summaryrefslogtreecommitdiffstats
path: root/Python/structmember.c
Commit message (Expand)AuthorAgeFilesLines
* SF bug http://sourceforge.net/bugs/?func=detailbug&bug_id=130242&group_id=5470Tim Peters2001-01-271-0/+1
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-11/+3
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
* Change copyright notice.Guido van Rossum2000-06-301-21/+6
* Trivial little change: when setting a member to an object, hold theGuido van Rossum1998-05-201-1/+3
* Quickly renamed the remaining files -- this directory is done.Guido van Rossum1997-04-291-78/+88
* Tweaks to keep the Microsoft compiler quier.Guido van Rossum1997-04-091-6/+8
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-12/+19
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
* - Added ability to get at strings embedded in the structJack Jansen1994-12-141-1/+23
* Merge back to main trunkGuido van Rossum1994-08-301-1/+6
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+2
* Added new types to setattr() as well...Guido van Rossum1992-06-031-0/+52
* Copyright for 1992 addedGuido van Rossum1992-04-051-1/+1
* Use new exceptions.Guido van Rossum1991-12-101-3/+3
* Added __members__ secret attributeGuido van Rossum1991-10-201-0/+25
* Added copyright notice.Guido van Rossum1991-02-191-0/+24
* Return -1 for errors.Guido van Rossum1990-12-201-1/+1
* "Compiling" versionGuido van Rossum1990-12-201-0/+134
table summary='file diffstat' width='100%'> -rw-r--r--.gitlab/ci/configure_hip6.3_nvidia.cmake (renamed from .gitlab/ci/configure_hip5.5_nvidia.cmake)0
-rw-r--r--.gitlab/ci/configure_hip6.3_radeon.cmake (renamed from .gitlab/ci/configure_hip5.5_radeon.cmake)0
-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.cmake7
-rw-r--r--.gitlab/ci/configure_macos_common.cmake6
-rw-r--r--.gitlab/ci/configure_macos_x86_64_ninja.cmake7
-rw-r--r--.gitlab/ci/configure_nvhpc_ninja.cmake3
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_i18n.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake4
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_ninja_multi.cmake1
-rw-r--r--.gitlab/ci/ctest_exclusions.cmake14
-rw-r--r--.gitlab/ci/docker/cuda12.6/Dockerfile9
-rwxr-xr-x.gitlab/ci/docker/cuda12.6/install_deps.sh21
-rw-r--r--.gitlab/ci/docker/cuda12.6/llvm-snapshot.gpg.key52
-rw-r--r--.gitlab/ci/docker/cuda12.6/llvm.list2
-rw-r--r--.gitlab/ci/docker/debian12-x86_64/Dockerfile2
-rw-r--r--.gitlab/ci/docker/debian12-x86_64/deps_packages.lst1
-rwxr-xr-x.gitlab/ci/docker/debian12-x86_64/install_deps.sh4
-rw-r--r--.gitlab/ci/docker/fedora41-hip/Dockerfile21
-rw-r--r--.gitlab/ci/docker/fedora41-hip/dnf.conf32
-rwxr-xr-x.gitlab/ci/docker/fedora41-hip/install_deps.sh10
-rw-r--r--.gitlab/ci/docker/fedora41/Dockerfile121
-rwxr-xr-x.gitlab/ci/docker/fedora41/build_iwyu.sh33
-rwxr-xr-x.gitlab/ci/docker/fedora41/build_rbenv.sh28
-rwxr-xr-x.gitlab/ci/docker/fedora41/build_rust.sh10
-rwxr-xr-x.gitlab/ci/docker/fedora41/build_rvm.sh41
-rw-r--r--.gitlab/ci/docker/fedora41/deps_packages.lst45
-rw-r--r--.gitlab/ci/docker/fedora41/dnf.conf32
-rwxr-xr-x.gitlab/ci/docker/fedora41/install_deps.sh18
-rwxr-xr-x.gitlab/ci/docker/fedora41/install_iwyu.sh30
-rwxr-xr-x.gitlab/ci/docker/fedora41/install_rvm.sh25
-rw-r--r--.gitlab/ci/docker/fedora41/iwyu_packages.lst8
-rw-r--r--.gitlab/ci/docker/fedora41/rbenv_packages.lst18
-rw-r--r--.gitlab/ci/docker/fedora41/rust_packages.lst1
-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--.gitlab/ci/docker/hip5.5/Dockerfile37
-rw-r--r--.gitlab/ci/docker/hip5.5/deps_packages.lst21
-rw-r--r--.gitlab/ci/docker/hip6.3/Dockerfile37
-rw-r--r--.gitlab/ci/docker/hip6.3/deps_packages.lst23
-rw-r--r--.gitlab/ci/docker/hip6.3/docker-clean (renamed from .gitlab/ci/docker/hip5.5/docker-clean)0
-rw-r--r--.gitlab/ci/docker/hip6.3/dpkg-exclude (renamed from .gitlab/ci/docker/hip5.5/dpkg-exclude)0
-rwxr-xr-x.gitlab/ci/docker/hip6.3/install_deps.sh (renamed from .gitlab/ci/docker/hip5.5/install_deps.sh)0
-rw-r--r--.gitlab/ci/docker/nvhpc22.11/Dockerfile6
-rw-r--r--.gitlab/ci/docker/nvhpc24.9/Dockerfile6
-rwxr-xr-x.gitlab/ci/docker/nvhpc24.9/install_deps.sh (renamed from .gitlab/ci/docker/nvhpc22.11/install_deps.sh)0
-rw-r--r--.gitlab/ci/env_cuda12.2_nvidia_clang.sh5
-rw-r--r--.gitlab/ci/env_cuda12.6_clang.sh3
-rw-r--r--.gitlab/ci/env_cuda12.6_nvidia_clang.sh5
-rw-r--r--.gitlab/ci/env_hip5.5_nvidia.sh4
-rw-r--r--.gitlab/ci/env_hip6.3_nvidia.sh4
-rw-r--r--.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps11
-rw-r--r--.gitlab/ci/iar-env.sh4
-rw-r--r--.gitlab/ci/iar.ps12
-rw-r--r--.gitlab/ci/package_windows_build.cmake3
-rw-r--r--.gitlab/ci/repackage/iar.ps115
-rwxr-xr-x.gitlab/ci/typos.bash23
-rw-r--r--.gitlab/os-linux.yml135
-rw-r--r--.gitlab/os-macos.yml14
-rw-r--r--.gitlab/os-windows.yml2
-rw-r--r--.gitlab/rules.yml14
-rw-r--r--.hooks-config2
-rw-r--r--.pre-commit-config.yaml146
-rw-r--r--.typos.toml72
-rw-r--r--Auxiliary/cmake-mode.el6
-rw-r--r--Auxiliary/cmake.m42
-rw-r--r--Auxiliary/vim/.gitattributes1
-rw-r--r--Auxiliary/vim/syntax/cmake.vim15
-rw-r--r--CMakeCPack.cmake10
-rw-r--r--CMakeLists.txt28
-rw-r--r--CONTRIBUTING.rst4
-rw-r--r--CONTRIBUTORS.rst100
-rw-r--r--CTestConfig.cmake2
-rw-r--r--CompileFlags.cmake2
-rw-r--r--Copyright.txt136
-rw-r--r--DartConfig.cmake2
-rw-r--r--Help/command/DEPRECATED_POLICY_VERSIONS.txt8
-rw-r--r--Help/command/FIND_XXX.txt4
-rw-r--r--Help/command/LINK_LIBRARIES_LINKER.txt24
-rw-r--r--Help/command/POLICY_VERSION.txt16
-rw-r--r--Help/command/add_custom_command.rst11
-rw-r--r--Help/command/add_custom_target.rst10
-rw-r--r--Help/command/add_dependencies.rst3
-rw-r--r--Help/command/add_executable.rst4
-rw-r--r--Help/command/add_library.rst9
-rw-r--r--Help/command/add_test.rst2
-rw-r--r--Help/command/block.rst6
-rw-r--r--Help/command/build_command.rst8
-rw-r--r--Help/command/cmake_host_system_information.rst12
-rw-r--r--Help/command/cmake_instrumentation.rst70
-rw-r--r--Help/command/cmake_minimum_required.rst33
-rw-r--r--Help/command/cmake_path.rst16
-rw-r--r--Help/command/cmake_pkg_config.rst2
-rw-r--r--Help/command/cmake_policy.rst9
-rw-r--r--Help/command/configure_file.rst2
-rw-r--r--Help/command/ctest_run_script.rst7
-rw-r--r--Help/command/ctest_submit.rst31
-rw-r--r--Help/command/define_property.rst16
-rw-r--r--Help/command/else.rst3
-rw-r--r--Help/command/enable_testing.rst10
-rw-r--r--Help/command/execute_process.rst58
-rw-r--r--Help/command/file.rst13
-rw-r--r--Help/command/find_library.rst6
-rw-r--r--Help/command/find_package.rst348
-rw-r--r--Help/command/fltk_wrap_ui.rst2
-rw-r--r--Help/command/foreach.rst4
-rw-r--r--Help/command/get_filename_component.rst22
-rw-r--r--Help/command/if.rst20
-rw-r--r--Help/command/include_regular_expression.rst8
-rw-r--r--Help/command/install.rst7
-rw-r--r--Help/command/list.rst20
-rw-r--r--Help/command/load_cache.rst116
-rw-r--r--Help/command/load_command.rst6
-rw-r--r--Help/command/separate_arguments.rst4
-rw-r--r--Help/command/set_source_files_properties.rst22
-rw-r--r--Help/command/string.rst14
-rw-r--r--Help/command/subdirs.rst2
-rw-r--r--Help/command/target_link_libraries.rst57
-rw-r--r--Help/command/try_compile.rst48
-rw-r--r--Help/command/try_run.rst15
-rw-r--r--Help/cpack_gen/archive.rst68
-rw-r--r--Help/cpack_gen/deb.rst20
-rw-r--r--Help/cpack_gen/ifw.rst14
-rw-r--r--Help/cpack_gen/nsis.rst18
-rw-r--r--Help/cpack_gen/rpm.rst36
-rw-r--r--Help/cpack_gen/wix.rst8
-rw-r--r--Help/dev/documentation.rst10
-rw-r--r--Help/dev/experimental.rst38
-rw-r--r--Help/dev/maint.rst11
-rw-r--r--Help/dev/source.rst37
-rw-r--r--Help/envvar/CLICOLOR.rst19
-rw-r--r--Help/envvar/CLICOLOR_FORCE.rst19
-rw-r--r--Help/envvar/CMAKE_EXPORT_BUILD_DATABASE.rst2
-rw-r--r--Help/envvar/CMAKE_POLICY_VERSION_MINIMUM.rst11
-rw-r--r--Help/envvar/CTEST_USE_INSTRUMENTATION.rst15
-rw-r--r--Help/envvar/CTEST_USE_VERBOSE_INSTRUMENTATION.rst17
-rw-r--r--Help/generator/Visual Studio 14 2015.rst17
-rw-r--r--Help/generator/Visual Studio 15 2017.rst17
-rw-r--r--Help/guide/importing-exporting/Downstream/main.cc4
-rw-r--r--Help/guide/importing-exporting/DownstreamComponents/main.cc6
-rw-r--r--Help/guide/importing-exporting/index.rst4
-rw-r--r--Help/guide/tutorial/A Basic Starting Point.rst5
-rw-r--r--Help/guide/tutorial/Adding a Library.rst2
-rw-r--r--Help/guide/tutorial/Complete/CMakeLists.txt2
-rw-r--r--Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx2
-rw-r--r--Help/guide/tutorial/Complete/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Packaging Debug and Release.rst2
-rw-r--r--Help/guide/tutorial/Step1/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx2
-rw-r--r--Help/guide/tutorial/Step10/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx2
-rw-r--r--Help/guide/tutorial/Step11/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx2
-rw-r--r--Help/guide/tutorial/Step12/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step2/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step3/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step4/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step5/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step6/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step7/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx2
-rw-r--r--Help/guide/tutorial/Step8/tutorial.cxx4
-rw-r--r--Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx2
-rw-r--r--Help/guide/tutorial/Step9/tutorial.cxx4
-rw-r--r--Help/include/COMPILE_DEFINITIONS_DISCLAIMER.txt16
-rw-r--r--Help/index.rst1
-rw-r--r--Help/manual/OPTIONS_BUILD.txt19
-rw-r--r--Help/manual/cmake-buildsystem.7.rst209
-rw-r--r--Help/manual/cmake-commands.7.rst3
-rw-r--r--Help/manual/cmake-configure-log.7.rst4
-rw-r--r--Help/manual/cmake-cxxmodules.7.rst3
-rw-r--r--Help/manual/cmake-developer.7.rst23
-rw-r--r--Help/manual/cmake-env-variables.7.rst5
-rw-r--r--Help/manual/cmake-file-api.7.rst20
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst16
-rw-r--r--Help/manual/cmake-instrumentation.7.rst466
-rw-r--r--Help/manual/cmake-modules.7.rst6
-rw-r--r--Help/manual/cmake-packages.7.rst4
-rw-r--r--Help/manual/cmake-policies.7.rst221
-rw-r--r--Help/manual/cmake-presets.7.rst4
-rw-r--r--Help/manual/cmake-properties.7.rst11
-rw-r--r--Help/manual/cmake-variables.7.rst27
-rw-r--r--Help/manual/cmake.1.rst28
-rw-r--r--Help/manual/ctest.1.rst46
-rw-r--r--Help/policy/CMP0000.rst21
-rw-r--r--Help/policy/CMP0001.rst11
-rw-r--r--Help/policy/CMP0002.rst19
-rw-r--r--Help/policy/CMP0003.rst19
-rw-r--r--Help/policy/CMP0004.rst11
-rw-r--r--Help/policy/CMP0005.rst9
-rw-r--r--Help/policy/CMP0006.rst9
-rw-r--r--Help/policy/CMP0007.rst9
-rw-r--r--Help/policy/CMP0008.rst11
-rw-r--r--Help/policy/CMP0009.rst9
-rw-r--r--Help/policy/CMP0010.rst9
-rw-r--r--Help/policy/CMP0011.rst9
-rw-r--r--Help/policy/CMP0012.rst9
-rw-r--r--Help/policy/CMP0013.rst9
-rw-r--r--Help/policy/CMP0014.rst9
-rw-r--r--Help/policy/CMP0015.rst11
-rw-r--r--Help/policy/CMP0016.rst9
-rw-r--r--Help/policy/CMP0017.rst9
-rw-r--r--Help/policy/CMP0018.rst9
-rw-r--r--Help/policy/CMP0019.rst9
-rw-r--r--Help/policy/CMP0020.rst9
-rw-r--r--Help/policy/CMP0021.rst9
-rw-r--r--Help/policy/CMP0022.rst9
-rw-r--r--Help/policy/CMP0023.rst11
-rw-r--r--Help/policy/CMP0024.rst9
-rw-r--r--Help/policy/CMP0025.rst11
-rw-r--r--Help/policy/CMP0026.rst9
-rw-r--r--Help/policy/CMP0027.rst9
-rw-r--r--Help/policy/CMP0028.rst9
-rw-r--r--Help/policy/CMP0029.rst7
-rw-r--r--Help/policy/CMP0030.rst7
-rw-r--r--Help/policy/CMP0031.rst7
-rw-r--r--Help/policy/CMP0032.rst7
-rw-r--r--Help/policy/CMP0033.rst7
-rw-r--r--Help/policy/CMP0034.rst7
-rw-r--r--Help/policy/CMP0035.rst7
-rw-r--r--Help/policy/CMP0036.rst7
-rw-r--r--Help/policy/CMP0037.rst9
-rw-r--r--Help/policy/CMP0038.rst9
-rw-r--r--Help/policy/CMP0039.rst9
-rw-r--r--Help/policy/CMP0040.rst9
-rw-r--r--Help/policy/CMP0041.rst9
-rw-r--r--Help/policy/CMP0042.rst9
-rw-r--r--Help/policy/CMP0043.rst9
-rw-r--r--Help/policy/CMP0044.rst9
-rw-r--r--Help/policy/CMP0045.rst9
-rw-r--r--Help/policy/CMP0046.rst9
-rw-r--r--Help/policy/CMP0047.rst11
-rw-r--r--Help/policy/CMP0048.rst9
-rw-r--r--Help/policy/CMP0049.rst9
-rw-r--r--Help/policy/CMP0050.rst9
-rw-r--r--Help/policy/CMP0051.rst9
-rw-r--r--Help/policy/CMP0052.rst9
-rw-r--r--Help/policy/CMP0053.rst9
-rw-r--r--Help/policy/CMP0054.rst17
-rw-r--r--Help/policy/CMP0055.rst9
-rw-r--r--Help/policy/CMP0056.rst11
-rw-r--r--Help/policy/CMP0057.rst9
-rw-r--r--Help/policy/CMP0058.rst13
-rw-r--r--Help/policy/CMP0059.rst9
-rw-r--r--Help/policy/CMP0060.rst11
-rw-r--r--Help/policy/CMP0061.rst9
-rw-r--r--Help/policy/CMP0062.rst9
-rw-r--r--Help/policy/CMP0063.rst9
-rw-r--r--Help/policy/CMP0064.rst9
-rw-r--r--Help/policy/CMP0065.rst11
-rw-r--r--Help/policy/CMP0071.rst4
-rw-r--r--Help/policy/CMP0112.rst24
-rw-r--r--Help/policy/CMP0120.rst2
-rw-r--r--Help/policy/CMP0141.rst4
-rw-r--r--Help/policy/CMP0143.rst2
-rw-r--r--Help/policy/CMP0147.rst3
-rw-r--r--Help/policy/CMP0168.rst2
-rw-r--r--Help/policy/CMP0181.rst41
-rw-r--r--Help/policy/CMP0182.rst31
-rw-r--r--Help/policy/CMP0183.rst33
-rw-r--r--Help/policy/CMP0184.rst54
-rw-r--r--Help/policy/CMP0185.rst25
-rw-r--r--Help/policy/REMOVED_COMMAND.txt8
-rw-r--r--Help/policy/REMOVED_EPILOGUE.txt4
-rw-r--r--Help/policy/REMOVED_PROLOGUE.txt5
-rw-r--r--Help/prop_cache/TYPE.rst21
-rw-r--r--Help/prop_dir/EXCLUDE_FROM_ALL.rst2
-rw-r--r--Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst4
-rw-r--r--Help/prop_dir/VS_SOLUTION_ITEMS.rst19
-rw-r--r--Help/prop_gbl/CMAKE_ROLE.rst5
-rw-r--r--Help/prop_gbl/DISABLED_FEATURES.rst2
-rw-r--r--Help/prop_gbl/ENABLED_FEATURES.rst2
-rw-r--r--Help/prop_gbl/INSTALL_PARALLEL.rst4
-rw-r--r--Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst2
-rw-r--r--Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst2
-rw-r--r--Help/prop_inst/CPACK_WIX_ACL.rst5
-rw-r--r--Help/prop_sf/COMPILE_DEFINITIONS.rst4
-rw-r--r--Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst8
-rw-r--r--Help/prop_sf/VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD.rst9
-rw-r--r--Help/prop_sf/VS_SHADER_OBJECT_FILE_NAME.rst5
-rw-r--r--Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst4
-rw-r--r--Help/prop_test/ENVIRONMENT_MODIFICATION.rst40
-rw-r--r--Help/prop_tgt/AIX_SHARED_LIBRARY_ARCHIVE.rst30
-rw-r--r--Help/prop_tgt/AUTOMOC.rst4
-rw-r--r--Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst28
-rw-r--r--Help/prop_tgt/CXX_MODULE_STD.rst8
-rw-r--r--Help/prop_tgt/CXX_STANDARD_REQUIRED.rst2
-rw-r--r--Help/prop_tgt/DEBUGGER_WORKING_DIRECTORY.rst18
-rw-r--r--Help/prop_tgt/EXPORT_BUILD_DATABASE.rst2
-rw-r--r--Help/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES.rst15
-rw-r--r--Help/prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES.rst16
-rw-r--r--Help/prop_tgt/GHS_INTEGRITY_APP.rst4
-rw-r--r--Help/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst4
-rw-r--r--Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst3
-rw-r--r--Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst2
-rw-r--r--Help/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT.rst8
-rw-r--r--Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst6
-rw-r--r--Help/prop_tgt/LANG_VISIBILITY_PRESET.rst4
-rw-r--r--Help/prop_tgt/LINK_LIBRARIES.rst2
-rw-r--r--Help/prop_tgt/LINK_WARNING_AS_ERROR.rst41
-rw-r--r--Help/prop_tgt/LINK_WHAT_YOU_USE.rst17
-rw-r--r--Help/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT.rst2
-rw-r--r--Help/prop_tgt/MSVC_RUNTIME_CHECKS-VALUES.txt16
-rw-r--r--Help/prop_tgt/MSVC_RUNTIME_CHECKS.rst34
-rw-r--r--Help/prop_tgt/POSITION_INDEPENDENT_CODE.rst8
-rw-r--r--Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst2
-rw-r--r--Help/prop_tgt/STATIC_LIBRARY_OPTIONS_ARCHIVER.txt23
-rw-r--r--Help/prop_tgt/Swift_MODULE_DIRECTORY.rst16
-rw-r--r--Help/prop_tgt/UNITY_BUILD_RELOCATABLE.rst39
-rw-r--r--Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst2
-rw-r--r--Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst2
-rw-r--r--Help/prop_tgt/VS_PROJECT_IMPORT.rst14
-rw-r--r--Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst23
-rw-r--r--Help/prop_tgt/XCODE_GENERATE_SCHEME.rst4
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst4
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_LLDB_INIT_FILE.rst15
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION.rst13
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst2
-rw-r--r--Help/release/3.0.rst8
-rw-r--r--Help/release/3.1.rst20
-rw-r--r--Help/release/3.11.rst4
-rw-r--r--Help/release/3.14.rst36
-rw-r--r--Help/release/3.17.rst2
-rw-r--r--Help/release/3.3.rst2
-rw-r--r--Help/release/3.30.rst2
-rw-r--r--Help/release/3.5.rst2
-rw-r--r--Help/release/3.6.rst4
-rw-r--r--Help/release/3.8.rst2
-rw-r--r--Help/release/4.0.rst303
-rw-r--r--Help/release/index.rst1
-rw-r--r--Help/variable/AIX.rst6
-rw-r--r--Help/variable/BUILD_TESTING.rst27
-rw-r--r--Help/variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE.rst2
-rw-r--r--Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst4
-rw-r--r--Help/variable/CMAKE_BACKWARDS_COMPATIBILITY.rst2
-rw-r--r--Help/variable/CMAKE_CFG_INTDIR.rst19
-rw-r--r--Help/variable/CMAKE_COLOR_DIAGNOSTICS.rst5
-rw-r--r--Help/variable/CMAKE_CURRENT_FUNCTION_LIST_DIR.rst5
-rw-r--r--Help/variable/CMAKE_CURRENT_FUNCTION_LIST_FILE.rst5
-rw-r--r--Help/variable/CMAKE_CURRENT_FUNCTION_LIST_LINE.rst5
-rw-r--r--Help/variable/CMAKE_CURRENT_LIST_DIR.rst3
-rw-r--r--Help/variable/CMAKE_CURRENT_LIST_FILE.rst3
-rw-r--r--Help/variable/CMAKE_CURRENT_LIST_LINE.rst2
-rw-r--r--Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst2
-rw-r--r--Help/variable/CMAKE_CXX_MODULE_STD.rst2
-rw-r--r--Help/variable/CMAKE_DEBUGGER_WORKING_DIRECTORY.rst8
-rw-r--r--Help/variable/CMAKE_DEBUG_POSTFIX.rst2
-rw-r--r--Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst2
-rw-r--r--Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL.rst9
-rw-r--r--Help/variable/CMAKE_EXE_LINKER_FLAGS.rst2
-rw-r--r--Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst2
-rw-r--r--Help/variable/CMAKE_EXPORT_BUILD_DATABASE.rst2
-rw-r--r--Help/variable/CMAKE_EXPORT_SARIF.rst81
-rw-r--r--Help/variable/CMAKE_HOST_AIX.rst6
-rw-r--r--Help/variable/CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst4
-rw-r--r--Help/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX.rst4
-rw-r--r--Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG.rst17
-rw-r--r--Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG_SEP.rst11
-rw-r--r--Help/variable/CMAKE_LANG_DEVICE_LINK_MODE.rst14
-rw-r--r--Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst8
-rw-r--r--Help/variable/CMAKE_LANG_LINK_MODE.rst14
-rw-r--r--Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst12
-rw-r--r--Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst15
-rw-r--r--Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst23
-rw-r--r--Help/variable/CMAKE_LINK_WARNING_AS_ERROR.rst9
-rw-r--r--Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst3
-rw-r--r--Help/variable/CMAKE_LIST_FILE_NAME.rst23
-rw-r--r--Help/variable/CMAKE_MODULE_LINKER_FLAGS.rst2
-rw-r--r--Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst2
-rw-r--r--Help/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.rst2
-rw-r--r--Help/variable/CMAKE_MSVC_RUNTIME_CHECKS.rst36
-rw-r--r--Help/variable/CMAKE_OBJDUMP.rst16
-rw-r--r--Help/variable/CMAKE_OSX_SYSROOT.rst30
-rw-r--r--Help/variable/CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED.rst9
-rw-r--r--Help/variable/CMAKE_PKG_CONFIG_PC_LIB_DIRS.rst8
-rw-r--r--Help/variable/CMAKE_PKG_CONFIG_PC_PATH.rst8
-rw-r--r--Help/variable/CMAKE_PKG_CONFIG_SYSROOT_DIR.rst8
-rw-r--r--Help/variable/CMAKE_PKG_CONFIG_TOP_BUILD_DIR.rst7
-rw-r--r--Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst3
-rw-r--r--Help/variable/CMAKE_POLICY_VERSION_MINIMUM.rst27
-rw-r--r--Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst20
-rw-r--r--Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst6
-rw-r--r--Help/variable/CMAKE_SCRIPT_MODE_FILE.rst5
-rw-r--r--Help/variable/CMAKE_SHARED_LINKER_FLAGS.rst2
-rw-r--r--Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst2
-rw-r--r--Help/variable/CMAKE_UNITY_BUILD_RELOCATABLE.rst9
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION.rst2
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst6
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION.rst2
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst2
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_LLDB_INIT_FILE.rst13
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION.rst12
-rw-r--r--Help/variable/CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst2
-rw-r--r--Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst2
-rw-r--r--Help/variable/CPACK_SET_DESTDIR.rst2
-rw-r--r--Help/variable/CTEST_EXTRA_SUBMIT_FILES.rst5
-rw-r--r--Help/variable/CTEST_NOTES_FILES.rst5
-rw-r--r--Help/variable/CTEST_RUN_CURRENT_SCRIPT.rst6
-rw-r--r--Help/variable/LINKER_FLAGS.txt5
-rw-r--r--Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt20
-rw-r--r--Help/variable/MSVC_TOOLSET_VERSION.rst27
-rw-r--r--Help/variable/MSVC_VERSION.rst33
-rw-r--r--LICENSE.rst28
-rw-r--r--Modules/AddFileDependencies.cmake2
-rw-r--r--Modules/AndroidTestUtilities.cmake2
-rw-r--r--Modules/AndroidTestUtilities/PushToAndroidDevice.cmake34
-rw-r--r--Modules/BundleUtilities.cmake335
-rw-r--r--Modules/CMake.cmake2
-rw-r--r--Modules/CMakeASM-ATTInformation.cmake2
-rw-r--r--Modules/CMakeASMInformation.cmake4
-rw-r--r--Modules/CMakeASM_MARMASMInformation.cmake9
-rw-r--r--Modules/CMakeASM_MASMInformation.cmake9
-rw-r--r--Modules/CMakeASM_NASMInformation.cmake2
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake4
-rw-r--r--Modules/CMakeAddNewLanguage.txt2
-rw-r--r--Modules/CMakeBackwardCompatibilityC.cmake27
-rw-r--r--Modules/CMakeBackwardCompatibilityCXX.cmake3
-rw-r--r--Modules/CMakeBorlandFindMake.cmake2
-rw-r--r--Modules/CMakeCCompiler.cmake.in1
-rw-r--r--Modules/CMakeCCompilerId.c.in2
-rw-r--r--Modules/CMakeCInformation.cmake2
-rw-r--r--Modules/CMakeCSharpInformation.cmake2
-rw-r--r--Modules/CMakeCUDAInformation.cmake2
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in2
-rw-r--r--Modules/CMakeCXXInformation.cmake2
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake6
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake2
-rw-r--r--Modules/CMakeCompilerABI.h2
-rw-r--r--Modules/CMakeCompilerCUDAArch.h2
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake2
-rw-r--r--Modules/CMakeDependentOption.cmake23
-rw-r--r--Modules/CMakeDetermineASM-ATTCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineASM_MARMASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineASM_MASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineASM_NASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCSharpCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompiler.cmake30
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake19
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake67
-rw-r--r--Modules/CMakeDetermineCompilerSupport.cmake2
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineHIPCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineISPCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineJavaCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineOBJCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineOBJCXXCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineRCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineSwiftCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineSystem.cmake29
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake10
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake6
-rw-r--r--Modules/CMakeExportBuildSettings.cmake2
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake2
-rw-r--r--Modules/CMakeFindBinUtils.cmake8
-rw-r--r--Modules/CMakeFindCodeBlocks.cmake2
-rw-r--r--Modules/CMakeFindDependencyMacro.cmake6
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake2
-rw-r--r--Modules/CMakeFindFrameworks.cmake2
-rw-r--r--Modules/CMakeFindJavaCommon.cmake2
-rw-r--r--Modules/CMakeFindKate.cmake2
-rw-r--r--Modules/CMakeFindPackageMode.cmake2
-rw-r--r--Modules/CMakeFindSublimeText2.cmake2
-rw-r--r--Modules/CMakeFindWMake.cmake2
-rw-r--r--Modules/CMakeFindXCode.cmake2
-rw-r--r--Modules/CMakeForceCompiler.cmake10
-rw-r--r--Modules/CMakeFortranInformation.cmake2
-rw-r--r--Modules/CMakeGenericSystem.cmake2
-rw-r--r--Modules/CMakeGraphVizOptions.cmake2
-rw-r--r--Modules/CMakeHIPInformation.cmake2
-rw-r--r--Modules/CMakeIOSInstallCombined.cmake13
-rw-r--r--Modules/CMakeISPCInformation.cmake2
-rw-r--r--Modules/CMakeImportBuildSettings.cmake2
-rw-r--r--Modules/CMakeInitializeConfigs.cmake2
-rw-r--r--Modules/CMakeJOMFindMake.cmake2
-rw-r--r--Modules/CMakeJavaInformation.cmake2
-rw-r--r--Modules/CMakeLanguageInformation.cmake2
-rw-r--r--Modules/CMakeMSYSFindMake.cmake2
-rw-r--r--Modules/CMakeMinGWFindMake.cmake2
-rw-r--r--Modules/CMakeNMakeFindMake.cmake2
-rw-r--r--Modules/CMakeNinjaFindMake.cmake2
-rw-r--r--Modules/CMakeOBJCCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCCompilerId.m.in2
-rw-r--r--Modules/CMakeOBJCInformation.cmake2
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCXXCompilerId.mm.in2
-rw-r--r--Modules/CMakeOBJCXXInformation.cmake2
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake11
-rw-r--r--Modules/CMakeParseArguments.cmake4
-rw-r--r--Modules/CMakeParseImplicitIncludeInfo.cmake2
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake10
-rw-r--r--Modules/CMakeParseLibraryArchitecture.cmake8
-rw-r--r--Modules/CMakePlatformId.h.in2
-rw-r--r--Modules/CMakePrintHelpers.cmake75
-rw-r--r--Modules/CMakePrintSystemInformation.cmake2
-rw-r--r--Modules/CMakePushCheckState.cmake148
-rw-r--r--Modules/CMakeRCInformation.cmake2
-rw-r--r--Modules/CMakeSwiftCompiler.cmake.in2
-rw-r--r--Modules/CMakeSwiftInformation.cmake2
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake2
-rw-r--r--Modules/CMakeSystemSpecificInitialize.cmake3
-rw-r--r--Modules/CMakeTestASM-ATTCompiler.cmake2
-rw-r--r--Modules/CMakeTestASMCompiler.cmake2
-rw-r--r--Modules/CMakeTestASM_MARMASMCompiler.cmake2
-rw-r--r--Modules/CMakeTestASM_MASMCompiler.cmake2
-rw-r--r--Modules/CMakeTestASM_NASMCompiler.cmake2
-rw-r--r--Modules/CMakeTestCCompiler.cmake2
-rw-r--r--Modules/CMakeTestCSharpCompiler.cmake2
-rw-r--r--Modules/CMakeTestCUDACompiler.cmake2
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake2
-rw-r--r--Modules/CMakeTestCompilerCommon.cmake2
-rw-r--r--Modules/CMakeTestFortranCompiler.cmake2
-rw-r--r--Modules/CMakeTestHIPCompiler.cmake2
-rw-r--r--Modules/CMakeTestISPCCompiler.cmake2
-rw-r--r--Modules/CMakeTestJavaCompiler.cmake2
-rw-r--r--Modules/CMakeTestOBJCCompiler.cmake2
-rw-r--r--Modules/CMakeTestOBJCXXCompiler.cmake2
-rw-r--r--Modules/CMakeTestRCCompiler.cmake2
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake2
-rw-r--r--Modules/CMakeUnixFindMake.cmake12
-rw-r--r--Modules/CMakeVerifyManifest.cmake39
-rw-r--r--Modules/CPack.cmake18
-rw-r--r--Modules/CPackComponent.cmake14
-rw-r--r--Modules/CPackIFW.cmake16
-rw-r--r--Modules/CPackIFWConfigureFile.cmake4
-rw-r--r--Modules/CSharpUtilities.cmake50
-rw-r--r--Modules/CTest.cmake29
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake4
-rw-r--r--Modules/CTestScriptMode.cmake3
-rw-r--r--Modules/CTestTargets.cmake2
-rw-r--r--Modules/CTestUseLaunchers.cmake4
-rw-r--r--Modules/CXX-DetectStdlib.h2
-rw-r--r--Modules/CheckCCompilerFlag.cmake2
-rw-r--r--Modules/CheckCSourceCompiles.cmake2
-rw-r--r--Modules/CheckCSourceRuns.cmake8
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake4
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake2
-rw-r--r--Modules/CheckCXXSourceRuns.cmake8
-rw-r--r--Modules/CheckCXXSymbolExists.cmake2
-rw-r--r--Modules/CheckCompilerFlag.cmake2
-rw-r--r--Modules/CheckFortranCompilerFlag.cmake2
-rw-r--r--Modules/CheckFortranFunctionExists.cmake6
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake2
-rw-r--r--Modules/CheckFortranSourceRuns.cmake8
-rw-r--r--Modules/CheckFunctionExists.cmake2
-rw-r--r--Modules/CheckIPOSupported.cmake28
-rw-r--r--Modules/CheckIncludeFile.cmake6
-rw-r--r--Modules/CheckIncludeFileCXX.cmake6
-rw-r--r--Modules/CheckIncludeFiles.cmake6
-rw-r--r--Modules/CheckLanguage.cmake2
-rw-r--r--Modules/CheckLibraryExists.cmake52
-rw-r--r--Modules/CheckLinkerFlag.cmake2
-rw-r--r--Modules/CheckOBJCCompilerFlag.cmake2
-rw-r--r--Modules/CheckOBJCSourceCompiles.cmake2
-rw-r--r--Modules/CheckOBJCSourceRuns.cmake8
-rw-r--r--Modules/CheckOBJCXXCompilerFlag.cmake2
-rw-r--r--Modules/CheckOBJCXXSourceCompiles.cmake2
-rw-r--r--Modules/CheckOBJCXXSourceRuns.cmake8
-rw-r--r--Modules/CheckPIESupported.cmake7
-rw-r--r--Modules/CheckPrototypeDefinition.cmake70
-rw-r--r--Modules/CheckSizeOf.cmake2
-rw-r--r--Modules/CheckSourceCompiles.cmake2
-rw-r--r--Modules/CheckSourceRuns.cmake8
-rw-r--r--Modules/CheckStructHasMember.cmake34
-rw-r--r--Modules/CheckSymbolExists.cmake7
-rw-r--r--Modules/CheckTypeSize.cmake60
-rw-r--r--Modules/CheckVariableExists.cmake15
-rw-r--r--Modules/Compiler/ADSP.cmake2
-rw-r--r--Modules/Compiler/ARMCC.cmake2
-rw-r--r--Modules/Compiler/ARMClang.cmake7
-rw-r--r--Modules/Compiler/Absoft-Fortran.cmake2
-rw-r--r--Modules/Compiler/AppleClang-CXX-FeatureTests.cmake2
-rw-r--r--Modules/Compiler/Bruce-C.cmake2
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake2
-rw-r--r--Modules/Compiler/Clang-C.cmake5
-rw-r--r--Modules/Compiler/Clang-CUDA.cmake2
-rw-r--r--Modules/Compiler/Clang-CXX.cmake5
-rw-r--r--Modules/Compiler/Clang.cmake6
-rw-r--r--Modules/Compiler/Cray-C.cmake2
-rw-r--r--Modules/Compiler/Cray-CXX.cmake2
-rw-r--r--Modules/Compiler/Cray-Fortran.cmake2
-rw-r--r--Modules/Compiler/Cray.cmake4
-rw-r--r--Modules/Compiler/CrayClang-C.cmake2
-rw-r--r--Modules/Compiler/CrayClang-CXX.cmake2
-rw-r--r--Modules/Compiler/CrayClang.cmake2
-rw-r--r--Modules/Compiler/CrayPrgEnv.cmake5
-rw-r--r--Modules/Compiler/Fujitsu-C.cmake2
-rw-r--r--Modules/Compiler/Fujitsu-CXX.cmake2
-rw-r--r--Modules/Compiler/Fujitsu.cmake4
-rw-r--r--Modules/Compiler/FujitsuClang.cmake2
-rw-r--r--Modules/Compiler/G95-Fortran.cmake2
-rw-r--r--Modules/Compiler/GNU.cmake4
-rw-r--r--Modules/Compiler/HP-C.cmake2
-rw-r--r--Modules/Compiler/HP-CXX.cmake2
-rw-r--r--Modules/Compiler/IAR-CXX.cmake5
-rw-r--r--Modules/Compiler/IAR.cmake2
-rw-r--r--Modules/Compiler/IBMClang-ASM.cmake6
-rw-r--r--Modules/Compiler/IBMClang-C-DetermineCompiler.cmake1
-rw-r--r--Modules/Compiler/IBMClang-C.cmake7
-rw-r--r--Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake1
-rw-r--r--Modules/Compiler/IBMClang-CXX.cmake42
-rw-r--r--Modules/Compiler/IBMClang-FindBinUtils.cmake1
-rw-r--r--Modules/Compiler/IBMClang.cmake58
-rw-r--r--Modules/Compiler/Intel.cmake6
-rw-r--r--Modules/Compiler/IntelLLVM.cmake6
-rw-r--r--Modules/Compiler/LCC.cmake4
-rw-r--r--Modules/Compiler/LFortran-Fortran.cmake2
-rw-r--r--Modules/Compiler/LLVMFlang-Fortran.cmake6
-rw-r--r--Modules/Compiler/MSVC-C.cmake2
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake2
-rw-r--r--Modules/Compiler/MSVC.cmake4
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake2
-rw-r--r--Modules/Compiler/NVHPC.cmake5
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake2
-rw-r--r--Modules/Compiler/NVIDIA.cmake6
-rw-r--r--Modules/Compiler/OpenWatcom.cmake4
-rw-r--r--Modules/Compiler/OrangeC.cmake2
-rw-r--r--Modules/Compiler/PGI.cmake4
-rw-r--r--Modules/Compiler/PathScale.cmake4
-rw-r--r--Modules/Compiler/QCC.cmake2
-rw-r--r--Modules/Compiler/SCO.cmake4
-rw-r--r--Modules/Compiler/SunPro-C.cmake2
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake2
-rw-r--r--Modules/Compiler/SunPro.cmake4
-rw-r--r--Modules/Compiler/TI.cmake4
-rw-r--r--Modules/Compiler/TIClang.cmake2
-rw-r--r--Modules/Compiler/Tasking-ASM.cmake5
-rw-r--r--Modules/Compiler/Tasking-C.cmake10
-rw-r--r--Modules/Compiler/Tasking-CXX.cmake12
-rw-r--r--Modules/Compiler/Tasking-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/Tasking-FindBinUtils.cmake2
-rw-r--r--Modules/Compiler/Tasking.cmake16
-rw-r--r--Modules/Compiler/TinyCC-C.cmake2
-rw-r--r--Modules/Compiler/XL.cmake4
-rw-r--r--Modules/Compiler/XLClang.cmake2
-rw-r--r--Modules/Dart.cmake5
-rw-r--r--Modules/DeployQt4.cmake14
-rw-r--r--Modules/Documentation.cmake2
-rw-r--r--Modules/ExternalData.cmake95
-rw-r--r--Modules/ExternalProject.cmake57
-rw-r--r--Modules/ExternalProject/download.cmake.in2
-rw-r--r--Modules/ExternalProject/extractfile.cmake.in2
-rw-r--r--Modules/ExternalProject/gitclone.cmake.in2
-rw-r--r--Modules/ExternalProject/gitupdate.cmake.in2
-rw-r--r--Modules/ExternalProject/hgclone.cmake.in2
-rw-r--r--Modules/ExternalProject/mkdirs.cmake.in2
-rw-r--r--Modules/ExternalProject/shared_internal_commands.cmake1
-rw-r--r--Modules/ExternalProject/verify.cmake.in2
-rw-r--r--Modules/FLTKCompatibility.cmake2
-rw-r--r--Modules/FeatureSummary.cmake488
-rw-r--r--Modules/FetchContent.cmake2
-rw-r--r--Modules/FetchContent/CMakeLists.cmake.in2
-rw-r--r--Modules/FindALSA.cmake8
-rw-r--r--Modules/FindASPELL.cmake6
-rw-r--r--Modules/FindAVIFile.cmake6
-rw-r--r--Modules/FindArmadillo.cmake13
-rw-r--r--Modules/FindBISON.cmake134
-rw-r--r--Modules/FindBLAS.cmake6
-rw-r--r--Modules/FindBZip2.cmake12
-rw-r--r--Modules/FindBacktrace.cmake14
-rw-r--r--Modules/FindBoost.cmake5
-rw-r--r--Modules/FindBullet.cmake6
-rw-r--r--Modules/FindCABLE.cmake2
-rw-r--r--Modules/FindCUDA.cmake22
-rw-r--r--Modules/FindCUDA/parse_cubin.cmake2
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake4
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake2
-rw-r--r--Modules/FindCUDAToolkit.cmake14
-rw-r--r--Modules/FindCURL.cmake39
-rw-r--r--Modules/FindCVS.cmake6
-rw-r--r--Modules/FindCoin3D.cmake6
-rw-r--r--Modules/FindCups.cmake12
-rw-r--r--Modules/FindCurses.cmake14
-rw-r--r--Modules/FindCxxTest.cmake12
-rw-r--r--Modules/FindCygwin.cmake2
-rw-r--r--Modules/FindDCMTK.cmake4
-rw-r--r--Modules/FindDart.cmake6
-rw-r--r--Modules/FindDevIL.cmake8
-rw-r--r--Modules/FindDoxygen.cmake215
-rw-r--r--Modules/FindEXPAT.cmake6
-rw-r--r--Modules/FindEnvModules.cmake9
-rw-r--r--Modules/FindFLEX.cmake207
-rw-r--r--Modules/FindFLTK.cmake16
-rw-r--r--Modules/FindFLTK2.cmake10
-rw-r--r--Modules/FindFontconfig.cmake4
-rw-r--r--Modules/FindFreetype.cmake4
-rw-r--r--Modules/FindGCCXML.cmake2
-rw-r--r--Modules/FindGDAL.cmake26
-rw-r--r--Modules/FindGIF.cmake14
-rw-r--r--Modules/FindGLEW.cmake4
-rw-r--r--Modules/FindGLU.cmake2
-rw-r--r--Modules/FindGLUT.cmake8
-rw-r--r--Modules/FindGSL.cmake6
-rw-r--r--Modules/FindGTK.cmake2
-rw-r--r--Modules/FindGTK2.cmake12
-rw-r--r--Modules/FindGTest.cmake12
-rw-r--r--Modules/FindGettext.cmake104
-rw-r--r--Modules/FindGit.cmake4
-rw-r--r--Modules/FindGnuTLS.cmake10
-rw-r--r--Modules/FindGnuplot.cmake26
-rw-r--r--Modules/FindHDF5.cmake7
-rw-r--r--Modules/FindHSPELL.cmake6
-rw-r--r--Modules/FindHTMLHelp.cmake2
-rw-r--r--Modules/FindHg.cmake12
-rw-r--r--Modules/FindICU.cmake6
-rw-r--r--Modules/FindIce.cmake7
-rw-r--r--Modules/FindIconv.cmake4
-rw-r--r--Modules/FindIcotool.cmake6
-rw-r--r--Modules/FindImageMagick.cmake10
-rw-r--r--Modules/FindIntl.cmake7
-rw-r--r--Modules/FindJNI.cmake19
-rw-r--r--Modules/FindJPEG.cmake6
-rw-r--r--Modules/FindJasper.cmake6
-rw-r--r--Modules/FindJava.cmake6
-rw-r--r--Modules/FindKDE3.cmake2
-rw-r--r--Modules/FindKDE4.cmake2
-rw-r--r--Modules/FindLAPACK.cmake6
-rw-r--r--Modules/FindLATEX.cmake16
-rw-r--r--Modules/FindLTTngUST.cmake6
-rw-r--r--Modules/FindLibArchive.cmake4
-rw-r--r--Modules/FindLibLZMA.cmake10
-rw-r--r--Modules/FindLibXml2.cmake10
-rw-r--r--Modules/FindLibXslt.cmake12
-rw-r--r--Modules/FindLibinput.cmake4
-rw-r--r--Modules/FindLua.cmake15
-rw-r--r--Modules/FindLua50.cmake14
-rw-r--r--Modules/FindLua51.cmake14
-rw-r--r--Modules/FindMFC.cmake2
-rw-r--r--Modules/FindMPEG.cmake6
-rw-r--r--Modules/FindMPEG2.cmake6
-rw-r--r--Modules/FindMPI.cmake39
-rw-r--r--Modules/FindMPI/test_mpi.c2
-rw-r--r--Modules/FindMatlab.cmake16
-rw-r--r--Modules/FindMotif.cmake6
-rw-r--r--Modules/FindMsys.cmake2
-rw-r--r--Modules/FindODBC.cmake4
-rw-r--r--Modules/FindOpenACC.cmake4
-rw-r--r--Modules/FindOpenAL.cmake6
-rw-r--r--Modules/FindOpenCL.cmake15
-rw-r--r--Modules/FindOpenGL.cmake8
-rw-r--r--Modules/FindOpenMP.cmake47
-rw-r--r--Modules/FindOpenSP.cmake5
-rw-r--r--Modules/FindOpenSSL.cmake43
-rw-r--r--Modules/FindOpenSceneGraph.cmake10
-rw-r--r--Modules/FindOpenThreads.cmake6
-rw-r--r--Modules/FindPHP4.cmake6
-rw-r--r--Modules/FindPNG.cmake6
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake199
-rw-r--r--Modules/FindPackageMessage.cmake2
-rw-r--r--Modules/FindPatch.cmake18
-rw-r--r--Modules/FindPerl.cmake6
-rw-r--r--Modules/FindPerlLibs.cmake4
-rw-r--r--Modules/FindPhysFS.cmake6
-rw-r--r--Modules/FindPike.cmake2
-rw-r--r--Modules/FindPkgConfig.cmake20
-rw-r--r--Modules/FindPostgreSQL.cmake8
-rw-r--r--Modules/FindProducer.cmake6
-rw-r--r--Modules/FindProtobuf.cmake123
-rw-r--r--Modules/FindPython.cmake141
-rw-r--r--Modules/FindPython/Support.cmake428
-rw-r--r--Modules/FindPython2.cmake60
-rw-r--r--Modules/FindPython3.cmake68
-rw-r--r--Modules/FindPythonInterp.cmake6
-rw-r--r--Modules/FindPythonLibs.cmake12
-rw-r--r--Modules/FindQt.cmake2
-rw-r--r--Modules/FindQt3.cmake6
-rw-r--r--Modules/FindQt4.cmake27
-rw-r--r--Modules/FindQuickTime.cmake6
-rw-r--r--Modules/FindRTI.cmake8
-rw-r--r--Modules/FindRuby.cmake685
-rw-r--r--Modules/FindSDL.cmake8
-rw-r--r--Modules/FindSDL_gfx.cmake4
-rw-r--r--Modules/FindSDL_image.cmake6
-rw-r--r--Modules/FindSDL_mixer.cmake6
-rw-r--r--Modules/FindSDL_net.cmake6
-rw-r--r--Modules/FindSDL_sound.cmake10
-rw-r--r--Modules/FindSDL_ttf.cmake6
-rw-r--r--Modules/FindSQLite3.cmake6
-rw-r--r--Modules/FindSWIG.cmake4
-rw-r--r--Modules/FindSelfPackers.cmake2
-rw-r--r--Modules/FindSquish.cmake18
-rw-r--r--Modules/FindSubversion.cmake11
-rw-r--r--Modules/FindTCL.cmake10
-rw-r--r--Modules/FindTIFF.cmake11
-rw-r--r--Modules/FindTclStub.cmake2
-rw-r--r--Modules/FindTclsh.cmake6
-rw-r--r--Modules/FindThreads.cmake14
-rw-r--r--Modules/FindUnixCommands.cmake4
-rw-r--r--Modules/FindVulkan.cmake7
-rw-r--r--Modules/FindWget.cmake6
-rw-r--r--Modules/FindWish.cmake2
-rw-r--r--Modules/FindX11.cmake22
-rw-r--r--Modules/FindXCTest.cmake70
-rw-r--r--Modules/FindXMLRPC.cmake8
-rw-r--r--Modules/FindXalanC.cmake9
-rw-r--r--Modules/FindXercesC.cmake9
-rw-r--r--Modules/FindZLIB.cmake8
-rw-r--r--Modules/Findosg.cmake6
-rw-r--r--Modules/FindosgAnimation.cmake6
-rw-r--r--Modules/FindosgDB.cmake6
-rw-r--r--Modules/FindosgFX.cmake6
-rw-r--r--Modules/FindosgGA.cmake6
-rw-r--r--Modules/FindosgIntrospection.cmake6
-rw-r--r--Modules/FindosgManipulator.cmake6
-rw-r--r--Modules/FindosgParticle.cmake6
-rw-r--r--Modules/FindosgPresentation.cmake6
-rw-r--r--Modules/FindosgProducer.cmake6
-rw-r--r--Modules/FindosgQt.cmake6
-rw-r--r--Modules/FindosgShadow.cmake6
-rw-r--r--Modules/FindosgSim.cmake6
-rw-r--r--Modules/FindosgTerrain.cmake6
-rw-r--r--Modules/FindosgText.cmake6
-rw-r--r--Modules/FindosgUtil.cmake6
-rw-r--r--Modules/FindosgViewer.cmake6
-rw-r--r--Modules/FindosgVolume.cmake6
-rw-r--r--Modules/FindosgWidget.cmake6
-rw-r--r--Modules/Findosg_functions.cmake2
-rw-r--r--Modules/FindwxWidgets.cmake17
-rw-r--r--Modules/FindwxWindows.cmake6
-rw-r--r--Modules/FortranCInterface.cmake27
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt2
-rw-r--r--Modules/FortranCInterface/Detect.cmake10
-rw-r--r--Modules/FortranCInterface/Verify/CMakeLists.txt2
-rw-r--r--Modules/GNUInstallDirs.cmake9
-rw-r--r--Modules/GenerateExportHeader.cmake44
-rw-r--r--Modules/GetPrerequisites.cmake32
-rw-r--r--Modules/GoogleTest.cmake20
-rw-r--r--Modules/GoogleTestAddTests.cmake2
-rw-r--r--Modules/ITKCompatibility.cmake3
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake7
-rw-r--r--Modules/Internal/CMakeASM-ATTLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeASMLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeASM_MASMLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeASM_NASMLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeCLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeCUDAArchitecturesAll.cmake2
-rw-r--r--Modules/Internal/CMakeCUDAArchitecturesNative.cmake2
-rw-r--r--Modules/Internal/CMakeCUDAArchitecturesValidate.cmake2
-rw-r--r--Modules/Internal/CMakeCUDAFilterImplicitLibs.cmake2
-rw-r--r--Modules/Internal/CMakeCUDAFindToolkit.cmake2
-rw-r--r--Modules/Internal/CMakeCUDALinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeCXXLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeCommonLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeDetermineLinkerId.cmake8
-rw-r--r--Modules/Internal/CMakeFortranLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeHIPLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake2
-rw-r--r--Modules/Internal/CMakeNVCCParseImplicitInfo.cmake2
-rw-r--r--Modules/Internal/CMakeOBJCLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeOBJCXXLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeSwiftLinkerInformation.cmake2
-rw-r--r--Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake2
-rw-r--r--Modules/Internal/CPack/.gitattributes2
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake9
-rw-r--r--Modules/Internal/CPack/CPackExternal.cmake2
-rw-r--r--Modules/Internal/CPack/CPackFreeBSD.cmake2
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake2
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake122
-rw-r--r--Modules/Internal/CPack/CPackWIX.cmake2
-rw-r--r--Modules/Internal/CPack/CPackZIP.cmake2
-rw-r--r--Modules/Internal/CPack/ISComponents.pas2
-rw-r--r--Modules/Internal/CheckCompilerFlag.cmake2
-rw-r--r--Modules/Internal/CheckFlagCommonConfig.cmake8
-rw-r--r--Modules/Internal/CheckLinkerFlag.cmake7
-rw-r--r--Modules/Internal/CheckSourceCompiles.cmake8
-rw-r--r--Modules/Internal/CheckSourceRuns.cmake8
-rw-r--r--Modules/Internal/HeaderpadWorkaround.cmake7
-rw-r--r--Modules/Internal/OSRelease/010-TryOldCentOS.cmake2
-rw-r--r--Modules/Internal/OSRelease/020-TryDebianVersion.cmake2
-rw-r--r--Modules/KDE3Macros.cmake4
-rw-r--r--Modules/Linker/AIX-ASM.cmake2
-rw-r--r--Modules/Linker/AIX-C.cmake2
-rw-r--r--Modules/Linker/AIX-CXX.cmake2
-rw-r--r--Modules/Linker/AIX-Fortran.cmake2
-rw-r--r--Modules/Linker/AIX.cmake4
-rw-r--r--Modules/Linker/AppleClang.cmake4
-rw-r--r--Modules/Linker/GNU-ASM.cmake2
-rw-r--r--Modules/Linker/GNU-C.cmake2
-rw-r--r--Modules/Linker/GNU-CUDA.cmake2
-rw-r--r--Modules/Linker/GNU-CXX.cmake2
-rw-r--r--Modules/Linker/GNU-Fortran.cmake2
-rw-r--r--Modules/Linker/GNU-HIP.cmake2
-rw-r--r--Modules/Linker/GNU.cmake9
-rw-r--r--Modules/Linker/GNUgold-ASM.cmake2
-rw-r--r--Modules/Linker/GNUgold-C.cmake2
-rw-r--r--Modules/Linker/GNUgold-CUDA.cmake2
-rw-r--r--Modules/Linker/GNUgold-CXX.cmake2
-rw-r--r--Modules/Linker/GNUgold-Fortran.cmake2
-rw-r--r--Modules/Linker/GNUgold-HIP.cmake2
-rw-r--r--Modules/Linker/GNUgold.cmake2
-rw-r--r--Modules/Linker/LLD-ASM.cmake2
-rw-r--r--Modules/Linker/LLD-C.cmake2
-rw-r--r--Modules/Linker/LLD-CUDA.cmake2
-rw-r--r--Modules/Linker/LLD-CXX.cmake2
-rw-r--r--Modules/Linker/LLD-Fortran.cmake2
-rw-r--r--Modules/Linker/LLD-HIP.cmake2
-rw-r--r--Modules/Linker/LLD-OBJC.cmake2
-rw-r--r--Modules/Linker/LLD-OBJCXX.cmake2
-rw-r--r--Modules/Linker/LLD.cmake14
-rw-r--r--Modules/Linker/MOLD-ASM.cmake6
-rw-r--r--Modules/Linker/MOLD-C.cmake6
-rw-r--r--Modules/Linker/MOLD-CUDA.cmake6
-rw-r--r--Modules/Linker/MOLD-CXX.cmake6
-rw-r--r--Modules/Linker/MOLD-Fortran.cmake6
-rw-r--r--Modules/Linker/MOLD-HIP.cmake6
-rw-r--r--Modules/Linker/MOLD-OBJC.cmake6
-rw-r--r--Modules/Linker/MOLD-OBJCXX.cmake6
-rw-r--r--Modules/Linker/MOLD.cmake18
-rw-r--r--Modules/Linker/MSVC-ASM.cmake6
-rw-r--r--Modules/Linker/MSVC-C.cmake6
-rw-r--r--Modules/Linker/MSVC-CUDA.cmake6
-rw-r--r--Modules/Linker/MSVC-CXX.cmake6
-rw-r--r--Modules/Linker/MSVC-Fortran.cmake6
-rw-r--r--Modules/Linker/MSVC-HIP.cmake6
-rw-r--r--Modules/Linker/MSVC.cmake12
-rw-r--r--Modules/Linker/Solaris-ASM.cmake2
-rw-r--r--Modules/Linker/Solaris-C.cmake2
-rw-r--r--Modules/Linker/Solaris-CXX.cmake2
-rw-r--r--Modules/Linker/Solaris-Fortran.cmake2
-rw-r--r--Modules/Linker/Solaris.cmake4
-rw-r--r--Modules/MacroAddFileDependencies.cmake4
-rw-r--r--Modules/MatlabTestsRedirect.cmake2
-rw-r--r--Modules/Platform/AIX-GNU.cmake4
-rw-r--r--Modules/Platform/AIX-IBMClang.cmake2
-rw-r--r--Modules/Platform/AIX-Initialize.cmake1
-rw-r--r--Modules/Platform/AIX-XL.cmake4
-rw-r--r--Modules/Platform/AIX-XLClang.cmake2
-rwxr-xr-xModules/Platform/AIX/ExportImportList4
-rw-r--r--Modules/Platform/Android-Clang.cmake2
-rw-r--r--Modules/Platform/Android-Common.cmake2
-rw-r--r--Modules/Platform/Android-Determine.cmake3
-rw-r--r--Modules/Platform/Android-GNU.cmake2
-rw-r--r--Modules/Platform/Android-Initialize.cmake2
-rw-r--r--Modules/Platform/Android/Determine-Compiler-NDK.cmake2
-rw-r--r--Modules/Platform/Android/Determine-Compiler-Standalone.cmake2
-rw-r--r--Modules/Platform/Android/Determine-Compiler.cmake2
-rw-r--r--Modules/Platform/Apple-Absoft-Fortran.cmake2
-rw-r--r--Modules/Platform/Apple-Apple-Swift.cmake2
-rw-r--r--Modules/Platform/Apple-Clang.cmake6
-rw-r--r--Modules/Platform/Apple-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Apple-GNU.cmake2
-rw-r--r--Modules/Platform/Apple-Intel-Fortran.cmake2
-rw-r--r--Modules/Platform/Apple-Intel.cmake2
-rw-r--r--Modules/Platform/Apple-IntelLLVM-Fortran.cmake2
-rw-r--r--Modules/Platform/Apple-IntelLLVM.cmake2
-rw-r--r--Modules/Platform/Apple-NAG-Fortran.cmake2
-rw-r--r--Modules/Platform/Apple-PGI.cmake2
-rw-r--r--Modules/Platform/BSDOS.cmake1
-rw-r--r--Modules/Platform/BlueGeneP-base.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-dynamic.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static-GNU-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-static.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-base.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static-GNU-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-C.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-CXX.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake2
-rw-r--r--Modules/Platform/BlueGeneQ-static.cmake2
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake2
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake106
-rw-r--r--Modules/Platform/Darwin.cmake34
-rw-r--r--Modules/Platform/GHS-MULTI-Determine.cmake6
-rw-r--r--Modules/Platform/GHS-MULTI.cmake2
-rw-r--r--Modules/Platform/GNU-GNU-C.cmake2
-rw-r--r--Modules/Platform/GNU-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/GNU-GNU-Fortran.cmake3
-rw-r--r--Modules/Platform/GNU-GNU.cmake27
-rw-r--r--Modules/Platform/GNU.cmake22
-rw-r--r--Modules/Platform/Generic-ADSP-ASM.cmake1
-rw-r--r--Modules/Platform/HP-UX-GNU.cmake2
-rw-r--r--Modules/Platform/HP-UX-HP.cmake2
-rw-r--r--Modules/Platform/HP-UX.cmake1
-rw-r--r--Modules/Platform/Haiku.cmake20
-rw-r--r--Modules/Platform/Linker/AIX-AIX-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-AIX-C.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-AIX-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-AIX-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-AIX.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-C.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/AIX-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Android-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Android-C.cmake2
-rw-r--r--Modules/Platform/Linker/Android-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Android-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Android-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/Android-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Android-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Android-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Android-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-C.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-AppleClang.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-C.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-LLD-OBJC.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-MOLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-MOLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-MOLD-OBJC.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-OBJC.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-OBJCXX.cmake2
-rw-r--r--Modules/Platform/Linker/Apple-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/BSD-Linker-Initialize.cmake7
-rw-r--r--Modules/Platform/Linker/CYGWIN-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-C.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/CYGWIN-LLD.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-C.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-ASM.cmake8
-rw-r--r--Modules/Platform/Linker/FreeBSD-C.cmake7
-rw-r--r--Modules/Platform/Linker/FreeBSD-CXX.cmake7
-rw-r--r--Modules/Platform/Linker/FreeBSD-Fortran.cmake7
-rw-r--r--Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/FreeBSD-LLD.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/GNU-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/GNU.cmake7
-rw-r--r--Modules/Platform/Linker/Haiku-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-C.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Haiku-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-C.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-C.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-GNUgold-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-LLD.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-MOLD.cmake2
-rw-r--r--Modules/Platform/Linker/Linux-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-C.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/MSYS-LLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-C.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-C.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/NetBSD-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-ASM.cmake7
-rw-r--r--Modules/Platform/Linker/OpenBSD-C.cmake7
-rw-r--r--Modules/Platform/Linker/OpenBSD-CXX.cmake7
-rw-r--r--Modules/Platform/Linker/OpenBSD-Fortran.cmake7
-rw-r--r--Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/OpenBSD-LLD.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-C.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/SerenityOS-LLD.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-C.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-Solaris-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-Solaris-C.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-Solaris-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/SunOS-Solaris.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-ASM.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-C.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-CXX.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-Fortran.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-GNU-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-GNU.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-HIP.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-LLD-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-LLD.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-C.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-CUDA.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-Fortran.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-HIP.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/Windows-MSVC.cmake7
-rw-r--r--Modules/Platform/Linker/Windows-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsCE-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsCE-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsCE-MSVC-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsCE-MSVC-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsKernelModeDriver-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsKernelModeDriver-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-ASM.cmake7
-rw-r--r--Modules/Platform/Linker/WindowsPhone-C.cmake7
-rw-r--r--Modules/Platform/Linker/WindowsPhone-CXX.cmake7
-rw-r--r--Modules/Platform/Linker/WindowsPhone-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-MSVC-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-MSVC-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-MSVC-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-MSVC-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsPhone-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-ASM.cmake7
-rw-r--r--Modules/Platform/Linker/WindowsStore-C.cmake7
-rw-r--r--Modules/Platform/Linker/WindowsStore-CXX.cmake7
-rw-r--r--Modules/Platform/Linker/WindowsStore-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-LLD-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-LLD-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-LLD-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-MSVC-ASM.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-MSVC-C.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-MSVC-CXX.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-MSVC-Swift.cmake2
-rw-r--r--Modules/Platform/Linker/WindowsStore-Swift.cmake2
-rw-r--r--Modules/Platform/Linux-Apple-Swift.cmake2
-rw-r--r--Modules/Platform/Linux-Fujitsu.cmake2
-rw-r--r--Modules/Platform/Linux-GNU.cmake2
-rw-r--r--Modules/Platform/Linux-Intel.cmake2
-rw-r--r--Modules/Platform/Linux-IntelLLVM.cmake2
-rw-r--r--Modules/Platform/Linux-LCC.cmake2
-rw-r--r--Modules/Platform/Linux-NVHPC.cmake2
-rw-r--r--Modules/Platform/Linux-OpenWatcom.cmake2
-rw-r--r--Modules/Platform/Linux-PGI.cmake2
-rw-r--r--Modules/Platform/Linux-PathScale.cmake2
-rw-r--r--Modules/Platform/MP-RAS.cmake2
-rw-r--r--Modules/Platform/SunOS-GNU.cmake2
-rw-r--r--Modules/Platform/SunOS-PathScale.cmake2
-rw-r--r--Modules/Platform/Tru64.cmake1
-rw-r--r--Modules/Platform/UnixPaths.cmake2
-rw-r--r--Modules/Platform/Windows-Apple-Swift.cmake2
-rw-r--r--Modules/Platform/Windows-Clang-ASM.cmake4
-rw-r--r--Modules/Platform/Windows-Clang.cmake25
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake2
-rw-r--r--Modules/Platform/Windows-GNU.cmake4
-rw-r--r--Modules/Platform/Windows-Intel-Fortran.cmake6
-rw-r--r--Modules/Platform/Windows-Intel.cmake2
-rw-r--r--Modules/Platform/Windows-IntelLLVM-Fortran.cmake6
-rw-r--r--Modules/Platform/Windows-IntelLLVM.cmake8
-rw-r--r--Modules/Platform/Windows-LLVMFlang-Fortran.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake39
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake14
-rw-r--r--Modules/Platform/Windows-OpenWatcom.cmake2
-rw-r--r--Modules/Platform/Windows-PGI.cmake2
-rw-r--r--Modules/Platform/Windows.cmake1
-rw-r--r--Modules/Platform/Windows3x-OpenWatcom.cmake2
-rw-r--r--Modules/Platform/WindowsKernelModeDriver-Initialize.cmake4
-rw-r--r--Modules/Platform/WindowsPaths.cmake2
-rw-r--r--Modules/Platform/Xenix.cmake1
-rw-r--r--Modules/Platform/eCos.cmake1
-rw-r--r--Modules/Platform/gas.cmake1
-rw-r--r--Modules/Platform/iOS-Initialize.cmake2
-rw-r--r--Modules/Platform/tvOS-Initialize.cmake2
-rw-r--r--Modules/Platform/visionOS-Initialize.cmake2
-rw-r--r--Modules/Platform/watchOS-Initialize.cmake2
-rw-r--r--Modules/ProcessorCount.cmake2
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake5
-rw-r--r--Modules/Qt4Macros.cmake2
-rw-r--r--Modules/SelectLibraryConfigurations.cmake2
-rw-r--r--Modules/SquishTestScript.cmake7
-rw-r--r--Modules/SystemInformation.cmake3
-rw-r--r--Modules/TestBigEndian.cmake50
-rw-r--r--Modules/TestCXXAcceptsFlag.cmake2
-rw-r--r--Modules/TestEndianness.c.in (renamed from Modules/TestEndianess.c.in)0
-rw-r--r--Modules/TestForANSIForScope.cmake7
-rw-r--r--Modules/TestForANSIStreamHeaders.cmake6
-rw-r--r--Modules/TestForSSTREAM.cmake6
-rw-r--r--Modules/TestForSTDNamespace.cmake6
-rw-r--r--Modules/UseEcos.cmake5
-rw-r--r--Modules/UseJava.cmake34
-rw-r--r--Modules/UseJava/ClassFilelist.cmake2
-rw-r--r--Modules/UseJava/ClearClassFiles.cmake2
-rw-r--r--Modules/UseJava/Symlinks.cmake2
-rw-r--r--Modules/UseJava/javaTargets.cmake.in2
-rw-r--r--Modules/UsePkgConfig.cmake7
-rw-r--r--Modules/UseQt4.cmake10
-rw-r--r--Modules/UseSWIG.cmake14
-rw-r--r--Modules/UseSWIG/ManageSupportFiles.cmake2
-rw-r--r--Modules/Use_wxWindows.cmake2
-rw-r--r--Modules/UsewxWidgets.cmake4
-rw-r--r--Modules/VTKCompatibility.cmake3
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake6
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake6
-rw-r--r--Modules/ecos_clean.cmake2
-rw-r--r--Modules/kde3uic.cmake3
-rw-r--r--Packaging/QtSDK/ToolsCMakeXX.cmake2
-rw-r--r--Packaging/QtSDK/qt.tools.cmake.xx.qs.in2
-rw-r--r--README.rst4
-rw-r--r--Source/CMakeCopyright.cmake12
-rw-r--r--Source/CMakeLists.txt58
-rwxr-xr-xSource/CMakeVersion.bash12
-rw-r--r--Source/CMakeVersion.cmake13
-rw-r--r--Source/CMakeVersion.rc.in2
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx20
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.h20
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx40
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h24
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx18
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h6
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx12
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h10
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx22
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h2
-rw-r--r--Source/CPack/WiX/cmCMakeToWixPath.cxx6
-rw-r--r--Source/CPack/WiX/cmCMakeToWixPath.h4
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx4
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h8
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.cxx9
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.h2
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.h6
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXPatch.cxx14
-rw-r--r--Source/CPack/WiX/cmWIXPatch.h6
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx22
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h16
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXShortcut.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXShortcut.h2
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h2
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx83
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h10
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackBundleGenerator.h6
-rw-r--r--Source/CPack/cmCPackComponentGroup.cxx6
-rw-r--r--Source/CPack/cmCPackComponentGroup.h6
-rw-r--r--Source/CPack/cmCPackConfigure.h.in2
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.h4
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.h6
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx64
-rw-r--r--Source/CPack/cmCPackDebGenerator.h10
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx59
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h14
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx22
-rw-r--r--Source/CPack/cmCPackExternalGenerator.h30
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx46
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx126
-rw-r--r--Source/CPack/cmCPackGenerator.h99
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx8
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h10
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.cxx202
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.h22
-rw-r--r--Source/CPack/cmCPackLog.cxx6
-rw-r--r--Source/CPack/cmCPackLog.h22
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx97
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h8
-rw-r--r--Source/CPack/cmCPackNuGetGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackNuGetGenerator.h4
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx42
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h36
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx24
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.h16
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx12
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h12
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h2
-rw-r--r--Source/CPack/cpack.cxx46
-rw-r--r--Source/CTest/cmCTestBZR.cxx45
-rw-r--r--Source/CTest/cmCTestBZR.h5
-rw-r--r--Source/CTest/cmCTestBinPacker.cxx36
-rw-r--r--Source/CTest/cmCTestBinPacker.h10
-rw-r--r--Source/CTest/cmCTestBuildAndTest.cxx341
-rw-r--r--Source/CTest/cmCTestBuildAndTest.h56
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx453
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h71
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx152
-rw-r--r--Source/CTest/cmCTestBuildCommand.h60
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx210
-rw-r--r--Source/CTest/cmCTestBuildHandler.h52
-rw-r--r--Source/CTest/cmCTestCVS.cxx19
-rw-r--r--Source/CTest/cmCTestCVS.h7
-rw-r--r--Source/CTest/cmCTestCommand.cxx19
-rw-r--r--Source/CTest/cmCTestCommand.h32
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx328
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h43
-rw-r--r--Source/CTest/cmCTestConfigureHandler.cxx103
-rw-r--r--Source/CTest/cmCTestConfigureHandler.h26
-rw-r--r--Source/CTest/cmCTestCoverageCommand.cxx50
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h41
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx60
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h11
-rw-r--r--Source/CTest/cmCTestCurl.cxx8
-rw-r--r--Source/CTest/cmCTestCurl.h6
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx88
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h39
-rw-r--r--Source/CTest/cmCTestGIT.cxx63
-rw-r--r--Source/CTest/cmCTestGIT.h5
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx166
-rw-r--r--Source/CTest/cmCTestGenericHandler.h89
-rw-r--r--Source/CTest/cmCTestGlobalVC.cxx13
-rw-r--r--Source/CTest/cmCTestGlobalVC.h7
-rw-r--r--Source/CTest/cmCTestHG.cxx29
-rw-r--r--Source/CTest/cmCTestHG.h5
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx201
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h118
-rw-r--r--Source/CTest/cmCTestLaunch.cxx85
-rw-r--r--Source/CTest/cmCTestLaunch.h26
-rw-r--r--Source/CTest/cmCTestLaunchReporter.cxx14
-rw-r--r--Source/CTest/cmCTestLaunchReporter.h13
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx66
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h43
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx81
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h29
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx124
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h7
-rw-r--r--Source/CTest/cmCTestP4.cxx32
-rw-r--r--Source/CTest/cmCTestP4.h9
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.cxx12
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h26
-rw-r--r--Source/CTest/cmCTestResourceAllocator.cxx20
-rw-r--r--Source/CTest/cmCTestResourceAllocator.h14
-rw-r--r--Source/CTest/cmCTestResourceGroupsLexerHelper.cxx6
-rw-r--r--Source/CTest/cmCTestResourceGroupsLexerHelper.h6
-rw-r--r--Source/CTest/cmCTestResourceSpec.cxx26
-rw-r--r--Source/CTest/cmCTestResourceSpec.h34
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.cxx19
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h24
-rw-r--r--Source/CTest/cmCTestRunTest.cxx52
-rw-r--r--Source/CTest/cmCTestRunTest.h12
-rw-r--r--Source/CTest/cmCTestSVN.cxx38
-rw-r--r--Source/CTest/cmCTestSVN.h5
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx687
-rw-r--r--Source/CTest/cmCTestScriptHandler.h142
-rw-r--r--Source/CTest/cmCTestSleepCommand.cxx30
-rw-r--r--Source/CTest/cmCTestSleepCommand.h39
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx156
-rw-r--r--Source/CTest/cmCTestStartCommand.h38
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx208
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h68
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx96
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h46
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx161
-rw-r--r--Source/CTest/cmCTestTestCommand.h110
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx359
-rw-r--r--Source/CTest/cmCTestTestHandler.h141
-rw-r--r--Source/CTest/cmCTestTestMeasurementXMLParser.cxx10
-rw-r--r--Source/CTest/cmCTestTestMeasurementXMLParser.h8
-rw-r--r--Source/CTest/cmCTestTypes.cxx24
-rw-r--r--Source/CTest/cmCTestTypes.h12
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx393
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h43
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx354
-rw-r--r--Source/CTest/cmCTestUpdateHandler.h64
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx91
-rw-r--r--Source/CTest/cmCTestUploadCommand.h44
-rw-r--r--Source/CTest/cmCTestUploadHandler.cxx75
-rw-r--r--Source/CTest/cmCTestUploadHandler.h37
-rw-r--r--Source/CTest/cmCTestVC.cxx25
-rw-r--r--Source/CTest/cmCTestVC.h14
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx2
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.h2
-rw-r--r--Source/CTest/cmParseCacheCoverage.cxx2
-rw-r--r--Source/CTest/cmParseCacheCoverage.h4
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.cxx8
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.h6
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx4
-rw-r--r--Source/CTest/cmParseDelphiCoverage.h6
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx2
-rw-r--r--Source/CTest/cmParseGTMCoverage.h4
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx6
-rw-r--r--Source/CTest/cmParseJacocoCoverage.h4
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx4
-rw-r--r--Source/CTest/cmParseMumpsCoverage.h4
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx4
-rw-r--r--Source/CTest/cmParsePHPCoverage.h6
-rw-r--r--Source/CTest/cmProcess.cxx18
-rw-r--r--Source/CTest/cmProcess.h17
-rw-r--r--Source/CTest/cmUVJobServerClient.cxx16
-rw-r--r--Source/CTest/cmUVJobServerClient.h2
-rw-r--r--Source/Checks/Curses/CMakeLists.txt2
-rw-r--r--Source/Checks/cm_cxx_filesystem.cxx2
-rw-r--r--Source/CursesDialog/CMakeLists.txt2
-rw-r--r--Source/CursesDialog/ccmake.cxx18
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx8
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h8
-rw-r--r--Source/CursesDialog/cmCursesColor.cxx2
-rw-r--r--Source/CursesDialog/cmCursesColor.h2
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx6
-rw-r--r--Source/CursesDialog/cmCursesForm.h6
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.h4
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx6
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h6
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx40
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h20
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx6
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h4
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesStandardIncludes.h2
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx8
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h8
-rw-r--r--Source/CursesDialog/cmCursesWidget.cxx6
-rw-r--r--Source/CursesDialog/cmCursesWidget.h6
-rw-r--r--Source/CursesDialog/form/CMakeLists.txt2
-rw-r--r--Source/CursesDialog/form/cmFormConfigure.h.in2
-rw-r--r--Source/LexerParser/cmCTestResourceGroupsLexer.cxx2
-rw-r--r--Source/LexerParser/cmCTestResourceGroupsLexer.in.l2
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.cxx2246
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.h689
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.in.l148
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.cxx1856
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.y196
-rw-r--r--Source/LexerParser/cmCommandArgumentParserTokens.h81
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.cxx2
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.in.l2
-rw-r--r--Source/LexerParser/cmDependsJavaParser.cxx2
-rw-r--r--Source/LexerParser/cmDependsJavaParser.y2
-rw-r--r--Source/LexerParser/cmExprLexer.cxx2
-rw-r--r--Source/LexerParser/cmExprLexer.in.l2
-rw-r--r--Source/LexerParser/cmExprParser.cxx2
-rw-r--r--Source/LexerParser/cmExprParser.y2
-rw-r--r--Source/LexerParser/cmFortranLexer.cxx2
-rw-r--r--Source/LexerParser/cmFortranLexer.in.l2
-rw-r--r--Source/LexerParser/cmFortranParser.cxx2
-rw-r--r--Source/LexerParser/cmFortranParser.y2
-rw-r--r--Source/LexerParser/cmGccDepfileLexer.cxx2
-rw-r--r--Source/LexerParser/cmGccDepfileLexer.in.l2
-rw-r--r--Source/LexerParser/cmListFileLexer.c2
-rw-r--r--Source/LexerParser/cmListFileLexer.in.l2
-rw-r--r--Source/Modules/CMakeBuildUtilities.cmake1
-rw-r--r--Source/Modules/CheckCXXLinkerFlag.cmake2
-rw-r--r--Source/Modules/FindJsonCpp.cmake6
-rw-r--r--Source/Modules/FindLibRHash.cmake6
-rw-r--r--Source/Modules/FindLibUUID.cmake6
-rw-r--r--Source/Modules/FindLibUV.cmake6
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx18
-rw-r--r--Source/QtDialog/AddCacheEntry.h12
-rw-r--r--Source/QtDialog/CMakeGUIExec.cxx2
-rw-r--r--Source/QtDialog/CMakeLists.txt9
-rw-r--r--Source/QtDialog/CMakeSetup.cxx24
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx53
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h38
-rw-r--r--Source/QtDialog/EnvironmentDialog.cxx22
-rw-r--r--Source/QtDialog/EnvironmentDialog.h14
-rw-r--r--Source/QtDialog/FirstConfigure.cxx42
-rw-r--r--Source/QtDialog/FirstConfigure.h34
-rw-r--r--Source/QtDialog/QCMake.cxx43
-rw-r--r--Source/QtDialog/QCMake.h50
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx56
-rw-r--r--Source/QtDialog/QCMakeCacheView.h38
-rw-r--r--Source/QtDialog/QCMakePreset.cxx14
-rw-r--r--Source/QtDialog/QCMakePreset.h14
-rw-r--r--Source/QtDialog/QCMakePresetComboBox.cxx8
-rw-r--r--Source/QtDialog/QCMakePresetComboBox.h10
-rw-r--r--Source/QtDialog/QCMakePresetItemModel.cxx20
-rw-r--r--Source/QtDialog/QCMakePresetItemModel.h16
-rw-r--r--Source/QtDialog/QCMakeSizeType.h2
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx10
-rw-r--r--Source/QtDialog/QCMakeWidgets.h12
-rw-r--r--Source/QtDialog/QtDialogCPack.cmake.in2
-rw-r--r--Source/QtDialog/RegexExplorer.cxx8
-rw-r--r--Source/QtDialog/RegexExplorer.h4
-rw-r--r--Source/QtDialog/WarningMessagesDialog.cxx2
-rw-r--r--Source/QtDialog/WarningMessagesDialog.h2
-rw-r--r--Source/bindexplib.cxx26
-rw-r--r--Source/bindexplib.h6
-rw-r--r--Source/cmAddCompileDefinitionsCommand.cxx2
-rw-r--r--Source/cmAddCompileDefinitionsCommand.h2
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx2
-rw-r--r--Source/cmAddCompileOptionsCommand.h2
-rw-r--r--Source/cmAddCustomCommandCommand.cxx49
-rw-r--r--Source/cmAddCustomCommandCommand.h2
-rw-r--r--Source/cmAddCustomTargetCommand.cxx25
-rw-r--r--Source/cmAddCustomTargetCommand.h2
-rw-r--r--Source/cmAddDefinitionsCommand.cxx2
-rw-r--r--Source/cmAddDefinitionsCommand.h2
-rw-r--r--Source/cmAddDependenciesCommand.cxx2
-rw-r--r--Source/cmAddDependenciesCommand.h2
-rw-r--r--Source/cmAddExecutableCommand.cxx8
-rw-r--r--Source/cmAddExecutableCommand.h2
-rw-r--r--Source/cmAddLibraryCommand.cxx10
-rw-r--r--Source/cmAddLibraryCommand.h2
-rw-r--r--Source/cmAddLinkOptionsCommand.cxx2
-rw-r--r--Source/cmAddLinkOptionsCommand.h2
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx6
-rw-r--r--Source/cmAddSubDirectoryCommand.h2
-rw-r--r--Source/cmAddTestCommand.cxx2
-rw-r--r--Source/cmAddTestCommand.h2
-rw-r--r--Source/cmAffinity.cxx4
-rw-r--r--Source/cmAffinity.h2
-rw-r--r--Source/cmAlgorithms.h6
-rw-r--r--Source/cmArchiveWrite.cxx28
-rw-r--r--Source/cmArchiveWrite.h16
-rw-r--r--Source/cmArgumentParser.cxx2
-rw-r--r--Source/cmArgumentParser.h2
-rw-r--r--Source/cmArgumentParserTypes.h9
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h2
-rw-r--r--Source/cmBase32.cxx22
-rw-r--r--Source/cmBase32.h6
-rw-r--r--Source/cmBinUtilsLinker.cxx4
-rw-r--r--Source/cmBinUtilsLinker.h4
-rw-r--r--Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx4
-rw-r--r--Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h4
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.cxx12
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.h2
-rw-r--r--Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx8
-rw-r--r--Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h2
-rw-r--r--Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx4
-rw-r--r--Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h4
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.cxx8
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.h4
-rw-r--r--Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx10
-rw-r--r--Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h2
-rw-r--r--Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx6
-rw-r--r--Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h4
-rw-r--r--Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx4
-rw-r--r--Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h6
-rw-r--r--Source/cmBinUtilsWindowsPELinker.cxx2
-rw-r--r--Source/cmBinUtilsWindowsPELinker.h2
-rw-r--r--Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx6
-rw-r--r--Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h4
-rw-r--r--Source/cmBlockCommand.cxx14
-rw-r--r--Source/cmBlockCommand.h2
-rw-r--r--Source/cmBreakCommand.cxx63
-rw-r--r--Source/cmBreakCommand.h2
-rw-r--r--Source/cmBuildCommand.cxx6
-rw-r--r--Source/cmBuildCommand.h2
-rw-r--r--Source/cmBuildDatabase.cxx8
-rw-r--r--Source/cmBuildDatabase.h2
-rw-r--r--Source/cmBuildNameCommand.cxx61
-rw-r--r--Source/cmBuildNameCommand.h13
-rw-r--r--Source/cmBuildOptions.h6
-rw-r--r--Source/cmCLocaleEnvironmentScope.cxx2
-rw-r--r--Source/cmCLocaleEnvironmentScope.h2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx24
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h2
-rw-r--r--Source/cmCMakeLanguageCommand.cxx6
-rw-r--r--Source/cmCMakeLanguageCommand.h2
-rw-r--r--Source/cmCMakeMinimumRequired.cxx2
-rw-r--r--Source/cmCMakeMinimumRequired.h2
-rw-r--r--Source/cmCMakePath.cxx6
-rw-r--r--Source/cmCMakePath.h141
-rw-r--r--Source/cmCMakePathCommand.cxx100
-rw-r--r--Source/cmCMakePathCommand.h2
-rw-r--r--Source/cmCMakePkgConfigCommand.cxx28
-rw-r--r--Source/cmCMakePkgConfigCommand.h2
-rw-r--r--Source/cmCMakePolicyCommand.cxx33
-rw-r--r--Source/cmCMakePolicyCommand.h2
-rw-r--r--Source/cmCMakePresetsErrors.cxx90
-rw-r--r--Source/cmCMakePresetsErrors.h76
-rw-r--r--Source/cmCMakePresetsGraph.cxx141
-rw-r--r--Source/cmCMakePresetsGraph.h56
-rw-r--r--Source/cmCMakePresetsGraphInternal.h60
-rw-r--r--Source/cmCMakePresetsGraphReadJSON.cxx48
-rw-r--r--Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx10
-rw-r--r--Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx18
-rw-r--r--Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx4
-rw-r--r--Source/cmCMakePresetsGraphReadJSONTestPresets.cxx16
-rw-r--r--Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx6
-rw-r--r--Source/cmCPackPropertiesGenerator.cxx2
-rw-r--r--Source/cmCPackPropertiesGenerator.h4
-rw-r--r--Source/cmCPluginAPI.cxx874
-rw-r--r--Source/cmCPluginAPI.h236
-rw-r--r--Source/cmCTest.cxx2906
-rw-r--r--Source/cmCTest.h257
-rw-r--r--Source/cmCacheManager.cxx64
-rw-r--r--Source/cmCacheManager.h64
-rw-r--r--Source/cmCallVisualStudioMacro.cxx26
-rw-r--r--Source/cmCallVisualStudioMacro.h8
-rw-r--r--Source/cmCommand.cxx59
-rw-r--r--Source/cmCommand.h97
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx296
-rw-r--r--Source/cmCommandArgumentParserHelper.h91
-rw-r--r--Source/cmCommandLineArgument.h39
-rw-r--r--Source/cmCommands.cxx60
-rw-r--r--Source/cmCommands.h2
-rw-r--r--Source/cmCommonTargetGenerator.cxx46
-rw-r--r--Source/cmCommonTargetGenerator.h30
-rw-r--r--Source/cmComputeComponentGraph.cxx4
-rw-r--r--Source/cmComputeComponentGraph.h4
-rw-r--r--Source/cmComputeLinkDepends.cxx163
-rw-r--r--Source/cmComputeLinkDepends.h25
-rw-r--r--Source/cmComputeLinkInformation.cxx382
-rw-r--r--Source/cmComputeLinkInformation.h35
-rw-r--r--Source/cmComputeTargetDepends.cxx48
-rw-r--r--Source/cmComputeTargetDepends.h10
-rw-r--r--Source/cmConditionEvaluator.cxx253
-rw-r--r--Source/cmConditionEvaluator.h29
-rw-r--r--Source/cmConfigure.cmake.h.in2
-rw-r--r--Source/cmConfigureFileCommand.cxx4
-rw-r--r--Source/cmConfigureFileCommand.h2
-rw-r--r--Source/cmConfigureLog.cxx6
-rw-r--r--Source/cmConfigureLog.h2
-rw-r--r--Source/cmConsoleBuf.cxx2
-rw-r--r--Source/cmConsoleBuf.h2
-rw-r--r--Source/cmConstStack.h2
-rw-r--r--Source/cmConstStack.tcc2
-rw-r--r--Source/cmContinueCommand.cxx2
-rw-r--r--Source/cmContinueCommand.h2
-rw-r--r--Source/cmConvertMSBuildXMLToJSON.py2
-rw-r--r--Source/cmCoreTryCompile.cxx135
-rw-r--r--Source/cmCoreTryCompile.h8
-rw-r--r--Source/cmCreateTestSourceList.cxx9
-rw-r--r--Source/cmCreateTestSourceList.h2
-rw-r--r--Source/cmCryptoHash.cxx8
-rw-r--r--Source/cmCryptoHash.h8
-rw-r--r--Source/cmCurl.cxx17
-rw-r--r--Source/cmCurl.h8
-rw-r--r--Source/cmCustomCommand.cxx47
-rw-r--r--Source/cmCustomCommand.h41
-rw-r--r--Source/cmCustomCommandGenerator.cxx26
-rw-r--r--Source/cmCustomCommandGenerator.h20
-rw-r--r--Source/cmCustomCommandLines.cxx2
-rw-r--r--Source/cmCustomCommandLines.h2
-rw-r--r--Source/cmCustomCommandTypes.h2
-rw-r--r--Source/cmCxxModuleMapper.cxx2
-rw-r--r--Source/cmCxxModuleMapper.h2
-rw-r--r--Source/cmCxxModuleUsageEffects.cxx2
-rw-r--r--Source/cmCxxModuleUsageEffects.h2
-rw-r--r--Source/cmDebugTools.h4
-rw-r--r--Source/cmDebuggerAdapter.cxx43
-rw-r--r--Source/cmDebuggerAdapter.h2
-rw-r--r--Source/cmDebuggerBreakpointManager.cxx12
-rw-r--r--Source/cmDebuggerBreakpointManager.h2
-rw-r--r--Source/cmDebuggerExceptionManager.cxx8
-rw-r--r--Source/cmDebuggerExceptionManager.h2
-rw-r--r--Source/cmDebuggerPosixPipeConnection.cxx2
-rw-r--r--Source/cmDebuggerPosixPipeConnection.h2
-rw-r--r--Source/cmDebuggerProtocol.cxx2
-rw-r--r--Source/cmDebuggerProtocol.h2
-rw-r--r--Source/cmDebuggerSourceBreakpoint.cxx2
-rw-r--r--Source/cmDebuggerSourceBreakpoint.h2
-rw-r--r--Source/cmDebuggerStackFrame.cxx8
-rw-r--r--Source/cmDebuggerStackFrame.h5
-rw-r--r--Source/cmDebuggerThread.cxx45
-rw-r--r--Source/cmDebuggerThread.h12
-rw-r--r--Source/cmDebuggerThreadManager.cxx12
-rw-r--r--Source/cmDebuggerThreadManager.h5
-rw-r--r--Source/cmDebuggerVariables.cxx6
-rw-r--r--Source/cmDebuggerVariables.h24
-rw-r--r--Source/cmDebuggerVariablesHelper.cxx9
-rw-r--r--Source/cmDebuggerVariablesHelper.h2
-rw-r--r--Source/cmDebuggerVariablesManager.cxx2
-rw-r--r--Source/cmDebuggerVariablesManager.h2
-rw-r--r--Source/cmDebuggerWindowsPipeConnection.cxx2
-rw-r--r--Source/cmDebuggerWindowsPipeConnection.h2
-rw-r--r--Source/cmDefinePropertyCommand.cxx6
-rw-r--r--Source/cmDefinePropertyCommand.h2
-rw-r--r--Source/cmDefinitions.cxx14
-rw-r--r--Source/cmDefinitions.h14
-rw-r--r--Source/cmDependencyProvider.h2
-rw-r--r--Source/cmDepends.cxx16
-rw-r--r--Source/cmDepends.h18
-rw-r--r--Source/cmDependsC.cxx18
-rw-r--r--Source/cmDependsC.h16
-rw-r--r--Source/cmDependsCompiler.cxx39
-rw-r--r--Source/cmDependsCompiler.h12
-rw-r--r--Source/cmDependsFortran.cxx42
-rw-r--r--Source/cmDependsFortran.h18
-rw-r--r--Source/cmDependsJava.cxx8
-rw-r--r--Source/cmDependsJava.h8
-rw-r--r--Source/cmDependsJavaParserHelper.cxx30
-rw-r--r--Source/cmDependsJavaParserHelper.h38
-rw-r--r--Source/cmDocumentation.cxx38
-rw-r--r--Source/cmDocumentation.h24
-rw-r--r--Source/cmDocumentationEntry.h8
-rw-r--r--Source/cmDocumentationFormatter.cxx270
-rw-r--r--Source/cmDocumentationFormatter.h13
-rw-r--r--Source/cmDocumentationSection.h12
-rw-r--r--Source/cmDuration.cxx8
-rw-r--r--Source/cmDuration.h8
-rw-r--r--Source/cmDynamicLoader.cxx16
-rw-r--r--Source/cmDynamicLoader.h4
-rw-r--r--Source/cmDyndepCollation.cxx4
-rw-r--r--Source/cmDyndepCollation.h2
-rw-r--r--Source/cmELF.cxx26
-rw-r--r--Source/cmELF.h12
-rw-r--r--Source/cmEnableLanguageCommand.cxx2
-rw-r--r--Source/cmEnableLanguageCommand.h2
-rw-r--r--Source/cmEnableTestingCommand.cxx2
-rw-r--r--Source/cmEnableTestingCommand.h2
-rw-r--r--Source/cmEvaluatedTargetProperty.cxx2
-rw-r--r--Source/cmEvaluatedTargetProperty.h2
-rw-r--r--Source/cmExecProgramCommand.cxx10
-rw-r--r--Source/cmExecProgramCommand.h2
-rw-r--r--Source/cmExecuteProcessCommand.cxx42
-rw-r--r--Source/cmExecuteProcessCommand.h2
-rw-r--r--Source/cmExecutionStatus.h4
-rw-r--r--Source/cmExpandedCommandArgument.cxx4
-rw-r--r--Source/cmExpandedCommandArgument.h4
-rw-r--r--Source/cmExperimental.cxx25
-rw-r--r--Source/cmExperimental.h6
-rw-r--r--Source/cmExportAndroidMKGenerator.cxx20
-rw-r--r--Source/cmExportAndroidMKGenerator.h2
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx12
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.h2
-rw-r--r--Source/cmExportBuildCMakeConfigGenerator.cxx12
-rw-r--r--Source/cmExportBuildCMakeConfigGenerator.h2
-rw-r--r--Source/cmExportBuildFileGenerator.cxx42
-rw-r--r--Source/cmExportBuildFileGenerator.h8
-rw-r--r--Source/cmExportCMakeConfigGenerator.cxx110
-rw-r--r--Source/cmExportCMakeConfigGenerator.h2
-rw-r--r--Source/cmExportCommand.cxx14
-rw-r--r--Source/cmExportCommand.h2
-rw-r--r--Source/cmExportFileGenerator.cxx4
-rw-r--r--Source/cmExportFileGenerator.h10
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.cxx12
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.h2
-rw-r--r--Source/cmExportInstallCMakeConfigGenerator.cxx16
-rw-r--r--Source/cmExportInstallCMakeConfigGenerator.h2
-rw-r--r--Source/cmExportInstallFileGenerator.cxx124
-rw-r--r--Source/cmExportInstallFileGenerator.h8
-rw-r--r--Source/cmExportInstallPackageInfoGenerator.cxx2
-rw-r--r--Source/cmExportInstallPackageInfoGenerator.h2
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx164
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h13
-rw-r--r--Source/cmExportPackageInfoGenerator.cxx46
-rw-r--r--Source/cmExportPackageInfoGenerator.h4
-rw-r--r--Source/cmExportSet.cxx12
-rw-r--r--Source/cmExportSet.h16
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmExportTryCompileFileGenerator.h6
-rw-r--r--Source/cmExprParserHelper.cxx6
-rw-r--r--Source/cmExprParserHelper.h12
-rw-r--r--Source/cmExternalMakefileProjectGenerator.cxx8
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h18
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx64
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h28
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx56
-rw-r--r--Source/cmExtraCodeLiteGenerator.h46
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx102
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h42
-rw-r--r--Source/cmExtraKateGenerator.cxx64
-rw-r--r--Source/cmExtraKateGenerator.h30
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx54
-rw-r--r--Source/cmExtraSublimeTextGenerator.h26
-rw-r--r--Source/cmFLTKWrapUICommand.cxx6
-rw-r--r--Source/cmFLTKWrapUICommand.h2
-rw-r--r--Source/cmFSPermissions.cxx2
-rw-r--r--Source/cmFSPermissions.h46
-rw-r--r--Source/cmFileAPI.cxx31
-rw-r--r--Source/cmFileAPI.h4
-rw-r--r--Source/cmFileAPICMakeFiles.cxx4
-rw-r--r--Source/cmFileAPICMakeFiles.h2
-rw-r--r--Source/cmFileAPICache.cxx2
-rw-r--r--Source/cmFileAPICache.h2
-rw-r--r--Source/cmFileAPICodemodel.cxx62
-rw-r--r--Source/cmFileAPICodemodel.h2
-rw-r--r--Source/cmFileAPICommand.cxx14
-rw-r--r--Source/cmFileAPICommand.h2
-rw-r--r--Source/cmFileAPIConfigureLog.cxx2
-rw-r--r--Source/cmFileAPIConfigureLog.h2
-rw-r--r--Source/cmFileAPIToolchains.cxx12
-rw-r--r--Source/cmFileAPIToolchains.h2
-rw-r--r--Source/cmFileCommand.cxx182
-rw-r--r--Source/cmFileCommand.h2
-rw-r--r--Source/cmFileCommand_ReadMacho.cxx2
-rw-r--r--Source/cmFileCommand_ReadMacho.h2
-rw-r--r--Source/cmFileCopier.cxx34
-rw-r--r--Source/cmFileCopier.h26
-rw-r--r--Source/cmFileInstaller.cxx18
-rw-r--r--Source/cmFileInstaller.h14
-rw-r--r--Source/cmFileLock.cxx14
-rw-r--r--Source/cmFileLock.h8
-rw-r--r--Source/cmFileLockPool.cxx28
-rw-r--r--Source/cmFileLockPool.h18
-rw-r--r--Source/cmFileLockResult.cxx8
-rw-r--r--Source/cmFileLockResult.h2
-rw-r--r--Source/cmFileLockUnix.cxx4
-rw-r--r--Source/cmFileLockWin32.cxx81
-rw-r--r--Source/cmFilePathChecksum.cxx2
-rw-r--r--Source/cmFilePathChecksum.h4
-rw-r--r--Source/cmFileSet.cxx22
-rw-r--r--Source/cmFileSet.h26
-rw-r--r--Source/cmFileTime.cxx2
-rw-r--r--Source/cmFileTime.h6
-rw-r--r--Source/cmFileTimeCache.cxx2
-rw-r--r--Source/cmFileTimeCache.h6
-rw-r--r--Source/cmFileTimes.cxx2
-rw-r--r--Source/cmFileTimes.h2
-rw-r--r--Source/cmFindBase.cxx157
-rw-r--r--Source/cmFindBase.h6
-rw-r--r--Source/cmFindCommon.cxx126
-rw-r--r--Source/cmFindCommon.h6
-rw-r--r--Source/cmFindFileCommand.cxx2
-rw-r--r--Source/cmFindFileCommand.h2
-rw-r--r--Source/cmFindLibraryCommand.cxx147
-rw-r--r--Source/cmFindLibraryCommand.h6
-rw-r--r--Source/cmFindPackageCommand.cxx1139
-rw-r--r--Source/cmFindPackageCommand.h100
-rw-r--r--Source/cmFindPackageStack.cxx2
-rw-r--r--Source/cmFindPackageStack.h2
-rw-r--r--Source/cmFindPathCommand.cxx4
-rw-r--r--Source/cmFindPathCommand.h2
-rw-r--r--Source/cmFindProgramCommand.cxx39
-rw-r--r--Source/cmFindProgramCommand.h2
-rw-r--r--Source/cmForEachCommand.cxx40
-rw-r--r--Source/cmForEachCommand.h2
-rw-r--r--Source/cmFortranParser.h42
-rw-r--r--Source/cmFortranParserImpl.cxx40
-rw-r--r--Source/cmFunctionBlocker.cxx6
-rw-r--r--Source/cmFunctionBlocker.h2
-rw-r--r--Source/cmFunctionCommand.cxx9
-rw-r--r--Source/cmFunctionCommand.h2
-rw-r--r--Source/cmGccDepfileLexerHelper.cxx6
-rw-r--r--Source/cmGccDepfileLexerHelper.h6
-rw-r--r--Source/cmGccDepfileReader.cxx4
-rw-r--r--Source/cmGccDepfileReader.h4
-rw-r--r--Source/cmGccDepfileReaderTypes.h2
-rw-r--r--Source/cmGeneratedFileStream.cxx8
-rw-r--r--Source/cmGeneratedFileStream.h9
-rw-r--r--Source/cmGeneratorExpression.cxx68
-rw-r--r--Source/cmGeneratorExpression.h30
-rw-r--r--Source/cmGeneratorExpressionContext.cxx4
-rw-r--r--Source/cmGeneratorExpressionContext.h4
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx14
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h14
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx16
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h22
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx24
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h16
-rw-r--r--Source/cmGeneratorExpressionLexer.cxx10
-rw-r--r--Source/cmGeneratorExpressionLexer.h8
-rw-r--r--Source/cmGeneratorExpressionNode.cxx673
-rw-r--r--Source/cmGeneratorExpressionNode.h18
-rw-r--r--Source/cmGeneratorExpressionParser.cxx4
-rw-r--r--Source/cmGeneratorExpressionParser.h4
-rw-r--r--Source/cmGeneratorOptions.h35
-rw-r--r--Source/cmGeneratorTarget.cxx526
-rw-r--r--Source/cmGeneratorTarget.h399
-rw-r--r--Source/cmGeneratorTarget_CompatibleInterface.cxx140
-rw-r--r--Source/cmGeneratorTarget_IncludeDirectories.cxx97
-rw-r--r--Source/cmGeneratorTarget_Link.cxx434
-rw-r--r--Source/cmGeneratorTarget_LinkDirectories.cxx13
-rw-r--r--Source/cmGeneratorTarget_Options.cxx180
-rw-r--r--Source/cmGeneratorTarget_Sources.cxx52
-rw-r--r--Source/cmGeneratorTarget_TargetPropertyEntry.cxx22
-rw-r--r--Source/cmGeneratorTarget_TransitiveProperty.cxx15
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx4
-rw-r--r--Source/cmGetCMakePropertyCommand.h2
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx28
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h2
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx3
-rw-r--r--Source/cmGetFilenameComponentCommand.h2
-rw-r--r--Source/cmGetPipes.cxx2
-rw-r--r--Source/cmGetPipes.h2
-rw-r--r--Source/cmGetPropertyCommand.cxx127
-rw-r--r--Source/cmGetPropertyCommand.h2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx6
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h2
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx36
-rw-r--r--Source/cmGetTargetPropertyCommand.h2
-rw-r--r--Source/cmGetTestPropertyCommand.cxx2
-rw-r--r--Source/cmGetTestPropertyCommand.h2
-rw-r--r--Source/cmGhsMultiGpj.cxx8
-rw-r--r--Source/cmGhsMultiGpj.h6
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx61
-rw-r--r--Source/cmGhsMultiTargetGenerator.h26
-rw-r--r--Source/cmGlobCacheEntry.h12
-rw-r--r--Source/cmGlobVerificationManager.cxx16
-rw-r--r--Source/cmGlobVerificationManager.h26
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx10
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h10
-rw-r--r--Source/cmGlobalCommonGenerator.cxx14
-rw-r--r--Source/cmGlobalCommonGenerator.h12
-rw-r--r--Source/cmGlobalGenerator.cxx678
-rw-r--r--Source/cmGlobalGenerator.h213
-rw-r--r--Source/cmGlobalGeneratorFactory.h11
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx28
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h18
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx10
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h10
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h2
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h2
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx10
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h10
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx377
-rw-r--r--Source/cmGlobalNinjaGenerator.h208
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx62
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h48
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx98
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h39
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx17
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx104
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h14
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx36
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h25
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx115
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h64
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx47
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h19
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx77
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h30
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx93
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h11
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx10
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h10
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx395
-rw-r--r--Source/cmGlobalXCodeGenerator.h124
-rw-r--r--Source/cmGraphAdjacencyList.h2
-rw-r--r--Source/cmGraphVizWriter.cxx56
-rw-r--r--Source/cmGraphVizWriter.h20
-rw-r--r--Source/cmHexFileConverter.cxx16
-rw-r--r--Source/cmHexFileConverter.h8
-rw-r--r--Source/cmIDEFlagTable.h2
-rw-r--r--Source/cmIDEOptions.cxx14
-rw-r--r--Source/cmIDEOptions.h12
-rw-r--r--Source/cmIfCommand.cxx2
-rw-r--r--Source/cmIfCommand.h2
-rw-r--r--Source/cmImportedCxxModuleInfo.cxx2
-rw-r--r--Source/cmImportedCxxModuleInfo.h2
-rw-r--r--Source/cmIncludeCommand.cxx50
-rw-r--r--Source/cmIncludeCommand.h2
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx6
-rw-r--r--Source/cmIncludeDirectoryCommand.h2
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx2
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h2
-rw-r--r--Source/cmIncludeGuardCommand.cxx2
-rw-r--r--Source/cmIncludeGuardCommand.h2
-rw-r--r--Source/cmIncludeRegularExpressionCommand.cxx2
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h2
-rw-r--r--Source/cmInstallAndroidMKExportGenerator.cxx2
-rw-r--r--Source/cmInstallAndroidMKExportGenerator.h2
-rw-r--r--Source/cmInstallCMakeConfigExportGenerator.cxx2
-rw-r--r--Source/cmInstallCMakeConfigExportGenerator.h2
-rw-r--r--Source/cmInstallCommand.cxx260
-rw-r--r--Source/cmInstallCommand.h2
-rw-r--r--Source/cmInstallCommandArguments.cxx36
-rw-r--r--Source/cmInstallCommandArguments.h30
-rw-r--r--Source/cmInstallCxxModuleBmiGenerator.cxx4
-rw-r--r--Source/cmInstallCxxModuleBmiGenerator.h4
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx8
-rw-r--r--Source/cmInstallDirectoryGenerator.h6
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rw-r--r--Source/cmInstallExportGenerator.h8
-rw-r--r--Source/cmInstallFileSetGenerator.cxx6
-rw-r--r--Source/cmInstallFileSetGenerator.h6
-rw-r--r--Source/cmInstallFilesCommand.cxx12
-rw-r--r--Source/cmInstallFilesCommand.h2
-rw-r--r--Source/cmInstallFilesGenerator.cxx6
-rw-r--r--Source/cmInstallFilesGenerator.h4
-rw-r--r--Source/cmInstallGenerator.cxx22
-rw-r--r--Source/cmInstallGenerator.h24
-rw-r--r--Source/cmInstallGetRuntimeDependenciesGenerator.cxx30
-rw-r--r--Source/cmInstallGetRuntimeDependenciesGenerator.h12
-rw-r--r--Source/cmInstallImportedRuntimeArtifactsGenerator.cxx10
-rw-r--r--Source/cmInstallImportedRuntimeArtifactsGenerator.h4
-rw-r--r--Source/cmInstallMode.h2
-rw-r--r--Source/cmInstallPackageInfoExportGenerator.cxx2
-rw-r--r--Source/cmInstallPackageInfoExportGenerator.h2
-rw-r--r--Source/cmInstallProgramsCommand.cxx12
-rw-r--r--Source/cmInstallProgramsCommand.h2
-rw-r--r--Source/cmInstallRuntimeDependencySet.cxx14
-rw-r--r--Source/cmInstallRuntimeDependencySet.h24
-rw-r--r--Source/cmInstallRuntimeDependencySetGenerator.cxx24
-rw-r--r--Source/cmInstallRuntimeDependencySetGenerator.h32
-rw-r--r--Source/cmInstallScriptGenerator.cxx6
-rw-r--r--Source/cmInstallScriptGenerator.h4
-rw-r--r--Source/cmInstallScriptHandler.cxx92
-rw-r--r--Source/cmInstallScriptHandler.h16
-rw-r--r--Source/cmInstallSubdirectoryGenerator.cxx8
-rw-r--r--Source/cmInstallSubdirectoryGenerator.h2
-rw-r--r--Source/cmInstallTargetGenerator.cxx48
-rw-r--r--Source/cmInstallTargetGenerator.h30
-rw-r--r--Source/cmInstallTargetsCommand.cxx2
-rw-r--r--Source/cmInstallTargetsCommand.h2
-rw-r--r--Source/cmInstallType.h2
-rw-r--r--Source/cmInstalledFile.cxx24
-rw-r--r--Source/cmInstalledFile.h30
-rw-r--r--Source/cmInstrumentation.cxx749
-rw-r--r--Source/cmInstrumentation.h103
-rw-r--r--Source/cmInstrumentationCommand.cxx146
-rw-r--r--Source/cmInstrumentationCommand.h13
-rw-r--r--Source/cmInstrumentationQuery.cxx115
-rw-r--r--Source/cmInstrumentationQuery.h50
-rw-r--r--Source/cmJSONHelpers.cxx28
-rw-r--r--Source/cmJSONHelpers.h88
-rw-r--r--Source/cmJSONState.cxx14
-rw-r--r--Source/cmJSONState.h16
-rw-r--r--Source/cmLDConfigLDConfigTool.cxx4
-rw-r--r--Source/cmLDConfigLDConfigTool.h2
-rw-r--r--Source/cmLDConfigTool.cxx2
-rw-r--r--Source/cmLDConfigTool.h2
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx35
-rw-r--r--Source/cmLinkDirectoriesCommand.h2
-rw-r--r--Source/cmLinkItem.cxx18
-rw-r--r--Source/cmLinkItem.h26
-rw-r--r--Source/cmLinkItemGraphVisitor.cxx8
-rw-r--r--Source/cmLinkItemGraphVisitor.h2
-rw-r--r--Source/cmLinkLibrariesCommand.cxx2
-rw-r--r--Source/cmLinkLibrariesCommand.h2
-rw-r--r--Source/cmLinkLineComputer.cxx6
-rw-r--r--Source/cmLinkLineComputer.h2
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx8
-rw-r--r--Source/cmLinkLineDeviceComputer.h4
-rw-r--r--Source/cmLinkedTree.h2
-rw-r--r--Source/cmList.cxx98
-rw-r--r--Source/cmList.h68
-rw-r--r--Source/cmListCommand.cxx114
-rw-r--r--Source/cmListCommand.h2
-rw-r--r--Source/cmListFileCache.cxx38
-rw-r--r--Source/cmListFileCache.h24
-rw-r--r--Source/cmListFileLexer.h8
-rw-r--r--Source/cmLoadCacheCommand.cxx14
-rw-r--r--Source/cmLoadCacheCommand.h2
-rw-r--r--Source/cmLoadCommandCommand.cxx287
-rw-r--r--Source/cmLoadCommandCommand.h13
-rw-r--r--Source/cmLocalCommonGenerator.cxx2
-rw-r--r--Source/cmLocalCommonGenerator.h2
-rw-r--r--Source/cmLocalGenerator.cxx1002
-rw-r--r--Source/cmLocalGenerator.h275
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmLocalGhsMultiGenerator.h2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx88
-rw-r--r--Source/cmLocalNinjaGenerator.h34
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx397
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h58
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx12
-rw-r--r--Source/cmLocalVisualStudio10Generator.h8
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx453
-rw-r--r--Source/cmLocalVisualStudio7Generator.h59
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx72
-rw-r--r--Source/cmLocalVisualStudioGenerator.h12
-rw-r--r--Source/cmLocalXCodeGenerator.cxx12
-rw-r--r--Source/cmLocalXCodeGenerator.h4
-rw-r--r--Source/cmLocale.h2
-rw-r--r--Source/cmMSVC60LinkLineComputer.cxx2
-rw-r--r--Source/cmMSVC60LinkLineComputer.h2
-rw-r--r--Source/cmMachO.cxx32
-rw-r--r--Source/cmMachO.h4
-rw-r--r--Source/cmMacroCommand.cxx13
-rw-r--r--Source/cmMacroCommand.h2
-rw-r--r--Source/cmMakeDirectoryCommand.cxx2
-rw-r--r--Source/cmMakeDirectoryCommand.h2
-rw-r--r--Source/cmMakefile.cxx1300
-rw-r--r--Source/cmMakefile.h328
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx51
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.h4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx40
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h14
-rw-r--r--Source/cmMakefileProfilingData.cxx12
-rw-r--r--Source/cmMakefileProfilingData.h10
-rw-r--r--Source/cmMakefileTargetGenerator.cxx162
-rw-r--r--Source/cmMakefileTargetGenerator.h42
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx11
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.h2
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx6
-rw-r--r--Source/cmMarkAsAdvancedCommand.h2
-rw-r--r--Source/cmMathCommand.cxx12
-rw-r--r--Source/cmMathCommand.h2
-rw-r--r--Source/cmMessageCommand.cxx28
-rw-r--r--Source/cmMessageCommand.h2
-rw-r--r--Source/cmMessageMetadata.h4
-rw-r--r--Source/cmMessageType.h12
-rw-r--r--Source/cmMessenger.cxx33
-rw-r--r--Source/cmMessenger.h14
-rw-r--r--Source/cmNewLineStyle.cxx4
-rw-r--r--Source/cmNewLineStyle.h4
-rw-r--r--Source/cmNinjaLinkLineComputer.cxx2
-rw-r--r--Source/cmNinjaLinkLineComputer.h2
-rw-r--r--Source/cmNinjaLinkLineDeviceComputer.cxx2
-rw-r--r--Source/cmNinjaLinkLineDeviceComputer.h2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx115
-rw-r--r--Source/cmNinjaNormalTargetGenerator.h66
-rw-r--r--Source/cmNinjaTargetGenerator.cxx197
-rw-r--r--Source/cmNinjaTargetGenerator.h108
-rw-r--r--Source/cmNinjaTypes.h2
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.h4
-rw-r--r--Source/cmOSXBundleGenerator.cxx20
-rw-r--r--Source/cmOSXBundleGenerator.h26
-rw-r--r--Source/cmOptionCommand.cxx10
-rw-r--r--Source/cmOptionCommand.h2
-rw-r--r--Source/cmOrderDirectories.cxx18
-rw-r--r--Source/cmOrderDirectories.h14
-rw-r--r--Source/cmOutputConverter.cxx6
-rw-r--r--Source/cmOutputConverter.h4
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx514
-rw-r--r--Source/cmOutputRequiredFilesCommand.h13
-rw-r--r--Source/cmPackageInfoReader.cxx788
-rw-r--r--Source/cmPackageInfoReader.h109
-rw-r--r--Source/cmParseArgumentsCommand.cxx18
-rw-r--r--Source/cmParseArgumentsCommand.h2
-rw-r--r--Source/cmPathLabel.cxx6
-rw-r--r--Source/cmPathLabel.h10
-rw-r--r--Source/cmPathResolver.cxx552
-rw-r--r--Source/cmPathResolver.h106
-rw-r--r--Source/cmPkgConfigParser.cxx18
-rw-r--r--Source/cmPkgConfigParser.h20
-rw-r--r--Source/cmPkgConfigResolver.cxx80
-rw-r--r--Source/cmPkgConfigResolver.h62
-rw-r--r--Source/cmPlaceholderExpander.cxx2
-rw-r--r--Source/cmPlaceholderExpander.h2
-rw-r--r--Source/cmPlistParser.cxx4
-rw-r--r--Source/cmPlistParser.h4
-rw-r--r--Source/cmPolicies.cxx151
-rw-r--r--Source/cmPolicies.h416
-rw-r--r--Source/cmProcessOutput.cxx8
-rw-r--r--Source/cmProcessOutput.h4
-rw-r--r--Source/cmProcessTools.cxx12
-rw-r--r--Source/cmProcessTools.h16
-rw-r--r--Source/cmProjectCommand.cxx41
-rw-r--r--Source/cmProjectCommand.h2
-rw-r--r--Source/cmProperty.h2
-rw-r--r--Source/cmPropertyDefinition.cxx10
-rw-r--r--Source/cmPropertyDefinition.h20
-rw-r--r--Source/cmPropertyMap.cxx12
-rw-r--r--Source/cmPropertyMap.h12
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapCPPCommand.h2
-rw-r--r--Source/cmQTWrapUICommand.cxx2
-rw-r--r--Source/cmQTWrapUICommand.h2
-rw-r--r--Source/cmQtAutoGen.cxx18
-rw-r--r--Source/cmQtAutoGen.h8
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx10
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.h2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx57
-rw-r--r--Source/cmQtAutoGenInitializer.h4
-rw-r--r--Source/cmQtAutoGenerator.cxx3
-rw-r--r--Source/cmQtAutoGenerator.h2
-rw-r--r--Source/cmQtAutoMocUic.cxx130
-rw-r--r--Source/cmQtAutoMocUic.h2
-rw-r--r--Source/cmQtAutoRcc.cxx2
-rw-r--r--Source/cmQtAutoRcc.h2
-rw-r--r--Source/cmRST.cxx2
-rw-r--r--Source/cmRST.h2
-rw-r--r--Source/cmRange.h2
-rw-r--r--Source/cmRemoveCommand.cxx2
-rw-r--r--Source/cmRemoveCommand.h2
-rw-r--r--Source/cmRemoveDefinitionsCommand.cxx2
-rw-r--r--Source/cmRemoveDefinitionsCommand.h2
-rw-r--r--Source/cmReturnCommand.cxx9
-rw-r--r--Source/cmReturnCommand.h2
-rw-r--r--Source/cmRulePlaceholderExpander.cxx33
-rw-r--r--Source/cmRulePlaceholderExpander.h97
-rw-r--r--Source/cmRuntimeDependencyArchive.cxx66
-rw-r--r--Source/cmRuntimeDependencyArchive.h42
-rw-r--r--Source/cmSarifLog.cxx383
-rw-r--r--Source/cmSarifLog.h287
-rw-r--r--Source/cmScanDepFormat.cxx4
-rw-r--r--Source/cmScanDepFormat.h2
-rw-r--r--Source/cmScriptGenerator.cxx16
-rw-r--r--Source/cmScriptGenerator.h12
-rw-r--r--Source/cmSearchPath.cxx96
-rw-r--r--Source/cmSearchPath.h37
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx2
-rw-r--r--Source/cmSeparateArgumentsCommand.h2
-rw-r--r--Source/cmSetCommand.cxx4
-rw-r--r--Source/cmSetCommand.h2
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.cxx4
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h2
-rw-r--r--Source/cmSetPropertyCommand.cxx162
-rw-r--r--Source/cmSetPropertyCommand.h4
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx10
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h2
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx4
-rw-r--r--Source/cmSetTargetPropertiesCommand.h2
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx4
-rw-r--r--Source/cmSetTestsPropertiesCommand.h2
-rw-r--r--Source/cmSiteNameCommand.cxx2
-rw-r--r--Source/cmSiteNameCommand.h2
-rw-r--r--Source/cmSourceFile.cxx40
-rw-r--r--Source/cmSourceFile.h44
-rw-r--r--Source/cmSourceFileLocation.cxx12
-rw-r--r--Source/cmSourceFileLocation.h12
-rw-r--r--Source/cmSourceFileLocationKind.h2
-rw-r--r--Source/cmSourceGroup.cxx32
-rw-r--r--Source/cmSourceGroup.h28
-rw-r--r--Source/cmSourceGroupCommand.cxx102
-rw-r--r--Source/cmSourceGroupCommand.h2
-rw-r--r--Source/cmStandardLevel.h2
-rw-r--r--Source/cmStandardLevelResolver.cxx42
-rw-r--r--Source/cmStandardLevelResolver.h20
-rw-r--r--Source/cmStandardLexer.h2
-rw-r--r--Source/cmState.cxx123
-rw-r--r--Source/cmState.h72
-rw-r--r--Source/cmStateDirectory.cxx41
-rw-r--r--Source/cmStateDirectory.h14
-rw-r--r--Source/cmStatePrivate.h4
-rw-r--r--Source/cmStateSnapshot.cxx35
-rw-r--r--Source/cmStateSnapshot.h21
-rw-r--r--Source/cmStateTypes.h20
-rw-r--r--Source/cmString.cxx8
-rw-r--r--Source/cmString.hxx68
-rw-r--r--Source/cmStringAlgorithms.cxx48
-rw-r--r--Source/cmStringAlgorithms.h116
-rw-r--r--Source/cmStringCommand.cxx130
-rw-r--r--Source/cmStringCommand.h2
-rw-r--r--Source/cmStringReplaceHelper.cxx8
-rw-r--r--Source/cmStringReplaceHelper.h10
-rw-r--r--Source/cmSubcommandTable.cxx2
-rw-r--r--Source/cmSubcommandTable.h2
-rw-r--r--Source/cmSubdirCommand.cxx2
-rw-r--r--Source/cmSubdirCommand.h2
-rw-r--r--Source/cmSubdirDependsCommand.cxx11
-rw-r--r--Source/cmSubdirDependsCommand.h13
-rw-r--r--Source/cmSyntheticTargetCache.h2
-rw-r--r--Source/cmSystemTools.cxx1084
-rw-r--r--Source/cmSystemTools.h178
-rw-r--r--Source/cmTarget.cxx393
-rw-r--r--Source/cmTarget.h56
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx8
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h2
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx8
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h2
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx8
-rw-r--r--Source/cmTargetCompileOptionsCommand.h2
-rw-r--r--Source/cmTargetDepend.h2
-rw-r--r--Source/cmTargetExport.h2
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx16
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h2
-rw-r--r--Source/cmTargetLinkDirectoriesCommand.cxx12
-rw-r--r--Source/cmTargetLinkDirectoriesCommand.h2
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx211
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h2
-rw-r--r--Source/cmTargetLinkLibraryType.h2
-rw-r--r--Source/cmTargetLinkOptionsCommand.cxx8
-rw-r--r--Source/cmTargetLinkOptionsCommand.h2
-rw-r--r--Source/cmTargetPrecompileHeadersCommand.cxx12
-rw-r--r--Source/cmTargetPrecompileHeadersCommand.h2
-rw-r--r--Source/cmTargetPropCommandBase.cxx16
-rw-r--r--Source/cmTargetPropCommandBase.h14
-rw-r--r--Source/cmTargetPropertyComputer.cxx42
-rw-r--r--Source/cmTargetPropertyComputer.h38
-rw-r--r--Source/cmTargetSourcesCommand.cxx36
-rw-r--r--Source/cmTargetSourcesCommand.h2
-rw-r--r--Source/cmTargetTraceDependencies.cxx6
-rw-r--r--Source/cmTargetTraceDependencies.h4
-rw-r--r--Source/cmTest.cxx14
-rw-r--r--Source/cmTest.h16
-rw-r--r--Source/cmTestGenerator.cxx34
-rw-r--r--Source/cmTestGenerator.h10
-rw-r--r--Source/cmTimestamp.cxx18
-rw-r--r--Source/cmTimestamp.h8
-rw-r--r--Source/cmTransformDepfile.cxx24
-rw-r--r--Source/cmTransformDepfile.h6
-rw-r--r--Source/cmTryCompileCommand.cxx4
-rw-r--r--Source/cmTryCompileCommand.h2
-rw-r--r--Source/cmTryRunCommand.cxx121
-rw-r--r--Source/cmTryRunCommand.h2
-rw-r--r--Source/cmUVHandlePtr.cxx4
-rw-r--r--Source/cmUVHandlePtr.h8
-rw-r--r--Source/cmUVProcessChain.cxx39
-rw-r--r--Source/cmUVProcessChain.h15
-rw-r--r--Source/cmUVStream.h4
-rw-r--r--Source/cmUVStreambuf.h6
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cmUnsetCommand.h2
-rw-r--r--Source/cmUseMangledMesaCommand.cxx103
-rw-r--r--Source/cmUseMangledMesaCommand.h13
-rw-r--r--Source/cmUtilitySourceCommand.cxx118
-rw-r--r--Source/cmUtilitySourceCommand.h13
-rw-r--r--Source/cmUtils.hxx2
-rw-r--r--Source/cmUuid.cxx8
-rw-r--r--Source/cmUuid.h6
-rw-r--r--Source/cmVSSetupHelper.cxx21
-rw-r--r--Source/cmVSSetupHelper.h10
-rw-r--r--Source/cmValue.h40
-rw-r--r--Source/cmVariableRequiresCommand.cxx64
-rw-r--r--Source/cmVariableRequiresCommand.h13
-rw-r--r--Source/cmVariableWatch.cxx16
-rw-r--r--Source/cmVariableWatch.h20
-rw-r--r--Source/cmVariableWatchCommand.cxx12
-rw-r--r--Source/cmVariableWatchCommand.h2
-rw-r--r--Source/cmVersion.cxx4
-rw-r--r--Source/cmVersion.h6
-rw-r--r--Source/cmVersionConfig.h.in2
-rw-r--r--Source/cmVersionMacros.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx333
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h50
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx18
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h16
-rw-r--r--Source/cmVisualStudioSlnData.cxx20
-rw-r--r--Source/cmVisualStudioSlnData.h30
-rw-r--r--Source/cmVisualStudioSlnParser.cxx72
-rw-r--r--Source/cmVisualStudioSlnParser.h26
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.cxx28
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.h20
-rw-r--r--Source/cmVsProjectType.h2
-rw-r--r--Source/cmWhileCommand.cxx4
-rw-r--r--Source/cmWhileCommand.h2
-rw-r--r--Source/cmWindowsRegistry.cxx34
-rw-r--r--Source/cmWindowsRegistry.h10
-rw-r--r--Source/cmWorkerPool.cxx46
-rw-r--r--Source/cmWorkerPool.h5
-rw-r--r--Source/cmWorkingDirectory.cxx15
-rw-r--r--Source/cmWorkingDirectory.h20
-rw-r--r--Source/cmWriteFileCommand.cxx2
-rw-r--r--Source/cmWriteFileCommand.h2
-rw-r--r--Source/cmXCOFF.cxx16
-rw-r--r--Source/cmXCOFF.h4
-rw-r--r--Source/cmXCode21Object.cxx6
-rw-r--r--Source/cmXCode21Object.h2
-rw-r--r--Source/cmXCodeObject.cxx22
-rw-r--r--Source/cmXCodeObject.h34
-rw-r--r--Source/cmXCodeScheme.cxx87
-rw-r--r--Source/cmXCodeScheme.h71
-rw-r--r--Source/cmXMLParser.cxx32
-rw-r--r--Source/cmXMLParser.h40
-rw-r--r--Source/cmXMLSafe.cxx6
-rw-r--r--Source/cmXMLSafe.h4
-rw-r--r--Source/cmXMLWriter.cxx14
-rw-r--r--Source/cmXMLWriter.h38
-rw-r--r--Source/cmXcFramework.cxx14
-rw-r--r--Source/cmXcFramework.h12
-rw-r--r--Source/cm_codecvt.cxx12
-rw-r--r--Source/cm_codecvt.hxx10
-rw-r--r--Source/cm_codecvt_Encoding.hxx2
-rw-r--r--Source/cm_fileno.cxx2
-rw-r--r--Source/cm_fileno.hxx2
-rw-r--r--Source/cm_get_date.c2
-rw-r--r--Source/cm_get_date.h4
-rw-r--r--Source/cm_sys_stat.h2
-rw-r--r--Source/cm_utf8.c10
-rw-r--r--Source/cm_utf8.h6
-rw-r--r--Source/cmake.cxx680
-rw-r--r--Source/cmake.h190
-rw-r--r--Source/cmake.version.manifest5
-rw-r--r--Source/cmakemain.cxx138
-rw-r--r--Source/cmcldeps.cxx19
-rw-r--r--Source/cmcmd.cxx96
-rw-r--r--Source/cmcmd.h10
-rw-r--r--Source/ctest.cxx67
-rw-r--r--Source/kwsys/Base64.c24
-rw-r--r--Source/kwsys/Base64.h.in12
-rw-r--r--Source/kwsys/CMakeLists.txt31
-rw-r--r--Source/kwsys/CONTRIBUTING.rst2
-rw-r--r--Source/kwsys/CommandLineArguments.cxx60
-rw-r--r--Source/kwsys/CommandLineArguments.hxx.in110
-rw-r--r--Source/kwsys/Configure.hxx.in5
-rw-r--r--Source/kwsys/ConsoleBuf.hxx.in34
-rw-r--r--Source/kwsys/Directory.cxx8
-rw-r--r--Source/kwsys/Directory.hxx.in12
-rw-r--r--Source/kwsys/DynamicLoader.cxx48
-rw-r--r--Source/kwsys/DynamicLoader.hxx.in12
-rw-r--r--Source/kwsys/Encoding.h.in8
-rw-r--r--Source/kwsys/Encoding.hxx.in14
-rw-r--r--Source/kwsys/EncodingC.c8
-rw-r--r--Source/kwsys/EncodingCXX.cxx44
-rw-r--r--Source/kwsys/FStream.hxx.in8
-rw-r--r--Source/kwsys/Glob.cxx18
-rw-r--r--Source/kwsys/Glob.hxx.in24
-rw-r--r--Source/kwsys/MD5.c18
-rw-r--r--Source/kwsys/Process.h.in7
-rw-r--r--Source/kwsys/ProcessUNIX.c52
-rw-r--r--Source/kwsys/ProcessWin32.c18
-rw-r--r--Source/kwsys/RegularExpression.cxx100
-rw-r--r--Source/kwsys/RegularExpression.hxx.in113
-rw-r--r--Source/kwsys/Status.cxx10
-rw-r--r--Source/kwsys/String.c8
-rw-r--r--Source/kwsys/String.h.in4
-rw-r--r--Source/kwsys/System.c8
-rw-r--r--Source/kwsys/System.h.in2
-rw-r--r--Source/kwsys/SystemInformation.cxx191
-rw-r--r--Source/kwsys/SystemInformation.hxx.in80
-rw-r--r--Source/kwsys/SystemTools.cxx822
-rw-r--r--Source/kwsys/SystemTools.hxx.in300
-rw-r--r--Source/kwsys/Terminal.c16
-rw-r--r--Source/kwsys/Terminal.h.in2
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx2
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx10
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx2
-rw-r--r--Source/kwsys/testConsoleBuf.cxx18
-rw-r--r--Source/kwsys/testConsoleBuf.hxx8
-rw-r--r--Source/kwsys/testConsoleBufChild.cxx2
-rw-r--r--Source/kwsys/testDirectory.cxx10
-rw-r--r--Source/kwsys/testDynamicLoader.cxx4
-rw-r--r--Source/kwsys/testEncode.c10
-rw-r--r--Source/kwsys/testEncoding.cxx10
-rw-r--r--Source/kwsys/testFStream.cxx12
-rw-r--r--Source/kwsys/testProcess.c48
-rw-r--r--Source/kwsys/testSystemTools.cxx93
-rw-r--r--Templates/.gitattributes1
-rw-r--r--Templates/CPack.GenericDescription.txt1
-rw-r--r--Templates/CPack.GenericLicense.txt1
-rw-r--r--Tests/BuildDepends/Project/generator.cxx4
-rw-r--r--Tests/BuildDepends/Project/zot.cxx6
-rw-r--r--Tests/BuildDepends/Project/zot_macro_dir.cxx2
-rw-r--r--Tests/BuildDepends/Project/zot_macro_tgt.cxx2
-rw-r--r--Tests/BuildDepends/Project/zot_pch.cxx2
-rw-r--r--Tests/BundleGeneratorTest/Executable.cxx2
-rw-r--r--Tests/BundleGeneratorTest/Library.cxx2
-rwxr-xr-xTests/BundleGeneratorTest/StartupCommand1
-rw-r--r--Tests/BundleTest/BundleLib.cxx2
-rw-r--r--Tests/BundleTest/randomResourceFile.plist.in1
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt39
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt2
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h2
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h3
-rw-r--r--Tests/CMakeCommands/target_link_libraries/compile_only.cpp7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/link_only.cpp (renamed from Tests/FindPackageTest/FindPackageTest.cxx)0
-rw-r--r--Tests/CMakeCopyright.cmake8
-rw-r--r--Tests/CMakeGUI/CMakeGUITest.cxx6
-rw-r--r--Tests/CMakeGUI/CMakeGUITest.h2
-rw-r--r--Tests/CMakeGUI/CatchShow.cxx2
-rw-r--r--Tests/CMakeGUI/CatchShow.h2
-rw-r--r--Tests/CMakeGUI/CatchShowTest.cxx2
-rw-r--r--Tests/CMakeGUI/CatchShowTest.h2
-rw-r--r--Tests/CMakeGUI/EnvironmentDialogTest.cxx2
-rw-r--r--Tests/CMakeGUI/EnvironmentDialogTest.h2
-rw-r--r--Tests/CMakeGUI/QCMakeCacheModelTest.cxx4
-rw-r--r--Tests/CMakeGUI/QCMakeCacheModelTest.h2
-rw-r--r--Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx2
-rw-r--r--Tests/CMakeGUI/QCMakePresetComboBoxTest.h2
-rw-r--r--Tests/CMakeGUI/QCMakePresetItemModelTest.cxx2
-rw-r--r--Tests/CMakeGUI/QCMakePresetItemModelTest.h2
-rw-r--r--Tests/CMakeGUI/QCMakePresetTest.cxx2
-rw-r--r--Tests/CMakeGUI/QCMakePresetTest.h2
-rw-r--r--Tests/CMakeLib/CMakeLists.txt17
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx6
-rw-r--r--Tests/CMakeLib/testAffinity.cxx2
-rw-r--r--Tests/CMakeLib/testArgumentParser.cxx2
-rw-r--r--Tests/CMakeLib/testAssert.cxx6
-rw-r--r--Tests/CMakeLib/testCMExtEnumSet.cxx233
-rw-r--r--Tests/CMakeLib/testCMFilesystemPath.cxx4
-rw-r--r--Tests/CMakeLib/testCMakePath.cxx2
-rw-r--r--Tests/CMakeLib/testCTestBinPacker.cxx7
-rw-r--r--Tests/CMakeLib/testCTestResourceAllocator.cxx186
-rw-r--r--Tests/CMakeLib/testCTestResourceGroups.cxx6
-rw-r--r--Tests/CMakeLib/testCTestResourceSpec.cxx6
-rw-r--r--Tests/CMakeLib/testCommon.h9
-rw-r--r--Tests/CMakeLib/testConfig.h.in2
-rw-r--r--Tests/CMakeLib/testDebugger.h6
-rw-r--r--Tests/CMakeLib/testDebuggerAdapter.cxx11
-rw-r--r--Tests/CMakeLib/testDebuggerAdapterPipe.cxx17
-rw-r--r--Tests/CMakeLib/testDebuggerBreakpointManager.cxx6
-rw-r--r--Tests/CMakeLib/testDebuggerNamedPipe.cxx38
-rw-r--r--Tests/CMakeLib/testDebuggerThread.cxx44
-rw-r--r--Tests/CMakeLib/testDebuggerVariables.cxx2
-rw-r--r--Tests/CMakeLib/testDebuggerVariablesHelper.cxx14
-rw-r--r--Tests/CMakeLib/testDebuggerVariablesManager.cxx2
-rw-r--r--Tests/CMakeLib/testDocumentationFormatter.cxx184
-rw-r--r--Tests/CMakeLib/testEncoding.cxx2
-rw-r--r--Tests/CMakeLib/testFindPackageCommand.cxx2
-rw-r--r--Tests/CMakeLib/testGccDepfileReader.cxx28
-rw-r--r--Tests/CMakeLib/testGeneratedFileStream.cxx2
-rw-r--r--Tests/CMakeLib/testJSONHelpers.cxx16
-rw-r--r--Tests/CMakeLib/testList.cxx4
-rw-r--r--Tests/CMakeLib/testOptional.cxx96
-rw-r--r--Tests/CMakeLib/testPathResolver.cxx599
-rw-r--r--Tests/CMakeLib/testRST.cxx2
-rw-r--r--Tests/CMakeLib/testRange.cxx2
-rw-r--r--Tests/CMakeLib/testString.cxx66
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx23
-rw-r--r--Tests/CMakeLib/testSystemTools.cxx197
-rw-r--r--Tests/CMakeLib/testUTF8.cxx10
-rw-r--r--Tests/CMakeLib/testUVJobServerClient.cxx4
-rw-r--r--Tests/CMakeLib/testUVPatches.cxx47
-rw-r--r--Tests/CMakeLib/testUVProcessChain.cxx52
-rw-r--r--Tests/CMakeLib/testUVProcessChainHelper.cxx4
-rw-r--r--Tests/CMakeLib/testUVStreambuf.cxx13
-rw-r--r--Tests/CMakeLib/testVisualStudioSlnParser.cxx10
-rw-r--r--Tests/CMakeLib/testVisualStudioSlnParser_data/.gitattributes2
-rw-r--r--Tests/CMakeLib/testXMLSafe.cxx6
-rw-r--r--Tests/CMakeLists.txt52
-rw-r--r--Tests/CMakeTests/.gitattributes1
-rw-r--r--Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in16
-rw-r--r--Tests/CMakeTests/IfTest.cmake.in54
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in37
-rw-r--r--Tests/CMakeTests/ModuleNoticesTest.cmake.in2
-rw-r--r--Tests/CMakeTests/StringTest.cmake.in2
-rw-r--r--Tests/CMakeTests/StringTestScript.cmake15
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt2
-rw-r--r--Tests/CTestConfig/CTestConfig.cxx2
-rw-r--r--Tests/CTestConfig/ScriptWithArgs.cmake2
-rw-r--r--Tests/CTestLimitDashJ/CreateSleepDelete.cmake2
-rw-r--r--Tests/CTestScriptMode/CTestTestScriptMode.cmake.in6
-rw-r--r--Tests/CTestTest/SmallAndFast/echoargs.c2
-rw-r--r--Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx2
-rw-r--r--Tests/CTestTest/test.cmake.in6
-rw-r--r--Tests/CTestTest2/test.cmake.in20
-rw-r--r--Tests/CTestTestCrash/crash.cxx2
-rw-r--r--Tests/CTestTestEmptyBinaryDirectory/test.cmake.in2
-rw-r--r--Tests/CTestTestLabelRegExp/test.cmake.in4
-rw-r--r--Tests/CTestTestLaunchers/test.cmake.in9
-rw-r--r--Tests/CTestTestParallel/lockFile.c2
-rw-r--r--Tests/CTestTestRunScript/hello.cmake.in1
-rw-r--r--Tests/CTestTestRunScript/test.cmake.in1
-rw-r--r--Tests/CTestTestScheduler/CMakeLists.txt4
-rw-r--r--Tests/CTestTestSerialInDepends/test.ctest10
-rw-r--r--Tests/CTestTestUpload/sleep.c2
-rw-r--r--Tests/CTestUpdateCommon.cmake6
-rw-r--r--Tests/CheckFortran.cmake2
-rw-r--r--Tests/CommandLineTest/CMakeLists.txt8
-rw-r--r--Tests/CompileDefinitions/compiletest.c4
-rw-r--r--Tests/CompileDefinitions/compiletest.cpp4
-rw-r--r--Tests/CompileDefinitions/target_prop/CMakeLists.txt3
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt1
-rw-r--r--Tests/CompileFeatures/cxx_deleted_functions.cpp4
-rw-r--r--Tests/CompileFeatures/cxx_raw_string_literals.cpp2
-rw-r--r--Tests/CompileFeatures/cxx_relaxed_constexpr.cpp2
-rw-r--r--Tests/CompileFeatures/cxx_unrestricted_unions.cpp2
-rw-r--r--Tests/Complex/CMakeLists.txt40
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt15
-rw-r--r--Tests/Complex/Executable/Included.cmake1
-rw-r--r--Tests/Complex/Executable/Temp/CMakeLists.txt8
-rw-r--r--Tests/Complex/Executable/complex.cxx34
-rw-r--r--Tests/Complex/Library/CMakeLists.txt7
-rw-r--r--Tests/Complex/VarTests.cmake9
-rw-r--r--Tests/Complex/cmTestConfigure.h.in4
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt40
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt15
-rw-r--r--Tests/ComplexOneConfig/Executable/Included.cmake1
-rw-r--r--Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt8
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx34
-rw-r--r--Tests/ComplexOneConfig/Library/CMakeLists.txt7
-rw-r--r--Tests/ComplexOneConfig/VarTests.cmake9
-rw-r--r--Tests/ComplexOneConfig/cmTestConfigure.h.in4
-rw-r--r--Tests/Cuda/Complex/file2.cu6
-rw-r--r--Tests/Cuda/ProperDeviceLibraries/main.cu2
-rw-r--r--Tests/Cuda/SharedRuntimePlusToolkit/nppif.cpp26
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp26
-rw-r--r--Tests/CudaOnly/CUBIN/main.cu2
-rw-r--r--Tests/CudaOnly/Fatbin/main.cu2
-rw-r--r--Tests/CudaOnly/OptixIR/main.cu4
-rw-r--r--Tests/CudaOnly/ResolveDeviceSymbols/file2.cu4
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file2.cu6
-rw-r--r--Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu26
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu26
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt2
-rw-r--r--Tests/CustomCommand/GeneratedHeader/CMakeLists.txt1
-rw-r--r--Tests/CustomCommand/foo.in1
-rw-r--r--Tests/CustomCommand/wrapper.cxx2
-rw-r--r--Tests/CustomCommandByproducts/CMakeLists.txt8
-rw-r--r--Tests/CustomCommandByproducts/ninja-check.cmake20
-rw-r--r--Tests/CustomCommandWorkingDirectory/working.c.in1
-rw-r--r--Tests/Dependency/Case1/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Eight/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Exec/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Exec2/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Exec3/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Exec4/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Five/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Seven/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Six/CMakeLists.txt1
-rw-r--r--Tests/Dependency/Three/CMakeLists.txt1
-rw-r--r--Tests/EmptyProperty/CMakeLists.txt1
-rw-r--r--Tests/EnforceConfig.cmake.in3
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt101
-rw-r--r--Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c3
-rw-r--r--Tests/ExportImport/Export/testExe1.c2
-rw-r--r--Tests/ExportImport/Export/testExe3.c2
-rw-r--r--Tests/ExportImport/Export/testExe4.c2
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt30
-rw-r--r--Tests/ExportImport/Import/A/cmp0022OLD_test.cpp12
-rw-r--r--Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp1
-rw-r--r--Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp1
-rw-r--r--Tests/ExportImport/Import/CMakeLists.txt1
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake2
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c3
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c3
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c3
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c3
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c6
-rw-r--r--Tests/ExternalProject/CMakeLists.txt34
-rw-r--r--Tests/ExternalProject/cvsrepo.tgzbin1317 -> 1462 bytes-rw-r--r--Tests/ExternalProject/gitrepo-sub-rec.tgzbin2086 -> 2202 bytes-rw-r--r--Tests/ExternalProject/gitrepo-sub.tgzbin2229 -> 2329 bytes-rwxr-xr-xTests/ExternalProject/gitrepo.bash7
-rw-r--r--Tests/ExternalProject/gitrepo.tgzbin1817 -> 1903 bytes-rw-r--r--Tests/ExternalProject/hgrepo.tgzbin2011 -> 2711 bytes-rw-r--r--Tests/ExternalProject/svnrepo.tgzbin3673 -> 3936 bytes-rw-r--r--Tests/ExternalProjectLocal/CMakeLists.txt8
-rw-r--r--Tests/ExternalProjectLocal/Step1.tarbin5632 -> 10240 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1.tar.bz2bin904 -> 898 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1.tgzbin791 -> 820 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1.zipbin1074 -> 1370 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1NoDir.tarbin5120 -> 10240 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1NoDir.tar.bz2bin852 -> 846 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1NoDir.tgzbin770 -> 785 bytes-rw-r--r--Tests/ExternalProjectLocal/Step1NoDir.zipbin1038 -> 1194 bytes-rw-r--r--Tests/ExternalProjectLocal/Step5/CMakeLists.txt2
-rw-r--r--Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake18
-rw-r--r--Tests/ExternalProjectUpdate/gitrepo.tgzbin3397 -> 3550 bytes-rw-r--r--Tests/FindCURL/Test/CMakeLists.txt7
-rw-r--r--Tests/FindGTK2/CMakeLists.txt24
-rw-r--r--Tests/FindGTK2/atk/main.c2
-rw-r--r--Tests/FindGTK2/gdk_pixbuf/main.c8
-rw-r--r--Tests/FindHDF5/Test/test_C.c2
-rw-r--r--Tests/FindHDF5/Test/test_CXX.cxx2
-rw-r--r--Tests/FindICU/Test/main.cpp2
-rw-r--r--Tests/FindIconv/Test/main.cxx6
-rw-r--r--Tests/FindLibLZMA/Test/main.c4
-rw-r--r--Tests/FindMatlab/matlab_wrapper1.cpp4
-rw-r--r--Tests/FindMatlab/matlab_wrapper2.cpp4
-rw-r--r--Tests/FindMatlab/matlab_wrapper_failure.cpp4
-rw-r--r--Tests/FindOpenACC/CTest/main.c2
-rw-r--r--Tests/FindOpenACC/CXXTest/main.cxx4
-rw-r--r--Tests/FindOpenSP/Test/main.cxx6
-rw-r--r--Tests/FindPackageCMakeTest/.gitignore (renamed from Tests/FindPackageTest/.gitignore)0
-rw-r--r--Tests/FindPackageCMakeTest/A/wibble-config.cmake (renamed from Tests/FindPackageTest/B/wibble-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/B/wibble-config.cmake (renamed from Tests/FindPackageTest/A/wibble-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 1.1/BazConfig.cmake (renamed from Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 1.1/BazConfigVersion.cmake7
-rw-r--r--Tests/FindPackageCMakeTest/Baz 1.2/CMake/BazConfig.cmake (renamed from Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 1.2/CMake/BazConfigVersion.cmake (renamed from Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake (renamed from Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake (renamed from Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 2.0/share/Baz 2/BazConfig.cmake (renamed from Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake (renamed from Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake (renamed from Tests/FindPackageTest/Baz 1.1/BazConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake (renamed from Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/CMakeLists.txt696
-rw-r--r--Tests/FindPackageCMakeTest/Exporter/CMakeLists.txt (renamed from Tests/FindPackageTest/Exporter/CMakeLists.txt)0
-rw-r--r--Tests/FindPackageCMakeTest/Exporter/CMakeTestExportPackageConfig.cmake.in (renamed from Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in)0
-rw-r--r--Tests/FindPackageCMakeTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in (renamed from Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in)0
-rw-r--r--Tests/FindPackageCMakeTest/Exporter/dummy.c (renamed from Tests/FindPackageTest/Exporter/dummy.c)0
-rw-r--r--Tests/FindPackageCMakeTest/FindLotsOfComponents.cmake (renamed from Tests/FindPackageTest/FindLotsOfComponents.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindPackageHandleStandardArgs.cmake (renamed from Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindPackageTest.cxx4
-rw-r--r--Tests/FindPackageCMakeTest/FindRecursiveA.cmake (renamed from Tests/FindPackageTest/FindRecursiveA.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindRecursiveB.cmake (renamed from Tests/FindPackageTest/FindRecursiveB.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindRecursiveC.cmake (renamed from Tests/FindPackageTest/FindRecursiveC.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindSomePackage.cmake (renamed from Tests/FindPackageTest/FindSomePackage.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindUpperCasePackage.cmake (renamed from Tests/FindPackageTest/FindUpperCasePackage.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindVersionTestA.cmake (renamed from Tests/FindPackageTest/FindVersionTestA.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindVersionTestB.cmake (renamed from Tests/FindPackageTest/FindVersionTestB.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindVersionTestC.cmake (renamed from Tests/FindPackageTest/FindVersionTestC.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/FindVersionTestD.cmake (renamed from Tests/FindPackageTest/FindVersionTestD.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/PreferConfig/ABCConfig.cmake (renamed from Tests/FindPackageTest/PreferConfig/ABCConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/PreferConfig/FindABC.cmake (renamed from Tests/FindPackageTest/PreferConfig/FindABC.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/PreferConfigOnlyModule/FindACME.cmake (renamed from Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/PreferConfigRecurse/ACMEConfig.cmake (renamed from Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/PreferConfigRecurse/FindACME.cmake (renamed from Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/RelocatableConfig.cmake.in (renamed from Tests/FindPackageTest/RelocatableConfig.cmake.in)0
-rw-r--r--Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfig.cmake2
-rw-r--r--Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfigVersion.cmake (renamed from Tests/FindPackageTest/SortLib-3.1.1/SortLibConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfig.cmake2
-rw-r--r--Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfigVersion.cmake (renamed from Tests/FindPackageTest/SortLib-3.10.1/SortLibConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfig.cmake (renamed from Tests/FindPackageTest/SortLib-3.1.1/SortLibConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfigVersion.cmake9
-rw-r--r--Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfig.cmake (renamed from Tests/FindPackageTest/SortLib-3.10.1/SortLibConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfigVersion.cmake9
-rw-r--r--Tests/FindPackageCMakeTest/SystemPackage/CMakeTestSystemPackageConfig.cmake (renamed from Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/TApp.app/Contents/Resources/TAppConfig.cmake (renamed from Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake (renamed from Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake (renamed from Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake (renamed from Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/cmake/SetFoundFALSEConfig.cmake (renamed from Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/cmake/SetFoundResolvedConfig.cmake (renamed from Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/cmake/SetFoundTRUEConfig.cmake (renamed from Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/include/foo.h (renamed from Tests/FindPackageTest/include/foo.h)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/Bar/BarConfig.cmake (renamed from Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/Bar/cmake/bar-config.cmake (renamed from Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/Blub/BlubConfig.cmake (renamed from Tests/FindPackageTest/lib/Blub/BlubConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/RecursiveA/recursivea-config.cmake (renamed from Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/SortLib-4.0.0/SortLibConfig.cmake (renamed from Tests/FindPackageTest/lib/SortLib-4.0.0/SortLibConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/SortLib-4.0.0/SortLibConfigVersion.cmake (renamed from Tests/FindPackageTest/lib/SortLib-4.0.0/SortLibConfigVersion.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/TApp/TAppConfig.cmake (renamed from Tests/FindPackageTest/lib/TApp/TAppConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/arch/Bar/BarConfig.cmake (renamed from Tests/FindPackageTest/lib/Bar/BarConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake (renamed from Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/arch/cmake/zot-4.0/zot-config.cmake (renamed from Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/arch/foo-1.2/CMake/FooConfig.cmake (renamed from Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/arch/zot-3.1/zot-config-version.cmake (renamed from Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/arch/zot-3.1/zot-config.cmake (renamed from Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/cmake/zot-3.1/zot-config-version.cmake (renamed from Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/cmake/zot-3.1/zot-config.cmake (renamed from Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config-version.cmake7
-rw-r--r--Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config.cmake (renamed from Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/foo-1.2/CMake/FooConfig.cmake (renamed from Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/foo-1.2/foo-config.cmake (renamed from Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfig.cmake (renamed from Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfigVersion.cmake7
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-1.0/zot-config.cmake (renamed from Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config-version.cmake4
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config.cmake (renamed from Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config-version.cmake4
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config.cmake (renamed from Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config-version.cmake7
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config.cmake (renamed from Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot/zot-config-version.cmake9
-rw-r--r--Tests/FindPackageCMakeTest/lib/zot/zot-config.cmake (renamed from Tests/FindPackageTest/lib/zot/zot-config.cmake)0
-rw-r--r--Tests/FindPackageCpsTest/CMakeLists.txt300
-rw-r--r--Tests/FindPackageCpsTest/FindPackageTest.cxx4
-rw-r--r--Tests/FindPackageCpsTest/RootTest/RootTest.cps10
-rw-r--r--Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.1.1/Resources/CPS/SortFramework.cps7
-rw-r--r--Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.10.1/Resources/CPS/SortFramework.cps7
-rw-r--r--Tests/FindPackageCpsTest/cmake/SampleConfig.cmake2
-rw-r--r--Tests/FindPackageCpsTest/cmake/dep2-config.cmake3
-rw-r--r--Tests/FindPackageCpsTest/cps/ComponentTest-extra1.cps12
-rw-r--r--Tests/FindPackageCpsTest/cps/ComponentTest-extra2.cps12
-rw-r--r--Tests/FindPackageCpsTest/cps/ComponentTest-extra3.cps15
-rw-r--r--Tests/FindPackageCpsTest/cps/ComponentTest-extra4.cps9
-rw-r--r--Tests/FindPackageCpsTest/cps/ComponentTest.cps10
-rw-r--r--Tests/FindPackageCpsTest/cps/DefaultConfigurationsTest.cps16
-rw-r--r--Tests/FindPackageCpsTest/cps/Repeat.cps10
-rw-r--r--Tests/FindPackageCpsTest/cps/RequiresTest.cps19
-rw-r--r--Tests/FindPackageCpsTest/cps/SortLib/3.1.1/SortLib.cps7
-rw-r--r--Tests/FindPackageCpsTest/cps/SortLib/3.10.1/SortLib.cps7
-rw-r--r--Tests/FindPackageCpsTest/cps/TransitiveDep-extra1.cps12
-rw-r--r--Tests/FindPackageCpsTest/cps/TransitiveDep-extra2.cps9
-rw-r--r--Tests/FindPackageCpsTest/cps/TransitiveDep-extra3.cps12
-rw-r--r--Tests/FindPackageCpsTest/cps/TransitiveDep.cps10
-rw-r--r--Tests/FindPackageCpsTest/cps/TransitiveTest.cps11
-rw-r--r--Tests/FindPackageCpsTest/cps/badversion1.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/badversion2.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/badversion3.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/badversion4.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/bar-extra.cps13
-rw-r--r--Tests/FindPackageCpsTest/cps/bar.cps19
-rw-r--r--Tests/FindPackageCpsTest/cps/customversion.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/defs.cps27
-rw-r--r--Tests/FindPackageCpsTest/cps/dep1.cps10
-rw-r--r--Tests/FindPackageCpsTest/cps/dep3.cps10
-rw-r--r--Tests/FindPackageCpsTest/cps/emptymarker.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/foo-relative.cps9
-rw-r--r--Tests/FindPackageCpsTest/cps/foo-relative@default.cps9
-rw-r--r--Tests/FindPackageCpsTest/cps/foo.cps14
-rw-r--r--Tests/FindPackageCpsTest/cps/foo@default.cps10
-rw-r--r--Tests/FindPackageCpsTest/cps/includes.cps15
-rw-r--r--Tests/FindPackageCpsTest/cps/longversion.cps8
-rw-r--r--Tests/FindPackageCpsTest/cps/sample.cps8
-rw-r--r--Tests/FindPackageCpsTest/defs-test-c.c37
-rw-r--r--Tests/FindPackageCpsTest/defs-test-cxx.cxx37
-rw-r--r--Tests/FindPackageCpsTest/include/cmincludetest/global.h (renamed from Tests/Wrapping/dummy)0
-rw-r--r--Tests/FindPackageCpsTest/include/cxx/cmincludetest/cxxonly.h (renamed from Tests/RunCMake/project_injected/CMP0048-WARN.cmake)0
-rw-r--r--Tests/FindPackageCpsTest/include/foo.h1
-rw-r--r--Tests/FindPackageCpsTest/requires-test.cxx7
-rw-r--r--Tests/FindPackageCpsTest/share/cps/SortLib/SortLib.cps7
-rw-r--r--Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake8
-rw-r--r--Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake8
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt671
-rw-r--r--Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake8
-rw-r--r--Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake5
-rw-r--r--Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake5
-rw-r--r--Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake8
-rw-r--r--Tests/FindPackageTest/lib/zot/zot-config-version.cmake10
-rw-r--r--Tests/FindProtobuf/CMakeLists.txt1
-rw-r--r--Tests/FindProtobuf/Test/CMakeLists.txt2
-rw-r--r--Tests/FindProtobuf/Test/main-desc.cxx8
-rw-r--r--Tests/FindPython/ArtifactsPrefix/CMakeLists.txt24
-rw-r--r--Tests/FindPython/CMakeLists.txt42
-rw-r--r--Tests/FindPython/Python/CMakeLists.txt40
-rw-r--r--Tests/FindPython/Python2/CMakeLists.txt41
-rw-r--r--Tests/FindPython/Python3/CMakeLists.txt41
-rw-r--r--Tests/FindPython/RequiredArtifacts/CMakeLists.txt12
-rw-r--r--Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt21
-rw-r--r--Tests/FindPython/TEST_spam.c41
-rw-r--r--Tests/FindPython/display_time.c17
-rw-r--r--Tests/FindPython/spam.c4
-rw-r--r--Tests/FindRuby/CMakeLists.txt16
-rw-r--r--Tests/FindRuby/Rbenv/CMakeLists.txt77
-rw-r--r--Tests/FindRuby/Rbenv/RbenvDefault.cmake28
-rw-r--r--Tests/FindRuby/Rbenv/RbenvOnly.cmake29
-rw-r--r--Tests/FindRuby/Rbenv/RbenvStandard.cmake29
-rw-r--r--Tests/FindRuby/Rvm/RvmOnly.cmake17
-rw-r--r--Tests/FindRuby/Test/CMakeLists.txt13
-rw-r--r--Tests/FindVulkan/Test/main-SPIRV-Tools.c4
-rw-r--r--Tests/FindVulkan/Test/main-dynamicVulkanLoading.cpp2
-rw-r--r--Tests/FindVulkan/Test/main-glslang.cxx8
-rw-r--r--Tests/FindX11/Test/CMakeLists.txt2
-rw-r--r--Tests/FindX11/Test/main.c14
-rw-r--r--Tests/Fortran/hello.f1
-rw-r--r--Tests/Fortran/testf.f1
-rw-r--r--Tests/Fortran/world.f1
-rw-r--r--Tests/FortranC/Flags.cmake.in3
-rw-r--r--Tests/FortranOnly/CMakeLists.txt1
-rw-r--r--Tests/FortranOnly/preprocess2.f2
-rw-r--r--Tests/Fuzzing/README.rst2
-rw-r--r--Tests/Fuzzing/xml_parser_fuzzer.cc4
-rw-r--r--Tests/GeneratorExpression/CMP0044/CMakeLists.txt9
-rw-r--r--Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp23
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt8
-rw-r--r--Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in2
-rw-r--r--Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in2
-rw-r--r--Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiExclude/verify.cmake2
-rw-r--r--Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c2
-rw-r--r--Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in2
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake2
-rw-r--r--Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt2
-rw-r--r--Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt2
-rw-r--r--Tests/ISPC/ObjectGenex/main.cxx2
-rw-r--r--Tests/IncludeDirectories/CMP0021/CMakeLists.txt14
-rw-r--r--Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h2
-rw-r--r--Tests/IncludeDirectories/CMP0021/main.cpp11
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt4
-rw-r--r--Tests/InterfaceLinkLibraries/CMakeLists.txt2
-rw-r--r--Tests/Java/HelloWorld.java1
-rw-r--r--Tests/LibName/CMakeLists.txt1
-rw-r--r--Tests/LibName/bar.c3
-rw-r--r--Tests/LibName/foo.c3
-rw-r--r--Tests/LibName/foobar.c3
-rw-r--r--Tests/LinkDirectory/External/CMakeLists.txt6
-rw-r--r--Tests/LinkLine/CMakeLists.txt1
-rw-r--r--Tests/LinkLineOrder/CMakeLists.txt1
-rw-r--r--Tests/LoadCommand/CMakeCommands/CMakeLists.txt14
-rw-r--r--Tests/LoadCommand/CMakeCommands/cmTestCommand.c192
-rw-r--r--Tests/LoadCommand/CMakeLists.txt53
-rw-r--r--Tests/LoadCommand/LoadedCommand.cxx.in32
-rw-r--r--Tests/LoadCommand/LoadedCommand.h.in3
-rw-r--r--Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt17
-rw-r--r--Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c192
-rw-r--r--Tests/LoadCommandOneConfig/CMakeLists.txt59
-rw-r--r--Tests/LoadCommandOneConfig/LoadedCommand.cxx.in32
-rw-r--r--Tests/LoadCommandOneConfig/LoadedCommand.h.in9
-rw-r--r--Tests/MFC/mfc1/ReadMe.txt12
-rw-r--r--Tests/MFC/mfc1/mfc1.rc352
-rw-r--r--Tests/MSManifest/Subdir2/test_manifest1.in2
-rw-r--r--Tests/MSManifest/Subdir2/test_manifest2.in18
-rw-r--r--Tests/MSVCRuntimeChecks/CMakeLists.txt105
-rw-r--r--Tests/MSVCRuntimeChecks/override-C.cmake3
-rw-r--r--Tests/MSVCRuntimeChecks/override-CUDA.cmake3
-rw-r--r--Tests/MSVCRuntimeChecks/override-CXX.cmake3
-rw-r--r--Tests/MSVCRuntimeChecks/override-Fortran.cmake3
-rw-r--r--Tests/MSVCRuntimeChecks/override-common.cmake50
-rw-r--r--Tests/MSVCRuntimeChecks/verify.F901
-rw-r--r--Tests/MSVCRuntimeChecks/verify.c1
-rw-r--r--Tests/MSVCRuntimeChecks/verify.cu1
-rw-r--r--Tests/MSVCRuntimeChecks/verify.cxx1
-rw-r--r--Tests/MSVCRuntimeChecks/verify.h61
-rw-r--r--Tests/MacRuntimePath/A/CMakeLists.txt2
-rw-r--r--Tests/MathTest/CMakeLists.txt1
-rw-r--r--Tests/MathTest/MathTestExec.cxx2
-rw-r--r--Tests/MumpsCoverage/.gitattributes1
-rw-r--r--Tests/MumpsCoverage/ZZCOVTST.mcov2
-rw-r--r--Tests/NewlineArgs/libcxx2.h.in1
-rw-r--r--Tests/OutDir/OutDir.c4
-rw-r--r--Tests/PerConfig/CMakeLists.txt2
-rw-r--r--Tests/PerConfig/pcShared.c2
-rw-r--r--Tests/PerConfig/pcStatic.c2
-rw-r--r--Tests/PerConfig/perconfig.c2
-rw-r--r--Tests/Plugin/include/DynamicLoader.hxx4
-rw-r--r--Tests/Plugin/src/DynamicLoader.cxx28
-rw-r--r--Tests/Policy0002/A/CMakeLists.txt1
-rw-r--r--Tests/Policy0002/CMakeLists.txt5
-rw-r--r--Tests/PolicyScope/Bar.cmake9
-rw-r--r--Tests/PolicyScope/CMakeLists.txt99
-rw-r--r--Tests/PolicyScope/FindFoo.cmake2
-rw-r--r--Tests/PreOrder/CMakeLists.txt1
-rw-r--r--Tests/PreOrder/Library/CMakeLists.txt1
-rw-r--r--Tests/Preprocess/CMakeLists.txt41
-rw-r--r--Tests/Qt4Deploy/testdeploy.cpp2
-rw-r--r--Tests/Qt4Targets/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp2
-rw-r--r--Tests/QtAutogen/Complex/abc.cpp2
-rw-r--r--Tests/QtAutogen/Complex/abc.h2
-rw-r--r--Tests/QtAutogen/Complex/abc_p.h2
-rw-r--r--Tests/QtAutogen/Complex/bar.cpp2
-rw-r--r--Tests/QtAutogen/Complex/blub.cpp2
-rw-r--r--Tests/QtAutogen/Complex/blub.h2
-rw-r--r--Tests/QtAutogen/Complex/calwidget.cpp6
-rw-r--r--Tests/QtAutogen/Complex/calwidget.h4
-rw-r--r--Tests/QtAutogen/Complex/codeeditor.cpp2
-rw-r--r--Tests/QtAutogen/Complex/codeeditor.h2
-rw-r--r--Tests/QtAutogen/Complex/foo.cpp2
-rw-r--r--Tests/QtAutogen/Complex/foo.h2
-rw-r--r--Tests/QtAutogen/Complex/sub/bar.h2
-rw-r--r--Tests/QtAutogen/Complex/xyz.cpp2
-rw-r--r--Tests/QtAutogen/Complex/xyz.h2
-rw-r--r--Tests/QtAutogen/Complex/yaf.cpp2
-rw-r--r--Tests/QtAutogen/Complex/yaf.h2
-rw-r--r--Tests/QtAutogen/Complex/yaf_p.h2
-rw-r--r--Tests/QtAutogen/MocOnly/IncA.cpp2
-rw-r--r--Tests/QtAutogen/MocOnly/IncB.cpp2
-rw-r--r--Tests/QtAutogen/MocSkipSource/qItemC.cpp4
-rw-r--r--Tests/QtAutogen/MocSkipSource/qItemD.cpp4
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp2
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp2
-rw-r--r--Tests/QtAutogen/SameName/object.h2
-rw-r--r--Tests/QtAutogen/SameName/object.hh2
-rw-r--r--Tests/QtAutogen/SameName/object.hpp2
-rw-r--r--Tests/QtAutogen/SameName/object.hxx2
-rw-r--r--Tests/QtAutogen/SameName/object_upper_ext.H2
-rw-r--r--Tests/QtAutogen/TestMacros.cmake1
-rw-r--r--Tests/QtAutogen/UicInterface/klocalizedstring.cpp4
-rw-r--r--Tests/QtAutogen/UicInterface/klocalizedstring.h6
-rw-r--r--Tests/QtAutogen/UicNoGui/MocOnly/main.cpp2
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER-check.cmake3
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED-check.cmake4
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED_SHELL-check.cmake4
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_SHELL-check.cmake3
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-validation.cmake15
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion.cmake66
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/RunCMakeTest.cmake30
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-result.txt (renamed from Tests/RunCMake/project/CMP0048-OLD-VERSION-result.txt)0
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-stderr.txt4
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage.cmake5
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/dump.c13
-rw-r--r--Tests/RunCMake/ARCHIVER-prefix/lib.c7
-rw-r--r--Tests/RunCMake/AppleSDK/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/AppleSDK/NoSDK-stdout.txt4
-rw-r--r--Tests/RunCMake/AppleSDK/NoSDK.cmake5
-rw-r--r--Tests/RunCMake/AppleSDK/RunCMakeTest.cmake47
-rw-r--r--Tests/RunCMake/AppleSDK/SDK-stdout.txt4
-rw-r--r--Tests/RunCMake/AppleSDK/SDK.cmake5
-rw-r--r--Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake3
-rw-r--r--Tests/RunCMake/AutoExportDll/hello.cxx4
-rw-r--r--Tests/RunCMake/Autogen_1/AutogenDuplicateDependency.cmake38
-rw-r--r--Tests/RunCMake/Autogen_1/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/Autogen_common/exe_common.h2
-rw-r--r--Tests/RunCMake/Autogen_common/utils.cmake8
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake9
-rw-r--r--Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0004/CMP0004-OLD.cmake18
-rw-r--r--Tests/RunCMake/CMP0004/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CMP0019/CMP0019-NEW.cmake1
-rw-r--r--Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0019/CMP0019-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt40
-rw-r--r--Tests/RunCMake/CMP0019/CMP0019-WARN.cmake1
-rw-r--r--Tests/RunCMake/CMP0019/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CMP0019/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake7
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake2
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake4
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake2
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt19
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake10
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt19
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake11
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt17
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt17
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake13
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN.cmake18
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake2
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-export.cmake4
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-install-export.cmake4
-rw-r--r--Tests/RunCMake/CMP0022/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0022/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-OLD.cmake12
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt25
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-WARN.cmake8
-rw-r--r--Tests/RunCMake/CMP0026/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake6
-rw-r--r--Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake13
-rw-r--r--Tests/RunCMake/CMP0026/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/clear-cached-information.cmake14
-rw-r--r--Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt13
-rw-r--r--Tests/RunCMake/CMP0027/CMP0027-OLD.cmake10
-rw-r--r--Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt18
-rw-r--r--Tests/RunCMake/CMP0027/CMP0027-WARN.cmake8
-rw-r--r--Tests/RunCMake/CMP0027/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0027/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt38
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake4
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake4
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt37
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake4
-rw-r--r--Tests/RunCMake/CMP0037/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond-package.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond-test.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/NEW-cond.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-package.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond-test.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/OLD-cond.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/RunCMakeTest.cmake40
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond-package.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond-test.cmake5
-rw-r--r--Tests/RunCMake/CMP0037/WARN-cond.cmake4
-rw-r--r--Tests/RunCMake/CMP0037/alias-test-NEW.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0037/alias-test-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0037/alias-test-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-WARN.cmake3
-rw-r--r--Tests/RunCMake/CMP0038/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0038/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt6
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-NEW.cmake3
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0039/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0039/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt1
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake2
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt6
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake2
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake7
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake5
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt1
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake4
-rw-r--r--Tests/RunCMake/CMP0040/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0040/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-OLD.cmake12
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt32
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-WARN.cmake10
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake11
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt34
-rw-r--r--Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake9
-rw-r--r--Tests/RunCMake/CMP0041/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0041/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-NEW.cmake3
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-WARN.cmake9
-rw-r--r--Tests/RunCMake/CMP0042/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0042/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-NEW.cmake7
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt5
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0043/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CMP0043/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMP0043/empty.cpp7
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-NEW.cmake3
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0045/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0045/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-Duplicate-result.txt1
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-Duplicate-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-Duplicate.cmake9
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake2
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake2
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake5
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake4
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake2
-rw-r--r--Tests/RunCMake/CMP0046/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0046/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt13
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-NEW.cmake3
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-OLD.cmake5
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0049/CMP0049-WARN.cmake3
-rw-r--r--Tests/RunCMake/CMP0049/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0049/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-NEW.cmake13
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-OLD.cmake13
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0050/CMP0050-WARN.cmake11
-rw-r--r--Tests/RunCMake/CMP0050/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0050/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CMP0050/empty.cpp10
-rw-r--r--Tests/RunCMake/CMP0050/input.h.in2
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-NEW.cmake3
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-OLD.cmake10
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt31
-rw-r--r--Tests/RunCMake/CMP0051/CMP0051-WARN.cmake14
-rw-r--r--Tests/RunCMake/CMP0051/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0051/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt13
-rw-r--r--Tests/RunCMake/CMP0053/CMP0053-OLD.cmake8
-rw-r--r--Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0053/CMP0053-WARN.cmake6
-rw-r--r--Tests/RunCMake/CMP0053/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0053/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-OLD.cmake47
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt23
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-WARN.cmake7
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt24
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake12
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake9
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt25
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake53
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt54
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake49
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake41
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt54
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake65
-rw-r--r--Tests/RunCMake/CMP0054/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0054/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope.cmake3
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments.cmake5
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-result.txt1
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope.cmake4
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-result.txt1
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments.cmake6
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-result.txt1
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope.cmake2
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-result.txt1
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments.cmake4
-rw-r--r--Tests/RunCMake/CMP0055/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0055/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-OLD-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt19
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0057/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0057/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-NEW.cmake3
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-OLD.cmake17
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt18
-rw-r--r--Tests/RunCMake/CMP0059/CMP0059-WARN.cmake17
-rw-r--r--Tests/RunCMake/CMP0059/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0059/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-NEW.cmake1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt16
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake2
-rw-r--r--Tests/RunCMake/CMP0060/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0060/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-WARN.cmake7
-rw-r--r--Tests/RunCMake/CMP0064/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0064/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0065/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0065/OLDBad1.cmake4
-rw-r--r--Tests/RunCMake/CMP0065/OLDBad2.cmake4
-rw-r--r--Tests/RunCMake/CMP0065/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0065/WARN-OFF.cmake3
-rw-r--r--Tests/RunCMake/CMP0065/WARN-ON-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0065/WARN-ON.cmake3
-rw-r--r--Tests/RunCMake/CMP0065/subproject/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CMP0068/CMP0068-NEW.cmake1
-rw-r--r--Tests/RunCMake/CMP0068/CMP0068-OLD.cmake1
-rw-r--r--Tests/RunCMake/CMP0068/CMP0068-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0132/CMP0132-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0135/CMP0135-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt13
-rw-r--r--Tests/RunCMake/CMakeListFileName/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMakeListFileName/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/CMakeListFileName/cant-change-file-result.txt (renamed from Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt)0
-rw-r--r--Tests/RunCMake/CMakeListFileName/cant-change-file-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakeListFileName/dont-set-file-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakeListFileName/project/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CMakeListFileName/project/other.cmake5
-rw-r--r--Tests/RunCMake/CMakeListFileName/project/subdir-1/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeListFileName/project/subdir-1/other.cmake1
-rw-r--r--Tests/RunCMake/CMakeListFileName/project/subdir-2/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeListFileName/remembers-file-stderr.txt4
-rw-r--r--Tests/RunCMake/CMakeListFileName/remembers-file-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-dne-result.txt (renamed from Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt)0
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-dne-stderr.txt9
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-multi-result.txt (renamed from Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt)0
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-multi-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-none-result.txt (renamed from Tests/RunCMake/add_custom_command/SourceByproducts-result.txt)0
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-none-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-stderr.txt4
-rw-r--r--Tests/RunCMake/CMakeListFileName/set-file-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakeLists.txt35
-rw-r--r--Tests/RunCMake/CMakePackage/ApplePlatformGenSubdir.cmake2
-rw-r--r--Tests/RunCMake/CMakePresets/IncludeOutsideProject.json.in3
-rw-r--r--Tests/RunCMake/CMakePresets/IncludeUserOutsideProjectUser.json.in3
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in3
-rw-r--r--Tests/RunCMake/CMakeRelease/FileTable-stdout.txt8
-rw-r--r--Tests/RunCMake/CMakeRelease/FileTable.cmake1
-rw-r--r--Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in1
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake7
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake29
-rw-r--r--Tests/RunCMake/CPack/TAR/Helpers.cmake3
-rw-r--r--Tests/RunCMake/CPack/TAR/Prerequirements.cmake4
-rw-r--r--Tests/RunCMake/CPack/TAR/packaging_COMPONENT_default.cmake1
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake20
-rw-r--r--Tests/RunCMake/CPack_NuGet/.gitattributes3
-rw-r--r--Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake4
-rw-r--r--Tests/RunCMake/CPack_NuGet/expected.nuspec12
-rw-r--r--Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/EmptyDirTest-ctest-stderr.txt3
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake35
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/TimeoutDefault-T-Test-stdout.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/TimeoutDefault-stdout.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py62
-rw-r--r--Tests/RunCMake/CTestCommandLine/show_only_json_check.py3
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx15
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/test.cmake.in10
-rw-r--r--Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CXXModules/check-json.cmake49
-rw-r--r--Tests/RunCMake/CXXModules/examples/build-database-check.cmake5
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CommandLine/C_basic-stdout.txt2
-rw-r--r--Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt3
-rw-r--r--Tests/RunCMake/CommandLine/D-tilde.cmake21
-rw-r--r--Tests/RunCMake/CommandLine/E_capabilities-stdout.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/ExplicitDirs-C_buildsrcdir-stdout.txt4
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake37
-rw-r--r--Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-D-abs-path-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-D-slash-abs-path-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/trace-expand-warn-uninitialized.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt38
-rw-r--r--Tests/RunCMake/CommandLine/warn-uninitialized.cmake13
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/ConfigDir/check-reply.cmake3
-rw-r--r--Tests/RunCMake/ConfigDir/config/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0/v1/query/query.json3
-rw-r--r--Tests/RunCMake/Configure/CacheVarHelpString.cmake21
-rw-r--r--Tests/RunCMake/Configure/RerunCMakeNinja-build1-check.cmake4
-rw-r--r--Tests/RunCMake/Configure/RerunCMakeNinja.cmake16
-rw-r--r--Tests/RunCMake/Configure/RerunCMakeNinja/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/Configure/RunCMakeTest.cmake24
-rw-r--r--Tests/RunCMake/CpsExportImport/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CpsExportImport/RunCMakeTest.cmake24
-rw-r--r--Tests/RunCMake/CpsExportImport/TestExecutable.cmake12
-rw-r--r--Tests/RunCMake/CpsExportImport/TestLibrary.cmake14
-rw-r--r--Tests/RunCMake/CpsExportImport/app.c13
-rw-r--r--Tests/RunCMake/CpsExportImport/liba.c7
-rw-r--r--Tests/RunCMake/CpsExportImport/libb.c13
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt15
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt4
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake2
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake1
-rw-r--r--Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake4
-rw-r--r--Tests/RunCMake/FPHSA/NameMismatch-stderr.txt8
-rw-r--r--Tests/RunCMake/FPHSA/range_ignored-stderr.txt2
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW-stdout.txt3
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW.cmake11
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stdout.txt7
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN.cmake10
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW-stdout.txt3
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW.cmake8
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD-stdout.txt3
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD.cmake8
-rw-r--r--Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake2
-rw-r--r--Tests/RunCMake/FileAPI/check_index.py1
-rw-r--r--Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py17
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json12
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json3
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_very-long.json11
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json26
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json1
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_exe_framework.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json11
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json10
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json17
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json12
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json12
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json10
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2.cmake3
-rw-r--r--Tests/RunCMake/FileAPI/cxx/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/FileAPI/dir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/FileAPI/dir/very-long/CMakeLists.txt (renamed from Tests/RunCMake/VS10Project/CSharpSourceGroup/images/empty.bmp)0
-rw-r--r--Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp4
-rw-r--r--Tests/RunCMake/GenEx-LIST/INSERT.cmake.in61
-rw-r--r--Tests/RunCMake/GenEx-PATH/NATIVE_PATH.cmake.in48
-rw-r--r--Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake2
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake2
-rw-r--r--Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake2
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt16
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake3
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c3
-rw-r--r--Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp2
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake17
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt6
-rw-r--r--Tests/RunCMake/GoogleTest/fake_gtest.cpp8
-rw-r--r--Tests/RunCMake/GoogleTest/flush_script_test.cpp6
-rw-r--r--Tests/RunCMake/GoogleTest/test_launcher.c8
-rw-r--r--Tests/RunCMake/Graphviz/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt6
-rw-r--r--Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-result.txt1
-rw-r--r--Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt16
-rw-r--r--Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-result.txt1
-rw-r--r--Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt20
-rw-r--r--Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt6
-rw-r--r--Tests/RunCMake/IfacePaths/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/IfacePaths/RunCMakeTest.cmake53
-rw-r--r--Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-result.txt1
-rw-r--r--Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt16
-rw-r--r--Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-result.txt1
-rw-r--r--Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt20
-rw-r--r--Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt (renamed from Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt)0
-rw-r--r--Tests/RunCMake/InstallParallel/no-parallel-install-stdout.txt2
-rw-r--r--Tests/RunCMake/InstallParallel/parallel-install-stdout.txt25
-rw-r--r--Tests/RunCMake/Instrumentation/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Instrumentation/RunCMakeTest.cmake135
-rw-r--r--Tests/RunCMake/Instrumentation/bad-hook-result.txt (renamed from Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/bad-hook-stderr.txt4
-rw-r--r--Tests/RunCMake/Instrumentation/bad-query-result.txt (renamed from Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/bad-query-stderr.txt4
-rw-r--r--Tests/RunCMake/Instrumentation/check-data-dir.cmake154
-rw-r--r--Tests/RunCMake/Instrumentation/check-generated-queries.cmake18
-rw-r--r--Tests/RunCMake/Instrumentation/check-make-program-hooks.cmake45
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-result.txt (renamed from Tests/RunCMake/Syntax/ParenInVarName1-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-stderr.txt6
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-bad-arg-result.txt (renamed from Tests/RunCMake/Syntax/ParenInENV-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-bad-arg-stderr.txt5
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-result.txt (renamed from Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-stderr.txt5
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-missing-version-result.txt (renamed from Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-missing-version-stderr.txt6
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-non-int-version-result.txt (renamed from Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-non-int-version-stderr.txt2
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-result.txt (renamed from Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-stderr.txt3
-rw-r--r--Tests/RunCMake/Instrumentation/empty-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt)0
-rw-r--r--Tests/RunCMake/Instrumentation/empty-stderr.txt4
-rw-r--r--Tests/RunCMake/Instrumentation/hook.cmake81
-rw-r--r--Tests/RunCMake/Instrumentation/hooks-1-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Instrumentation/hooks-1-install-stdout.txt1
-rw-r--r--Tests/RunCMake/Instrumentation/hooks-2-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Instrumentation/hooks-2-stdout.txt5
-rw-r--r--Tests/RunCMake/Instrumentation/hooks-2-test-stdout.txt1
-rw-r--r--Tests/RunCMake/Instrumentation/hooks-no-callbacks-index-stdout.txt1
-rw-r--r--Tests/RunCMake/Instrumentation/json.cmake4
-rw-r--r--Tests/RunCMake/Instrumentation/project/CMakeLists.txt23
-rw-r--r--Tests/RunCMake/Instrumentation/project/lib.cxx4
-rw-r--r--Tests/RunCMake/Instrumentation/project/lib.h1
-rw-r--r--Tests/RunCMake/Instrumentation/project/main.cxx5
-rw-r--r--Tests/RunCMake/Instrumentation/query/bad-hook.json.in4
-rw-r--r--Tests/RunCMake/Instrumentation/query/bad-query.json.in4
-rw-r--r--Tests/RunCMake/Instrumentation/query/bad-version.json.in3
-rw-r--r--Tests/RunCMake/Instrumentation/query/both-query.json.in7
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-bad-api-version.cmake3
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-bad-arg.cmake5
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-bad-data-version.cmake4
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-data.cmake5
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake7
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-missing-version.cmake3
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-parallel-install.cmake6
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command-resets-generated.cmake4
-rw-r--r--Tests/RunCMake/Instrumentation/query/cmake-command.cmake21
-rw-r--r--Tests/RunCMake/Instrumentation/query/dynamic-query.json.in7
-rw-r--r--Tests/RunCMake/Instrumentation/query/empty.json.in2
-rw-r--r--Tests/RunCMake/Instrumentation/query/generated/query-0.json.in6
-rw-r--r--Tests/RunCMake/Instrumentation/query/generated/query-1.json.in12
-rw-r--r--Tests/RunCMake/Instrumentation/query/generated/query-2.json.in17
-rw-r--r--Tests/RunCMake/Instrumentation/query/hooks-1.json.in6
-rw-r--r--Tests/RunCMake/Instrumentation/query/hooks-2.json.in5
-rw-r--r--Tests/RunCMake/Instrumentation/query/hooks-no-callbacks.json.in4
-rw-r--r--Tests/RunCMake/Instrumentation/query/no-query.json.in3
-rw-r--r--Tests/RunCMake/Instrumentation/verify-snippet.cmake115
-rw-r--r--Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt25
-rw-r--r--Tests/RunCMake/InterfaceLibrary/invalid_name.cmake3
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-result.txt1
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-stderr.txt18
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface.cmake7
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-OLD-result.txt1
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-OLD-stderr.txt18
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-OLD.cmake5
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-result.txt1
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-stderr.txt17
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface.cmake5
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-WARN-result.txt1
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-WARN-stderr.txt17
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMP0028-WARN.cmake3
-rw-r--r--Tests/RunCMake/LinkItemValidation/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/LinkItemValidation/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/BadValue-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt)0
-rw-r--r--Tests/RunCMake/LinkWarningAsError/BadValue-stderr.txt4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/BadValue.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/LinkWarningAsError/RunCMakeTest.cmake33
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnError-validation.cmake19
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnError.cmake103
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOff1-Build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOff1.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOff2-Build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOff2.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn1-Build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn1.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn2-Build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn2.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn3-build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn3.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn4-build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOn4.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore-Build-check.cmake4
-rw-r--r--Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore.cmake5
-rw-r--r--Tests/RunCMake/LinkWarningAsError/dump.c13
-rw-r--r--Tests/RunCMake/LinkWarningAsError/main.c5
-rw-r--r--Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake6
-rw-r--r--Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake6
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt)0
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW.cmake2
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NoEffect.cmake4
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-OLD.cmake2
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-WARN.cmake2
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMP0184-common.cmake25
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/MSVCRuntimeChecks/empty.c0
-rw-r--r--Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt2
-rw-r--r--Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt2
-rw-r--r--Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt20
-rw-r--r--Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in5
-rw-r--r--Tests/RunCMake/MaxRecursionDepth/test.cmake.in5
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake1
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake1
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt4
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt20
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake4
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt4
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt20
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake3
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt4
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-WARN-by-stderr.txt9
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake3
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt4
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt29
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake2
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/cmake--install-install-check.cmake4
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/cmake--install.cmake1
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/generator.c12
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/generatorlib.c4
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/generatorobj.c4
-rw-r--r--Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake2
-rw-r--r--Tests/RunCMake/PackageInfo/BadDefaultTarget-stderr.txt10
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultiple.cmake3
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleCommon.cmake11
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt)0
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-stderr.txt19
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace.cmake3
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt)0
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-stderr.txt18
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets.cmake5
-rw-r--r--Tests/RunCMake/PackageInfo/DependsMultipleNotInstalled.cmake4
-rw-r--r--Tests/RunCMake/PackageInfo/ReferencesNonExportedTarget-stderr.txt4
-rw-r--r--Tests/RunCMake/PackageInfo/Requirements-check.cmake6
-rw-r--r--Tests/RunCMake/PackageInfo/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/ParseImplicitData/.gitattributes1
-rw-r--r--Tests/RunCMake/ParseImplicitData/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/ParseImplicitData/aix-C-IBMClang-17.1.1.2.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/aix-C-XL-13.1.3.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/aix-C-XLClang-16.1.0.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/aix-CXX-IBMClang-17.1.1.2.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/aix-CXX-XL-13.1.3.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/aix-CXX-XLClang-16.1.0.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-C-Cray-8.7.input3
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-C-Cray-9.0-hlist-ad.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-C-GNU-7.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-C-Intel-18.0.2.20180210.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-8.7.input3
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-9.0-hlist-ad.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-CXX-GNU-7.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-CXX-Intel-18.0.2.20180210.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-8.7.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-9.0-hlist-ad.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-Fortran-GNU-7.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/craype-Fortran-Intel-18.0.2.20180210.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/darwin-C-AppleClang-8.0.0.8000042.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/darwin-CXX-AppleClang-8.0.0.8000042.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/freebsd-C-Clang-3.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/freebsd-CXX-Clang-3.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/freebsd-Fortran-GNU-4.6.4.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/hand-C-empty.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/hand-C-relative.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/hand-CXX-empty.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-GNU-10.2.1-static-libgcc.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-GNU-12.2.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-GNU-7.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-Intel-18.0.0.20170811.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-Intel-2021.10.0.20230609.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-IntelLLVM-2023.2.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-XL-12.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-C-XL-16.1.0.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-CLANG.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-XLClang-v.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-9.2.148-GCC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-10.2.1-static-libstdc++.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-12.2.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-7.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-18.0.0.20170811.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-2021.10.0.20230609.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-IntelLLVM-2023.2.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-XL-12.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-CXX-XL-16.1.0.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-10.2.1-static-libgfortran.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-12.2.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-13.3.0-static-libquadmath.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-7.3.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-Intel-2021.10.0.20230609.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-IntelLLVM-2023.2.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-clang.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-gcc.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-clang.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-gcc.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-XL-14.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-XL-12.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-XL-12.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc-Fortran-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-C-XL-12.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-CXX-XL-12.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux_pgf77-Fortran-PGI-18.10.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/netbsd-C-GNU-4.8.5.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/netbsd-CXX-GNU-4.8.5.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-C-GNU-4.8.5.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-CXX-GNU-4.8.5.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/openbsd-C-Clang-5.0.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/openbsd-CXX-Clang-5.0.1.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos-C-SunPro-5.13.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos-CXX-SunPro-5.13.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos-Fortran-SunPro-8.8.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-C-GNU-5.5.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-CXX-GNU-5.5.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-Fortran-GNU-5.5.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos5.11_i386-C-GNU-5.5.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos5.11_i386-CXX-GNU-5.5.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/sunos5.11_i386-Fortran-GNU-5.5.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_arm64-C-Clang-17.0.1-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_arm64-CXX-Clang-17.0.1-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_arm64-Fortran-LLVMFlang-17.0.1-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Clang-17.0.1-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Intel-2021.9.0.20230302.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-C-IntelLLVM-2023.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.36.32543.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.38.33130.0-VS.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Clang-17.0.1-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Intel-2021.9.0.20230302.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-IntelLLVM-2023.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.36.32543.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.38.33130.0-VS.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-Intel-2021.9.0.20230302.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-IntelLLVM-2023.1.0.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-17.0.1-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-18.0.0-MSVC.input2
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/CheckCompilerLinkerId.cmake5
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/results/craype-C-Cray-8.7.output2
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/results/craype-CXX-Cray-8.7.output2
-rw-r--r--Tests/RunCMake/Policy/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/PolicyScope/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/PolicyScope/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt1
-rw-r--r--Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt5
-rw-r--r--Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake2
-rw-r--r--Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake6
-rw-r--r--Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/PolicyScope/dir1/foo.cpp5
-rw-r--r--Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake7
-rw-r--r--Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/RunCMake.cmake51
-rw-r--r--Tests/RunCMake/RunCPack.cmake2
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/patch.xml10
-rw-r--r--Tests/RunCMake/RunCPack/verify.cmake2
-rw-r--r--Tests/RunCMake/RunCTest.cmake2
-rw-r--r--Tests/RunCMake/RuntimePath/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt2
-rw-r--r--Tests/RunCMake/SarifOutput/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/SarifOutput/DefaultSarifOutput-check.cmake4
-rw-r--r--Tests/RunCMake/SarifOutput/DefaultSarifOutput-stderr.txt4
-rw-r--r--Tests/RunCMake/SarifOutput/DefaultSarifOutput.cmake1
-rw-r--r--Tests/RunCMake/SarifOutput/GenerateSarifResults-check.cmake4
-rw-r--r--Tests/RunCMake/SarifOutput/GenerateSarifResults-expected.sarif67
-rw-r--r--Tests/RunCMake/SarifOutput/GenerateSarifResults-stderr.txt9
-rw-r--r--Tests/RunCMake/SarifOutput/GenerateSarifResults.cmake8
-rw-r--r--Tests/RunCMake/SarifOutput/ProjectFatalError-check.cmake4
-rw-r--r--Tests/RunCMake/SarifOutput/ProjectFatalError-expected.sarif47
-rw-r--r--Tests/RunCMake/SarifOutput/ProjectFatalError-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt)0
-rw-r--r--Tests/RunCMake/SarifOutput/ProjectFatalError-stderr.txt4
-rw-r--r--Tests/RunCMake/SarifOutput/ProjectFatalError.cmake1
-rw-r--r--Tests/RunCMake/SarifOutput/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/SarifOutput/SarifFileArgument-check.cmake4
-rw-r--r--Tests/RunCMake/SarifOutput/SarifFileArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/SarifOutput/SarifFileArgument.cmake1
-rw-r--r--Tests/RunCMake/SarifOutput/SarifFileArgumentScript-check.cmake4
-rw-r--r--Tests/RunCMake/SarifOutput/SarifFileArgumentScript.cmake2
-rw-r--r--Tests/RunCMake/SarifOutput/ScriptModeSarifVariable-check.cmake4
-rw-r--r--Tests/RunCMake/SarifOutput/ScriptModeSarifVariable.cmake3
-rw-r--r--Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-check.cmake5
-rw-r--r--Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-stderr.txt11
-rw-r--r--Tests/RunCMake/SarifOutput/ToggleExportSarifVariable.cmake6
-rw-r--r--Tests/RunCMake/SarifOutput/check-sarif.cmake19
-rw-r--r--Tests/RunCMake/Swift/CompileCommands-check.cmake4
-rw-r--r--Tests/RunCMake/Swift/ImportLibraryFlags-check-stdout.txt2
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-darwin.txt11
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-windows.txt13
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt11
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake15
-rw-r--r--Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt4
-rw-r--r--Tests/RunCMake/Syntax/At-stderr.txt (renamed from Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt)0
-rw-r--r--Tests/RunCMake/Syntax/At.cmake7
-rw-r--r--Tests/RunCMake/Syntax/AtWithVariable-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake9
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake9
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt27
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt21
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake4
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt24
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt56
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NUL.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt1
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake3
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake3
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt28
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-WARN.cmake5
-rw-r--r--Tests/RunCMake/Syntax/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Syntax/Dollar-stderr.txt (renamed from Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt)0
-rw-r--r--Tests/RunCMake/Syntax/Dollar.cmake4
-rw-r--r--Tests/RunCMake/Syntax/Escape2-stderr.txt6
-rw-r--r--Tests/RunCMake/Syntax/Escape2.cmake2
-rw-r--r--Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in4
-rw-r--r--Tests/RunCMake/Syntax/EscapeChar-char.cmake.in2
-rw-r--r--Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake2
-rw-r--r--Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt3
-rw-r--r--Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt10
-rw-r--r--Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/NameWithNewline-stderr.txt10
-rw-r--r--Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithTabs-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV-stderr.txt20
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV1-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt)0
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV1-stderr.txt20
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV1.cmake (renamed from Tests/RunCMake/Syntax/ParenInENV.cmake)0
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV2-stderr.txt (renamed from Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt)0
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV2.cmake2
-rw-r--r--Tests/RunCMake/Syntax/ParenInQuotedENV1-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt)0
-rw-r--r--Tests/RunCMake/Syntax/ParenInQuotedENV1-stderr.txt13
-rw-r--r--Tests/RunCMake/Syntax/ParenInQuotedENV1.cmake (renamed from Tests/RunCMake/Syntax/ParenInQuotedENV.cmake)0
-rw-r--r--Tests/RunCMake/Syntax/ParenInQuotedENV2-stderr.txt (renamed from Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt)0
-rw-r--r--Tests/RunCMake/Syntax/ParenInQuotedENV2.cmake2
-rw-r--r--Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/ParenInVarName0.cmake2
-rw-r--r--Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/ParenInVarName1.cmake4
-rw-r--r--Tests/RunCMake/Syntax/RunCMakeTest.cmake38
-rw-r--r--Tests/RunCMake/Syntax/Unquoted2.cmake2
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace0.cmake1
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace1-result.txt (renamed from Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt7
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace1.cmake1
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace2.cmake3
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt2
-rw-r--r--Tests/RunCMake/UnityBuild/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/UnityBuild/relocatable/foo.c5
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-check.cmake17
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path.cmake13
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-check.cmake35
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path.cmake18
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path-check.cmake35
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path.cmake18
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path-check.cmake17
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path.cmake14
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-check.cmake17
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path.cmake13
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path-check.cmake17
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path.cmake13
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations-check.cmake22
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations.cmake23
-rw-r--r--Tests/RunCMake/VS10Project/CSharpSourceGroup/Images/empty.bmp0
-rw-r--r--Tests/RunCMake/VS10Project/CustomCommandParallelDisable-check.cmake42
-rw-r--r--Tests/RunCMake/VS10Project/CustomCommandParallelDisable.cmake21
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/VS10Project/SolutionItems-check.cmake351
-rw-r--r--Tests/RunCMake/VS10Project/SolutionItems.cmake8
-rw-r--r--Tests/RunCMake/VS10Project/SolutionItems/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/VS10Project/SolutionItems/extraneous.txt0
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/my.props4
-rw-r--r--Tests/RunCMake/VS10Project/solution-item-0-1.txt0
-rw-r--r--Tests/RunCMake/VS10Project/solution-item-1-1.txt0
-rw-r--r--Tests/RunCMake/VS10Project/solution-item-2-1.txt0
-rw-r--r--Tests/RunCMake/VS10Project/solution-item-2-2.txt0
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h3
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h3
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake1
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt18
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt23
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake11
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt7
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt23
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake11
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt23
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake11
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VsNugetPackageRestore/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt2
-rw-r--r--Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt2
-rw-r--r--Tests/RunCMake/XcFramework/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake21
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn-build-check.cmake9
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn.cmake27
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/TestLib/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.c3
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.h1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake72
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake9
-rw-r--r--Tests/RunCMake/add_custom_command/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/add_custom_command/SOURCE-result.txt (renamed from Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-result.txt)0
-rw-r--r--Tests/RunCMake/add_custom_command/SOURCE-stderr.txt4
-rw-r--r--Tests/RunCMake/add_custom_command/SOURCE.cmake10
-rw-r--r--Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt4
-rw-r--r--Tests/RunCMake/add_custom_command/SourceByproducts.cmake1
-rw-r--r--Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt4
-rw-r--r--Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake1
-rw-r--r--Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt12
-rw-r--r--Tests/RunCMake/alias_targets/invalid-name-stderr.txt8
-rw-r--r--Tests/RunCMake/alias_targets/invalid-name.cmake3
-rw-r--r--Tests/RunCMake/block/Scope-POLICIES-stderr.txt10
-rw-r--r--Tests/RunCMake/block/Scope-VARIABLES-stderr.txt10
-rw-r--r--Tests/RunCMake/block/Scope-stderr.txt10
-rw-r--r--Tests/RunCMake/build_command/CMP0061-NEW.cmake1
-rw-r--r--Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt21
-rw-r--r--Tests/RunCMake/build_command/CMP0061-OLD-make.cmake2
-rw-r--r--Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt21
-rw-r--r--Tests/RunCMake/build_command/CMP0061-OLD-other.cmake2
-rw-r--r--Tests/RunCMake/build_command/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MacOS-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MacOS.cmake3
-rw-r--r--Tests/RunCMake/cmake_host_system_information/Registry_BadView2-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/cmake_host_system_information/UnitTest-stdout.txt4
-rw-r--r--Tests/RunCMake/cmake_host_system_information/UnitTest/etc/os-release4
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/defer_call-stderr.txt11
-rw-r--r--Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_minimum_required/Before24.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/Before3_10-stderr.txt29
-rw-r--r--Tests/RunCMake/cmake_minimum_required/Before3_10.cmake6
-rw-r--r--Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated-stderr.txt19
-rw-r--r--Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated.cmake5
-rw-r--r--Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-result.txt (renamed from Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt10
-rw-r--r--Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt15
-rw-r--r--Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake2
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake2
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved-stderr.txt10
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVar-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVar.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBad-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBad-stderr.txt10
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBad.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBadCache-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0035-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBadCache-stderr.txt9
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBadCache.cmake0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBadScript-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0035-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBadScript-stderr.txt7
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarBadScript.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarCache-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarCache.cmake0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarScript-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionEnvVarScript.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVar-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVar.cmake7
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBad-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0034-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBad-stderr.txt9
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBad.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBadCache-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0034-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBadCache-stderr.txt7
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBadCache.cmake0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBadScript-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBadScript-stderr.txt7
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarBadScript.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarCache-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarCache.cmake0
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarScript-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_minimum_required/PolicyVersionVarScript.cmake1
-rw-r--r--Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake24
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake2
-rw-r--r--Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt1
-rw-r--r--Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/ctest_build/ParallelLevel-check.cmake2
-rw-r--r--Tests/RunCMake/ctest_build/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/ctest_instrumentation/CMakeLists.txt.in10
-rw-r--r--Tests/RunCMake/ctest_instrumentation/InstrumentationInCTestXML-check.cmake41
-rw-r--r--Tests/RunCMake/ctest_instrumentation/NoInstrumentationInCTestXML-check.cmake11
-rw-r--r--Tests/RunCMake/ctest_instrumentation/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/ctest_instrumentation/main.c (renamed from Tests/Policy0002/policy0002.c)0
-rw-r--r--Tests/RunCMake/ctest_instrumentation/test.cmake.in17
-rw-r--r--Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLineWithInstrumentation-result.txt1
-rw-r--r--Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLineWithInstrumentation-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLineWithInstrumentation-stdout.txt9
-rw-r--r--Tests/RunCMake/ctest_labels_for_subprojects/RunCMakeTest.cmake28
-rw-r--r--Tests/RunCMake/ctest_submit/CDashUploadNone-stderr.txt5
-rw-r--r--Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-stderr.txt2
-rw-r--r--Tests/RunCMake/detect_jobserver.c8
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandErrorVar-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandErrorVar-stderr.txt5
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandErrorVar.cmake6
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandErrorVarIgnore-result.txt (renamed from Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt)0
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandErrorVarIgnore.cmake7
-rw-r--r--Tests/RunCMake/execute_process/CommandError-stderr.txt2
-rw-r--r--Tests/RunCMake/execute_process/CommandErrorVar-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0032-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/execute_process/CommandErrorVar-stderr.txt4
-rw-r--r--Tests/RunCMake/execute_process/CommandErrorVar.cmake23
-rw-r--r--Tests/RunCMake/execute_process/LastCommandGoodVar.cmake15
-rw-r--r--Tests/RunCMake/execute_process/NoneCommandError.cmake5
-rw-r--r--Tests/RunCMake/execute_process/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/execute_process/WindowsBatch-stdout.txt8
-rw-r--r--Tests/RunCMake/execute_process/WindowsBatch.cmake8
-rwxr-xr-xTests/RunCMake/execute_process/with space.bat1
-rwxr-xr-xTests/RunCMake/execute_process/with space.cmd1
-rw-r--r--Tests/RunCMake/exit_code.c8
-rw-r--r--Tests/RunCMake/exit_crash.c4
-rw-r--r--Tests/RunCMake/export/DependOnDoubleExport-stderr.txt7
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/file-RPATH/Common.cmake30
-rw-r--r--Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake1
-rw-r--r--Tests/RunCMake/find_file/REGISTRY_VIEW-no-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_file/REGISTRY_VIEW-wrong-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_file/Registry-query-stderr.txt10
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-no-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-specify-macro-stderr.txt2
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-undefined-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/REGISTRY_VIEW-no-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/REGISTRY_VIEW-wrong-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/Registry-query-stderr.txt10
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-no-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-specify-macro-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-undefined-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_package-CPS/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/find_package-CPS/CompatVersion.cmake13
-rw-r--r--Tests/RunCMake/find_package-CPS/CustomVersion.cmake13
-rw-r--r--Tests/RunCMake/find_package-CPS/ExactVersion.cmake13
-rw-r--r--Tests/RunCMake/find_package-CPS/ExperimentalWarning-stderr.txt27
-rw-r--r--Tests/RunCMake/find_package-CPS/ExperimentalWarning.cmake10
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingComponent-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0032-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingComponent-stderr.txt11
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingComponent.cmake7
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingComponentDependency-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingComponentDependency-stderr.txt22
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingComponentDependency.cmake7
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentCMake-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentCMake-stderr.txt11
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentCMake.cmake7
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentCPS-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0030-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentCPS-stderr.txt18
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentCPS.cmake7
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentDependency-result.txt (renamed from Tests/RunCMake/DisallowedCommands/CMP0030-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentDependency-stderr.txt24
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveComponentDependency.cmake8
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveDependency-result.txt (renamed from Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveDependency-stderr.txt22
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingTransitiveDependency.cmake7
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingVersion1-result.txt (renamed from Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingVersion1-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingVersion1.cmake10
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingVersion2-result.txt (renamed from Tests/RunCMake/CommandLine/toolchain-valid-abs-path-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingVersion2-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package-CPS/MissingVersion2.cmake10
-rw-r--r--Tests/RunCMake/find_package-CPS/MultipleVersions.cmake13
-rw-r--r--Tests/RunCMake/find_package-CPS/RunCMakeTest.cmake32
-rw-r--r--Tests/RunCMake/find_package-CPS/Setup.cmake11
-rw-r--r--Tests/RunCMake/find_package-CPS/TransitiveVersion.cmake13
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit1.cmake14
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit2.cmake14
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit3-result.txt (renamed from Tests/RunCMake/CMP0057/CMP0057-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit3-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit3.cmake11
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit4-result.txt (renamed from Tests/RunCMake/CMP0057/CMP0057-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit4-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package-CPS/VersionLimit4.cmake11
-rw-r--r--Tests/RunCMake/find_package-CPS/cmake/cmaketestpackage-config.cmake1
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/CustomVersion/37/CustomVersion.cps8
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/CustomVersion/42/CustomVersion.cps8
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/CustomVersion/55/CustomVersion.cps8
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/componenttest-extra.cps12
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/componenttest.cps7
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/incomplete.cps9
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/sample/1.1.0/sample.cps8
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/sample/1.2.3/sample.cps8
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/sample/1.4.2/sample.cps8
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/sample/1.5.0/sample.cps7
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/stillincomplete.cps9
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/transitiveincomplete.cps11
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/transitivemissingcmake.cps11
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/transitivemissingcps.cps11
-rw-r--r--Tests/RunCMake/find_package-CPS/cps/transitiveversion.cps11
-rw-r--r--Tests/RunCMake/find_package/CMP0074-common.cmake1
-rw-r--r--Tests/RunCMake/find_package/ComponentRecursion-stdout.txt3
-rw-r--r--Tests/RunCMake/find_package/ComponentRecursion.cmake2
-rw-r--r--Tests/RunCMake/find_package/ComponentTestConfig.cmake5
-rw-r--r--Tests/RunCMake/find_package/EmptyRoots.cmake10
-rw-r--r--Tests/RunCMake/find_package/FindComponentTest.cmake2
-rw-r--r--Tests/RunCMake/find_package/PackageRoot.cmake1
-rw-r--r--Tests/RunCMake/find_package/PackageRootNestedConfig.cmake1
-rw-r--r--Tests/RunCMake/find_package/PackageRootNestedModule.cmake1
-rw-r--r--Tests/RunCMake/find_package/REGISTRY_VIEW-no-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_package/REGISTRY_VIEW-wrong-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_package/Registry-query-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/find_path/REGISTRY_VIEW-no-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_path/REGISTRY_VIEW-wrong-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_path/Registry-query-stderr.txt10
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-no-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-specify-macro-stderr.txt2
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-undefined-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/REGISTRY_VIEW-no-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/REGISTRY_VIEW-wrong-view-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/Registry-query-stderr.txt10
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-no-function-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-specify-macro-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-undefined-function-stderr.txt2
-rw-r--r--Tests/RunCMake/function/CMAKE_CURRENT_FUNCTION.cmake2
-rw-r--r--Tests/RunCMake/get_filename_component/KnownComponents.cmake2
-rw-r--r--Tests/RunCMake/if/TestNameThatDoesNotExist.cmake1
-rw-r--r--Tests/RunCMake/if/TestNameThatExists.cmake1
-rw-r--r--Tests/RunCMake/include/CMP0024-WARN-result.txt1
-rw-r--r--Tests/RunCMake/include/CMP0024-WARN-stderr.txt25
-rw-r--r--Tests/RunCMake/include/CMP0024-WARN.cmake8
-rw-r--r--Tests/RunCMake/include/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/include_directories/CMP0021.cmake2
-rw-r--r--Tests/RunCMake/include_directories/incomplete-genex.cmake3
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW-stderr.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW.cmake3
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD-stderr.txt20
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD.cmake6
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN-stderr.txt16
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN.cmake5
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake2
-rw-r--r--Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt18
-rw-r--r--Tests/RunCMake/list/GET-CMP0007-WARN.cmake7
-rw-r--r--Tests/RunCMake/list/POP_BACK.cmake2
-rw-r--r--Tests/RunCMake/list/POP_FRONT.cmake2
-rw-r--r--Tests/RunCMake/list/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/load_cache/NewForm_Project.cmake2
-rw-r--r--Tests/RunCMake/load_cache/NewForm_Script.cmake2
-rw-r--r--Tests/RunCMake/load_cache/OldForm_Script.cmake2
-rw-r--r--Tests/RunCMake/project/CMP0048-NEW-stderr.txt7
-rw-r--r--Tests/RunCMake/project/CMP0048-NEW.cmake2
-rw-r--r--Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt4
-rw-r--r--Tests/RunCMake/project/CMP0048-OLD-VERSION.cmake2
-rw-r--r--Tests/RunCMake/project/CMP0048-OLD-stderr.txt18
-rw-r--r--Tests/RunCMake/project/CMP0048-OLD-stdout.txt2
-rw-r--r--Tests/RunCMake/project/CMP0048-OLD.cmake6
-rw-r--r--Tests/RunCMake/project/CMP0048-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/project/CMP0048-WARN.cmake3
-rw-r--r--Tests/RunCMake/project/CMP0096-NEW.cmake1
-rw-r--r--Tests/RunCMake/project/CMP0096-OLD.cmake1
-rw-r--r--Tests/RunCMake/project/CMP0096-WARN.cmake2
-rw-r--r--Tests/RunCMake/project/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/project/LanguagesDuplicate.cmake2
-rw-r--r--Tests/RunCMake/project/ProjectDescription.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectDescription2.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectDescriptionNoArg.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectHomepage.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectHomepage2-stderr.txt2
-rw-r--r--Tests/RunCMake/project/ProjectHomepage2.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt2
-rw-r--r--Tests/RunCMake/project/ProjectHomepageNoArg.cmake1
-rw-r--r--Tests/RunCMake/project/ProjectTwice.cmake1
-rw-r--r--Tests/RunCMake/project/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/project/VersionAndLanguagesEmpty.cmake1
-rw-r--r--Tests/RunCMake/project/VersionEmpty.cmake1
-rw-r--r--Tests/RunCMake/project/VersionInvalid-stderr.txt2
-rw-r--r--Tests/RunCMake/project/VersionInvalid.cmake1
-rw-r--r--Tests/RunCMake/project/VersionMax.cmake1
-rw-r--r--Tests/RunCMake/project/VersionMissingLanguages-stderr.txt2
-rw-r--r--Tests/RunCMake/project/VersionMissingLanguages.cmake1
-rw-r--r--Tests/RunCMake/project/VersionMissingValueOkay.cmake1
-rw-r--r--Tests/RunCMake/project/VersionTwice-stderr.txt2
-rw-r--r--Tests/RunCMake/project/VersionTwice.cmake1
-rw-r--r--Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt20
-rw-r--r--Tests/RunCMake/project_injected/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/project_injected/Inject-stderr.txt12
-rw-r--r--Tests/RunCMake/project_injected/Inject.cmake0
-rw-r--r--Tests/RunCMake/project_injected/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/property_init/CompileSources.cmake2
-rw-r--r--Tests/RunCMake/pseudo_emulator.c2
-rw-r--r--Tests/RunCMake/pseudo_emulator_custom_command.c8
-rw-r--r--Tests/RunCMake/pseudo_emulator_custom_command_arg.c6
-rw-r--r--Tests/RunCMake/return/CMP0140-WARN.cmake3
-rw-r--r--Tests/RunCMake/return/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/showIncludes.c2
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/CheckRPath.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion-CMP0181-OLD-validation.cmake5
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion-LINKER-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion-LINKER_CONSUMER-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion-LINKER_SHELL-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion-validation.cmake15
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion.cmake63
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-NEW-EXE_LINKER_FLAGS-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-NEW-EXE_LINKER_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-NEW-MODULE_LINKER_FLAGS-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-NEW-MODULE_LINKER_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-NEW-SHARED_LINKER_FLAGS-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-NEW-SHARED_LINKER_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-OLD-EXE_LINKER_FLAGS-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-OLD-EXE_LINKER_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-OLD-MODULE_LINKER_FLAGS-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-OLD-MODULE_LINKER_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-OLD-SHARED_LINKER_FLAGS-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2-CMP0181-OLD-SHARED_LINKER_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion2.cmake56
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-NEW-C_EXE_CREATE_LINK_FLAGS-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-NEW-C_EXE_CREATE_LINK_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-NEW-C_MODULE_CREATE_LINK_FLAGS-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-NEW-C_MODULE_CREATE_LINK_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-NEW-C_SHARED_CREATE_LINK_FLAGS-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-NEW-C_SHARED_CREATE_LINK_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-OLD-C_EXE_CREATE_LINK_FLAGS-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-OLD-C_EXE_CREATE_LINK_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-OLD-C_MODULE_CREATE_LINK_FLAGS-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-OLD-C_MODULE_CREATE_LINK_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-OLD-C_SHARED_CREATE_LINK_FLAGS-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3-CMP0181-OLD-C_SHARED_CREATE_LINK_FLAGS-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion3.cmake55
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-NEW-C_CREATE_CONSOLE_EXE-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-NEW-C_CREATE_CONSOLE_EXE-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-NEW-C_CREATE_WIN32_EXE-check.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-NEW-C_CREATE_WIN32_EXE-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-OLD-C_CREATE_CONSOLE_EXE-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-OLD-C_CREATE_CONSOLE_EXE-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-OLD-C_CREATE_WIN32_EXE-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4-CMP0181-OLD-C_CREATE_WIN32_EXE-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LINKER_expansion4.cmake47
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/RunCMakeTest.cmake73
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/bad_SHELL_usage-result.txt (renamed from Tests/RunCMake/CMP0050/CMP0050-NEW-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/bad_SHELL_usage-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/bad_SHELL_usage.cmake5
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/dump.c13
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/encode_literal.cmake15
-rw-r--r--Tests/RunCMake/target_link_libraries-LINKER-prefix/main.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt16
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt16
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt10
-rw-r--r--Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake14
-rw-r--r--Tests/RunCMake/target_sources/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/try_compile/CMP0056-stderr.txt24
-rw-r--r--Tests/RunCMake/try_compile/CMP0056-stdout.txt3
-rw-r--r--Tests/RunCMake/try_compile/CMP0056.cmake48
-rw-r--r--Tests/RunCMake/try_compile/ProjectVars-stdout.txt3
-rw-r--r--Tests/RunCMake/try_compile/ProjectVars.cmake1
-rw-r--r--Tests/RunCMake/try_compile/proj_vars/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/while/CMP0130-OLD-stderr.txt10
-rw-r--r--Tests/SBCS/CMakeLists.txt2
-rw-r--r--Tests/SharedLibraryArchive/CMakeLists.txt21
-rw-r--r--Tests/SharedLibraryArchive/nosla-check.cmake6
-rw-r--r--Tests/StagingPrefix/Producer/bar.h2
-rw-r--r--Tests/StagingPrefix/Producer/foo.h2
-rw-r--r--Tests/SubDir/Executable/test.cxx2
-rw-r--r--Tests/SubDirSpaces/CMakeLists.txt1
-rw-r--r--Tests/SubDirSpaces/Executable Sources/test.cxx2
-rw-r--r--Tests/SubDirSpaces/Executable/test.cxx2
-rw-r--r--Tests/SwiftMixPCH/CMain.c2
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt5
-rw-r--r--Tests/SwiftOnly/Sub Space/CMakeLists.txt1
-rw-r--r--Tests/SwiftOnly/Sub Space/SubSpace.swift1
-rw-r--r--Tests/SystemInformation/DumpInformation.cxx8
-rw-r--r--Tests/TestDriver/CMakeLists.txt1
-rw-r--r--Tests/Testing/CMakeLists.txt4
-rw-r--r--Tests/Testing/DartConfig.cmake1
-rw-r--r--Tests/TestsWorkingDirectory/main.c10
-rw-r--r--Tests/UseSWIG/example.h4
-rw-r--r--Tests/VSExternalInclude/Lib1/CMakeLists.txt1
-rw-r--r--Tests/VSExternalInclude/Lib2/CMakeLists.txt1
-rw-r--r--Tests/VSMARMASM/CMakeLists.txt1
-rw-r--r--Tests/VSMASM/CMakeLists.txt1
-rw-r--r--Tests/VSResource/CMakeLists.txt7
-rw-r--r--Tests/VSResource/main.cpp2
-rw-r--r--Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp2
-rw-r--r--Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp2
-rw-r--r--Tests/Visibility/CMakeLists.txt2
-rw-r--r--Tests/Wrapping/CMakeLists.txt12
-rw-r--r--Tests/Wrapping/Wrap.c2
-rw-r--r--Tests/Wrapping/qtwrappingmain.cxx2
-rw-r--r--Tests/XCTest/CMakeLists.txt15
-rw-r--r--Tests/XCTest/FrameworkExample/FrameworkExample.c2
-rw-r--r--Tests/XCTest/FrameworkExample/FrameworkExample.h2
-rw-r--r--Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m4
-rw-r--r--Tests/XCTest/StaticLibExample/StaticLibExample.c2
-rw-r--r--Tests/XCTest/StaticLibExample/StaticLibExample.h2
-rw-r--r--Tests/XCTest/StaticLibExampleTests/StaticLibExampleTests.m4
-rw-r--r--Tests/iOSNavApp/Classes/NavApp3AppDelegate.m6
-rw-r--r--Tests/iOSNavApp/Classes/RootViewController.m20
-rw-r--r--Tests/iOSNavApp/TotalFunction.c2
-rw-r--r--Tests/iOSNavApp/TotalFunction.h2
-rw-r--r--Utilities/.gitattributes2
-rw-r--r--Utilities/CMakeLists.txt8
-rw-r--r--Utilities/ClangTidyModule/CMakeLists.txt2
-rw-r--r--Utilities/ClangTidyModule/Module.cxx2
-rw-r--r--Utilities/ClangTidyModule/OstringstreamUseCmstrcatCheck.cxx8
-rw-r--r--Utilities/ClangTidyModule/OstringstreamUseCmstrcatCheck.h4
-rw-r--r--Utilities/ClangTidyModule/StringConcatenationUseCmstrcatCheck.cxx22
-rw-r--r--Utilities/ClangTidyModule/StringConcatenationUseCmstrcatCheck.h12
-rw-r--r--Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-fixit.cxx4
-rw-r--r--Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen.cxx4
-rw-r--r--Utilities/ClangTidyModule/UseBespokeEnumClassCheck.cxx6
-rw-r--r--Utilities/ClangTidyModule/UseBespokeEnumClassCheck.h4
-rw-r--r--Utilities/ClangTidyModule/UseCmstrlenCheck.cxx14
-rw-r--r--Utilities/ClangTidyModule/UseCmstrlenCheck.h4
-rw-r--r--Utilities/ClangTidyModule/UseCmsysFstreamCheck.cxx10
-rw-r--r--Utilities/ClangTidyModule/UseCmsysFstreamCheck.h4
-rw-r--r--Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx26
-rw-r--r--Utilities/ClangTidyModule/UsePragmaOnceCheck.h4
-rw-r--r--Utilities/Doxygen/CMakeLists.txt4
-rwxr-xr-xUtilities/Git/commit-msg2
-rwxr-xr-xUtilities/Git/pre-commit2
-rwxr-xr-xUtilities/Git/prepare-commit-msg2
-rw-r--r--Utilities/Release/README.rst6
-rw-r--r--Utilities/Release/WiX/CustomAction/.gitattributes1
-rw-r--r--Utilities/Release/files-v1.json.in24
-rw-r--r--Utilities/Release/files-v1.rst4
-rw-r--r--Utilities/Release/linux/aarch64/Dockerfile2
-rw-r--r--Utilities/Release/linux/aarch64/base/Dockerfile2
-rw-r--r--Utilities/Release/linux/aarch64/cache.txt2
-rw-r--r--Utilities/Release/linux/aarch64/deps/Dockerfile2
-rw-r--r--Utilities/Release/linux/aarch64/test/Dockerfile2
-rw-r--r--Utilities/Release/linux/aarch64/test/test-make.bash2
-rw-r--r--Utilities/Release/linux/aarch64/test/test-ninja.bash2
-rw-r--r--Utilities/Release/linux/x86_64/Dockerfile2
-rw-r--r--Utilities/Release/linux/x86_64/base/Dockerfile2
-rw-r--r--Utilities/Release/linux/x86_64/cache.txt2
-rw-r--r--Utilities/Release/linux/x86_64/deps/Dockerfile2
-rw-r--r--Utilities/Release/linux/x86_64/test/Dockerfile2
-rw-r--r--Utilities/Release/linux/x86_64/test/test-make.bash2
-rw-r--r--Utilities/Release/linux/x86_64/test/test-ninja.bash2
-rw-r--r--Utilities/Release/sunos/docker/Dockerfile53
-rwxr-xr-xUtilities/Release/sunos/docker/base.bash31
-rw-r--r--Utilities/Release/sunos/docker/base.lst3
-rw-r--r--Utilities/Release/sunos/docker/docker-clean0
-rwxr-xr-xUtilities/Release/sunos/docker/openssl.bash62
-rw-r--r--Utilities/Release/sunos/docker/openssl.lst4
-rw-r--r--Utilities/Release/sunos/docker/openssl.patch22
-rwxr-xr-xUtilities/Release/sunos/docker/sysroot.bash53
-rw-r--r--Utilities/Release/sunos/sparc64/cache.txt25
-rw-r--r--Utilities/Release/sunos/sparc64/toolchain.cmake6
-rw-r--r--Utilities/Release/sunos/x86_64/cache.txt25
-rw-r--r--Utilities/Release/sunos/x86_64/toolchain.cmake6
-rw-r--r--Utilities/Release/win/qt-5.15.10-win-x86-msvc.ps12
-rw-r--r--Utilities/Release/win/qtbase-6.3.0-win-msvc.cmake2
-rw-r--r--Utilities/Release/win/sign-package.ps12
-rw-r--r--Utilities/Scripts/BoostScanDeps.cmake2
-rwxr-xr-xUtilities/Scripts/clang-format.bash8
-rwxr-xr-xUtilities/Scripts/update-curl.bash2
-rwxr-xr-xUtilities/Scripts/update-liblzma.bash3
-rw-r--r--Utilities/Scripts/update-third-party.bash2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt10
-rw-r--r--Utilities/Sphinx/CTestConfig.cmake2
-rw-r--r--Utilities/Sphinx/CTestCustom.cmake.in1
-rw-r--r--Utilities/Sphinx/cmake.py2
-rw-r--r--Utilities/Sphinx/conf.py.in6
-rw-r--r--Utilities/Sphinx/static/cmake.css254
-rw-r--r--Utilities/Sphinx/templates/layout.html39
-rw-r--r--Utilities/Sphinx/templates/localtoc.html8
-rw-r--r--Utilities/cm3p/Setup.Configuration.h2
-rw-r--r--Utilities/cm3p/archive.h2
-rw-r--r--Utilities/cm3p/archive_entry.h2
-rw-r--r--Utilities/cm3p/bzlib.h2
-rw-r--r--Utilities/cm3p/cppdap/dap.h2
-rw-r--r--Utilities/cm3p/cppdap/future.h2
-rw-r--r--Utilities/cm3p/cppdap/io.h2
-rw-r--r--Utilities/cm3p/cppdap/optional.h2
-rw-r--r--Utilities/cm3p/cppdap/protocol.h2
-rw-r--r--Utilities/cm3p/cppdap/session.h2
-rw-r--r--Utilities/cm3p/cppdap/types.h2
-rw-r--r--Utilities/cm3p/curl/curl.h2
-rw-r--r--Utilities/cm3p/expat.h2
-rw-r--r--Utilities/cm3p/json/forwards.h2
-rw-r--r--Utilities/cm3p/json/json.h2
-rw-r--r--Utilities/cm3p/json/reader.h2
-rw-r--r--Utilities/cm3p/json/value.h2
-rw-r--r--Utilities/cm3p/json/version.h11
-rw-r--r--Utilities/cm3p/json/writer.h2
-rw-r--r--Utilities/cm3p/kwiml/abi.h2
-rw-r--r--Utilities/cm3p/kwiml/int.h2
-rw-r--r--Utilities/cm3p/lzma.h2
-rw-r--r--Utilities/cm3p/rhash.h2
-rw-r--r--Utilities/cm3p/uv.h2
-rw-r--r--Utilities/cm3p/zlib.h2
-rw-r--r--Utilities/cm3p/zstd.h2
-rw-r--r--Utilities/cmThirdParty.h.in2
-rw-r--r--Utilities/cmThirdPartyChecks.cmake2
-rw-r--r--Utilities/cmcurl/CMake/CurlSymbolHiding.cmake54
-rw-r--r--Utilities/cmcurl/CMake/CurlTests.c82
-rw-r--r--Utilities/cmcurl/CMake/FindBearSSL.cmake13
-rw-r--r--Utilities/cmcurl/CMake/FindBrotli.cmake85
-rw-r--r--Utilities/cmcurl/CMake/FindCares.cmake97
-rw-r--r--Utilities/cmcurl/CMake/FindGSS.cmake90
-rw-r--r--Utilities/cmcurl/CMake/FindLDAP.cmake111
-rw-r--r--Utilities/cmcurl/CMake/FindLibgsasl.cmake23
-rw-r--r--Utilities/cmcurl/CMake/FindLibidn2.cmake23
-rw-r--r--Utilities/cmcurl/CMake/FindLibpsl.cmake85
-rw-r--r--Utilities/cmcurl/CMake/FindLibrtmp.cmake103
-rw-r--r--Utilities/cmcurl/CMake/FindLibssh.cmake23
-rw-r--r--Utilities/cmcurl/CMake/FindLibssh2.cmake85
-rw-r--r--Utilities/cmcurl/CMake/FindLibuv.cmake23
-rw-r--r--Utilities/cmcurl/CMake/FindMSH3.cmake67
-rw-r--r--Utilities/cmcurl/CMake/FindMbedTLS.cmake136
-rw-r--r--Utilities/cmcurl/CMake/FindNGHTTP2.cmake84
-rw-r--r--Utilities/cmcurl/CMake/FindNGHTTP3.cmake84
-rw-r--r--Utilities/cmcurl/CMake/FindNGTCP2.cmake141
-rw-r--r--Utilities/cmcurl/CMake/FindNettle.cmake23
-rw-r--r--Utilities/cmcurl/CMake/FindQuiche.cmake68
-rw-r--r--Utilities/cmcurl/CMake/FindRustls.cmake104
-rw-r--r--Utilities/cmcurl/CMake/FindWolfSSH.cmake15
-rw-r--r--Utilities/cmcurl/CMake/FindWolfSSL.cmake100
-rw-r--r--Utilities/cmcurl/CMake/FindZstd.cmake107
-rw-r--r--Utilities/cmcurl/CMake/Macros.cmake41
-rw-r--r--Utilities/cmcurl/CMake/OtherTests.cmake67
-rw-r--r--Utilities/cmcurl/CMake/PickyWarnings.cmake139
-rw-r--r--Utilities/cmcurl/CMake/Platforms/WindowsCache.cmake195
-rw-r--r--Utilities/cmcurl/CMake/Utilities.cmake32
-rw-r--r--Utilities/cmcurl/CMake/curl-config.cmake.in44
-rw-r--r--Utilities/cmcurl/CMake/win32-cache.cmake205
-rw-r--r--Utilities/cmcurl/CMakeLists.txt1838
-rw-r--r--Utilities/cmcurl/COPYING2
-rw-r--r--Utilities/cmcurl/curltest.c10
-rw-r--r--Utilities/cmcurl/include/curl/curl.h94
-rw-r--r--Utilities/cmcurl/include/curl/curlver.h6
-rw-r--r--Utilities/cmcurl/include/curl/easy.h2
-rw-r--r--Utilities/cmcurl/include/curl/multi.h18
-rw-r--r--Utilities/cmcurl/include/curl/system.h136
-rw-r--r--Utilities/cmcurl/lib/CMakeLists.txt75
-rw-r--r--Utilities/cmcurl/lib/Makefile.inc18
-rw-r--r--Utilities/cmcurl/lib/altsvc.c171
-rw-r--r--Utilities/cmcurl/lib/altsvc.h7
-rw-r--r--Utilities/cmcurl/lib/amigaos.c5
-rw-r--r--Utilities/cmcurl/lib/asyn-ares.c272
-rw-r--r--Utilities/cmcurl/lib/asyn-thread.c153
-rw-r--r--Utilities/cmcurl/lib/asyn.h63
-rw-r--r--Utilities/cmcurl/lib/bufq.c31
-rw-r--r--Utilities/cmcurl/lib/bufq.h8
-rw-r--r--Utilities/cmcurl/lib/c-hyper.c1254
-rw-r--r--Utilities/cmcurl/lib/c-hyper.h63
-rw-r--r--Utilities/cmcurl/lib/cf-h1-proxy.c343
-rw-r--r--Utilities/cmcurl/lib/cf-h2-proxy.c41
-rw-r--r--Utilities/cmcurl/lib/cf-haproxy.c4
-rw-r--r--Utilities/cmcurl/lib/cf-https-connect.c364
-rw-r--r--Utilities/cmcurl/lib/cf-https-connect.h4
-rw-r--r--Utilities/cmcurl/lib/cf-socket.c390
-rw-r--r--Utilities/cmcurl/lib/cf-socket.h17
-rw-r--r--Utilities/cmcurl/lib/cfilters.c103
-rw-r--r--Utilities/cmcurl/lib/cfilters.h29
-rw-r--r--Utilities/cmcurl/lib/conncache.c157
-rw-r--r--Utilities/cmcurl/lib/conncache.h12
-rw-r--r--Utilities/cmcurl/lib/connect.c70
-rw-r--r--Utilities/cmcurl/lib/connect.h2
-rw-r--r--Utilities/cmcurl/lib/content_encoding.c373
-rw-r--r--Utilities/cmcurl/lib/cookie.c1459
-rw-r--r--Utilities/cmcurl/lib/cookie.h46
-rw-r--r--Utilities/cmcurl/lib/curl_addrinfo.c114
-rw-r--r--Utilities/cmcurl/lib/curl_addrinfo.h2
-rw-r--r--Utilities/cmcurl/lib/curl_config.h.cmake100
-rw-r--r--Utilities/cmcurl/lib/curl_ctype.h2
-rw-r--r--Utilities/cmcurl/lib/curl_fnmatch.c6
-rw-r--r--Utilities/cmcurl/lib/curl_get_line.c2
-rw-r--r--Utilities/cmcurl/lib/curl_get_line.h6
-rw-r--r--Utilities/cmcurl/lib/curl_gethostname.c4
-rw-r--r--Utilities/cmcurl/lib/curl_gssapi.c11
-rw-r--r--Utilities/cmcurl/lib/curl_hmac.h36
-rw-r--r--Utilities/cmcurl/lib/curl_md5.h14
-rw-r--r--Utilities/cmcurl/lib/curl_memory.h2
-rw-r--r--Utilities/cmcurl/lib/curl_multibyte.c233
-rw-r--r--Utilities/cmcurl/lib/curl_ntlm_core.c34
-rw-r--r--Utilities/cmcurl/lib/curl_path.c203
-rw-r--r--Utilities/cmcurl/lib/curl_path.h49
-rw-r--r--Utilities/cmcurl/lib/curl_rtmp.c8
-rw-r--r--Utilities/cmcurl/lib/curl_setup.h232
-rw-r--r--Utilities/cmcurl/lib/curl_setup_once.h26
-rw-r--r--Utilities/cmcurl/lib/curl_sha256.h4
-rw-r--r--Utilities/cmcurl/lib/curl_sha512_256.c79
-rw-r--r--Utilities/cmcurl/lib/curl_sspi.h12
-rw-r--r--Utilities/cmcurl/lib/curl_threads.c6
-rw-r--r--Utilities/cmcurl/lib/curl_threads.h2
-rw-r--r--Utilities/cmcurl/lib/curl_trc.c98
-rw-r--r--Utilities/cmcurl/lib/curl_trc.h136
-rw-r--r--Utilities/cmcurl/lib/curlx.h9
-rw-r--r--Utilities/cmcurl/lib/cw-out.c13
-rw-r--r--Utilities/cmcurl/lib/dict.c1
-rw-r--r--Utilities/cmcurl/lib/doh.c235
-rw-r--r--Utilities/cmcurl/lib/doh.h14
-rw-r--r--Utilities/cmcurl/lib/dynbuf.c12
-rw-r--r--Utilities/cmcurl/lib/dynbuf.h5
-rw-r--r--Utilities/cmcurl/lib/dynhds.c4
-rw-r--r--Utilities/cmcurl/lib/easy.c123
-rw-r--r--Utilities/cmcurl/lib/easy_lock.h6
-rw-r--r--Utilities/cmcurl/lib/easyif.h2
-rw-r--r--Utilities/cmcurl/lib/easyoptions.c2
-rw-r--r--Utilities/cmcurl/lib/escape.c14
-rw-r--r--Utilities/cmcurl/lib/file.c40
-rw-r--r--Utilities/cmcurl/lib/fopen.c2
-rw-r--r--Utilities/cmcurl/lib/formdata.c48
-rw-r--r--Utilities/cmcurl/lib/formdata.h2
-rw-r--r--Utilities/cmcurl/lib/ftp.c445
-rw-r--r--Utilities/cmcurl/lib/ftplistparser.c4
-rw-r--r--Utilities/cmcurl/lib/functypes.h1
-rw-r--r--Utilities/cmcurl/lib/getenv.c4
-rw-r--r--Utilities/cmcurl/lib/getinfo.c38
-rw-r--r--Utilities/cmcurl/lib/gopher.c2
-rw-r--r--Utilities/cmcurl/lib/hash.c2
-rw-r--r--Utilities/cmcurl/lib/headers.c2
-rw-r--r--Utilities/cmcurl/lib/hmac.c75
-rw-r--r--Utilities/cmcurl/lib/hostip.c44
-rw-r--r--Utilities/cmcurl/lib/hostip.h38
-rw-r--r--Utilities/cmcurl/lib/hostip4.c4
-rw-r--r--Utilities/cmcurl/lib/hsts.c102
-rw-r--r--Utilities/cmcurl/lib/hsts.h2
-rw-r--r--Utilities/cmcurl/lib/http.c952
-rw-r--r--Utilities/cmcurl/lib/http.h67
-rw-r--r--Utilities/cmcurl/lib/http1.c12
-rw-r--r--Utilities/cmcurl/lib/http2.c228
-rw-r--r--Utilities/cmcurl/lib/http2.h21
-rw-r--r--Utilities/cmcurl/lib/http_aws_sigv4.c199
-rw-r--r--Utilities/cmcurl/lib/http_chunks.c4
-rw-r--r--Utilities/cmcurl/lib/http_digest.c4
-rw-r--r--Utilities/cmcurl/lib/http_negotiate.c9
-rw-r--r--Utilities/cmcurl/lib/http_ntlm.c6
-rw-r--r--Utilities/cmcurl/lib/http_proxy.c173
-rw-r--r--Utilities/cmcurl/lib/http_proxy.h6
-rw-r--r--Utilities/cmcurl/lib/httpsrr.c167
-rw-r--r--Utilities/cmcurl/lib/httpsrr.h76
-rw-r--r--Utilities/cmcurl/lib/imap.c86
-rw-r--r--Utilities/cmcurl/lib/inet_ntop.c6
-rw-r--r--Utilities/cmcurl/lib/inet_ntop.h15
-rw-r--r--Utilities/cmcurl/lib/inet_pton.c38
-rw-r--r--Utilities/cmcurl/lib/inet_pton.h10
-rw-r--r--Utilities/cmcurl/lib/krb5.c59
-rw-r--r--Utilities/cmcurl/lib/ldap.c81
-rw-r--r--Utilities/cmcurl/lib/llist.c66
-rw-r--r--Utilities/cmcurl/lib/llist.h4
-rw-r--r--Utilities/cmcurl/lib/macos.c2
-rw-r--r--Utilities/cmcurl/lib/md4.c7
-rw-r--r--Utilities/cmcurl/lib/md5.c126
-rw-r--r--Utilities/cmcurl/lib/memdebug.c10
-rw-r--r--Utilities/cmcurl/lib/memdebug.h2
-rw-r--r--Utilities/cmcurl/lib/mime.c137
-rw-r--r--Utilities/cmcurl/lib/mprintf.c124
-rw-r--r--Utilities/cmcurl/lib/mqtt.c7
-rw-r--r--Utilities/cmcurl/lib/multi.c1239
-rw-r--r--Utilities/cmcurl/lib/multihandle.h10
-rw-r--r--Utilities/cmcurl/lib/multiif.h27
-rw-r--r--Utilities/cmcurl/lib/netrc.c503
-rw-r--r--Utilities/cmcurl/lib/netrc.h27
-rw-r--r--Utilities/cmcurl/lib/nonblock.c12
-rw-r--r--Utilities/cmcurl/lib/noproxy.c2
-rw-r--r--Utilities/cmcurl/lib/openldap.c92
-rw-r--r--Utilities/cmcurl/lib/parsedate.c18
-rw-r--r--Utilities/cmcurl/lib/pingpong.c10
-rw-r--r--Utilities/cmcurl/lib/pop3.c71
-rw-r--r--Utilities/cmcurl/lib/progress.c43
-rw-r--r--Utilities/cmcurl/lib/progress.h2
-rw-r--r--Utilities/cmcurl/lib/psl.c2
-rw-r--r--Utilities/cmcurl/lib/psl.h2
-rw-r--r--Utilities/cmcurl/lib/rand.c2
-rw-r--r--Utilities/cmcurl/lib/request.c32
-rw-r--r--Utilities/cmcurl/lib/request.h14
-rw-r--r--Utilities/cmcurl/lib/rtsp.c27
-rw-r--r--Utilities/cmcurl/lib/rtsp.h3
-rw-r--r--Utilities/cmcurl/lib/select.c108
-rw-r--r--Utilities/cmcurl/lib/select.h9
-rw-r--r--Utilities/cmcurl/lib/sendf.c55
-rw-r--r--Utilities/cmcurl/lib/sendf.h3
-rw-r--r--Utilities/cmcurl/lib/setopt.c3752
-rw-r--r--Utilities/cmcurl/lib/setup-vms.h2
-rw-r--r--Utilities/cmcurl/lib/setup-win32.h11
-rw-r--r--Utilities/cmcurl/lib/sha256.c110
-rw-r--r--Utilities/cmcurl/lib/share.c45
-rw-r--r--Utilities/cmcurl/lib/share.h11
-rw-r--r--Utilities/cmcurl/lib/smb.c67
-rw-r--r--Utilities/cmcurl/lib/smtp.c62
-rw-r--r--Utilities/cmcurl/lib/socketpair.c2
-rw-r--r--Utilities/cmcurl/lib/socketpair.h16
-rw-r--r--Utilities/cmcurl/lib/socks.c6
-rw-r--r--Utilities/cmcurl/lib/socks_gssapi.c45
-rw-r--r--Utilities/cmcurl/lib/socks_sspi.c8
-rw-r--r--Utilities/cmcurl/lib/speedcheck.h2
-rw-r--r--Utilities/cmcurl/lib/splay.c8
-rw-r--r--Utilities/cmcurl/lib/strcase.c4
-rw-r--r--Utilities/cmcurl/lib/strerror.c18
-rw-r--r--Utilities/cmcurl/lib/strparse.c136
-rw-r--r--Utilities/cmcurl/lib/strparse.h71
-rw-r--r--Utilities/cmcurl/lib/strtok.h8
-rw-r--r--Utilities/cmcurl/lib/strtoofft.c2
-rw-r--r--Utilities/cmcurl/lib/system_win32.c2
-rw-r--r--Utilities/cmcurl/lib/telnet.c51
-rw-r--r--Utilities/cmcurl/lib/tftp.c47
-rw-r--r--Utilities/cmcurl/lib/transfer.c393
-rw-r--r--Utilities/cmcurl/lib/transfer.h16
-rw-r--r--Utilities/cmcurl/lib/url.c290
-rw-r--r--Utilities/cmcurl/lib/urlapi.c200
-rw-r--r--Utilities/cmcurl/lib/urldata.h197
-rw-r--r--Utilities/cmcurl/lib/vauth/cram.c2
-rw-r--r--Utilities/cmcurl/lib/vauth/digest.c32
-rw-r--r--Utilities/cmcurl/lib/vauth/digest_sspi.c6
-rw-r--r--Utilities/cmcurl/lib/vauth/gsasl.c2
-rw-r--r--Utilities/cmcurl/lib/vauth/krb5_gssapi.c11
-rw-r--r--Utilities/cmcurl/lib/vauth/krb5_sspi.c2
-rw-r--r--Utilities/cmcurl/lib/vauth/ntlm.c16
-rw-r--r--Utilities/cmcurl/lib/vauth/ntlm_sspi.c2
-rw-r--r--Utilities/cmcurl/lib/vauth/spnego_gssapi.c9
-rw-r--r--Utilities/cmcurl/lib/vauth/spnego_sspi.c2
-rw-r--r--Utilities/cmcurl/lib/vauth/vauth.c15
-rw-r--r--Utilities/cmcurl/lib/version.c195
-rw-r--r--Utilities/cmcurl/lib/version_win32.c6
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_msh3.c81
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_ngtcp2.c410
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_osslq.c146
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_quiche.c60
-rw-r--r--Utilities/cmcurl/lib/vquic/vquic-tls.c70
-rw-r--r--Utilities/cmcurl/lib/vquic/vquic-tls.h17
-rw-r--r--Utilities/cmcurl/lib/vquic/vquic.c79
-rw-r--r--Utilities/cmcurl/lib/vquic/vquic.h8
-rw-r--r--Utilities/cmcurl/lib/vssh/curl_path.c203
-rw-r--r--Utilities/cmcurl/lib/vssh/curl_path.h36
-rw-r--r--Utilities/cmcurl/lib/vssh/libssh.c135
-rw-r--r--Utilities/cmcurl/lib/vssh/libssh2.c1759
-rw-r--r--Utilities/cmcurl/lib/vssh/ssh.h64
-rw-r--r--Utilities/cmcurl/lib/vssh/wolfssh.c26
-rw-r--r--Utilities/cmcurl/lib/vtls/bearssl.c97
-rw-r--r--Utilities/cmcurl/lib/vtls/cipher_suite.c4
-rw-r--r--Utilities/cmcurl/lib/vtls/gtls.c655
-rw-r--r--Utilities/cmcurl/lib/vtls/gtls.h24
-rw-r--r--Utilities/cmcurl/lib/vtls/keylog.c12
-rw-r--r--Utilities/cmcurl/lib/vtls/mbedtls.c376
-rw-r--r--Utilities/cmcurl/lib/vtls/openssl.c817
-rw-r--r--Utilities/cmcurl/lib/vtls/openssl.h26
-rw-r--r--Utilities/cmcurl/lib/vtls/rustls.c49
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel.c465
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel.h2
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel_int.h13
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel_verify.c315
-rw-r--r--Utilities/cmcurl/lib/vtls/sectransp.c120
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls.c783
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls.h92
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls_int.h91
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls_scache.c1213
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls_scache.h218
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls_spack.c345
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls_spack.h43
-rw-r--r--Utilities/cmcurl/lib/vtls/wolfssl.c551
-rw-r--r--Utilities/cmcurl/lib/vtls/wolfssl.h26
-rw-r--r--Utilities/cmcurl/lib/vtls/x509asn1.c35
-rw-r--r--Utilities/cmcurl/lib/vtls/x509asn1.h3
-rw-r--r--Utilities/cmcurl/lib/warnless.c56
-rw-r--r--Utilities/cmcurl/lib/warnless.h10
-rw-r--r--Utilities/cmcurl/lib/ws.c234
-rw-r--r--Utilities/cmcurl/lib/ws.h13
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt8
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt5
-rw-r--r--Utilities/cmliblzma/COPYING92
-rw-r--r--Utilities/cmliblzma/common/common_w32res.rc29
-rw-r--r--Utilities/cmliblzma/common/mythread.h55
-rw-r--r--Utilities/cmliblzma/common/sysdefs.h43
-rw-r--r--Utilities/cmliblzma/common/tuklib_common.h29
-rw-r--r--Utilities/cmliblzma/common/tuklib_config.h5
-rw-r--r--Utilities/cmliblzma/common/tuklib_cpucores.c14
-rw-r--r--Utilities/cmliblzma/common/tuklib_cpucores.h5
-rw-r--r--Utilities/cmliblzma/common/tuklib_integer.h370
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma.h39
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/base.h130
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/bcj.h54
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/block.h185
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/check.h49
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/container.h521
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/delta.h28
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/filter.h521
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/hardware.h10
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/index.h298
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/index_hash.h46
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/lzma12.h196
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/stream_flags.h114
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/version.h43
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/vli.h26
-rw-r--r--Utilities/cmliblzma/liblzma/check/check.c5
-rw-r--r--Utilities/cmliblzma/liblzma/check/check.h16
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_arm64.h122
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_fast.c158
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_small.c12
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_table.c34
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_table_be.h4
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_table_le.h4
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_tablegen.c23
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_x86.S20
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_fast.c114
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_small.c10
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_table.c29
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_table_be.h4
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_table_le.h4
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_tablegen.c15
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_x86.S18
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc_common.h137
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc_macros.h30
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc_x86_clmul.h432
-rw-r--r--Utilities/cmliblzma/liblzma/check/sha256.c21
-rw-r--r--Utilities/cmliblzma/liblzma/common/alone_decoder.c28
-rw-r--r--Utilities/cmliblzma/liblzma/common/alone_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/alone_encoder.c17
-rw-r--r--Utilities/cmliblzma/liblzma/common/auto_decoder.c32
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c25
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_buffer_encoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_decoder.c89
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_encoder.c13
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_encoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_header_decoder.c34
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_header_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_util.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/common.c61
-rw-r--r--Utilities/cmliblzma/liblzma/common/common.h128
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_decoder_memusage.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_encoder_memusage.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_preset.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_preset.h10
-rw-r--r--Utilities/cmliblzma/liblzma/common/file_info.c854
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c7
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_common.c82
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_common.h8
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_decoder.c42
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_encoder.c84
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_encoder.h11
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/hardware_cputhreads.c17
-rw-r--r--Utilities/cmliblzma/liblzma/common/hardware_physmem.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/index.c28
-rw-r--r--Utilities/cmliblzma/liblzma/common/index.h19
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_decoder.c46
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_decoder.h24
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_encoder.c18
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_encoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_hash.c38
-rw-r--r--Utilities/cmliblzma/liblzma/common/lzip_decoder.c417
-rw-r--r--Utilities/cmliblzma/liblzma/common/lzip_decoder.h21
-rw-r--r--Utilities/cmliblzma/liblzma/common/memcmplen.h64
-rw-r--r--Utilities/cmliblzma/liblzma/common/microlzma_decoder.c220
-rw-r--r--Utilities/cmliblzma/liblzma/common/microlzma_encoder.c140
-rw-r--r--Utilities/cmliblzma/liblzma/common/outqueue.c304
-rw-r--r--Utilities/cmliblzma/liblzma/common/outqueue.h186
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c6
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_decoder.c40
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_decoder_mt.c2017
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_encoder.c46
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_encoder_mt.c241
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_flags_common.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_flags_common.h8
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c15
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/string_conversion.c1338
-rw-r--r--Utilities/cmliblzma/liblzma/common/vli_decoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/vli_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/common/vli_size.c5
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_common.c5
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_common.h5
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_decoder.c17
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_encoder.c17
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_encoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_private.h5
-rw-r--r--Utilities/cmliblzma/liblzma/liblzma.pc.in7
-rw-r--r--Utilities/cmliblzma/liblzma/liblzma_generic.map128
-rw-r--r--Utilities/cmliblzma/liblzma/liblzma_linux.map143
-rw-r--r--Utilities/cmliblzma/liblzma/liblzma_w32res.rc15
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_decoder.c61
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_decoder.h128
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder.c82
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder.h39
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h6
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder_hash_table.h4
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c16
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/fastpos.h6
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/fastpos_table.c4
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/fastpos_tablegen.c19
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c10
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c16
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_common.h41
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c891
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h7
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c219
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h8
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c5
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c7
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c5
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h24
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/price.h6
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/price_table.c4
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/price_tablegen.c22
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_common.h14
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h839
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h128
-rw-r--r--Utilities/cmliblzma/liblzma/simple/arm.c9
-rw-r--r--Utilities/cmliblzma/liblzma/simple/arm64.c136
-rw-r--r--Utilities/cmliblzma/liblzma/simple/armthumb.c9
-rw-r--r--Utilities/cmliblzma/liblzma/simple/ia64.c9
-rw-r--r--Utilities/cmliblzma/liblzma/simple/powerpc.c9
-rw-r--r--Utilities/cmliblzma/liblzma/simple/riscv.c755
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_coder.c11
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_coder.h23
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_decoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_encoder.c5
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_encoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_private.h5
-rw-r--r--Utilities/cmliblzma/liblzma/simple/sparc.c9
-rw-r--r--Utilities/cmliblzma/liblzma/simple/x86.c20
-rw-r--r--Utilities/cmlibuv/CMakeLists.txt8
-rw-r--r--Utilities/cmlibuv/include/uv.h8
-rw-r--r--Utilities/cmlibuv/src/unix/fs.c23
-rw-r--r--Utilities/cmlibuv/src/unix/process.c3
-rw-r--r--Utilities/cmlibuv/src/win/process.c9
-rw-r--r--Utilities/cmllpkgc/llpkgc.c2
-rw-r--r--Utilities/cmllpkgc/llpkgc.h2
-rw-r--r--Utilities/cmllpkgc/llpkgc__internal.c2
-rw-r--r--Utilities/cmllpkgc/llpkgc__internal.h2
-rw-r--r--Utilities/std/cm/algorithm2
-rw-r--r--Utilities/std/cm/array2
-rw-r--r--Utilities/std/cm/bits/container_helpers.hxx72
-rw-r--r--Utilities/std/cm/bits/erase_if.hxx2
-rw-r--r--Utilities/std/cm/bits/fs_path.cxx50
-rw-r--r--Utilities/std/cm/bits/string_view.cxx32
-rw-r--r--Utilities/std/cm/deque4
-rw-r--r--Utilities/std/cm/filesystem162
-rw-r--r--Utilities/std/cm/forward_list2
-rw-r--r--Utilities/std/cm/iomanip22
-rw-r--r--Utilities/std/cm/iterator2
-rw-r--r--Utilities/std/cm/list4
-rw-r--r--Utilities/std/cm/map2
-rw-r--r--Utilities/std/cm/memory2
-rw-r--r--Utilities/std/cm/optional88
-rw-r--r--Utilities/std/cm/set2
-rw-r--r--Utilities/std/cm/shared_mutex2
-rw-r--r--Utilities/std/cm/string4
-rw-r--r--Utilities/std/cm/string_view42
-rw-r--r--Utilities/std/cm/type_traits33
-rw-r--r--Utilities/std/cm/unordered_map2
-rw-r--r--Utilities/std/cm/unordered_set2
-rw-r--r--Utilities/std/cm/utility2
-rw-r--r--Utilities/std/cm/vector4
-rw-r--r--Utilities/std/cmSTL.hxx.in2
-rw-r--r--Utilities/std/cmext/algorithm9
-rw-r--r--Utilities/std/cmext/enum_set331
-rw-r--r--Utilities/std/cmext/iterator10
-rw-r--r--Utilities/std/cmext/memory2
-rw-r--r--Utilities/std/cmext/string_view6
-rw-r--r--Utilities/std/cmext/type_traits2
-rwxr-xr-xbootstrap32
5119 files changed, 77273 insertions, 63715 deletions
diff --git a/.clang-format b/.clang-format
index 813a84d..84b96ab 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,5 +1,5 @@
---
-# This configuration requires clang-format version 15 exactly.
+# This configuration requires clang-format version 18 exactly.
BasedOnStyle: Mozilla
AlignOperands: false
AllowShortFunctionsOnASingleLine: InlineOnly
@@ -16,6 +16,7 @@ BraceWrapping:
BreakBeforeBraces: Custom
ColumnLimit: 79
IndentPPDirectives: AfterHash
+QualifierAlignment: Right
SortUsingDeclarations: false
SpaceAfterTemplateKeyword: true
IncludeBlocks: Regroup
diff --git a/.clang-tidy b/.clang-tidy
index c85fd67..35503d4 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -8,7 +8,6 @@ bugprone-*,\
-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-return-const-ref-from-parameter,\
@@ -30,6 +29,7 @@ misc-*,\
-misc-use-internal-linkage,\
modernize-*,\
-modernize-avoid-c-arrays,\
+-modernize-concat-nested-namespaces,\
-modernize-macro-to-enum,\
-modernize-return-braced-init-list,\
-modernize-type-traits,\
@@ -45,7 +45,6 @@ performance-*,\
-performance-unnecessary-value-param,\
readability-*,\
-readability-avoid-nested-conditional-operator,\
--readability-avoid-return-with-void-value,\
-readability-avoid-unconditional-preprocessor-if,\
-readability-convert-member-functions-to-static,\
-readability-enum-initial-value,\
@@ -59,11 +58,6 @@ readability-*,\
-readability-make-member-function-const,\
-readability-math-missing-parentheses,\
-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/.codespellrc b/.codespellrc
index c227872..383e9ce 100644
--- a/.codespellrc
+++ b/.codespellrc
@@ -4,5 +4,59 @@ check-hidden =
# Disable warnings about binary files
quiet-level = 2
builtin = clear,rare,en-GB_to_en-US
-skip = */.git,*/build,*/Copyright.txt,*/CTestCustom.cmake.in,*/doxygen.config,*/Modules/Internal/CPack/NSIS.template.in,*/Source/CursesDialog/form/*,*/Source/kwsys/*,*/Tests/RunCMake/CPack/tests/DMG_SLA/German.*,*/Tests/RunCMake/ParseImplicitData/*.input,*/Tests/StringFileTest/test.utf8,*.pfx,*/Utilities/cm*
-ignore-words-list = aci,ags,ake,ans,ba,ccompiler,cconfiguration,certi,conly,copyin,dependees,dne,dum,earch,ect,filetest,fo,helpfull,hiden,isnt,keypair,nd,ned,nin,nknown,ot,pard,sectionin,seh,ser,te,upto,varn,vas,wee
+
+# Skip paths matching fnmatch glob patterns.
+skip =
+ .git,
+ .typos.toml,
+ build,
+ CONTRIBUTORS.rst,
+ CTestCustom.cmake.in,
+ Modules/Internal/CPack/NSIS.template.in,
+ Source/CursesDialog/form/*,
+ Source/kwsys/*,
+ Tests/RunCMake/CPack/tests/DMG_SLA/German.*,
+ Tests/RunCMake/ParseImplicitData/*.input,
+ Tests/StringFileTest/test.utf8,
+ Utilities/cm*,
+ *.pfx,
+
+# noqa: spellcheck off
+ignore-words-list =
+ abd,
+ aci,
+ ags,
+ ake,
+ ans,
+ ba,
+ ccompiler,
+ cconfiguration,
+ certi,
+ conly,
+ copyin,
+ dependees,
+ dne,
+ dum,
+ earch,
+ ect,
+ filetest,
+ fo,
+ helpfull,
+ hiden,
+ isnt,
+ keypair,
+ nd,
+ ned,
+ nin,
+ nknown,
+ ot,
+ pard,
+ sectionin,
+ seh,
+ ser,
+ te,
+ upto,
+ varn,
+ vas,
+ wee,
+# noqa: spellcheck on
diff --git a/.gitattributes b/.gitattributes
index 96a1166..0e7ab06 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,15 +1,22 @@
.git* export-ignore
.hooks* export-ignore
+.clang-format export-ignore
+.clang-tidy export-ignore
.codespellrc export-ignore
.editorconfig export-ignore
+.pre-commit-config.yaml export-ignore
+.typos.toml export-ignore
# Custom attribute to mark sources as using our C code style.
-[attr]our-c-style whitespace=tab-in-indent format.clang-format=15
+[attr]our-c-style whitespace=tab-in-indent format.clang-format=18
# Custom attribute to mark sources as generated.
# Do not perform whitespace checks. Do not format.
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format
+# Custom attribute to mark files as TABs indented.
+[attr]tab-indent whitespace=-tab-in-indent
+
bootstrap eol=lf
configure eol=lf
*.[1-9] eol=lf
@@ -19,9 +26,28 @@ configure eol=lf
*.bat eol=crlf
*.bat.in eol=crlf
+*.cmd eol=crlf
*.sln eol=crlf
*.vcproj eol=crlf
+Makefile tab-indent
+Makefile.in tab-indent
+NSIS.template.in tab-indent
+coverage.xml.in tab-indent
+*.F tab-indent
+*.f tab-indent
+*.pbxproj.in tab-indent
+*.plist.in tab-indent
+*.plist tab-indent
+*.sln tab-indent
+*.s tab-indent
+*.vcproj tab-indent
+*.vcproj.in tab-indent
+*.vfproj.in tab-indent
+*.xib tab-indent
+*.make tab-indent
+.hooks-config tab-indent
+
*.pfx -text
*.png -text
*.png.in -text
@@ -31,6 +57,7 @@ configure eol=lf
*.cpp our-c-style
*.cu our-c-style
*.cxx our-c-style
+*.H our-c-style
*.h our-c-style
*.hh our-c-style
*.hpp our-c-style
diff --git a/.gitignore b/.gitignore
index 1780a41..9e28364 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+# Help tools that honor '.gitignore' (redundant for Git itself).
+/.git
+
/CMakeUserPresets.json
# Common build directories
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f61070e..8660d3c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -72,6 +72,12 @@ u:source-package:
needs:
- p:source-package
+b:version-update:
+ extends:
+ - .cmake_version_update_linux
+ - .linux_x86_64_tags
+ - .run_version_update
+
# Documentation builds
b:cmake.org-help:
@@ -89,9 +95,9 @@ u:cmake.org-help:
# Lint builds
-l:codespell:
+l:spellcheck:
extends:
- - .cmake_codespell_linux
+ - .cmake_spellcheck_linux
- .linux_x86_64_tags
- .run_automatically
@@ -300,7 +306,7 @@ t:fedora41-makefiles-nospace:
CMAKE_CI_BUILD_NAME: fedora41_makefiles_nospace
CMAKE_CI_JOB_NIGHTLY: "true"
-t:nvhpc22.11-ninja:
+t:nvhpc24.9-ninja:
extends:
- .nvhpc_ninja
- .cmake_test_linux_release
@@ -390,10 +396,31 @@ t:cuda12.2-nvidia:
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos7_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:cuda12.2-clang:
+ extends:
+ - .cuda12.2_clang
+ - .cmake_test_linux_release
+ - .linux_x86_64_tags_cuda_arch_52
+ - .run_dependent
+ - .needs_centos7_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:cuda12.6-nvidia:
+ extends:
+ - .cuda12.6_nvidia
+ - .cmake_test_linux_release
+ - .linux_x86_64_tags_cuda_arch_52
+ - .cmake_junit_artifacts
+ - .run_dependent
+ - .needs_centos7_x86_64
-t:cuda12.2-nvidia-clang:
+t:cuda12.6-nvidia-clang:
extends:
- - .cuda12.2_nvidia_clang
+ - .cuda12.6_nvidia_clang
- .cmake_test_linux_release
- .linux_x86_64_tags_cuda_arch_52
- .cmake_junit_artifacts
@@ -402,9 +429,9 @@ t:cuda12.2-nvidia-clang:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:cuda12.2-clang:
+t:cuda12.6-clang:
extends:
- - .cuda12.2_clang
+ - .cuda12.6_clang
- .cmake_test_linux_release
- .linux_x86_64_tags_cuda_arch_52
- .run_dependent
@@ -412,9 +439,9 @@ t:cuda12.2-clang:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:hip5.5-nvidia:
+t:hip6.3-nvidia:
extends:
- - .hip5.5_nvidia
+ - .hip6.3_nvidia
- .cmake_test_linux_release
- .linux_x86_64_tags_cuda_arch_52
- .run_dependent
@@ -422,9 +449,9 @@ t:hip5.5-nvidia:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:hip5.5-radeon:
+t:hip6.3-radeon:
extends:
- - .hip5.5_radeon
+ - .hip6.3_radeon
- .cmake_test_linux_release
- .linux_x86_64_tags_radeon
- .run_dependent
@@ -432,6 +459,26 @@ t:hip5.5-radeon:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
+t:linux-gcc-cxx-modules-ninja:
+ extends:
+ - .gcc_cxx_modules_ninja
+ - .cmake_test_linux_release
+ - .linux_x86_64_tags
+ - .run_dependent
+ - .needs_centos7_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:linux-gcc-cxx-modules-ninja-multi:
+ extends:
+ - .gcc_cxx_modules_ninja_multi
+ - .cmake_test_linux_release
+ - .linux_x86_64_tags
+ - .run_dependent
+ - .needs_centos7_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
t:debian10-legacy:
extends:
- .debian10_legacy
@@ -736,6 +783,13 @@ t:oneapi2024.1.0-makefiles:
CMAKE_CI_BUILD_NAME: oneapi2024.1.0_makefiles
CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2024.1.0-el8
+t:oneapi2024.2.0-makefiles:
+ extends:
+ - .cmake_test_linux_inteloneapi_makefiles
+ variables:
+ CMAKE_CI_BUILD_NAME: oneapi2024.2.0_makefiles
+ CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2024.2.0-rocky9
+
b:linux-x86_64-package:
extends:
- .linux_package
@@ -776,6 +830,46 @@ u:linux-aarch64-package:
needs:
- b:linux-aarch64-package
+b:sunos-x86_64-package:
+ extends:
+ - .sunos_package
+ - .sunos_release_x86_64
+ - .cmake_build_sunos_release
+ - .cmake_release_artifacts
+ - .linux_x86_64_tags
+ - .run_only_for_package
+ needs:
+ - p:doc-package
+ variables:
+ CMAKE_CI_ARTIFACTS_NAME: "artifacts-sunos-x86_64"
+
+u:sunos-x86_64-package:
+ extends:
+ - .rsync_upload_package
+ - .run_only_for_package
+ needs:
+ - b:sunos-x86_64-package
+
+b:sunos-sparc64-package:
+ extends:
+ - .sunos_package
+ - .sunos_release_sparc64
+ - .cmake_build_sunos_release
+ - .cmake_release_artifacts
+ - .linux_x86_64_tags
+ - .run_only_for_package
+ needs:
+ - p:doc-package
+ variables:
+ CMAKE_CI_ARTIFACTS_NAME: "artifacts-sunos-sparc64"
+
+u:sunos-sparc64-package:
+ extends:
+ - .rsync_upload_package
+ - .run_only_for_package
+ needs:
+ - b:sunos-sparc64-package
+
## Sanitizer builds
b:fedora41-asan:
@@ -1093,6 +1187,15 @@ t:windows-vs2022-x64-nightly:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
+t:windows-vs2022-x64-i18n:
+ extends:
+ - .t:windows-vs2022-x64
+ - .windows_x86_64_tags_concurrent_vs2022_android
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake i18n cï\\$CI_CONCURRENT_ID"
+ CMAKE_CONFIGURATION: windows_vs2022_x64_i18n
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
t:windows-vs2019-x64:
extends:
- .windows_vs2019_x64
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
index b2315be..97b8f38 100644
--- a/.gitlab/artifacts.yml
+++ b/.gitlab/artifacts.yml
@@ -60,7 +60,7 @@
# CTest/CDash information.
- ${CMAKE_CI_BUILD_DIR}/Testing/
- - ${CMAKE_CI_BUILD_DIR}/DartConfiguation.tcl
+ - ${CMAKE_CI_BUILD_DIR}/DartConfiguration.tcl
- ${CMAKE_CI_BUILD_DIR}/CTestCustom.cmake
- ${CMAKE_CI_BUILD_DIR}/cdash-build-id
reports:
@@ -78,6 +78,8 @@
- ${CMAKE_CI_BUILD_DIR}/cmake-*-linux-x86_64.*
- ${CMAKE_CI_BUILD_DIR}/cmake-*-linux-aarch64.*
- ${CMAKE_CI_BUILD_DIR}/cmake-*-macos*-universal.*
+ - ${CMAKE_CI_BUILD_DIR}/cmake-*-sunos-x86_64.*
+ - ${CMAKE_CI_BUILD_DIR}/cmake-*-sunos-sparc64.*
- ${CMAKE_CI_BUILD_DIR}/cmake-*-windows-x86_64.*
- ${CMAKE_CI_BUILD_DIR}/cmake-*-windows-i386.*
- ${CMAKE_CI_BUILD_DIR}/cmake-*-windows-arm64.*
diff --git a/.gitlab/ci/cmake_version_update.sh b/.gitlab/ci/cmake_version_update.sh
new file mode 100755
index 0000000..e73419d
--- /dev/null
+++ b/.gitlab/ci/cmake_version_update.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+set -e
+
+if test "$CI_COMMIT_REF_NAME" != "master"; then
+ echo "The version update may run only on the 'master' branch."
+ exit 1
+fi
+
+# A project-specific access token must be provided by
+# the pipeline schedule under which this job runs.
+if test -z "$CMAKE_CI_GIT_ACCESS_TOKEN"; then
+ echo "No CMAKE_CI_GIT_ACCESS_TOKEN is available."
+ exit 1
+fi
+
+git config user.name "${CMAKE_CI_AUTHOR_NAME-Kitware Robot}"
+git config user.email "${CMAKE_CI_AUTHOR_EMAIL-kwrobot@kitware.com}"
+git remote add upstream "https://oauth2:$CMAKE_CI_GIT_ACCESS_TOKEN@gitlab.kitware.com/$CI_PROJECT_PATH.git"
+
+# Repeat a few times in case we lose a race.
+n=6
+for try in $(seq $n); do
+ git fetch upstream "$CI_COMMIT_REF_NAME"
+ git reset -q --hard FETCH_HEAD
+ Source/CMakeVersion.bash
+ git update-index -q --ignore-missing --refresh
+ modified=$(git diff-index --name-only HEAD -- "Source/CMakeVersion.cmake" "LICENSE.rst")
+ if test -n "$modified"; then
+ echo "version changed"
+ git add -u
+ git commit -m "CMake Nightly Date Stamp"
+ if git push --push-option=ci.skip upstream "HEAD:$CI_COMMIT_REF_NAME"; then
+ exit 0
+ else
+ echo "Try #$try failed to fast-forward."
+ fi
+ else
+ echo "version unchanged"
+ exit 0
+ fi
+ sleep 30
+done
+
+# Give up after failing too many times.
+exit 1
diff --git a/.gitlab/ci/codespell.bash b/.gitlab/ci/codespell.bash
new file mode 100755
index 0000000..bbaffd2
--- /dev/null
+++ b/.gitlab/ci/codespell.bash
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+result=0
+
+# 'codespell' with no arguments adds a leading './' to all paths.
+# Avoid that by globbing top-level entries explicitly.
+shopt -s dotglob
+echo "Running 'codespell' on source code..."
+codespell * || result=1
+shopt -u dotglob
+
+if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
+ for COMMIT in $(git rev-list "^$CI_MERGE_REQUEST_DIFF_BASE_SHA" "$CI_COMMIT_SHA"); do
+ echo "Running 'codespell' on commit message of $COMMIT..."
+ git show --format=%B -s "$COMMIT" | codespell - || result=1
+ done
+fi
+
+exit $result
diff --git a/.gitlab/ci/codespell.sh b/.gitlab/ci/codespell.sh
deleted file mode 100755
index fd052bd..0000000
--- a/.gitlab/ci/codespell.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-set -e
-
-result=0
-echo "Running codespell on source code..."
-codespell || result=1
-
-if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
- for COMMIT in $(git rev-list "^$CI_MERGE_REQUEST_DIFF_BASE_SHA" "$CI_COMMIT_SHA"); do
- echo "Running codespell on commit message of $COMMIT..."
- git show --format=%B -s "$COMMIT" | codespell - || result=1
- done
-fi
-
-exit $result
diff --git a/.gitlab/ci/configure_cuda12.2_nvidia_clang.cmake b/.gitlab/ci/configure_cuda12.2_nvidia_clang.cmake
deleted file mode 100644
index 3019a99..0000000
--- a/.gitlab/ci/configure_cuda12.2_nvidia_clang.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include("${CMAKE_CURRENT_LIST_DIR}/configure_cuda12.2_nvidia_common.cmake")
diff --git a/.gitlab/ci/configure_cuda12.6_clang.cmake b/.gitlab/ci/configure_cuda12.6_clang.cmake
new file mode 100644
index 0000000..ed53d1b
--- /dev/null
+++ b/.gitlab/ci/configure_cuda12.6_clang.cmake
@@ -0,0 +1,7 @@
+set(CMake_TEST_CUDA "Clang" CACHE STRING "")
+set(CMake_TEST_CUDA_ARCH "52" CACHE STRING "")
+set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20;23" CACHE STRING "")
+set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_CUDA "ON" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_cuda12.6_nvidia.cmake b/.gitlab/ci/configure_cuda12.6_nvidia.cmake
new file mode 100644
index 0000000..5aeebf6
--- /dev/null
+++ b/.gitlab/ci/configure_cuda12.6_nvidia.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_cuda12.6_nvidia_common.cmake")
diff --git a/.gitlab/ci/configure_cuda12.6_nvidia_clang.cmake b/.gitlab/ci/configure_cuda12.6_nvidia_clang.cmake
new file mode 100644
index 0000000..5aeebf6
--- /dev/null
+++ b/.gitlab/ci/configure_cuda12.6_nvidia_clang.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_cuda12.6_nvidia_common.cmake")
diff --git a/.gitlab/ci/configure_cuda12.6_nvidia_common.cmake b/.gitlab/ci/configure_cuda12.6_nvidia_common.cmake
new file mode 100644
index 0000000..392d669
--- /dev/null
+++ b/.gitlab/ci/configure_cuda12.6_nvidia_common.cmake
@@ -0,0 +1,8 @@
+set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "")
+set(CMake_TEST_CUDA_ARCH "52" CACHE STRING "")
+set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
+set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20" CACHE STRING "")
+set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_CUDA "ON" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_debian12_ninja_common.cmake b/.gitlab/ci/configure_debian12_ninja_common.cmake
index 751a6c8..3912daa 100644
--- a/.gitlab/ci/configure_debian12_ninja_common.cmake
+++ b/.gitlab/ci/configure_debian12_ninja_common.cmake
@@ -89,6 +89,7 @@ set(CMake_TEST_FindPython3 "ON" CACHE BOOL "")
set(CMake_TEST_FindPython3_IronPython "ON" CACHE BOOL "")
set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby "ON" CACHE BOOL "")
+#set(CMake_TEST_FindRuby_RBENV "ON" CACHE BOOL "") # fails because system and rbenv versions are same
set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "")
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_fedora41_makefiles.cmake b/.gitlab/ci/configure_fedora41_makefiles.cmake
index de57fde..2a57087 100644
--- a/.gitlab/ci/configure_fedora41_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora41_makefiles.cmake
@@ -88,6 +88,7 @@ set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "")
set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "")
set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby "ON" CACHE BOOL "")
+set(CMake_TEST_FindRuby_RBENV "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "")
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_hip5.5_nvidia.cmake b/.gitlab/ci/configure_hip6.3_nvidia.cmake
index 036a227..036a227 100644
--- a/.gitlab/ci/configure_hip5.5_nvidia.cmake
+++ b/.gitlab/ci/configure_hip6.3_nvidia.cmake
diff --git a/.gitlab/ci/configure_hip5.5_radeon.cmake b/.gitlab/ci/configure_hip6.3_radeon.cmake
index 06e47c9..06e47c9 100644
--- a/.gitlab/ci/configure_hip5.5_radeon.cmake
+++ b/.gitlab/ci/configure_hip6.3_radeon.cmake
diff --git a/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake b/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake
new file mode 100644
index 0000000..b7faa36
--- /dev/null
+++ b/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake
@@ -0,0 +1,3 @@
+set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,bmionly,build_database,import_std23" 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
new file mode 100644
index 0000000..b7faa36
--- /dev/null
+++ b/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja_multi.cmake
@@ -0,0 +1,3 @@
+set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,bmionly,build_database,import_std23" 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 d49205f..eb319c9 100644
--- a/.gitlab/ci/configure_macos_arm64_ninja.cmake
+++ b/.gitlab/ci/configure_macos_arm64_ninja.cmake
@@ -11,5 +11,12 @@ set(CMake_TEST_TLS_VERIFY_URL_BAD "https://badtls-expired.kitware.com" CACHE STR
set(CMake_TEST_TLS_VERSION "1.2" CACHE STRING "")
set(CMake_TEST_TLS_VERSION_URL_BAD "https://badtls-v1-1.kitware.com:8011" CACHE STRING "")
+# "Release" flags without "-DNDEBUG" so we get assertions.
+set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "")
+
+# https://libcxx.llvm.org/Hardening.html
+set(CMAKE_CXX_FLAGS "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" 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_common.cmake b/.gitlab/ci/configure_macos_common.cmake
index e78c9ce..614f211 100644
--- a/.gitlab/ci/configure_macos_common.cmake
+++ b/.gitlab/ci/configure_macos_common.cmake
@@ -16,3 +16,9 @@ set(BUILD_QtDialog ON CACHE BOOL "")
# when CMake itself is configured. Use a version that is not
# newer than the macOS version running on any CI host.
set(CMake_TEST_XCTest_DEPLOYMENT_TARGET "10.15" CACHE STRING "")
+
+if("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_arm64")
+ set(CMake_TEST_APPLE_SILICON ON CACHE BOOL "")
+else()
+ set(CMake_TEST_APPLE_SILICON OFF CACHE BOOL "")
+endif()
diff --git a/.gitlab/ci/configure_macos_x86_64_ninja.cmake b/.gitlab/ci/configure_macos_x86_64_ninja.cmake
index c823917..9de043e 100644
--- a/.gitlab/ci/configure_macos_x86_64_ninja.cmake
+++ b/.gitlab/ci/configure_macos_x86_64_ninja.cmake
@@ -14,5 +14,12 @@ set(CMake_TEST_TLS_VERIFY_URL_BAD "https://badtls-expired.kitware.com" CACHE STR
set(CMake_TEST_TLS_VERSION "1.2" CACHE STRING "")
set(CMake_TEST_TLS_VERSION_URL_BAD "https://badtls-v1-1.kitware.com:8011" CACHE STRING "")
+# "Release" flags without "-DNDEBUG" so we get assertions.
+set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "")
+
+# https://libcxx.llvm.org/Hardening.html
+set(CMAKE_CXX_FLAGS "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" 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_nvhpc_ninja.cmake b/.gitlab/ci/configure_nvhpc_ninja.cmake
index ebbafcb..e25ff72 100644
--- a/.gitlab/ci/configure_nvhpc_ninja.cmake
+++ b/.gitlab/ci/configure_nvhpc_ninja.cmake
@@ -2,6 +2,9 @@ set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "")
set(CMake_TEST_CUDA_ARCH "52" CACHE STRING "")
set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
+set(CMake_TEST_C_STANDARDS "90;99;11;17" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
set(configure_no_sccache 1)
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_i18n.cmake b/.gitlab/ci/configure_windows_vs2022_x64_i18n.cmake
new file mode 100644
index 0000000..3932f8a
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs2022_x64_i18n.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs2022_x64.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
index f31c1b5..3fb894c 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
@@ -14,6 +14,10 @@ set(CMake_TEST_TLS_VERIFY_URL_BAD "https://badtls-expired.kitware.com" CACHE STR
set(CMake_TEST_TLS_VERSION "1.2" CACHE STRING "")
set(CMake_TEST_TLS_VERSION_URL_BAD "https://badtls-v1-1.kitware.com:8011" CACHE STRING "")
+# Release flags without -DNDEBUG so we get assertions.
+set(CMAKE_C_FLAGS_RELEASE "-O2 -Ob2" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Ob2" 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_vs2022_x64_ninja_multi.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja_multi.cmake
index 6857c2c..3a0eddd 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64_ninja_multi.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja_multi.cmake
@@ -1,6 +1,7 @@
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_IAR_TOOLCHAINS "$ENV{CI_PROJECT_DIR}/.gitlab/iar" CACHE PATH "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
+ set(CMake_TEST_Swift "ON" CACHE STRING "")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_cxx_modules_common.cmake")
diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake
index 8df2ed3..f21a68d 100644
--- a/.gitlab/ci/ctest_exclusions.cmake
+++ b/.gitlab/ci/ctest_exclusions.cmake
@@ -16,13 +16,6 @@ if (CTEST_CMAKE_GENERATOR MATCHES "Visual Studio")
"^ExternalProjectUpdateSetup$")
endif ()
-if (CTEST_CMAKE_GENERATOR MATCHES "Xcode")
- list(APPEND test_exclusions
- # FIXME(#26301): The XCTest fails with Xcode 16.0.
- "^XCTest$"
- )
-endif ()
-
if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "_asan")
list(APPEND test_exclusions
CTestTest2 # crashes on purpose
@@ -37,13 +30,6 @@ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "_jom")
)
endif()
-if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "nvhpc_")
- list(APPEND test_exclusions
- # FIXME(#24187): This test fails with NVHPC as the CUDA host compiler.
- "^CudaOnly.SeparateCompilationPTX$"
- )
-endif()
-
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
set(test_exclusions "(${test_exclusions})")
diff --git a/.gitlab/ci/docker/cuda12.6/Dockerfile b/.gitlab/ci/docker/cuda12.6/Dockerfile
new file mode 100644
index 0000000..b47bcfd
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.6/Dockerfile
@@ -0,0 +1,9 @@
+FROM kitware/nvidia-cuda:12.6.3-devel-ubuntu24.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.6/install_deps.sh b/.gitlab/ci/docker/cuda12.6/install_deps.sh
new file mode 100755
index 0000000..4708277
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.6/install_deps.sh
@@ -0,0 +1,21 @@
+#!/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 \
+ libomp-18-dev \
+ curl \
+ git
+
+apt-get clean
diff --git a/.gitlab/ci/docker/cuda12.6/llvm-snapshot.gpg.key b/.gitlab/ci/docker/cuda12.6/llvm-snapshot.gpg.key
new file mode 100644
index 0000000..aa6b105
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.6/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.6/llvm.list b/.gitlab/ci/docker/cuda12.6/llvm.list
new file mode 100644
index 0000000..b39b6d4
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.6/llvm.list
@@ -0,0 +1,2 @@
+deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main
+deb-src http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main
diff --git a/.gitlab/ci/docker/debian12-x86_64/Dockerfile b/.gitlab/ci/docker/debian12-x86_64/Dockerfile
index 477e763..3a9a6a1 100644
--- a/.gitlab/ci/docker/debian12-x86_64/Dockerfile
+++ b/.gitlab/ci/docker/debian12-x86_64/Dockerfile
@@ -44,6 +44,8 @@ RUN --mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \
FROM ${BASE_IMAGE}
LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
+ENV RBENV_ROOT=/opt/rbenv
+
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=bind,source=dpkg-exclude,target=/etc/dpkg/dpkg.cfg.d/exclude \
diff --git a/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst b/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst
index 21d25f0..d92f38d 100644
--- a/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst
+++ b/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst
@@ -102,6 +102,7 @@ libxslt-dev xsltproc
openjdk-17-jdk
python3 python3-dev python3-numpy pypy3 pypy3-dev python3-venv
qtbase5-dev qtbase5-dev-tools
+rbenv ruby-build
ruby ruby-dev
swig
unixodbc-dev
diff --git a/.gitlab/ci/docker/debian12-x86_64/install_deps.sh b/.gitlab/ci/docker/debian12-x86_64/install_deps.sh
index 7bfcacd..1493f1e 100755
--- a/.gitlab/ci/docker/debian12-x86_64/install_deps.sh
+++ b/.gitlab/ci/docker/debian12-x86_64/install_deps.sh
@@ -10,6 +10,10 @@ sha256sum --check ironpython.sha256sum
dpkg -i ironpython_3.4.0.deb
rm ironpython_3.4.0.deb ironpython.sha256sum
+# Ruby rbenv
+rbenv install 3.1.2
+rbenv global 3.1.2
+
# Perforce
curl -L https://www.perforce.com/downloads/perforce/r21.2/bin.linux26x86_64/helix-core-server.tgz -o - \
| tar -C /usr/local/bin -xvzf - -- p4 p4d
diff --git a/.gitlab/ci/docker/fedora41-hip/Dockerfile b/.gitlab/ci/docker/fedora41-hip/Dockerfile
index 606ddcc..ac7a0ff 100644
--- a/.gitlab/ci/docker/fedora41-hip/Dockerfile
+++ b/.gitlab/ci/docker/fedora41-hip/Dockerfile
@@ -3,25 +3,10 @@
ARG BASE_IMAGE=fedora:41
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 \
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
--mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
- --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \
- --mount=type=cache,target=/var/cache/pip \
+ --mount=type=cache,target=/var/lib/dnf \
--mount=type=tmpfs,target=/var/log \
--mount=type=tmpfs,target=/tmp \
- sh /root/install_deps.sh
+ dnf install -y $(grep -h '^[^#]\+$' /root/*.lst)
diff --git a/.gitlab/ci/docker/fedora41-hip/dnf.conf b/.gitlab/ci/docker/fedora41-hip/dnf.conf
new file mode 100644
index 0000000..1189746
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41-hip/dnf.conf
@@ -0,0 +1,32 @@
+[main]
+autocheck_running_kernel=0
+debuglevel=2
+diskspacecheck=0
+fastestmirror=1
+gpgcheck=1
+installonly_limit=5
+install_weak_deps=0
+keepcache=1
+log_rotate=0
+max_parallel_downloads=10
+metadata_expire=90m
+multilib_policy=best
+plugins=1
+tsflags=nodocs
+
+# Enable color for all output
+color=always
+
+# Default color options according to yum.conf(5)
+color_list_installed_older=bold,black
+color_list_installed_newer=bold,yellow
+color_list_installed_reinstall=normal
+color_list_installed_extra=bold,red
+color_list_available_upgrade=bold,blue
+color_list_available_downgrade=dim,yellow
+color_list_available_install=normal
+color_list_available_reinstall =bold,underline,green
+color_search_match=bold,magenta
+color_update_installed=green
+color_update_local=cyan
+color_update_remote=yellow
diff --git a/.gitlab/ci/docker/fedora41-hip/install_deps.sh b/.gitlab/ci/docker/fedora41-hip/install_deps.sh
deleted file mode 100755
index eedff9c..0000000
--- a/.gitlab/ci/docker/fedora41-hip/install_deps.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/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/fedora41/Dockerfile b/.gitlab/ci/docker/fedora41/Dockerfile
index ed7daa7..67bcbbc 100644
--- a/.gitlab/ci/docker/fedora41/Dockerfile
+++ b/.gitlab/ci/docker/fedora41/Dockerfile
@@ -4,55 +4,132 @@ ARG BASE_IMAGE=fedora:41
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 \
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
+ --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
--mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \
+ --mount=type=bind,source=rbenv_packages.lst,target=/root/rbenv_packages.lst \
+ --mount=type=bind,source=rust_packages.lst,target=/root/rust_packages.lst \
--mount=type=bind,source=rvm_packages.lst,target=/root/rvm_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)
+ dnf install --downloadonly -y $(grep -h '^[^#]\+$' /root/*.lst)
-FROM ${BASE_IMAGE} AS rvm-build
+FROM ${BASE_IMAGE} AS rust-build-env
LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
+# Pre-install prerequisites to build Rust projects.
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
+ --mount=type=bind,source=rust_packages.lst,target=/root/rust_packages.lst \
+ --mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
+ --mount=type=tmpfs,target=/var/log \
+ --mount=type=tmpfs,target=/tmp \
+ dnf install -y $(grep '^[^#]\+$' /root/rust_packages.lst)
-RUN --mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \
+
+FROM rust-build-env AS rust-build
+LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
+# Build the needed Rust packages.
+# https://doc.rust-lang.org/cargo/guide/cargo-home.html?highlight=.cargo#caching-the-cargo-home-in-ci
+RUN --mount=type=bind,source=build_rust.sh,target=/root/build_rust.sh \
+ --mount=type=cache,target=/root/.cargo/registry/index \
+ --mount=type=cache,target=/root/.cargo/registry/cache \
+ --mount=type=tmpfs,target=/tmp \
+ sh /root/build_rust.sh
+
+
+FROM ${BASE_IMAGE} AS rvm-build-env
+LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
+# Pre-install prerequisites for RVM.
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
--mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \
- --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \
+ --mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
--mount=type=tmpfs,target=/var/log \
--mount=type=tmpfs,target=/tmp \
- sh /root/install_rvm.sh
+ dnf install -y $(grep '^[^#]\+$' /root/rvm_packages.lst)
-FROM ${BASE_IMAGE} AS iwyu-build
-LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
+FROM rvm-build-env AS rvm-build
+LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
+# Build Ruby with RVM.
+RUN --mount=type=bind,source=build_rvm.sh,target=/root/build_rvm.sh \
+ --mount=type=cache,target=/usr/local/rvm/archives \
+ --mount=type=cache,target=/usr/local/rvm/gem-cache \
+ --mount=type=cache,target=/usr/local/rvm/src \
+ --mount=type=tmpfs,target=/tmp \
+ sh /root/build_rvm.sh
-RUN --mount=type=bind,source=install_iwyu.sh,target=/root/install_iwyu.sh \
+
+FROM ${BASE_IMAGE} AS rbenv
+# Pre-install prerequisites for `rbenv`.
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
+ --mount=type=bind,source=rbenv_packages.lst,target=/root/rbenv_packages.lst \
+ --mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
+ --mount=type=tmpfs,target=/var/log \
+ --mount=type=tmpfs,target=/tmp \
+ dnf install -y $(grep '^[^#]\+$' /root/rbenv_packages.lst)
+
+
+FROM rbenv AS rbenv-build
+ENV RBENV_ROOT=/opt/rbenv
+ENV RBENV_BUILD_ROOT=/root/.cache/rbenv-build
+ENV RUBY_BUILD_CACHE_PATH=/root/.cache/rbenv
+# Build Ruby with `rbenv`.
+RUN --mount=type=cache,target=/root/.cache \
+ --mount=type=bind,source=build_rbenv.sh,target=/root/build_rbenv.sh \
+ --mount=type=tmpfs,target=/tmp \
+ sh /root/build_rbenv.sh
+
+
+FROM ${BASE_IMAGE} AS iwyu-build-env
+LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
+# Pre-install prerequisites to build IWYU.
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
--mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \
- --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \
+ --mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
--mount=type=tmpfs,target=/var/log \
--mount=type=tmpfs,target=/tmp \
- sh /root/install_iwyu.sh
+ dnf install -y $(grep '^[^#]\+$' /root/iwyu_packages.lst)
+
+
+FROM iwyu-build-env AS iwyu-build
+LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
+# Build IWYU.
+RUN --mount=type=bind,source=build_iwyu.sh,target=/root/build_iwyu.sh \
+ --mount=type=cache,target=/root/include-what-you-use \
+ --mount=type=tmpfs,target=/tmp \
+ sh /root/build_iwyu.sh
+
+
+FROM ${BASE_IMAGE} AS p4-dl
+# Download Perforce.
+# NOTE `curl` is pre-installed in the base image.
+RUN curl -C- -L https://www.perforce.com/downloads/perforce/r21.2/bin.linux26x86_64/helix-core-server.tgz \
+ | tar -C /usr/local/bin -xvzf - -- p4 p4d
FROM ${BASE_IMAGE}
LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
-RUN --mount=type=bind,source=install_deps.sh,target=/root/install_deps.sh \
+ENV RBENV_ROOT=/opt/rbenv
+
+COPY --from=p4-dl --chown=root:root /usr/local/bin/p4 /usr/local/bin/p4d /usr/local/bin
+
+RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
+ --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/lib/dnf,target=/var/lib/dnf,sharing=private \
- --mount=type=cache,target=/var/cache/pip \
+ --mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
--mount=type=tmpfs,target=/var/log \
--mount=type=tmpfs,target=/tmp \
sh /root/install_deps.sh
+RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \
+ tar -C / -xf /root/iwyu.tar
+
+RUN --mount=type=bind,from=rust-build,source=/root,target=/root \
+ tar -C /usr/local -xf /root/rust.tar
+
RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
tar -C /usr/local -xf /root/rvm.tar
-RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \
- tar -C / -xf /root/iwyu.tar
+RUN --mount=type=bind,from=rbenv-build,source=/root,target=/root \
+ tar -C / -xf /root/rbenv.tar && rbenv global 3.1.2
diff --git a/.gitlab/ci/docker/fedora41/build_iwyu.sh b/.gitlab/ci/docker/fedora41/build_iwyu.sh
new file mode 100755
index 0000000..60d5cfd
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/build_iwyu.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -e
+
+cd
+if [ -d include-what-you-use/.git ]; then
+ cd include-what-you-use
+ git pull
+else
+ git clone https://github.com/include-what-you-use/include-what-you-use.git
+ cd include-what-you-use
+fi
+
+readonly llvm_full_version="$( clang --version | head -n1 | cut -d' ' -f3 )"
+readonly llvm_version="$( echo "$llvm_full_version" | cut -d. -f-1 )"
+git checkout "clang_$llvm_version"
+
+mkdir -p build
+cd build
+
+cmake -GNinja \
+ --fresh \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DIWYU_RESOURCE_RELATIVE_TO=clang \
+ -DIWYU_RESOURCE_DIR=../lib/clang/"$llvm_version" \
+ -DCMAKE_INSTALL_PREFIX=/usr/local/lib/llvm-"$llvm_version" \
+ ..
+
+cmake --build . --parallel
+
+DESTDIR=~/iwyu-destdir cmake --install .
+
+tar -C ~/iwyu-destdir -cf ~/iwyu.tar .
diff --git a/.gitlab/ci/docker/fedora41/build_rbenv.sh b/.gitlab/ci/docker/fedora41/build_rbenv.sh
new file mode 100755
index 0000000..3ed0033
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/build_rbenv.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+echo "gem: --no-document" > ~/.gemrc
+
+# Ruby rbenv
+export RUBY_CONFIGURE_OPTS=--disable-install-doc
+export RUBY_BUILD_CURL_OPTS=-C-
+rbenv install 3.1.2 -k -s -v
+
+cat <<EOF >/tmp/exclude.lst
+*LICENSE*
+*/doc/*
+*/man/*
+*.md
+BSDL
+CONTRIBUTING.*
+COPYING
+LEGAL
+PSFL
+README.rdoc
+History.rdoc
+gem_make.out
+test-unit-*/test
+rss-*/test
+EOF
+tar -cf /root/rbenv.tar --exclude-from=/tmp/exclude.lst ${RBENV_ROOT}
diff --git a/.gitlab/ci/docker/fedora41/build_rust.sh b/.gitlab/ci/docker/fedora41/build_rust.sh
new file mode 100755
index 0000000..f20949b
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/build_rust.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+typos_version=1.29.4
+cargo install --root /usr/local --version "$typos_version" typos-cli
+
+strip /usr/local/bin/typos
+
+tar -C /usr/local -cf /root/rust.tar bin/typos
diff --git a/.gitlab/ci/docker/fedora41/build_rvm.sh b/.gitlab/ci/docker/fedora41/build_rvm.sh
new file mode 100755
index 0000000..a62e9a7
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/build_rvm.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+set -e
+
+echo "gem: --no-document" > ~/.gemrc
+
+gpg2 --keyserver hkps://keyserver.ubuntu.com \
+ --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \
+ 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
+
+curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles
+
+export rvm_silence_banner=1
+
+# keep version in sync with `env_fedora*_makefiles.cmake`
+/usr/local/rvm/bin/rvm install ruby-3.0.4 --no-docs --disable-binary
+
+for p in archives docs examples gem-cache log src; do
+ touch /usr/local/rvm/${p}/.tar_exclude
+done
+
+cat <<EOF >/tmp/exclude.lst
+*LICENSE*
+*/doc/*
+*/man/*
+*.md
+BSDL
+CONTRIBUTING.*
+COPYING
+LEGAL
+PSFL
+README.rdoc
+History.rdoc
+gem_make.out
+test-unit-*/test
+rss-*/test
+EOF
+tar -C /usr/local \
+ --exclude-tag-under=.tar_exclude \
+ --exclude-from=/tmp/exclude.lst \
+ -cf /root/rvm.tar rvm
diff --git a/.gitlab/ci/docker/fedora41/deps_packages.lst b/.gitlab/ci/docker/fedora41/deps_packages.lst
index 9b34671..e311d51 100644
--- a/.gitlab/ci/docker/fedora41/deps_packages.lst
+++ b/.gitlab/ci/docker/fedora41/deps_packages.lst
@@ -10,7 +10,7 @@ clang-devel
clang-tools-extra
clang-tools-extra-devel
compiler-rt
-flang-19.1.0-2.fc41
+flang
gcc-c++
git-core
lfortran
@@ -24,7 +24,6 @@ jsoncpp-devel
libarchive-devel
libcurl-devel
libuv-devel
-libuv-devel
libzstd-devel
rhash-devel
xz-devel
@@ -33,17 +32,17 @@ zlib-devel
# Install documentation tools.
python3-sphinx
python3-sphinxcontrib-qthelp
-texinfo
qt5-qttools-devel
qt6-qttools-devel
+texinfo
# Install lint tools.
clang-analyzer
codespell
# Tools needed for the test suite.
-findutils
file
+findutils
jq
which
@@ -52,8 +51,8 @@ nasm
# Packages needed to test CTest.
breezy
-subversion
mercurial
+subversion
# Packages needed to test CPack.
rpm-build
@@ -61,7 +60,8 @@ rpm-build
# Packages needed to test find modules.
alsa-lib-devel
blas-devel
-boost-devel boost-python3-devel
+boost-devel
+boost-python3-devel
bzip2-devel
cups-devel
DevIL-devel
@@ -76,7 +76,8 @@ giflib-devel
glew-devel
gmock
gnutls-devel
-grpc-devel grpc-plugins
+grpc-devel
+grpc-plugins
gsl-devel
gtest-devel
gtk2-devel
@@ -91,12 +92,10 @@ lapack-devel
libarchive-devel
libcurl-devel
libicu-devel
-libinput-devel systemd-devel
+libinput-devel
libjpeg-turbo-devel
libomp-devel
libpng-devel
-opensp-devel
-postgresql-server-devel
libtiff-devel
libuv-devel
libxml2-devel
@@ -104,17 +103,31 @@ libxslt-devel
mpich-devel
openal-soft-devel
openmpi-devel
+opensp-devel
patch
perl
-protobuf-devel protobuf-c-devel protobuf-lite-devel
-pypy2 pypy2-devel
-pypy3 pypy3-devel
-python3 python3-devel python3-numpy
-python3-jsmin python3-jsonschema
-ruby rubygems ruby-devel
+postgresql-server-devel
+protobuf-c-devel
+protobuf-devel
+protobuf-lite-devel
+pypy2
+pypy2-devel
+pypy3
+pypy3-devel
+python3
+python3-devel
+python3-jsmin
+python3-jsonschema
+python3-numpy
+rbenv
+ruby
+ruby-build-rbenv
+ruby-devel
+rubygems
SDL-devel
sqlite-devel
swig
+systemd-devel
unixODBC-devel
wxGTK-devel
xalan-c-devel
diff --git a/.gitlab/ci/docker/fedora41/dnf.conf b/.gitlab/ci/docker/fedora41/dnf.conf
new file mode 100644
index 0000000..1189746
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/dnf.conf
@@ -0,0 +1,32 @@
+[main]
+autocheck_running_kernel=0
+debuglevel=2
+diskspacecheck=0
+fastestmirror=1
+gpgcheck=1
+installonly_limit=5
+install_weak_deps=0
+keepcache=1
+log_rotate=0
+max_parallel_downloads=10
+metadata_expire=90m
+multilib_policy=best
+plugins=1
+tsflags=nodocs
+
+# Enable color for all output
+color=always
+
+# Default color options according to yum.conf(5)
+color_list_installed_older=bold,black
+color_list_installed_newer=bold,yellow
+color_list_installed_reinstall=normal
+color_list_installed_extra=bold,red
+color_list_available_upgrade=bold,blue
+color_list_available_downgrade=dim,yellow
+color_list_available_install=normal
+color_list_available_reinstall =bold,underline,green
+color_search_match=bold,magenta
+color_update_installed=green
+color_update_local=cyan
+color_update_remote=yellow
diff --git a/.gitlab/ci/docker/fedora41/install_deps.sh b/.gitlab/ci/docker/fedora41/install_deps.sh
index 72d0a3f..d9c9b5c 100755
--- a/.gitlab/ci/docker/fedora41/install_deps.sh
+++ b/.gitlab/ci/docker/fedora41/install_deps.sh
@@ -2,21 +2,9 @@
set -e
-dnf install \
- --setopt=install_weak_deps=False \
- --setopt=fastestmirror=True \
- --setopt=max_parallel_downloads=10 \
- -y \
- $(grep '^[^#]\+$' /root/deps_packages.lst)
+dnf install -y $(grep '^[^#]\+$' /root/deps_packages.lst)
-# Remove tests for numpy
+# Remove tests for Python packages
for v in 3.13; do
- find /usr/lib64/python${v}/site-packages/numpy -type d -a -name tests -exec rm -rf {} +
+ find /usr/lib64/python${v}/site-packages -type d -a -name tests -exec rm -rf {} +
done
-
-# Remove some other packages tests
-find /usr/lib64/python3.13/site-packages/breezy -type d -a -name tests -exec rm -rf {} +
-
-# Perforce
-curl -L https://www.perforce.com/downloads/perforce/r21.2/bin.linux26x86_64/helix-core-server.tgz -o - \
- | tar -C /usr/local/bin -xvzf - -- p4 p4d
diff --git a/.gitlab/ci/docker/fedora41/install_iwyu.sh b/.gitlab/ci/docker/fedora41/install_iwyu.sh
deleted file mode 100755
index 718b3d0..0000000
--- a/.gitlab/ci/docker/fedora41/install_iwyu.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Install development tools.
-dnf install \
- --setopt=install_weak_deps=False \
- --setopt=fastestmirror=True \
- --setopt=max_parallel_downloads=10 \
- -y \
- $(grep '^[^#]\+$' /root/iwyu_packages.lst)
-
-cd /root
-git clone "https://github.com/include-what-you-use/include-what-you-use.git"
-cd include-what-you-use
-readonly llvm_full_version="$( clang --version | head -n1 | cut -d' ' -f3 )"
-readonly llvm_version="$( echo "$llvm_full_version" | cut -d. -f-1 )"
-git checkout "clang_$llvm_version"
-mkdir build
-cd build
-
-cmake -GNinja \
- -DCMAKE_BUILD_TYPE=Release \
- "-DIWYU_RESOURCE_RELATIVE_TO=clang" \
- "-DIWYU_RESOURCE_DIR=../lib/clang/$llvm_version" \
- "-DCMAKE_INSTALL_PREFIX=/usr/local/lib/llvm-$llvm_version" \
- ..
-ninja
-DESTDIR=/root/iwyu-destdir ninja install
-tar -C /root/iwyu-destdir -cf /root/iwyu.tar .
diff --git a/.gitlab/ci/docker/fedora41/install_rvm.sh b/.gitlab/ci/docker/fedora41/install_rvm.sh
deleted file mode 100755
index 10e7545..0000000
--- a/.gitlab/ci/docker/fedora41/install_rvm.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-set -e
-
-dnf install \
- --setopt=install_weak_deps=False \
- --setopt=fastestmirror=True \
- --setopt=max_parallel_downloads=10 \
- -y \
- $(grep '^[^#]\+$' /root/rvm_packages.lst)
-
-gpg2 --keyserver hkps://keyserver.ubuntu.com \
- --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \
- 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
-
-curl -sSL https://get.rvm.io | bash -s stable
-
-# keep version in sync with `env_fedora*_makefiles.cmake`
-/usr/local/rvm/bin/rvm install ruby-3.0.4
-
-for p in archives examples gem-cache log src; do
- touch /usr/local/rvm/${p}/.tar_exclude
-done
-
-tar -C /usr/local --exclude-tag-under=.tar_exclude -cf /root/rvm.tar rvm
diff --git a/.gitlab/ci/docker/fedora41/iwyu_packages.lst b/.gitlab/ci/docker/fedora41/iwyu_packages.lst
index e3551bd..a981836 100644
--- a/.gitlab/ci/docker/fedora41/iwyu_packages.lst
+++ b/.gitlab/ci/docker/fedora41/iwyu_packages.lst
@@ -1,7 +1,7 @@
clang-devel
-llvm-devel
-zlib-devel
-g++
cmake
-ninja-build
+gcc-c++
git
+llvm-devel
+ninja-build
+zlib-devel
diff --git a/.gitlab/ci/docker/fedora41/rbenv_packages.lst b/.gitlab/ci/docker/fedora41/rbenv_packages.lst
new file mode 100644
index 0000000..d16afff
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/rbenv_packages.lst
@@ -0,0 +1,18 @@
+rbenv
+ruby-build-rbenv
+
+# Packages needed for `rbenv`
+# https://github.com/rbenv/ruby-build/wiki#fedora
+autoconf
+bzip2
+gcc
+gdbm-devel
+libffi-devel
+libyaml-devel
+make
+ncurses-devel
+openssl-devel
+patch
+readline-devel
+rust
+zlib-devel
diff --git a/.gitlab/ci/docker/fedora41/rust_packages.lst b/.gitlab/ci/docker/fedora41/rust_packages.lst
new file mode 100644
index 0000000..1af6be6
--- /dev/null
+++ b/.gitlab/ci/docker/fedora41/rust_packages.lst
@@ -0,0 +1 @@
+rust-cargo-devel
diff --git a/.gitlab/ci/docker/gcc_cxx_modules/Dockerfile b/.gitlab/ci/docker/gcc_cxx_modules/Dockerfile
new file mode 100644
index 0000000..7f6e297
--- /dev/null
+++ b/.gitlab/ci/docker/gcc_cxx_modules/Dockerfile
@@ -0,0 +1,9 @@
+FROM fedora:41
+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
new file mode 100755
index 0000000..b8b706b
--- /dev/null
+++ b/.gitlab/ci/docker/gcc_cxx_modules/install_deps.sh
@@ -0,0 +1,7 @@
+#!/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
new file mode 100755
index 0000000..32cb9ec
--- /dev/null
+++ b/.gitlab/ci/docker/gcc_cxx_modules/install_gcc.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+readonly revision="10e702789eeabcc88451e34c2a5c7dccb96190a5" # master as of 21 Nov 2024
+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-importstd"
+make "-j$njobs"
+make "-j$njobs" install-strip
+rm -rf "$workdir"
diff --git a/.gitlab/ci/docker/hip5.5/Dockerfile b/.gitlab/ci/docker/hip5.5/Dockerfile
deleted file mode 100644
index 3a4aa53..0000000
--- a/.gitlab/ci/docker/hip5.5/Dockerfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# syntax=docker/dockerfile:1
-
-ARG BASE_IMAGE=rocm/dev-ubuntu-22.04:5.5
-
-FROM ${BASE_IMAGE} AS cuda-keyring
-ADD https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb /root/
-RUN --mount=type=tmpfs,target=/var/log \
- dpkg -i /root/cuda-keyring_1.1-1_all.deb \
- && rm /root/cuda-keyring_1.1-1_all.deb
-
-FROM cuda-keyring AS apt-cache
-# Populate APT cache w/ the fresh metadata and prefetch packages.
-# Use an empty `docker-clean` file to "hide" the image-provided
-# file to disallow removing packages after `apt-get` operations.
-RUN --mount=type=tmpfs,target=/var/log \
- --mount=type=bind,source=docker-clean,target=/etc/apt/apt.conf.d/docker-clean \
- --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
- apt-get update \
- && apt-get --download-only -y install $(grep -h '^[^#]\+$' /root/*.lst)
-
-FROM cuda-keyring
-MAINTAINER Brad King <brad.king@kitware.com>
-
-ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
-ENV NVIDIA_REQUIRE_CUDA=cuda>=11.8
-ENV NVIDIA_VISIBLE_DEVICES=all
-ENV PATH="/opt/rocm/bin:$PATH"
-
-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=bind,source=dpkg-exclude,target=/etc/dpkg/dpkg.cfg.d/exclude \
- --mount=type=bind,source=docker-clean,target=/etc/apt/apt.conf.d/docker-clean \
- --mount=type=cache,from=apt-cache,source=/var/lib/apt/lists,target=/var/lib/apt/lists \
- --mount=type=cache,from=apt-cache,source=/var/cache/apt,target=/var/cache/apt,sharing=private \
- --mount=type=tmpfs,target=/var/log \
- --mount=type=tmpfs,target=/tmp \
- sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/hip5.5/deps_packages.lst b/.gitlab/ci/docker/hip5.5/deps_packages.lst
deleted file mode 100644
index 3276055..0000000
--- a/.gitlab/ci/docker/hip5.5/deps_packages.lst
+++ /dev/null
@@ -1,21 +0,0 @@
-# Install development tools.
-g++
-curl
-git
-
-# NVIDIA CUDA Compiler
-cuda-keyring
-cuda-nvcc-11-8
-cuda-profiler-api-11-8
-
-# NVIDIA CUDA Toolkit
-# These are not needed for HIP, but having them in
-# the environment allows us to run CUDA tests too.
-cuda-nvrtc-dev-11-8
-cuda-nvtx-11-8
-libcublas-dev-11-8
-libcufft-dev-11-8
-libcurand-dev-11-8
-libcusolver-dev-11-8
-libcusparse-dev-11-8
-libnpp-dev-11-8
diff --git a/.gitlab/ci/docker/hip6.3/Dockerfile b/.gitlab/ci/docker/hip6.3/Dockerfile
new file mode 100644
index 0000000..a9f8303
--- /dev/null
+++ b/.gitlab/ci/docker/hip6.3/Dockerfile
@@ -0,0 +1,37 @@
+# syntax=docker/dockerfile:1
+
+ARG BASE_IMAGE=rocm/dev-ubuntu-24.04:6.3.2
+
+FROM ${BASE_IMAGE} AS cuda-keyring
+ADD https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb /root/
+RUN --mount=type=tmpfs,target=/var/log \
+ dpkg -i /root/cuda-keyring_1.1-1_all.deb \
+ && rm /root/cuda-keyring_1.1-1_all.deb
+
+FROM cuda-keyring AS apt-cache
+# Populate APT cache w/ the fresh metadata and prefetch packages.
+# Use an empty `docker-clean` file to "hide" the image-provided
+# file to disallow removing packages after `apt-get` operations.
+RUN --mount=type=tmpfs,target=/var/log \
+ --mount=type=bind,source=docker-clean,target=/etc/apt/apt.conf.d/docker-clean \
+ --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
+ apt-get update \
+ && apt-get --download-only -y install $(grep -h '^[^#]\+$' /root/*.lst)
+
+FROM cuda-keyring
+MAINTAINER Brad King <brad.king@kitware.com>
+
+ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
+ENV NVIDIA_REQUIRE_CUDA=cuda>=12.6
+ENV NVIDIA_VISIBLE_DEVICES=all
+ENV PATH="/opt/rocm/bin:$PATH"
+
+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=bind,source=dpkg-exclude,target=/etc/dpkg/dpkg.cfg.d/exclude \
+ --mount=type=bind,source=docker-clean,target=/etc/apt/apt.conf.d/docker-clean \
+ --mount=type=cache,from=apt-cache,source=/var/lib/apt/lists,target=/var/lib/apt/lists \
+ --mount=type=cache,from=apt-cache,source=/var/cache/apt,target=/var/cache/apt,sharing=private \
+ --mount=type=tmpfs,target=/var/log \
+ --mount=type=tmpfs,target=/tmp \
+ sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/hip6.3/deps_packages.lst b/.gitlab/ci/docker/hip6.3/deps_packages.lst
new file mode 100644
index 0000000..2ecf81e
--- /dev/null
+++ b/.gitlab/ci/docker/hip6.3/deps_packages.lst
@@ -0,0 +1,23 @@
+# Install development tools.
+g++
+curl
+git
+
+# NVIDIA CUDA Compiler
+cuda-keyring
+cuda-nvcc-12-6
+cuda-profiler-api-12-6
+
+# NVIDIA CUDA Toolkit
+# These are not needed for HIP, but having them in
+# the environment allows us to run CUDA tests too.
+cuda-nvrtc-dev-12-6
+cuda-nvtx-12-6
+cuda-opencl-dev-12-6
+libcublas-dev-12-6
+libcufft-dev-12-6
+libcurand-dev-12-6
+libcusolver-dev-12-6
+libcusparse-dev-12-6
+libnpp-dev-12-6
+libnvjitlink-dev-12-6
diff --git a/.gitlab/ci/docker/hip5.5/docker-clean b/.gitlab/ci/docker/hip6.3/docker-clean
index e69de29..e69de29 100644
--- a/.gitlab/ci/docker/hip5.5/docker-clean
+++ b/.gitlab/ci/docker/hip6.3/docker-clean
diff --git a/.gitlab/ci/docker/hip5.5/dpkg-exclude b/.gitlab/ci/docker/hip6.3/dpkg-exclude
index 60b6565..60b6565 100644
--- a/.gitlab/ci/docker/hip5.5/dpkg-exclude
+++ b/.gitlab/ci/docker/hip6.3/dpkg-exclude
diff --git a/.gitlab/ci/docker/hip5.5/install_deps.sh b/.gitlab/ci/docker/hip6.3/install_deps.sh
index d1c8aed..d1c8aed 100755
--- a/.gitlab/ci/docker/hip5.5/install_deps.sh
+++ b/.gitlab/ci/docker/hip6.3/install_deps.sh
diff --git a/.gitlab/ci/docker/nvhpc22.11/Dockerfile b/.gitlab/ci/docker/nvhpc22.11/Dockerfile
deleted file mode 100644
index 078ae37..0000000
--- a/.gitlab/ci/docker/nvhpc22.11/Dockerfile
+++ /dev/null
@@ -1,6 +0,0 @@
-# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/nvhpc/tags
-FROM kitware/nvidia-nvhpc:22.11-devel-cuda_multi-ubuntu22.04
-MAINTAINER Brad King <brad.king@kitware.com>
-
-COPY install_deps.sh /root/install_deps.sh
-RUN sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/nvhpc24.9/Dockerfile b/.gitlab/ci/docker/nvhpc24.9/Dockerfile
new file mode 100644
index 0000000..b94b14a
--- /dev/null
+++ b/.gitlab/ci/docker/nvhpc24.9/Dockerfile
@@ -0,0 +1,6 @@
+# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/nvhpc/tags
+FROM kitware/nvidia-nvhpc:24.9-devel-cuda_multi-ubuntu24.04
+MAINTAINER Brad King <brad.king@kitware.com>
+
+COPY install_deps.sh /root/install_deps.sh
+RUN sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/nvhpc22.11/install_deps.sh b/.gitlab/ci/docker/nvhpc24.9/install_deps.sh
index 51ee410..51ee410 100755
--- a/.gitlab/ci/docker/nvhpc22.11/install_deps.sh
+++ b/.gitlab/ci/docker/nvhpc24.9/install_deps.sh
diff --git a/.gitlab/ci/env_cuda12.2_nvidia_clang.sh b/.gitlab/ci/env_cuda12.2_nvidia_clang.sh
deleted file mode 100644
index 0562ab0..0000000
--- a/.gitlab/ci/env_cuda12.2_nvidia_clang.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-export CC=/usr/bin/clang-18
-export CXX=/usr/bin/clang++-18
-export CUDACXX=/usr/local/cuda/bin/nvcc
-export CUDAHOSTCXX=/usr/bin/clang++-18
-export CUDAFLAGS=--allow-unsupported-compiler
diff --git a/.gitlab/ci/env_cuda12.6_clang.sh b/.gitlab/ci/env_cuda12.6_clang.sh
new file mode 100644
index 0000000..4b71b42
--- /dev/null
+++ b/.gitlab/ci/env_cuda12.6_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_cuda12.6_nvidia_clang.sh b/.gitlab/ci/env_cuda12.6_nvidia_clang.sh
new file mode 100644
index 0000000..4bdf54c
--- /dev/null
+++ b/.gitlab/ci/env_cuda12.6_nvidia_clang.sh
@@ -0,0 +1,5 @@
+export CC=/usr/bin/clang-18
+export CXX=/usr/bin/clang++-18
+export CUDACXX=/usr/local/cuda/bin/nvcc
+export CUDAHOSTCXX=/usr/bin/clang++-18
+export CUDAFLAGS=
diff --git a/.gitlab/ci/env_hip5.5_nvidia.sh b/.gitlab/ci/env_hip5.5_nvidia.sh
deleted file mode 100644
index 67d1ef2..0000000
--- a/.gitlab/ci/env_hip5.5_nvidia.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-export HIP_PLATFORM=nvidia
-export CUDA_PATH=/usr/local/cuda-11.8
-export PATH=/usr/local/cuda-11.8/bin:$PATH
-export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64
diff --git a/.gitlab/ci/env_hip6.3_nvidia.sh b/.gitlab/ci/env_hip6.3_nvidia.sh
new file mode 100644
index 0000000..3b326cb
--- /dev/null
+++ b/.gitlab/ci/env_hip6.3_nvidia.sh
@@ -0,0 +1,4 @@
+export HIP_PLATFORM=nvidia
+export CUDA_PATH=/usr/local/cuda-12.6
+export PATH=/usr/local/cuda-12.6/bin:$PATH
+export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64
diff --git a/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1 b/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1
index ee6e46d..64e3c65 100644
--- a/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1
@@ -1,6 +1,7 @@
if ("$env:CMAKE_CI_NIGHTLY" -eq "true") {
. ".gitlab/ci/iar-env.ps1"
. ".gitlab/ci/ispc-env.ps1"
+ . ".gitlab/ci/swift-env.ps1"
}
. .gitlab/ci/ninja-env.ps1
diff --git a/.gitlab/ci/iar-env.sh b/.gitlab/ci/iar-env.sh
index 29246a1..8583c71 100644
--- a/.gitlab/ci/iar-env.sh
+++ b/.gitlab/ci/iar-env.sh
@@ -1,5 +1,5 @@
files='
-bxarm-9.50.2.deb
+bxarm-9.60.3.deb
bxavr-8.10.2.deb
bxrh850-3.10.2.deb
bxriscv-3.30.1.deb
@@ -12,7 +12,7 @@ for f in $files; do
done
echo '
-cb6a276ace472939fbb76fc5ce517149296ac2c87047b59504f9fe95aed81794 bxarm-9.50.2.deb
+b65e7e51fa61dd058d9946901ccb2d2b878973573e8d28761644d541bb93a82d bxarm-9.60.3.deb
4a1065291952a23a8bfbbaa4eb36ca49b0af8653b8faab34ce955d9d48d64506 bxavr-8.10.2.deb
b14085a0f21750c58168125d3cece2e3fcbd4c6495c652b5e65b6637bac0ac31 bxrh850-3.10.2.deb
517e18dffdd4345f97c480b5128c7feea25ec1c3f06e62d8e2e6808c401d514a bxriscv-3.30.1.deb
diff --git a/.gitlab/ci/iar.ps1 b/.gitlab/ci/iar.ps1
index d71dd0a..a372437 100644
--- a/.gitlab/ci/iar.ps1
+++ b/.gitlab/ci/iar.ps1
@@ -7,7 +7,7 @@ $outdir = "$outdir\.gitlab"
$iar_dir = New-Item -Force -ItemType Directory -Path "$outdir\iar"
$files = @{
- "bxarm-9.50.2.71951-1.zip" = "8A1C16673CEDF95DB94214159EADF06E86E66FA177149D0F379AACA88E26BC15"
+ "bxarm-9.60.3.7274-1.zip" = "AE1923440B260FD8F7AA75AB0BF15B8AC7AF9A7865C07F6B9A73F8D05DFEA7E1"
"BXAVR-8102-1.zip" = "862EFD23531854506070D5647F9B32197B80E5A727304BFBD8E386A3DAADF093"
"BXRH850-3102-1.zip" = "8D1D009A0D138C7CA8431316123CB85CE1B41319A68B997F90D2E338CD469C7F"
"BXRISCV-3301-1.zip" = "59FF23F7B98EE72567A23942DE799AF137791A19BFEC102B2A59821FABBCA55A"
diff --git a/.gitlab/ci/package_windows_build.cmake b/.gitlab/ci/package_windows_build.cmake
index b881e21..a2b7ed4 100644
--- a/.gitlab/ci/package_windows_build.cmake
+++ b/.gitlab/ci/package_windows_build.cmake
@@ -4,8 +4,9 @@ include(build/ci_package_info.cmake)
set(build "${CMAKE_CURRENT_BINARY_DIR}/build")
file(GLOB paths RELATIVE "${CMAKE_CURRENT_BINARY_DIR}"
- # Allow CPack to find CMAKE_ROOT.
+ # Allow CPack to find CMAKE_ROOT and license text.
"${build}/CMakeFiles/CMakeSourceDir.txt"
+ "${build}/CMakeFiles/LICENSE.txt"
# We need the main binaries.
"${build}/bin"
diff --git a/.gitlab/ci/repackage/iar.ps1 b/.gitlab/ci/repackage/iar.ps1
index bb8bb04..5a8c1e5 100644
--- a/.gitlab/ci/repackage/iar.ps1
+++ b/.gitlab/ci/repackage/iar.ps1
@@ -18,12 +18,23 @@ $installer_file = Get-Item $installer
$installer_name = $installer_file.Name
$package_name = $installer_file.Basename + "-" + $revision
$package_dir = "$basedir\$package_name"
-
+$exclude = @(
+ "arm/config/debugger"
+ "arm/config/flashloader"
+ "arm/drivers"
+ "arm/src"
+ )
Write-Host "Installing to: $package_dir"
Start-Process -Wait -FilePath "$installer_file" -ArgumentList "/hide_usd /autoinstall/$package_dir"
+foreach ($p in $exclude) {
+ Remove-Item "$package_dir/$p" -Recurse -Force
+}
+
@"
-This was repackaged from an installation by "$installer_name".
+This was repackaged from an installation by "$installer_name"
+using CMake's ".gitlab/ci/repackage/iar.ps1" script.
+
Obtain a network license as follows:
set IAR_LMS_SETTINGS_DIR=%cd%\license
diff --git a/.gitlab/ci/typos.bash b/.gitlab/ci/typos.bash
new file mode 100755
index 0000000..4c92383
--- /dev/null
+++ b/.gitlab/ci/typos.bash
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+result=0
+
+echo "Running 'typos' on source code..."
+typos || result=1
+
+cfg='.typos.toml'
+tmp_cfg="${TEMP:-/tmp}/$cfg"
+# Uncomment `extend-ignore-identifiers-re` in the top-level config file
+# to make Git hashes (possibly used in commit messages) valid "identifiers".
+sed 's/^#\s*\(extend-ignore-identifiers-re\)/\1/' "$cfg" >"$tmp_cfg"
+
+if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
+ for COMMIT in $(git rev-list "^$CI_MERGE_REQUEST_DIFF_BASE_SHA" "$CI_COMMIT_SHA"); do
+ echo "Running 'typos' on commit message of $COMMIT..."
+ git show --format=%B -s "$COMMIT" | typos -c "$tmp_cfg" - || result=1
+ done
+fi
+
+exit $result
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index e9d8ed9..71603e1 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -30,6 +30,24 @@
variables:
BOOTSTRAP_ARGS: '-- "-DCMake_DOC_ARTIFACT_PREFIX=$CI_PROJECT_DIR/build/install-doc"'
+.sunos_release_x86_64:
+ image: "kitware/cmake:build-sunos-x86_64-deps-2025-02-27"
+
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+ CMAKE_ARCH: x86_64
+
+.sunos_release_sparc64:
+ image: "kitware/cmake:build-sunos-sparc64-deps-2025-02-27"
+
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+ CMAKE_ARCH: sparc64
+
+.sunos_package:
+ variables:
+ CMake_DOC_ARTIFACT_PREFIX: "$CI_PROJECT_DIR/build/install-doc"
+
.needs_centos7_x86_64:
needs:
- b:centos7-x86_64
@@ -41,7 +59,7 @@
### Debian
.debian12:
- image: "kitware/cmake:ci-debian12-x86_64-2024-08-27"
+ image: "kitware/cmake:ci-debian12-x86_64-2025-01-23"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -65,14 +83,14 @@
### Fedora
.fedora41:
- image: "kitware/cmake:ci-fedora41-x86_64-2024-11-11"
+ image: "kitware/cmake:ci-fedora41-x86_64-2025-02-03"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
CMAKE_ARCH: x86_64
.fedora41_hip:
- image: "kitware/cmake:ci-fedora41-hip-x86_64-2024-12-02"
+ image: "kitware/cmake:ci-fedora41-hip-x86_64-2025-02-03"
variables:
# FIXME(rocclr): device modules fail loading from binaries in paths with spaces
@@ -307,7 +325,7 @@
### NVHPC Compiler
.nvhpc:
- image: "kitware/cmake:ci-nvhpc22.11-x86_64-2022-12-06"
+ image: "kitware/cmake:ci-nvhpc24.9-x86_64-2024-09-27"
variables:
CMAKE_ARCH: x86_64
@@ -402,33 +420,53 @@
CMAKE_CONFIGURATION: cuda12.2_nvidia
CTEST_NO_WARNINGS_ALLOWED: 1
-.cuda12.2_nvidia_clang:
+.cuda12.2_clang:
extends: .cuda12.2
variables:
- CMAKE_CONFIGURATION: cuda12.2_nvidia_clang
+ CMAKE_CONFIGURATION: cuda12.2_clang
CTEST_NO_WARNINGS_ALLOWED: 1
-.cuda12.2_clang:
- extends: .cuda12.2
+.cuda12.6:
+ extends: .cuda
+ image: "kitware/cmake:ci-cuda12.6-x86_64-2025-01-30"
variables:
- CMAKE_CONFIGURATION: cuda12.2_clang
+ CMAKE_ARCH: x86_64
+
+.cuda12.6_nvidia:
+ extends: .cuda12.6
+ variables:
+ CMAKE_CONFIGURATION: cuda12.6_nvidia
+ CTEST_NO_WARNINGS_ALLOWED: 1
+
+.cuda12.6_nvidia_clang:
+ extends: .cuda12.6
+ variables:
+ CMAKE_CONFIGURATION: cuda12.6_nvidia_clang
+ CTEST_NO_WARNINGS_ALLOWED: 1
+
+.cuda12.6_clang:
+ extends: .cuda12.6
+ variables:
+ CMAKE_CONFIGURATION: cuda12.6_clang
CTEST_NO_WARNINGS_ALLOWED: 1
### HIP builds
-.hip5.5:
- image: "kitware/cmake:ci-hip5.5-x86_64-2023-09-18"
+.hip6.3:
+ image: "kitware/cmake:ci-hip6.3-x86_64-2025-02-14"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
CMAKE_ARCH: x86_64
CTEST_LABELS: "HIP"
-.hip5.5_radeon:
- extends: .hip5.5
+.hip6.3_radeon:
+ extends: .hip6.3
variables:
- CMAKE_CONFIGURATION: hip5.5_radeon
+ # FIXME(rocclr): device modules fail loading from binaries in paths with spaces
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake-ci"
+ CMAKE_CONFIGURATION: hip6.3_radeon
CMAKE_GENERATOR: "Ninja Multi-Config"
.debian12_hip_radeon:
@@ -445,13 +483,37 @@
CMAKE_CONFIGURATION: fedora41_hip_radeon
CTEST_LABELS: "HIP"
-.hip5.5_nvidia:
- extends: .hip5.5
+.hip6.3_nvidia:
+ extends: .hip6.3
variables:
- CMAKE_CONFIGURATION: hip5.5_nvidia
+ CMAKE_CONFIGURATION: hip6.3_nvidia
CTEST_LABELS: "HIP"
+### C++ modules
+
+.gcc_cxx_modules_x86_64:
+ image: "kitware/cmake:ci-gcc_cxx_modules-x86_64-2024-12-23"
+
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+ CMAKE_ARCH: x86_64
+ CC: "/opt/gcc-importstd/bin/gcc"
+ CXX: "/opt/gcc-importstd/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:
@@ -556,11 +618,19 @@
interruptible: true
-.cmake_codespell_linux:
+.cmake_version_update_linux:
+ stage: build
+ extends: .fedora41
+ script:
+ - .gitlab/ci/cmake_version_update.sh
+ interruptible: false # The job internally fetches and retries.
+
+.cmake_spellcheck_linux:
stage: build
extends: .fedora41
script:
- - .gitlab/ci/codespell.sh
+ - .gitlab/ci/codespell.bash
+ - .gitlab/ci/typos.bash
interruptible: true
.cmake_build_linux:
@@ -696,6 +766,33 @@
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
+.cmake_build_sunos_release:
+ stage: build
+
+ script:
+ - *before_script_linux
+ # SunOS sysroot
+ - Utilities/Release/sunos/docker/sysroot.bash $CMAKE_ARCH
+ # Initial cache
+ - mkdir -p build/
+ - cp Utilities/Release/sunos/$CMAKE_ARCH/cache.txt build/CMakeCache.txt
+ # Make sccache available.
+ - source .gitlab/ci/sccache-env.sh
+ - echo "CMAKE_C_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
+ - echo "CMAKE_CXX_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
+ # Build
+ - cd build/
+ - cmake .. -GNinja
+ -DCMAKE_DOC_DIR=doc/cmake
+ -DCMake_DOC_ARTIFACT_PREFIX="$CMake_DOC_ARTIFACT_PREFIX"
+ -DCMAKE_TOOLCHAIN_FILE="$CI_PROJECT_DIR/Utilities/Release/sunos/$CMAKE_ARCH/toolchain.cmake"
+ - ninja
+ # Package
+ - cpack -G "TGZ;STGZ"
+ - sccache --show-stats
+
+ interruptible: true
+
### Documentation
.cmake_org_help:
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 629d87e..66ee593 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -7,7 +7,7 @@
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
# TODO: Factor this out so that each job selects the Xcode version to
# use so that different versions can be tested in a single pipeline.
- DEVELOPER_DIR: "/Applications/Xcode-16.2.app/Contents/Developer"
+ DEVELOPER_DIR: "/Applications/Xcode-16.4.app/Contents/Developer"
# Avoid conflicting with other projects running on the same machine.
SCCACHE_SERVER_PORT: 4227
@@ -29,6 +29,7 @@
variables:
CMAKE_CONFIGURATION: macos_x86_64_ninja
+ CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
.macos_arm64_ninja:
@@ -36,6 +37,7 @@
variables:
CMAKE_CONFIGURATION: macos_arm64_ninja
+ CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
.macos_arm64_ninja_symlinked:
@@ -142,7 +144,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-x86_64
- shell
- - xcode-16.2
+ - xcode-16.4
- nonconcurrent
.macos_x86_64_tags_ext:
@@ -150,7 +152,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-x86_64
- shell
- - xcode-16.2
+ - xcode-16.4
- concurrent
.macos_arm64_tags:
@@ -158,7 +160,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-16.2
+ - xcode-16.4
- nonconcurrent
.macos_arm64_tags_ext:
@@ -166,7 +168,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-16.2
+ - xcode-16.4
- concurrent
.macos_arm64_tags_package:
@@ -174,7 +176,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-16.2
+ - xcode-16.4
- nonconcurrent
- finder
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 06785b0..ed4bf7d 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -26,7 +26,7 @@
variables:
# Debug and RelWithDebinfo build types use the `/Zi` which results in
- # uncacheable compiations.
+ # uncacheable compilations.
# https://github.com/mozilla/sccache/issues/242
CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 0402d33..c7102f9 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -2,7 +2,7 @@
.run_manually:
rules:
- - if: '$CMAKE_CI_PACKAGE != null'
+ - if: '$CMAKE_CI_PACKAGE != null || $CMAKE_CI_VERSION_UPDATE != null'
when: never
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
when: never
@@ -25,7 +25,7 @@
.run_automatically:
rules:
- - if: '$CMAKE_CI_PACKAGE != null'
+ - if: '$CMAKE_CI_PACKAGE != null || $CMAKE_CI_VERSION_UPDATE != null'
when: never
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
when: never
@@ -48,7 +48,7 @@
.run_dependent:
rules:
- - if: '$CMAKE_CI_PACKAGE != null'
+ - if: '$CMAKE_CI_PACKAGE != null || $CMAKE_CI_VERSION_UPDATE != null'
when: never
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
when: never
@@ -86,6 +86,8 @@
.run_cmake_org_help:
rules:
+ - if: '$CMAKE_CI_VERSION_UPDATE != null'
+ when: never
- if: '$CMAKE_CI_PACKAGE =~ /v[0-9]+\.[0-9]+/'
variables:
RSYNC_DESTINATION: "kitware@cmake.org:$CMAKE_CI_PACKAGE/"
@@ -105,3 +107,9 @@
CMAKE_CI_VERSION_NO_GIT: "OFF"
when: on_success
- when: never
+
+.run_version_update:
+ rules:
+ - if: '$CMAKE_CI_VERSION_UPDATE != null'
+ when: on_success
+ - when: never
diff --git a/.hooks-config b/.hooks-config
index 064371c..320bf4c 100644
--- a/.hooks-config
+++ b/.hooks-config
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Loaded by .git/hooks/(pre-commit|commit-msg|prepare-commit-msg)
# during git commit after local hooks have been installed.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..fccc0be
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,146 @@
+# Read the docs here: https://pre-commit.com
+# List of some available hooks: https://pre-commit.com/hooks.html
+#
+# Install `pre-commit`:
+#
+# $ pip install pre-commit
+#
+# Install hooks to your clone:
+# $ pre-commit install
+#
+
+default_stages: [pre-commit]
+default_install_hook_types: [commit-msg, pre-commit]
+fail_fast: false
+# NOTE Exclude third-party sources and some files globally.
+# See `Utilities/Scripts/update-*.bash` scripts and
+# https://pre-commit.com/#regular-expressions
+exclude: >-
+ (?x)Auxiliary/vim
+ | Licenses/.*\.txt$
+ | Source/(CursesDialog/form|kwsys)
+ | Utilities/(cm.*|GitSetup|KWIML)
+ | .*\.patch$
+
+repos:
+ - repo: meta
+ hooks:
+ - id: check-hooks-apply
+ - id: check-useless-excludes
+
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-json
+ # NOTE Some tests have intentionally broken JSONs.
+ exclude: >-
+ (?x)Tests/(
+ CMakeLib/testCTestResourceSpec_data/spec13
+ | RunCMake/CTestResourceAllocation/invalid
+ )\.json
+ - id: check-yaml
+ - id: end-of-file-fixer
+ # NOTE Exclude tests directory: some test files have no
+ # the trailing EOL in the file intentionally but some
+ # just missed it.
+ # TODO Add the missed trailing EOL in the following files
+ # if possible.
+ exclude: >-
+ (?x)Tests/(
+ DelphiCoverage/src/UTCovTest\.pas
+ | FortranModules/in_interface/module\.f90
+ | JavascriptCoverage/output\.json\.in
+ | Module/ExternalData/Alt/(
+ MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3
+ | SHA1/85158f0c1996837976e858c42a9a7634bfe91b93
+ )
+ | RunCMake/(
+ CMP0055/CMP0055-(NEW|OLD)-Reject-Arguments\.cmake
+ | CommandLine/E_cat_good_binary_cat-stdout\.txt
+ | define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_[12]-result\.txt
+ | FindMatlab/MatlabTest2-stderr\.txt
+ | string/UTF-(16|32)LE\.txt
+ | Syntax/BOM-UTF-(16|32)-LE.cmake
+ | Syntax/CommandEOF\.cmake
+ | VS10Project/shader2?\.hlsl
+ )
+ | SourceGroups/README\.txt
+ | StringFileTest/test\.utf8
+ | VSWindowsFormsResx/WindowsFormsResx/MyForm\.resx
+ | VSXaml/Package\.appxmanifest
+ )
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+
+ - repo: https://github.com/jumanjihouse/pre-commit-hooks
+ rev: 3.0.0
+ hooks:
+ - id: git-check
+ pass_filenames: false
+
+ - repo: https://github.com/sphinx-contrib/sphinx-lint
+ rev: v1.0.0
+ hooks:
+ - id: sphinx-lint
+ # NOTE Looks like `bad-dedent` gives too many false-positives.
+ args: ['--disable', 'bad-dedent']
+
+ - repo: https://github.com/pre-commit/pygrep-hooks
+ rev: v1.10.0
+ hooks:
+ - id: rst-backticks
+ # NOTE The `productionlist` directive can give false-positives
+ exclude: >-
+ (?x)Help/(
+ dev/maint\.rst
+ | manual/cmake-(developer|language)\.7\.rst
+ | variable/CMAKE_MESSAGE_CONTEXT\.rst
+ )
+ | Tests/CMakeLib/testRST\.rst
+ - id: rst-directive-colons
+ - id: rst-inline-touching-normal
+
+ - repo: https://github.com/codespell-project/codespell
+ rev: v2.4.0
+ hooks:
+ - id: codespell
+ stages: [commit-msg, pre-commit]
+
+ - repo: https://github.com/crate-ci/typos
+ rev: v1.29.4
+ hooks:
+ - id: typos
+ # NOTE Override hook's default args to prevent automatic
+ # fixing of found typos. Let the dev decide what to fix!
+ args: ['--force-exclude']
+ stages: [commit-msg, pre-commit]
+
+ - repo: https://github.com/pre-commit/mirrors-clang-format
+ # ATTENTION CMake's `clang-format` is version 18.
+ # DO NOT UPDATE THIS VERSION unless officially supported
+ # `clang-format` get bumped.
+ rev: v18.1.8
+ hooks:
+ - id: clang-format
+ types_or: [c, c++, cuda]
+ exclude_types: [objective-c++]
+ # The following exclude list based on the output of:
+ # $ git ls-files | git check-attr --stdin format.clang-format | grep ...
+ # and
+ # $ find -name .gitattributes -exec grep -Hn clang-format {} +
+ exclude: >-
+ (?x)(
+ Source/LexerParser
+ | Tests/(
+ CSharpLinkFromCxx/UsefulManagedCppClass.*
+ | CompileFeatures/cxx_right_angle_brackets\.cpp
+ | PositionIndependentTargets/pic_test\.h
+ | RunCMake/(
+ CommandLine/cmake_depends/test_UTF-16LE\.h
+ | CXXModules/examples/circular/circular-[ab]\.cppm
+ | GenerateExportHeader/reference
+ )
+ | VSWinStorePhone/Direct3DApp1/Direct3DApp1\.cpp
+ )
+ )
diff --git a/.typos.toml b/.typos.toml
new file mode 100644
index 0000000..70608b8
--- /dev/null
+++ b/.typos.toml
@@ -0,0 +1,72 @@
+# The manual about all configuration options is here:
+# https://github.com/crate-ci/typos/blob/master/docs/reference.md
+
+[default]
+check-file = true
+check-filename = true
+extend-ignore-re = [
+ # NOTE Allow to mark a block of text to exclude from spellchecking
+ "(?s)(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)off.*?\\n\\s*(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)on"
+ # NOTE Allow to mark a line to exclude from spellchecking
+ , "(?Rm)^.*(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)disable-line$"
+ ]
+locale = "en-us"
+# ATTENTION If, for any reason, you want to add the
+# `extend-ignore-identifiers-re` to this section,
+# please also modify the `.gitlab/ci/typos.bash`
+# script accordingly.
+#extend-ignore-identifiers-re=["\\b[0-9a-f]{10}\\b"]
+
+# Add repo-wide false positives here in the form of `word = "word"`.
+# Check the manual for details.
+[default.extend-words]
+HPE = "HPE"
+# British spelling of `XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` property name.
+BEHAVIOUR = "BEHAVIOUR"
+# Misspelled `Fortran_BUILDING_INSTRINSIC_MODULES` property name kept for compatibility: `INSTRINSIC` should be `INTRINSIC`.
+INSTRINSIC = "INSTRINSIC"
+# This is a file extension for `cobertura-merge`
+ser = "ser"
+# The Ninja option name
+restat = "restat"
+# SpectreMitigation
+Spectre = "Spectre"
+
+[type.cmake.extend-identifiers]
+COMMANDs = "COMMANDs"
+xCOMMANDx = "xCOMMANDx"
+
+[type.cmake.extend-words]
+# Some compiler's options trigger false-positives
+Fo = "Fo"
+ot = "ot"
+# Part of compiler executable name, e.g., `arm-unknown-nto-qnx6`, but also could be in a literal string.
+nto = "nto"
+
+[type.cpp.extend-identifiers]
+APPENDed = "APPENDed"
+
+[type.json.extend-identifiers]
+# Some compiler options from `Templates/MSBuild/FlagTables/*.json` trigger too many false-positives.
+Fo = "Fo"
+fo = "fo"
+Ot = "Ot"
+SEH = "SEH"
+
+[files]
+ignore-hidden = false
+ignore-dot = false
+extend-exclude = [
+ "CONTRIBUTORS.rst"
+ # Exclude third-party sources.
+ , "Source/CursesDialog/form/"
+ , "Source/kwsys/"
+ , "Source/bindexplib.cxx"
+ , "Source/cmcldeps.cxx"
+ , "Source/QtDialog/*.ui"
+ , "Utilities/cm*"
+ , "Utilities/ClangTidyModule"
+ , "Utilities/KWIML"
+ # FIXME: Fix spelling typos in tests. Exclude for now.
+ , "Tests"
+ ]
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 35af733..7cfb2ba 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -3,7 +3,7 @@
;; Package-Requires: ((emacs "24.1"))
; Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-; file Copyright.txt or https://cmake.org/licensing for details.
+; file LICENSE.rst or https://cmake.org/licensing for details.
;------------------------------------------------------------------------------
@@ -182,14 +182,14 @@ set the path with these commands:
)
)
-(defun cmake-point-in-indendation ()
+(defun cmake-point-in-indentation ()
(string-match "^[ \\t]*$" (buffer-substring (line-beginning-position) (point))))
(defun cmake-indent-line-to (column)
"Indent the current line to COLUMN.
If point is within the existing indentation it is moved to the end of
the indentation. Otherwise it retains the same position on the line"
- (if (cmake-point-in-indendation)
+ (if (cmake-point-in-indentation)
(indent-line-to column)
(save-excursion (indent-line-to column))))
diff --git a/Auxiliary/cmake.m4 b/Auxiliary/cmake.m4
index 39826bc..205b0e4 100644
--- a/Auxiliary/cmake.m4
+++ b/Auxiliary/cmake.m4
@@ -1,5 +1,5 @@
dnl Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-dnl file Copyright.txt or https://cmake.org/licensing for details.
+dnl file LICENSE.rst or https://cmake.org/licensing for details.
AC_DEFUN([CMAKE_FIND_BINARY],
[AC_ARG_VAR([CMAKE_BINARY], [path to the cmake binary])dnl
diff --git a/Auxiliary/vim/.gitattributes b/Auxiliary/vim/.gitattributes
new file mode 100644
index 0000000..c40dd66
--- /dev/null
+++ b/Auxiliary/vim/.gitattributes
@@ -0,0 +1 @@
+extract-upper-case.pl tab-indent
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index d09bbfc..64e18e8 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -155,6 +155,7 @@ syn keyword cmakeProperty contained
\ C_STANDARD_REQUIRED
\ DEBUG_CONFIGURATIONS
\ DEBUG_POSTFIX
+ \ DEBUGGER_WORKING_DIRECTORY
\ DEFINE_SYMBOL
\ DEFINITIONS
\ DEPENDS
@@ -194,7 +195,7 @@ syn keyword cmakeProperty contained
\ FOLDER
\ FRAMEWORK
\ FRAMEWORK_VERSION
- \ Fortran_BUILDING_INSTRINSIC_MODULES
+ \ Fortran_BUILDING_INTRINSIC_MODULES
\ Fortran_FORMAT
\ Fortran_MODULE_DIRECTORY
\ Fortran_PREPROCESS
@@ -304,6 +305,7 @@ syn keyword cmakeProperty contained
\ MEASUREMENT
\ MODIFIED
\ MSVC_DEBUG_INFORMATION_FORMAT
+ \ MSVC_RUNTIME_CHECKS
\ MSVC_RUNTIME_LIBRARY
\ NAME
\ NO_SONAME
@@ -482,13 +484,12 @@ syn keyword cmakeProperty contained
\ XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
\ XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
\ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
- \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
\ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
\ XCODE_SCHEME_ENVIRONMENT
\ XCODE_SCHEME_EXECUTABLE
\ XCODE_SCHEME_GUARD_MALLOC
- \ XCODE_SCHEME_LAUNCH_CONFIGURATION
\ XCODE_SCHEME_LAUNCH_MODE
+ \ XCODE_SCHEME_LLDB_INIT_FILE
\ XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
\ XCODE_SCHEME_MALLOC_GUARD_EDGES
\ XCODE_SCHEME_MALLOC_SCRIBBLE
@@ -500,6 +501,7 @@ syn keyword cmakeProperty contained
\ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
\ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
\ XCODE_SCHEME_LAUNCH_CONFIGURATION
+ \ XCODE_SCHEME_TEST_CONFIGURATION
\ XCODE_SCHEME_WORKING_DIRECTORY
\ XCODE_SCHEME_ZOMBIE_OBJECTS
\ XCODE_XCCONFIG
@@ -1140,6 +1142,7 @@ syn keyword cmakeVariable contained
\ CMAKE_C_VISIBILITY_PRESET
\ CMAKE_DEBUG_POSTFIX
\ CMAKE_DEBUG_TARGET_PROPERTIES
+ \ CMAKE_DEBUGGER_WORKING_DIRECTORY
\ CMAKE_DEFAULT_BUILD_TYPE
\ CMAKE_DEFAULT_CONFIGS
\ CMAKE_DEPENDS_IN_PROJECT_ONLY
@@ -1178,6 +1181,7 @@ syn keyword cmakeVariable contained
\ CMAKE_EXE_LINKER_FLAGS
\ CMAKE_EXE_LINKER_FLAGS_INIT
\ CMAKE_EXPORT_COMPILE_COMMANDS
+ \ CMAKE_EXPORT_SARIF
\ CMAKE_EXPORT_NO_PACKAGE_REGISTRY
\ CMAKE_EXPORT_PACKAGE_REGISTRY
\ CMAKE_EXTRA_GENERATOR
@@ -1530,6 +1534,7 @@ syn keyword cmakeVariable contained
\ CMAKE_MODULE_PATH
\ CMAKE_MSVCIDE_RUN_PATH
\ CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
+ \ CMAKE_MSVC_RUNTIME_CHECKS
\ CMAKE_MSVC_RUNTIME_LIBRARY
\ CMAKE_NETRC
\ CMAKE_NETRC_FILE
@@ -1848,12 +1853,11 @@ syn keyword cmakeVariable contained
\ CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
\ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
\ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
- \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
\ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
\ CMAKE_XCODE_SCHEME_ENVIRONMENT
\ CMAKE_XCODE_SCHEME_GUARD_MALLOC
- \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION
\ CMAKE_XCODE_SCHEME_LAUNCH_MODE
+ \ CMAKE_XCODE_SCHEME_LLDB_INIT_FILE
\ CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
\ CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES
\ CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE
@@ -1865,6 +1869,7 @@ syn keyword cmakeVariable contained
\ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
\ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
\ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION
+ \ CMAKE_XCODE_SCHEME_TEST_CONFIGURATION
\ CMAKE_XCODE_SCHEME_WORKING_DIRECTORY
\ CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS
\ CMAKE_XCODE_XCCONFIG
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index a0c0e54..97668d3 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
option(CMAKE_INSTALL_DEBUG_LIBRARIES
"Install Microsoft runtime debug libraries with CMake." FALSE)
@@ -14,10 +14,14 @@ if(CMake_INSTALL_DEPENDENCIES)
include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
endif()
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LICENSE.txt")
+file(READ "${CMake_LICENSE_FILE}" license_text)
+string(REPLACE "`Contributors <CONTRIBUTORS.rst>`_" "Contributors" license_text "${license_text}")
+file(WRITE "${CPACK_RESOURCE_FILE_LICENSE}" "${license_text}")
+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
set(CPACK_PACKAGE_VENDOR "Kitware")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CPACK_RESOURCE_FILE_LICENSE}")
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79a562c..907c344 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.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-cmake_minimum_required(VERSION 3.13...3.29 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.30 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)
@@ -196,18 +196,18 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
endif()
option(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" "${CMAKE_USE_SYSTEM_LIBRARY_CURL}")
option(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}")
- CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
+ cmake_dependent_option(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
"${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
- CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
+ cmake_dependent_option(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
"${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
- CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZSTD "Use system-installed zstd"
+ cmake_dependent_option(CMAKE_USE_SYSTEM_ZSTD "Use system-installed zstd"
"${CMAKE_USE_SYSTEM_LIBRARY_ZSTD}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
- CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
+ cmake_dependent_option(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
"${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
- CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_NGHTTP2 "Use system-installed nghttp2"
+ cmake_dependent_option(CMAKE_USE_SYSTEM_NGHTTP2 "Use system-installed nghttp2"
"${CMAKE_USE_SYSTEM_LIBRARY_NGHTTP2}" "NOT CMAKE_USE_SYSTEM_CURL" ON)
option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
- CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp"
+ cmake_dependent_option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp"
"${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}" "NOT CMAKE_USE_SYSTEM_CPPDAP" ON)
option(CMAKE_USE_SYSTEM_LIBRHASH "Use system-installed librhash" "${CMAKE_USE_SYSTEM_LIBRARY_LIBRHASH}")
option(CMAKE_USE_SYSTEM_LIBUV "Use system-installed libuv" "${CMAKE_USE_SYSTEM_LIBRARY_LIBUV}")
@@ -325,8 +325,8 @@ if(CMake_RUN_CLANG_TIDY)
unset(clang_tidy_module_sha1)
endif()
+ configure_file(.clang-tidy .clang-tidy COPYONLY)
endif()
-configure_file(.clang-tidy .clang-tidy COPYONLY)
option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF)
@@ -386,6 +386,7 @@ endif()
# The main section of the CMakeLists file
#
#-----------------------------------------------------------------------
+include(Source/CMakeCopyright.cmake)
include(Source/CMakeVersion.cmake)
include(CTest)
@@ -414,8 +415,8 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE 1)
else()
include(CheckSymbolExists)
- CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
- CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
+ check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV)
+ check_symbol_exists(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
endif()
endif()
@@ -533,7 +534,10 @@ endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
# Install license file as it requires.
- install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
+ install(FILES
+ "${CMake_LICENSE_FILE}"
+ "${CMake_SOURCE_DIR}/CONTRIBUTORS.rst"
+ DESTINATION ${CMAKE_DOC_DIR})
# Install script directories.
install(
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 88f39f1..7247467 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -74,6 +74,6 @@ License
We do not require any formal copyright assignment or contributor license
agreement. Any contributions intentionally sent upstream are presumed
to be offered under terms of the OSI-approved BSD 3-clause License.
-See `Copyright.txt`_ for details.
+See `LICENSE.rst`_ for details.
-.. _`Copyright.txt`: Copyright.txt
+.. _`LICENSE.rst`: LICENSE.rst
diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst
new file mode 100644
index 0000000..76cd4ba
--- /dev/null
+++ b/CONTRIBUTORS.rst
@@ -0,0 +1,100 @@
+Contributors
+************
+
+The following individuals and institutions are among the contributors:
+
+* `Aaron C. Meadows <mailto:cmake@shadowguarddev.com>`_
+* `Adriaan de Groot <mailto:groot@kde.org>`_
+* `Aleksey Avdeev <mailto:solo@altlinux.ru>`_
+* `Alexander Neundorf <mailto:neundorf@kde.org>`_
+* `Alexander Smorkalov <mailto:alexander.smorkalov@itseez.com>`_
+* `Alexey Sokolov <mailto:sokolov@google.com>`_
+* `Alex Merry <mailto:alex.merry@kde.org>`_
+* `Alex Turbov <mailto:i.zaufi@gmail.com>`_
+* `Andreas Pakulat <mailto:apaku@gmx.de>`_
+* `Andreas Schneider <mailto:asn@cryptomilk.org>`_
+* `André Rigland Brodtkorb <mailto:Andre.Brodtkorb@ifi.uio.no>`_
+* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
+* Benjamin Eikel
+* `Bjoern Ricks <mailto:bjoern.ricks@gmail.com>`_
+* `Brad Hards <mailto:bradh@kde.org>`_
+* Christopher Harvey
+* `Christoph Grüninger <mailto:foss@grueninger.de>`_
+* `Clement Creusot <mailto:creusot@cs.york.ac.uk>`_
+* `Daniel Blezek <mailto:blezek@gmail.com>`_
+* `Daniel Pfeifer <mailto:daniel@pfeifer-mail.de>`_
+* `Dawid Wróbel <mailto:me@dawidwrobel.com>`_
+* `Enrico Scholz <mailto:enrico.scholz@informatik.tu-chemnitz.de>`_
+* `Eran Ifrah <mailto:eran.ifrah@gmail.com>`_
+* Esben Mose Hansen, Ange Optimization ApS
+* `Geoffrey Viola <mailto:geoffrey.viola@asirobots.com>`_
+* `Google Inc <https://www.google.com/>`_
+* Gregor Jasny
+* `Helio Chissini de Castro <mailto:helio@kde.org>`_
+* `Ilya Lavrenov <mailto:ilya.lavrenov@itseez.com>`_
+* `Insight Software Consortium <https://insightsoftwareconsortium.org/>`_
+* `Intel Corporation <https://www.intel.com/>`_
+* Jan Woetzel
+* `Jordan Williams <mailto:jordan@jwillikers.com>`_
+* Julien Schueller
+* `Kelly Thompson <mailto:kgt@lanl.gov>`_
+* `Konstantin Podsvirov <mailto:konstantin@podsvirov.su>`_
+* `Laurent Montel <mailto:montel@kde.org>`_
+* `Mario Bensi <mailto:mbensi@ipsquad.net>`_
+* `Martin Gräßlin <mailto:mgraesslin@kde.org>`_
+* `Mathieu Malaterre <mailto:mathieu.malaterre@gmail.com>`_
+* Matthaeus G. Chajdas
+* `Matthias Kretz <mailto:kretz@kde.org>`_
+* `Matthias Maennich <mailto:matthias@maennich.net>`_
+* `Michael Hirsch, Ph.D. <https://www.scivision.dev/>`_
+* Michael Stürmer
+* Miguel A. Figueroa-Villanueva
+* `Mike Durso <mailto:rbprogrammer@gmail.com>`_
+* Mike Jackson
+* `Mike McQuaid <mailto:mike@mikemcquaid.com>`_
+* `Nicolas Bock <mailto:nicolasbock@gmail.com>`_
+* `Nicolas Despres <mailto:nicolas.despres@gmail.com>`_
+* `Nikita Krupen'ko <mailto:krnekit@gmail.com>`_
+* `NVIDIA Corporation <https://www.nvidia.com/>`_
+* `OpenGamma Ltd. <https://opengamma.com/>`_
+* `Patrick Stotko <mailto:stotko@cs.uni-bonn.de>`_
+* `Per Øyvind Karlsen <mailto:peroyvind@mandriva.org>`_
+* `Peter Collingbourne <mailto:peter@pcc.me.uk>`_
+* `Petr Gotthard <mailto:gotthard@honeywell.com>`_
+* `Philip Lowman <mailto:philip@yhbt.com>`_
+* `Philippe Proulx <mailto:pproulx@efficios.com>`_
+* Raffi Enficiaud, Max Planck Society
+* Raumfeld
+* `Roger Leigh <mailto:rleigh@codelibre.net>`_
+* `Rolf Eike Beer <mailto:eike@sf-mail.de>`_
+* `Roman Donchenko <mailto:roman.donchenko@itseez.com>`_
+* `Roman Kharitonov <mailto:roman.kharitonov@itseez.com>`_
+* Ruslan Baratov
+* `Sebastian Holtermann <mailto:sebholt@xwmw.org>`_
+* `Stephen Kelly <mailto:steveire@gmail.com>`_
+* `Sylvain Joubert <mailto:joubert.sy@gmail.com>`_
+* `The Qt Company Ltd. <https://www.qt.io/>`_
+* `Thomas Sondergaard <mailto:ts@medical-insight.com>`_
+* `Tobias Hunger <mailto:tobias.hunger@qt.io>`_
+* `Todd Gamblin <mailto:tgamblin@llnl.gov>`_
+* Tristan Carel
+* `University of Dundee <https://www.dundee.ac.uk/>`_
+* Vadim Zhukov
+* `Will Dicharry <mailto:wdicharry@stellarscience.com>`_
+
+See version control history for details of individual contributions.
+
+Copyright
+=========
+
+The accompanying `LICENSE.rst`_ notice applies to distributions of CMake
+in source and binary form. We do not require any formal copyright
+assignment or contributor license agreement. Any contributions
+intentionally sent upstream are presumed to be offered under terms
+of the OSI-approved BSD 3-clause License.
+
+Third-party software packages supplied with CMake under compatible
+licenses provide their own copyright notices documented in corresponding
+subdirectories or source files.
+
+.. _`LICENSE.rst`: LICENSE.rst
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 476a1c6..3e4c187 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# If changing this file, also update Utilities/Sphinx/CTestConfig.cmake
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index 3080daa..14f944b 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#-----------------------------------------------------------------------------
# set some special flags for different compilers
diff --git a/Copyright.txt b/Copyright.txt
deleted file mode 100644
index 2074109..0000000
--- a/Copyright.txt
+++ /dev/null
@@ -1,136 +0,0 @@
-CMake - Cross Platform Makefile Generator
-Copyright 2000-2024 Kitware, Inc. and Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the name of Kitware, Inc. nor the names of 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 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
-The following individuals and institutions are among the Contributors:
-
-* Aaron C. Meadows <cmake@shadowguarddev.com>
-* Adriaan de Groot <groot@kde.org>
-* Aleksey Avdeev <solo@altlinux.ru>
-* Alexander Neundorf <neundorf@kde.org>
-* Alexander Smorkalov <alexander.smorkalov@itseez.com>
-* Alexey Sokolov <sokolov@google.com>
-* Alex Merry <alex.merry@kde.org>
-* Alex Turbov <i.zaufi@gmail.com>
-* Andreas Pakulat <apaku@gmx.de>
-* Andreas Schneider <asn@cryptomilk.org>
-* André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
-* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
-* Benjamin Eikel
-* Bjoern Ricks <bjoern.ricks@gmail.com>
-* Brad Hards <bradh@kde.org>
-* Christopher Harvey
-* Christoph Grüninger <foss@grueninger.de>
-* Clement Creusot <creusot@cs.york.ac.uk>
-* Daniel Blezek <blezek@gmail.com>
-* Daniel Pfeifer <daniel@pfeifer-mail.de>
-* Dawid Wróbel <me@dawidwrobel.com>
-* Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-* Eran Ifrah <eran.ifrah@gmail.com>
-* Esben Mose Hansen, Ange Optimization ApS
-* Geoffrey Viola <geoffrey.viola@asirobots.com>
-* Google Inc
-* Gregor Jasny
-* Helio Chissini de Castro <helio@kde.org>
-* Ilya Lavrenov <ilya.lavrenov@itseez.com>
-* Insight Software Consortium <insightsoftwareconsortium.org>
-* Intel Corporation <www.intel.com>
-* Jan Woetzel
-* Jordan Williams <jordan@jwillikers.com>
-* Julien Schueller
-* Kelly Thompson <kgt@lanl.gov>
-* Konstantin Podsvirov <konstantin@podsvirov.pro>
-* Laurent Montel <montel@kde.org>
-* Mario Bensi <mbensi@ipsquad.net>
-* Martin Gräßlin <mgraesslin@kde.org>
-* Mathieu Malaterre <mathieu.malaterre@gmail.com>
-* Matthaeus G. Chajdas
-* Matthias Kretz <kretz@kde.org>
-* Matthias Maennich <matthias@maennich.net>
-* Michael Hirsch, Ph.D. <www.scivision.co>
-* Michael Stürmer
-* Miguel A. Figueroa-Villanueva
-* Mike Durso <rbprogrammer@gmail.com>
-* Mike Jackson
-* Mike McQuaid <mike@mikemcquaid.com>
-* Nicolas Bock <nicolasbock@gmail.com>
-* Nicolas Despres <nicolas.despres@gmail.com>
-* Nikita Krupen'ko <krnekit@gmail.com>
-* NVIDIA Corporation <www.nvidia.com>
-* OpenGamma Ltd. <opengamma.com>
-* Patrick Stotko <stotko@cs.uni-bonn.de>
-* Per Øyvind Karlsen <peroyvind@mandriva.org>
-* Peter Collingbourne <peter@pcc.me.uk>
-* Petr Gotthard <gotthard@honeywell.com>
-* Philip Lowman <philip@yhbt.com>
-* Philippe Proulx <pproulx@efficios.com>
-* Raffi Enficiaud, Max Planck Society
-* Raumfeld <raumfeld.com>
-* Roger Leigh <rleigh@codelibre.net>
-* Rolf Eike Beer <eike@sf-mail.de>
-* Roman Donchenko <roman.donchenko@itseez.com>
-* Roman Kharitonov <roman.kharitonov@itseez.com>
-* Ruslan Baratov
-* Sebastian Holtermann <sebholt@xwmw.org>
-* Stephen Kelly <steveire@gmail.com>
-* Sylvain Joubert <joubert.sy@gmail.com>
-* The Qt Company Ltd.
-* Thomas Sondergaard <ts@medical-insight.com>
-* Tobias Hunger <tobias.hunger@qt.io>
-* Todd Gamblin <tgamblin@llnl.gov>
-* Tristan Carel
-* University of Dundee
-* Vadim Zhukov
-* Will Dicharry <wdicharry@stellarscience.com>
-
-See version control history for details of individual contributions.
-
-The above copyright and license notice applies to distributions of
-CMake in source and binary form. Third-party software packages supplied
-with CMake under compatible licenses provide their own copyright notices
-documented in corresponding subdirectories or source files.
-
-------------------------------------------------------------------------------
-
-CMake was initially developed by Kitware with the following sponsorship:
-
- * National Library of Medicine at the National Institutes of Health
- as part of the Insight Segmentation and Registration Toolkit (ITK).
-
- * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
- Visualization Initiative.
-
- * National Alliance for Medical Image Computing (NAMIC) is funded by the
- National Institutes of Health through the NIH Roadmap for Medical Research,
- Grant U54 EB005149.
-
- * Kitware, Inc.
diff --git a/DartConfig.cmake b/DartConfig.cmake
index 7d7c45b..467242d 100644
--- a/DartConfig.cmake
+++ b/DartConfig.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set(CTEST_PROJECT_NAME "CMake")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
diff --git a/Help/command/DEPRECATED_POLICY_VERSIONS.txt b/Help/command/DEPRECATED_POLICY_VERSIONS.txt
index f5104d3..1b9f0d4 100644
--- a/Help/command/DEPRECATED_POLICY_VERSIONS.txt
+++ b/Help/command/DEPRECATED_POLICY_VERSIONS.txt
@@ -1,3 +1,11 @@
+.. versionchanged:: 4.0
+
+ Compatibility with versions of CMake older than 3.5 is removed.
+ Calls to :command:`cmake_minimum_required(VERSION)` or
+ :command:`cmake_policy(VERSION)` that do not specify at least
+ 3.5 as their policy version (optionally via ``...<max>``)
+ will produce an error in CMake 4.0 and above.
+
.. versionchanged:: 3.31
Compatibility with versions of CMake older than 3.10 is deprecated.
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index 56c77c1..ab96bd3 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -11,8 +11,8 @@ The general signature is:
|FIND_XXX| (
<VAR>
name | |NAMES|
- [HINTS [path | ENV var]... ]
- [PATHS [path | ENV var]... ]
+ [HINTS [path | ENV var]...]
+ [PATHS [path | ENV var]...]
[REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
[VALIDATOR function]
diff --git a/Help/command/LINK_LIBRARIES_LINKER.txt b/Help/command/LINK_LIBRARIES_LINKER.txt
new file mode 100644
index 0000000..45669f2
--- /dev/null
+++ b/Help/command/LINK_LIBRARIES_LINKER.txt
@@ -0,0 +1,24 @@
+Handling Compiler Driver Differences
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 4.0
+
+To pass options to the linker tool, each compiler driver has its own syntax.
+The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
+way, options to pass to the linker tool. ``LINKER:`` is replaced by the
+appropriate driver option and ``,`` by the appropriate driver separator.
+The driver prefix and driver separator are given by the values of the
+:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
+:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
+
+For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
+``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``.
+
+The ``LINKER:`` prefix supports, as an alternative syntax, specification of
+arguments using the ``SHELL:`` prefix and space as separator. The previous
+example then becomes ``"LINKER:SHELL:-z defs"``.
+
+.. note::
+
+ Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
+ ``LINKER:`` prefix is not supported.
diff --git a/Help/command/POLICY_VERSION.txt b/Help/command/POLICY_VERSION.txt
new file mode 100644
index 0000000..424849d
--- /dev/null
+++ b/Help/command/POLICY_VERSION.txt
@@ -0,0 +1,16 @@
+This specifies that the current CMake code is written for the given range of
+CMake versions, ``<min>[...<max>]``. It sets the "policy version" to:
+
+* the range's ``<max>`` version, if specified, or to
+* the ``<min>`` version, or to
+* the value of the :variable:`CMAKE_POLICY_VERSION_MINIMUM` variable
+ if it is higher than the other two versions.
+
+The policy version effectively requests behavior preferred as of a given CMake
+version and tells newer CMake versions to warn about their new policies.
+All policies known to the running version of CMake and introduced
+in that version or earlier will be set to use ``NEW`` behavior.
+All policies introduced in later versions will be unset (unless the
+:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable sets a default).
+This effectively requests behavior preferred as of a given CMake
+version and tells newer CMake versions to warn about their new policies.
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 6c2d693..dffefe5 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -102,7 +102,7 @@ The options are:
``COMMAND``
Specify the command-line(s) to execute at build time.
At least one ``COMMAND`` would normally be given, but certain patterns
- may omit it, such as adding commands in separate calls using `APPEND`.
+ may omit it, such as adding commands in separate calls using ``APPEND``.
If more than one ``COMMAND`` is specified, they will be executed in order,
but *not* necessarily composed into a stateful shell or batch script.
@@ -141,17 +141,16 @@ The options are:
built before any target using this custom command
(see policy :policy:`CMP0112`).
- * ``TARGET_FILE``
- * ``TARGET_LINKER_FILE``
- * ``TARGET_SONAME_FILE``
- * ``TARGET_PDB_FILE``
+ * ``TARGET_FILE``
+ * ``TARGET_LINKER_FILE``
+ * ``TARGET_SONAME_FILE``
+ * ``TARGET_PDB_FILE``
This target-level dependency does NOT add a file-level dependency that would
cause the custom command to re-run whenever the executable is recompiled.
List target names with the ``DEPENDS`` option to add such file-level
dependencies.
-
``COMMENT``
Display the given message before the commands are executed at
build time. This will be ignored if ``APPEND`` is given, although a future
diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst
index d88e0f0..b574cba 100644
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@ -7,7 +7,7 @@ Add a target with no output so it will always be built.
add_custom_target(Name [ALL] [command1 [args1...]]
[COMMAND command2 [args2...] ...]
- [DEPENDS depend depend depend ... ]
+ [DEPENDS depend depend depend ...]
[BYPRODUCTS [files...]]
[WORKING_DIRECTORY dir]
[COMMENT comment]
@@ -103,10 +103,10 @@ The options are:
dependency will be added automatically so that the mentioned target will be
built before this custom target (see policy :policy:`CMP0112`).
- * ``TARGET_FILE``
- * ``TARGET_LINKER_FILE``
- * ``TARGET_SONAME_FILE``
- * ``TARGET_PDB_FILE``
+ * ``TARGET_FILE``
+ * ``TARGET_LINKER_FILE``
+ * ``TARGET_SONAME_FILE``
+ * ``TARGET_PDB_FILE``
The command and arguments are optional and if not specified an empty
target will be created.
diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst
index 3a51a30..c619212 100644
--- a/Help/command/add_dependencies.rst
+++ b/Help/command/add_dependencies.rst
@@ -5,13 +5,14 @@ Add a dependency between top-level targets.
.. code-block:: cmake
- add_dependencies(<target> [<target-dependency>]...)
+ add_dependencies(<target> <target-dependency>...)
Makes a top-level ``<target>`` depend on other top-level targets to
ensure that they build before ``<target>`` does. A top-level target
is one created by one of the :command:`add_executable`,
:command:`add_library`, or :command:`add_custom_target` commands
(but not targets generated by CMake like ``install``).
+At least one ``<target-dependency>`` must be given.
Dependencies added to an :ref:`imported target <Imported Targets>`
or an :ref:`interface library <Interface Libraries>` are followed
diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst
index b6833b4..bab3714 100644
--- a/Help/command/add_executable.rst
+++ b/Help/command/add_executable.rst
@@ -14,8 +14,8 @@ Normal Executables
add_executable(<name> <options>... <sources>...)
:target: normal
- Add an executable target called ``<name>`` to be built from the source
- files listed in the command invocation.
+ Add an :ref:`executable <Executables>` target called ``<name>`` to
+ be built from the source files listed in the command invocation.
The options are:
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index cab380e..58b576d 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -20,14 +20,17 @@ Normal Libraries
The optional ``<type>`` specifies the type of library to be created:
``STATIC``
- An archive of object files for use when linking other targets.
+ A :ref:`Static Library <Static Libraries>`:
+ an archive of object files for use when linking other targets.
``SHARED``
- A dynamic library that may be linked by other targets and loaded
+ A :ref:`Shared Library <Shared Libraries>`:
+ a dynamic library that may be linked by other targets and loaded
at runtime.
``MODULE``
- A plugin that may not be linked by other targets, but may be
+ A :ref:`Module Library <Module Libraries>`:
+ a plugin that may not be linked by other targets, but may be
dynamically loaded at runtime using dlopen-like functionality.
If no ``<type>`` is given the default is ``STATIC`` or ``SHARED``
diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst
index 2a3c759..dbaa4fb 100644
--- a/Help/command/add_test.rst
+++ b/Help/command/add_test.rst
@@ -16,7 +16,7 @@ if necessary. See policy :policy:`CMP0110`.
CMake only generates tests if the :command:`enable_testing` command has been
invoked. The :module:`CTest` module invokes ``enable_testing`` automatically
-unless ``BUILD_TESTING`` is set to ``OFF``.
+unless :variable:`BUILD_TESTING` is set to ``OFF``.
Tests added with the ``add_test(NAME)`` signature support using
:manual:`generator expressions <cmake-generator-expressions(7)>`
diff --git a/Help/command/block.rst b/Help/command/block.rst
index 4c6e111..7b5b581 100644
--- a/Help/command/block.rst
+++ b/Help/command/block.rst
@@ -7,7 +7,7 @@ Evaluate a group of commands with a dedicated variable and/or policy scope.
.. code-block:: cmake
- block([SCOPE_FOR [POLICIES] [VARIABLES] ] [PROPAGATE <var-name>...])
+ block([SCOPE_FOR [POLICIES] [VARIABLES]] [PROPAGATE <var-name>...])
<commands>
endblock()
@@ -43,13 +43,15 @@ scopes created by the ``block()`` command are removed.
set(var1 "INIT1")
set(var2 "INIT2")
+ set(var3 "INIT3")
block(PROPAGATE var1 var2)
set(var1 "VALUE1")
unset(var2)
+ set(var3 "VALUE3")
endblock()
- # Now var1 holds VALUE1, and var2 is unset
+ # Now var1 holds VALUE1, var2 is unset, and var3 holds the initial value INIT3
This option is only allowed when a variable scope is created. An error will
be raised in the other cases.
diff --git a/Help/command/build_command.rst b/Help/command/build_command.rst
index 3d86a2e..21adab9 100644
--- a/Help/command/build_command.rst
+++ b/Help/command/build_command.rst
@@ -15,14 +15,14 @@ This is mainly intended for internal use by the :module:`CTest` module.
Sets the given ``<variable>`` to a command-line string of the form::
- <cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i]
+ <cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...]
where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
tool, and ``<config>``, ``<parallel>`` and ``<target>`` are the values
provided to the ``CONFIGURATION``, ``PARALLEL_LEVEL`` and ``TARGET``
-options, if any. The trailing ``-- -i`` option is added for
-:ref:`Makefile Generators` if policy :policy:`CMP0061` is not set to
-``NEW``.
+options, if any. In CMake versions prior to 4.0, a trailing ``-- -i``
+option was added for :ref:`Makefile Generators` if policy :policy:`CMP0061`
+was not set to ``NEW``.
When invoked, this :option:`cmake --build` command line will launch the
underlying build system tool.
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index 0d2f75e..18f6725 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -129,7 +129,15 @@ queried. The list of queried values is stored in ``<variable>``.
``OS_NAME``
.. versionadded:: 3.10
- See :variable:`CMAKE_HOST_SYSTEM_NAME`
+ The host operating system name:
+
+ * On UNIX platforms, this is ``uname -s``.
+
+ * On Apple platforms, this is ``sw_vers -productName``.
+
+ * On Windows, this is ``Windows``.
+
+ See also :variable:`CMAKE_HOST_SYSTEM_NAME`.
``OS_RELEASE``
.. versionadded:: 3.10
@@ -275,7 +283,7 @@ Query Windows registry
.. versionadded:: 3.24
-::
+.. code-block:: cmake
cmake_host_system_information(RESULT <variable>
QUERY WINDOWS_REGISTRY <key> [VALUE_NAMES|SUBKEYS|VALUE <name>]
diff --git a/Help/command/cmake_instrumentation.rst b/Help/command/cmake_instrumentation.rst
new file mode 100644
index 0000000..22e77ea
--- /dev/null
+++ b/Help/command/cmake_instrumentation.rst
@@ -0,0 +1,70 @@
+cmake_instrumentation
+---------------------
+
+.. versionadded:: 4.0
+
+.. note::
+
+ This command is only available when experimental support for instrumentation
+ has been enabled by the ``CMAKE_EXPERIMENTAL_INSTRUMENTATION`` gate.
+
+Enables interacting with the
+:manual:`CMake Instrumentation API <cmake-instrumentation(7)>`.
+
+This allows for configuring instrumentation at the project-level.
+
+.. code-block:: cmake
+
+ cmake_instrumentation(
+ API_VERSION <version>
+ DATA_VERSION <version>
+ [HOOKS <hooks>...]
+ [QUERIES <queries>...]
+ [CALLBACK <callback>]
+ )
+
+The ``API_VERSION`` and ``DATA_VERSION`` must always be given. Currently, the
+only supported value for both fields is 1. See :ref:`cmake-instrumentation API v1`
+for details of the ``API_VERSION`` and :ref:`cmake-instrumentation Data v1` for details
+of the ``DATA_VERSION``.
+
+Each of the optional keywords ``HOOKS``, ``QUERIES``, and ``CALLBACK``
+correspond to one of the parameters to the :ref:`cmake-instrumentation v1 Query Files`.
+The ``CALLBACK`` keyword can be provided multiple times to create multiple callbacks.
+
+Whenever ``cmake_instrumentation`` is invoked, a query file is generated in
+``<build>/.cmake/instrumentation/v1/query/generated`` to enable instrumentation
+with the provided arguments.
+
+Example
+^^^^^^^
+
+The following example shows an invocation of the command and its
+equivalent JSON query file.
+
+.. code-block:: cmake
+
+ cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ HOOKS postGenerate preCMakeBuild postCMakeBuild
+ QUERIES staticSystemInformation dynamicSystemInformation
+ CALLBACK ${CMAKE_COMMAND} -P /path/to/handle_data.cmake
+ CALLBACK ${CMAKE_COMMAND} -P /path/to/handle_data_2.cmake
+ )
+
+.. code-block:: json
+
+ {
+ "version": 1,
+ "hooks": [
+ "postGenerate", "preCMakeBuild", "postCMakeBuild"
+ ],
+ "queries": [
+ "staticSystemInformation", "dynamicSystemInformation"
+ ],
+ "callbacks": [
+ "/path/to/cmake -P /path/to/handle_data.cmake"
+ "/path/to/cmake -P /path/to/handle_data_2.cmake"
+ ]
+ }
diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst
index de2c8f3..333e514 100644
--- a/Help/command/cmake_minimum_required.rst
+++ b/Help/command/cmake_minimum_required.rst
@@ -8,7 +8,7 @@ Require a minimum version of cmake.
cmake_minimum_required(VERSION <min>[...<policy_max>] [FATAL_ERROR])
.. versionadded:: 3.12
- The optional ``<policy_max>`` version.
+ The optional ``<policy_max>`` version behavior; ignored in older CMake.
Sets the minimum required version of cmake for a project.
Also updates the policy settings as explained below.
@@ -19,7 +19,7 @@ form ``major.minor[.patch[.tweak]]``, and the ``...`` is literal.
If the running version of CMake is lower than the ``<min>`` required
version it will stop processing the project and report an error.
The optional ``<policy_max>`` version, if specified, must be at least the
-``<min>`` version and affects policy settings as described in `Policy Settings`_.
+``<min>`` version and sets the `Policy Version`_.
If the running version of CMake is older than 3.12, the extra ``...``
dots will be seen as version component separators, resulting in the
``...<max>`` part being ignored and preserving the pre-3.12 behavior
@@ -48,37 +48,18 @@ with an error instead of just a warning.
calling scope, calling ``cmake_minimum_required()`` inside a function
is generally discouraged.
-.. _`Policy Settings`:
+.. _`Policy Version`:
-Policy Settings
-^^^^^^^^^^^^^^^
+Policy Version
+^^^^^^^^^^^^^^
-The ``cmake_minimum_required(VERSION)`` command implicitly invokes the
-:command:`cmake_policy(VERSION)` command to specify that the current
-project code is written for the given range of CMake versions.
-All policies known to the running version of CMake and introduced
-in the ``<min>`` (or ``<max>``, if specified) version or earlier will
-be set to use ``NEW`` behavior. All policies introduced in later
-versions will be unset. This effectively requests behavior preferred
-as of a given CMake version and tells newer CMake versions to warn
-about their new policies.
-
-When a ``<min>`` version higher than 2.4 is specified the command
-implicitly invokes
+``cmake_minimum_required(VERSION <min>[...<max>])`` implicitly invokes
.. code-block:: cmake
cmake_policy(VERSION <min>[...<max>])
-which sets CMake policies based on the range of versions specified.
-When a ``<min>`` version 2.4 or lower is given the command implicitly
-invokes
-
-.. code-block:: cmake
-
- cmake_policy(VERSION 2.4[...<max>])
-
-which enables compatibility features for CMake 2.4 and lower.
+.. include:: POLICY_VERSION.txt
.. include:: DEPRECATED_POLICY_VERSIONS.txt
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst
index 39b7b99..81932b6 100644
--- a/Help/command/cmake_path.rst
+++ b/Help/command/cmake_path.rst
@@ -122,11 +122,11 @@ constraints):
identify a file, a hard link, a symbolic link, or a directory. Two special
cases are recognized:
- * The item name consisting of a single dot character ``.`` is a
- directory name that refers to the current directory.
+ * The item name consisting of a single dot character ``.`` is a
+ directory name that refers to the current directory.
- * The item name consisting of two dot characters ``..`` is a
- directory name that refers to the parent directory.
+ * The item name consisting of two dot characters ``..`` is a
+ directory name that refers to the parent directory.
The ``(...)*`` pattern shown above is to indicate that there can be zero
or more item names, with multiple items separated by a
@@ -154,11 +154,11 @@ constraints):
The following exceptions apply to the above interpretation:
- * If the first character in the ``filename`` is a period, that period is
- ignored (i.e. a ``filename`` like ``".profile"`` is treated as having
- no extension).
+ * If the first character in the ``filename`` is a period, that period is
+ ignored (i.e. a ``filename`` like ``".profile"`` is treated as having
+ no extension).
- * If the ``filename`` is either ``.`` or ``..``, it has no extension.
+ * If the ``filename`` is either ``.`` or ``..``, it has no extension.
The *stem* is the part of the ``filename`` before the extension.
diff --git a/Help/command/cmake_pkg_config.rst b/Help/command/cmake_pkg_config.rst
index 0d7e512..3744d93 100644
--- a/Help/command/cmake_pkg_config.rst
+++ b/Help/command/cmake_pkg_config.rst
@@ -12,7 +12,7 @@ Process pkg-config format package files.
Synopsis
^^^^^^^^
-.. parsed-literal::
+.. code-block:: cmake
cmake_pkg_config(EXTRACT <package> [<version>] [...])
diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst
index 4a08c01..276e160 100644
--- a/Help/command/cmake_policy.rst
+++ b/Help/command/cmake_policy.rst
@@ -39,14 +39,7 @@ CMake is older than 3.12, the extra ``...`` dots will be seen as version
component separators, resulting in the ``...<max>`` part being ignored and
preserving the pre-3.12 behavior of basing policies on ``<min>``.
-This specifies that the current CMake code is written for the given
-range of CMake versions. All policies known to the running version of CMake
-and introduced in the ``<min>`` (or ``<max>``, if specified) version
-or earlier will be set to use ``NEW`` behavior. All policies
-introduced in later versions will be unset (unless the
-:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable sets a default).
-This effectively requests behavior preferred as of a given CMake
-version and tells newer CMake versions to warn about their new policies.
+.. include:: POLICY_VERSION.txt
Note that the :command:`cmake_minimum_required(VERSION)`
command implicitly calls ``cmake_policy(VERSION)`` too.
diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst
index 7200c24..546f9ce 100644
--- a/Help/command/configure_file.rst
+++ b/Help/command/configure_file.rst
@@ -13,7 +13,7 @@ Copy a file to another location and modify its contents.
[NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
FILE_PERMISSIONS <permissions>...]
[COPYONLY] [ESCAPE_QUOTES] [@ONLY]
- [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
+ [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF]])
Copies an ``<input>`` file to an ``<output>`` file while performing
`transformations`_ of the input file content.
diff --git a/Help/command/ctest_run_script.rst b/Help/command/ctest_run_script.rst
index 145bd90..0d94eb0 100644
--- a/Help/command/ctest_run_script.rst
+++ b/Help/command/ctest_run_script.rst
@@ -9,7 +9,6 @@ runs a :option:`ctest -S` script
script_file_name2 ... [RETURN_VALUE var])
Runs a script or scripts much like if it was run from :option:`ctest -S`.
-If no argument is provided then the current script is run using the current
-settings of the variables. If ``NEW_PROCESS`` is specified then each
-script will be run in a separate process.If ``RETURN_VALUE`` is specified
-the return value of the last script run will be put into ``var``.
+If ``NEW_PROCESS`` is specified then each script will be run in a separate
+process. If ``RETURN_VALUE`` is specified the return value of the last script
+run will be put into ``var``.
diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index 3b6bf3a..56a47e8 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -22,21 +22,22 @@ By default all available parts are submitted.
The options are:
``PARTS <part>...``
- Specify a subset of parts to submit. Valid part names are::
-
- Start = nothing
- Update = ctest_update results, in Update.xml
- Configure = ctest_configure results, in Configure.xml
- Build = ctest_build results, in Build.xml
- Test = ctest_test results, in Test.xml
- Coverage = ctest_coverage results, in Coverage.xml
- MemCheck = ctest_memcheck results, in DynamicAnalysis.xml and
- DynamicAnalysis-Test.xml
- Notes = Files listed by CTEST_NOTES_FILES, in Notes.xml
- ExtraFiles = Files listed by CTEST_EXTRA_SUBMIT_FILES
- Upload = Files prepared for upload by ctest_upload(), in Upload.xml
- Submit = nothing
- Done = Build is complete, in Done.xml
+ Specify a subset of parts to submit. Valid part names are:
+
+ * ``Start`` - nothing.
+ * ``Update`` - :command:`ctest_update` results, in ``Update.xml``.
+ * ``Configure`` - :command:`ctest_configure` results, in ``Configure.xml``.
+ * ``Build`` - :command:`ctest_build` results, in ``Build.xml``.
+ * ``Test`` - :command:`ctest_test` results, in ``Test.xml``.
+ * ``Coverage`` - :command:`ctest_coverage` results, in ``Coverage.xml``.
+ * ``MemCheck`` - :command:`ctest_memcheck` results, in
+ ``DynamicAnalysis.xml`` and ``DynamicAnalysis-Test.xml``.
+ * ``Notes`` - Files listed by :variable:`CTEST_NOTES_FILES`, in ``Notes.xml``.
+ * ``ExtraFiles`` - Files listed by :variable:`CTEST_EXTRA_SUBMIT_FILES`.
+ * ``Upload`` - Files prepared for upload by :command:`ctest_upload`, in
+ ``Upload.xml``.
+ * ``Submit`` - nothing.
+ * ``Done`` - Build is complete, in ``Done.xml``.
``FILES <file>...``
Specify an explicit list of specific files to be submitted.
diff --git a/Help/command/define_property.rst b/Help/command/define_property.rst
index 06f2823..3dccca9 100644
--- a/Help/command/define_property.rst
+++ b/Help/command/define_property.rst
@@ -21,15 +21,13 @@ primary use case.
The first argument determines the kind of scope in which the property should
be used. It must be one of the following:
-::
-
- GLOBAL = associated with the global namespace
- DIRECTORY = associated with one directory
- TARGET = associated with one target
- SOURCE = associated with one source file
- TEST = associated with a test named with add_test
- VARIABLE = documents a CMake language variable
- CACHED_VARIABLE = documents a CMake cache variable
+* ``GLOBAL`` - associated with the global namespace.
+* ``DIRECTORY`` - associated with one directory.
+* ``TARGET`` - associated with one target.
+* ``SOURCE`` - associated with one source file.
+* ``TEST`` - associated with a test named with :command:`add_test`.
+* ``VARIABLE`` - documents a CMake language variable.
+* ``CACHED_VARIABLE`` - documents a CMake cache variable.
Note that unlike :command:`set_property` and :command:`get_property` no
actual scope needs to be given; only the kind of scope is important.
diff --git a/Help/command/else.rst b/Help/command/else.rst
index a98fcd8..4c07b6c 100644
--- a/Help/command/else.rst
+++ b/Help/command/else.rst
@@ -8,3 +8,6 @@ Starts the else portion of an if block.
else([<condition>])
See the :command:`if` command.
+
+The optional ``<condition>`` argument is supported for backward compatibility
+only and is not evaluated.
diff --git a/Help/command/enable_testing.rst b/Help/command/enable_testing.rst
index 3ac1a19..7bae5c0 100644
--- a/Help/command/enable_testing.rst
+++ b/Help/command/enable_testing.rst
@@ -9,12 +9,12 @@ Enable testing for current directory and below.
Enables testing for this directory and below.
-This command should be in the source directory root
-because ctest expects to find a test file in the build
-directory root.
+This command should be in the top-level source directory because
+:manual:`ctest(1)` expects to find a test file in the top-level
+build directory.
This command is automatically invoked when the :module:`CTest`
-module is included, except if the ``BUILD_TESTING`` option is
-turned off.
+module is included, except if the :variable:`BUILD_TESTING`
+option is turned off.
See also the :command:`add_test` command.
diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst
index 6b0372d..c2c7fe3 100644
--- a/Help/command/execute_process.rst
+++ b/Help/command/execute_process.rst
@@ -24,7 +24,7 @@ Execute one or more child processes.
[ENCODING <name>]
[ECHO_OUTPUT_VARIABLE]
[ECHO_ERROR_VARIABLE]
- [COMMAND_ERROR_IS_FATAL <ANY|LAST>])
+ [COMMAND_ERROR_IS_FATAL <ANY|LAST|NONE>])
Runs the given sequence of one or more commands.
@@ -44,17 +44,31 @@ Options:
CMake executes the child process using operating system APIs directly:
- * On POSIX platforms, the command line is passed to the
- child process in an ``argv[]`` style array.
+ * On POSIX platforms, the command line is passed to the child process
+ in an ``argv[]`` style array. No intermediate shell is executed,
+ so shell operators such as ``>`` are treated as normal arguments.
* On Windows platforms, the command line is encoded as a string such
- that child processes using ``CommandLineToArgvW`` will decode the
+ that child processes using `CommandLineToArgvW`_ will decode the
original arguments.
- No intermediate shell is used, so shell operators such as ``>``
- are treated as normal arguments.
- (Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to
- redirect stdin, stdout, and stderr.)
+ If the command runs a ``.exe``, ``.com``, or other executable,
+ no intermediate command interpreter is executed, so shell operators
+ such as ``>`` are treated as normal arguments.
+
+ If the command runs a ``.bat`` or ``.cmd`` script, it is executed
+ through the ``cmd`` command interpreter. The command interpreter
+ does not use `CommandLineToArgvW`_, so some arguments may be received
+ by the script with extra quoting.
+
+ .. versionchanged:: 4.0
+ ``.bat`` and ``.cmd`` scripts are now explicitly executed through the
+ command interpreter by prepending ``cmd /c call`` to the command line.
+ Previously, they were implicitly executed through ``cmd /c``, without
+ ``call``, by undocumented behavior of `CreateProcessW`_.
+
+ Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to
+ redirect stdin, stdout, and stderr.
For **sequential execution** of multiple commands use multiple
``execute_process`` calls each with a single ``COMMAND`` argument.
@@ -168,17 +182,35 @@ Options:
`UTF-8 RFC <https://datatracker.ietf.org/doc/html/rfc3629>`_
naming convention.
-``COMMAND_ERROR_IS_FATAL <ANY|LAST>``
+``COMMAND_ERROR_IS_FATAL <ANY|LAST|NONE>``
.. versionadded:: 3.19
The option following ``COMMAND_ERROR_IS_FATAL`` determines the behavior when
an error is encountered:
- ``ANY``
+ ``ANY``
If any of the commands in the list of commands fail, the
``execute_process()`` command halts with an error.
- ``LAST``
+ ``LAST``
If the last command in the list of commands fails, the
- ``execute_process()`` command halts with an error. Commands earlier in the
- list will not cause a fatal error.
+ ``execute_process()`` command halts with an error.
+ Commands earlier in the list will not cause a fatal error.
+
+
+ ``NONE``
+ .. versionadded:: 4.0
+
+ Regardless of any of the commands failing, the ``execute_process()``
+ command will not halt with an error.
+
+ .. versionadded:: 4.0
+
+ If not provided, the
+ :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL` variable
+ is checked. If the variable is not set, the default is ``NONE``.
+ If ``RESULT_VARIABLE`` or ``RESULTS_VARIABLE`` is supplied,
+ :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL` is ignored.
+
+.. _`CommandLineToArgvW`: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw
+.. _`CreateProcessW`: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 890bdf4..8a9f6e9 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -37,7 +37,7 @@ Synopsis
`Filesystem`_
file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] <globbing-expr>...)
- file(`MAKE_DIRECTORY`_ <directories>...)
+ file(`MAKE_DIRECTORY`_ <directories>... [...])
file({`REMOVE`_ | `REMOVE_RECURSE`_ } <files>...)
file(`RENAME`_ <oldname> <newname> [...])
file(`COPY_FILE`_ <oldname> <newname> [...])
@@ -211,7 +211,7 @@ Writing
[CONDITION <expression>] [TARGET <target>]
[NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
FILE_PERMISSIONS <permissions>...]
- [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
+ [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF]])
The options are:
@@ -293,7 +293,7 @@ Writing
file(CONFIGURE OUTPUT <output-file>
CONTENT <content>
[ESCAPE_QUOTES] [@ONLY]
- [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
+ [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF]])
:target: CONFIGURE
.. versionadded:: 3.18
@@ -402,7 +402,8 @@ Filesystem
.. signature::
file(MAKE_DIRECTORY <directories>... [RESULT <result>])
- Create the given directories and their parents as needed.
+ Create the given directories and their parents as needed. Relative input
+ paths are evaluated with respect to the current source directory.
The options are:
@@ -1336,7 +1337,7 @@ Handling Runtime Binaries
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.
+ :variable:`CMAKE_OBJDUMP` variable if set, else by system introspection.
.. versionadded:: 3.18
- Use ``CMAKE_OBJDUMP`` if set.
+ Uses :variable:`CMAKE_OBJDUMP` if set.
diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst
index ba046fa..fea5e74 100644
--- a/Help/command/find_library.rst
+++ b/Help/command/find_library.rst
@@ -52,8 +52,10 @@ for it. The ``NAMES_PER_DIR`` option tells this command to consider one
directory at a time and search for all names in it.
Each library name given to the ``NAMES`` option is first considered
-as a library file name and then considered with platform-specific
-prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``). Therefore one
+as is, if it contains a library suffix, and then considered with
+platform-specific prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``),
+as defined by the variables :variable:`CMAKE_FIND_LIBRARY_PREFIXES` and
+:variable:`CMAKE_FIND_LIBRARY_SUFFIXES`. Therefore one
may specify library file names such as ``libfoo.a`` directly.
This can be used to locate static libraries on UNIX-like systems.
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index c26076b..72b28d3 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -26,7 +26,7 @@ Typical Usage
Most calls to ``find_package()`` typically have the following form:
-.. parsed-literal::
+.. code-block:: cmake
find_package(<PackageName> [<version>] [REQUIRED] [COMPONENTS <components>...])
@@ -41,8 +41,8 @@ projects should find packages using this form. This reduces complexity and
maximizes the ways in which the package can be found or provided.
Understanding the `basic signature`_ should be enough for general usage of
-``find_package()``. Project maintainers who intend to provide a config
-package should understand the bigger picture, as explained in
+``find_package()``. Project maintainers who intend to provide a package
+configuration file should understand the bigger picture, as explained in
:ref:`Full Signature` and all subsequent sections on this page.
Search Modes
@@ -78,6 +78,20 @@ The command has a few modes by which it searches for packages:
(see :ref:`version selection` for an explanation of how these separate
version files are used).
+ .. note::
+ If the experimental ``CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES`` is enabled,
+ files named ``<PackageName>.cps`` and ``<lowercasePackageName>.cps`` are
+ also considered. These files provide package information according to the
+ |CPS|_ (CPS), which is more portable than CMake script. Aside from any
+ explicitly noted exceptions, any references to "config files", "config
+ mode", "package configuration files", and so forth refer equally to both
+ CPS and CMake-script files. This functionality is a work in progress, and
+ some features may be missing.
+
+ Search is implemented in a manner that will tend to prefer |CPS| files
+ over CMake-script config files in most cases. Specifying ``CONFIGS``
+ suppresses consideration of CPS files.
+
In config mode, the command can be given a list of names to search for
as package names. The locations where CMake searches for the config and
version files is considerably more complicated than for Module mode
@@ -115,7 +129,7 @@ forced to use only Module mode with a ``MODULE`` keyword. If the
Basic Signature
^^^^^^^^^^^^^^^
-.. parsed-literal::
+.. code-block:: cmake
find_package(<PackageName> [version] [EXACT] [QUIET] [MODULE]
[REQUIRED] [[COMPONENTS] [components...]]
@@ -145,19 +159,29 @@ otherwise execution still continues. As a form of shorthand, if the
``REQUIRED`` option is present, the ``COMPONENTS`` keyword can be omitted
and the required components can be listed directly after ``REQUIRED``.
-Additional optional components may be listed after
-``OPTIONAL_COMPONENTS``. If these cannot be satisfied, the package overall
-can still be considered found, as long as all required components are
-satisfied.
+Additional optional components may be listed after ``OPTIONAL_COMPONENTS``.
+If these cannot be satisfied, the package overall can still be considered
+found, as long as all required components are satisfied.
The set of available components and their meaning are defined by the
-target package. Formally, it is up to the target package how to
-interpret the component information given to it, but it should follow
-the expectations stated above. For calls where no components are specified,
-there is no single expected behavior and target packages should clearly
-define what occurs in such cases. Common arrangements include assuming it
-should find all components, no components or some well-defined subset of the
-available components.
+target package:
+
+* For CMake-script package configuration files, it is formally up to the target
+ package how to interpret the component information given to it, but it should
+ follow the expectations stated above. For calls where no components are
+ specified, there is no single expected behavior and target packages should
+ clearly define what occurs in such cases. Common arrangements include
+ assuming it should find all components, no components or some well-defined
+ subset of the available components.
+
+* |CPS| packages consist of a root configuration file and zero or more
+ appendices, each of which provide components and may have dependencies.
+ CMake always attempts to load the root configuration file. Appendices are
+ only loaded if their dependencies can be satisfied, and if they either
+ provide requested components, or if no components were requested. If the
+ dependencies of an appendix providing a required component cannot be
+ satisfied, the package is considered not found. Otherwise, that appendix
+ is ignored.
.. versionadded:: 3.24
The ``REGISTRY_VIEW`` keyword specifies which registry views should be
@@ -177,13 +201,23 @@ The ``[version]`` argument requests a version with which the package found
should be compatible. There are two possible forms in which it may be
specified:
- * A single version with the format ``major[.minor[.patch[.tweak]]]``, where
- each component is a numeric value.
- * A version range with the format ``versionMin...[<]versionMax`` where
- ``versionMin`` and ``versionMax`` have the same format and constraints
- on components being integers as the single version. By default, both end
- points are included. By specifying ``<``, the upper end point will be
- excluded. Version ranges are only supported with CMake 3.19 or later.
+* A single version with the format ``major[.minor[.patch[.tweak]]]``, where
+ each component is a numeric value.
+* A version range with the format ``versionMin...[<]versionMax`` where
+ ``versionMin`` and ``versionMax`` have the same format and constraints on
+ components being integers as the single version. By default, both end points
+ are included. By specifying ``<``, the upper end point will be excluded.
+ Version ranges are only supported with CMake 3.19 or later.
+
+.. note::
+ With the exception of CPS packages, version support is currently provided
+ only on a package-by-package basis. When a version range is specified but
+ the package is only designed to expect a single version, the package will
+ ignore the upper end point of the range and only take the single version at
+ the lower end of the range into account. Non-CPS packages that do support
+ version ranges do so in a manner that is determined by the individual
+ package. See the `Version Selection`_ section below for details and
+ important caveats.
The ``EXACT`` option requests that the version be matched exactly. This option
is incompatible with the specification of a version range.
@@ -191,11 +225,7 @@ is incompatible with the specification of a version range.
If no ``[version]`` and/or component list is given to a recursive invocation
inside a find-module, the corresponding arguments are forwarded
automatically from the outer call (including the ``EXACT`` flag for
-``[version]``). Version support is currently provided only on a
-package-by-package basis (see the `Version Selection`_ section below).
-When a version range is specified but the package is only designed to expect
-a single version, the package will ignore the upper end point of the range and
-only take the single version at the lower end of the range into account.
+``[version]``).
See the :command:`cmake_policy` command documentation for discussion
of the ``NO_POLICY_SCOPE`` option.
@@ -213,7 +243,7 @@ of the ``NO_POLICY_SCOPE`` option.
Full Signature
^^^^^^^^^^^^^^
-.. parsed-literal::
+.. code-block:: cmake
find_package(<PackageName> [version] [EXACT] [QUIET]
[REQUIRED] [[COMPONENTS] [components...]]
@@ -224,8 +254,8 @@ Full Signature
[BYPASS_PROVIDER]
[NAMES name1 [name2 ...]]
[CONFIGS config1 [config2 ...]]
- [HINTS path1 [path2 ... ]]
- [PATHS path1 [path2 ... ]]
+ [HINTS path1 [path2 ...]]
+ [PATHS path1 [path2 ...]]
[REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
[NO_DEFAULT_PATH]
@@ -263,23 +293,29 @@ Once found, any :ref:`version constraint <version selection>` is checked,
and if satisfied, the configuration file is read and processed by CMake.
Since the file is provided by the package it already knows the
location of package contents. The full path to the configuration file
-is stored in the cmake variable ``<PackageName>_CONFIG``.
+is stored in the CMake variable ``<PackageName>_CONFIG``.
+
+.. note::
+
+ If the experimental ``CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES`` is enabled,
+ files named ``<PackageName>.cps`` and ``<lowercasePackageName>.cps`` are
+ also considered, unless ``CONFIGS`` is given.
All configuration files which have been considered by CMake while
searching for the package with an appropriate version are stored in the
``<PackageName>_CONSIDERED_CONFIGS`` variable, and the associated versions
in the ``<PackageName>_CONSIDERED_VERSIONS`` variable.
-If the package configuration file cannot be found CMake will generate
+If the package configuration file cannot be found, CMake will generate
an error describing the problem unless the ``QUIET`` argument is
-specified. If ``REQUIRED`` is specified and the package is not found a
+specified. If ``REQUIRED`` is specified and the package is not found, a
fatal error is generated and the configure step stops executing. If
``<PackageName>_DIR`` has been set to a directory not containing a
-configuration file CMake will ignore it and search from scratch.
+configuration file, CMake will ignore it and search from scratch.
-Package maintainers providing CMake package configuration files are
-encouraged to name and install them such that the :ref:`search procedure`
-outlined below will find them without requiring use of additional options.
+Package maintainers providing package configuration files are encouraged to
+name and install them such that the :ref:`search procedure` outlined below
+will find them without requiring use of additional options.
.. _`search procedure`:
@@ -308,11 +344,19 @@ Each entry is meant for installation trees following Windows (``W``), UNIX
==================================================================== ==========
Entry Convention
==================================================================== ==========
+ ``<prefix>/<name>/cps/`` [#p2]_ W
+ ``<prefix>/<name>/*/cps/`` [#p2]_ W
+ ``<prefix>/cps/<name>/`` [#p2]_ W
+ ``<prefix>/cps/<name>/*/`` [#p2]_ W
+ ``<prefix>/cps/`` [#p2]_ W
``<prefix>/`` W
``<prefix>/(cmake|CMake)/`` W
``<prefix>/<name>*/`` W
``<prefix>/<name>*/(cmake|CMake)/`` W
- ``<prefix>/<name>*/(cmake|CMake)/<name>*/`` [#]_ W
+ ``<prefix>/<name>*/(cmake|CMake)/<name>*/`` [#p1]_ W
+ ``<prefix>/(lib/<arch>|lib*|share)/cps/<name>/`` [#p2]_ U
+ ``<prefix>/(lib/<arch>|lib*|share)/cps/<name>/*/`` [#p2]_ U
+ ``<prefix>/(lib/<arch>|lib*|share)/cps/`` [#p2]_ U
``<prefix>/(lib/<arch>|lib*|share)/cmake/<name>*/`` U
``<prefix>/(lib/<arch>|lib*|share)/<name>*/`` U
``<prefix>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/`` U
@@ -321,22 +365,34 @@ Each entry is meant for installation trees following Windows (``W``), UNIX
``<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/`` W/U
==================================================================== ==========
-.. [#] .. versionadded:: 3.25
+.. [#p1] .. versionadded:: 3.25
+
+.. [#p2] .. versionadded:: 4.0
On systems supporting macOS :prop_tgt:`FRAMEWORK` and :prop_tgt:`BUNDLE`, the
following directories are searched for Frameworks or Application Bundles
containing a configuration file:
-=========================================================== ==========
- Entry Convention
-=========================================================== ==========
- ``<prefix>/<name>.framework/Resources/`` A
- ``<prefix>/<name>.framework/Resources/CMake/`` A
- ``<prefix>/<name>.framework/Versions/*/Resources/`` A
- ``<prefix>/<name>.framework/Versions/*/Resources/CMake/`` A
- ``<prefix>/<name>.app/Contents/Resources/`` A
- ``<prefix>/<name>.app/Contents/Resources/CMake/`` A
-=========================================================== ==========
+=============================================================== ==========
+ Entry Convention
+=============================================================== ==========
+ ``<prefix>/<name>.framework/Versions/*/Resources/CPS/`` [#p3]_ A
+ ``<prefix>/<name>.framework/Resources/CPS/`` [#p3]_ A
+ ``<prefix>/<name>.framework/Resources/`` A
+ ``<prefix>/<name>.framework/Resources/CMake/`` A
+ ``<prefix>/<name>.framework/Versions/*/Resources/`` A
+ ``<prefix>/<name>.framework/Versions/*/Resources/CMake/`` A
+ ``<prefix>/<name>.app/Contents/Resources/CPS/`` [#p3]_ A
+ ``<prefix>/<name>.app/Contents/Resources/`` A
+ ``<prefix>/<name>.app/Contents/Resources/CMake/`` A
+=============================================================== ==========
+
+.. [#p3] .. versionadded:: 4.0
+
+When searching the above paths, ``find_package`` will only look for ``.cps``
+files in search paths which contain ``/cps/``, and will only look for
+``.cmake`` files otherwise. (This only applies to the paths as specified and
+does not consider the contents of ``<prefix>`` or ``<name>``.)
In all cases the ``<name>`` is treated as case-insensitive and corresponds
to any of the names specified (``<PackageName>`` or names given by ``NAMES``).
@@ -390,6 +446,13 @@ intended for installations on Apple platforms. The
:variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE`
variables determine the order of preference.
+.. warning::
+
+ Setting :variable:`CMAKE_FIND_FRAMEWORK` or :variable:`CMAKE_FIND_APPBUNDLE`
+ to values other than ``FIRST`` (the default) will cause CMake to search for
+ |CPS| files in an order that is different from the order set forth in the
+ specification.
+
The set of installation prefixes is constructed using the following
steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are
enabled.
@@ -426,7 +489,7 @@ enabled.
This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
-2. Search paths specified in cmake-specific cache variables. These
+2. Search paths specified in CMake-specific cache variables. These
are intended to be used on the command line with a :option:`-DVAR=VALUE <cmake -D>`.
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
@@ -436,7 +499,7 @@ enabled.
* :variable:`CMAKE_FRAMEWORK_PATH`
* :variable:`CMAKE_APPBUNDLE_PATH`
-3. Search paths specified in cmake-specific environment variables.
+3. Search paths specified in CMake-specific environment variables.
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(``;`` on Windows and ``:`` on UNIX).
@@ -470,7 +533,7 @@ enabled.
See the :manual:`cmake-packages(7)` manual for details on the user
package registry.
-7. Search cmake variables defined in the Platform files for the
+7. Search CMake variables defined in the Platform files for the
current system. The searching of :variable:`CMAKE_INSTALL_PREFIX` and
:variable:`CMAKE_STAGING_PREFIX` can be
skipped if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
@@ -507,13 +570,12 @@ Paths are searched in the order described above. The first viable package
configuration file found is used, even if a newer version of the package
resides later in the list of search paths.
-For search paths which contain ``<name>*``, the order among matching paths
-is unspecified unless the :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` variable
-is set. This variable, along with the
-:variable:`CMAKE_FIND_PACKAGE_SORT_DIRECTION` variable, determines the order
-in which CMake considers paths that match a single search path containing
-``<name>*``. For example, if the file system contains the package
-configuration files
+For search paths which contain glob expressions (``*``), the order in which
+directories matching the glob are searched is unspecified unless the
+:variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` variable is set. This variable,
+along with the :variable:`CMAKE_FIND_PACKAGE_SORT_DIRECTION` variable,
+determines the order in which CMake considers glob matches. For example, if
+the file system contains the package configuration files
::
@@ -534,8 +596,8 @@ one can set
.. code-block:: cmake
- SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
- SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+ set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+ set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
before calling ``find_package``.
@@ -543,6 +605,14 @@ before calling ``find_package``.
Added the ``CMAKE_FIND_USE_<CATEGORY>`` variables to globally disable
various search locations.
+.. versionchanged:: 4.0
+ The variables :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` and
+ :variable:`CMAKE_FIND_PACKAGE_SORT_DIRECTION` now also control the order
+ in which ``find_package`` searches directories matching the glob expression
+ in the search paths ``<prefix>/<name>.framework/Versions/*/Resources/``
+ and ``<prefix>/<name>.framework/Versions/*/Resources/CMake``. In previous
+ versions of CMake, this order was unspecified.
+
.. include:: FIND_XXX_ROOT.txt
.. include:: FIND_XXX_ORDER.txt
@@ -574,12 +644,17 @@ Config Mode Version Selection
When the ``[version]`` argument is given, Config mode will only find a
version of the package that claims compatibility with the requested
-version (see :ref:`format specification <FIND_PACKAGE_VERSION_FORMAT>`). If the
-``EXACT`` option is given, only a version of the package claiming an exact match
-of the requested version may be found. CMake does not establish any
-convention for the meaning of version numbers. Package version
-numbers are checked by "version" files provided by the packages themselves
-or by :module:`FetchContent`. For a candidate package configuration file
+version (see :ref:`format specification <FIND_PACKAGE_VERSION_FORMAT>`). If
+the ``EXACT`` option is given, only a version of the package claiming an exact
+match of the requested version may be found. CMake does not establish any
+convention for the meaning of version numbers.
+
+CMake-script
+""""""""""""
+
+For CMake-script package configuration files, package version numbers are
+checked by "version" files provided by the packages themselves or by
+:module:`FetchContent`. For a candidate package configuration file
``<config-file>.cmake`` the corresponding version file is located next
to it and named either ``<config-file>-version.cmake`` or
``<config-file>Version.cmake``. If no such version file is available
@@ -668,7 +743,7 @@ sets these variables:
These variables are checked by the ``find_package`` command to determine
whether the configuration file provides an acceptable version. They
are not available after the ``find_package`` call returns. If the version
-is acceptable the following variables are set:
+is acceptable, the following variables are set:
``<PackageName>_VERSION``
Full provided version string
@@ -685,12 +760,100 @@ is acceptable the following variables are set:
and the corresponding package configuration file is loaded.
+.. note::
+ While the exact behavior of version matching is determined by the individual
+ package, many packages use :command:`write_basic_package_version_file` to
+ supply this logic. The version check scripts this produces have some notable
+ caveats with respect to version ranges:
+
+ * The upper end of a version range acts as a hard limit on what versions will
+ be accepted. Thus, while a request for version ``1.4.0`` might be
+ satisfied by a package whose version is ``1.6.0`` and which advertises
+ 'same major version' compatibility, the same package will be rejected if
+ the requested version range is ``1.4.0...1.5.0``.
+
+ * Both ends of the version range must match the package's advertised
+ compatibility level. For example, if a package advertises 'same major and
+ minor version' compatibility, requesting the version range
+ ``1.4.0...<1.5.5`` or ``1.4.0...1.5.0`` will result in that package being
+ rejected, even if the package version is ``1.4.1``.
+
+ As a result, it is not possible to use a version range to extend the range
+ of compatible package versions that will be accepted.
+
+|CPS|
+"""""
+
+For |CPS| package configuration files, package version numbers are checked by
+CMake according to the set of recognized version schemas. At present, the
+following schemas are recognized:
+
+ ``simple``
+ Version numbers are a tuple of integers followed by an optional trailing
+ segment which is ignored with respect to version comparisons.
+
+ ``custom``
+ The mechanism for interpreting version numbers is unspecified. The version
+ strings must match exactly for the package to be accepted.
+
+Refer to |cps-version_schema|_ for a more detailed explanation of each schema
+and how comparisons for each are performed. Note that the specification may
+include schemas that are not supported by CMake.
+
+In addition to the package's ``version``, CPS allows packages to optionally
+specify a |cps-compat_version|_, which is the oldest version for which the
+package provides compatibility. That is, the package warrants that a consumer
+expecting the ``compat_version`` should be able to use the package, even if the
+package's actual version is newer. If not specified, the ``compat_version``
+is implicitly equal to the package version, i.e. no backwards compatibility is
+provided.
+
+When a package uses a recognized schema, CMake will determine the package's
+acceptability according to the following rules:
+
+* If ``EXACT`` was specified, or if the package does not supply a
+ ``compat_version``, the package's ``version`` must equal the requested
+ version.
+
+* Otherwise:
+
+ * The package's ``version`` must be greater than or equal to the requested
+ (minimum) version, and
+
+ * the package's ``compat_version`` must be less than or equal to the
+ requested (minimum) version, and
+
+ * if a requested maximum version was given, it must be greater than (or equal
+ to, depending on whether the maximum version is specified as inclusive or
+ exclusive) the package's ``version``.
+
+.. note::
+ This implementation of range matching was chosen in order to most closely
+ match the behavior of :command:`write_basic_package_version_file`, albeit
+ without the case where an overly broad range matches nothing.
+
+For packages using the ``simple`` version schema, if the version is acceptable,
+the following variables are set:
+
+``<PackageName>_VERSION``
+ Full provided version string
+``<PackageName>_VERSION_MAJOR``
+ Major version if provided, else 0
+``<PackageName>_VERSION_MINOR``
+ Minor version if provided, else 0
+``<PackageName>_VERSION_PATCH``
+ Patch version if provided, else 0
+``<PackageName>_VERSION_TWEAK``
+ Tweak version if provided, else 0
+``<PackageName>_VERSION_COUNT``
+ Number of version components, non-negative
+
Package File Interface Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When loading a find module or package configuration file ``find_package``
-defines variables to provide information about the call arguments (and
-restores their original state before returning):
+When loading a find module or CMake-script package configuration file,
+``find_package`` defines variables to provide information about the call
+arguments (and restores their original state before returning):
``CMAKE_FIND_PACKAGE_NAME``
The ``<PackageName>`` which is searched for
@@ -774,3 +937,46 @@ configuration file to handle components in a way that makes sense
for the package. The package configuration file may set
``<PackageName>_FOUND`` to false to tell ``find_package`` that component
requirements are not satisfied.
+
+.. _CPS: https://cps-org.github.io/cps/
+.. |CPS| replace:: Common Package Specification
+
+.. _cps-compat_version: https://cps-org.github.io/cps/schema.html#compat-version
+.. |cps-compat_version| replace:: ``compat_version``
+
+.. _cps-version_schema: https://cps-org.github.io/cps/schema.html#version-schema
+.. |cps-version_schema| replace:: ``version_schema``
+
+CPS Transitive Requirements
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A |CPS| package description consists of one or more components which may in
+turn depend on other components either internal or external to the package.
+When external components are required, the providing package is noted as
+a package-level requirement of the package. Additionally, the set of required
+components is typically noted in said external package requirement.
+
+Where a CMake-script package description would use the
+:command:`find_dependency` command to handle transitive dependencies, CMake
+handles transitive dependencies for CPS itself using an internally nested
+``find_package`` call. This call can resolve CPS package dependencies via
+*either* another CPS package, or via a CMake-script package. The manner in
+which the CPS component dependencies are handled is subject to some caveats.
+
+When the candidate for resolving a transitive dependency is another CPS
+package, things are simple; ``COMPONENTS`` and CPS "components" are directly
+comparable (and are effectively synonymous with CMake "imported targets").
+CMake-script packages, however, are encouraged to (and often do) check that
+required components were found, whether or not the package describes separate
+components. Additionally, even those that do describe components typically do
+not have the same correlation to imported targets that is normal for CPS. As
+a result, passing the set of required components declared by a CPS package to
+``COMPONENTS`` would result in spurious failures to resolve dependencies.
+
+To address this, if a candidate for resolving a CPS transitive dependency is a
+CMake-script package, CMake passes the required components as declared by the
+consuming CPS package as ``OPTIONAL_COMPONENTS`` and performs a separate,
+internal check that the candidate package supplied the required imported
+targets. Those targets must be named ``<PackageName>::<ComponentName>``, in
+conformance with CPS convention, or the check will consider the package not
+found.
diff --git a/Help/command/fltk_wrap_ui.rst b/Help/command/fltk_wrap_ui.rst
index 6675272..448354e 100644
--- a/Help/command/fltk_wrap_ui.rst
+++ b/Help/command/fltk_wrap_ui.rst
@@ -6,7 +6,7 @@ Create FLTK user interfaces Wrappers.
.. code-block:: cmake
fltk_wrap_ui(resultingLibraryName source1
- source2 ... sourceN )
+ source2 ... sourceN)
Produce .h and .cxx files for all the .fl and .fld files listed. The
resulting .h and .cxx files will be added to a variable named
diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst
index c3fdbf7..52ce7f4 100644
--- a/Help/command/foreach.rst
+++ b/Help/command/foreach.rst
@@ -105,6 +105,8 @@ iteration variables as follows:
- if any of the lists are shorter, the corresponding iteration
variable is not defined for the current iteration.
+.. noqa: spellcheck off
+
.. code-block:: cmake
list(APPEND English one two three four)
@@ -129,6 +131,8 @@ yields::
-- en=three, ba=tiga
-- en=four, ba=
+.. noqa: spellcheck on
+
See Also
^^^^^^^^
diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst
index 7d74a33..87ed6bc 100644
--- a/Help/command/get_filename_component.rst
+++ b/Help/command/get_filename_component.rst
@@ -20,15 +20,13 @@ Get a specific component of a full filename.
Sets ``<var>`` to a component of ``<FileName>``, where ``<mode>`` is one of:
-::
-
- DIRECTORY = Directory without file name
- NAME = File name without directory
- EXT = File name longest extension (.b.c from d/a.b.c)
- NAME_WE = File name with neither the directory nor the longest extension
- LAST_EXT = File name last extension (.c from d/a.b.c)
- NAME_WLE = File name with neither the directory nor the last extension
- PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11)
+* ``DIRECTORY`` - directory without file name.
+* ``NAME`` - file name without directory.
+* ``EXT`` - file name longest extension (``.b.c`` from ``d/a.b.c``).
+* ``NAME_WE`` - file name with neither the directory nor the longest extension.
+* ``LAST_EXT`` - file name last extension (``.c`` from ``d/a.b.c``).
+* ``NAME_WLE`` - file name with neither the directory nor the last extension.
+* ``PATH`` - legacy alias for ``DIRECTORY`` (use for CMake <= 2.8.11).
.. versionadded:: 3.14
Added the ``LAST_EXT`` and ``NAME_WLE`` modes.
@@ -46,10 +44,8 @@ added to the cache.
Sets ``<var>`` to the absolute path of ``<FileName>``, where ``<mode>`` is one
of:
-::
-
- ABSOLUTE = Full path to file
- REALPATH = Full path to existing file with symlinks resolved
+* ``ABSOLUTE`` - full path to file.
+* ``REALPATH`` - full path to existing file with symlinks resolved.
If the provided ``<FileName>`` is a relative path, it is evaluated relative
to the given base directory ``<dir>``. If no base directory is
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 9eaf6da..4fed570 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -87,9 +87,9 @@ Basic Expressions
A quoted string always evaluates to false unless:
* The string's value is one of the true constants, or
- * Policy :policy:`CMP0054` is not set to ``NEW`` and the string's value
- happens to be a variable name that is affected by :policy:`CMP0054`'s
- behavior.
+ * in CMake versions prior to 4.0, policy :policy:`CMP0054` is not set
+ to ``NEW`` and the string's value happens to be a variable name that
+ is affected by :policy:`CMP0054`'s behavior.
Logic Operators
"""""""""""""""
@@ -149,7 +149,7 @@ Existence Checks
does not matter. Note the following caveats:
* Macro arguments are not variables.
- * It is not possible to test directly whether a `<name>` is a non-cache
+ * It is not possible to test directly whether a ``<name>`` is a non-cache
variable. The expression ``if(DEFINED someName)`` will evaluate to true
if either a cache or non-cache variable ``someName`` exists. In
comparison, the expression ``if(DEFINED CACHE{someName})`` will only
@@ -390,11 +390,13 @@ Path Comparisons
.. versionadded:: 3.24
- Compares the two paths component-by-component. Only if every component of
- both paths match will the two paths compare equal. Multiple path separators
- are effectively collapsed into a single separator, but note that backslashes
- are not converted to forward slashes. No other
- :ref:`path normalization <Normalization>` is performed.
+ Lexicographically compares two CMake paths component-by-component without
+ accessing the filesystem. Only if every component of both paths match will
+ the two paths compare equal. Multiple path separators are effectively
+ collapsed into a single separator, but note that backslashes are not
+ converted to forward slashes.
+ No other :ref:`path normalization <Normalization>` is performed.
+ Trailing slashes are preserved, thus ``/a/b`` and ``/a/b/`` are not equal.
Component-wise comparison is superior to string-based comparison due to the
handling of multiple path separators. In the following example, the
diff --git a/Help/command/include_regular_expression.rst b/Help/command/include_regular_expression.rst
index dde8378..99fd171 100644
--- a/Help/command/include_regular_expression.rst
+++ b/Help/command/include_regular_expression.rst
@@ -10,9 +10,7 @@ Set the regular expression used for dependency checking.
Sets the regular expressions used in dependency checking. Only files
matching ``regex_match`` will be traced as dependencies. Only files
matching ``regex_complain`` will generate warnings if they cannot be found
-(standard header paths are not searched). The defaults are:
+(standard header paths are not searched).
-::
-
- regex_match = "^.*$" (match everything)
- regex_complain = "^$" (match empty string only)
+The default for ``regex_match`` is ``"^.*$"`` (match everything).
+The default for ``regex_complain`` is ``"^$"`` (match empty string only).
diff --git a/Help/command/install.rst b/Help/command/install.rst
index a0e6a08..f3262a0 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -111,6 +111,11 @@ signatures that specify them. The common options are:
created. The default component name may be controlled with the
:variable:`CMAKE_INSTALL_DEFAULT_COMPONENT_NAME` variable.
+ Installation components can be then used by the ``cmake --install`` command's
+ :option:`--component <cmake--install --component>` option and the
+ :module:`CPackComponent` module. Global target ``list_install_components``
+ lists all available components.
+
``EXCLUDE_FROM_ALL``
.. versionadded:: 3.6
@@ -783,7 +788,7 @@ Signatures
.. code-block:: cmake
- install(CODE "MESSAGE(\"Sample install message.\")")
+ install(CODE "message(\"Sample install message.\")")
will print a message during installation.
diff --git a/Help/command/list.rst b/Help/command/list.rst
index 47d96a7..0110021 100644
--- a/Help/command/list.rst
+++ b/Help/command/list.rst
@@ -134,8 +134,8 @@ For more information on regular expressions look under
list(INSERT <list> <element_index> <element> [<element> ...])
Inserts elements to the list to the specified index. It is an
- error to specify an out-of-range index. Valid indexes are 0 to `N`
- where `N` is the length of the list, inclusive. An empty list
+ error to specify an out-of-range index. Valid indexes are *0* to *N*
+ where *N* is the length of the list, inclusive. An empty list
has length 0. If no variable named ``<list>`` exists in the
current scope its value is treated as empty and the elements are
inserted in that empty list.
@@ -146,8 +146,8 @@ For more information on regular expressions look under
.. versionadded:: 3.15
If no variable name is given, removes exactly one element. Otherwise,
- with `N` variable names provided, assign the last `N` elements' values
- to the given variables and then remove the last `N` values from
+ with *N* variable names provided, assign the last *N* elements' values
+ to the given variables and then remove the last *N* values from
``<list>``.
.. signature::
@@ -156,8 +156,8 @@ For more information on regular expressions look under
.. versionadded:: 3.15
If no variable name is given, removes exactly one element. Otherwise,
- with `N` variable names provided, assign the first `N` elements' values
- to the given variables and then remove the first `N` values from
+ with *N* variable names provided, assign the first *N* elements' values
+ to the given variables and then remove the first *N* values from
``<list>``.
.. signature::
@@ -236,7 +236,7 @@ For more information on regular expressions look under
list(TRANSFORM <list> GENEX_STRIP ...)
:target: TRANSFORM_GENEX_STRIP
- :command:`REPLACE <string(REGEX REPLACE)>`:
+ :command:`REPLACE <string(REGEX REPLACE)>`
Match the regular expression as many times as possible and substitute
the replacement expression for the match for each element of the list
(same semantic as :command:`string(REGEX REPLACE)`).
@@ -307,10 +307,10 @@ Ordering
Sorts a list of strings using natural order
(see ``strverscmp(3)`` manual), i.e. such that contiguous digits
are compared as whole numbers.
- For example: the following list `10.0 1.1 2.1 8.0 2.0 3.1`
- will be sorted as `1.1 2.0 2.1 3.1 8.0 10.0` if the ``NATURAL``
+ For example: the following list *10.0 1.1 2.1 8.0 2.0 3.1*
+ will be sorted as *1.1 2.0 2.1 3.1 8.0 10.0* if the ``NATURAL``
comparison is selected where it will be sorted as
- `1.1 10.0 2.0 2.1 3.1 8.0` with the ``STRING`` comparison.
+ *1.1 10.0 2.0 2.1 3.1 8.0* with the ``STRING`` comparison.
Use the ``CASE`` keyword to select a case sensitive or case insensitive
sort mode. The ``<case>`` option should be one of:
diff --git a/Help/command/load_cache.rst b/Help/command/load_cache.rst
index b89eb61..86d1e85 100644
--- a/Help/command/load_cache.rst
+++ b/Help/command/load_cache.rst
@@ -1,26 +1,110 @@
load_cache
----------
-Load in the values from another project's CMake cache.
+Load in the values from another project's ``CMakeCache.txt`` cache file. This
+is useful for projects that depend on another project built in a separate
+directory tree.
+
+This command has two signatures. The recommended signature is:
+
+.. signature::
+ load_cache(<build-dir> READ_WITH_PREFIX <prefix> <entry>...)
+ :target: READ_WITH_PREFIX
+
+ Loads the cache file from the specified ``<build-dir>`` build directory and
+ retrieves the listed cache entries. The retrieved values are stored in local
+ variables, with their names prefixed by the provided ``<prefix>``. This only
+ reads the cache values; it does not create or modify entries in the local
+ project's cache.
+
+ ``READ_WITH_PREFIX <prefix>``
+ For each cache ``<entry>``, a local variable is created using the specified
+ ``<prefix>`` followed by the entry name.
+
+ This signature can be also used in :option:`cmake -P` script mode.
+
+The following signature of this command is strongly discouraged, but it is
+provided for backward compatibility:
+
+.. signature::
+ load_cache(<build-dir> [EXCLUDE <entry>...] [INCLUDE_INTERNALS <entry>...])
+ :target: raw
+
+ This form loads the cache file from the specified ``<build-dir>`` build
+ directory and imports all its non-internal cache entries into the local
+ project's cache as internal cache variables. By default, only non-internal
+ entries are imported, unless the ``INCLUDE_INTERNALS`` option is used.
+
+ The options are:
+
+ ``EXCLUDE <entry>...``
+ This option can be used to exclude a given list of non-internal cache
+ entries when importing values.
+ ``INCLUDE_INTERNALS <entry>...``
+ This option can be used to provide a list of internal cache entries to
+ include in addition to the non-internal cache entries.
+
+ This signature can be used only in CMake projects. Script mode is not
+ supported.
+
+.. note::
+
+ Instead of loading the outside project's cache file and manually accessing
+ variables, a more robust and convenient approach is to use the
+ :command:`export` command in the outside project, when available. This allows
+ the project to provide its targets, configuration, or features in a
+ structured and maintainable way, making integration simpler and less
+ error-prone.
+
+Examples
+^^^^^^^^
+
+Reading specific cache variables from another project and storing them as local
+variables:
.. code-block:: cmake
- load_cache(pathToBuildDirectory READ_WITH_PREFIX prefix entry1...)
+ load_cache(
+ path/to/other-project/build-dir
+ READ_WITH_PREFIX prefix_
+ OTHER_PROJECT_CACHE_VAR_1
+ OTHER_PROJECT_CACHE_VAR_2
+ )
+
+ message(STATUS "${prefix_OTHER_PROJECT_CACHE_VAR_1")
+ message(STATUS "${prefix_OTHER_PROJECT_CACHE_VAR_2")
+ # Outputs:
+ # -- some-value...
+ # -- another-value...
-Reads the cache and store the requested entries in variables with their
-name prefixed with the given prefix. This only reads the values, and
-does not create entries in the local project's cache.
+Reading all non-internal cache entries from another project and storing them as
+internal cache variables using the obsolete signature:
.. code-block:: cmake
- load_cache(pathToBuildDirectory [EXCLUDE entry1...]
- [INCLUDE_INTERNALS entry1...])
-
-Loads in the values from another cache and store them in the local
-project's cache as internal entries. This is useful for a project
-that depends on another project built in a different tree. ``EXCLUDE``
-option can be used to provide a list of entries to be excluded.
-``INCLUDE_INTERNALS`` can be used to provide a list of internal entries to
-be included. Normally, no internal entries are brought in. Use of
-this form of the command is strongly discouraged, but it is provided
-for backward compatibility.
+ load_cache(path/to/other-project/build-dir)
+
+ message(STATUS "${OTHER_PROJECT_CACHE_VAR_1")
+ message(STATUS "${OTHER_PROJECT_CACHE_VAR_2")
+ # Outputs:
+ # -- some-value...
+ # -- another-value...
+
+Excluding specific non-internal cache entries and including internal ones using
+the obsolete signature:
+
+.. code-block:: cmake
+
+ load_cache(
+ path/to/other-project/build-dir
+ EXCLUDE OTHER_PROJECT_CACHE_VAR_2
+ INCLUDE_INTERNALS OTHER_PROJECT_INTERNAL_CACHE_VAR
+ )
+
+ message(STATUS "${OTHER_PROJECT_CACHE_VAR_1")
+ message(STATUS "${OTHER_PROJECT_CACHE_VAR_2")
+ message(STATUS "${OTHER_PROJECT_INTERNAL_CACHE_VAR}")
+ # Outputs:
+ # -- some-value...
+ # --
+ # -- some-internal-value...
diff --git a/Help/command/load_command.rst b/Help/command/load_command.rst
index 4b3888f..16516b4 100644
--- a/Help/command/load_command.rst
+++ b/Help/command/load_command.rst
@@ -14,10 +14,6 @@ cmCOMMAND_NAME. If found, it is loaded as a module and the command is
added to the set of available CMake commands. Usually,
:command:`try_compile` is used before this command to compile the
module. If the command is successfully loaded a variable named
-
-.. code-block:: cmake
-
- CMAKE_LOADED_COMMAND_<COMMAND_NAME>
-
+``CMAKE_LOADED_COMMAND_<COMMAND_NAME>``
will be set to the full path of the module that was loaded. Otherwise
the variable will not be set.
diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst
index 4f0b25e..b9148f0 100644
--- a/Help/command/separate_arguments.rst
+++ b/Help/command/separate_arguments.rst
@@ -45,8 +45,8 @@ be one of the following keywords:
``<variable>`` will be empty. Otherwise, ``<variable>`` is a list of 2
elements:
- 0. Absolute path of the program
- 1. Any command-line arguments present in ``<args>`` as a string
+ 0. Absolute path of the program
+ 1. Any command-line arguments present in ``<args>`` as a string
For example:
diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst
index d937b33..869f200 100644
--- a/Help/command/set_source_files_properties.rst
+++ b/Help/command/set_source_files_properties.rst
@@ -19,17 +19,17 @@ list.
same directory (``CMakeLists.txt``). Visibility can be set in other directory
scopes using one or both of the following options:
-``DIRECTORY <dirs>...``
- The source file properties will be set in each of the ``<dirs>``
- directories' scopes. CMake must already know about each of these
- source directories, either by having added them through a call to
- :command:`add_subdirectory` or it being the top level source directory.
- Relative paths are treated as relative to the current source directory.
-
-``TARGET_DIRECTORY <targets>...``
- The source file properties will be set in each of the directory scopes
- where any of the specified ``<targets>`` were created (the ``<targets>``
- must therefore already exist).
+ ``DIRECTORY <dirs>...``
+ The source file properties will be set in each of the ``<dirs>``
+ directories' scopes. CMake must already know about each of these
+ source directories, either by having added them through a call to
+ :command:`add_subdirectory` or it being the top level source directory.
+ Relative paths are treated as relative to the current source directory.
+
+ ``TARGET_DIRECTORY <targets>...``
+ The source file properties will be set in each of the directory scopes
+ where any of the specified ``<targets>`` were created (the ``<targets>``
+ must therefore already exist).
Use :command:`get_source_file_property` to get property values.
See also the :command:`set_property(SOURCE)` command.
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 6bd56a1..e9de32e 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -163,11 +163,15 @@ The following characters have special meaning in regular expressions:
:command:`if(MATCHES)`, save subgroup matches in the variables
:variable:`CMAKE_MATCH_<n>` for ``<n>`` 0..9.
+.. noqa: spellcheck off
+
``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|``
has lower precedence than concatenation. This means that the regular
expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular
expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``.
+.. noqa: spellcheck on
+
CMake language :ref:`Escape Sequences` such as ``\t``, ``\r``, ``\n``,
and ``\\`` may be used to construct literal tabs, carriage returns,
newlines, and backslashes (respectively) to pass in a regex. For example:
@@ -474,10 +478,8 @@ Generation
If no explicit ``<format_string>`` is given, it will default to:
- ::
-
- %Y-%m-%dT%H:%M:%S for local time.
- %Y-%m-%dT%H:%M:%SZ for UTC.
+ * ``%Y-%m-%dT%H:%M:%S`` for local time.
+ * ``%Y-%m-%dT%H:%M:%SZ`` for UTC.
.. versionadded:: 3.8
If the ``SOURCE_DATE_EPOCH`` environment variable is set,
@@ -519,6 +521,10 @@ Functionality for querying a JSON string.
option is not present, a fatal error message is generated. If no error
occurs, the ``<error-variable>`` will be set to ``NOTFOUND``.
+In the following subcommands, the ``<json-string>`` argument should
+be written as a :ref:`Quoted Argument` to ensure the entire JSON
+string is passed as a single argument even if it contains semicolons.
+
.. signature::
string(JSON <out-var> [ERROR_VARIABLE <error-variable>]
GET <json-string> <member|index> [<member|index> ...])
diff --git a/Help/command/subdirs.rst b/Help/command/subdirs.rst
index ecc6d1f..2c42a0b 100644
--- a/Help/command/subdirs.rst
+++ b/Help/command/subdirs.rst
@@ -10,7 +10,7 @@ Add a list of subdirectories to the build.
.. code-block:: cmake
subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...]
- [PREORDER] )
+ [PREORDER])
Add a list of subdirectories to the build. The :command:`add_subdirectory`
command should be used instead of ``subdirs`` although ``subdirs`` will still
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index 94a2429..ab01307 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -59,7 +59,8 @@ Each ``<item>`` may be:
There are some cases where CMake may ask the linker to search for
the library (e.g. ``/usr/lib/libfoo.so`` becomes ``-lfoo``), such
as when a shared library is detected to have no ``SONAME`` field.
- See policy :policy:`CMP0060` for discussion of another case.
+ In CMake versions prior to 4.0, see policy :policy:`CMP0060` for
+ discussion of another case.
If the library file is in a macOS framework, the ``Headers`` directory
of the framework will also be processed as a
@@ -119,9 +120,6 @@ Each ``<item>`` may be:
Additionally, a generator expression may be used as a fragment of
any of the above items, e.g. ``foo$<1:_d>``.
- Note that generator expressions will not be used in OLD handling of
- policy :policy:`CMP0003` or policy :policy:`CMP0004`.
-
* A ``debug``, ``optimized``, or ``general`` keyword immediately followed
by another ``<item>``. The item following such a keyword will be used
only for the corresponding build configuration. The ``debug`` keyword
@@ -148,6 +146,8 @@ command lines.
See the :manual:`cmake-buildsystem(7)` manual for more on defining
buildsystem properties.
+.. include:: ../command/LINK_LIBRARIES_LINKER.txt
+
Libraries for a Target and/or its Dependents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -179,8 +179,10 @@ When this target is linked into another target then the libraries
linked to this target will appear on the link line for the other
target too. This transitive "link interface" is stored in the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property and may be overridden
-by setting the property directly. When :policy:`CMP0022` is not set to
-``NEW``, transitive linking is built in but may be overridden by the
+by setting the property directly.
+
+In CMake versions prior to 4.0, if :policy:`CMP0022` is not set to ``NEW``,
+transitive linking is built in but may be overridden by the
:prop_tgt:`LINK_INTERFACE_LIBRARIES` property. Calls to other signatures
of this command may set the property making any libraries linked
exclusively by this signature private.
@@ -188,6 +190,9 @@ exclusively by this signature private.
Libraries for a Target and/or its Dependents (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This signature is for compatibility only. Prefer the ``PUBLIC`` or
+``PRIVATE`` keywords instead.
+
.. code-block:: cmake
target_link_libraries(<target>
@@ -197,44 +202,34 @@ Libraries for a Target and/or its Dependents (Legacy)
The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both
the link dependencies and the link interface in one command.
-This signature is for compatibility only. Prefer the ``PUBLIC`` or
-``PRIVATE`` keywords instead.
-
Libraries and targets following ``LINK_PUBLIC`` are linked to, and are
-made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy
-:policy:`CMP0022` is not ``NEW``, they are also made part of the
-:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following
-``LINK_PRIVATE`` are linked to, but are not made part of the
-:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`).
+made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
+
+In CMake versions prior to 4.0, if policy :policy:`CMP0022` is not ``NEW``,
+they are also made part of the :prop_tgt:`LINK_INTERFACE_LIBRARIES`.
+Libraries and targets following ``LINK_PRIVATE`` are linked to, but are
+not made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`
+(or :prop_tgt:`LINK_INTERFACE_LIBRARIES`).
Libraries for Dependents Only (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This signature is for compatibility only. Prefer the ``INTERFACE`` mode
+instead.
+
.. code-block:: cmake
target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...)
The ``LINK_INTERFACE_LIBRARIES`` mode appends the libraries to the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property instead of using them
-for linking. If policy :policy:`CMP0022` is not ``NEW``, then this mode
-also appends libraries to the :prop_tgt:`LINK_INTERFACE_LIBRARIES` and its
-per-configuration equivalent.
+for linking.
-This signature is for compatibility only. Prefer the ``INTERFACE`` mode
-instead.
+In CMake versions prior to 4.0, if policy :policy:`CMP0022` is not ``NEW``,
+then this mode also appends libraries to the
+:prop_tgt:`LINK_INTERFACE_LIBRARIES` and its per-configuration equivalent.
-Libraries specified as ``debug`` are wrapped in a generator expression to
-correspond to debug builds. If policy :policy:`CMP0022` is
-not ``NEW``, the libraries are also appended to the
-:prop_tgt:`LINK_INTERFACE_LIBRARIES_DEBUG <LINK_INTERFACE_LIBRARIES_<CONFIG>>`
-property (or to the properties corresponding to configurations listed in
-the :prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set).
-Libraries specified as ``optimized`` are appended to the
-:prop_tgt:`INTERFACE_LINK_LIBRARIES` property. If policy :policy:`CMP0022`
-is not ``NEW``, they are also appended to the
-:prop_tgt:`LINK_INTERFACE_LIBRARIES` property. Libraries specified as
-``general`` (or without any keyword) are treated as if specified for both
-``debug`` and ``optimized``.
+.. _`Linking Object Libraries`:
Linking Object Libraries
^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 30ab41a..181e850 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -92,10 +92,11 @@ Try Compiling Source Files
.. versionadded:: 3.25
-Try building an executable or static library from one or more source files
-(which one is determined by the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE`
-variable). Build success returns ``TRUE`` and build failure returns ``FALSE``
-in ``<compileResultVar>``.
+Try building an executable or static library from one or more source files.
+The binary type is determined by variable
+:variable:`CMAKE_TRY_COMPILE_TARGET_TYPE`.
+Build success returns boolean ``true`` and build failure returns boolean
+``false`` in ``<compileResultVar>`` (cached unless ``NO_CACHE`` is specified).
In this form, one or more source files must be provided. Additionally, one of
``SOURCES`` and/or ``SOURCE_FROM_*`` must precede other keywords.
@@ -163,7 +164,7 @@ The options for the above signatures are:
The above example shows how values for variables
``COMPILE_DEFINITIONS``, ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``,
``LINK_LIBRARIES``, and ``LINK_OPTIONS`` are used. Compiler options
- can be passed in like `CMAKE_FLAGS -DCOMPILE_DEFINITIONS=-Werror`.
+ can be passed in like ``CMAKE_FLAGS -DCOMPILE_DEFINITIONS=-Werror``.
``COMPILE_DEFINITIONS <defs>...``
Specify ``-Ddefinition`` arguments to pass to :command:`add_definitions`
@@ -211,9 +212,10 @@ The options for the above signatures are:
``NO_CACHE``
.. versionadded:: 3.25
- The result will be stored in a normal variable rather than a cache entry.
+ ``<compileResultVar>`` will be stored in a normal variable rather than a
+ cache entry.
- The result variable is normally cached so that a simple pattern can be used
+ ``<compileResultVar>`` is normally cached so that a simple pattern can be used
to avoid repeating the test on subsequent executions of CMake:
.. code-block:: cmake
@@ -318,23 +320,40 @@ Other Behavior Settings
* :variable:`CMAKE_CUDA_RUNTIME_LIBRARY`
* :variable:`CMAKE_ENABLE_EXPORTS`
+ * :variable:`CMAKE_EXE_LINKER_FLAGS`, unless using CMake versions
+ prior to 4.0 without policy :policy:`CMP0056` set to ``NEW``
* :variable:`CMAKE_LINK_SEARCH_START_STATIC`
* :variable:`CMAKE_LINK_SEARCH_END_STATIC`
* :variable:`CMAKE_MSVC_RUNTIME_LIBRARY`
* :variable:`CMAKE_POSITION_INDEPENDENT_CODE`
* :variable:`CMAKE_WATCOM_RUNTIME_LIBRARY`
- If :policy:`CMP0056` is set to ``NEW``, then
- :variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well.
-
.. versionchanged:: 3.14
If :policy:`CMP0083` is set to ``NEW``, then in order to obtain correct
behavior at link time, the ``check_pie_supported()`` command from the
:module:`CheckPIESupported` module must be called before using the
``try_compile`` command.
-The current settings of :policy:`CMP0065` and :policy:`CMP0083` are propagated
-through to the generated test project.
+Some policies are set automatically in the generated test project
+as needed to honor the state of the calling project:
+
+* :policy:`CMP0065` (in CMake versions prior to 4.0)
+* :policy:`CMP0083`
+* :policy:`CMP0091`
+* :policy:`CMP0104`
+* :policy:`CMP0123`
+* :policy:`CMP0126`
+* :policy:`CMP0128`
+* :policy:`CMP0136`
+* :policy:`CMP0141`
+* :policy:`CMP0155`
+* :policy:`CMP0157`
+* :policy:`CMP0181`
+* :policy:`CMP0184`
+
+.. versionadded:: 4.0
+ The current setting of :policy:`CMP0181` policy is propagated through to the
+ generated test project.
Set variable :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` to choose a build
configuration:
@@ -399,6 +418,11 @@ configuration:
propagated into the test project's build configuration when using the
:ref:`whole-project signature <Try Compiling Whole Projects>`.
+.. versionadded:: 4.0
+ If :policy:`CMP0184` is set to ``NEW``, one can use
+ :variable:`CMAKE_MSVC_RUNTIME_CHECKS` to specify the enabled MSVC runtime
+ checks.
+
See Also
^^^^^^^^
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index c466a81..f14a5c2 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -40,13 +40,14 @@ Try Compiling and Running Source Files
.. versionadded:: 3.25
Try building an executable from one or more source files. Build success
-returns ``TRUE`` and build failure returns ``FALSE`` in ``<compileResultVar>``.
-If the build succeeds, this runs the executable and stores the exit code in
-``<runResultVar>``. If the executable was built, but failed to run, then
-``<runResultVar>`` will be set to ``FAILED_TO_RUN``. See command
-:command:`try_compile` for documentation of options common to both commands,
-and for information on how the test project is constructed to build the source
-file.
+returns boolean ``true`` and build failure returns boolean ``false`` in
+``<compileResultVar>`` (cached unless ``NO_CACHE`` is specified).
+If the build succeeds, this runs the executable and stores the exit code
+in ``<runResultVar>`` (cached unless ``NO_CACHE`` is specified).
+If the executable was built, but failed to run, then ``<runResultVar>``
+will be set to ``FAILED_TO_RUN``. See command :command:`try_compile` for
+documentation of options common to both commands, and for information on
+how the test project is constructed to build the source file.
One or more source files must be provided. Additionally, one of ``SOURCES``
and/or ``SOURCE_FROM_*`` must precede other keywords.
diff --git a/Help/cpack_gen/archive.rst b/Help/cpack_gen/archive.rst
index 5836f91..81da98b 100644
--- a/Help/cpack_gen/archive.rst
+++ b/Help/cpack_gen/archive.rst
@@ -4,19 +4,29 @@ CPack Archive Generator
CPack generator for packaging files into an archive, which can have
any of the following formats:
- - 7Z - 7zip - (``.7z``)
- - TBZ2 (``.tar.bz2``)
- - TGZ (``.tar.gz``)
- - TXZ (``.tar.xz``)
- - TZ (``.tar.Z``)
- - TZST (``.tar.zst``)
- - ZIP (``.zip``)
+- 7Z - 7zip - (``.7z``)
-.. versionadded:: 3.1
- 7Z and TXZ formats support.
+ .. versionadded:: 3.1
-.. versionadded:: 3.16
- TZST format support.
+- TAR (``.tar``)
+
+ .. versionadded:: 4.0
+
+- TBZ2 (``.tar.bz2``)
+
+- TGZ (``.tar.gz``)
+
+- TXZ (``.tar.xz``)
+
+ .. versionadded:: 3.1
+
+- TZ (``.tar.Z``)
+
+- TZST (``.tar.zst``)
+
+ .. versionadded:: 3.16
+
+- ZIP (``.zip``)
When this generator is called from ``CPackSourceConfig.cmake`` (or through
the ``package_source`` target), then the generated archive will contain all
@@ -45,25 +55,39 @@ Variables specific to CPack Archive generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. variable:: CPACK_ARCHIVE_FILE_NAME
- CPACK_ARCHIVE_<component>_FILE_NAME
- Package file name without extension.
+ .. versionadded:: 3.9
- :Default: The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces
- replaced by '-'.
+ Archive name for component-based packages, without extension.
- The extension is determined from the archive format (see list above) and
- automatically appended to the file name. Note that ``<component>`` is all
- uppercase in the variable name.
+ :Default: :variable:`CPACK_PACKAGE_FILE_NAME`
+
+ The extension is appended automatically.
+
+ If :variable:`CPACK_COMPONENTS_GROUPING` is set to ``ALL_COMPONENTS_IN_ONE``,
+ this will be the name of the one output archive.
+
+ .. versionchanged:: 4.0
+
+ This variable also works for non-component packages.
+
+.. variable:: CPACK_ARCHIVE_<component>_FILE_NAME
.. versionadded:: 3.9
- Per-component :variable:`!CPACK_ARCHIVE_<component>_FILE_NAME` variables.
+
+ Component archive name without extension.
+
+ :Default: ``<CPACK_ARCHIVE_FILE_NAME>-<component>``, with spaces replaced
+ by ``'-'``.
+
+ The extension is appended automatically. Note that ``<component>`` is all
+ uppercase in the variable name.
.. variable:: CPACK_ARCHIVE_FILE_EXTENSION
.. versionadded:: 3.25
- Package file extension.
+ Archive file extension.
:Default: Default values are given in the list above.
@@ -87,10 +111,10 @@ CPack generators which are essentially archives at their core. These include:
.. variable:: CPACK_ARCHIVE_THREADS
- The number of threads to use when performing the compression.
-
.. versionadded:: 3.18
+ The number of threads to use when performing the compression.
+
:Default: value of :variable:`CPACK_THREADS`
If set to ``0``, the number of available cores on the machine will be used instead.
diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst
index 15f94dc..ce7a3e8 100644
--- a/Help/cpack_gen/deb.rst
+++ b/Help/cpack_gen/deb.rst
@@ -25,8 +25,8 @@ or a component GROUP name.
Here are some CPack DEB generator wiki resources that are here for historic
reasons and are no longer maintained but may still prove useful:
- - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Configuration
- - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators#deb-unix-only
+- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Configuration
+- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators#deb-unix-only
List of CPack DEB generator specific variables:
@@ -398,7 +398,7 @@ List of CPack DEB generator specific variables:
.. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
- Sets the `Pre-Depends` field of the Debian package.
+ Sets the ``Pre-Depends`` field of the Debian package.
Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
also forces ``dpkg`` to complete installation of the packages named
before even starting the installation of the package which declares the
@@ -462,8 +462,8 @@ List of CPack DEB generator specific variables:
.. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
- Sets the `Conflicts` field of the Debian package.
- When one binary package declares a conflict with another using a `Conflicts`
+ Sets the ``Conflicts`` field of the Debian package.
+ When one binary package declares a conflict with another using a ``Conflicts``
field, ``dpkg`` will not allow them to be unpacked on the system at
the same time.
@@ -490,8 +490,8 @@ List of CPack DEB generator specific variables:
.. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
- Sets the `Provides` field of the Debian package.
- A virtual package is one which appears in the `Provides` control field of
+ Sets the ``Provides`` field of the Debian package.
+ A virtual package is one which appears in the ``Provides`` control field of
another package.
:Mandatory: No
@@ -509,7 +509,7 @@ List of CPack DEB generator specific variables:
.. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
- Sets the `Replaces` field of the Debian package.
+ Sets the ``Replaces`` field of the Debian package.
Packages can declare in their control file that they should overwrite
files in certain other packages, or completely replace other packages.
@@ -547,7 +547,7 @@ List of CPack DEB generator specific variables:
.. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
- Sets the `Suggests` field of the Debian package.
+ Sets the ``Suggests`` field of the Debian package.
Allows packages to declare a suggested package install grouping.
:Mandatory: No
@@ -668,7 +668,7 @@ List of CPack DEB generator specific variables:
.. variable:: CPACK_DEBIAN_PACKAGE_MULTIARCH
CPACK_DEBIAN_<COMPONENT>_PACKAGE_MULTIARCH
- Sets the `Multi-Arch` field of the Debian package.
+ Sets the ``Multi-Arch`` field of the Debian package.
Packages can declare in their control file how they should handle
situations, where packages for different architectures are being installed
on the same machine.
diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst
index 68f8792..9687281 100644
--- a/Help/cpack_gen/ifw.rst
+++ b/Help/cpack_gen/ifw.rst
@@ -349,12 +349,12 @@ Package
Archive compression level. The allowable values are:
- * 0 (*No compression*)
- * 1 (*Fastest compression*)
- * 3 (*Fast compression*)
- * 5 (*Normal compression*)
- * 7 (*Maximum compression*)
- * 9 (*Ultra compression*)
+ * 0 (*No compression*)
+ * 1 (*Fastest compression*)
+ * 3 (*Fast compression*)
+ * 5 (*Normal compression*)
+ * 7 (*Maximum compression*)
+ * 9 (*Ultra compression*)
If this variable is not set, QtIFW will use a default compression level,
which will typically be 5 (*Normal compression*).
@@ -469,7 +469,7 @@ a remote server.
The ``DOWNLOADED`` option in the :command:`cpack_add_component` command
specifies that a component is to be downloaded. Alternatively, the ``ALL``
option in the :command:`cpack_configure_downloads` command specifies that
-`all` components are to be be downloaded.
+``all`` components are to be be downloaded.
The :command:`cpack_ifw_add_repository` command and the
:variable:`CPACK_IFW_DOWNLOAD_ALL` variable allow for more specific
diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst
index df306c2..458ed93 100644
--- a/Help/cpack_gen/nsis.rst
+++ b/Help/cpack_gen/nsis.rst
@@ -61,7 +61,7 @@ on Windows Nullsoft Scriptable Install System.
.. variable:: CPACK_NSIS_COMPRESSOR
- The arguments that will be passed to the NSIS `SetCompressor` command.
+ The arguments that will be passed to the NSIS ``SetCompressor`` command.
.. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL
@@ -78,8 +78,8 @@ on Windows Nullsoft Scriptable Install System.
.. variable:: CPACK_NSIS_DISPLAY_NAME
- The display name string that appears in the Windows `Apps & features`
- in `Control Panel`
+ The display name string that appears in the Windows *Apps & features*
+ in *Control Panel*
.. variable:: CPACK_NSIS_PACKAGE_NAME
@@ -111,15 +111,15 @@ on Windows Nullsoft Scriptable Install System.
.. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA
- Additional NSIS commands for creating `Start Menu` shortcuts.
+ Additional NSIS commands for creating *Start Menu* shortcuts.
.. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA
- Additional NSIS commands to uninstall `Start Menu` shortcuts.
+ Additional NSIS commands to uninstall *Start Menu* shortcuts.
.. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY
- Creating NSIS `Start Menu` links assumes that they are in ``bin`` unless this
+ Creating NSIS *Start Menu* links assumes that they are in ``bin`` unless this
variable is set. For example, you would set this to ``exec`` if your
executables are in an exec directory.
@@ -132,9 +132,11 @@ on Windows Nullsoft Scriptable Install System.
Specify links in ``[application]`` menu. This should contain a list of pair
``link`` ``link name``. The link may be a URL or a path relative to
- installation prefix. Like::
+ installation prefix. Like:
- set(CPACK_NSIS_MENU_LINKS
+ .. code-block:: cmake
+
+ set(CPACK_NSIS_MENU_LINKS
"doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html"
"CMake Help" "https://cmake.org" "CMake Web Site")
diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst
index ebd3766..0fd6964 100644
--- a/Help/cpack_gen/rpm.rst
+++ b/Help/cpack_gen/rpm.rst
@@ -22,7 +22,7 @@ https://rpm.org/documentation.
.. versionchanged:: 3.6
- `<COMPONENT>` part of variables is preferred to be in upper case (e.g. if
+ ``<COMPONENT>`` part of variables is preferred to be in upper case (e.g. if
component is named ``foo`` then use :variable:`!CPACK_RPM_FOO_XXXX` variable
name format) as is with other :variable:`!CPACK_<COMPONENT>_XXXX` variables.
For the purposes of back compatibility (CMake/CPack version 3.5 and lower)
@@ -36,8 +36,8 @@ https://rpm.org/documentation.
Here are some CPack RPM generator wiki resources that are here for historic
reasons and are no longer maintained but may still prove useful:
- - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Configuration
- - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators#rpm-unix-only
+- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Configuration
+- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators#rpm-unix-only
List of CPack RPM generator specific variables:
@@ -324,7 +324,7 @@ List of CPack RPM generator specific variables:
:Default:
May be used to set RPM dependencies (requires). Note that you must enclose
- the complete requires string between quotes, for example:
+ the entire value between quotes when setting this variable, for example:
.. code-block:: cmake
@@ -343,7 +343,8 @@ List of CPack RPM generator specific variables:
:Default:
May be used to set negative RPM dependencies (conflicts). Note that you must
- enclose the complete requires string between quotes, for example:
+ enclose the entire value between quotes when setting this variable,
+ for example:
.. code-block:: cmake
@@ -364,7 +365,8 @@ List of CPack RPM generator specific variables:
:Default:
May be used to set RPM preinstall dependencies (requires(pre)). Note that
- you must enclose the complete requires string between quotes, for example:
+ you must enclose the entire value between quotes when setting this variable,
+ for example:
.. code-block:: cmake
@@ -381,7 +383,8 @@ List of CPack RPM generator specific variables:
:Default:
May be used to set RPM postinstall dependencies (requires(post)). Note that
- you must enclose the complete requires string between quotes, for example:
+ you must enclose the entire value between quotes when setting this variable,
+ for example:
.. code-block:: cmake
@@ -398,8 +401,8 @@ List of CPack RPM generator specific variables:
:Default:
May be used to set RPM postuninstall dependencies (requires(postun)). Note
- that you must enclose the complete requires string between quotes, for
- example:
+ that you must enclose the entire value between quotes when setting this
+ variable, for example:
.. code-block:: cmake
@@ -416,7 +419,8 @@ List of CPack RPM generator specific variables:
:Default:
May be used to set RPM preuninstall dependencies (requires(preun)). Note that
- you must enclose the complete requires string between quotes, for example:
+ you must enclose the entire value between quotes when setting this variable,
+ for example:
.. code-block:: cmake
@@ -425,15 +429,15 @@ List of CPack RPM generator specific variables:
.. variable:: CPACK_RPM_PACKAGE_SUGGESTS
CPACK_RPM_<component>_PACKAGE_SUGGESTS
- RPM spec suggest field.
+ RPM spec suggests field.
:Mandatory: No
:Default:
May be used to set weak RPM dependencies (suggests). If ``rpmbuild`` doesn't
support the ``Suggests`` tag, CPack will emit a warning and ignore this
- variable. Note that you must enclose the complete requires string between
- quotes.
+ variable. Note that you must enclose the entire value between quotes when
+ setting this variable.
.. variable:: CPACK_RPM_PACKAGE_PROVIDES
CPACK_RPM_<component>_PACKAGE_PROVIDES
@@ -526,7 +530,7 @@ List of CPack RPM generator specific variables:
May be set by the user in order to specify a USER binary spec file
to be used by the CPack RPM generator instead of generating the file.
- The specified file will be processed by configure_file( @ONLY).
+ The specified file will be processed by configure_file(@ONLY).
.. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
@@ -1087,8 +1091,8 @@ Source RPM packaging has its own set of variables:
:Default:
May be used to set source RPM build dependencies (BuildRequires). Note that
- you must enclose the complete build requirements string between quotes, for
- example:
+ you must enclose the entire value between quotes when setting this variable,
+ for example:
.. code-block:: cmake
diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst
index ae4f1e7..e2003ca 100644
--- a/Help/cpack_gen/wix.rst
+++ b/Help/cpack_gen/wix.rst
@@ -3,7 +3,7 @@ CPack WIX Generator
Use the `WiX Toolset`_ to produce a Windows Installer ``.msi`` database.
-.. _`WiX Toolset`: https://wixtoolset.org/
+.. _`WiX Toolset`: https://www.firegiant.com/wixtoolset/
.. versionadded:: 3.7
The :variable:`CPACK_COMPONENT_<compName>_DISABLED` variable is now
@@ -222,7 +222,7 @@ Windows using WiX.
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:
- https://wixtoolset.org/docs/v3/wixui/wixui_localization/
+ https://docs.firegiant.com/wix3/wixui/wixui_localization/
.. variable:: CPACK_WIX_TEMPLATE
@@ -427,7 +427,7 @@ Windows using WiX.
for using WiX extensions. Each declaration should be in the form name=url, where
name is the plain namespace without the usual xmlns: prefix and url is an unquoted
namespace url. A list of commonly known WiX schemata can be found here:
- https://wixtoolset.org/docs/v3/xsd/
+ https://docs.firegiant.com/wix3/xsd/
.. variable:: CPACK_WIX_SKIP_WIX_UI_EXTENSION
@@ -486,4 +486,4 @@ Windows using WiX.
latter installer should be distributed with instructions to
first manually uninstall any older version.
- See https://wixtoolset.org/docs/v3/xsd/wix/package/
+ See https://docs.firegiant.com/wix3/xsd/wix/package/
diff --git a/Help/dev/documentation.rst b/Help/dev/documentation.rst
index 8270bb1..ada6ab4 100644
--- a/Help/dev/documentation.rst
+++ b/Help/dev/documentation.rst
@@ -629,15 +629,15 @@ reStructuredText markup from comment blocks that start in ``.rst:``.
At the top of ``Modules/<module-name>.cmake``, begin with the following
license notice:
-::
+.. code-block:: cmake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- # file Copyright.txt or https://cmake.org/licensing for details.
+ # file LICENSE.rst or https://cmake.org/licensing for details.
After this notice, add a *BLANK* line. Then, add documentation using
a `Bracket Comment`_ of the form:
-::
+.. code-block:: cmake
#[=======================================================================[.rst:
<module-name>
@@ -655,10 +655,10 @@ All such comments must start with ``#`` in the first column.
For example, a ``FindXxx.cmake`` module may contain:
-::
+.. code-block:: cmake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- # file Copyright.txt or https://cmake.org/licensing for details.
+ # file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindXxx
diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst
index 5d4c107..0b19422 100644
--- a/Help/dev/experimental.rst
+++ b/Help/dev/experimental.rst
@@ -56,6 +56,24 @@ When activated, this experimental feature provides the following:
* The experimental ``install(PACKAGE_INFO)`` command is available to export
package information in the |CPS|_ format.
+Find/Import |CPS| Packages
+==========================
+
+In order to activate support for this experimental feature, set
+
+* variable ``CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES`` to
+* value ``e82e467b-f997-4464-8ace-b00808fff261``.
+
+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 :command:`find_package` command will also search for packages which are
+ described using |CPS|_. Refer to the :command:`find_package` documentation
+ for details.
+
C++ ``import std`` support
==========================
@@ -101,3 +119,23 @@ When activated, this experimental feature provides the following:
* Targets with the property set to a true value will have their C++ build
information exported to the build database.
+
+Instrumentation
+===============
+
+In order to activate support for the :command:`cmake_instrumentation` command,
+set
+
+* variable ``CMAKE_EXPERIMENTAL_INSTRUMENTATION`` to
+* value ``a37d1069-1972-4901-b9c9-f194aaf2b6e0``.
+
+To enable instrumentation at the user-level, files should be placed under
+either
+``<CMAKE_CONFIG_DIR>/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0`` or
+``<CMAKE_BINARY_DIR>/.cmake/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0``.
+
+To include instrumentation data in CTest XML files (for submission to CDash),
+you need to set the following environment variables:
+
+* ``CTEST_USE_INSTRUMENTATION=1``
+* ``CTEST_EXPERIMENTAL_INSTRUMENTATION=a37d1069-1972-4901-b9c9-f194aaf2b6e0``
diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst
index 10b3f7d..2f4babc 100644
--- a/Help/dev/maint.rst
+++ b/Help/dev/maint.rst
@@ -302,6 +302,13 @@ Update ``Source/CMakeVersion.cmake`` to set the version to
set(CMake_VERSION_PATCH $date)
#set(CMake_VERSION_RC 0)
+Update ``Help/manual/cmake-policies.7.rst`` to set the ``...<max>``
+example to ``...$major.$minor``:
+
+.. code-block:: cmake
+
+ cmake_minimum_required(VERSION 3.10...$major.$minor)
+
Commit with a message such as::
Begin post-$ver development
@@ -318,7 +325,7 @@ Add the following trailing lines in the merge request description::
Fast-forward: true
Backport-ff: release:HEAD~1^2
-This configures the ``Do: merge`` action to fast-foward the ``master``
+This configures the ``Do: merge`` action to fast-forward the ``master``
and ``release`` branches to the respective commits created above.
Further steps may proceed after this has been merged.
@@ -350,7 +357,7 @@ Commit with a message such as::
away from setting policies to OLD.
Update the ``cmake_policy`` version range generated by ``install(EXPORT)``
-in ``cmExportFileGenerator::GeneratePolicyHeaderCode`` and
+in ``cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode`` and
``install_jar_exports`` in ``javaTargets.cmake.in`` to end at the
previous release. We use one release back since we now know all the
policies added for that version. Commit with a message such as::
diff --git a/Help/dev/source.rst b/Help/dev/source.rst
index 363089f..fd8597d 100644
--- a/Help/dev/source.rst
+++ b/Help/dev/source.rst
@@ -9,7 +9,7 @@ See documentation on `CMake Development`_ for more information.
C++ Code Style
==============
-We use `clang-format`_ version **15** to define our style for C++ code in
+We use `clang-format`_ version **18** to define our style for C++ code in
the CMake source tree. See the `.clang-format`_ configuration file for our
style settings. Use the `Utilities/Scripts/clang-format.bash`_ script to
format source code. It automatically runs ``clang-format`` on the set of
@@ -20,6 +20,36 @@ format only a subset of files, such as those that are locally modified.
.. _`.clang-format`: ../../.clang-format
.. _`Utilities/Scripts/clang-format.bash`: ../../Utilities/Scripts/clang-format.bash
+In addition, we have a few coding conventions that we prefer for new code to
+follow (which are not enforced by other tooling):
+
+* Name local variables using ``camelCase``.
+
+* Name class members and free functions using ``PascalCase``.
+
+* Reference class members using ``this->Member``.
+
+* Use east ``const`` style, e.g., ``int const`` instead of ``const int``.
+
+* Declare variables using a locally-specified type:
+
+ .. code-block:: c++
+
+ T x = f();
+
+ Use ``auto`` only if the real type explicitly appears in the initializer:
+
+ .. code-block:: c++
+
+ auto y = cm::make_unique<T>();
+ auto z = []() -> T {...}();
+
+ Exceptions:
+
+ * Iterators: ``auto i = myMap.find(myKey);``
+
+ * Lambdas: ``auto f = []() {...};``
+
C++ Subset Permitted
====================
@@ -191,6 +221,11 @@ Available features are:
* ``<cm/vector>``:
``cm::erase``, ``cm::erase_if``, ``cm::ssize``
+* From ``C++23``:
+
+ * ``<cm/type_traits>``:
+ ``cm::is_scoped_enum``
+
Additionally, some useful non-standard extensions to the C++ standard library
are available in headers under the directory ``cmext/`` in namespace ``cm``.
These are:
diff --git a/Help/envvar/CLICOLOR.rst b/Help/envvar/CLICOLOR.rst
new file mode 100644
index 0000000..404e79e
--- /dev/null
+++ b/Help/envvar/CLICOLOR.rst
@@ -0,0 +1,19 @@
+CLICOLOR
+--------
+
+.. versionadded:: 3.21
+
+.. include:: ENV_VAR.txt
+
+Set to ``0`` to tell command-line tools not to print color
+messages even if connected to a terminal.
+This is a `common convention`_ among command-line tools in general.
+
+See also the :envvar:`CLICOLOR_FORCE` environment variable.
+:envvar:`CLICOLOR_FORCE`, if activated, takes precedence over
+:envvar:`!CLICOLOR`.
+
+See the :variable:`CMAKE_COLOR_DIAGNOSTICS` variable to control
+color in a generated build system.
+
+.. _`common convention`: https://web.archive.org/web/20230417221418/https://bixense.com/clicolors/
diff --git a/Help/envvar/CLICOLOR_FORCE.rst b/Help/envvar/CLICOLOR_FORCE.rst
new file mode 100644
index 0000000..639ed85
--- /dev/null
+++ b/Help/envvar/CLICOLOR_FORCE.rst
@@ -0,0 +1,19 @@
+CLICOLOR_FORCE
+--------------
+
+.. versionadded:: 3.5
+
+.. include:: ENV_VAR.txt
+
+Set to a non-empty value, other than ``0``, to tell command-line
+tools to print color messages even if not connected to a terminal.
+This is a `common convention`_ among command-line tools in general.
+
+See also the :envvar:`CLICOLOR` environment variable.
+:envvar:`!CLICOLOR_FORCE`, if activated, takes precedence over
+:envvar:`CLICOLOR`.
+
+See the :variable:`CMAKE_COLOR_DIAGNOSTICS` variable to control
+color in a generated build system.
+
+.. _`common convention`: https://web.archive.org/web/20230417221418/https://bixense.com/clicolors/
diff --git a/Help/envvar/CMAKE_EXPORT_BUILD_DATABASE.rst b/Help/envvar/CMAKE_EXPORT_BUILD_DATABASE.rst
index b6d004d..a9d868a 100644
--- a/Help/envvar/CMAKE_EXPORT_BUILD_DATABASE.rst
+++ b/Help/envvar/CMAKE_EXPORT_BUILD_DATABASE.rst
@@ -10,7 +10,7 @@ explicit configuration given on the first run while creating a new build tree.
On later runs in an existing build tree the value persists in the cache as
:variable:`CMAKE_EXPORT_BUILD_DATABASE`.
-.. note ::
+.. note::
This variable is meaningful only when experimental support for build
databases has been enabled by the
diff --git a/Help/envvar/CMAKE_POLICY_VERSION_MINIMUM.rst b/Help/envvar/CMAKE_POLICY_VERSION_MINIMUM.rst
new file mode 100644
index 0000000..0521f5c
--- /dev/null
+++ b/Help/envvar/CMAKE_POLICY_VERSION_MINIMUM.rst
@@ -0,0 +1,11 @@
+CMAKE_POLICY_VERSION_MINIMUM
+----------------------------
+
+.. versionadded:: 4.0
+
+.. include:: ENV_VAR.txt
+
+The default value for :variable:`CMAKE_POLICY_VERSION_MINIMUM` when there
+is no explicit configuration given on the first run while creating a new
+build tree. On later runs in an existing build tree the value persists in
+the cache as :variable:`CMAKE_POLICY_VERSION_MINIMUM`.
diff --git a/Help/envvar/CTEST_USE_INSTRUMENTATION.rst b/Help/envvar/CTEST_USE_INSTRUMENTATION.rst
new file mode 100644
index 0000000..c6c7f70
--- /dev/null
+++ b/Help/envvar/CTEST_USE_INSTRUMENTATION.rst
@@ -0,0 +1,15 @@
+CTEST_USE_INSTRUMENTATION
+-------------------------
+
+.. versionadded:: 4.0
+
+.. include:: ENV_VAR.txt
+
+.. note::
+
+ This feature is only available when experimental support for instrumentation
+ has been enabled by the ``CMAKE_EXPERIMENTAL_INSTRUMENTATION`` gate.
+
+Setting this environment variable enables
+:manual:`instrumentation <cmake-instrumentation(7)>` for CTest in
+:ref:`Dashboard Client` mode.
diff --git a/Help/envvar/CTEST_USE_VERBOSE_INSTRUMENTATION.rst b/Help/envvar/CTEST_USE_VERBOSE_INSTRUMENTATION.rst
new file mode 100644
index 0000000..d7f7477
--- /dev/null
+++ b/Help/envvar/CTEST_USE_VERBOSE_INSTRUMENTATION.rst
@@ -0,0 +1,17 @@
+CTEST_USE_VERBOSE_INSTRUMENTATION
+---------------------------------
+
+.. versionadded:: 4.0
+
+.. include:: ENV_VAR.txt
+
+.. note::
+
+ This feature is only available when experimental support for instrumentation
+ has been enabled by the ``CMAKE_EXPERIMENTAL_INSTRUMENTATION`` gate.
+
+Setting this environment variable causes CTest to report the full
+command line (including arguments) to CDash for each instrumented command.
+By default, CTest truncates the command line at the first space.
+
+See also :envvar:`CTEST_USE_INSTRUMENTATION`
diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst
index af7dfaa..6629b68 100644
--- a/Help/generator/Visual Studio 14 2015.rst
+++ b/Help/generator/Visual Studio 14 2015.rst
@@ -25,15 +25,18 @@ name (architecture). For example:
* ``cmake -G "Visual Studio 14 2015" -A x64``
* ``cmake -G "Visual Studio 14 2015" -A ARM``
-For compatibility with CMake versions prior to 3.1, one may specify
-a target platform name optionally at the end of the generator name.
-This is supported only for:
+.. versionchanged:: 4.0
-``Visual Studio 14 2015 Win64``
- Specify target platform ``x64``.
+ Previously, for compatibility with CMake versions prior to 3.1,
+ one could specify a target platform name optionally at the
+ end of the generator name. This has been removed.
+ This was supported only for:
-``Visual Studio 14 2015 ARM``
- Specify target platform ``ARM``.
+ ``Visual Studio 14 2015 Win64``
+ Specify target platform ``x64``.
+
+ ``Visual Studio 14 2015 ARM``
+ Specify target platform ``ARM``.
Toolset Selection
^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst
index 6bcc033..3f29072 100644
--- a/Help/generator/Visual Studio 15 2017.rst
+++ b/Help/generator/Visual Studio 15 2017.rst
@@ -34,15 +34,18 @@ name (architecture). For example:
* ``cmake -G "Visual Studio 15 2017" -A ARM``
* ``cmake -G "Visual Studio 15 2017" -A ARM64``
-For compatibility with CMake versions prior to 3.1, one may specify
-a target platform name optionally at the end of the generator name.
-This is supported only for:
+.. versionchanged:: 4.0
-``Visual Studio 15 2017 Win64``
- Specify target platform ``x64``.
+ Previously, for compatibility with CMake versions prior to 3.1,
+ one could specify a target platform name optionally at the
+ end of the generator name. This has been removed.
+ This was supported only for:
-``Visual Studio 15 2017 ARM``
- Specify target platform ``ARM``.
+ ``Visual Studio 15 2017 Win64``
+ Specify target platform ``x64``.
+
+ ``Visual Studio 15 2017 ARM``
+ Specify target platform ``ARM``.
Toolset Selection
^^^^^^^^^^^^^^^^^
diff --git a/Help/guide/importing-exporting/Downstream/main.cc b/Help/guide/importing-exporting/Downstream/main.cc
index 8574373..1102364 100644
--- a/Help/guide/importing-exporting/Downstream/main.cc
+++ b/Help/guide/importing-exporting/Downstream/main.cc
@@ -12,10 +12,10 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
// calculate square root
- const double sqrt = MathFunctions::sqrt(inputValue);
+ double const sqrt = MathFunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << sqrt
<< std::endl;
diff --git a/Help/guide/importing-exporting/DownstreamComponents/main.cc b/Help/guide/importing-exporting/DownstreamComponents/main.cc
index f5e8fa6..a53037e 100644
--- a/Help/guide/importing-exporting/DownstreamComponents/main.cc
+++ b/Help/guide/importing-exporting/DownstreamComponents/main.cc
@@ -13,15 +13,15 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
// calculate square root
- const double sqrt = MathFunctions::sqrt(inputValue);
+ double const sqrt = MathFunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << sqrt
<< std::endl;
// calculate sum
- const double sum = MathFunctions::add(inputValue, inputValue);
+ double const sum = MathFunctions::add(inputValue, inputValue);
std::cout << inputValue << " + " << inputValue << " = " << sum << std::endl;
return 0;
diff --git a/Help/guide/importing-exporting/index.rst b/Help/guide/importing-exporting/index.rst
index 91c50dd..cee7909 100644
--- a/Help/guide/importing-exporting/index.rst
+++ b/Help/guide/importing-exporting/index.rst
@@ -319,7 +319,7 @@ were built in its own tree. For example:
include(GNUInstallDirs)
include(${INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions/MathFunctionTargets.cmake)
- add_executable(myexe src1.c src2.c )
+ add_executable(myexe src1.c src2.c)
target_link_libraries(myexe PRIVATE MathFunctions::MathFunctions)
Line 2 loads the target CMake file. Although we only exported a single
@@ -390,7 +390,7 @@ section.
:start-after: # create config file
:end-before: # install config files
-Install the generated configuration files with the :command:`INSTALL(files)`
+Install the generated configuration files with the :command:`install(FILES)`
command. Both ``MathFunctionsConfigVersion.cmake`` and
``MathFunctionsConfig.cmake`` are installed to the same location, completing
the package.
diff --git a/Help/guide/tutorial/A Basic Starting Point.rst b/Help/guide/tutorial/A Basic Starting Point.rst
index 2325e9e..b36e2e7 100644
--- a/Help/guide/tutorial/A Basic Starting Point.rst
+++ b/Help/guide/tutorial/A Basic Starting Point.rst
@@ -17,7 +17,7 @@ the ``Build and Run`` section will walk step-by-step through how to build and
test the exercise. Finally, at the end of each exercise the intended solution
is discussed.
-Also note that each step in the tutorial builds on the next. So, for example,
+Also note that each step in the tutorial builds on the previous. For example,
the starting code for ``Step2`` is the complete solution to ``Step1``.
Exercise 1 - Building a Basic Project
@@ -319,6 +319,7 @@ Files to Edit
* ``CMakeLists.txt``
* ``tutorial.cxx``
+* ``TutorialConfig.h.in``
Getting Started
---------------
@@ -399,7 +400,7 @@ include files.
**Note:** Throughout this tutorial, we will refer to the project build and
the project binary directory interchangeably. These are the same and are not
-meant to refer to a `bin/` directory.
+meant to refer to a ``bin/`` directory.
We used :command:`target_include_directories` to specify
where the executable target should look for include files.
diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst
index cfcfc67..8f39da3 100644
--- a/Help/guide/tutorial/Adding a Library.rst
+++ b/Help/guide/tutorial/Adding a Library.rst
@@ -194,7 +194,7 @@ Lastly, replace ``sqrt`` with the wrapper function ``mathfunctions::sqrt``.
:caption: TODO 6: tutorial.cxx
:name: CMakeLists.txt-option
:language: cmake
- :start-after: const double inputValue = std::stod(argv[1]);
+ :start-after: double const inputValue = std::stod(argv[1]);
:end-before: std::cout
.. raw:: html
diff --git a/Help/guide/tutorial/Complete/CMakeLists.txt b/Help/guide/tutorial/Complete/CMakeLists.txt
index 548a82d..181c25e 100644
--- a/Help/guide/tutorial/Complete/CMakeLists.txt
+++ b/Help/guide/tutorial/Complete/CMakeLists.txt
@@ -121,7 +121,7 @@ install(FILES
)
# generate the export targets for the build tree
-# needs to be after the install(TARGETS ) command
+# needs to be after the install(TARGETS) command
export(EXPORT MathFunctionsTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsTargets.cmake"
)
diff --git a/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx
index ee58556..f85b278 100644
--- a/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx
+++ b/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx
@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
- const bool fileOpen = fout.is_open();
+ bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {
diff --git a/Help/guide/tutorial/Complete/tutorial.cxx b/Help/guide/tutorial/Complete/tutorial.cxx
index a4f44d5..78641b1 100644
--- a/Help/guide/tutorial/Complete/tutorial.cxx
+++ b/Help/guide/tutorial/Complete/tutorial.cxx
@@ -16,9 +16,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Packaging Debug and Release.rst b/Help/guide/tutorial/Packaging Debug and Release.rst
index 8c660a3..6036969 100644
--- a/Help/guide/tutorial/Packaging Debug and Release.rst
+++ b/Help/guide/tutorial/Packaging Debug and Release.rst
@@ -10,7 +10,7 @@ possible, however, to setup CPack to bundle multiple build directories and
construct a package that contains multiple configurations of the same project.
First, we want to ensure that the debug and release builds use different names
-for the libraries that will be installed. Let's use `d` as the
+for the libraries that will be installed. Let's use ``d`` as the
postfix for the debug libraries.
Set :variable:`CMAKE_DEBUG_POSTFIX` near the beginning of the top-level
diff --git a/Help/guide/tutorial/Step1/tutorial.cxx b/Help/guide/tutorial/Step1/tutorial.cxx
index 64d0916..18077b6 100644
--- a/Help/guide/tutorial/Step1/tutorial.cxx
+++ b/Help/guide/tutorial/Step1/tutorial.cxx
@@ -17,10 +17,10 @@ int main(int argc, char* argv[])
// convert input to double
// TODO 4: Replace atof(argv[1]) with std::stod(argv[1])
- const double inputValue = atof(argv[1]);
+ double const inputValue = atof(argv[1]);
// calculate square root
- const double outputValue = sqrt(inputValue);
+ double const outputValue = sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
return 0;
diff --git a/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx
index ee58556..f85b278 100644
--- a/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx
+++ b/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx
@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
- const bool fileOpen = fout.is_open();
+ bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {
diff --git a/Help/guide/tutorial/Step10/tutorial.cxx b/Help/guide/tutorial/Step10/tutorial.cxx
index 37a0333..ca5110c 100644
--- a/Help/guide/tutorial/Step10/tutorial.cxx
+++ b/Help/guide/tutorial/Step10/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx
index ee58556..f85b278 100644
--- a/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx
+++ b/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx
@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
- const bool fileOpen = fout.is_open();
+ bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {
diff --git a/Help/guide/tutorial/Step11/tutorial.cxx b/Help/guide/tutorial/Step11/tutorial.cxx
index 37a0333..ca5110c 100644
--- a/Help/guide/tutorial/Step11/tutorial.cxx
+++ b/Help/guide/tutorial/Step11/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx
index ee58556..f85b278 100644
--- a/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx
+++ b/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx
@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
- const bool fileOpen = fout.is_open();
+ bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {
diff --git a/Help/guide/tutorial/Step12/tutorial.cxx b/Help/guide/tutorial/Step12/tutorial.cxx
index a4f44d5..78641b1 100644
--- a/Help/guide/tutorial/Step12/tutorial.cxx
+++ b/Help/guide/tutorial/Step12/tutorial.cxx
@@ -16,9 +16,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step2/tutorial.cxx b/Help/guide/tutorial/Step2/tutorial.cxx
index 7a2a595..b4063c8 100644
--- a/Help/guide/tutorial/Step2/tutorial.cxx
+++ b/Help/guide/tutorial/Step2/tutorial.cxx
@@ -17,12 +17,12 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
// TODO 6: Replace sqrt with mathfunctions::sqrt
// calculate square root
- const double outputValue = sqrt(inputValue);
+ double const outputValue = sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
return 0;
diff --git a/Help/guide/tutorial/Step3/tutorial.cxx b/Help/guide/tutorial/Step3/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step3/tutorial.cxx
+++ b/Help/guide/tutorial/Step3/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step4/tutorial.cxx b/Help/guide/tutorial/Step4/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step4/tutorial.cxx
+++ b/Help/guide/tutorial/Step4/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step5/tutorial.cxx b/Help/guide/tutorial/Step5/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step5/tutorial.cxx
+++ b/Help/guide/tutorial/Step5/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step6/tutorial.cxx b/Help/guide/tutorial/Step6/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step6/tutorial.cxx
+++ b/Help/guide/tutorial/Step6/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step7/tutorial.cxx b/Help/guide/tutorial/Step7/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step7/tutorial.cxx
+++ b/Help/guide/tutorial/Step7/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx
index ee58556..f85b278 100644
--- a/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx
+++ b/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx
@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
- const bool fileOpen = fout.is_open();
+ bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {
diff --git a/Help/guide/tutorial/Step8/tutorial.cxx b/Help/guide/tutorial/Step8/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step8/tutorial.cxx
+++ b/Help/guide/tutorial/Step8/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx
index ee58556..f85b278 100644
--- a/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx
+++ b/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx
@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
- const bool fileOpen = fout.is_open();
+ bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {
diff --git a/Help/guide/tutorial/Step9/tutorial.cxx b/Help/guide/tutorial/Step9/tutorial.cxx
index a3a2bdc..48be3c6 100644
--- a/Help/guide/tutorial/Step9/tutorial.cxx
+++ b/Help/guide/tutorial/Step9/tutorial.cxx
@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
- const double inputValue = std::stod(argv[1]);
+ double const inputValue = std::stod(argv[1]);
- const double outputValue = mathfunctions::sqrt(inputValue);
+ double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
diff --git a/Help/include/COMPILE_DEFINITIONS_DISCLAIMER.txt b/Help/include/COMPILE_DEFINITIONS_DISCLAIMER.txt
index 6797d0e..f0ebc8d 100644
--- a/Help/include/COMPILE_DEFINITIONS_DISCLAIMER.txt
+++ b/Help/include/COMPILE_DEFINITIONS_DISCLAIMER.txt
@@ -5,14 +5,16 @@ to be escaped correctly, do not attempt to work-around the problem by
adding escape sequences to the value. Your work-around may break in a
future version of CMake that has improved escape support. Instead
consider defining the macro in a (configured) header file. Then
-report the limitation. Known limitations include::
+report the limitation. Known limitations include:
- # - broken almost everywhere
- ; - broken in VS IDE 7.0 and Borland Makefiles
- , - broken in VS IDE
- % - broken in some cases in NMake
- & | - broken in some cases on MinGW
- ^ < > \" - broken in most Make tools on Windows
+ ============= ========================
+ ``#`` Broken almost everywhere.
+ ``;`` Broken in VS IDE 7.0 and Borland Makefiles.
+ ``,`` Broken in VS IDE.
+ ``%`` Broken in some cases in NMake.
+ ``& |`` Broken in some cases on MinGW.
+ ``^ < > \ "`` Broken in most Make tools on Windows.
+ ============= ========================
CMake does not reject these values outright because they do work in
some cases. Use with caution.
diff --git a/Help/index.rst b/Help/index.rst
index ca03213..f9ffcba 100644
--- a/Help/index.rst
+++ b/Help/index.rst
@@ -64,6 +64,7 @@ Reference Manuals
/manual/cmake-file-api.7
/manual/cmake-generator-expressions.7
/manual/cmake-generators.7
+ /manual/cmake-instrumentation.7
/manual/cmake-language.7
/manual/cmake-modules.7
/manual/cmake-packages.7
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index b8ea1ce..4d8f88e 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -119,6 +119,25 @@
Specify the installation directory, used by the
:variable:`CMAKE_INSTALL_PREFIX` variable. Must be an absolute path.
+.. option:: --project-file <project-file-name>
+
+ .. versionadded:: 4.0
+
+ Specify an alternate project file name.
+
+ This determines the top-level file processed by CMake when configuring a
+ project, and the file processed by :command:`add_subdirectory`.
+
+ By default, this is ``CMakeLists.txt``. If set to anything else,
+ ``CMakeLists.txt`` will be used as a fallback whenever the specified file
+ cannot be found within a project subdirectory.
+
+ .. note::
+
+ This feature is intended for temporary use by developers during an incremental
+ transition and not for publication of a final product. CMake will always emit
+ a warning when the project file is anything other than ``CMakeLists.txt``.
+
.. option:: -Wno-dev
Suppress developer warnings.
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index eb25a4a..4fa878e 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -37,10 +37,13 @@ is defined as an executable formed by compiling and linking ``zipapp.cpp``.
When linking the ``zipapp`` executable, the ``archive`` static library is
linked in.
-.. _`Binary Executables`:
+.. _`Executables`:
-Binary Executables
-------------------
+Executables
+-----------
+
+Executables are binaries created by linking object files together,
+one of which contains a program entry point, e.g., ``main``.
The :command:`add_executable` command defines an executable target:
@@ -48,56 +51,101 @@ The :command:`add_executable` command defines an executable target:
add_executable(mytool mytool.cpp)
+CMake generates build rules to compile the source files into object
+files and link them into an executable.
+
+Link dependencies of executables may be specified using the
+:command:`target_link_libraries` command. Linkers start with the
+object files compiled from the executable's own source files, and
+then resolve remaining symbol dependencies by searching linked libraries.
+
Commands such as :command:`add_custom_command`, which generates rules to be
run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
target as a ``COMMAND`` executable. The buildsystem rules will ensure that
the executable is built before attempting to run the command.
-Binary Library Types
---------------------
+.. _`Static Libraries`:
-.. _`Normal Libraries`:
+Static Libraries
+----------------
-Normal Libraries
-^^^^^^^^^^^^^^^^
+Static libraries are archives of object files. They are produced by an
+archiver, not a linker. `Executables`_, `Shared Libraries`_, and
+`Module Libraries`_ may link to static libraries as dependencies.
+Linkers select subsets of object files from static libraries as needed
+to resolve symbols and link them into consuming binaries. Each binary
+that links to a static library gets its own copy of the symbols, and
+the static library itself is not needed at runtime.
-By default, the :command:`add_library` command defines a ``STATIC`` library,
-unless a type is specified. A type may be specified when using the command:
+The :command:`add_library` command defines a static library target
+when called with the ``STATIC`` library type:
.. code-block:: cmake
- add_library(archive SHARED archive.cpp zip.cpp lzma.cpp)
+ add_library(archive STATIC archive.cpp zip.cpp lzma.cpp)
+
+or, when the :variable:`BUILD_SHARED_LIBS` variable is false, with no type:
.. code-block:: cmake
- add_library(archive STATIC archive.cpp zip.cpp lzma.cpp)
+ add_library(archive archive.cpp zip.cpp lzma.cpp)
-The :variable:`BUILD_SHARED_LIBS` variable may be enabled to change the
-behavior of :command:`add_library` to build shared libraries by default.
-
-In the context of the buildsystem definition as a whole, it is largely
-irrelevant whether particular libraries are ``SHARED`` or ``STATIC`` --
-the commands, dependency specifications and other APIs work similarly
-regardless of the library type. The ``MODULE`` library type is
-dissimilar in that it is generally not linked to -- it is not used in
-the right-hand-side of the :command:`target_link_libraries` command.
-It is a type which is loaded as a plugin using runtime techniques.
-If the library does not export any unmanaged symbols (e.g. Windows
-resource DLL, C++/CLI DLL), it is required that the library not be a
-``SHARED`` library because CMake expects ``SHARED`` libraries to export
-at least one symbol.
+CMake generates build rules to compile the source files into object
+files and archive them into a static library.
+
+Link dependencies of static libraries may be specified using the
+:command:`target_link_libraries` command. Since static libraries are
+archives rather than linked binaries, object files from their link
+dependencies are not included in the libraries themselves (except for
+`Object Libraries`_ specified as *direct* link dependencies).
+Instead, CMake records static libraries' link dependencies for
+transitive use when linking consuming binaries.
+
+.. _`Shared Libraries`:
+
+Shared Libraries
+----------------
+
+Shared libraries are binaries created by linking object files together.
+`Executables`_, other shared libraries, and `Module Libraries`_ may link
+to shared libraries as dependencies. Linkers record references to shared
+libraries in consuming binaries. At runtime, a dynamic loader searches
+for referenced shared libraries on disk and loads their symbols.
+
+The :command:`add_library` command defines a shared library target
+when called with the ``SHARED`` library type:
.. code-block:: cmake
- add_library(archive MODULE 7z.cpp)
+ add_library(archive SHARED archive.cpp zip.cpp lzma.cpp)
+
+or, when the :variable:`BUILD_SHARED_LIBS` variable is true, with no type:
+
+.. code-block:: cmake
+
+ add_library(archive archive.cpp zip.cpp lzma.cpp)
+
+CMake generates build rules to compile the source files into object
+files and link them into a shared library.
+
+Link dependencies of shared libraries may be specified using the
+:command:`target_link_libraries` command. Linkers start with the
+object files compiled from the shared library's own source files, and
+then resolve remaining symbol dependencies by searching linked libraries.
+
+.. note::
+
+ CMake expects shared libraries to export at least one symbol. If a library
+ does not export any unmanaged symbols, e.g., a Windows resource DLL or
+ C++/CLI DLL, make it a `Module Library <Module Libraries_>`_ instead.
.. _`Apple Frameworks`:
Apple Frameworks
-""""""""""""""""
+----------------
-A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK`
-target property to create an macOS or iOS Framework Bundle.
+`Shared Libraries`_ and `Static Libraries`_ may be marked with the
+:prop_tgt:`FRAMEWORK` target property to create a macOS or iOS Framework.
A library with the ``FRAMEWORK`` target property should also set the
:prop_tgt:`FRAMEWORK_VERSION` target property. This property is typically
set to the value of "A" by macOS conventions.
@@ -113,46 +161,80 @@ and it uniquely identifies the bundle.
MACOSX_FRAMEWORK_IDENTIFIER org.cmake.MyFramework
)
+.. _`Module Libraries`:
+
+Module Libraries
+----------------
+
+Module libraries are binaries created by linking object files together.
+Unlike `Shared Libraries`_, module libraries may not be linked by other
+binaries as dependencies -- do not name them in the right-hand side of
+the :command:`target_link_libraries` command. Instead, module libraries
+are plugins that an application can dynamically load on-demand at runtime,
+e.g., by ``dlopen``.
+
+The :command:`add_library` command defines a module library target
+when called with the ``MODULE`` library type:
+
+.. code-block:: cmake
+
+ add_library(archivePlugin MODULE 7z.cpp)
+
+CMake generates build rules to compile the source files into object
+files and link them into a module library.
+
+Link dependencies of module libraries may be specified using the
+:command:`target_link_libraries` command. Linkers start with the
+object files compiled from the module library's own source files, and
+then resolve remaining symbol dependencies by searching linked libraries.
+
.. _`Object Libraries`:
Object Libraries
-^^^^^^^^^^^^^^^^
+----------------
-The ``OBJECT`` library type defines a non-archival collection of object files
-resulting from compiling the given source files. The object files collection
-may be used as source inputs to other targets by using the syntax
-:genex:`$<TARGET_OBJECTS:name>`. This is a
-:manual:`generator expression <cmake-generator-expressions(7)>` that can be
-used to supply the ``OBJECT`` library content to other targets:
+Object libraries are collections of object files created by compiling
+source files without any archiving or linking. The object files may be
+used when linking `Executables`_, `Shared Libraries`_, and
+`Module Libraries`_, or when archiving `Static Libraries`_.
+
+The :command:`add_library` command defines an object library target
+when called with the ``OBJECT`` library type:
.. code-block:: cmake
- add_library(archive OBJECT archive.cpp zip.cpp lzma.cpp)
+ add_library(archiveObjs OBJECT archive.cpp zip.cpp lzma.cpp)
- add_library(archiveExtras STATIC $<TARGET_OBJECTS:archive> extras.cpp)
+CMake generates build rules to compile the source files into object files.
- add_executable(test_exe $<TARGET_OBJECTS:archive> test.cpp)
+Other targets may specify the object files as source inputs by using the
+:manual:`generator expression <cmake-generator-expressions(7)>` syntax
+:genex:`$<TARGET_OBJECTS:name>`:
-The link (or archiving) step of those other targets will use the object
-files collection in addition to those from their own sources.
+.. code-block:: cmake
-Alternatively, object libraries may be linked into other targets:
+ add_library(archiveExtras STATIC $<TARGET_OBJECTS:archiveObjs> extras.cpp)
-.. code-block:: cmake
+ add_executable(test_exe $<TARGET_OBJECTS:archiveObjs> test.cpp)
- add_library(archive OBJECT archive.cpp zip.cpp lzma.cpp)
+The consuming targets are linked (or archived) using object files
+both from their own sources and from the named object libraries.
+
+Alternatively, object libraries may be specified as link dependencies
+of other targets:
+
+.. code-block:: cmake
add_library(archiveExtras STATIC extras.cpp)
- target_link_libraries(archiveExtras PUBLIC archive)
+ target_link_libraries(archiveExtras PUBLIC archiveObjs)
add_executable(test_exe test.cpp)
- target_link_libraries(test_exe archive)
+ target_link_libraries(test_exe archiveObjs)
-The link (or archiving) step of those other targets will use the object
-files from ``OBJECT`` libraries that are *directly* linked. Additionally,
-usage requirements of the ``OBJECT`` libraries will be honored when compiling
-sources in those other targets. Furthermore, those usage requirements
-will propagate transitively to dependents of those other targets.
+The consuming targets are linked (or archived) using object files
+both from their own sources and from object libraries specified as
+*direct* link dependencies by :command:`target_link_libraries`.
+See :ref:`Linking Object Libraries`.
Object libraries may not be used as the ``TARGET`` in a use of the
:command:`add_custom_command(TARGET)` command signature. However,
@@ -386,14 +468,15 @@ for linking a target.
: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.
+ shared library, or module library. Entries for `Static Libraries`_
+ and `Shared 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`_,
+ ``LINK_LIBRARIES`` entries naming `Static Libraries`_, `Shared Libraries`_,
`Interface Libraries`_, `Object Libraries`_, and `Imported Targets`_,
collected over the transitive closure of their
:prop_tgt:`INTERFACE_LINK_LIBRARIES` properties.
@@ -581,8 +664,8 @@ linking consumers.
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`_,
+ `Static Libraries`_, `Shared Libraries`_, `Interface Libraries`_,
+ `Object Libraries`_, and `Imported Targets`_,
:prop_tgt:`INTERFACE_LINK_DIRECTORIES`
.. versionadded:: 3.13
@@ -877,20 +960,20 @@ on the consumer:
target_compile_definitions(lib1 INTERFACE
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:LIB1_WITH_EXE>
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:LIB1_WITH_SHARED_LIB>
- $<$<TARGET_POLICY:CMP0041>:CONSUMER_CMP0041_NEW>
+ $<$<TARGET_POLICY:CMP0182>:CONSUMER_CMP0182_NEW>
)
add_executable(exe1 exe1.cpp)
target_link_libraries(exe1 lib1)
- cmake_policy(SET CMP0041 NEW)
+ cmake_policy(SET CMP0182 NEW)
add_library(shared_lib shared_lib.cpp)
target_link_libraries(shared_lib lib1)
The ``exe1`` executable will be compiled with ``-DLIB1_WITH_EXE``, while the
``shared_lib`` shared library will be compiled with ``-DLIB1_WITH_SHARED_LIB``
-and ``-DCONSUMER_CMP0041_NEW``, because policy :policy:`CMP0041` is
+and ``-DCONSUMER_CMP0182_NEW``, because policy :policy:`CMP0182` is
``NEW`` at the point where the ``shared_lib`` target is created.
The ``BUILD_INTERFACE`` expression wraps requirements which are only used when
@@ -1430,7 +1513,7 @@ default header set along with the target:
add_library(Eigen INTERFACE)
- target_sources(Eigen INTERFACE
+ target_sources(Eigen PUBLIC
FILE_SET HEADERS
BASE_DIRS src
FILES src/eigen.h src/vector.h src/matrix.h
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index 00f46aa..6f1a947 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -51,6 +51,7 @@ These commands are always available.
/command/include
/command/include_guard
/command/list
+ /command/load_cache
/command/macro
/command/mark_as_advanced
/command/math
@@ -89,6 +90,7 @@ These commands are available only in CMake projects.
/command/aux_source_directory
/command/build_command
/command/cmake_file_api
+ /command/cmake_instrumentation
/command/create_test_sourcelist
/command/define_property
/command/enable_language
@@ -104,7 +106,6 @@ These commands are available only in CMake projects.
/command/install
/command/link_directories
/command/link_libraries
- /command/load_cache
/command/project
/command/remove_definitions
/command/set_source_files_properties
diff --git a/Help/manual/cmake-configure-log.7.rst b/Help/manual/cmake-configure-log.7.rst
index cb6cb90..2cf7580 100644
--- a/Help/manual/cmake-configure-log.7.rst
+++ b/Help/manual/cmake-configure-log.7.rst
@@ -20,7 +20,9 @@ detailed information about specific events, such as toolchain inspection
by :command:`try_compile`, meant for use in debugging the configuration
of a build tree.
-For human use, this version of CMake writes the configure log to the file::
+For human use, this version of CMake writes the configure log to the file:
+
+.. code-block:: cmake
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml
diff --git a/Help/manual/cmake-cxxmodules.7.rst b/Help/manual/cmake-cxxmodules.7.rst
index 1387e24..ee16e27 100644
--- a/Help/manual/cmake-cxxmodules.7.rst
+++ b/Help/manual/cmake-cxxmodules.7.rst
@@ -95,11 +95,12 @@ library combinations:
* Clang 18.1.2 and newer with ``-stdlib=libc++`` or ``-stdlib=libstdc++``
* MSVC toolset 14.36 and newer (provided with Visual Studio 17.6 Preview 2 and
newer)
+* GCC 15 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 ::
+.. note::
This support is provided only when experimental support for
``import std;`` has been enabled by the
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index fc7a27d..2815e9c 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -126,7 +126,9 @@ In either case (or even when providing both variables and imported
targets), find modules should provide backwards compatibility with old
versions that had the same name.
-A FindFoo.cmake module will typically be loaded by the command::
+A FindFoo.cmake module will typically be loaded by the command:
+
+.. code-block:: cmake
find_package(Foo [major[.minor[.patch[.tweak]]]]
[EXACT] [QUIET] [REQUIRED]
@@ -216,7 +218,11 @@ for any macros, functions and imported targets defined by the Find module.
variable for use by client code. This should not be a cache entry.
``Xxx_ROOT_DIR``
- Where to find the base directory of the module.
+ The base directory of the installation of ``Xxx`` that can be optionally set
+ by the find module if ``Xxx`` is found. This is useful for large packages
+ where many files need to be referenced relative to a common base (or root)
+ directory. Not to be confused with the ``Xxx_ROOT`` hint variable set from the
+ outside for the find module to know where to look for the ``Xxx``.
``Xxx_VERSION_VV``
Variables of this form specify whether the ``Xxx`` module being provided
@@ -335,7 +341,7 @@ reStructuredText-format documentation. For example:
::
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- # file Copyright.txt or https://cmake.org/licensing for details.
+ # file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFoo
@@ -417,18 +423,18 @@ information from the ``Foo.pc`` file.
Now we need to find the libraries and include files; we use the
information from ``pkg-config`` to provide hints to CMake about where to
-look.
+look before checking other default paths.
.. code-block:: cmake
find_path(Foo_INCLUDE_DIR
NAMES foo.h
- PATHS ${PC_Foo_INCLUDE_DIRS}
+ HINTS ${PC_Foo_INCLUDE_DIRS}
PATH_SUFFIXES Foo
)
find_library(Foo_LIBRARY
NAMES foo
- PATHS ${PC_Foo_LIBRARY_DIRS}
+ HINTS ${PC_Foo_LIBRARY_DIRS}
)
Alternatively, if the library is available with multiple configurations, you can
@@ -439,11 +445,11 @@ use :module:`SelectLibraryConfigurations` to automatically set the
find_library(Foo_LIBRARY_RELEASE
NAMES foo
- PATHS ${PC_Foo_LIBRARY_DIRS}/Release
+ HINTS ${PC_Foo_LIBRARY_DIRS}/Release
)
find_library(Foo_LIBRARY_DEBUG
NAMES foo
- PATHS ${PC_Foo_LIBRARY_DIRS}/Debug
+ HINTS ${PC_Foo_LIBRARY_DIRS}/Debug
)
include(SelectLibraryConfigurations)
@@ -466,7 +472,6 @@ rest of the work for us
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Foo
- FOUND_VAR Foo_FOUND
REQUIRED_VARS
Foo_LIBRARY
Foo_INCLUDE_DIR
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index fd5935c..198e71f 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -20,11 +20,14 @@ Environment Variables that Change Behavior
.. toctree::
:maxdepth: 1
+ /envvar/CLICOLOR
+ /envvar/CLICOLOR_FORCE
/envvar/CMAKE_APPBUNDLE_PATH
/envvar/CMAKE_FRAMEWORK_PATH
/envvar/CMAKE_INCLUDE_PATH
/envvar/CMAKE_LIBRARY_PATH
/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH
+ /envvar/CMAKE_POLICY_VERSION_MINIMUM
/envvar/CMAKE_PREFIX_PATH
/envvar/CMAKE_PROGRAM_PATH
/envvar/CMAKE_TLS_VERIFY
@@ -114,7 +117,9 @@ Environment Variables for CTest
/envvar/CTEST_OUTPUT_ON_FAILURE
/envvar/CTEST_PARALLEL_LEVEL
/envvar/CTEST_PROGRESS_OUTPUT
+ /envvar/CTEST_USE_INSTRUMENTATION
/envvar/CTEST_USE_LAUNCHERS_DEFAULT
+ /envvar/CTEST_USE_VERBOSE_INSTRUMENTATION
/envvar/DASHBOARD_TEST_FROM_CTEST
Environment Variables for the CMake curses interface
diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst
index a4ce5de..561791c 100644
--- a/Help/manual/cmake-file-api.7.rst
+++ b/Help/manual/cmake-file-api.7.rst
@@ -435,7 +435,7 @@ Version 1 does not exist to avoid confusion with that from
{
"kind": "codemodel",
- "version": { "major": 2, "minor": 7 },
+ "version": { "major": 2, "minor": 8 },
"paths": {
"source": "/path/to/top-level-source-dir",
"build": "/path/to/top-level-build-dir"
@@ -1095,6 +1095,22 @@ with members:
when link-time optimization (a.k.a. interprocedural optimization
or link-time code generation) is enabled.
+``debugger``
+ Optional member that is present when the target has one of the
+ following fields set.
+ The value is a JSON object of entries corresponding to
+ debugger specific values set.
+
+ This field was added in codemodel version 2.8.
+
+ ``workingDirectory``
+ Optional member that is present when the DEBUGGER_WORKING_DIRECTORY
+ target property is set.
+ The member will also be present in Visual Studio Generator
+ scenarios when VS_DEBUGGER_WORKING_DIRECTORY is set.
+
+ This field was added in codemodel version 2.8.
+
``dependencies``
Optional member that is present when the target depends on other targets.
The value is a JSON array of entries corresponding to the dependencies.
@@ -1367,6 +1383,8 @@ elsewhere in the containing object. The backtrace graph object members are:
Object Kind "configureLog"
--------------------------
+.. versionadded:: 3.26
+
The ``configureLog`` object kind describes the location and contents of
a :manual:`cmake-configure-log(7)` file.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 26a4a60..271d7a9 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -691,7 +691,7 @@ All paths are expected to be in cmake-style format.
present, ``0`` otherwise. See :ref:`Path Structure And Terminology` for the
meaning of each path component.
- ::
+ .. code-block:: cmake
$<PATH:HAS_ROOT_NAME,path>
$<PATH:HAS_ROOT_DIRECTORY,path>
@@ -753,7 +753,7 @@ command. All paths are expected to be in cmake-style format.
All operations now accept a list of paths as argument. When a list of paths
is specified, the operation will be applied to each path.
- ::
+ .. code-block:: cmake
$<PATH:GET_ROOT_NAME,path...>
$<PATH:GET_ROOT_DIRECTORY,path...>
@@ -795,6 +795,16 @@ in cmake-style format.
When the ``NORMALIZE`` option is specified, the path is :ref:`normalized
<Normalization>` after the conversion.
+.. genex:: $<PATH:NATIVE_PATH[,NORMALIZE],path...>
+
+ .. versionadded:: 4.0
+
+ Returns ``path`` converted into a native format with platform-specific
+ slashes (``\`` on Windows hosts and ``/`` elsewhere).
+
+ When the ``NORMALIZE`` option is specified, the path is :ref:`normalized
+ <Normalization>` before the conversion.
+
.. genex:: $<PATH:APPEND,path...,input,...>
.. versionadded:: 3.24
@@ -1405,7 +1415,7 @@ Compile Context
linking requirements (e.g., all-``inline`` or C++ template libraries).
Note that for proper evaluation of this expression requires policy :policy:`CMP0099`
- to be set to `NEW`.
+ to be set to ``NEW``.
Linker Language And ID
^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/manual/cmake-instrumentation.7.rst b/Help/manual/cmake-instrumentation.7.rst
new file mode 100644
index 0000000..e20d8a6
--- /dev/null
+++ b/Help/manual/cmake-instrumentation.7.rst
@@ -0,0 +1,466 @@
+.. cmake-manual-description: CMake Instrumentation
+
+cmake-instrumentation(7)
+************************
+
+.. versionadded:: 4.0
+
+.. only:: html
+
+ .. contents::
+
+Introduction
+============
+
+.. note::
+
+ This feature is only available when experimental support for instrumentation
+ has been enabled by the ``CMAKE_EXPERIMENTAL_INSTRUMENTATION`` gate.
+
+The CMake Instrumentation API allows for the collection of timing data, target
+information and system diagnostic information during the configure, generate,
+build, test and install steps for a CMake project.
+
+This feature is only available for projects using the :ref:`Makefile Generators`
+or the :ref:`Ninja Generators`.
+
+All interactions with the CMake instrumentation API must specify both an API
+version and a Data version. At this time, there is only one version for each of
+these: the `API v1`_ and `Data v1`_.
+
+Data Collection
+---------------
+
+Whenever a command is executed with
+instrumentation enabled, a `v1 Snippet File`_ is created in the project build
+tree with data specific to that command. These files remain until after
+`Indexing`_ occurs.
+
+CMake sets the :prop_gbl:`RULE_LAUNCH_COMPILE`, :prop_gbl:`RULE_LAUNCH_LINK` and
+:prop_gbl:`RULE_LAUNCH_CUSTOM` global properties to use the
+``ctest --instrument`` launcher in order to capture details of each compile, link
+and custom command respectively. If the project has been configured with :module:`CTestUseLaunchers`,
+``ctest --instrument`` will also include the behavior usually performed by
+``ctest --launch``.
+
+Indexing
+--------
+
+Indexing is the process of collating generated instrumentation data. Indexing
+occurs at specific intervals called hooks, such as after every build. These
+hooks are configured as part of the `v1 Query Files`_. Whenever a hook is
+triggered, an index file is generated containing a list of snippet files newer
+than the previous indexing.
+
+Indexing and can also be performed by manually invoking
+``ctest --collect-instrumentation <build>``.
+
+Callbacks
+---------
+
+As part of the `v1 Query Files`_, users can provide a list of callbacks
+intended to handle data collected by this feature.
+
+Whenever `Indexing`_ occurs, each provided callback is executed, passing the
+path to the generated index file as an argument.
+
+These callbacks, defined either at the user-level or project-level should read
+the instrumentation data and perform any desired handling of it. The index file
+and its listed snippets are automatically deleted by CMake once all callbacks
+have completed. Note that a callback should never move or delete these data
+files manually as they may be needed by other callbacks.
+
+Enabling Instrumentation
+========================
+
+Instrumentation can be enabled either for an individual CMake project, or
+for all CMake projects configured and built by a user. For both cases,
+see the `v1 Query Files`_ for details on configuring this feature.
+
+Enabling Instrumentation at the Project-Level
+---------------------------------------------
+
+Project code can contain instrumentation queries with the
+:command:`cmake_instrumentation` command.
+
+In addition, query files can be placed manually under
+``<build>/.cmake/instrumentation/<version>/query/`` at the top of a build tree.
+This version of CMake supports only one version schema, `API v1`_.
+
+Enabling Instrumentation at the User-Level
+------------------------------------------
+
+Instrumentation can be configured at the user-level by placing query files in
+the :envvar:`CMAKE_CONFIG_DIR` under
+``<config_dir>/instrumentation/<version>/query/``.
+
+Enabling Instrumentation for CDash Submissions
+----------------------------------------------
+
+You can enable instrumentation when using CTest in :ref:`Dashboard Client`
+mode by setting the :envvar:`CTEST_USE_INSTRUMENTATION` environment variable
+to the current UUID for the ``CMAKE_EXPERIMENTAL_INSTRUMENTATION`` feature.
+Doing so automatically enables the ``dynamicSystemInformation`` query.
+
+The following table shows how each type of instrumented command gets mapped
+to a corresponding type of CTest XML file.
+
+=================================================== ==================
+:ref:`Snippet Role <cmake-instrumentation Data v1>` CTest XML File
+=================================================== ==================
+``configure`` ``Configure.xml``
+``generate`` ``Configure.xml``
+``compile`` ``Build.xml``
+``link`` ``Build.xml``
+``custom`` ``Build.xml``
+``build`` unused!
+``cmakeBuild`` ``Build.xml``
+``cmakeInstall`` ``Build.xml``
+``install`` ``Build.xml``
+``ctest`` ``Build.xml``
+``test`` ``Test.xml``
+=================================================== ==================
+
+By default the command line reported to CDash is truncated at the first space.
+You can instead choose to report the full command line (including arguments)
+by setting :envvar:`CTEST_USE_VERBOSE_INSTRUMENTATION` to 1.
+
+.. _`cmake-instrumentation API v1`:
+
+API v1
+======
+
+The API version specifies both the subdirectory layout of the instrumentation data,
+and the format of the query files.
+
+The Instrumentation API v1 is housed in the ``instrumentation/v1/`` directory
+under either ``<build>/.cmake/`` for output data and project-level queries, or
+``<config_dir>/`` for user-level queries. The ``v1`` component of this
+directory is what signifies the API version. It has the following
+subdirectories:
+
+``query/``
+ Holds query files written by users or clients. Any file with the ``.json``
+ file extension will be recognized as a query file. These files are owned by
+ whichever client or user creates them.
+
+``query/generated/``
+ Holds query files generated by a CMake project with the
+ :command:`cmake_instrumentation` command. These files are owned by CMake and
+ are deleted and regenerated automatically during the CMake configure step.
+
+``data/``
+ Holds instrumentation data collected on the project. CMake owns all data
+ files, they should never be removed by other processes. Data collected here
+ remains until after `Indexing`_ occurs and all `Callbacks`_ are executed.
+
+``cdash/``
+ Holds temporary files used internally to generate XML content to be submitted
+ to CDash.
+
+.. _`cmake-instrumentation v1 Query Files`:
+
+v1 Query Files
+--------------
+
+Any file with the ``.json`` extension under the ``instrumentation/v1/query/``
+directory is recognized as a query for instrumentation data.
+
+These files must contain a JSON object with the following keys. The ``version``
+key is required, but all other fields are optional.
+
+``version``
+ The Data version of snippet file to generate, an integer. Currently the only
+ supported version is ``1``.
+
+``callbacks``
+ A list of command-line strings for `Callbacks`_ to handle collected
+ instrumentation data. Whenever these callbacks are executed, the full path to
+ a `v1 Index File`_ is appended to the arguments included in the string.
+
+``hooks``
+ A list of strings specifying when `Indexing`_ should occur automatically.
+ These are the intervals when instrumentation data should be collated and user
+ `Callbacks`_ should be invoked to handle the data. Elements in this list
+ should be one of the following:
+
+ * ``postGenerate``
+ * ``preBuild`` (called when ``ninja`` or ``make`` is invoked; unavailable on Windows)
+ * ``postBuild`` (called when ``ninja`` or ``make`` completes; unavailable on Windows)
+ * ``preCMakeBuild`` (called when ``cmake --build`` is invoked)
+ * ``postCMakeBuild`` (called when ``cmake --build`` completes)
+ * ``postInstall``
+ * ``postTest``
+
+``queries``
+ A list of strings specifying additional optional data to collect during
+ instrumentation. Elements in this list should be one of the following:
+
+ ``staticSystemInformation``
+ Enables collection of the static information about the host machine CMake
+ is being run from. This data is collected during `Indexing`_ and is
+ included in the generated `v1 Index File`_.
+
+ ``dynamicSystemInformation``
+ Enables collection of the dynamic information about the host machine
+ CMake is being run from. Data is collected for every `v1 Snippet File`_
+ generated by CMake, and includes information from immediately before and
+ after the command is executed.
+
+The ``callbacks`` listed will be invoked during the specified hooks
+*at a minimum*. When there are multiple query files, the ``callbacks``,
+``hooks`` and ``queries`` between them will be merged. Therefore, if any query
+file includes any ``hooks``, every ``callback`` across all query files will be
+executed at every ``hook`` across all query files. Additionally, if any query
+file includes any optional ``queries``, the optional query data will be present
+in all data files.
+
+Example:
+
+.. code-block:: json
+
+ {
+ "version": 1,
+ "callbacks": [
+ "/usr/bin/python callback.py",
+ "/usr/bin/cmake -P callback.cmake arg",
+ ],
+ "hooks": [
+ "postCMakeBuild",
+ "postInstall"
+ ],
+ "queries": [
+ "staticSystemInformation",
+ "dynamicSystemInformation"
+ ]
+ }
+
+In this example, after every ``cmake --build`` or ``cmake --install``
+invocation, an index file ``index-<timestamp>.json`` will be generated in
+``<build>/.cmake/instrumentation/v1/data`` containing a list of data snippet
+files created since the previous indexing. The commands
+``/usr/bin/python callback.py index-<timestamp>.json`` and
+``/usr/bin/cmake -P callback.cmake arg index-<timestamp>.json`` will be executed in
+that order. The index file will contain the ``staticSystemInformation`` data and
+each snippet file listed in the index will contain the
+``dynamicSystemInformation`` data. Once both callbacks have completed, the index
+file and all snippet files listed by it will be deleted from the project build
+tree.
+
+.. _`cmake-instrumentation Data v1`:
+
+Data v1
+=======
+
+Data version specifies the contents of the output files generated by the CMake
+instrumentation API as part of the `Data Collection`_ and `Indexing`_. There are
+two types of data files generated: the `v1 Snippet File`_ and `v1 Index File`_.
+When using the `API v1`_, these files live in
+``<build>/.cmake/instrumentation/v1/data/`` under the project build tree.
+
+v1 Snippet File
+---------------
+
+Snippet files are generated for every compile, link and custom command invoked
+as part of the CMake build or install step and contain instrumentation data about
+the command executed. Additionally, snippet files are created for the following:
+
+* The CMake configure step
+* The CMake generate step
+* Entire build step (executed with ``cmake --build``)
+* Entire install step (executed with ``cmake --install``)
+* Each ``ctest`` invocation
+* Each individual test executed by ``ctest``.
+
+These files remain in the build tree until after `Indexing`_ occurs and any
+user-specified `Callbacks`_ are executed.
+
+Snippet files have a filename with the syntax ``<role>-<hash>-<timestamp>.json``
+and contain the following data:
+
+ ``version``
+ The Data version of the snippet file, an integer. Currently the version is
+ always ``1``.
+
+ ``command``
+ The full command executed. Excluded when ``role`` is ``build``.
+
+ ``workingDir``
+ The working directory in which the ``command`` was executed.
+
+ ``result``
+ The exit-value of the command, an integer.
+
+ ``role``
+ The type of command executed, which will be one of the following values:
+
+ * ``configure``: the CMake configure step
+ * ``generate``: the CMake generate step
+ * ``compile``: an individual compile step invoked during the build
+ * ``link``: an individual link step invoked during the build
+ * ``custom``: an individual custom command invoked during the build
+ * ``build``: a complete ``make`` or ``ninja`` invocation. Only generated if ``preBuild`` or ``postBuild`` hooks are enabled.
+ * ``cmakeBuild``: a complete ``cmake --build`` invocation
+ * ``cmakeInstall``: a complete ``cmake --install`` invocation
+ * ``install``: an individual ``cmake -P cmake_install.cmake`` invocation
+ * ``ctest``: a complete ``ctest`` invocation
+ * ``test``: a single test executed by CTest
+
+ ``target``
+ The CMake target associated with the command. Only included when ``role`` is
+ ``compile`` or ``link``.
+
+ ``targetType``
+ The :prop_tgt:`TYPE` of the target. Only included when ``role`` is
+ ``link``.
+
+ ``targetLabels``
+ The :prop_tgt:`LABELS` of the target. Only included when ``role`` is
+ ``link``.
+
+ ``timeStart``
+ Time at which the command started, expressed as the number of milliseconds
+ since the system epoch.
+
+ ``duration``
+ The duration that the command ran for, expressed in milliseconds.
+
+ ``outputs``
+ The command's output file(s), an array. Only included when ``role`` is one
+ of: ``compile``, ``link``, ``custom``.
+
+ ``outputSizes``
+ The size(s) in bytes of the ``outputs``, an array. For files which do not
+ exist, the size is 0. Included under the same conditions as the ``outputs``
+ field.
+
+ ``source``
+ The source file being compiled. Only included when ``role`` is ``compile``.
+
+ ``language``
+ The language of the source file being compiled. Only included when ``role`` is
+ ``compile``.
+
+ ``testName``
+ The name of the test being executed. Only included when ``role`` is ``test``.
+
+ ``config``
+ The type of build, such as ``Release`` or ``Debug``. Only included when
+ ``role`` is ``compile``, ``link`` or ``test``.
+
+ ``dynamicSystemInformation``
+ Specifies the dynamic information collected about the host machine
+ CMake is being run from. Data is collected for every snippet file
+ generated by CMake, with data immediately before and after the command is
+ executed. Only included when enabled by the `v1 Query Files`_.
+
+ ``beforeHostMemoryUsed``
+ The Host Memory Used in KiB at ``timeStart``.
+
+ ``afterHostMemoryUsed``
+ The Host Memory Used in KiB at ``timeStop``.
+
+ ``beforeCPULoadAverage``
+ The Average CPU Load at ``timeStart``.
+
+ ``afterCPULoadAverage``
+ The Average CPU Load at ``timeStop``.
+
+Example:
+
+.. code-block:: json
+
+ {
+ "version": 1,
+ "command" : "\"/usr/bin/c++\" \"-MD\" \"-MT\" \"CMakeFiles/main.dir/main.cxx.o\" \"-MF\" \"CMakeFiles/main.dir/main.cxx.o.d\" \"-o\" \"CMakeFiles/main.dir/main.cxx.o\" \"-c\" \"<src>/main.cxx\"",
+ "role" : "compile",
+ "return" : 1,
+ "target": "main",
+ "language" : "C++",
+ "outputs" : [ "CMakeFiles/main.dir/main.cxx.o" ],
+ "outputSizes" : [ 0 ],
+ "source" : "<src>/main.cxx",
+ "config" : "Debug",
+ "dynamicSystemInformation" :
+ {
+ "afterCPULoadAverage" : 2.3500000000000001,
+ "afterHostMemoryUsed" : 6635680.0
+ "beforeCPULoadAverage" : 2.3500000000000001,
+ "beforeHostMemoryUsed" : 6635832.0
+ },
+ "timeStart" : 1737053448177,
+ "duration" : 31
+ }
+
+v1 Index File
+-------------
+
+Index files contain a list of `v1 Snippet File`_. It serves as an entry point
+for navigating the instrumentation data. They are generated whenever `Indexing`_
+occurs and deleted after any user-specified `Callbacks`_ are executed.
+
+``version``
+ The Data version of the index file, an integer. Currently the version is
+ always ``1``.
+
+``buildDir``
+ The build directory of the CMake project.
+
+``dataDir``
+ The full path to the ``<build>/.cmake/instrumentation/v1/data/`` directory.
+
+``hook``
+ The name of the hook responsible for generating the index file. In addition
+ to the hooks that can be specified by one of the `v1 Query Files`_, this value may
+ be set to ``manual`` if indexing is performed by invoking
+ ``ctest --collect-instrumentation <build>``.
+
+``snippets``
+ Contains a list of `v1 Snippet File`_. This includes all snippet files
+ generated since the previous index file was created. The file paths are
+ relative to ``dataDir``.
+
+``staticSystemInformation``
+ Specifies the static information collected about the host machine
+ CMake is being run from. Only included when enabled by the `v1 Query Files`_.
+
+ * ``OSName``
+ * ``OSPlatform``
+ * ``OSRelease``
+ * ``OSVersion``
+ * ``familyId``
+ * ``hostname``
+ * ``is64Bits``
+ * ``modelId``
+ * ``numberOfLogicalCPU``
+ * ``numberOfPhysicalCPU``
+ * ``processorAPICID``
+ * ``processorCacheSize``
+ * ``processorClockFrequency``
+ * ``processorName``
+ * ``totalPhysicalMemory``
+ * ``totalVirtualMemory``
+ * ``vendorID``
+ * ``vendorString``
+
+Example:
+
+.. code-block:: json
+
+ {
+ "version": 1,
+ "hook": "manual",
+ "buildDir": "<build>",
+ "dataDir": "<build>/.cmake/instrumentation/v1/data",
+ "snippets": [
+ "configure-<hash>-<timestamp>.json",
+ "generate-<hash>-<timestamp>.json",
+ "compile-<hash>-<timestamp>.json",
+ "compile-<hash>-<timestamp>.json",
+ "link-<hash>-<timestamp>.json",
+ "install-<hash>-<timestamp>.json",
+ "ctest-<hash>-<timestamp>.json",
+ "test-<hash>-<timestamp>.json",
+ "test-<hash>-<timestamp>.json",
+ ]
+ }
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 9f014e1..e758637 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -85,7 +85,6 @@ These modules are loaded using the :command:`include` command.
/module/InstallRequiredSystemLibraries
/module/ProcessorCount
/module/SelectLibraryConfigurations
- /module/SquishTestScript
/module/TestForANSIForScope
/module/TestForANSIStreamHeaders
/module/TestForSSTREAM
@@ -133,7 +132,6 @@ They are normally called through the :command:`find_package` command.
/module/FindFontconfig
/module/FindFreetype
/module/FindGCCXML
- /module/FindGDAL
/module/FindGettext
/module/FindGIF
/module/FindGit
@@ -275,12 +273,13 @@ Deprecated Utility Modules
/module/Documentation
/module/GetPrerequisites
/module/MacroAddFileDependencies
+ /module/SquishTestScript
/module/TestBigEndian
/module/TestCXXAcceptsFlag
+ /module/Use_wxWindows
/module/UseJavaClassFilelist
/module/UseJavaSymlinks
/module/UsePkgConfig
- /module/Use_wxWindows
/module/WriteBasicConfigVersionFile
/module/WriteCompilerDetectionHeader
@@ -293,6 +292,7 @@ Deprecated Find Modules
/module/FindBoost
/module/FindCUDA
/module/FindDart
+ /module/FindGDAL
/module/FindITK
/module/FindPythonInterp
/module/FindPythonLibs
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index ed85dc4..ed94b1d 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -682,7 +682,9 @@ If a project arranges for package registry entries to exist, such as::
45e7d55f13b87179bb12f907c8de6fc4 REG_SZ c:/Users/Me/Work/lib/cmake/MyPackage
7b4a9844f681c80ce93190d4e3185db9 REG_SZ c:/Users/Me/Work/MyPackage-build
-or::
+or
+
+.. code-block:: console
$ cat ~/.cmake/packages/MyPackage/7d1fb77e07ce59a81bed093bbee945bd
/home/me/work/lib/cmake/MyPackage
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index c62fb48..0165d6a 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -10,49 +10,102 @@ cmake-policies(7)
Introduction
============
-Policies in CMake are used to preserve backward compatible behavior
-across multiple releases. When a new policy is introduced, newer CMake
-versions will begin to warn about the backward compatible behavior. It
-is possible to disable the warning by explicitly requesting the OLD, or
-backward compatible behavior using the :command:`cmake_policy` command.
-It is also possible to request ``NEW``, or non-backward compatible behavior
-for a policy, also avoiding the warning. Each policy can also be set to
-either ``NEW`` or ``OLD`` behavior explicitly on the command line with the
-:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable.
-
-A policy is a deprecation mechanism and not a reliable feature toggle.
-A policy should almost never be set to ``OLD``, except to silence warnings
-in an otherwise frozen or stable codebase, or temporarily as part of a
-larger migration path. The ``OLD`` behavior of each policy is undesirable
-and will be replaced with an error condition in a future release.
-
-The :command:`cmake_minimum_required` command does more than report an
-error if a too-old version of CMake is used to build a project. It
-also sets all policies introduced in that CMake version or earlier to
-``NEW`` behavior. To manage policies without increasing the minimum required
-CMake version, the :command:`if(POLICY)` command may be used:
+CMake policies introduce behavior changes while preserving compatibility
+for existing project releases. Policies are deprecation mechanisms, not
+feature toggles. Each policy documents a deprecated ``OLD`` behavior and
+a preferred ``NEW`` behavior. Projects must be updated over time to
+use the ``NEW`` behavior, but their existing releases will continue to
+work with the ``OLD`` behavior.
+
+Updating Projects
+-----------------
+
+When policies are newly introduced by a version of CMake, their ``OLD``
+behaviors are immediately deprecated by that version of CMake and later.
+Projects should be updated to use the ``NEW`` behaviors of the policies
+as soon as possible.
+
+Use the :command:`cmake_minimum_required` command to record the latest
+version of CMake for which a project has been updated.
+For example:
+
+..
+ Sync this cmake_minimum_required example with ``Help/dev/maint.rst``.
.. code-block:: cmake
- if(POLICY CMP0990)
- cmake_policy(SET CMP0990 NEW)
- endif()
+ cmake_minimum_required(VERSION 3.10...3.31)
+
+This uses the ``<min>...<max>`` syntax to enable the ``NEW`` behaviors
+of policies introduced in CMake 3.31 and earlier while only requiring a
+minimum version of CMake 3.10. The project is expected to work with
+both the ``OLD`` and ``NEW`` behaviors of policies introduced between
+those versions.
+
+Transition Schedule
+-------------------
+
+To help projects port to the ``NEW`` behaviors of policies on their own
+schedule, CMake offers a transition period:
+
+* If a policy is not set by a project, CMake uses its ``OLD`` behavior,
+ but may warn that the policy has not been set.
+
+ * Users running CMake may silence the warning without modifying a
+ project by setting the :variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>`
+ variable as a cache entry on the :manual:`cmake(1)` command line:
+
+ .. code-block:: shell
+
+ cmake -DCMAKE_POLICY_DEFAULT_CMP0990=OLD ...
+
+ * Projects may silence the warning by using the :command:`cmake_policy`
+ command to explicitly set the policy to ``OLD`` or ``NEW`` behavior:
+
+ .. code-block:: cmake
+
+ if(POLICY CMP0990)
+ cmake_policy(SET CMP0990 NEW)
+ endif()
+
+ .. note::
+
+ A policy should almost never be set to ``OLD``, except to silence
+ warnings in an otherwise frozen or stable codebase, or temporarily
+ as part of a larger migration path.
-This has the effect of using the ``NEW`` behavior with newer CMake releases which
-users may be using and not issuing a compatibility warning.
+* If a policy is set to ``OLD`` by a project, CMake versions released
+ at least |POLICY_OLD_DELAY_WARNING| after the version that introduced
+ a policy may issue a warning that the policy's ``OLD`` behavior will
+ be removed from a future version of CMake.
-The setting of a policy is confined in some cases to not propagate to the
-parent scope. For example, if the files read by the :command:`include` command
-or the :command:`find_package` command contain a use of :command:`cmake_policy`,
-that policy setting will not affect the caller by default. Both commands accept
-an optional ``NO_POLICY_SCOPE`` keyword to control this behavior.
+* If a policy is not set to ``NEW`` by a project, CMake versions released
+ at least |POLICY_OLD_DELAY_ERROR| after the version that introduced a
+ policy, and whose major version number is higher, may issue an error
+ that the policy's ``OLD`` behavior has been removed.
-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.
+.. |POLICY_OLD_DELAY_WARNING| replace:: 2 years
+.. |POLICY_OLD_DELAY_ERROR| replace:: 6 years
+
+Supported Policies
+==================
+
+The following policies are supported.
+
+Policies Introduced by CMake 4.0
+--------------------------------
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0185: FindRuby no longer provides upper-case RUBY_* variables. </policy/CMP0185>
+ CMP0184: MSVC runtime checks flags are selected by an abstraction. </policy/CMP0184>
+ CMP0183: add_feature_info() supports full Condition Syntax. </policy/CMP0183>
+ CMP0182: Create shared library archives by default on AIX. </policy/CMP0182>
+ CMP0181: Link command-line fragment variables are parsed and re-quoted. </policy/CMP0181>
Policies Introduced by CMake 3.31
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -69,7 +122,7 @@ Policies Introduced by CMake 3.31
CMP0171: 'codegen' is a reserved target name. </policy/CMP0171>
Policies Introduced by CMake 3.30
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -85,7 +138,7 @@ Policies Introduced by CMake 3.30
CMP0162: Visual Studio generators add UseDebugLibraries indicators by default. </policy/CMP0162>
Policies Introduced by CMake 3.29
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -98,7 +151,7 @@ Policies Introduced by CMake 3.29
CMP0156: De-duplicate libraries on link lines based on linker capabilities. </policy/CMP0156>
Policies Introduced by CMake 3.28
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -109,7 +162,7 @@ Policies Introduced by CMake 3.28
CMP0152: file(REAL_PATH) resolves symlinks before collapsing ../ components. </policy/CMP0152>
Policies Introduced by CMake 3.27
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -124,7 +177,7 @@ Policies Introduced by CMake 3.27
CMP0144: find_package uses upper-case PACKAGENAME_ROOT variables. </policy/CMP0144>
Policies Introduced by CMake 3.26
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -132,7 +185,7 @@ Policies Introduced by CMake 3.26
CMP0143: USE_FOLDERS global property is treated as ON by default. </policy/CMP0143>
Policies Introduced by CMake 3.25
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -142,7 +195,7 @@ Policies Introduced by CMake 3.25
CMP0140: The return() command checks its arguments. </policy/CMP0140>
Policies Introduced by CMake 3.24
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -159,7 +212,7 @@ Policies Introduced by CMake 3.24
CMP0130: while() diagnoses condition evaluation errors. </policy/CMP0130>
Policies Introduced by CMake 3.23
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -167,7 +220,7 @@ Policies Introduced by CMake 3.23
CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU. </policy/CMP0129>
Policies Introduced by CMake 3.22
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -176,7 +229,7 @@ Policies Introduced by CMake 3.22
CMP0127: cmake_dependent_option() supports full Condition Syntax. </policy/CMP0127>
Policies Introduced by CMake 3.21
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -189,7 +242,7 @@ Policies Introduced by CMake 3.21
CMP0121: The list command detects invalid indices. </policy/CMP0121>
Policies Introduced by CMake 3.20
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -202,7 +255,7 @@ Policies Introduced by CMake 3.20
CMP0115: Source file extensions must be explicit. </policy/CMP0115>
Policies Introduced by CMake 3.19
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -215,7 +268,7 @@ Policies Introduced by CMake 3.19
CMP0109: find_program() requires permission to execute but not to read. </policy/CMP0109>
Policies Introduced by CMake 3.18
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -228,7 +281,7 @@ Policies Introduced by CMake 3.18
CMP0103: Multiple export() with same FILE without APPEND is not allowed. </policy/CMP0103>
Policies Introduced by CMake 3.17
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -240,7 +293,7 @@ Policies Introduced by CMake 3.17
CMP0098: FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0098>
Policies Introduced by CMake 3.16
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -250,7 +303,7 @@ Policies Introduced by CMake 3.16
CMP0095: RPATH entries are properly escaped in the intermediary CMake install script. </policy/CMP0095>
Policies Introduced by CMake 3.15
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -263,7 +316,7 @@ Policies Introduced by CMake 3.15
CMP0089: Compiler id for IBM Clang-based XL compilers is now XLClang. </policy/CMP0089>
Policies Introduced by CMake 3.14
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -278,7 +331,7 @@ Policies Introduced by CMake 3.14
Policies Introduced by CMake 3.13
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -291,7 +344,7 @@ Policies Introduced by CMake 3.13
CMP0076: target_sources() command converts relative paths to absolute. </policy/CMP0076>
Policies Introduced by CMake 3.12
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -301,7 +354,7 @@ Policies Introduced by CMake 3.12
CMP0073: Do not produce legacy _LIB_DEPENDS cache entries. </policy/CMP0073>
Policies Introduced by CMake 3.11
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -309,7 +362,7 @@ Policies Introduced by CMake 3.11
CMP0072: FindOpenGL prefers GLVND by default when available. </policy/CMP0072>
Policies Introduced by CMake 3.10
-=================================
+---------------------------------
.. toctree::
:maxdepth: 1
@@ -318,7 +371,7 @@ Policies Introduced by CMake 3.10
CMP0070: Define file(GENERATE) behavior for relative paths. </policy/CMP0070>
Policies Introduced by CMake 3.9
-================================
+--------------------------------
.. toctree::
:maxdepth: 1
@@ -327,7 +380,7 @@ Policies Introduced by CMake 3.9
CMP0068: RPATH settings on macOS do not affect install_name. </policy/CMP0068>
Policies Introduced by CMake 3.8
-================================
+--------------------------------
.. toctree::
:maxdepth: 1
@@ -335,15 +388,25 @@ Policies Introduced by CMake 3.8
CMP0067: Honor language standard in try_compile() source-file signature. </policy/CMP0067>
Policies Introduced by CMake 3.7
-================================
+--------------------------------
.. toctree::
:maxdepth: 1
CMP0066: Honor per-config flags in try_compile() source-file signature. </policy/CMP0066>
-Policies Introduced by CMake 3.4
-================================
+Unsupported Policies
+====================
+
+The following policies are no longer supported.
+Projects' calls to :command:`cmake_minimum_required(VERSION)` or
+:command:`cmake_policy(VERSION)` must set them to ``NEW``.
+Their ``OLD`` behaviors have been removed from CMake.
+
+.. _`Policies Introduced by CMake 3.4`:
+
+Policies Introduced by CMake 3.4, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
@@ -351,8 +414,10 @@ Policies Introduced by CMake 3.4
CMP0065: Do not add flags to export symbols from executables without the ENABLE_EXPORTS target property. </policy/CMP0065>
CMP0064: Support new TEST if() operator. </policy/CMP0064>
-Policies Introduced by CMake 3.3
-================================
+.. _`Policies Introduced by CMake 3.3`:
+
+Policies Introduced by CMake 3.3, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
@@ -365,8 +430,10 @@ Policies Introduced by CMake 3.3
CMP0058: Ninja requires custom command byproducts to be explicit. </policy/CMP0058>
CMP0057: Support new IN_LIST if() operator. </policy/CMP0057>
-Policies Introduced by CMake 3.2
-================================
+.. _`Policies Introduced by CMake 3.2`:
+
+Policies Introduced by CMake 3.2, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
@@ -374,8 +441,10 @@ Policies Introduced by CMake 3.2
CMP0056: Honor link flags in try_compile() source-file signature. </policy/CMP0056>
CMP0055: Strict checking for break() command. </policy/CMP0055>
-Policies Introduced by CMake 3.1
-================================
+.. _`Policies Introduced by CMake 3.1`:
+
+Policies Introduced by CMake 3.1, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
@@ -385,8 +454,10 @@ Policies Introduced by CMake 3.1
CMP0052: Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES. </policy/CMP0052>
CMP0051: List TARGET_OBJECTS in SOURCES target property. </policy/CMP0051>
-Policies Introduced by CMake 3.0
-================================
+.. _`Policies Introduced by CMake 3.0`:
+
+Policies Introduced by CMake 3.0, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
@@ -419,8 +490,10 @@ Policies Introduced by CMake 3.0
CMP0025: Compiler id for Apple Clang is now AppleClang. </policy/CMP0025>
CMP0024: Disallow include export result. </policy/CMP0024>
-Policies Introduced by CMake 2.8
-================================
+.. _`Policies Introduced by CMake 2.8`:
+
+Policies Introduced by CMake 2.8, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
@@ -438,8 +511,10 @@ Policies Introduced by CMake 2.8
CMP0013: Duplicate binary directories are not allowed. </policy/CMP0013>
CMP0012: if() recognizes numbers and boolean constants. </policy/CMP0012>
-Policies Introduced by CMake 2.6
-================================
+.. _`Policies Introduced by CMake 2.6`:
+
+Policies Introduced by CMake 2.6, Removed by CMake 4.0
+------------------------------------------------------
.. toctree::
:maxdepth: 1
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index e52376f..9400a1b 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -1124,8 +1124,8 @@ fields:
``steps``
A required array of objects describing the steps of the workflow. The first
- step must be a configure preset, and all subsequent steps must be non-
- configure presets whose ``configurePreset`` field matches the starting
+ step must be a configure preset, and all subsequent steps must be
+ non-configure presets whose ``configurePreset`` field matches the starting
configure preset. Each object may contain the following fields:
``type``
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 10dbe10..224f1d8 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -97,6 +97,7 @@ Properties on Directories
/prop_dir/VARIABLES
/prop_dir/VS_GLOBAL_SECTION_POST_section
/prop_dir/VS_GLOBAL_SECTION_PRE_section
+ /prop_dir/VS_SOLUTION_ITEMS
/prop_dir/VS_STARTUP_PROJECT
.. _`Target Properties`:
@@ -203,6 +204,7 @@ Properties on Targets
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_STANDARD_REQUIRED
/prop_tgt/DEBUG_POSTFIX
+ /prop_tgt/DEBUGGER_WORKING_DIRECTORY
/prop_tgt/DEFINE_SYMBOL
/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES
/prop_tgt/DEPLOYMENT_REMOTE_DIRECTORY
@@ -224,7 +226,7 @@ Properties on Targets
/prop_tgt/EXPORT_NO_SYSTEM
/prop_tgt/EXPORT_PROPERTIES
/prop_tgt/FOLDER
- /prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES
+ /prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES
/prop_tgt/Fortran_FORMAT
/prop_tgt/Fortran_MODULE_DIRECTORY
/prop_tgt/Fortran_PREPROCESS
@@ -342,6 +344,7 @@ Properties on Targets
/prop_tgt/LINK_OPTIONS
/prop_tgt/LINK_SEARCH_END_STATIC
/prop_tgt/LINK_SEARCH_START_STATIC
+ /prop_tgt/LINK_WARNING_AS_ERROR
/prop_tgt/LINK_WHAT_YOU_USE
/prop_tgt/LINKER_LANGUAGE
/prop_tgt/LINKER_TYPE
@@ -356,6 +359,7 @@ Properties on Targets
/prop_tgt/MANUALLY_ADDED_DEPENDENCIES
/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG
/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT
+ /prop_tgt/MSVC_RUNTIME_CHECKS
/prop_tgt/MSVC_RUNTIME_LIBRARY
/prop_tgt/NAME
/prop_tgt/NO_SONAME
@@ -415,6 +419,7 @@ Properties on Targets
/prop_tgt/UNITY_BUILD_CODE_AFTER_INCLUDE
/prop_tgt/UNITY_BUILD_CODE_BEFORE_INCLUDE
/prop_tgt/UNITY_BUILD_MODE
+ /prop_tgt/UNITY_BUILD_RELOCATABLE
/prop_tgt/UNITY_BUILD_UNIQUE_ID
/prop_tgt/VERIFY_INTERFACE_HEADER_SETS
/prop_tgt/VERSION
@@ -490,7 +495,9 @@ Properties on Targets
/prop_tgt/XCODE_SCHEME_EXECUTABLE
/prop_tgt/XCODE_SCHEME_GUARD_MALLOC
/prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION
+ /prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION
/prop_tgt/XCODE_SCHEME_LAUNCH_MODE
+ /prop_tgt/XCODE_SCHEME_LLDB_INIT_FILE
/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES
/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE
@@ -583,6 +590,7 @@ Properties on Source Files
/prop_sf/UNITY_GROUP
/prop_sf/VS_COPY_TO_OUT_DIR
/prop_sf/VS_CSHARP_tagname
+ /prop_sf/VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD
/prop_sf/VS_DEPLOYMENT_CONTENT
/prop_sf/VS_DEPLOYMENT_LOCATION
/prop_sf/VS_INCLUDE_IN_VSIX
@@ -655,6 +663,7 @@ Deprecated Properties on Targets
:maxdepth: 1
/prop_tgt/COMPILE_DEFINITIONS_CONFIG
+ /prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES
/prop_tgt/IMPORTED_NO_SYSTEM
/prop_tgt/IOS_INSTALL_COMBINED
/prop_tgt/POST_INSTALL_SCRIPT
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 4c27bd5..16c072d 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -78,10 +78,13 @@ Variables that Provide Information
/variable/CMAKE_LANG_COMPILER_LINKER_ID
/variable/CMAKE_LANG_COMPILER_LINKER_VERSION
/variable/CMAKE_LANG_COMPILER_RANLIB
+ /variable/CMAKE_LANG_DEVICE_LINK_MODE
/variable/CMAKE_LANG_LINK_LIBRARY_SUFFIX
+ /variable/CMAKE_LANG_LINK_MODE
/variable/CMAKE_LINK_LIBRARY_SUFFIX
/variable/CMAKE_LINK_SEARCH_END_STATIC
/variable/CMAKE_LINK_SEARCH_START_STATIC
+ /variable/CMAKE_LIST_FILE_NAME
/variable/CMAKE_MAJOR_VERSION
/variable/CMAKE_MAKE_PROGRAM
/variable/CMAKE_MATCH_COUNT
@@ -90,6 +93,7 @@ Variables that Provide Information
/variable/CMAKE_MINOR_VERSION
/variable/CMAKE_NETRC
/variable/CMAKE_NETRC_FILE
+ /variable/CMAKE_OBJDUMP
/variable/CMAKE_PARENT_LIST_FILE
/variable/CMAKE_PATCH_VERSION
/variable/CMAKE_PROJECT_DESCRIPTION
@@ -175,6 +179,7 @@ Variables that Change Behavior
:maxdepth: 1
/variable/BUILD_SHARED_LIBS
+ /variable/BUILD_TESTING
/variable/CMAKE_ABSOLUTE_DESTINATION_FILES
/variable/CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY
/variable/CMAKE_APPBUNDLE_PATH
@@ -196,8 +201,10 @@ Variables that Change Behavior
/variable/CMAKE_ERROR_DEPRECATED
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO
+ /variable/CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
/variable/CMAKE_EXPORT_BUILD_DATABASE
/variable/CMAKE_EXPORT_COMPILE_COMMANDS
+ /variable/CMAKE_EXPORT_SARIF
/variable/CMAKE_EXPORT_PACKAGE_REGISTRY
/variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY
/variable/CMAKE_FIND_APPBUNDLE
@@ -246,7 +253,13 @@ Variables that Change Behavior
/variable/CMAKE_MESSAGE_LOG_LEVEL
/variable/CMAKE_MFC_FLAG
/variable/CMAKE_MODULE_PATH
+ /variable/CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED
+ /variable/CMAKE_PKG_CONFIG_PC_LIB_DIRS
+ /variable/CMAKE_PKG_CONFIG_PC_PATH
+ /variable/CMAKE_PKG_CONFIG_SYSROOT_DIR
+ /variable/CMAKE_PKG_CONFIG_TOP_BUILD_DIR
/variable/CMAKE_POLICY_DEFAULT_CMPNNNN
+ /variable/CMAKE_POLICY_VERSION_MINIMUM
/variable/CMAKE_POLICY_WARNING_CMPNNNN
/variable/CMAKE_PREFIX_PATH
/variable/CMAKE_PROGRAM_PATH
@@ -294,7 +307,9 @@ Variables that Change Behavior
/variable/CMAKE_XCODE_SCHEME_ENVIRONMENT
/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC
/variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION
+ /variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION
/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE
+ /variable/CMAKE_XCODE_SCHEME_LLDB_INIT_FILE
/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES
/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE
@@ -314,6 +329,7 @@ Variables that Describe the System
.. toctree::
:maxdepth: 1
+ /variable/AIX
/variable/ANDROID
/variable/APPLE
/variable/BORLAND
@@ -322,6 +338,7 @@ Variables that Describe the System
/variable/CMAKE_CL_64
/variable/CMAKE_COMPILER_2005
/variable/CMAKE_HOST_APPLE
+ /variable/CMAKE_HOST_AIX
/variable/CMAKE_HOST_BSD
/variable/CMAKE_HOST_EXECUTABLE_SUFFIX
/variable/CMAKE_HOST_LINUX
@@ -433,6 +450,7 @@ Variables that Control the Build
/variable/CMAKE_CXX_MODULE_STD
/variable/CMAKE_CXX_SCAN_FOR_MODULES
/variable/CMAKE_DEBUG_POSTFIX
+ /variable/CMAKE_DEBUGGER_WORKING_DIRECTORY
/variable/CMAKE_DEFAULT_BUILD_TYPE
/variable/CMAKE_DEFAULT_CONFIGS
/variable/CMAKE_DEPENDS_USE_COMPILER
@@ -480,7 +498,6 @@ Variables that Control the Build
/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED
/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG
/variable/CMAKE_LANG_LINKER_LAUNCHER
- /variable/CMAKE_LANG_USING_LINKER_MODE
/variable/CMAKE_LANG_USING_LINKER_TYPE
/variable/CMAKE_LANG_VISIBILITY_PRESET
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY
@@ -498,6 +515,7 @@ Variables that Control the Build
/variable/CMAKE_LINK_LIBRARY_FLAG
/variable/CMAKE_LINK_LIBRARY_USING_FEATURE
/variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED
+ /variable/CMAKE_LINK_WARNING_AS_ERROR
/variable/CMAKE_LINK_WHAT_YOU_USE
/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK
/variable/CMAKE_LINKER_TYPE
@@ -509,6 +527,7 @@ Variables that Control the Build
/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG_INIT
/variable/CMAKE_MODULE_LINKER_FLAGS_INIT
/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
+ /variable/CMAKE_MSVC_RUNTIME_CHECKS
/variable/CMAKE_MSVC_RUNTIME_LIBRARY
/variable/CMAKE_MSVCIDE_RUN_PATH
/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX
@@ -544,6 +563,7 @@ Variables that Control the Build
/variable/CMAKE_TRY_COMPILE_TARGET_TYPE
/variable/CMAKE_UNITY_BUILD
/variable/CMAKE_UNITY_BUILD_BATCH_SIZE
+ /variable/CMAKE_UNITY_BUILD_RELOCATABLE
/variable/CMAKE_UNITY_BUILD_UNIQUE_ID
/variable/CMAKE_VERIFY_INTERFACE_HEADER_SETS
/variable/CMAKE_VISIBILITY_INLINES_HIDDEN
@@ -611,6 +631,8 @@ Variables for Languages
/variable/CMAKE_LANG_ARCHIVE_APPEND
/variable/CMAKE_LANG_ARCHIVE_CREATE
/variable/CMAKE_LANG_ARCHIVE_FINISH
+ /variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG
+ /variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG_SEP
/variable/CMAKE_LANG_BYTE_ORDER
/variable/CMAKE_LANG_COMPILE_OBJECT
/variable/CMAKE_LANG_COMPILER
@@ -715,6 +737,7 @@ Variables for CTest
/variable/CTEST_DROP_SITE_PASSWORD
/variable/CTEST_DROP_SITE_USER
/variable/CTEST_EXTRA_COVERAGE_GLOB
+ /variable/CTEST_EXTRA_SUBMIT_FILES
/variable/CTEST_GIT_COMMAND
/variable/CTEST_GIT_INIT_SUBMODULES
/variable/CTEST_GIT_UPDATE_CUSTOM
@@ -728,6 +751,7 @@ Variables for CTest
/variable/CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
/variable/CTEST_MEMORYCHECK_TYPE
/variable/CTEST_NIGHTLY_START_TIME
+ /variable/CTEST_NOTES_FILES
/variable/CTEST_P4_CLIENT
/variable/CTEST_P4_COMMAND
/variable/CTEST_P4_OPTIONS
@@ -841,6 +865,7 @@ Deprecated Variables that Control the Build
:maxdepth: 1
/variable/CMAKE_IOS_INSTALL_COMBINED
+ /variable/CMAKE_LANG_USING_LINKER_MODE
/variable/CMAKE_USE_RELATIVE_PATHS
Deprecated Variables for Languages
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 4610e11..e20cb9c 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -167,12 +167,12 @@ the current working directory (cwd) is used for the other. For example:
============================== ============ ===========
Command Line Source Dir Build Dir
============================== ============ ===========
- ``cmake -B build`` `cwd` ``build``
+ ``cmake -B build`` *cwd* ``build``
``cmake -B build src`` ``src`` ``build``
``cmake -B build -S src`` ``src`` ``build``
- ``cmake src`` ``src`` `cwd`
- ``cmake build`` (existing) `loaded` ``build``
- ``cmake -S src`` ``src`` `cwd`
+ ``cmake src`` ``src`` *cwd*
+ ``cmake build`` (existing) *loaded* ``build``
+ ``cmake -S src`` ``src`` *cwd*
``cmake -S src build`` ``src`` ``build``
``cmake -S src -B build`` ``src`` ``build``
============================== ============ ===========
@@ -307,6 +307,16 @@ Options
When this command line option is given, :variable:`CMAKE_MESSAGE_CONTEXT_SHOW`
is ignored.
+.. option:: --sarif-output=<path>
+
+ .. versionadded:: 4.0
+
+ Enable logging of diagnostic messages produced by CMake in the SARIF format.
+
+ Write diagnostic messages to a SARIF file at the path specified. Projects can
+ also set :variable:`CMAKE_EXPORT_SARIF` to ``ON`` to enable this feature for a
+ build tree.
+
.. option:: --debug-trycompile
Do not delete the files and directories created for
@@ -395,7 +405,7 @@ Options
``json-v1``
Prints each line as a separate JSON document. Each document is
- separated by a newline ( ``\n`` ). It is guaranteed that no
+ separated by a newline (``\n``). It is guaranteed that no
newline characters will be present inside a JSON document.
.. code-block:: json
@@ -513,6 +523,14 @@ Options
:variable:`CMAKE_COMPILE_WARNING_AS_ERROR`, preventing warnings from being
treated as errors on compile.
+.. option:: --link-no-warning-as-error
+
+ .. versionadded:: 4.0
+
+ Ignore target property :prop_tgt:`LINK_WARNING_AS_ERROR` and variable
+ :variable:`CMAKE_LINK_WARNING_AS_ERROR`, preventing warnings from being
+ treated as errors on link.
+
.. option:: --profiling-output=<path>
.. versionadded:: 3.18
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 9281339..132dc80 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -353,18 +353,32 @@ Run Tests
This allows the user to widen the output to avoid clipping the test
name which can be very annoying.
-.. option:: --interactive-debug-mode [0|1]
+.. option:: --interactive-debug-mode <0|1>
- Set the interactive mode to ``0`` or ``1``.
+ Disable (``0``) or enable (``1``) interactive debug mode.
This option causes CTest to run tests in either an interactive mode
or a non-interactive mode. In dashboard mode (``Experimental``, ``Nightly``,
``Continuous``), the default is non-interactive. In non-interactive mode,
the environment variable :envvar:`DASHBOARD_TEST_FROM_CTEST` is set.
- Prior to CMake 3.11, interactive mode on Windows allowed system debug
- popup windows to appear. Now, due to CTest's use of ``libuv`` to launch
- test processes, all system debug popup windows are always blocked.
+ Interactive Mode allows Windows Error Reporting (WER) to show debug popup
+ windows and to create core dumps. To enable core dumps in tests,
+ use interactive mode, and follow the Windows documentation
+ on `Collecting User-Mode Dumps`_.
+
+ .. versionchanged:: 4.0
+ Windows Error Reporting (WER) is enabled in interactive mode, so
+ test processes may show debug popup windows and create core dumps.
+ This was made possible by updates to ``libuv``.
+
+ .. versionchanged:: 3.11
+ Windows Error Reporting (WER) is disabled in both interactive and
+ non-interactive modes, so test processes do not show popup windows
+ or create core dumps. This is due to launching test processes with
+ ``libuv``.
+
+.. _`Collecting User-Mode Dumps`: https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
.. option:: --no-label-summary
@@ -421,11 +435,8 @@ Run Tests
.. option:: --force-new-ctest-process
- Run child CTest instances as new processes.
-
- By default CTest will run child CTest instances within the same
- process. If this behavior is not desired, this argument will
- enforce new processes for child CTest processes.
+ Ignored. This option once disabled a now-removed optimization
+ for tests running ``ctest`` itself.
.. option:: --schedule-random
@@ -540,7 +551,7 @@ that are mapped to subprojects.
When the :prop_test:`PROCESSORS` test property is set, CTest will display a
weighted test timing result in label and subproject summaries. The time is
-reported with `sec*proc` instead of just `sec`.
+reported with ``sec * proc`` instead of just ``sec``.
The weighted time summary reported for each label or subproject ``j``
is computed as::
@@ -784,9 +795,8 @@ The available ``<dashboard-options>`` are the following:
.. option:: --extra-submit <file>[;<file>]
- Submit extra files to the dashboard.
-
- This option will submit extra files to the dashboard.
+ Submit extra ``.xml`` part files to the dashboard.
+ See the :command:`ctest_submit` command's ``PARTS ExtraFiles`` option.
.. option:: --http-header <header>
@@ -800,10 +810,10 @@ The available ``<dashboard-options>`` are the following:
.. option:: --http1.0
- Submit using `HTTP 1.0`.
+ Submit using ``HTTP 1.0``.
- This option will force CTest to use `HTTP 1.0` to submit files to the
- dashboard, instead of `HTTP 1.1`.
+ This option will force CTest to use ``HTTP 1.0`` to submit files to the
+ dashboard, instead of ``HTTP 1.1``.
.. option:: --no-compress-output
@@ -1505,7 +1515,7 @@ Configuration settings include:
* `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_PASSWORD`
* :module:`CTest` module variable: ``DROP_SITE_PASSWORD`` if set,
- else ``CTEST_DROP_SITE_PASWORD``
+ else ``CTEST_DROP_SITE_PASSWORD``
``DropSiteUser``
Legacy option. When ``SubmitURL`` is not set, it is constructed from
diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst
index aecfa71..e06a4c2 100644
--- a/Help/policy/CMP0000.rst
+++ b/Help/policy/CMP0000.rst
@@ -1,6 +1,9 @@
CMP0000
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
A minimum required CMake version must be specified.
CMake requires that projects specify the version of CMake to which
@@ -10,7 +13,7 @@ CMake. Specifying a version also helps the project build with CMake
versions newer than that specified. Use the :command:`cmake_minimum_required`
command at the top of your main ``CMakeLists.txt`` file:
-::
+.. code-block:: cmake
cmake_minimum_required(VERSION <major>.<minor>)
@@ -21,14 +24,10 @@ the project. See documentation of :command:`cmake_minimum_required` for
details.
Note that the command invocation must appear in the ``CMakeLists.txt``
-file itself; a call in an included file is not sufficient. However,
-the :command:`cmake_policy` command may be called to set policy ``CMP0000``
-to ``OLD`` or ``NEW`` behavior explicitly. The ``OLD`` behavior is to
-silently ignore the missing invocation. The ``NEW`` behavior is to issue
-an error instead of a warning. An included file may set ``CMP0000``
-explicitly to affect how this policy is enforced for the main
-``CMakeLists.txt`` file.
-
-This policy was introduced in CMake version 2.6.0.
+file itself; a call in an included file is not sufficient. The ``OLD``
+behavior was to silently ignore the missing invocation. The ``NEW``
+behavior is to issue an error instead of a warning.
-.. include:: DEPRECATED.txt
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst
index e06f2a1..3a3c442 100644
--- a/Help/policy/CMP0001.rst
+++ b/Help/policy/CMP0001.rst
@@ -1,11 +1,14 @@
CMP0001
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
``CMAKE_BACKWARDS_COMPATIBILITY`` should no longer be used.
The behavior is to check ``CMAKE_BACKWARDS_COMPATIBILITY`` and present
it to the user. The ``NEW`` behavior is to ignore
-CMAKE_BACKWARDS_COMPATIBILITY completely.
+``CMAKE_BACKWARDS_COMPATIBILITY`` completely.
In CMake 2.4 and below the variable ``CMAKE_BACKWARDS_COMPATIBILITY`` was
used to request compatibility with earlier versions of CMake. In
@@ -15,7 +18,5 @@ and the :command:`cmake_policy` command. However, CMake must still check
below.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst
index f50ddd5..02fbf57 100644
--- a/Help/policy/CMP0002.rst
+++ b/Help/policy/CMP0002.rst
@@ -1,18 +1,19 @@
CMP0002
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Logical target names must be globally unique.
Targets names created with :command:`add_executable`, :command:`add_library`, or
:command:`add_custom_target` are logical build target names. Logical target
names must be globally unique because:
-::
-
- - Unique names may be referenced unambiguously both in CMake
- code and on make tool command lines.
- - Logical names are used by Xcode and VS IDE generators
- to produce meaningful project names for the targets.
+* Unique names may be referenced unambiguously both in CMake
+ code and on make tool command lines.
+* Logical names are used by Xcode and VS IDE generators
+ to produce meaningful project names for the targets.
The logical name of executable and library targets does not have to
correspond to the physical file names built. Consider using the
@@ -22,7 +23,5 @@ must simply have globally unique names (unless one uses the global
property :prop_gbl:`ALLOW_DUPLICATE_CUSTOM_TARGETS` with a Makefiles generator).
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst
index 0a6b778..e3c8fa6 100644
--- a/Help/policy/CMP0003.rst
+++ b/Help/policy/CMP0003.rst
@@ -1,13 +1,16 @@
CMP0003
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Libraries linked via full path no longer produce linker search paths.
This policy affects how libraries whose full paths are NOT known are
found at link time, but was created due to a change in how CMake deals
with libraries whose full paths are known. Consider the code
-::
+.. code-block:: cmake
target_link_libraries(myexe /path/to/libA.so)
@@ -33,7 +36,7 @@ example code now produces something like
Unfortunately this change can break code like
-::
+.. code-block:: cmake
target_link_libraries(myexe /path/to/libA.so B)
@@ -67,7 +70,7 @@ The setting for this policy used when generating the link line is that
in effect when the target is created by an add_executable or
add_library command. For the example described above, the code
-::
+.. code-block:: cmake
cmake_policy(SET CMP0003 OLD) # or cmake_policy(VERSION 2.4)
add_executable(myexe myexe.c)
@@ -76,7 +79,7 @@ add_library command. For the example described above, the code
will work and suppress the warning for this policy. It may also be
updated to work with the corrected linking approach:
-::
+.. code-block:: cmake
cmake_policy(SET CMP0003 NEW) # or cmake_policy(VERSION 2.6)
link_directories(/path/to) # needed to find library B
@@ -85,7 +88,7 @@ updated to work with the corrected linking approach:
Even better, library B may be specified with a full path:
-::
+.. code-block:: cmake
add_executable(myexe myexe.c)
target_link_libraries(myexe /path/to/libA.so /path/to/libB.so)
@@ -98,7 +101,5 @@ target. This avoids flooding users with messages for every target
when setting the policy once will probably fix all targets.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst
index 74e3e66..94d04fe 100644
--- a/Help/policy/CMP0004.rst
+++ b/Help/policy/CMP0004.rst
@@ -1,12 +1,15 @@
CMP0004
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Libraries linked may not have leading or trailing whitespace.
CMake versions 2.4 and below silently removed leading and trailing
whitespace from libraries linked with code like
-::
+.. code-block:: cmake
target_link_libraries(myexe " A ")
@@ -20,7 +23,5 @@ target is created by an :command:`add_executable` or :command:`add_library`
command.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst
index 3037a12..9163845 100644
--- a/Help/policy/CMP0005.rst
+++ b/Help/policy/CMP0005.rst
@@ -1,6 +1,9 @@
CMP0005
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Preprocessor definition values are now escaped automatically.
This policy determines whether or not CMake should generate escaped
@@ -20,7 +23,5 @@ See documentation of the ``COMPILE_DEFINITIONS`` target property for
limitations of the escaping implementation.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst
index 31efebd..08776f2 100644
--- a/Help/policy/CMP0006.rst
+++ b/Help/policy/CMP0006.rst
@@ -1,6 +1,9 @@
CMP0006
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Installing :prop_tgt:`MACOSX_BUNDLE` targets requires a ``BUNDLE DESTINATION``.
This policy determines whether the :command:`install(TARGETS)` command must be
@@ -18,7 +21,5 @@ behavior for this policy is to produce an error if a bundle target is installed
without a ``BUNDLE DESTINATION``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst
index b95f36c..7b013db 100644
--- a/Help/policy/CMP0007.rst
+++ b/Help/policy/CMP0007.rst
@@ -1,6 +1,9 @@
CMP0007
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
list command no longer ignores empty elements.
This policy determines whether the list command will ignore empty
@@ -11,7 +14,5 @@ elements. The ``NEW`` behavior for this policy is to correctly count
empty elements in a list.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst
index bcb10d5..8a4b8c5 100644
--- a/Help/policy/CMP0008.rst
+++ b/Help/policy/CMP0008.rst
@@ -1,11 +1,14 @@
CMP0008
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Libraries linked by full-path must have a valid library file name.
In CMake 2.4 and below it is possible to write code like
-::
+.. code-block:: cmake
target_link_libraries(myexe /full/path/to/somelib)
@@ -29,7 +32,5 @@ it. The ``NEW`` behavior for this policy is to trust the given path and
pass it directly to the native build tool unchanged.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.1
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst
index c554522..aeef533 100644
--- a/Help/policy/CMP0009.rst
+++ b/Help/policy/CMP0009.rst
@@ -1,6 +1,9 @@
CMP0009
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
FILE GLOB_RECURSE calls should not follow symlinks by default.
In CMake 2.6.1 and below, :command:`file(GLOB_RECURSE)` calls would follow
@@ -15,7 +18,5 @@ to follow the symlinks by default, but only if ``FOLLOW_SYMLINKS`` is given
as an additional argument to the ``FILE`` command.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.2
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst
index 442553d..1f32283 100644
--- a/Help/policy/CMP0010.rst
+++ b/Help/policy/CMP0010.rst
@@ -1,6 +1,9 @@
CMP0010
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Bad variable reference syntax is an error.
In CMake 2.6.2 and below, incorrect variable reference syntax such as
@@ -14,7 +17,5 @@ If :policy:`CMP0053` is set to ``NEW``, this policy has no effect
and is treated as always being ``NEW``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst
index 976b3c3..98614b9 100644
--- a/Help/policy/CMP0011.rst
+++ b/Help/policy/CMP0011.rst
@@ -1,6 +1,9 @@
CMP0011
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Included scripts do automatic :command:`cmake_policy` PUSH and POP.
In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by
@@ -19,7 +22,5 @@ The ``NEW`` behavior for this policy is to allow the commands to do
their default cmake_policy ``PUSH`` and ``POP``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst
index dd889d2..24cc20b 100644
--- a/Help/policy/CMP0012.rst
+++ b/Help/policy/CMP0012.rst
@@ -1,6 +1,9 @@
CMP0012
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
:command:`if` recognizes numbers and boolean constants.
In CMake versions 2.6.4 and lower the :command:`if` command implicitly
@@ -22,7 +25,5 @@ for this policy is to recognize numbers and boolean constants without
dereferencing variables with such names.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst
index 4ee19cc..c22d5c9 100644
--- a/Help/policy/CMP0013.rst
+++ b/Help/policy/CMP0013.rst
@@ -1,6 +1,9 @@
CMP0013
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Duplicate binary directories are not allowed.
CMake 2.6.3 and below silently permitted add_subdirectory() calls to
@@ -15,7 +18,5 @@ behavior for this policy is to disallow duplicate binary directories
with an error.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst
index 1487bc4..e147705 100644
--- a/Help/policy/CMP0014.rst
+++ b/Help/policy/CMP0014.rst
@@ -1,6 +1,9 @@
CMP0014
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Input directories must have ``CMakeLists.txt``.
CMake versions before 2.8 silently ignored missing ``CMakeLists.txt``
@@ -11,7 +14,5 @@ The ``OLD`` behavior for this policy is to silently ignore the problem.
The ``NEW`` behavior for this policy is to report an error.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst
index cd65c3f..6fbe833 100644
--- a/Help/policy/CMP0015.rst
+++ b/Help/policy/CMP0015.rst
@@ -1,7 +1,10 @@
CMP0015
-------
- :command:`link_directories` treats paths relative to the source dir.
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
+:command:`link_directories` treats paths relative to the source dir.
In CMake 2.8.0 and lower the :command:`link_directories` command passed
relative paths unchanged to the linker. In CMake 2.8.1 and above the
@@ -13,7 +16,5 @@ this policy is to use relative paths verbatim in the linker command. The
paths by appending the relative path to ``CMAKE_CURRENT_SOURCE_DIR``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.1
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst
index 960361d..2e5ac53 100644
--- a/Help/policy/CMP0016.rst
+++ b/Help/policy/CMP0016.rst
@@ -1,6 +1,9 @@
CMP0016
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
:command:`target_link_libraries` reports error if its only argument
is not a target.
@@ -10,7 +13,5 @@ wasn't a valid target. In CMake 2.8.3 and above it reports an error
in this case.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst
index d06ad13..7bac8a6 100644
--- a/Help/policy/CMP0017.rst
+++ b/Help/policy/CMP0017.rst
@@ -1,6 +1,9 @@
CMP0017
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Prefer files from the CMake module directory when including from there.
Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e.
@@ -15,7 +18,5 @@ behavior is to always prefer files from CMAKE_MODULE_PATH over files
from the CMake modules directory.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.4
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst
index e4cd184..c3ae66f 100644
--- a/Help/policy/CMP0018.rst
+++ b/Help/policy/CMP0018.rst
@@ -1,6 +1,9 @@
CMP0018
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Ignore ``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` variable.
CMake 2.8.8 and lower compiled sources in ``SHARED`` and ``MODULE`` libraries
@@ -28,7 +31,5 @@ The ``NEW`` behavior for this policy is to ignore
honor the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.9
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst
index f3fa46a..004316f 100644
--- a/Help/policy/CMP0019.rst
+++ b/Help/policy/CMP0019.rst
@@ -1,6 +1,9 @@
CMP0019
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Do not re-expand variables in include and link information.
CMake 2.8.10 and lower re-evaluated values given to the
@@ -16,7 +19,5 @@ strict compatibility. The ``NEW`` behavior for this policy is to leave
the values untouched.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst
index 0a4de5c..ceace31 100644
--- a/Help/policy/CMP0020.rst
+++ b/Help/policy/CMP0020.rst
@@ -1,6 +1,9 @@
CMP0020
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Automatically link Qt executables to ``qtmain`` target on Windows.
CMake 2.8.10 and lower required users of Qt to always specify a link
@@ -21,7 +24,5 @@ The ``NEW`` behavior for this policy is to link executables to ``qtmain.lib``
automatically when they link to QtCore ``IMPORTED`` target.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst
index 2c49c33..b9074ab 100644
--- a/Help/policy/CMP0021.rst
+++ b/Help/policy/CMP0021.rst
@@ -1,6 +1,9 @@
CMP0021
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` target
property.
@@ -15,7 +18,5 @@ policy is to issue a ``FATAL_ERROR`` if ``INCLUDE_DIRECTORIES`` contains a
relative path.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst
index c82a768..91e7aa3 100644
--- a/Help/policy/CMP0022.rst
+++ b/Help/policy/CMP0022.rst
@@ -1,6 +1,9 @@
CMP0022
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
:prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.
CMake 2.8.11 constructed the 'link interface' of a target from
@@ -33,7 +36,5 @@ property for in-build targets, and ignore the old properties matching
``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst
index c863a91..6f582ec 100644
--- a/Help/policy/CMP0023.rst
+++ b/Help/policy/CMP0023.rst
@@ -1,6 +1,9 @@
CMP0023
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Plain and keyword :command:`target_link_libraries` signatures cannot be mixed.
CMake 2.8.12 introduced the :command:`target_link_libraries` signature using
@@ -11,7 +14,7 @@ target explicitly, even if empty. This produces confusing behavior
when used in combination with the historical behavior of the plain
:command:`target_link_libraries` signature. For example, consider the code:
-::
+.. code-block:: cmake
target_link_libraries(mylib A)
target_link_libraries(mylib PRIVATE B)
@@ -29,7 +32,5 @@ this policy is to not to allow mixing of the keyword and plain
signatures.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst
index c9fd472..72dbc0e 100644
--- a/Help/policy/CMP0024.rst
+++ b/Help/policy/CMP0024.rst
@@ -1,6 +1,9 @@
CMP0024
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Disallow include export result.
CMake 2.8.12 and lower allowed use of the :command:`include` command with the
@@ -18,7 +21,5 @@ an :command:`export` command. The ``NEW`` behavior for this policy is not to
allow including the result of an :command:`export` command.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst
index cfbed2a..d0f67f9 100644
--- a/Help/policy/CMP0025.rst
+++ b/Help/policy/CMP0025.rst
@@ -1,6 +1,9 @@
CMP0025
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Compiler id for Apple Clang is now ``AppleClang``.
CMake 3.0 and above recognize that Apple Clang is a different compiler
@@ -19,11 +22,9 @@ The ``OLD`` behavior for this policy is to use compiler id ``Clang``. The
``NEW`` behavior for this policy is to use compiler id ``AppleClang``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
-.. include:: STANDARD_ADVICE.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
+.. include:: REMOVED_EPILOGUE.txt
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0025 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
-variable to control the warning.
-
-.. include:: DEPRECATED.txt
+variable to control the warning in CMake versions before 4.0.
diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst
index b2a5f25..06b1dd1 100644
--- a/Help/policy/CMP0026.rst
+++ b/Help/policy/CMP0026.rst
@@ -1,6 +1,9 @@
CMP0026
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Disallow use of the LOCATION property for build targets.
CMake 2.8.12 and lower allowed reading the :prop_tgt:`LOCATION` target
@@ -23,7 +26,5 @@ properties from build-targets. The ``NEW`` behavior for this policy is to
not to allow reading the :prop_tgt:`LOCATION` properties from build-targets.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst
index 78c01f7..eaf1929 100644
--- a/Help/policy/CMP0027.rst
+++ b/Help/policy/CMP0027.rst
@@ -1,6 +1,9 @@
CMP0027
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Conditionally linked imported targets with missing include directories.
CMake 2.8.11 introduced introduced the concept of
@@ -21,7 +24,5 @@ the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a generator-expression
conditionally linked ``IMPORTED`` target does not exist.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst
index 18b17ee..c0ba715 100644
--- a/Help/policy/CMP0028.rst
+++ b/Help/policy/CMP0028.rst
@@ -1,6 +1,9 @@
CMP0028
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Double colon in target name means ``ALIAS`` or ``IMPORTED`` target.
CMake 2.8.12 and lower allowed the use of targets and files with double
@@ -21,7 +24,5 @@ for this policy is to issue a ``FATAL_ERROR`` if a link dependency contains
double-colons but is not an ``IMPORTED`` target or an ``ALIAS`` target.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst
index aa10b97..b5cca1e 100644
--- a/Help/policy/CMP0029.rst
+++ b/Help/policy/CMP0029.rst
@@ -1,12 +1,13 @@
CMP0029
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`subdir_depends` command should not be called.
The implementation of this command has been empty since December 2001
but was kept in CMake for compatibility for a long time.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst
index 81bbb84..a0b11d5 100644
--- a/Help/policy/CMP0030.rst
+++ b/Help/policy/CMP0030.rst
@@ -1,6 +1,9 @@
CMP0030
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`use_mangled_mesa` command should not be called.
This command was created in September 2001 to support VTK before
@@ -8,6 +11,4 @@ modern CMake language and custom command capabilities. VTK has
not used it in years.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst
index 8c3eef6..7e5f22d 100644
--- a/Help/policy/CMP0031.rst
+++ b/Help/policy/CMP0031.rst
@@ -1,6 +1,9 @@
CMP0031
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`load_command` command should not be called.
This command was added in August 2002 to allow projects to add
@@ -10,6 +13,4 @@ the CMake process. It has been mostly superseded by the
:command:`macro` and :command:`function` commands.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst
index 5c1fa4b..26a9c15 100644
--- a/Help/policy/CMP0032.rst
+++ b/Help/policy/CMP0032.rst
@@ -1,6 +1,9 @@
CMP0032
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`output_required_files` command should not be called.
This command was added in June 2001 to expose the then-current CMake
@@ -10,6 +13,4 @@ scanning capabilities of this command are very limited and this
functionality is better achieved through dedicated outside tools.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst
index 4a6cc59..7f84dc0 100644
--- a/Help/policy/CMP0033.rst
+++ b/Help/policy/CMP0033.rst
@@ -1,6 +1,9 @@
CMP0033
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`export_library_dependencies` command should not be called.
This command was added in January 2003 to export ``<tgt>_LIB_DEPENDS``
@@ -11,6 +14,4 @@ The functionality has been superseded by the :command:`export` and
:command:`install(EXPORT)` commands.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst
index 0f3934a..386cd34 100644
--- a/Help/policy/CMP0034.rst
+++ b/Help/policy/CMP0034.rst
@@ -1,6 +1,9 @@
CMP0034
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`utility_source` command should not be called.
This command was introduced in March 2001 to help build executables used to
@@ -8,6 +11,4 @@ generate other files. This approach has long been replaced by
:command:`add_executable` combined with :command:`add_custom_command`.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst
index 58199a4..b3e818e 100644
--- a/Help/policy/CMP0035.rst
+++ b/Help/policy/CMP0035.rst
@@ -1,12 +1,13 @@
CMP0035
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`variable_requires` command should not be called.
This command was introduced in November 2001 to perform some conditional
logic. It has long been replaced by the :command:`if` command.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst
index 4bcfc54..0d1f857 100644
--- a/Help/policy/CMP0036.rst
+++ b/Help/policy/CMP0036.rst
@@ -1,6 +1,9 @@
CMP0036
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`build_name` command should not be called.
This command was added in May 2001 to compute a name for the current
@@ -9,6 +12,4 @@ documented as discouraged and replaced by the :variable:`CMAKE_SYSTEM`
and :variable:`CMAKE_<LANG>_COMPILER` variables.
.. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt
diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst
index f912a22..5d3f518 100644
--- a/Help/policy/CMP0037.rst
+++ b/Help/policy/CMP0037.rst
@@ -1,6 +1,9 @@
CMP0037
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Target names should not be reserved and should match a validity pattern.
CMake 2.8.12 and lower allowed creating targets using :command:`add_library`,
@@ -28,7 +31,5 @@ The ``NEW`` behavior for this policy is to report an error
if an add_* command is used with an invalid target name.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst
index b0de8ca..df147de 100644
--- a/Help/policy/CMP0038.rst
+++ b/Help/policy/CMP0038.rst
@@ -1,6 +1,9 @@
CMP0038
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Targets may not link directly to themselves.
CMake 2.8.12 and lower allowed a build target to link to itself directly with
@@ -12,7 +15,5 @@ in their own link implementation. The ``NEW`` behavior for this policy is to
report an error if a target attempts to link to itself.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst
index 558c5c5..4a0a7aa 100644
--- a/Help/policy/CMP0039.rst
+++ b/Help/policy/CMP0039.rst
@@ -1,6 +1,9 @@
CMP0039
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Utility targets may not have link dependencies.
CMake 2.8.12 and lower allowed using utility targets in the left hand side
@@ -13,7 +16,5 @@ report an error if an attempt is made to set the link libraries of a
utility target.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst
index b6777ef..7d7bec0 100644
--- a/Help/policy/CMP0040.rst
+++ b/Help/policy/CMP0040.rst
@@ -1,6 +1,9 @@
CMP0040
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The target in the ``TARGET`` signature of :command:`add_custom_command`
must exist and must be defined in the current directory.
@@ -14,7 +17,5 @@ an error if the target referenced in :command:`add_custom_command` is
unknown or was defined outside the current directory.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst
index bf9e8a5..d3f0043 100644
--- a/Help/policy/CMP0041.rst
+++ b/Help/policy/CMP0041.rst
@@ -1,6 +1,9 @@
CMP0041
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Error on relative include with generator expression.
Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the
@@ -21,7 +24,5 @@ an error if a generator expression appears in another location and the path is
relative.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst
index 8fb8cb2..3985e21 100644
--- a/Help/policy/CMP0042.rst
+++ b/Help/policy/CMP0042.rst
@@ -1,6 +1,9 @@
CMP0042
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
:prop_tgt:`MACOSX_RPATH` is enabled by default.
CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install
@@ -15,7 +18,5 @@ the :prop_tgt:`INSTALL_NAME_DIR` and :variable:`CMAKE_INSTALL_NAME_DIR`
variables.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst
index decd228..5b248b9 100644
--- a/Help/policy/CMP0043.rst
+++ b/Help/policy/CMP0043.rst
@@ -1,6 +1,9 @@
CMP0043
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Ignore COMPILE_DEFINITIONS_<Config> properties
CMake 2.8.12 and lower allowed setting the
@@ -41,7 +44,5 @@ compilation command. The ``NEW`` behavior for this policy is to ignore the conte
of the :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property .
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst
index 36c2839..9ee1be1 100644
--- a/Help/policy/CMP0044.rst
+++ b/Help/policy/CMP0044.rst
@@ -1,6 +1,9 @@
CMP0044
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Case sensitive ``<LANG>_COMPILER_ID`` generator expressions
CMake 2.8.12 introduced the ``<LANG>_COMPILER_ID``
@@ -15,7 +18,5 @@ for this policy is to perform a case-sensitive comparison with the value in
the ``<LANG>_COMPILER_ID`` expression.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst
index 257abfa..5dea2b6 100644
--- a/Help/policy/CMP0045.rst
+++ b/Help/policy/CMP0045.rst
@@ -1,6 +1,9 @@
CMP0045
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Error on non-existent target in get_target_property.
In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted
@@ -13,7 +16,5 @@ for this policy is to issue a ``FATAL_ERROR`` if the command is called with a
non-existent target.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst
index 6e9bc72..cf45945 100644
--- a/Help/policy/CMP0046.rst
+++ b/Help/policy/CMP0046.rst
@@ -1,6 +1,9 @@
CMP0046
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Error on non-existent dependency in add_dependencies.
CMake 2.8.12 and lower silently ignored non-existent dependencies
@@ -12,7 +15,5 @@ if non-existent dependencies are listed in the :command:`add_dependencies`
command.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst
index e82d72c..e890260 100644
--- a/Help/policy/CMP0047.rst
+++ b/Help/policy/CMP0047.rst
@@ -1,6 +1,9 @@
CMP0047
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Use ``QCC`` compiler id for the qcc drivers on QNX.
CMake 3.0 and above recognize that the QNX qcc compiler driver is
@@ -20,11 +23,9 @@ for the qcc and QCC compiler drivers. The ``NEW`` behavior for this policy
is to use the ``QCC`` compiler id for those drivers.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
-.. include:: STANDARD_ADVICE.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
+.. include:: REMOVED_EPILOGUE.txt
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0047 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
-variable to control the warning.
-
-.. include:: DEPRECATED.txt
+variable to control the warning in CMake versions before 4.0.
diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst
index 6192136..76a74ce 100644
--- a/Help/policy/CMP0048.rst
+++ b/Help/policy/CMP0048.rst
@@ -1,6 +1,9 @@
CMP0048
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
The :command:`project` command manages ``VERSION`` variables.
CMake version 3.0 introduced the ``VERSION`` option of the :command:`project`
@@ -17,7 +20,5 @@ The ``NEW`` behavior for this policy is to set ``VERSION`` as documented by the
:command:`project` command.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst
index d12ef88..c2500cd 100644
--- a/Help/policy/CMP0049.rst
+++ b/Help/policy/CMP0049.rst
@@ -1,6 +1,9 @@
CMP0049
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Do not expand variables in target source entries.
CMake 2.8.12 and lower performed an extra layer of variable expansion
@@ -18,7 +21,5 @@ the target sources. The ``NEW`` behavior for this policy is to issue an error
if such variables need to be expanded.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst
index 1b93773..dcd68a6 100644
--- a/Help/policy/CMP0050.rst
+++ b/Help/policy/CMP0050.rst
@@ -1,6 +1,9 @@
CMP0050
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
Disallow add_custom_command SOURCE signatures.
CMake 2.8.12 and lower allowed a signature for :command:`add_custom_command`
@@ -13,7 +16,5 @@ The ``OLD`` behavior for this policy is to allow the use of
policy is to issue an error if such a signature is used.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst
index e049bba..ae4498a 100644
--- a/Help/policy/CMP0051.rst
+++ b/Help/policy/CMP0051.rst
@@ -1,6 +1,9 @@
CMP0051
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.1
List :genex:`TARGET_OBJECTS` in SOURCES target property.
@@ -21,7 +24,5 @@ behavior for this policy is to include ``TARGET_OBJECTS`` expressions
in the output.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst
index c710262..c4cd981 100644
--- a/Help/policy/CMP0052.rst
+++ b/Help/policy/CMP0052.rst
@@ -1,6 +1,9 @@
CMP0052
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.1
Reject source and build dirs in installed
@@ -22,7 +25,5 @@ directory. The ``NEW`` behavior for this
policy is to issue an error if such a directory is used.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst
index 5a6f5cf..82ab716 100644
--- a/Help/policy/CMP0053.rst
+++ b/Help/policy/CMP0053.rst
@@ -1,6 +1,9 @@
CMP0053
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.1
Simplify variable reference and escape sequence evaluation.
@@ -45,7 +48,5 @@ variable references and escape sequences. The ``NEW`` behavior is to
use the simpler variable expansion and escape sequence evaluation rules.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst
index d22e8d9..560b706 100644
--- a/Help/policy/CMP0054.rst
+++ b/Help/policy/CMP0054.rst
@@ -1,6 +1,9 @@
CMP0054
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.1
Only interpret :command:`if` arguments as variables or keywords when unquoted.
@@ -16,7 +19,7 @@ that have been quoted or bracketed.
Given the following partial example:
-::
+.. code-block:: cmake
set(A E)
set(E "")
@@ -29,25 +32,23 @@ Given the following partial example:
After explicit expansion of variables this gives:
-::
+.. code-block:: cmake
if("E" STREQUAL "")
With the policy set to ``OLD`` implicit expansion reduces this semantically to:
-::
+.. code-block:: cmake
if("" STREQUAL "")
With the policy set to ``NEW`` the quoted arguments will not be
further dereferenced:
-::
+.. code-block:: cmake
if("E" STREQUAL "")
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst
index dc83863..eda4700 100644
--- a/Help/policy/CMP0055.rst
+++ b/Help/policy/CMP0055.rst
@@ -1,6 +1,9 @@
CMP0055
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.2
Strict checking for the :command:`break` command.
@@ -14,7 +17,5 @@ outside of loop contexts and ignores any arguments. The ``NEW`` behavior for th
policy is to issue an error if a misplaced break or any arguments are found.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.2
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst
index ca238e2..41ca3ba 100644
--- a/Help/policy/CMP0056.rst
+++ b/Help/policy/CMP0056.rst
@@ -1,6 +1,9 @@
CMP0056
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.2
Honor link flags in :command:`try_compile` source-file signature.
@@ -28,11 +31,9 @@ set it on the command line by defining the
variable in the cache.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.2
-.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
-.. include:: STANDARD_ADVICE.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
+.. include:: REMOVED_EPILOGUE.txt
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0056 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
-variable to control the warning.
-
-.. include:: DEPRECATED.txt
+variable to control the warning in CMake versions before 4.0.
diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst
index 07bc969..4c78568 100644
--- a/Help/policy/CMP0057.rst
+++ b/Help/policy/CMP0057.rst
@@ -1,6 +1,9 @@
CMP0057
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
Support new :command:`if` IN_LIST operator.
@@ -11,7 +14,5 @@ The ``OLD`` behavior for this policy is to ignore the IN_LIST operator.
The ``NEW`` behavior is to interpret the IN_LIST operator.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst
index 2b729e0..7069a93 100644
--- a/Help/policy/CMP0058.rst
+++ b/Help/policy/CMP0058.rst
@@ -1,6 +1,9 @@
CMP0058
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
Ninja requires custom command byproducts to be explicit.
@@ -104,12 +107,10 @@ rules for unknown dependencies in the build tree. The ``NEW``
behavior for this policy is to not generate these and instead
require projects to specify custom command ``BYPRODUCTS`` explicitly.
-.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace::
- warns when it sees unknown dependencies in out-of-source build trees
-.. include:: STANDARD_ADVICE.txt
-
The policy setting must be in scope at the end of the top-level
``CMakeLists.txt`` file of the project and has global effect.
-.. include:: DEPRECATED.txt
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
+.. |WARNED_OR_DID_NOT_WARN| replace::
+ warned when it saw unknown dependencies in out-of-source build trees
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst
index 4ac286d..3dfc81b 100644
--- a/Help/policy/CMP0059.rst
+++ b/Help/policy/CMP0059.rst
@@ -1,6 +1,9 @@
CMP0059
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
Do not treat ``DEFINITIONS`` as a built-in directory property.
@@ -14,7 +17,5 @@ so far to the :command:`add_definitions` command. The ``NEW`` behavior is
to behave as a normal user-defined directory property.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst
index 8fff803..078f22e 100644
--- a/Help/policy/CMP0060.rst
+++ b/Help/policy/CMP0060.rst
@@ -1,6 +1,9 @@
CMP0060
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
Link libraries by full path even in implicit directories.
@@ -59,11 +62,9 @@ The ``NEW`` behavior for this policy is to link libraries by full path even
if they are in implicit link directories.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
-.. include:: STANDARD_ADVICE.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
+.. include:: REMOVED_EPILOGUE.txt
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0060 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
-variable to control the warning.
-
-.. include:: DEPRECATED.txt
+variable to control the warning in CMake versions before 4.0.
diff --git a/Help/policy/CMP0061.rst b/Help/policy/CMP0061.rst
index 22ec0d0..765ecb7 100644
--- a/Help/policy/CMP0061.rst
+++ b/Help/policy/CMP0061.rst
@@ -1,6 +1,9 @@
CMP0061
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
CTest does not by default tell ``make`` to ignore errors (``-i``).
@@ -22,7 +25,5 @@ calls in CTest. The ``NEW`` behavior for this policy is to not
add ``-i``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0062.rst b/Help/policy/CMP0062.rst
index e0cf71b..c785b46 100644
--- a/Help/policy/CMP0062.rst
+++ b/Help/policy/CMP0062.rst
@@ -1,6 +1,9 @@
CMP0062
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
Disallow :command:`install` of :command:`export` result.
@@ -24,7 +27,5 @@ an :command:`export()` command. The ``NEW`` behavior for this policy is
not to allow installing the result of an :command:`export()` command.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0063.rst b/Help/policy/CMP0063.rst
index 1e1cbfa..1f00c20 100644
--- a/Help/policy/CMP0063.rst
+++ b/Help/policy/CMP0063.rst
@@ -1,6 +1,9 @@
CMP0063
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.3
Honor visibility properties for all target types.
@@ -23,7 +26,5 @@ The ``NEW`` behavior for this policy is to honor the visibility properties
for all target types.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0064.rst b/Help/policy/CMP0064.rst
index 4fd873f..fca428b 100644
--- a/Help/policy/CMP0064.rst
+++ b/Help/policy/CMP0064.rst
@@ -1,6 +1,9 @@
CMP0064
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.4
Recognize ``TEST`` as a operator for the :command:`if` command.
@@ -12,7 +15,5 @@ The ``OLD`` behavior for this policy is to ignore the ``TEST`` operator.
The ``NEW`` behavior is to interpret the ``TEST`` operator.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.4
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/CMP0065.rst b/Help/policy/CMP0065.rst
index 54034b1..7d70899 100644
--- a/Help/policy/CMP0065.rst
+++ b/Help/policy/CMP0065.rst
@@ -1,6 +1,9 @@
CMP0065
-------
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
.. versionadded:: 3.4
Do not add flags to export symbols from executables without
@@ -21,11 +24,9 @@ flags when linking executables if the :prop_tgt:`ENABLE_EXPORTS` target
property is set to ``True``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.4
-.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
-.. include:: STANDARD_ADVICE.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
+.. include:: REMOVED_EPILOGUE.txt
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0065 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
-variable to control the warning.
-
-.. include:: DEPRECATED.txt
+variable to control the warning in CMake versions before 4.0.
diff --git a/Help/policy/CMP0071.rst b/Help/policy/CMP0071.rst
index 7e118ee..5c86f55 100644
--- a/Help/policy/CMP0071.rst
+++ b/Help/policy/CMP0071.rst
@@ -28,7 +28,9 @@ source files.
source file properties :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` or
:prop_sf:`SKIP_AUTOGEN`.
-Source skip example::
+Source skip example:
+
+.. code-block:: cmake
# ...
set_property(SOURCE /path/to/file1.h PROPERTY SKIP_AUTOMOC ON)
diff --git a/Help/policy/CMP0112.rst b/Help/policy/CMP0112.rst
index 2d21d96..2b21eaf 100644
--- a/Help/policy/CMP0112.rst
+++ b/Help/policy/CMP0112.rst
@@ -8,18 +8,18 @@ Target file component generator expressions do not add target dependencies.
The following target-based generator expressions that query for directory or
file name components no longer add a dependency on the evaluated target.
- - ``TARGET_FILE_NAME``
- - ``TARGET_FILE_DIR``
- - ``TARGET_LINKER_FILE_BASE_NAME``
- - ``TARGET_LINKER_FILE_NAME``
- - ``TARGET_LINKER_FILE_DIR``
- - ``TARGET_SONAME_FILE_NAME``
- - ``TARGET_SONAME_FILE_DIR``
- - ``TARGET_PDB_FILE_NAME``
- - ``TARGET_PDB_FILE_DIR``
- - ``TARGET_BUNDLE_DIR``
- - ``TARGET_BUNDLE_DIR_NAME``
- - ``TARGET_BUNDLE_CONTENT_DIR``
+- ``TARGET_FILE_NAME``
+- ``TARGET_FILE_DIR``
+- ``TARGET_LINKER_FILE_BASE_NAME``
+- ``TARGET_LINKER_FILE_NAME``
+- ``TARGET_LINKER_FILE_DIR``
+- ``TARGET_SONAME_FILE_NAME``
+- ``TARGET_SONAME_FILE_DIR``
+- ``TARGET_PDB_FILE_NAME``
+- ``TARGET_PDB_FILE_DIR``
+- ``TARGET_BUNDLE_DIR``
+- ``TARGET_BUNDLE_DIR_NAME``
+- ``TARGET_BUNDLE_CONTENT_DIR``
In CMake 3.18 and lower a dependency on the evaluated target of the above
diff --git a/Help/policy/CMP0120.rst b/Help/policy/CMP0120.rst
index 0ffeb0e..bba2291 100644
--- a/Help/policy/CMP0120.rst
+++ b/Help/policy/CMP0120.rst
@@ -6,7 +6,7 @@ CMP0120
The :module:`WriteCompilerDetectionHeader` module is removed.
CMake versions 3.1 through 3.19 provide this module to generate a
-C++ compatibility layer by re-using information from CMake's table of
+C++ compatibility layer by reusing information from CMake's table of
preprocessor checks for :manual:`cmake-compile-features(7)`. However:
* Those granular features have been superseded by meta-features for
diff --git a/Help/policy/CMP0141.rst b/Help/policy/CMP0141.rst
index 1aef848..ac3160c 100644
--- a/Help/policy/CMP0141.rst
+++ b/Help/policy/CMP0141.rst
@@ -13,8 +13,8 @@ In CMake 3.24 and below, debug information format flags are added to
the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` cache entries by CMake
automatically. This allows users to edit their cache entries to adjust the
flags. However, the presence of such default flags is problematic for
-projects that want to choose a different runtime library programmatically.
-In particular, it requires string editing of the
+projects that want to choose a different debug information format
+programmatically. In particular, it requires string editing of the
:variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` variables with knowledge of the
CMake builtin defaults so they can be replaced.
diff --git a/Help/policy/CMP0143.rst b/Help/policy/CMP0143.rst
index b3bbb28..ce13752 100644
--- a/Help/policy/CMP0143.rst
+++ b/Help/policy/CMP0143.rst
@@ -16,7 +16,7 @@ as ``OFF`` by default unless projects enable the feature. For example:
CMake 3.26 and later prefer to enable the feature by default.
-Note that it is the policy setting at the `end` of the top level
+Note that it is the policy setting at the **end** of the top level
``CMakeLists.txt`` file that matters. The policy setting applies globally
to the whole project.
diff --git a/Help/policy/CMP0147.rst b/Help/policy/CMP0147.rst
index fd5dc5f..1790678 100644
--- a/Help/policy/CMP0147.rst
+++ b/Help/policy/CMP0147.rst
@@ -10,7 +10,8 @@ parallel. CMake 3.27 and above prefer to enable this behavior by adding
a ``BuildInParallel`` setting to custom commands in ``.vcxproj`` files.
This policy provides compatibility for projects that have not been updated
to expect this, e.g., because their custom commands were accidentally
-relying on serial execution by MSBuild.
+relying on serial execution by MSBuild. To control this behavior in a more
+precise way, refer to :prop_sf:`VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD`.
The ``OLD`` behavior for this policy is to not add ``BuildInParallel``.
The ``NEW`` behavior for this policy is to add ``BuildInParallel`` for
diff --git a/Help/policy/CMP0168.rst b/Help/policy/CMP0168.rst
index cab40b9..ec8ef2a 100644
--- a/Help/policy/CMP0168.rst
+++ b/Help/policy/CMP0168.rst
@@ -35,7 +35,7 @@ The ``NEW`` behavior has the following characteristics:
tracking and populating the dependency. This will force the dependency's
download, update, and patch steps to be re-executed. The directory used for
downloads is not affected by :option:`cmake --fresh`, so any previously
- downloaded files for the ``URL`` download method can still be re-used.
+ downloaded files for the ``URL`` download method can still be reused.
The ``OLD`` behavior has the following characteristics:
diff --git a/Help/policy/CMP0181.rst b/Help/policy/CMP0181.rst
new file mode 100644
index 0000000..807ab05
--- /dev/null
+++ b/Help/policy/CMP0181.rst
@@ -0,0 +1,41 @@
+CMP0181
+-------
+
+.. versionadded:: 4.0
+
+The :variable:`CMAKE_EXE_LINKER_FLAGS`,
+:variable:`CMAKE_EXE_LINKER_FLAGS_<CONFIG>`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS_<CONFIG>`,
+:variable:`CMAKE_MODULE_LINKER_FLAGS`,
+and :variable:`CMAKE_MODULE_LINKER_FLAGS_<CONFIG>` variables are parsed and
+re-quoted and support the ``LINKER:`` prefix.
+
+CMake 3.31 and below use the content of these variables as is.
+
+CMake 4.0 and above parse the content of these variables and manage the
+escaping of special characters. Moreover, the ``LINKER:`` prefix is now
+recognized and expanded.
+
+The ``OLD`` behavior of this policy is to consume the content of the
+:variable:`CMAKE_EXE_LINKER_FLAGS`,
+:variable:`CMAKE_EXE_LINKER_FLAGS_<CONFIG>`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS_<CONFIG>`,
+:variable:`CMAKE_MODULE_LINKER_FLAGS`,
+and :variable:`CMAKE_MODULE_LINKER_FLAGS_<CONFIG>` variables as is.
+
+The ``NEW`` behavior of this policy is to parse and re-quote the content of the
+:variable:`CMAKE_EXE_LINKER_FLAGS`,
+:variable:`CMAKE_EXE_LINKER_FLAGS_<CONFIG>`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS_<CONFIG>`,
+:variable:`CMAKE_MODULE_LINKER_FLAGS`,
+and :variable:`CMAKE_MODULE_LINKER_FLAGS_<CONFIG>` variables as well as to
+expand the ``LINKER:`` prefix.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.0
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0182.rst b/Help/policy/CMP0182.rst
new file mode 100644
index 0000000..4cc8603
--- /dev/null
+++ b/Help/policy/CMP0182.rst
@@ -0,0 +1,31 @@
+CMP0182
+-------
+
+.. versionadded:: 4.0
+
+Create shared library archives by default on AIX.
+
+CMake 3.30 and below always represented ``SHARED`` library targets
+as plain shared object ``.so`` files. This is consistent with other
+UNIX platforms, but is not the preferred convention on AIX.
+CMake 3.31 added the :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` target
+property to create a shared library archive: the shared object ``.so``
+file is placed inside an archive ``.a`` file. However, the behavior
+was disabled by default for compatibility with existing projects that
+do not set :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE`.
+
+CMake 4.0 and above prefer, when :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE`
+is not set, to enable creation of shared library archives by default
+because it is the preferred convention on AIX. This policy provides
+compatibility for projects that have not been updated.
+
+The ``OLD`` behavior for this policy is to disable shared library
+archives when :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` is not set.
+The ``NEW`` behavior for this policy is to enable shared library
+archives when :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` is not set.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.0
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0183.rst b/Help/policy/CMP0183.rst
new file mode 100644
index 0000000..5d1b59d
--- /dev/null
+++ b/Help/policy/CMP0183.rst
@@ -0,0 +1,33 @@
+CMP0183
+-------
+
+.. versionadded:: 4.0
+
+:command:`add_feature_info` supports full :ref:`Condition Syntax`.
+
+The ``<enabled>`` parameter accepts a :ref:`semicolon-separated list <CMake
+Language Lists>` of conditions. CMake 3.31 and lower evaluate each
+``condition`` as ``if(${condition})``, which does not properly handle
+conditions with nested paren groups. CMake 4.0 and above instead prefer
+to evaluate each ``condition`` as ``if(<condition>)``, where ``<condition>``
+is re-parsed as if literally written in a call to :command:`if`. This
+allows expressions like::
+
+ "A AND (B OR C)"
+
+but requires expressions like::
+
+ "FOO MATCHES (UPPER|lower)"
+
+to be re-written as::
+
+ "FOO MATCHES \"(UPPER|lower)\""
+
+Policy ``CMP0183`` provides compatibility for projects that have not
+been updated to expect the new behavior.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.0
+.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0184.rst b/Help/policy/CMP0184.rst
new file mode 100644
index 0000000..5020829
--- /dev/null
+++ b/Help/policy/CMP0184.rst
@@ -0,0 +1,54 @@
+CMP0184
+-------
+
+.. versionadded:: 4.0
+
+MSVC runtime checks flags are selected by an abstraction.
+
+Compilers targeting the MSVC ABI have flags to select the runtime checks.
+Runtime checks selection typically varies with build
+configuration.
+
+In CMake 3.31 and below, runtime checks flags are added to
+the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` cache entries by CMake
+automatically. This allows users to edit their cache entries to adjust the
+flags. However, the presence of such default flags is problematic for
+projects that want to choose different runtime checks programmatically.
+In particular, it requires string editing of the
+:variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` variables with knowledge of the
+CMake builtin defaults so they can be replaced.
+
+CMake 4.0 and above prefer to leave the runtime checks flags
+out of the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` values and instead
+offer a first-class abstraction. The
+:variable:`CMAKE_MSVC_RUNTIME_CHECKS` variable and
+:prop_tgt:`MSVC_RUNTIME_CHECKS` target property may be set to
+select the MSVC runtime checks. If they are not set, CMake
+enables runtime checks for the ``Debug`` configuration only using the default
+value ``$<$<CONFIG:Debug>:StackFrameErrorCheck;UninitializedVariable>``, if
+supported by the compiler, or an empty value otherwise.
+
+This policy provides compatibility with projects that have not been updated
+to be aware of the abstraction. The policy setting takes effect as of the
+first :command:`project` or :command:`enable_language` command that enables
+a language whose compiler targets the MSVC ABI.
+
+.. note::
+
+ Once the policy has taken effect at the top of a project, that choice
+ will be used throughout the tree. In projects that have nested projects
+ in subdirectories, be sure to confirm if everything is working with the
+ selected policy behavior.
+
+The ``OLD`` behavior for this policy is to place MSVC runtimes checks
+flags in the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` cache
+entries and ignore the :variable:`CMAKE_MSVC_RUNTIME_CHECKS`
+abstraction. The ``NEW`` behavior for this policy is to *not* place MSVC
+runtime checks flags in the default cache entries and use
+the abstraction instead.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.0
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0185.rst b/Help/policy/CMP0185.rst
new file mode 100644
index 0000000..2020d21
--- /dev/null
+++ b/Help/policy/CMP0185.rst
@@ -0,0 +1,25 @@
+CMP0185
+-------
+
+.. versionadded:: 4.0
+
+:module:`FindRuby` no longer provides upper-case ``RUBY_*`` variables.
+
+:module:`FindRuby` in CMake 3.31 and below provided result variables
+named with an upper-case ``RUBY_`` prefix. CMake 3.18 renamed them
+with a ``Ruby_`` prefix to match the name of the package, but continued
+to provide the upper-case ``RUBY_`` variables for compatibility.
+
+CMake 4.0 and above prefer to provide only ``Ruby_`` variables and no
+longer provide ``RUBY_`` variables. This policy provides compatibility
+with projects that have not been updated.
+
+The ``OLD`` behavior for this policy is to provide both ``Ruby_`` and
+``RUBY_`` variables. The ``NEW`` behavior for this policy is to provide
+only ``Ruby_`` variables and not ``RUBY_`` variables.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.0
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/REMOVED_COMMAND.txt b/Help/policy/REMOVED_COMMAND.txt
new file mode 100644
index 0000000..1c8c963
--- /dev/null
+++ b/Help/policy/REMOVED_COMMAND.txt
@@ -0,0 +1,8 @@
+CMake >= |disallowed_version| prefer that this command never be called.
+The ``OLD`` behavior for this policy is to allow the command to be called.
+The ``NEW`` behavior for this policy is to issue a ``FATAL_ERROR`` when the
+command is called.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: |disallowed_version|
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt
diff --git a/Help/policy/REMOVED_EPILOGUE.txt b/Help/policy/REMOVED_EPILOGUE.txt
new file mode 100644
index 0000000..b7434bc
--- /dev/null
+++ b/Help/policy/REMOVED_EPILOGUE.txt
@@ -0,0 +1,4 @@
+This policy was introduced in CMake version |INTRODUCED_IN_CMAKE_VERSION|.
+Prior to removal in CMake version |REMOVED_IN_CMAKE_VERSION|, it could be
+set by :command:`cmake_policy` or :command:`cmake_minimum_required`.
+If it was not set, CMake |WARNED_OR_DID_NOT_WARN|, and used ``OLD`` behavior.
diff --git a/Help/policy/REMOVED_PROLOGUE.txt b/Help/policy/REMOVED_PROLOGUE.txt
new file mode 100644
index 0000000..5141b6e
--- /dev/null
+++ b/Help/policy/REMOVED_PROLOGUE.txt
@@ -0,0 +1,5 @@
+.. warning::
+ The ``OLD`` behavior of this policy was removed
+ in CMake version |REMOVED_IN_CMAKE_VERSION|.
+ This policy must be set to ``NEW`` by a call to
+ :command:`cmake_minimum_required` or :command:`cmake_policy`.
diff --git a/Help/prop_cache/TYPE.rst b/Help/prop_cache/TYPE.rst
index 7ca859f..e004c75 100644
--- a/Help/prop_cache/TYPE.rst
+++ b/Help/prop_cache/TYPE.rst
@@ -7,15 +7,18 @@ Cache entry values are always strings, but CMake GUIs present widgets
to help users set values. The GUIs use this property as a hint to
determine the widget type. Valid ``TYPE`` values are:
-::
+.. table::
+ :align: left
- BOOL = Boolean ON/OFF value.
- PATH = Path to a directory.
- FILEPATH = Path to a file.
- STRING = Generic string value.
- INTERNAL = Do not present in GUI at all.
- STATIC = Value managed by CMake, do not change.
- UNINITIALIZED = Type not yet specified.
+ ================= ========================================
+ ``BOOL`` Boolean ON/OFF value.
+ ``PATH`` Path to a directory.
+ ``FILEPATH`` Path to a file.
+ ``STRING`` Generic string value.
+ ``INTERNAL`` Do not present in GUI at all.
+ ``STATIC`` Value managed by CMake, do not change.
+ ``UNINITIALIZED`` Type not yet specified.
+ ================= ========================================
Generally the ``TYPE`` of a cache entry should be set by the command which
-creates it ( :command:`set`, :command:`option`, :command:`find_library`, etc.).
+creates it (:command:`set`, :command:`option`, :command:`find_library`, etc.).
diff --git a/Help/prop_dir/EXCLUDE_FROM_ALL.rst b/Help/prop_dir/EXCLUDE_FROM_ALL.rst
index 1adb50e..e4563da 100644
--- a/Help/prop_dir/EXCLUDE_FROM_ALL.rst
+++ b/Help/prop_dir/EXCLUDE_FROM_ALL.rst
@@ -3,7 +3,7 @@ EXCLUDE_FROM_ALL
Set this directory property to a true value on a subdirectory to exclude
its targets from the "all" target of its ancestors. If excluded, running
-e.g. ``make`` in the parent directory will not build targets the
+e.g. ``make`` in the parent directory will not build targets in the
subdirectory by default. This does not affect the "all" target of the
subdirectory itself. Running e.g. ``make`` inside the subdirectory will
still build its targets.
diff --git a/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst b/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst
index f534976..e764f02 100644
--- a/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst
+++ b/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst
@@ -17,13 +17,13 @@ replaced by the value given with the macro argument substituted for
will convert lines of the form
-::
+.. code-block:: c
#include MYDIR(myheader.h)
to
-::
+.. code-block:: c
#include <mydir/myheader.h>
diff --git a/Help/prop_dir/VS_SOLUTION_ITEMS.rst b/Help/prop_dir/VS_SOLUTION_ITEMS.rst
new file mode 100644
index 0000000..edc86d9
--- /dev/null
+++ b/Help/prop_dir/VS_SOLUTION_ITEMS.rst
@@ -0,0 +1,19 @@
+VS_SOLUTION_ITEMS
+-----------------
+
+.. versionadded:: 4.0
+
+Specify solution level items included in the generated Visual Studio solution.
+
+The :ref:`Visual Studio Generators` create a ``.sln`` file for each directory
+whose ``CMakeLists.txt`` file calls the :command:`project` command. Append paths
+to this property in the same directory as the top-level :command:`project`
+command call (e.g. in the top-level ``CMakeLists.txt`` file) to specify files
+included in the corresponding solution file.
+
+If a file specified in ``VS_SOLUTION_ITEMS`` matches a :command:`source_group`
+command call, the affected solution level items are placed in a hierarchy of
+solution level folders according to the name specified in that command.
+Otherwise the items are placed in a default solution level directory named
+``Solution Items``. This name matches the default directory name used by Visual
+Studio when attempting to add solution level items at the root of the solution.
diff --git a/Help/prop_gbl/CMAKE_ROLE.rst b/Help/prop_gbl/CMAKE_ROLE.rst
index 3f4492f..963dce7 100644
--- a/Help/prop_gbl/CMAKE_ROLE.rst
+++ b/Help/prop_gbl/CMAKE_ROLE.rst
@@ -20,3 +20,8 @@ values:
``CPACK``
Running in CPack.
+
+See Also
+^^^^^^^^
+
+* The :variable:`CMAKE_SCRIPT_MODE_FILE` variable.
diff --git a/Help/prop_gbl/DISABLED_FEATURES.rst b/Help/prop_gbl/DISABLED_FEATURES.rst
index 882bbfa..023d9a4 100644
--- a/Help/prop_gbl/DISABLED_FEATURES.rst
+++ b/Help/prop_gbl/DISABLED_FEATURES.rst
@@ -8,4 +8,4 @@ it contains the names of all packages which were not found. This is
determined using the ``<NAME>_FOUND`` variables. Packages which are
searched ``QUIET`` are not listed. A project can add its own features to
this list. This property is used by the macros in
-``FeatureSummary.cmake``.
+:module:`FeatureSummary` module.
diff --git a/Help/prop_gbl/ENABLED_FEATURES.rst b/Help/prop_gbl/ENABLED_FEATURES.rst
index acbb3d0..a5f6121 100644
--- a/Help/prop_gbl/ENABLED_FEATURES.rst
+++ b/Help/prop_gbl/ENABLED_FEATURES.rst
@@ -8,4 +8,4 @@ it contains the names of all packages which were found. This is
determined using the ``<NAME>_FOUND`` variables. Packages which are
searched ``QUIET`` are not listed. A project can add its own features to
this list. This property is used by the macros in
-``FeatureSummary.cmake``.
+:module:`FeatureSummary` module.
diff --git a/Help/prop_gbl/INSTALL_PARALLEL.rst b/Help/prop_gbl/INSTALL_PARALLEL.rst
index c30d6c9..936b1ef 100644
--- a/Help/prop_gbl/INSTALL_PARALLEL.rst
+++ b/Help/prop_gbl/INSTALL_PARALLEL.rst
@@ -6,7 +6,7 @@ INSTALL_PARALLEL
Enables parallel installation option for a project. The install code for each
subdirectory added with ``add_subdirectory`` can run independently.
-When using the Ninja generator, setting this property to ``ON``, causes
+When using the :ref:`Ninja Generators`, enabling this property causes
``install/local`` targets have the console pool disabled, allowing them to run
concurrently.
@@ -15,7 +15,7 @@ explicit dependency on the ``install/local`` target for each subdirectory.
.. versionadded:: 3.31
- When this property is ``ON``, ``cmake --install`` can be given the ``-j <jobs>``
+ When this property is enabled, ``cmake --install`` can be given the ``-j <jobs>``
or ``--parallel <jobs>`` option to specify a maximum number of jobs.
The :envvar:`CMAKE_INSTALL_PARALLEL_LEVEL` environment variable specifies a
default parallel level if this option is not provided.
diff --git a/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst b/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
index 55e9a20..8cf6cce 100644
--- a/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
+++ b/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
@@ -3,7 +3,7 @@ CPACK_DESKTOP_SHORTCUTS
.. versionadded:: 3.3
-Species a list of shortcut names that should be created on the `Desktop`
+Species a list of shortcut names that should be created on the ``Desktop``
for this file.
The property is currently only supported by the :cpack_gen:`CPack WIX Generator`.
diff --git a/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst
index e896acd..e9bfa17 100644
--- a/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst
+++ b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst
@@ -3,7 +3,7 @@ CPACK_STARTUP_SHORTCUTS
.. versionadded:: 3.3
-Species a list of shortcut names that should be created in the `Startup` folder
+Species a list of shortcut names that should be created in the ``Startup`` folder
for this file.
The property is currently only supported by the :cpack_gen:`CPack WIX Generator`.
diff --git a/Help/prop_inst/CPACK_WIX_ACL.rst b/Help/prop_inst/CPACK_WIX_ACL.rst
index a82191a..4facb30 100644
--- a/Help/prop_inst/CPACK_WIX_ACL.rst
+++ b/Help/prop_inst/CPACK_WIX_ACL.rst
@@ -16,8 +16,7 @@ each of which has to match the following format.
``<user>`` and ``<domain>`` specify the windows user and domain for which the
``<Permission>`` element should be generated.
-``<permission>`` is any of the YesNoType attributes listed here::
-
- https://wixtoolset.org/documentation/manual/v3/xsd/wix/permission.html
+``<permission>`` is any of the YesNoType attributes listed at:
+https://docs.firegiant.com/wix3/xsd/wix/permission/
The property is currently only supported by the :cpack_gen:`CPack WIX Generator`.
diff --git a/Help/prop_sf/COMPILE_DEFINITIONS.rst b/Help/prop_sf/COMPILE_DEFINITIONS.rst
index 2af896e..d14d637 100644
--- a/Help/prop_sf/COMPILE_DEFINITIONS.rst
+++ b/Help/prop_sf/COMPILE_DEFINITIONS.rst
@@ -28,5 +28,5 @@ does not support per-config per-source settings, so expressions
that depend on the build configuration are not allowed with that
generator.
-Generator expressions should be preferred instead of setting the alternative per-configuration
-property.
+Prefer using generator expressions in :prop_sf:`!COMPILE_DEFINITIONS` over the
+deprecated :prop_sf:`COMPILE_DEFINITIONS_<CONFIG>` property.
diff --git a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst
index ec867b6..a1ea26e 100644
--- a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst
+++ b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst
@@ -1,10 +1,14 @@
COMPILE_DEFINITIONS_<CONFIG>
----------------------------
-Ignored. See CMake Policy :policy:`CMP0043`.
+.. deprecated:: 3.0
+
+ Prefer the :prop_sf:`COMPILE_DEFINITIONS` source-file property with
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
Per-configuration preprocessor definitions on a source file.
-This is the configuration-specific version of :prop_tgt:`COMPILE_DEFINITIONS`.
+This is the configuration-specific version of :prop_sf:`COMPILE_DEFINITIONS`.
+
Note that :generator:`Xcode` does not support per-configuration source
file flags so this property will be ignored by the :generator:`Xcode` generator.
diff --git a/Help/prop_sf/VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD.rst b/Help/prop_sf/VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD.rst
new file mode 100644
index 0000000..e15a239
--- /dev/null
+++ b/Help/prop_sf/VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD.rst
@@ -0,0 +1,9 @@
+VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD
+----------------------------------------
+
+.. versionadded:: 4.0
+
+A boolean property that disables parallel building for the source file in
+Visual Studio if it is built via :command:`add_custom_command` and is the
+``MAIN_DEPENDENCY`` input for the custom command.
+See policy :policy:`CMP0147`.
diff --git a/Help/prop_sf/VS_SHADER_OBJECT_FILE_NAME.rst b/Help/prop_sf/VS_SHADER_OBJECT_FILE_NAME.rst
index 3647a5e..5268972 100644
--- a/Help/prop_sf/VS_SHADER_OBJECT_FILE_NAME.rst
+++ b/Help/prop_sf/VS_SHADER_OBJECT_FILE_NAME.rst
@@ -3,6 +3,11 @@ VS_SHADER_OBJECT_FILE_NAME
.. versionadded:: 3.12
+.. noqa: spellcheck off
+.. Ignore ``-Fo`` here
+
Specifies a file name for the compiled shader object file for an ``.hlsl``
source file. This adds the ``-Fo`` flag to the command line for the FxCompiler
tool.
+
+.. noqa: spellcheck on
diff --git a/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst b/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst
index ba51e00..d1b31db 100644
--- a/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst
+++ b/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst
@@ -5,7 +5,9 @@ XCODE_FILE_ATTRIBUTES
Add values to the :generator:`Xcode` ``ATTRIBUTES`` setting on its reference to a
source file. Among other things, this can be used to set the role on
-a ``.mig`` file::
+a ``.mig`` file:
+
+.. code-block:: cmake
set_source_files_properties(defs.mig
PROPERTIES
diff --git a/Help/prop_test/ENVIRONMENT_MODIFICATION.rst b/Help/prop_test/ENVIRONMENT_MODIFICATION.rst
index ad3e190..c6c1a82 100644
--- a/Help/prop_test/ENVIRONMENT_MODIFICATION.rst
+++ b/Help/prop_test/ENVIRONMENT_MODIFICATION.rst
@@ -13,26 +13,26 @@ where ``MYVAR`` is the case-sensitive name of an environment variable
to be modified. Entries are considered in the order specified in the
property's value. The ``OP`` may be one of:
- - ``reset``: Reset to the unmodified value, ignoring all modifications to
- ``MYVAR`` prior to this entry. Note that this will reset the variable to
- the value set by :prop_test:`ENVIRONMENT`, if it was set, and otherwise
- to its state from the rest of the CTest execution.
- - ``set``: Replaces the current value of ``MYVAR`` with ``VALUE``.
- - ``unset``: Unsets the current value of ``MYVAR``.
- - ``string_append``: Appends singular ``VALUE`` to the current value of
- ``MYVAR``.
- - ``string_prepend``: Prepends singular ``VALUE`` to the current value of
- ``MYVAR``.
- - ``path_list_append``: Appends singular ``VALUE`` to the current value of
- ``MYVAR`` using the host platform's path list separator (``;`` on Windows
- and ``:`` elsewhere).
- - ``path_list_prepend``: Prepends singular ``VALUE`` to the current value of
- ``MYVAR`` using the host platform's path list separator (``;`` on Windows
- and ``:`` elsewhere).
- - ``cmake_list_append``: Appends singular ``VALUE`` to the current value of
- ``MYVAR`` using ``;`` as the separator.
- - ``cmake_list_prepend``: Prepends singular ``VALUE`` to the current value of
- ``MYVAR`` using ``;`` as the separator.
+- ``reset``: Reset to the unmodified value, ignoring all modifications to
+ ``MYVAR`` prior to this entry. Note that this will reset the variable to
+ the value set by :prop_test:`ENVIRONMENT`, if it was set, and otherwise
+ to its state from the rest of the CTest execution.
+- ``set``: Replaces the current value of ``MYVAR`` with ``VALUE``.
+- ``unset``: Unsets the current value of ``MYVAR``.
+- ``string_append``: Appends singular ``VALUE`` to the current value of
+ ``MYVAR``.
+- ``string_prepend``: Prepends singular ``VALUE`` to the current value of
+ ``MYVAR``.
+- ``path_list_append``: Appends singular ``VALUE`` to the current value of
+ ``MYVAR`` using the host platform's path list separator (``;`` on Windows
+ and ``:`` elsewhere).
+- ``path_list_prepend``: Prepends singular ``VALUE`` to the current value of
+ ``MYVAR`` using the host platform's path list separator (``;`` on Windows
+ and ``:`` elsewhere).
+- ``cmake_list_append``: Appends singular ``VALUE`` to the current value of
+ ``MYVAR`` using ``;`` as the separator.
+- ``cmake_list_prepend``: Prepends singular ``VALUE`` to the current value of
+ ``MYVAR`` using ``;`` as the separator.
Unrecognized ``OP`` values will result in the test failing before it is
executed. This is so that future operations may be added without changing
diff --git a/Help/prop_tgt/AIX_SHARED_LIBRARY_ARCHIVE.rst b/Help/prop_tgt/AIX_SHARED_LIBRARY_ARCHIVE.rst
index 9e81594..456174a 100644
--- a/Help/prop_tgt/AIX_SHARED_LIBRARY_ARCHIVE.rst
+++ b/Help/prop_tgt/AIX_SHARED_LIBRARY_ARCHIVE.rst
@@ -3,20 +3,32 @@ AIX_SHARED_LIBRARY_ARCHIVE
.. versionadded:: 3.31
-On AIX, enable creation of a shared library archive. This places
-the shared object ``.so`` file inside an archive ``.a`` file.
+On AIX, enable or disable creation of a shared library archive
+for a ``SHARED`` library target:
-By default, CMake creates shared libraries on AIX as plain
-shared object ``.so`` files for consistency with other UNIX platforms.
-Alternatively, set this property to a true value to create a shared
-library archive instead, as is AIX convention.
+* If enabled, the shared object ``.so`` file is placed inside
+ an archive ``.a`` file. This is the preferred convention on AIX.
-The shared object name in the archive encodes version information from
-the :prop_tgt:`SOVERSION` target property, if set, and otherwise from
-the :prop_tgt:`VERSION` target property, if set.
+ The shared object name in the archive encodes version information from
+ the :prop_tgt:`SOVERSION` target property, if set, and otherwise from
+ the :prop_tgt:`VERSION` target property, if set.
+
+* If disabled, a plain shared object ``.so`` file is produced.
+ This is consistent with other UNIX platforms.
This property defaults to :variable:`CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`
if that variable is set when a non-imported ``SHARED`` library target
is created by :command:`add_library`. Imported targets must explicitly
enable :prop_tgt:`!AIX_SHARED_LIBRARY_ARCHIVE` if they import an AIX
shared library archive.
+
+.. versionchanged:: 4.0
+
+ For a non-imported target, if this property is not set, the
+ default is *enabled*. See policy :policy:`CMP0182`.
+
+ In CMake 3.31, policy :policy:`CMP0182` did not exist,
+ so the default was *disabled*.
+
+ In CMake 3.30 and lower, :prop_tgt:`!AIX_SHARED_LIBRARY_ARCHIVE`
+ did not exist, so the default was *disabled*.
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index d4f2b25..b376894 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -28,9 +28,9 @@ At configuration time, a list of header files that should be scanned by
target's sources, CMake searches for
- a regular header with the same base name
- (``<source_base>.<header_extention>``) and
+ (``<source_base>.<header_extension>``) and
- a private header with the same base name and a ``_p`` suffix
- (``<source_base>_p.<header_extention>``)
+ (``<source_base>_p.<header_extension>``)
and adds these to the scan list.
diff --git a/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst b/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst
index d571f53..fec98f6 100644
--- a/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst
+++ b/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst
@@ -41,7 +41,9 @@ Example 1
A header file ``my_class.hpp`` uses a custom macro ``JSON_FILE_MACRO`` which
is defined in an other header ``macros.hpp``.
We want the ``moc`` file of ``my_class.hpp`` to depend on the file name
-argument of ``JSON_FILE_MACRO``::
+argument of ``JSON_FILE_MACRO``:
+
+.. code-block:: c++
// my_class.hpp
class My_Class : public QObject
@@ -52,9 +54,11 @@ argument of ``JSON_FILE_MACRO``::
};
In ``CMakeLists.txt`` we add a filter to
-:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` like this::
+:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` like this:
+
+.. code-block:: c++
- list( APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
+ list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
"JSON_FILE_MACRO"
"[\n][ \t]*JSON_FILE_MACRO[ \t]*\\([ \t]*\"([^\"]+)\""
)
@@ -68,7 +72,9 @@ Example 2
In the target ``my_target`` a header file ``complex_class.hpp`` uses a
custom macro ``JSON_BASED_CLASS`` which is defined in an other header
-``macros.hpp``::
+``macros.hpp``:
+
+.. code-block:: c++
// macros.hpp
...
@@ -81,7 +87,7 @@ custom macro ``JSON_BASED_CLASS`` which is defined in an other header
};
...
-::
+.. code-block:: c++
// complex_class.hpp
#pragma once
@@ -90,13 +96,17 @@ custom macro ``JSON_BASED_CLASS`` which is defined in an other header
Since ``complex_class.hpp`` doesn't contain a ``Q_OBJECT`` macro it would be
ignored by :prop_tgt:`AUTOMOC`. We change this by adding ``JSON_BASED_CLASS``
-to :variable:`CMAKE_AUTOMOC_MACRO_NAMES`::
+to :variable:`CMAKE_AUTOMOC_MACRO_NAMES`:
+
+.. code-block:: cmake
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "JSON_BASED_CLASS")
We want the ``moc`` file of ``complex_class.hpp`` to depend on
``meta.json``. So we add a filter to
-:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS`::
+:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS`:
+
+.. code-block:: cmake
list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
"JSON_BASED_CLASS"
@@ -104,6 +114,8 @@ We want the ``moc`` file of ``complex_class.hpp`` to depend on
)
Additionally we assume ``meta.json`` is :prop_sf:`GENERATED` which is
-why we have to add it to :prop_tgt:`AUTOGEN_TARGET_DEPENDS`::
+why we have to add it to :prop_tgt:`AUTOGEN_TARGET_DEPENDS`:
+
+.. code-block:: cmake
set_property(TARGET my_target APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "meta.json")
diff --git a/Help/prop_tgt/CXX_MODULE_STD.rst b/Help/prop_tgt/CXX_MODULE_STD.rst
index d42699d..3c9bb23 100644
--- a/Help/prop_tgt/CXX_MODULE_STD.rst
+++ b/Help/prop_tgt/CXX_MODULE_STD.rst
@@ -6,7 +6,7 @@ CXX_MODULE_STD
``CXX_MODULE_STD`` is a boolean specifying whether the target may use
``import std;`` its C++ sources or not.
-.. note ::
+.. note::
This setting is meaningful only when experimental support for ``import
std;`` has been enabled by the ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` gate.
@@ -17,10 +17,10 @@ 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:
+.. note::
- Similar to the introduction of :prop:`CXX_SCAN_FOR_MODULES`, this property
- defaults to _not_ adding ``import std`` support to targets using
+ Similar to the introduction of :prop_tgt:`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
diff --git a/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst b/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst
index 8b17490..c2662a5 100644
--- a/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst
+++ b/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst
@@ -18,3 +18,5 @@ compile features and a list of supported compilers.
This property is initialized by the value of
the :variable:`CMAKE_CXX_STANDARD_REQUIRED` variable if it is set when a
target is created.
+
+Alternatively, see :ref:`Requiring Language Standards`.
diff --git a/Help/prop_tgt/DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/DEBUGGER_WORKING_DIRECTORY.rst
new file mode 100644
index 0000000..3653e9e
--- /dev/null
+++ b/Help/prop_tgt/DEBUGGER_WORKING_DIRECTORY.rst
@@ -0,0 +1,18 @@
+DEBUGGER_WORKING_DIRECTORY
+--------------------------
+
+.. versionadded:: 4.0
+
+Sets the local debugger working directory for C++ targets.
+The property value may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+This property is initialized by the value of the variable
+:variable:`CMAKE_DEBUGGER_WORKING_DIRECTORY` if it is set when a target is
+created.
+
+If the :prop_tgt:`VS_DEBUGGER_WORKING_DIRECTORY` property is also set, it will
+take precedence over ``DEBUGGER_WORKING_DIRECTORY`` when using one of the
+Visual Studio generators.
+
+Similarly, if :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` is set, it will
+override ``DEBUGGER_WORKING_DIRECTORY`` when using the Xcode generator.
diff --git a/Help/prop_tgt/EXPORT_BUILD_DATABASE.rst b/Help/prop_tgt/EXPORT_BUILD_DATABASE.rst
index 6f68b47..68e308a 100644
--- a/Help/prop_tgt/EXPORT_BUILD_DATABASE.rst
+++ b/Help/prop_tgt/EXPORT_BUILD_DATABASE.rst
@@ -8,7 +8,7 @@ Enable/Disable output of a build database for a target.
This property is initialized by the value of the variable
:variable:`CMAKE_EXPORT_BUILD_DATABASE` if it is set when a target is created.
-.. note ::
+.. note::
This property is meaningful only when experimental support for build
databases has been enabled by the
diff --git a/Help/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES.rst b/Help/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES.rst
index 3533ef9..d0487de 100644
--- a/Help/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES.rst
+++ b/Help/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES.rst
@@ -1,16 +1,11 @@
Fortran_BUILDING_INSTRINSIC_MODULES
-----------------------------------
-.. versionadded:: 3.22
+.. deprecated:: 4.0
-Instructs the CMake Fortran preprocessor that the target is building
-Fortran intrinsics for building a Fortran compiler.
+ Please use the :prop_tgt:`Fortran_BUILDING_INTRINSIC_MODULES` instead.
-This property is off by default and should be turned only on projects
-that build a Fortran compiler. It should not be turned on for projects
-that use a Fortran compiler.
+.. versionadded:: 3.22
-Turning this property on will correctly add dependencies for building
-Fortran intrinsic modules whereas turning the property off will ignore
-Fortran intrinsic modules in the dependency graph as they are supplied
-by the compiler itself.
+A misspelled variant of the :prop_tgt:`Fortran_BUILDING_INTRINSIC_MODULES`
+target property.
diff --git a/Help/prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES.rst b/Help/prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES.rst
new file mode 100644
index 0000000..8e0f71b
--- /dev/null
+++ b/Help/prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES.rst
@@ -0,0 +1,16 @@
+Fortran_BUILDING_INTRINSIC_MODULES
+----------------------------------
+
+.. versionadded:: 4.0
+
+Instructs the CMake Fortran preprocessor that the target is building
+Fortran intrinsics for building a Fortran compiler.
+
+This property is off by default and should be turned only on projects
+that build a Fortran compiler. It should not be turned on for projects
+that use a Fortran compiler.
+
+Turning this property on will correctly add dependencies for building
+Fortran intrinsic modules whereas turning the property off will ignore
+Fortran intrinsic modules in the dependency graph as they are supplied
+by the compiler itself.
diff --git a/Help/prop_tgt/GHS_INTEGRITY_APP.rst b/Help/prop_tgt/GHS_INTEGRITY_APP.rst
index cccd087..7b58152 100644
--- a/Help/prop_tgt/GHS_INTEGRITY_APP.rst
+++ b/Help/prop_tgt/GHS_INTEGRITY_APP.rst
@@ -4,9 +4,9 @@ GHS_INTEGRITY_APP
.. versionadded:: 3.14
``ON`` / ``OFF`` boolean to determine if an executable target should
-be treated as an `Integrity Application`.
+be treated as an ``Integrity Application``.
If no value is set and if a ``.int`` file is added as a source file to the
-executable target it will be treated as an `Integrity Application`.
+executable target it will be treated as an ``Integrity Application``.
Supported on :generator:`Green Hills MULTI`.
diff --git a/Help/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst b/Help/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst
index f7e366a..be7be12 100644
--- a/Help/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst
+++ b/Help/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst
@@ -17,13 +17,13 @@ replaced by the value given with the macro argument substituted for
will convert lines of the form
-::
+.. code-block:: c
#include MYDIR(myheader.h)
to
-::
+.. code-block:: c
#include <mydir/myheader.h>
diff --git a/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst b/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst
index a4746d3..9daefb8 100644
--- a/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst
+++ b/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst
@@ -9,8 +9,7 @@ must be specified in other target properties:
* :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`, or
* :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>` (on DLL platforms, on AIX for
- :ref:`Executables <Binary Executables>` or on Apple for
- :ref:`Shared Libraries <Normal Libraries>`), or
+ :ref:`Executables` or on Apple for :ref:`Shared Libraries`), or
* :prop_tgt:`IMPORTED_OBJECTS_<CONFIG>` (for :ref:`Object Libraries`), or
* :prop_tgt:`IMPORTED_LIBNAME_<CONFIG>` (for :ref:`Interface Libraries`).
diff --git a/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst b/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst
index 53f5838..73d273b 100644
--- a/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst
+++ b/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst
@@ -32,6 +32,8 @@ direct link dependencies of a target's dependents by using the
:prop_tgt:`INTERFACE_LINK_LIBRARIES_DIRECT` and
:prop_tgt:`INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE` target properties.
+.. include:: ../command/LINK_LIBRARIES_LINKER.txt
+
Creating Relocatable Packages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT.rst b/Help/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT.rst
index 6243bb1..c87c825 100644
--- a/Help/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT.rst
+++ b/Help/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT.rst
@@ -95,12 +95,16 @@ One may limit the effects of ``INTERFACE_LINK_LIBRARIES_DIRECT`` and
``INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE`` to a subset of dependent
targets by using the :genex:`TARGET_PROPERTY` generator expression.
For example, to limit the effects to executable targets, use an
-entry of the form::
+entry of the form:
+
+.. code-block:: cmake
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:...>"
Similarly, to limit the effects to specific targets, use an entry
-of the form::
+of the form:
+
+.. code-block:: cmake
"$<$<BOOL:$<TARGET_PROPERTY:USE_IT>>:...>"
diff --git a/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
index 785b17c..886adf2 100644
--- a/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
+++ b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
@@ -8,3 +8,9 @@ INTERFACE_LINK_OPTIONS
.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_LINK_OPTIONS``
.. |PROPERTY_LINK| replace:: :prop_tgt:`LINK_OPTIONS`
.. include:: INTERFACE_BUILD_PROPERTY.txt
+
+.. include:: ../command/DEVICE_LINK_OPTIONS.txt
+
+.. include:: ../command/OPTIONS_SHELL.txt
+
+.. include:: ../command/LINK_OPTIONS_LINKER.txt
diff --git a/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst b/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst
index 5d34e20..638f753 100644
--- a/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst
+++ b/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst
@@ -5,8 +5,8 @@ Value for symbol visibility compile flags
The ``<LANG>_VISIBILITY_PRESET`` property determines the value passed in a
visibility related compile option, such as ``-fvisibility=`` for ``<LANG>``.
-This property affects compilation in sources of all types of targets
-(subject to policy :policy:`CMP0063`).
+This property affects compilation in sources of all types of targets.
+See policy :policy:`CMP0063`.
This property is initialized by the value of the
:variable:`CMAKE_<LANG>_VISIBILITY_PRESET` variable if it is set when a
diff --git a/Help/prop_tgt/LINK_LIBRARIES.rst b/Help/prop_tgt/LINK_LIBRARIES.rst
index b449aa1..8814980 100644
--- a/Help/prop_tgt/LINK_LIBRARIES.rst
+++ b/Help/prop_tgt/LINK_LIBRARIES.rst
@@ -33,3 +33,5 @@ See the :variable:`CMAKE_LINK_LIBRARIES_STRATEGY` variable and
corresponding :prop_tgt:`LINK_LIBRARIES_STRATEGY` target property
for details on how CMake orders direct link dependencies on linker
command lines.
+
+.. include:: ../command/LINK_LIBRARIES_LINKER.txt
diff --git a/Help/prop_tgt/LINK_WARNING_AS_ERROR.rst b/Help/prop_tgt/LINK_WARNING_AS_ERROR.rst
new file mode 100644
index 0000000..c3f7566
--- /dev/null
+++ b/Help/prop_tgt/LINK_WARNING_AS_ERROR.rst
@@ -0,0 +1,41 @@
+LINK_WARNING_AS_ERROR
+---------------------
+
+.. versionadded:: 4.0
+
+Specify whether to treat warnings on link as errors.
+If enabled, adds a flag to treat warnings on link as errors.
+If the :option:`cmake --link-no-warning-as-error` option is given
+on the :manual:`cmake(1)` command line, this property is ignored.
+
+This property takes a :ref:`semicolon-separated-list <CMake Language Lists>` of
+the following values:
+
+* ``LINKER``: treat the linker warnings as errors.
+* ``DRIVER``: treat the compiler warnings as errors when used to drive the link
+ step. See the :prop_tgt:`COMPILE_WARNING_AS_ERROR` target property for more
+ information.
+
+Moreover, for consistency with the :prop_tgt:`COMPILE_WARNING_AS_ERROR` target
+property, a boolean value can be specified:
+
+* ``True`` value: this is equivalent to ``LINKER`` and ``DRIVER`` values.
+* ``False`` value: deactivate this feature for the target.
+
+This property is not implemented for all linkers. It is silently ignored
+if there is no implementation for the linker being used. The currently
+implemented :variable:`compiler linker IDs <CMAKE_<LANG>_COMPILER_LINKER_ID>`
+are:
+
+* ``AIX``
+* ``AppleClang``
+* ``GNU``
+* ``GNUgold``
+* ``LLD``
+* ``MOLD``
+* ``MSVC``
+* ``Solaris``
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_LINK_WARNING_AS_ERROR` if it is set when a target is
+created.
diff --git a/Help/prop_tgt/LINK_WHAT_YOU_USE.rst b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
index d6de0d4..08d263c 100644
--- a/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
+++ b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
@@ -3,14 +3,15 @@ LINK_WHAT_YOU_USE
.. versionadded:: 3.7
-This is a boolean option that, when set to ``TRUE``, will automatically run
-contents of variable :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK` on the target
-after it is linked. In addition, the linker flag specified by variable
-:variable:`CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG` will be passed to the target
-with the link command so that all libraries specified on the command line will
-be linked into the target. This will result in the link producing a list of
-libraries that provide no symbols used by this target but are being linked to
-it.
+This is a boolean option that, when set to ``TRUE``, adds a link-time check
+to print a list of shared libraries that are being linked but provide no symbols
+used by the target. This is intended as a lint.
+
+The flag specified by :variable:`CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG` will
+be passed to the linker so that all libraries specified on the command line
+will be linked into the target. Then the command specified by
+:variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK` will run after the target is linked
+to check the binary for unnecessarily-linked shared libraries.
.. note::
diff --git a/Help/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT.rst b/Help/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT.rst
index 7e08b48..94ee20d 100644
--- a/Help/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT.rst
+++ b/Help/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT.rst
@@ -19,7 +19,7 @@ support per-configuration specification. For example, the code:
MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>")
selects for the target ``foo`` the program database debug information format
-for the Debug configuration.
+for the ``Debug`` and ``RelWithDebInfo`` configurations.
This property is initialized from the value of the
:variable:`CMAKE_MSVC_DEBUG_INFORMATION_FORMAT` variable, if it is set.
diff --git a/Help/prop_tgt/MSVC_RUNTIME_CHECKS-VALUES.txt b/Help/prop_tgt/MSVC_RUNTIME_CHECKS-VALUES.txt
new file mode 100644
index 0000000..44df3bf
--- /dev/null
+++ b/Help/prop_tgt/MSVC_RUNTIME_CHECKS-VALUES.txt
@@ -0,0 +1,16 @@
+``PossibleDataLoss``
+ Compile with ``-RTCc`` or equivalent flag(s) to enable possible
+ data loss checks.
+``StackFrameErrorCheck``
+ Compile with ``-RTCs`` or equivalent flag(s) to enable stack frame
+ error checks.
+``UninitializedVariable``
+ Compile with ``-RTCu`` or equivalent flag(s) to enable uninitialized
+ variables checks.
+
+The value is ignored on compilers not targeting the MSVC ABI, but an
+unsupported value will be rejected as an error when using a compiler
+targeting the MSVC ABI.
+
+The value may also be the empty string (``""``), in which case no runtime
+error check flags will be added explicitly by CMake.
diff --git a/Help/prop_tgt/MSVC_RUNTIME_CHECKS.rst b/Help/prop_tgt/MSVC_RUNTIME_CHECKS.rst
new file mode 100644
index 0000000..72639d5
--- /dev/null
+++ b/Help/prop_tgt/MSVC_RUNTIME_CHECKS.rst
@@ -0,0 +1,34 @@
+MSVC_RUNTIME_CHECKS
+-------------------
+
+.. versionadded:: 4.0
+
+Select the list of enabled runtime checks when targeting the MSVC ABI.
+
+The allowed values are:
+
+.. include:: MSVC_RUNTIME_CHECKS-VALUES.txt
+
+Use :manual:`generator expressions <cmake-generator-expressions(7)>` to
+support per-configuration specification. For example, the code:
+
+.. code-block:: cmake
+
+ add_executable(foo foo.c)
+ set_property(TARGET foo PROPERTY
+ MSVC_RUNTIME_CHECKS "$<$<CONFIG:Debug,RelWithDebInfo>:PossibleDataLoss;UninitializedVariable>")
+
+enables for the target ``foo`` the possible data loss and uninitialized
+variables checks for the ``Debug`` and ``RelWithDebInfo`` configurations.
+
+This property is initialized from the value of the
+:variable:`CMAKE_MSVC_RUNTIME_CHECKS` variable, if it is set.
+If this property is not set, CMake selects runtime checks using the default
+value ``$<$<CONFIG:Debug>:StackFrameErrorCheck;UninitializedVariable>``,
+if supported by the compiler, or an empty value otherwise.
+
+.. note::
+
+ This property has effect only when policy :policy:`CMP0184` is set to ``NEW``
+ prior to the first :command:`project` or :command:`enable_language` command
+ that enables a language using a compiler targeting the MSVC ABI.
diff --git a/Help/prop_tgt/POSITION_INDEPENDENT_CODE.rst b/Help/prop_tgt/POSITION_INDEPENDENT_CODE.rst
index 0aaf66b..2ba1e6f 100644
--- a/Help/prop_tgt/POSITION_INDEPENDENT_CODE.rst
+++ b/Help/prop_tgt/POSITION_INDEPENDENT_CODE.rst
@@ -4,11 +4,11 @@ POSITION_INDEPENDENT_CODE
Whether to create a position-independent target
The ``POSITION_INDEPENDENT_CODE`` property determines whether position
-independent executables or shared libraries will be created. This
+independent executables or libraries will be created. This
property is ``True`` by default for ``SHARED`` and ``MODULE`` library
-targets and ``False`` otherwise. This property is initialized by the value
-of the :variable:`CMAKE_POSITION_INDEPENDENT_CODE` variable if it is set
-when a target is created.
+targets. For other targets, this property is initialized by the value
+of the :variable:`CMAKE_POSITION_INDEPENDENT_CODE` variable if it is set
+when the target is created, or ``False`` otherwise.
.. note::
diff --git a/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
index f5d9437..370c75c 100644
--- a/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
+++ b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
@@ -22,3 +22,5 @@ for more on defining buildsystem properties.
property.
.. include:: ../command/OPTIONS_SHELL.txt
+
+.. include:: ../prop_tgt/STATIC_LIBRARY_OPTIONS_ARCHIVER.txt
diff --git a/Help/prop_tgt/STATIC_LIBRARY_OPTIONS_ARCHIVER.txt b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS_ARCHIVER.txt
new file mode 100644
index 0000000..16a989a
--- /dev/null
+++ b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS_ARCHIVER.txt
@@ -0,0 +1,23 @@
+Handling Archiver Driver Differences
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 4.0
+
+To pass options to the archiver tool, each compiler driver has its own syntax.
+The ``ARCHIVER:`` prefix and ``,`` separator can be used to specify, in a portable
+way, options to pass to the archiver tool. ``ARCHIVER:`` is replaced by the
+appropriate driver option and ``,`` by the appropriate driver separator.
+The driver prefix and driver separator are given by the values of the
+:variable:`CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG` and
+:variable:`CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG_SEP` variables.
+
+The ``ARCHIVER:`` prefix can be specified as part of a ``SHELL:`` prefix
+expression.
+
+The ``ARCHIVER:`` prefix supports, as an alternative syntax, specification of
+arguments using the ``SHELL:`` prefix and space as separator.
+
+.. note::
+
+ Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
+ ``ARCHIVER:`` prefix is not supported.
diff --git a/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst b/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst
index 77f8311..af6bad0 100644
--- a/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst
+++ b/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst
@@ -11,14 +11,14 @@ placed in the build directory corresponding to the target's source directory.
If the variable :variable:`CMAKE_Swift_MODULE_DIRECTORY` is set when a target is
created its value is used to initialize this property.
-.. warning::
+.. versionadded:: 4.0
- This property does not currently provide a way to express per-config
- module directories, so use with multi-config generators is problematic:
+ The property value may use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+ Multi-configuration generators (:generator:`Ninja Multi-Config`) append a
+ per-configuration subdirectory to the specified directory unless a generator
+ expression is used.
- * The :generator:`Xcode` generator does not implement the property at all.
+.. warning::
- * The :generator:`Ninja Multi-Config` generator implements this property,
- but module files generated for different build configurations have the
- same path, which can lead to subtle problems when building more than
- one configuration.
+ The :generator:`Xcode` generator ignores this property.
diff --git a/Help/prop_tgt/UNITY_BUILD_RELOCATABLE.rst b/Help/prop_tgt/UNITY_BUILD_RELOCATABLE.rst
new file mode 100644
index 0000000..8e0f30d
--- /dev/null
+++ b/Help/prop_tgt/UNITY_BUILD_RELOCATABLE.rst
@@ -0,0 +1,39 @@
+UNITY_BUILD_RELOCATABLE
+-----------------------
+
+.. versionadded:: 4.0
+
+By default, the unity file generated when :prop_tgt:`UNITY_BUILD` is enabled
+uses absolute paths to reference the original source files. This causes the
+unity file to result in a different output depending on the location of the
+source files.
+
+When this property is set to true, the ``#include`` lines inside the generated
+unity source files will attempt to use relative paths to the original source
+files if possible in order to standardize the output of the unity file.
+
+The unity file's path to an original source file uses the following priority:
+
+* a path relative to the generated unity file if the source file exists
+ directly in :variable:`CMAKE_BINARY_DIR`, or in a subfolder under it.
+
+* a path relative to :variable:`CMAKE_SOURCE_DIR` if the source file exists
+ directly in :variable:`CMAKE_SOURCE_DIR`, or in a subfolder under it.
+
+* an absolute path to the source file.
+
+This target property *does not* guarantee a consistent unity file across
+different environments as the final priority is an absolute path.
+
+Example usage:
+
+.. code-block:: cmake
+
+ add_library(example_library
+ source1.cxx
+ source2.cxx
+ source3.cxx)
+
+ set_target_properties(example_library PROPERTIES
+ UNITY_BUILD True
+ UNITY_BUILD_RELOCATABLE TRUE)
diff --git a/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst b/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst
index adbbc71..4846139 100644
--- a/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst
+++ b/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst
@@ -6,7 +6,7 @@ Whether to add a compile flag to hide symbols of inline functions
The ``VISIBILITY_INLINES_HIDDEN`` property determines whether a flag for
hiding symbols for inline functions, such as ``-fvisibility-inlines-hidden``,
should be used when invoking the compiler. This property affects compilation
-in sources of all types of targets (subject to policy :policy:`CMP0063`).
+in sources of all types of targets. See policy :policy:`CMP0063`.
This property is initialized by
the value of the :variable:`CMAKE_VISIBILITY_INLINES_HIDDEN` variable if it
diff --git a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst
index dbf5442..9dfa79f 100644
--- a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst
+++ b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst
@@ -13,3 +13,5 @@ created.
This property only works for :ref:`Visual Studio Generators`;
it is ignored on other generators.
+
+See also :prop_tgt:`DEBUGGER_WORKING_DIRECTORY`.
diff --git a/Help/prop_tgt/VS_PROJECT_IMPORT.rst b/Help/prop_tgt/VS_PROJECT_IMPORT.rst
index f5e9698..09cdcf2 100644
--- a/Help/prop_tgt/VS_PROJECT_IMPORT.rst
+++ b/Help/prop_tgt/VS_PROJECT_IMPORT.rst
@@ -5,6 +5,14 @@ VS_PROJECT_IMPORT
Visual Studio managed project imports
-Adds to a generated Visual Studio project one or more semicolon-delimited paths
-to .props files needed when building projects from some NuGet packages.
-For example, ``my_packages_path/MyPackage.1.0.0/build/MyPackage.props``.
+Adds to a generated Visual Studio project one or more paths to ``.props``
+files needed when building projects from some NuGet packages.
+
+For example:
+
+.. code-block:: cmake
+
+ set_property(TARGET myTarget PROPERTY VS_PROJECT_IMPORT
+ "my_packages_path/PackageA.1.0.0/build/PackageA.props"
+ "my_packages_path/PackageB.1.0.0/build/PackageB.props"
+ )
diff --git a/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst
index 00f32f6..5ba1bc1 100644
--- a/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst
+++ b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst
@@ -10,11 +10,24 @@ Enable this boolean property to automatically create a module definition
for a ``SHARED`` library (or executable with :prop_tgt:`ENABLE_EXPORTS`)
on Windows. The module definition file will be passed to the linker
causing all symbols to be exported from the ``.dll``.
-For global *data* symbols, ``__declspec(dllimport)`` must still be used when
-compiling against the code in the ``.dll``. All other function symbols will
-be automatically exported and imported by callers. This simplifies porting
-projects to Windows by reducing the need for explicit ``dllexport`` markup,
-even in ``C++`` classes.
+
+This simplifies porting projects to Windows by reducing the need for
+explicit ``dllexport`` markup, even in ``C++`` classes. Function
+symbols will be automatically exported and may be linked by callers.
+However, there are some cases when compiling code in a consumer may
+require explicit ``dllimport`` markup:
+
+* Global *data* symbols must be explicitly marked with
+ ``__declspec(dllimport)`` in order to link to data in the ``.dll``.
+
+* In cases that the compiler generates references to the virtual function
+ table, such as in a delegating constructor of a class with virtual
+ functions, the whole class must be marked with ``__declspec(dllimport)``
+ in order to link to the vftable in the ``.dll``.
+
+* See the `MSVC Linker /EXPORT Option`_ for more information on data symbols.
+
+.. _`MSVC Linker /EXPORT Option`: https://learn.microsoft.com/en-us/cpp/build/reference/export-exports-a-function
When this property is enabled, zero or more ``.def`` files may also be
specified as source files of the target. The exports named by these files
diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst
index fa3c5bc..8cb5ba0 100644
--- a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst
+++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst
@@ -30,7 +30,6 @@ at target creation time.
- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP`
- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER`
- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP`
-- :prop_tgt:`XCODE_SCHEME_LAUNCH_CONFIGURATION`
- :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_API_VALIDATION`
- :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION`
- :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS`
@@ -44,5 +43,8 @@ The following target properties will be applied on the
- :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE`
- :prop_tgt:`XCODE_SCHEME_ENVIRONMENT`
- :prop_tgt:`XCODE_SCHEME_EXECUTABLE`
+- :prop_tgt:`XCODE_SCHEME_LAUNCH_CONFIGURATION`
- :prop_tgt:`XCODE_SCHEME_LAUNCH_MODE`
+- :prop_tgt:`XCODE_SCHEME_TEST_CONFIGURATION`
+- :prop_tgt:`XCODE_SCHEME_LLDB_INIT_FILE`
- :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY`
diff --git a/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst b/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
index 6ffd694..badf8e2 100644
--- a/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
+++ b/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
@@ -4,8 +4,8 @@ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
.. versionadded:: 3.23
Property value for ``GPU Frame Capture`` in the Options section of
-the generated Xcode scheme. Example values are `Metal` and
-`Disabled`.
+the generated Xcode scheme. Example values are ``Metal`` and
+``Disabled``.
This property is initialized by the value of the variable
:variable:`CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE`
diff --git a/Help/prop_tgt/XCODE_SCHEME_LLDB_INIT_FILE.rst b/Help/prop_tgt/XCODE_SCHEME_LLDB_INIT_FILE.rst
new file mode 100644
index 0000000..eeb73fb
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_LLDB_INIT_FILE.rst
@@ -0,0 +1,15 @@
+XCODE_SCHEME_LLDB_INIT_FILE
+---------------------------
+
+.. versionadded:: 4.0
+
+Property value for ``LLDB Init File`` in the Info section of the
+generated Xcode scheme. In case the value contains generator
+expressions those are evaluated.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_LLDB_INIT_FILE` if it is set
+when a target is created.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION.rst b/Help/prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION.rst
new file mode 100644
index 0000000..7128271
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION.rst
@@ -0,0 +1,13 @@
+XCODE_SCHEME_TEST_CONFIGURATION
+-------------------------------
+
+.. versionadded:: 4.0
+
+Set the build configuration to test the target.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_TEST_CONFIGURATION`
+if it is set when a target is created.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst b/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
index d8d56fc..3f28037 100644
--- a/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
+++ b/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
@@ -13,3 +13,5 @@ when a target is created.
Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
documentation to see all Xcode schema related properties.
+
+See also :prop_tgt:`DEBUGGER_WORKING_DIRECTORY`.
diff --git a/Help/release/3.0.rst b/Help/release/3.0.rst
index e37c130..006ba0c 100644
--- a/Help/release/3.0.rst
+++ b/Help/release/3.0.rst
@@ -50,7 +50,9 @@ Syntax
* The CMake language has been extended with
:ref:`Bracket Argument` and :ref:`Bracket Comment`
- syntax inspired by Lua long brackets::
+ syntax inspired by Lua long brackets:
+
+ .. code-block:: cmake
set(x [===[bracket argument]===] #[[bracket comment]])
@@ -364,8 +366,8 @@ Deprecated and Removed Features
* The builtin documentation formatters that supported command-line
options such as ``--help-man`` and ``--help-html`` have been removed
in favor of the above-mentioned new documentation system. These and
- other command-line options that used to generate man- and html-
- formatted pages no longer work. The :manual:`cmake(1)`
+ other command-line options that used to generate man- and
+ html- formatted pages no longer work. The :manual:`cmake(1)`
``--help-custom-modules`` option now produces a warning at runtime
and generates a minimal document that reports the limitation.
diff --git a/Help/release/3.1.rst b/Help/release/3.1.rst
index 3f4712b..0ae9233 100644
--- a/Help/release/3.1.rst
+++ b/Help/release/3.1.rst
@@ -336,17 +336,23 @@ Deprecated and Removed Features
* In CMake 3.0 the :command:`target_link_libraries` command
accidentally began allowing unquoted arguments to use
:manual:`generator expressions <cmake-generator-expressions(7)>`
- containing a (``;`` separated) list within them. For example::
+ containing a (``;`` separated) list within them. For example:
+
+ .. code-block:: cmake
set(libs B C)
target_link_libraries(A PUBLIC $<BUILD_INTERFACE:${libs}>)
- This is equivalent to writing::
+ This is equivalent to writing:
+
+ .. code-block:: cmake
target_link_libraries(A PUBLIC $<BUILD_INTERFACE:B C>)
and was never intended to work. It did not work in CMake 2.8.12.
- Such generator expressions should be in quoted arguments::
+ Such generator expressions should be in quoted arguments:
+
+ .. code-block:: cmake
set(libs B C)
target_link_libraries(A PUBLIC "$<BUILD_INTERFACE:${libs}>")
@@ -356,14 +362,18 @@ Deprecated and Removed Features
* Prior to CMake 3.1 the Makefile generators did not escape ``#``
correctly inside make variable assignments used in generated
makefiles, causing them to be treated as comments. This made
- code like::
+ code like:
+
+ .. code-block:: cmake
add_compile_options(-Wno-#pragma-messages)
not work in Makefile generators, but work in other generators.
Now it is escaped correctly, making the behavior consistent
across generators. However, some projects may have tried to
- workaround the original bug with code like::
+ workaround the original bug with code like:
+
+ .. code-block:: cmake
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-\\#pragma-messages")
diff --git a/Help/release/3.11.rst b/Help/release/3.11.rst
index 6e1520a..c2c15eb 100644
--- a/Help/release/3.11.rst
+++ b/Help/release/3.11.rst
@@ -127,7 +127,7 @@ Properties
Modules
-------
-* The :module:`CheckIncludeFiles` module :command:`CHECK_INCLUDE_FILES`
+* The :module:`CheckIncludeFiles` module :command:`check_include_files`
command gained a ``LANGUAGE`` option to specify whether to check using the
``C`` or ``CXX`` compiler.
@@ -161,7 +161,7 @@ Modules
* A :module:`FindIconv` module was added to locate iconv support.
-* The :module:`GenerateExportHeader` module ``GENERATE_EXPORT_HEADER`` command
+* The :module:`GenerateExportHeader` module ``generate_export_header`` command
gained an ``INCLUDE_GUARD_NAME`` option to change the name of the include
guard symbol written to the generated export header.
Additionally, it now adds a comment after the closing ``#endif`` on the
diff --git a/Help/release/3.14.rst b/Help/release/3.14.rst
index ab59ee2..f46a417 100644
--- a/Help/release/3.14.rst
+++ b/Help/release/3.14.rst
@@ -236,28 +236,28 @@ Modules
their library names rather than header names. The old variables are provided
for compatibility:
- - ``X11_Xxf86misc_INCLUDE_PATH`` instead of ``X11_xf86misc_INCLUDE_PATH``
- - ``X11_Xxf86misc_LIB`` instead of ``X11_xf86misc_LIB``
- - ``X11_Xxf86misc_FOUND`` instead of ``X11_xf86misc_FOUND``
- - ``X11_Xxf86vm_INCLUDE_PATH`` instead of ``X11_xf86vmode_INCLUDE_PATH``
- - ``X11_Xxf86vm_LIB`` instead of ``X11_xf86vmode_LIB``
- - ``X11_Xxf86vm_FOUND`` instead of ``X11_xf86vmode_FOUND``
- - ``X11_xkbfile_INCLUDE_PATH`` instead of ``X11_Xkbfile_INCLUDE_PATH``
- - ``X11_xkbfile_LIB`` instead of ``X11_Xkbfile_LIB``
- - ``X11_xkbfile_FOUND`` instead of ``X11_Xkbfile_FOUND``
- - ``X11_Xtst_INCLUDE_PATH`` instead of ``X11_XTest_INCLUDE_PATH``
- - ``X11_Xtst_LIB`` instead of ``X11_XTest_LIB``
- - ``X11_Xtst_FOUND`` instead of ``X11_XTest_FOUND``
- - ``X11_Xss_INCLUDE_PATH`` instead of ``X11_Xscreensaver_INCLUDE_PATH``
- - ``X11_Xss_LIB`` instead of ``X11_Xscreensaver_LIB``
- - ``X11_Xss_FOUND`` instead of ``X11_Xscreensaver_FOUND``
+ - ``X11_Xxf86misc_INCLUDE_PATH`` instead of ``X11_xf86misc_INCLUDE_PATH``
+ - ``X11_Xxf86misc_LIB`` instead of ``X11_xf86misc_LIB``
+ - ``X11_Xxf86misc_FOUND`` instead of ``X11_xf86misc_FOUND``
+ - ``X11_Xxf86vm_INCLUDE_PATH`` instead of ``X11_xf86vmode_INCLUDE_PATH``
+ - ``X11_Xxf86vm_LIB`` instead of ``X11_xf86vmode_LIB``
+ - ``X11_Xxf86vm_FOUND`` instead of ``X11_xf86vmode_FOUND``
+ - ``X11_xkbfile_INCLUDE_PATH`` instead of ``X11_Xkbfile_INCLUDE_PATH``
+ - ``X11_xkbfile_LIB`` instead of ``X11_Xkbfile_LIB``
+ - ``X11_xkbfile_FOUND`` instead of ``X11_Xkbfile_FOUND``
+ - ``X11_Xtst_INCLUDE_PATH`` instead of ``X11_XTest_INCLUDE_PATH``
+ - ``X11_Xtst_LIB`` instead of ``X11_XTest_LIB``
+ - ``X11_Xtst_FOUND`` instead of ``X11_XTest_FOUND``
+ - ``X11_Xss_INCLUDE_PATH`` instead of ``X11_Xscreensaver_INCLUDE_PATH``
+ - ``X11_Xss_LIB`` instead of ``X11_Xscreensaver_LIB``
+ - ``X11_Xss_FOUND`` instead of ``X11_Xscreensaver_FOUND``
The following variables are deprecated completely since they were
essentially duplicates:
- - ``X11_Xinput_INCLUDE_PATH`` (use ``X11_Xi_INCLUDE_PATH``)
- - ``X11_Xinput_LIB`` (use ``X11_Xi_LIB``)
- - ``X11_Xinput_FOUND`` (use ``X11_Xi_FOUND``)
+ - ``X11_Xinput_INCLUDE_PATH`` (use ``X11_Xi_INCLUDE_PATH``)
+ - ``X11_Xinput_LIB`` (use ``X11_Xi_LIB``)
+ - ``X11_Xinput_FOUND`` (use ``X11_Xi_FOUND``)
* The :module:`FindX11` now provides ``X11_Xext_INCLUDE_PATH``.
diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst
index a27d638..63ec423 100644
--- a/Help/release/3.17.rst
+++ b/Help/release/3.17.rst
@@ -145,7 +145,7 @@ Properties
* Target properties :prop_tgt:`MACHO_COMPATIBILITY_VERSION` and
:prop_tgt:`MACHO_CURRENT_VERSION` were added to set the
- ``compatibility_version`` and ``curent_version``, respectively,
+ ``compatibility_version`` and ``current_version``, respectively,
for Mach-O binaries. For backwards compatibility, if these properties
are not set, :prop_tgt:`SOVERSION` and :prop_tgt:`VERSION`
are used respectively as fallbacks.
diff --git a/Help/release/3.3.rst b/Help/release/3.3.rst
index 2dc237f..efb6a7c 100644
--- a/Help/release/3.3.rst
+++ b/Help/release/3.3.rst
@@ -135,7 +135,7 @@ Modules
documentation, and unit tests.
* The :module:`FindPackageHandleStandardArgs` module
- ``FIND_PACKAGE_HANDLE_STANDARD_ARGS`` function now
+ ``find_package_handle_standard_args`` function now
always populates both the ``<PackageName>_FOUND``
and ``<UPPERCASE_NAME>_FOUND`` variables (the latter
for backwards compatibility). The ``FOUND_VAR``
diff --git a/Help/release/3.30.rst b/Help/release/3.30.rst
index e1720be..b98bf37 100644
--- a/Help/release/3.30.rst
+++ b/Help/release/3.30.rst
@@ -285,7 +285,7 @@ Changes made since CMake 3.30.0 include the following.
This refines 3.30.3's behavior change to restore behavior of nested
directories that call :command:`project` with the same project name,
but the implementation in this release is flawed (this release note has
- been retoractively updated). It can result in different behavior between
+ been retroactively updated). It can result in different behavior between
the first and subsequent runs. Do not use CMake 3.30.4 if your project
contains nested calls to :command:`project` with the same project name
and you use these variables.
diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst
index 58a5d4e..e877164 100644
--- a/Help/release/3.5.rst
+++ b/Help/release/3.5.rst
@@ -168,7 +168,7 @@ Deprecated and Removed Features
* The :generator:`Xcode` generator was fixed to escape backslashes in
strings consistently with other generators. Projects that previously
- worked around the inconsistecy with an extra level of backslashes
+ worked around the inconsistency with an extra level of backslashes
conditioned on the Xcode generator must be updated to remove the
workaround for CMake 3.5 and greater.
diff --git a/Help/release/3.6.rst b/Help/release/3.6.rst
index 63e3134..92b1012 100644
--- a/Help/release/3.6.rst
+++ b/Help/release/3.6.rst
@@ -225,8 +225,8 @@ CPack
package file names, how to specify that rpmbuild should decide on file
name format as well as handling of multiple rpm packages generated by a
single user defined spec file.
- See :variable:`CPACK_RPM_PACKAGE_NAME` and
- :variable:`CPACK_RPM_<component>_PACKAGE_NAME`.
+ See :variable:`CPACK_RPM_FILE_NAME` and
+ :variable:`CPACK_RPM_<component>_FILE_NAME`.
* The :cpack_gen:`CPack RPM Generator` learned how to correctly handle symlinks
that are pointing outside generated packages.
diff --git a/Help/release/3.8.rst b/Help/release/3.8.rst
index de51a7b..bae7eea 100644
--- a/Help/release/3.8.rst
+++ b/Help/release/3.8.rst
@@ -368,7 +368,7 @@ Other Changes
* The :command:`ctest_memcheck` command no longer automatically adds
``leak_check=1`` to the options used by ``AddressSanitizer``. The default
- behavior of ``AddressSanitizer`` is to run `LeakSanitizer` to check leaks
+ behavior of ``AddressSanitizer`` is to run ``LeakSanitizer`` to check leaks
unless ``leak_check=0``.
* The :command:`ctest_memcheck` command was fixed to correctly append extra
diff --git a/Help/release/4.0.rst b/Help/release/4.0.rst
new file mode 100644
index 0000000..97981c3
--- /dev/null
+++ b/Help/release/4.0.rst
@@ -0,0 +1,303 @@
+CMake 4.0 Release Notes
+***********************
+
+.. only:: html
+
+ .. contents::
+
+Changes made since CMake 3.31 include the following.
+
+New Features
+============
+
+File-Based API
+--------------
+
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
+ been updated to 2.8.
+
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object
+ gained a new ``debugger`` field.
+
+Command-Line
+------------
+
+* The :option:`cmake --link-no-warning-as-error` option was added to suppress
+ the effects of the :prop_tgt:`LINK_WARNING_AS_ERROR` target property and
+ :variable:`CMAKE_LINK_WARNING_AS_ERROR` variable.
+
+* The :option:`cmake --project-file` option was added to specify an alternate
+ filename for ``CMakeLists.txt`` files. This is intended for temporary use
+ by developers during an incremental transition and not for publication of a
+ final product. CMake will always emit a warning when the project file is
+ anything other than ``CMakeLists.txt``.
+
+Commands
+--------
+
+* The :command:`target_link_libraries` command now supports the ``LINKER:``
+ prefix.
+
+Variables
+---------
+
+* The :variable:`AIX` and :variable:`CMAKE_HOST_AIX` variables are
+ now set to true when the target or host system is AIX, respectively.
+
+* Linker flag variables learned to support the ``LINKER:`` prefix:
+
+ * :variable:`CMAKE_EXE_LINKER_FLAGS`
+ * :variable:`CMAKE_EXE_LINKER_FLAGS_<CONFIG>`
+ * :variable:`CMAKE_SHARED_LINKER_FLAGS`
+ * :variable:`CMAKE_SHARED_LINKER_FLAGS_<CONFIG>`
+ * :variable:`CMAKE_MODULE_LINKER_FLAGS`
+ * :variable:`CMAKE_MODULE_LINKER_FLAGS_<CONFIG>`
+
+ See policy :policy:`CMP0181`.
+
+* The :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL` variable
+ was added to specify the :command:`execute_process` command's
+ default ``COMMAND_ERROR_IS_FATAL`` behavior.
+
+* The :variable:`CMAKE_<LANG>_LINK_MODE` and
+ :variable:`CMAKE_<LANG>_DEVICE_LINK_MODE` variables were added to provide
+ information on how the link step is done.
+
+* The :variable:`CMAKE_LINK_WARNING_AS_ERROR` variable and corresponding
+ :prop_tgt:`LINK_WARNING_AS_ERROR` target property were added to link
+ using a linker-specific flag to treat warnings as errors.
+
+* The :variable:`CMAKE_MSVC_RUNTIME_CHECKS` variable and
+ :prop_tgt:`MSVC_RUNTIME_CHECKS` target property were introduced
+ to select runtime checks for compilers targeting the MSVC ABI.
+ See policy :policy:`CMP0184`.
+
+* The :variable:`CMAKE_POLICY_VERSION_MINIMUM` variable was added to
+ help packagers and end users try to configure existing projects that
+ have not been updated to work with supported CMake versions.
+ The :envvar:`CMAKE_POLICY_VERSION_MINIMUM` environment variable was
+ added to initialize it.
+
+* The :variable:`CMAKE_UNITY_BUILD_RELOCATABLE` variable and corresponding
+ :prop_tgt:`UNITY_BUILD_RELOCATABLE` target property were added to make
+ sources generated for :variable:`CMAKE_UNITY_BUILD` to ``#include`` the
+ original source files using relative paths where possible.
+
+* The :variable:`CMAKE_XCODE_SCHEME_LLDB_INIT_FILE` variable and corresponding
+ :prop_tgt:`XCODE_SCHEME_LLDB_INIT_FILE` target property were added to tell
+ the :generator:`Xcode` generator what to put in the scheme's "LLDB Init File"
+ setting.
+
+* The :variable:`CMAKE_XCODE_SCHEME_TEST_CONFIGURATION` variable and corresponding
+ :prop_tgt:`XCODE_SCHEME_TEST_CONFIGURATION` target property were added to tell
+ the :generator:`Xcode` generator what to put in the scheme's "Build Configuration"
+ setting for the test action.
+
+Properties
+----------
+
+* The :prop_tgt:`DEBUGGER_WORKING_DIRECTORY` target property and corresponding
+ :variable:`CMAKE_DEBUGGER_WORKING_DIRECTORY` variable were added to tell
+ generators what debugger working directory should be set for targets.
+
+* The :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property now supports an
+ ``ARCHIVER:`` prefix to pass options to the archiver through the compiler
+ driver in a portable way.
+
+* The :prop_tgt:`Swift_MODULE_DIRECTORY` target property now supports
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+* The :prop_sf:`VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD` source file property
+ was added to tell :ref:`Visual Studio Generators` not to run a custom command
+ in parallel.
+
+* The :prop_dir:`VS_SOLUTION_ITEMS` directory property was added
+ to tell :ref:`Visual Studio Generators` to attach files directly
+ to the Solution (``.sln``).
+
+Modules
+-------
+
+* The :module:`ExternalData` module gained a
+ :variable:`ExternalData_HTTPHEADERS` variable to specify HTTP headers.
+
+* The :module:`ExternalProject` module's :command:`ExternalProject_Add`
+ command gained an ``INSTALL_JOB_SERVER_AWARE`` option to enable
+ integration of the GNU Make job server when using an explicit
+ ``INSTALL_COMMAND`` with :ref:`Makefile Generators`.
+
+* The :module:`FeatureSummary` module :command:`add_feature_info`
+ command now supports full :ref:`Condition Syntax`.
+ See policy :policy:`CMP0183`.
+
+* The :module:`FindBISON` module :command:`bison_target` command gained an
+ ``OPTIONS`` option to specify Bison command-line options.
+
+* The :module:`FindCURL` module now provides a ``CURL_VERSION`` result
+ variable to match upstream cURL's CMake package.
+
+* The :module:`FindFLEX` module :command:`flex_target` command gained an
+ ``OPTIONS`` option to specify Flex command-line options.
+
+* The :module:`FindPatch` module now supports running in
+ :ref:`cmake -P <Script Processing Mode>` script mode by skipping
+ the creation of the imported target.
+
+* The :module:`FindProtobuf` module :command:`protobuf_generate` command
+ gained a ``PROTOC_EXE`` option to specify a custom ``protoc`` executable.
+
+* The :module:`FindPython`, :module:`FindPython2`, and :module:`FindPython3`
+ modules gained the possibility to do multiple calls in the same directory by
+ using, respectively, the variables ``Python_ARTIFACTS_PREFIX``,
+ ``Python2_ARTIFACTS_PREFIX``, and ``Python3_ARTIFACTS_PREFIX``.
+
+* The :module:`FindRuby` module learned to find rbenv-provided installations.
+
+Generator Expressions
+---------------------
+
+* The :genex:`$<PATH>` generator expression gained the ``NATIVE_PATH``
+ operation to convert a CMake path into a native one.
+
+CTest
+-----
+
+* The :option:`ctest --interactive-debug-mode` option on Windows
+ now enables Windows Error Reporting by default in test processes,
+ allowing them to creating debug popup windows and core dumps.
+ This restores behavior previously removed by CMake 3.11 after
+ updates to ``libuv`` made it possible.
+
+CPack
+-----
+
+* The :cpack_gen:`CPack Archive Generator` learned to generate ``.tar``
+ packages without compression.
+
+* The :cpack_gen:`CPack Archive Generator` now honors the
+ :variable:`CPACK_ARCHIVE_FILE_NAME` variable for all packages.
+ Previously, this variable worked only for component-based packages.
+
+Deprecated and Removed Features
+===============================
+
+* Compatibility with versions of CMake older than 3.5 has been removed.
+ Calls to :command:`cmake_minimum_required` or :command:`cmake_policy`
+ that set the policy version to an older value now issue an error.
+ Note that calls to those commands can still support older versions of
+ CMake by using their ``VERSION`` arguments' ``<min>...<max>`` syntax.
+ This requires only the ``<min>`` version of CMake, but when running a
+ newer version, sets policies up to the ``<max>`` version.
+
+* The :generator:`Visual Studio 14 2015` and :generator:`Visual Studio 15 2017`
+ generators no longer support specifying a platform as part of the generator
+ name. See :ref:`Visual Studio Platform Selection`.
+
+* The :variable:`CMAKE_<LANG>_USING_LINKER_MODE` variable is no longer used to
+ determine the type of the contents of the
+ :variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` variable. The
+ :variable:`CMAKE_<LANG>_LINK_MODE` variable, set by CMake, is used instead.
+
+* The :module:`FindGDAL` module is now deprecated in favor of upstream
+ GDAL's official CMake package configuration file. Port projects to
+ the latter by calling ``find_package(GDAL CONFIG)``. For further
+ details, see `GDAL's documentation on CMake integration
+ <https://gdal.org/en/latest/development/cmake.html>`_.
+
+* The :module:`FindRuby` module no longer provides variables with the
+ upper-case ``RUBY_`` prefix. See policy :policy:`CMP0185`.
+
+* CTest's undocumented declarative scripting mode has been removed.
+ This mode used to be triggered by a :option:`ctest -S` script which did not
+ call any :ref:`CTest Commands` unless :variable:`CTEST_RUN_CURRENT_SCRIPT`
+ was explicitly set to ``OFF``.
+
+* The :command:`ctest_run_script` command may no longer be called without any
+ arguments.
+
+Other Changes
+=============
+
+* On macOS with :ref:`Ninja Generators` and :ref:`Makefile Generators`, when
+ a compiler is found in ``/usr/bin``, it is now used as-is and is no longer
+ mapped to the corresponding compiler inside Xcode. The mapping was
+ introduced by CMake 3.2 to allow build trees to continue to work with their
+ original compiler even when ``xcode-select`` switches to a different
+ Xcode installation. However, the compilers inside Xcode cannot be used
+ without explicit ``-isysroot`` flags and are therefore not suitable for
+ passing to arbitrary third-party build systems. Furthermore, the mapping
+ behavior can override user-specified compiler paths. Therefore, this
+ behavior has been reverted.
+
+* In builds targeting macOS, :variable:`CMAKE_OSX_SYSROOT` now defaults to
+ empty, deferring to the compiler's default macOS SDK selection. In order
+ to pass an explicit macOS SDK via the compiler's ``-isysroot`` flag, users
+ may configure their build tree with ``-DCMAKE_OSX_SYSROOT=macosx``, or
+ ``export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"`` in their
+ environment.
+
+ Notes:
+
+ * macOS compilers in ``/usr/bin``, when not invoked with ``-isysroot``,
+ search for headers in ``/usr/local/include`` before system SDK paths,
+ matching the convention on many platforms. Users on macOS-x86_64 hosts
+ with Homebrew installed in ``/usr/local`` should pass an explicit SDK,
+ as described above, when not building with Homebrew tools.
+
+ * Some Clang compilers have no default macOS SDK selection. For these,
+ if :variable:`CMAKE_OSX_SYSROOT` is empty, CMake will automatically pass
+ ``-isysroot`` with the macOS SDK printed by ``xcrun --show-sdk-path``.
+
+* On Windows, file paths named in project code, e.g., in ``CMakeLists.txt``,
+ are no longer automatically converted to their on-disk upper/lower case.
+ Projects are expected to spell source file paths consistently using
+ their canonical case, e.g., in calls to :command:`add_library`,
+ :command:`set_property(SOURCE)`, or :command:`set_source_files_properties`.
+ This matches the behavior on platforms with case-sensitive filesystems.
+
+* On AIX, ``SHARED`` library targets now produce a shared library archive
+ by default. See policy :policy:`CMP0182`.
+
+* The :option:`cmake --preset` command no longer outputs a summary of the
+ preset's CMake cache and environment variables by default. That summary is
+ now only shown when the message log level is set to ``VERBOSE``, ``DEBUG``,
+ or ``TRACE`` via the :option:`cmake --log-level` option or the
+ :variable:`CMAKE_MESSAGE_LOG_LEVEL` cache variable.
+
+* Precompiled SunOS ``sparc64`` and ``x86_64`` binaries are now provided
+ on `cmake.org`_.
+
+.. _`cmake.org`: https://cmake.org/download/
+
+Updates
+=======
+
+Changes made since CMake 4.0.0 include the following.
+
+4.0.1
+-----
+
+* This version made no changes to documented features or interfaces.
+ Some implementation updates were made to support ecosystem changes
+ and/or fix regressions.
+
+4.0.2
+-----
+
+* When building for macOS with a Clang that has no default macOS SDK,
+ if :variable:`CMAKE_OSX_SYSROOT` is empty, CMake now automatically passes
+ ``-isysroot`` with the macOS SDK printed by ``xcrun --show-sdk-path``.
+ This restores support for using LLVM/Clang on macOS without manually
+ setting ``CMAKE_OSX_SYSROOT``, which was broken by CMake 4.0.0's
+ removal of a default value.
+
+* The :prop_tgt:`DEBUGGER_WORKING_DIRECTORY` target property is now
+ used by the :generator:`Xcode` generator as a fallback for the
+ :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` target property.
+
+4.0.3
+-----
+
+* This version made no changes to documented features or interfaces.
+ Some implementation updates were made to support ecosystem changes
+ and/or fix regressions.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 40767b7..b083cf5 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -13,6 +13,7 @@ Releases
.. toctree::
:maxdepth: 1
+ 4.0 <4.0>
3.31 <3.31>
3.30 <3.30>
3.29 <3.29>
diff --git a/Help/variable/AIX.rst b/Help/variable/AIX.rst
new file mode 100644
index 0000000..b07418d
--- /dev/null
+++ b/Help/variable/AIX.rst
@@ -0,0 +1,6 @@
+AIX
+---
+
+.. versionadded:: 4.0
+
+Set to true when the target system is AIX.
diff --git a/Help/variable/BUILD_TESTING.rst b/Help/variable/BUILD_TESTING.rst
new file mode 100644
index 0000000..4d460b2
--- /dev/null
+++ b/Help/variable/BUILD_TESTING.rst
@@ -0,0 +1,27 @@
+BUILD_TESTING
+-------------
+
+Control whether the :module:`CTest` module invokes :command:`enable_testing`.
+
+The :module:`CTest` module, when loaded by ``include(CTest)``,
+runs code of the form:
+
+.. code-block:: cmake
+
+ option(BUILD_TESTING "..." ON)
+ if (BUILD_TESTING)
+ # ...
+ enable_testing()
+ # ...
+ endif()
+
+This creates a ``BUILD_TESTING`` option that controls whether the
+:command:`enable_testing` command is invoked to enable generation
+of tests to run using :manual:`ctest(1)`. See the :command:`add_test`
+command to create tests.
+
+.. note::
+
+ Call ``include(CTest)`` in the top-level source directory since
+ :manual:`ctest(1)` expects to find a test file in the top-level
+ build directory.
diff --git a/Help/variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE.rst b/Help/variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE.rst
index 2b636c0..88653b3 100644
--- a/Help/variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE.rst
+++ b/Help/variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE.rst
@@ -3,7 +3,7 @@ CMAKE_AIX_SHARED_LIBRARY_ARCHIVE
.. versionadded:: 3.31
-On AIX, enable creation of shared library archives.
+On AIX, enable or disable creation of shared library archives.
This variable initializes the :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE`
target property on non-imported ``SHARED`` library targets as they are
diff --git a/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst b/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
index 1153cb2..cc19acb 100644
--- a/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
+++ b/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
@@ -16,7 +16,9 @@ The default value is ``Q_OBJECT;Q_GADGET;Q_NAMESPACE;Q_NAMESPACE_EXPORT``.
Example
^^^^^^^
Let CMake know that source files that contain ``CUSTOM_MACRO`` must be ``moc``
-processed as well::
+processed as well:
+
+.. code-block:: cmake
set(CMAKE_AUTOMOC ON)
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")
diff --git a/Help/variable/CMAKE_BACKWARDS_COMPATIBILITY.rst b/Help/variable/CMAKE_BACKWARDS_COMPATIBILITY.rst
index 05c366a..7e99598 100644
--- a/Help/variable/CMAKE_BACKWARDS_COMPATIBILITY.rst
+++ b/Help/variable/CMAKE_BACKWARDS_COMPATIBILITY.rst
@@ -1,4 +1,4 @@
CMAKE_BACKWARDS_COMPATIBILITY
-----------------------------
-Deprecated. See CMake Policy :policy:`CMP0001` documentation.
+Removed. See policy :policy:`CMP0001`.
diff --git a/Help/variable/CMAKE_CFG_INTDIR.rst b/Help/variable/CMAKE_CFG_INTDIR.rst
index 677538d..b9d2919 100644
--- a/Help/variable/CMAKE_CFG_INTDIR.rst
+++ b/Help/variable/CMAKE_CFG_INTDIR.rst
@@ -13,22 +13,25 @@ For native build systems supporting multiple configurations in the
build tree (such as :ref:`Visual Studio Generators` and :generator:`Xcode`),
the value is a reference to a build-time variable specifying the name
of the per-configuration output subdirectory. On :ref:`Makefile Generators`
-this evaluates to `.` because there is only one configuration in a build tree.
+this evaluates to ``.`` because there is only one configuration in a build tree.
Example values:
-::
+.. table::
+ :align: left
- $(Configuration) = Visual Studio
- $(CONFIGURATION) = Xcode
- . = Make-based tools
- . = Ninja
- ${CONFIGURATION} = Ninja Multi-Config
+ ========================= ==============================
+ ``$(Configuration)`` Visual Studio
+ ``$(CONFIGURATION)`` Xcode
+ ``.`` Make-based tools
+ ``.`` Ninja
+ ``${CONFIGURATION}`` Ninja Multi-Config
+ ========================= ==============================
Since these values are evaluated by the native build system, this
variable is suitable only for use in command lines that will be
evaluated at build time. Example of intended usage:
-::
+.. code-block:: cmake
add_executable(mytool mytool.c)
add_custom_command(
diff --git a/Help/variable/CMAKE_COLOR_DIAGNOSTICS.rst b/Help/variable/CMAKE_COLOR_DIAGNOSTICS.rst
index a72c9e1..85195cb 100644
--- a/Help/variable/CMAKE_COLOR_DIAGNOSTICS.rst
+++ b/Help/variable/CMAKE_COLOR_DIAGNOSTICS.rst
@@ -3,7 +3,7 @@ CMAKE_COLOR_DIAGNOSTICS
.. versionadded:: 3.24
-Enable color diagnostics throughout.
+Enable color diagnostics throughout the generated build system.
This variable uses three states: ``ON``, ``OFF`` and not defined.
@@ -35,3 +35,6 @@ When ``OFF``:
If the :envvar:`CMAKE_COLOR_DIAGNOSTICS` environment variable is set, its
value is used. Otherwise, ``CMAKE_COLOR_DIAGNOSTICS`` is not defined by
default.
+
+See the :envvar:`CLICOLOR` and :envvar:`CLICOLOR_FORCE` environment
+variables to control color output from CMake command-line tools.
diff --git a/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_DIR.rst b/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_DIR.rst
index f8f553d..c4f5b98 100644
--- a/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_DIR.rst
+++ b/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_DIR.rst
@@ -39,5 +39,6 @@ The above example can be written in the more concise and more robust form:
endfunction()
See also :variable:`CMAKE_CURRENT_FUNCTION`,
-:variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE` and
-:variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE`.
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE`,
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE` and
+:variable:`CMAKE_CURRENT_LIST_DIR`.
diff --git a/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_FILE.rst b/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_FILE.rst
index 437dfec..d533441 100644
--- a/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_FILE.rst
+++ b/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_FILE.rst
@@ -7,5 +7,6 @@ When executing code inside a :command:`function`, this variable
contains the full path to the listfile that defined the current function.
See also :variable:`CMAKE_CURRENT_FUNCTION`,
-:variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR` and
-:variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE`.
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR`,
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE` and
+:variable:`CMAKE_CURRENT_LIST_FILE`.
diff --git a/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_LINE.rst b/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_LINE.rst
index 2fc7012..2b1f472 100644
--- a/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_LINE.rst
+++ b/Help/variable/CMAKE_CURRENT_FUNCTION_LIST_LINE.rst
@@ -8,5 +8,6 @@ contains the line number in the listfile where the current function
was defined.
See also :variable:`CMAKE_CURRENT_FUNCTION`,
-:variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR` and
-:variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE`.
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR`,
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE` and
+:variable:`CMAKE_CURRENT_LIST_LINE`.
diff --git a/Help/variable/CMAKE_CURRENT_LIST_DIR.rst b/Help/variable/CMAKE_CURRENT_LIST_DIR.rst
index ebc3ab9..b55bc37 100644
--- a/Help/variable/CMAKE_CURRENT_LIST_DIR.rst
+++ b/Help/variable/CMAKE_CURRENT_LIST_DIR.rst
@@ -14,4 +14,5 @@ function is the directory of the file invoking the bottom-most entry
on the call stack, not the directory of the file containing the macro
or function definition.
-See also :variable:`CMAKE_CURRENT_LIST_FILE`.
+See also :variable:`CMAKE_CURRENT_LIST_FILE` and
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR`.
diff --git a/Help/variable/CMAKE_CURRENT_LIST_FILE.rst b/Help/variable/CMAKE_CURRENT_LIST_FILE.rst
index 84b0eee..c94933d 100644
--- a/Help/variable/CMAKE_CURRENT_LIST_FILE.rst
+++ b/Help/variable/CMAKE_CURRENT_LIST_FILE.rst
@@ -12,4 +12,5 @@ value. Therefore the value of the variable inside a macro or function
is the file invoking the bottom-most entry on the call stack, not the
file containing the macro or function definition.
-See also :variable:`CMAKE_PARENT_LIST_FILE`.
+See also :variable:`CMAKE_PARENT_LIST_FILE` and
+:variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE`.
diff --git a/Help/variable/CMAKE_CURRENT_LIST_LINE.rst b/Help/variable/CMAKE_CURRENT_LIST_LINE.rst
index 7f839c2..f23ba2f 100644
--- a/Help/variable/CMAKE_CURRENT_LIST_LINE.rst
+++ b/Help/variable/CMAKE_CURRENT_LIST_LINE.rst
@@ -9,3 +9,5 @@ cmake.
If CMake is currently processing deferred calls scheduled by
the :command:`cmake_language(DEFER)` command, this variable
evaluates to ``DEFERRED`` instead of a specific line number.
+
+See also :variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE`.
diff --git a/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst b/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst
index 384b5eb..6605f1a 100644
--- a/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst
+++ b/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst
@@ -8,7 +8,7 @@ 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 ::
+.. 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
index e2b27a0..057272b 100644
--- a/Help/variable/CMAKE_CXX_MODULE_STD.rst
+++ b/Help/variable/CMAKE_CXX_MODULE_STD.rst
@@ -6,7 +6,7 @@ CMAKE_CXX_MODULE_STD
Whether to add utility targets as dependencies to targets with at least
``cxx_std_23`` or not.
-.. note ::
+.. note::
This setting 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_DEBUGGER_WORKING_DIRECTORY.rst b/Help/variable/CMAKE_DEBUGGER_WORKING_DIRECTORY.rst
new file mode 100644
index 0000000..be4020e
--- /dev/null
+++ b/Help/variable/CMAKE_DEBUGGER_WORKING_DIRECTORY.rst
@@ -0,0 +1,8 @@
+CMAKE_DEBUGGER_WORKING_DIRECTORY
+--------------------------------
+
+.. versionadded:: 4.0
+
+This variable is used to initialize the :prop_tgt:`DEBUGGER_WORKING_DIRECTORY`
+property on each target as it is created. See that target property
+for additional information.
diff --git a/Help/variable/CMAKE_DEBUG_POSTFIX.rst b/Help/variable/CMAKE_DEBUG_POSTFIX.rst
index 08577a5..7772da6 100644
--- a/Help/variable/CMAKE_DEBUG_POSTFIX.rst
+++ b/Help/variable/CMAKE_DEBUG_POSTFIX.rst
@@ -4,4 +4,4 @@ CMAKE_DEBUG_POSTFIX
See variable :variable:`CMAKE_<CONFIG>_POSTFIX`.
This variable is a special case of the more-general
-:variable:`CMAKE_<CONFIG>_POSTFIX` variable for the `DEBUG` configuration.
+:variable:`CMAKE_<CONFIG>_POSTFIX` variable for the ``DEBUG`` configuration.
diff --git a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst
index 29249d6..f1dfb56 100644
--- a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst
+++ b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst
@@ -3,7 +3,7 @@ CMAKE_DOTNET_TARGET_FRAMEWORK
.. versionadded:: 3.17
-Default value for :prop_tgt:`DOTNET_TARGET_FRAMEWORK` property of
+Default value for :prop_tgt:`DOTNET_TARGET_FRAMEWORK` property of
targets.
This variable is used to initialize the
diff --git a/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL.rst b/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL.rst
new file mode 100644
index 0000000..54e17d6
--- /dev/null
+++ b/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL.rst
@@ -0,0 +1,9 @@
+CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
+--------------------------------------------
+
+.. versionadded:: 4.0
+
+Specify a default for the :command:`execute_process` command's
+``COMMAND_ERROR_IS_FATAL`` option. This variable is ignored when a
+``RESULTS_VARIABLE`` or ``RESULT_VARIABLE`` keyword is supplied to
+the command.
diff --git a/Help/variable/CMAKE_EXE_LINKER_FLAGS.rst b/Help/variable/CMAKE_EXE_LINKER_FLAGS.rst
index 9e108f8..a978d11 100644
--- a/Help/variable/CMAKE_EXE_LINKER_FLAGS.rst
+++ b/Help/variable/CMAKE_EXE_LINKER_FLAGS.rst
@@ -4,3 +4,5 @@ CMAKE_EXE_LINKER_FLAGS
Linker flags to be used to create executables.
These flags will be used by the linker when creating an executable.
+
+.. include:: ../variable/LINKER_FLAGS.txt
diff --git a/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst
index 0cd8113..1d74077 100644
--- a/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst
+++ b/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst
@@ -5,3 +5,5 @@ Flags to be used when linking an executable.
Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating
executables.
+
+.. include:: ../variable/LINKER_FLAGS.txt
diff --git a/Help/variable/CMAKE_EXPORT_BUILD_DATABASE.rst b/Help/variable/CMAKE_EXPORT_BUILD_DATABASE.rst
index 94d9842..a71f778 100644
--- a/Help/variable/CMAKE_EXPORT_BUILD_DATABASE.rst
+++ b/Help/variable/CMAKE_EXPORT_BUILD_DATABASE.rst
@@ -3,7 +3,7 @@ CMAKE_EXPORT_BUILD_DATABASE
.. versionadded:: 3.31
-.. note ::
+.. note::
This variable is meaningful only when experimental support for build
databases has been enabled by the
diff --git a/Help/variable/CMAKE_EXPORT_SARIF.rst b/Help/variable/CMAKE_EXPORT_SARIF.rst
new file mode 100644
index 0000000..09ed40b
--- /dev/null
+++ b/Help/variable/CMAKE_EXPORT_SARIF.rst
@@ -0,0 +1,81 @@
+CMAKE_EXPORT_SARIF
+------------------
+
+.. versionadded:: 4.0
+
+Enable or disable CMake diagnostics output in SARIF format for a project.
+
+If enabled, CMake will generate a SARIF log file containing diagnostic messages
+output by CMake when running in a project. By default, the log file is written
+to ``.cmake/sarif/cmake.sarif``, but the location can be changed by setting the
+command-line option :option:`cmake --sarif-output` to the desired path.
+
+The Static Analysis Results Interchange Format (SARIF) is a JSON-based standard
+format for static analysis tools (including build tools like CMake) to record
+and communicate diagnostic messages. CMake generates a SARIF log entry for
+warnings and errors produced while running CMake on a project (e.g.
+:command:`message` calls). Each log entry includes the message, severity, and
+location information if available.
+
+An example of CMake's SARIF output is:
+
+.. code-block:: json
+
+ {
+ "version" : "2.1.0",
+ "$schema" : "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
+ "runs" :
+ [
+ {
+ "tool" :
+ {
+ "driver" :
+ {
+ "name" : "CMake",
+ "rules" :
+ [
+ {
+ "id" : "CMake.Warning",
+ "messageStrings" :
+ {
+ "default" :
+ {
+ "text" : "CMake Warning: {0}"
+ }
+ },
+ "name" : "CMake Warning"
+ }
+ ]
+ }
+ },
+ "results" :
+ [
+ {
+ "level" : "warning",
+ "locations" :
+ [
+ {
+ "physicalLocation" :
+ {
+ "artifactLocation" :
+ {
+ "uri" : "/home/user/development/project/CMakeLists.txt"
+ },
+ "region" :
+ {
+ "startLine" : 5
+ }
+ }
+ }
+ ],
+ "message" :
+ {
+ "text" : "An example warning"
+ },
+ "ruleId" : "CMake.Warning",
+ "ruleIndex" : 0
+ }
+ ]
+ }
+ ]
+ }
diff --git a/Help/variable/CMAKE_HOST_AIX.rst b/Help/variable/CMAKE_HOST_AIX.rst
new file mode 100644
index 0000000..8037796
--- /dev/null
+++ b/Help/variable/CMAKE_HOST_AIX.rst
@@ -0,0 +1,6 @@
+CMAKE_HOST_AIX
+--------------
+
+.. versionadded:: 4.0
+
+Set to true when the host system is AIX.
diff --git a/Help/variable/CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst b/Help/variable/CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst
index f864c20..47d8ef0 100644
--- a/Help/variable/CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst
+++ b/Help/variable/CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst
@@ -17,11 +17,11 @@ path. Example of such locations are directories created due to the setting of
Expected content of the ``CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS``
variable is a list of permissions that can be used by :command:`install` command
-`PERMISSIONS` section.
+``PERMISSIONS`` section.
Example usage:
-::
+.. code-block:: cmake
set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ
diff --git a/Help/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX.rst b/Help/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX.rst
index ff072ca..91ce012 100644
--- a/Help/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX.rst
+++ b/Help/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX.rst
@@ -9,6 +9,8 @@ path prefixing the toolchain GNU compiler and its binutils.
See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX`
and :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_MACHINE`.
-For example, the path to the linker is::
+For example, the path to the linker is:
+
+.. code-block:: cmake
${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}
diff --git a/Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG.rst b/Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG.rst
new file mode 100644
index 0000000..c4a5d4d
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG.rst
@@ -0,0 +1,17 @@
+CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG
+----------------------------------
+
+.. versionadded:: 4.0
+
+Defines the syntax of compiler driver option to pass options to the archiver
+tool. It will be used to translate the ``ARCHIVER:`` prefix in the static
+library options (see :prop_tgt:`STATIC_LIBRARY_OPTIONS`).
+
+This variable holds a :ref:`semicolon-separated list <CMake Language Lists>` of
+tokens. If a space (i.e. " ") is specified as last token, flag and
+``ARCHIVER:`` arguments will be specified as separate arguments to the compiler
+driver. The :variable:`CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG_SEP` variable can be
+specified to manage concatenation of arguments.
+
+See :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` variable for examples of
+definitions because ``CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG`` use the same syntax.
diff --git a/Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG_SEP.rst b/Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG_SEP.rst
new file mode 100644
index 0000000..9822fd8
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_ARCHIVER_WRAPPER_FLAG_SEP.rst
@@ -0,0 +1,11 @@
+CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG_SEP
+--------------------------------------
+
+.. versionadded:: 4.0
+
+This variable is used with :variable:`CMAKE_<LANG>_ARCHIVER_WRAPPER_FLAG`
+variable to format ``ARCHIVER:`` prefix in the static library options
+(see :prop_tgt:`STATIC_LIBRARY_OPTIONS`).
+
+When specified, arguments of the ``ARCHIVER:`` prefix will be concatenated
+using this value as separator.
diff --git a/Help/variable/CMAKE_LANG_DEVICE_LINK_MODE.rst b/Help/variable/CMAKE_LANG_DEVICE_LINK_MODE.rst
new file mode 100644
index 0000000..8ab1de3
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_DEVICE_LINK_MODE.rst
@@ -0,0 +1,14 @@
+CMAKE_<LANG>_DEVICE_LINK_MODE
+-----------------------------
+
+.. versionadded:: 4.0
+
+Defines how the device link step is done. The possible values are:
+
+``DRIVER``
+ The compiler is used as driver for the device link step.
+
+``LINKER``
+ The linker is used directly for the device link step.
+
+This variable is read-only. Setting it is undefined behavior.
diff --git a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst
index 7e008df..030fcfc 100644
--- a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst
+++ b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst
@@ -31,9 +31,9 @@ Some toolchains read implicit directories from an environment variable such as
consistent when operating in a given build tree because CMake saves the value
detected when first creating a build tree.
-If policy :policy:`CMP0060` is not set to ``NEW``, then when a library in one
-of these directories is given by full path to :command:`target_link_libraries`
-CMake will generate the ``-l<name>`` form on link lines for historical
-purposes.
+In CMake versions prior to 4.0, if policy :policy:`CMP0060` is not set
+to ``NEW``, then when a library in one of these directories is given by
+full path to :command:`target_link_libraries` CMake will generate the
+``-l<name>`` form on link lines for historical purposes.
See also the :variable:`CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES` variable.
diff --git a/Help/variable/CMAKE_LANG_LINK_MODE.rst b/Help/variable/CMAKE_LANG_LINK_MODE.rst
new file mode 100644
index 0000000..6025671
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_LINK_MODE.rst
@@ -0,0 +1,14 @@
+CMAKE_<LANG>_LINK_MODE
+----------------------
+
+.. versionadded:: 4.0
+
+Defines how the link step is done. The possible values are:
+
+``DRIVER``
+ The compiler is used as driver for the link step.
+
+``LINKER``
+ The linker is used directly for the link step.
+
+This variable is read-only. Setting it is undefined behavior.
diff --git a/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst b/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst
index 5004530..ea1a3d2 100644
--- a/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst
+++ b/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst
@@ -3,7 +3,13 @@ CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG
.. versionadded:: 3.22
-Linker flag to be used to configure linker so that all specified libraries on
-the command line will be linked into the target.
+Linker flag used by :prop_tgt:`LINK_WHAT_YOU_USE` to tell the linker to
+link all shared libraries specified on the command line even if none
+of their symbols is needed. This is an implementation detail used so
+that the command in :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK` can check
+the binary for unnecessarily-linked shared libraries.
-See also variable :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK`.
+.. note::
+
+ Do not rely on this abstraction to intentionally link to
+ shared libraries whose symbols are not needed.
diff --git a/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst b/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst
index bfed407..7b252aa 100644
--- a/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst
+++ b/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst
@@ -15,3 +15,18 @@ variable should be interpreted. The supported linker mode values are:
``TOOL``
:variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` holds the path to the linker
tool.
+
+.. warning::
+
+ The variable must be set accordingly to how CMake manage the link step:
+
+ * value ``TOOL`` is expected and required when the linker is used directly
+ for the link step.
+ * value ``FLAGS`` is expected or the variable not set when the compiler is
+ used as driver for the link step.
+
+.. deprecated:: 4.0
+
+This variable is no longer used. The type of information stored in the
+:variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` variable is determined by the
+:variable:`CMAKE_<LANG>_LINK_MODE` variable.
diff --git a/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst b/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst
index 1cf7d28..faed3b0 100644
--- a/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst
+++ b/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst
@@ -6,9 +6,15 @@ CMAKE_<LANG>_USING_LINKER_<TYPE>
This variable defines how to specify the ``<TYPE>`` linker for the link step,
as controlled by the :variable:`CMAKE_LINKER_TYPE` variable or the
:prop_tgt:`LINKER_TYPE` target property. Depending on the value of the
-:variable:`CMAKE_<LANG>_USING_LINKER_MODE` variable,
+:variable:`CMAKE_<LANG>_LINK_MODE` variable,
``CMAKE_<LANG>_USING_LINKER_<TYPE>`` can hold compiler flags for the link step,
-or flags to be given directly to the linker tool.
+or the path to the linker tool.
+
+.. versionchanged:: 4.0
+
+The type of information stored in this variable is now determined by the
+:variable:`CMAKE_<LANG>_LINK_MODE` variable instead of the
+:variable:`CMAKE_<LANG>_USING_LINKER_MODE` variable.
.. note::
@@ -19,21 +25,25 @@ For example, the ``LLD`` linker for ``GNU`` compilers is defined like so:
.. code-block:: cmake
+ # CMAKE_C_LINK_MODE holds value "DRIVER"
set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld")
-On the ``Windows`` platform with ``Clang`` compilers simulating ``MSVC``:
+On the ``Windows`` platform with ``Clang`` compilers simulating ``MSVC`` with
+``GNU`` front-end:
.. code-block:: cmake
+ # CMAKE_C_LINK_MODE holds value "DRIVER"
set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld-link")
-And for the ``MSVC`` compiler, the linker is invoked directly, not via the
-compiler frontend:
+And for the ``MSVC`` compiler or ``Clang`` compilers simulating ``MSVC`` with
+``MSVC`` front-end, the linker is invoked directly, not via the compiler
+front-end:
.. code-block:: cmake
+ # CMAKE_C_LINK_MODE holds value "LINKER"
set(CMAKE_C_USING_LINKER_LLD "/path/to/lld-link.exe")
- set(CMAKE_C_USING_LINKER_MODE TOOL)
A custom linker type can also be defined, usually in a toolchain file:
@@ -41,4 +51,3 @@ A custom linker type can also be defined, usually in a toolchain file:
set(CMAKE_LINKER_TYPE lld_launcher)
set(CMAKE_C_USING_LINKER_lld_launcher "-fuse-ld=/path/to/lld-launcher.sh")
- set(CMAKE_C_USING_LINKER_MODE FLAG)
diff --git a/Help/variable/CMAKE_LINK_WARNING_AS_ERROR.rst b/Help/variable/CMAKE_LINK_WARNING_AS_ERROR.rst
new file mode 100644
index 0000000..6e754ef
--- /dev/null
+++ b/Help/variable/CMAKE_LINK_WARNING_AS_ERROR.rst
@@ -0,0 +1,9 @@
+CMAKE_LINK_WARNING_AS_ERROR
+---------------------------
+
+.. versionadded:: 4.0
+
+Specify whether to treat warnings on link as errors.
+
+This variable is used to initialize the
+:prop_tgt:`LINK_WARNING_AS_ERROR` property on all the targets.
diff --git a/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst b/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst
index e626641..382b4db 100644
--- a/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst
+++ b/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst
@@ -3,7 +3,8 @@ CMAKE_LINK_WHAT_YOU_USE_CHECK
.. versionadded:: 3.22
-Defines the command executed after the link step to check libraries usage.
+Command executed by :prop_tgt:`LINK_WHAT_YOU_USE` after the linker to
+check for unnecessarily-linked shared libraries.
This check is currently only defined on ``ELF`` platforms with value
``ldd -u -r``.
diff --git a/Help/variable/CMAKE_LIST_FILE_NAME.rst b/Help/variable/CMAKE_LIST_FILE_NAME.rst
new file mode 100644
index 0000000..bed189b
--- /dev/null
+++ b/Help/variable/CMAKE_LIST_FILE_NAME.rst
@@ -0,0 +1,23 @@
+CMAKE_LIST_FILE_NAME
+--------------------
+
+.. versionadded:: 4.0
+
+The name of the CMake project files. This determines the top-level file
+processed when CMake is configured, and the file processed by
+:command:`add_subdirectory`.
+
+By default, this is ``CMakeLists.txt``. If set to anything else,
+``CMakeLists.txt`` will be used as a fallback whenever the specified file
+cannot be found within a project subdirectory.
+
+This variable reports the value set via the :option:`cmake --project-file`
+option. The value of this variable should never be set directly by projects or
+users.
+
+.. warning::
+
+ The use of alternate project file names is intended for temporary use by
+ developers during an incremental transition and not for publication of a final
+ product. CMake will always emit a warning when the project file is anything
+ other than ``CMakeLists.txt``.
diff --git a/Help/variable/CMAKE_MODULE_LINKER_FLAGS.rst b/Help/variable/CMAKE_MODULE_LINKER_FLAGS.rst
index 6372bbd..eed6b65 100644
--- a/Help/variable/CMAKE_MODULE_LINKER_FLAGS.rst
+++ b/Help/variable/CMAKE_MODULE_LINKER_FLAGS.rst
@@ -4,3 +4,5 @@ CMAKE_MODULE_LINKER_FLAGS
Linker flags to be used to create modules.
These flags will be used by the linker when creating a module.
+
+.. include:: ../variable/LINKER_FLAGS.txt
diff --git a/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst
index 393263e..fd0769c 100644
--- a/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst
+++ b/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst
@@ -4,3 +4,5 @@ CMAKE_MODULE_LINKER_FLAGS_<CONFIG>
Flags to be used when linking a module.
Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating modules.
+
+.. include:: ../variable/LINKER_FLAGS.txt
diff --git a/Help/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.rst b/Help/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.rst
index 80df8fc..84c2584 100644
--- a/Help/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.rst
+++ b/Help/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.rst
@@ -21,7 +21,7 @@ support per-configuration specification. For example, the code:
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>")
selects for all following targets the program database debug information format
-for the Debug configuration.
+for the ``Debug`` and ``RelWithDebInfo`` configurations.
If this variable is not set, the :prop_tgt:`MSVC_DEBUG_INFORMATION_FORMAT`
target property will not be set automatically. If that property is not set,
diff --git a/Help/variable/CMAKE_MSVC_RUNTIME_CHECKS.rst b/Help/variable/CMAKE_MSVC_RUNTIME_CHECKS.rst
new file mode 100644
index 0000000..5ba8547
--- /dev/null
+++ b/Help/variable/CMAKE_MSVC_RUNTIME_CHECKS.rst
@@ -0,0 +1,36 @@
+CMAKE_MSVC_RUNTIME_CHECKS
+-------------------------
+
+.. versionadded:: 4.0
+
+Select the list of enabled runtime checks when targeting the MSVC ABI.
+This variable is used to initialize the
+:prop_tgt:`MSVC_RUNTIME_CHECKS` property on all targets as they are
+created. It is also propagated by calls to the :command:`try_compile` command
+into the test project.
+
+The allowed values are:
+
+.. include:: ../prop_tgt/MSVC_RUNTIME_CHECKS-VALUES.txt
+
+Use :manual:`generator expressions <cmake-generator-expressions(7)>` to
+support per-configuration specification. For example, the code:
+
+.. code-block:: cmake
+
+ set(CMAKE_MSVC_RUNTIME_CHECKS "$<$<CONFIG:Debug,RelWithDebInfo>:PossibleDataLoss;UninitializedVariable>")
+
+enables for the target ``foo`` the possible data loss and uninitialized variables checks
+for the ``Debug`` and ``RelWithDebInfo`` configurations.
+
+If this variable is not set, the :prop_tgt:`MSVC_RUNTIME_CHECKS`
+target property will not be set automatically. If that property is not set,
+CMake selects runtime checks using the default value
+``$<$<CONFIG:Debug>:StackFrameErrorCheck;UninitializedVariable>``,
+if supported by the compiler, or empty value otherwise.
+
+.. note::
+
+ This variable has effect only when policy :policy:`CMP0184` is set to ``NEW``
+ prior to the first :command:`project` or :command:`enable_language` command
+ that enables a language using a compiler targeting the MSVC ABI.
diff --git a/Help/variable/CMAKE_OBJDUMP.rst b/Help/variable/CMAKE_OBJDUMP.rst
new file mode 100644
index 0000000..9a01beb
--- /dev/null
+++ b/Help/variable/CMAKE_OBJDUMP.rst
@@ -0,0 +1,16 @@
+CMAKE_OBJDUMP
+-------------
+
+Path to the ``objdump`` executable on the host system. This tool, typically
+part of the Binutils collection on Unix-like systems, provides information
+about compiled object files.
+
+This cache variable may be populated by CMake when project languages are
+enabled using the :command:`project` or :command:`enable_language` commands.
+
+See Also
+^^^^^^^^
+
+* The :command:`file(GET_RUNTIME_DEPENDENCIES)` command provides a more general
+ way to get information from runtime binaries.
+* The :variable:`CPACK_OBJDUMP_EXECUTABLE` variable.
diff --git a/Help/variable/CMAKE_OSX_SYSROOT.rst b/Help/variable/CMAKE_OSX_SYSROOT.rst
index db9fccd..4be343a 100644
--- a/Help/variable/CMAKE_OSX_SYSROOT.rst
+++ b/Help/variable/CMAKE_OSX_SYSROOT.rst
@@ -2,12 +2,30 @@ CMAKE_OSX_SYSROOT
-----------------
Specify the location or name of the macOS platform SDK to be used.
-CMake uses this value to compute the value of the ``-isysroot`` flag
-or equivalent and to help the ``find_*`` commands locate files in
-the SDK.
-If not set explicitly the value is initialized by the ``SDKROOT``
-environment variable, if set, and otherwise computed based on the
-:variable:`CMAKE_OSX_DEPLOYMENT_TARGET` or the host platform.
+If not set explicitly, the value is initialized by the ``SDKROOT``
+environment variable, if set. Otherwise, the value defaults to empty,
+and the compiler is expected to choose a default macOS SDK on its own.
+
+.. versionchanged:: 4.0
+ The default is now empty. Previously a default was computed based on
+ the :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` or the host platform.
+
+In order to pass an explicit macOS SDK via the compiler's ``-isysroot`` flag,
+users may configure their build tree with ``-DCMAKE_OSX_SYSROOT=macosx``,
+or ``export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"`` in their
+environment.
+
+Notes:
+
+* macOS compilers in ``/usr/bin``, when not invoked with ``-isysroot``,
+ search for headers in ``/usr/local/include`` before system SDK paths,
+ matching the convention on many platforms. Users on macOS-x86_64 hosts
+ with Homebrew installed in ``/usr/local`` should pass an explicit SDK,
+ as described above, when not building with Homebrew tools.
+
+* Some Clang compilers have no default macOS SDK selection. For these,
+ if :variable:`CMAKE_OSX_SYSROOT` is empty, CMake will automatically pass
+ ``-isysroot`` with the macOS SDK printed by ``xcrun --show-sdk-path``.
.. include:: CMAKE_OSX_VARIABLE.txt
diff --git a/Help/variable/CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED.rst b/Help/variable/CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED.rst
new file mode 100644
index 0000000..febd5a3
--- /dev/null
+++ b/Help/variable/CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED.rst
@@ -0,0 +1,9 @@
+CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED
+------------------------------------
+
+.. versionadded:: 4.0
+
+Enable / Disable the default "uninstalled" search behavior of the
+:command:`cmake_pkg_config` command. When this variable is false, package files
+with an "-uninstalled" suffix have higher priority than exact package name
+matches.
diff --git a/Help/variable/CMAKE_PKG_CONFIG_PC_LIB_DIRS.rst b/Help/variable/CMAKE_PKG_CONFIG_PC_LIB_DIRS.rst
new file mode 100644
index 0000000..20576fb
--- /dev/null
+++ b/Help/variable/CMAKE_PKG_CONFIG_PC_LIB_DIRS.rst
@@ -0,0 +1,8 @@
+CMAKE_PKG_CONFIG_PC_LIB_DIRS
+----------------------------
+
+.. versionadded:: 4.0
+
+:ref:`Semicolon-separated list <CMake Language Lists>` of primary paths which
+the :command:`cmake_pkg_config` command will search for package files by
+default. Also used to derive the ``pc_path`` package variable.
diff --git a/Help/variable/CMAKE_PKG_CONFIG_PC_PATH.rst b/Help/variable/CMAKE_PKG_CONFIG_PC_PATH.rst
new file mode 100644
index 0000000..8e57b03
--- /dev/null
+++ b/Help/variable/CMAKE_PKG_CONFIG_PC_PATH.rst
@@ -0,0 +1,8 @@
+CMAKE_PKG_CONFIG_PC_PATH
+------------------------
+
+.. versionadded:: 4.0
+
+:ref:`Semicolon-separated list <CMake Language Lists>` of supplementary paths
+which the :command:`cmake_pkg_config` command will search for package files by
+default. Also used to derive the ``pc_path`` package variable.
diff --git a/Help/variable/CMAKE_PKG_CONFIG_SYSROOT_DIR.rst b/Help/variable/CMAKE_PKG_CONFIG_SYSROOT_DIR.rst
new file mode 100644
index 0000000..e303ecd
--- /dev/null
+++ b/Help/variable/CMAKE_PKG_CONFIG_SYSROOT_DIR.rst
@@ -0,0 +1,8 @@
+CMAKE_PKG_CONFIG_SYSROOT_DIR
+----------------------------
+
+.. versionadded:: 4.0
+
+Path prepended to ``-I`` include directories and ``-L`` library directories
+extracted by the :command:`cmake_pkg_config` command by default. Also used to
+derive the ``pc_sysrootdir`` package variable.
diff --git a/Help/variable/CMAKE_PKG_CONFIG_TOP_BUILD_DIR.rst b/Help/variable/CMAKE_PKG_CONFIG_TOP_BUILD_DIR.rst
new file mode 100644
index 0000000..a343c94
--- /dev/null
+++ b/Help/variable/CMAKE_PKG_CONFIG_TOP_BUILD_DIR.rst
@@ -0,0 +1,7 @@
+CMAKE_PKG_CONFIG_TOP_BUILD_DIR
+------------------------------
+
+.. versionadded:: 4.0
+
+Path used to derive the ``pc_top_builddir`` package variable by the
+:command:`cmake_pkg_config` command by default.
diff --git a/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst
index d643fb8..5f47d4e 100644
--- a/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst
@@ -22,3 +22,6 @@ not itself been updated:
* Projects may set this variable before a call to :command:`add_subdirectory`
that adds a third-party project in order to set its policies without
modifying third-party code.
+
+See :variable:`CMAKE_POLICY_VERSION_MINIMUM` set policies to ``NEW``
+based on the version of CMake that introduced them.
diff --git a/Help/variable/CMAKE_POLICY_VERSION_MINIMUM.rst b/Help/variable/CMAKE_POLICY_VERSION_MINIMUM.rst
new file mode 100644
index 0000000..d1fa143
--- /dev/null
+++ b/Help/variable/CMAKE_POLICY_VERSION_MINIMUM.rst
@@ -0,0 +1,27 @@
+CMAKE_POLICY_VERSION_MINIMUM
+----------------------------
+
+.. versionadded:: 4.0
+
+Specify a minimum :ref:`Policy Version` for a project without modifying
+its calls to :command:`cmake_minimum_required(VERSION)` and
+:command:`cmake_policy(VERSION)`.
+
+This variable should not be set by a project in CMake code as a way to
+set its own policy version. Use :command:`cmake_minimum_required(VERSION)`
+and/or :command:`cmake_policy(VERSION)` for that. This variable is meant
+to externally set policies for which a project has not itself been updated:
+
+* Users running CMake may set this variable in the cache, e.g.,
+ ``-DCMAKE_POLICY_VERSION_MINIMUM=3.5``, to try configuring a project
+ that has not been updated to set at least that policy version itself.
+
+ Alternatively, users may set the :envvar:`CMAKE_POLICY_VERSION_MINIMUM`
+ environment variable to initialize the cache entry in new build trees
+ automatically.
+
+* Projects may set this variable before a call to :command:`add_subdirectory`
+ that adds a third-party project in order to set its policy version without
+ modifying third-party code.
+
+See :variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` to set individual policies.
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index 59fa0be..3a9605f 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -6,16 +6,16 @@ has not been set explicitly by :command:`cmake_policy` or implicitly
by :command:`cmake_minimum_required`. This is meaningful
only for the policies that do not warn by default:
-* ``CMAKE_POLICY_WARNING_CMP0025`` controls the warning for
- policy :policy:`CMP0025`.
-* ``CMAKE_POLICY_WARNING_CMP0047`` controls the warning for
- policy :policy:`CMP0047`.
-* ``CMAKE_POLICY_WARNING_CMP0056`` controls the warning for
- policy :policy:`CMP0056`.
-* ``CMAKE_POLICY_WARNING_CMP0060`` controls the warning for
- policy :policy:`CMP0060`.
-* ``CMAKE_POLICY_WARNING_CMP0065`` controls the warning for
- policy :policy:`CMP0065`.
+* ``CMAKE_POLICY_WARNING_CMP0025`` controlled the warning for
+ policy :policy:`CMP0025` in CMake versions before 4.0.
+* ``CMAKE_POLICY_WARNING_CMP0047`` controlled the warning for
+ policy :policy:`CMP0047` in CMake versions before 4.0.
+* ``CMAKE_POLICY_WARNING_CMP0056`` controlled the warning for
+ policy :policy:`CMP0056` in CMake versions before 4.0.
+* ``CMAKE_POLICY_WARNING_CMP0060`` controlled the warning for
+ policy :policy:`CMP0060` in CMake versions before 4.0.
+* ``CMAKE_POLICY_WARNING_CMP0065`` controlled the warning for
+ policy :policy:`CMP0065` in CMake versions before 4.0.
* ``CMAKE_POLICY_WARNING_CMP0066`` controls the warning for
policy :policy:`CMP0066`.
* ``CMAKE_POLICY_WARNING_CMP0067`` controls the warning for
diff --git a/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst b/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst
index b010317..f83246a 100644
--- a/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst
+++ b/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst
@@ -4,6 +4,6 @@ CMAKE_POSITION_INDEPENDENT_CODE
Default value for :prop_tgt:`POSITION_INDEPENDENT_CODE` of targets.
This variable is used to initialize the
-:prop_tgt:`POSITION_INDEPENDENT_CODE` property on all the targets.
-See that target property for additional information. If set, its
-value is also used by the :command:`try_compile` command.
+:prop_tgt:`POSITION_INDEPENDENT_CODE` property on targets that
+are not ``SHARED`` or ``MODULE`` library targets.
+If set, its value is also used by the :command:`try_compile` command.
diff --git a/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst b/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst
index 313fb4e..d90a175 100644
--- a/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst
+++ b/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst
@@ -7,3 +7,8 @@ processed.
When run in :option:`cmake -P` script mode, CMake sets this variable to
the full path of the script file. When run to configure a ``CMakeLists.txt``
file, this variable is not set.
+
+See Also
+^^^^^^^^
+
+* The :prop_gbl:`CMAKE_ROLE` global property provides the current running mode.
diff --git a/Help/variable/CMAKE_SHARED_LINKER_FLAGS.rst b/Help/variable/CMAKE_SHARED_LINKER_FLAGS.rst
index fce950c..45748ff 100644
--- a/Help/variable/CMAKE_SHARED_LINKER_FLAGS.rst
+++ b/Help/variable/CMAKE_SHARED_LINKER_FLAGS.rst
@@ -4,3 +4,5 @@ CMAKE_SHARED_LINKER_FLAGS
Linker flags to be used to create shared libraries.
These flags will be used by the linker when creating a shared library.
+
+.. include:: ../variable/LINKER_FLAGS.txt
diff --git a/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst
index 4bf87a0..b968820 100644
--- a/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst
+++ b/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst
@@ -5,3 +5,5 @@ Flags to be used when linking a shared library.
Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating shared
libraries.
+
+.. include:: ../variable/LINKER_FLAGS.txt
diff --git a/Help/variable/CMAKE_UNITY_BUILD_RELOCATABLE.rst b/Help/variable/CMAKE_UNITY_BUILD_RELOCATABLE.rst
new file mode 100644
index 0000000..09bc5cc
--- /dev/null
+++ b/Help/variable/CMAKE_UNITY_BUILD_RELOCATABLE.rst
@@ -0,0 +1,9 @@
+CMAKE_UNITY_BUILD_RELOCATABLE
+-----------------------------
+
+.. versionadded:: 4.0
+
+This variable is used to initialize the :prop_tgt:`UNITY_BUILD_RELOCATABLE`
+property of targets when they are created. Setting it to true causes
+sources generated for :variable:`CMAKE_UNITY_BUILD` to ``#include`` the
+original source files using relative paths where possible.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION.rst b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION.rst
index ce5c4b3..b01a4d9 100644
--- a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION.rst
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION.rst
@@ -3,7 +3,7 @@ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
.. versionadded:: 3.25
-Property value for ``Metal: API Validation`` in the Options section of
+Populate ``Metal: API Validation`` in the Options section of
the generated Xcode scheme.
This variable initializes the
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
index 3a3c847..669f710 100644
--- a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
@@ -3,9 +3,9 @@ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
.. versionadded:: 3.23
-Property value for ``GPU Frame Capture`` in the Options section of
-the generated Xcode scheme. Example values are `Metal` and
-`Disabled`.
+Populate ``GPU Frame Capture`` in the Options section of
+the generated Xcode scheme. Example values are ``Metal`` and
+``Disabled``.
This variable initializes the
:prop_tgt:`XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE`
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION.rst b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION.rst
index 073a6c9..6647bc0 100644
--- a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION.rst
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION.rst
@@ -3,7 +3,7 @@ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
.. versionadded:: 3.25
-Property value for ``Metal: Shader Validation`` in the Options section of
+Populate ``Metal: Shader Validation`` in the Options section of
the generated Xcode scheme.
This variable initializes the
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst b/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst
index c15b1ea..ae75678 100644
--- a/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst
+++ b/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst
@@ -3,7 +3,7 @@ CMAKE_XCODE_SCHEME_LAUNCH_MODE
.. versionadded:: 3.25
-Property value for ``Launch`` in the Info section of the generated Xcode
+Populate ``Launch`` in the Info section of the generated Xcode
scheme.
This variable initializes the :prop_tgt:`XCODE_SCHEME_LAUNCH_MODE` property on
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_LLDB_INIT_FILE.rst b/Help/variable/CMAKE_XCODE_SCHEME_LLDB_INIT_FILE.rst
new file mode 100644
index 0000000..7e143c6
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_LLDB_INIT_FILE.rst
@@ -0,0 +1,13 @@
+CMAKE_XCODE_SCHEME_LLDB_INIT_FILE
+---------------------------------
+
+.. versionadded:: 4.0
+
+Populate ``LLDB Init File`` in the Info section of the generated Xcode
+scheme.
+
+This variable initializes the :prop_tgt:`XCODE_SCHEME_LLDB_INIT_FILE` property
+on all targets.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION.rst b/Help/variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION.rst
new file mode 100644
index 0000000..3610780
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_TEST_CONFIGURATION
+-------------------------------------
+
+.. versionadded:: 4.0
+
+Set the build configuration for testing targets.
+
+This variable initializes the :prop_tgt:`XCODE_SCHEME_TEST_CONFIGURATION`
+property on all targets.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst b/Help/variable/CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst
index 01fb189..4bfee33 100644
--- a/Help/variable/CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst
+++ b/Help/variable/CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS.rst
@@ -9,5 +9,5 @@ This variable serves the same purpose during packaging as the
:variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable
serves during installation (e.g. ``make install``).
-If `include(CPack)` is used then by default this variable is set to the content
+If ``include(CPack)`` is used then by default this variable is set to the content
of :variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS`.
diff --git a/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst b/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst
index f423e2e..15be951 100644
--- a/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst
+++ b/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst
@@ -7,7 +7,7 @@ Each CPack generator has a default value (like ``/usr``). This default
value may be overwritten from the ``CMakeLists.txt`` or the :manual:`cpack(1)`
command line by setting an alternative value. Example:
-::
+.. code-block:: cmake
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")
diff --git a/Help/variable/CPACK_SET_DESTDIR.rst b/Help/variable/CPACK_SET_DESTDIR.rst
index 27fd355..76060b1 100644
--- a/Help/variable/CPACK_SET_DESTDIR.rst
+++ b/Help/variable/CPACK_SET_DESTDIR.rst
@@ -9,7 +9,7 @@ basic relocation mechanism that should not be used on Windows (see
:variable:`CMAKE_INSTALL_PREFIX` documentation). It is usually invoked like
this:
-::
+.. code-block:: sh
make DESTDIR=/home/john install
diff --git a/Help/variable/CTEST_EXTRA_SUBMIT_FILES.rst b/Help/variable/CTEST_EXTRA_SUBMIT_FILES.rst
new file mode 100644
index 0000000..21f801f
--- /dev/null
+++ b/Help/variable/CTEST_EXTRA_SUBMIT_FILES.rst
@@ -0,0 +1,5 @@
+CTEST_EXTRA_SUBMIT_FILES
+------------------------
+
+Specify files for :command:`ctest_submit(PARTS ExtraFiles)` to submit
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Help/variable/CTEST_NOTES_FILES.rst b/Help/variable/CTEST_NOTES_FILES.rst
new file mode 100644
index 0000000..301b78a
--- /dev/null
+++ b/Help/variable/CTEST_NOTES_FILES.rst
@@ -0,0 +1,5 @@
+CTEST_NOTES_FILES
+-----------------
+
+Specify files for :command:`ctest_submit(PARTS Notes)` to submit
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Help/variable/CTEST_RUN_CURRENT_SCRIPT.rst b/Help/variable/CTEST_RUN_CURRENT_SCRIPT.rst
index 8cb6eaa..616324e 100644
--- a/Help/variable/CTEST_RUN_CURRENT_SCRIPT.rst
+++ b/Help/variable/CTEST_RUN_CURRENT_SCRIPT.rst
@@ -1,7 +1,5 @@
CTEST_RUN_CURRENT_SCRIPT
------------------------
-.. versionadded:: 3.11
-
-Setting this to 0 prevents :manual:`ctest(1)` from being run again when it
-reaches the end of a script run by calling :option:`ctest -S`.
+Removed. This variable once supported an undocumented feature that has since
+been removed.
diff --git a/Help/variable/LINKER_FLAGS.txt b/Help/variable/LINKER_FLAGS.txt
new file mode 100644
index 0000000..7b0630a
--- /dev/null
+++ b/Help/variable/LINKER_FLAGS.txt
@@ -0,0 +1,5 @@
+
+.. include:: ../command/LINK_LIBRARIES_LINKER.txt
+
+This support implies to parse and re-quote the content of the variable. See
+policy :policy:`CMP0181`.
diff --git a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt
index 9158631..75fe0e6 100644
--- a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt
+++ b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt
@@ -5,8 +5,10 @@
:prop_tgt:`LINK_LIBRARY_OVERRIDE_<LIBRARY>` target properties.
``WHOLE_ARCHIVE``
- Force inclusion of all members of a static library. This feature is only
- supported for the following platforms, with limitations as noted:
+ Force inclusion of all members of a static library when linked as a
+ dependency of consuming :ref:`Executables`, :ref:`Shared Libraries`,
+ and :ref:`Module Libraries`. This feature is only supported for the
+ following platforms, with limitations as noted:
* Linux.
* All BSD variants.
@@ -21,6 +23,14 @@
* Cygwin.
* MSYS.
+ .. note::
+
+ Since :ref:`Static Libraries` are archives and not linked binaries,
+ CMake records their link dependencies for transitive use when linking
+ consuming binaries. Therefore ``WHOLE_ARCHIVE`` does not cause a
+ static library's objects to be included in other static libraries.
+ Use :ref:`Object Libraries` for that.
+
``FRAMEWORK``
This option tells the linker to search for the specified framework using
the ``-framework`` linker option. It can only be used on Apple platforms,
@@ -44,9 +54,9 @@
File paths must conform to one of the following patterns (``*`` is a
wildcard, and optional parts are shown as ``[...]``):
- * ``[/path/to/]FwName[.framework]``
- * ``[/path/to/]FwName.framework/FwName[suffix]``
- * ``[/path/to/]FwName.framework/Versions/*/FwName[suffix]``
+ * ``[/path/to/]FwName[.framework]``
+ * ``[/path/to/]FwName.framework/FwName[suffix]``
+ * ``[/path/to/]FwName.framework/Versions/*/FwName[suffix]``
Note that CMake recognizes and automatically handles framework targets,
even without using the :genex:`$<LINK_LIBRARY:FRAMEWORK,...>` expression.
diff --git a/Help/variable/MSVC_TOOLSET_VERSION.rst b/Help/variable/MSVC_TOOLSET_VERSION.rst
index 59479af..84a6f33 100644
--- a/Help/variable/MSVC_TOOLSET_VERSION.rst
+++ b/Help/variable/MSVC_TOOLSET_VERSION.rst
@@ -7,17 +7,24 @@ The toolset version of Microsoft Visual C/C++ being used if any.
If MSVC-like is being used, this variable is set based on the version
of the compiler as given by the :variable:`MSVC_VERSION` variable.
-Known toolset version numbers are::
+Known toolset version numbers are:
- 80 = VS 2005 (8.0)
- 90 = VS 2008 (9.0)
- 100 = VS 2010 (10.0)
- 110 = VS 2012 (11.0)
- 120 = VS 2013 (12.0)
- 140 = VS 2015 (14.0)
- 141 = VS 2017 (15.0)
- 142 = VS 2019 (16.0)
- 143 = VS 2022 (17.0)
+.. table::
+ :align: left
+
+ ===== ==============
+ Value Version
+ ===== ==============
+ 80 VS 2005 (8.0)
+ 90 VS 2008 (9.0)
+ 100 VS 2010 (10.0)
+ 110 VS 2012 (11.0)
+ 120 VS 2013 (12.0)
+ 140 VS 2015 (14.0)
+ 141 VS 2017 (15.0)
+ 142 VS 2019 (16.0)
+ 143 VS 2022 (17.0)
+ ===== ==============
Compiler versions newer than those known to CMake will be reported
as the latest known toolset version.
diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst
index 400217b..4d87a03 100644
--- a/Help/variable/MSVC_VERSION.rst
+++ b/Help/variable/MSVC_VERSION.rst
@@ -6,20 +6,27 @@ If a compiler simulating Visual C++ is being used, this variable is set
to the toolset version simulated as given by the ``_MSC_VER``
preprocessor definition.
-Known version numbers are::
+Known version numbers are:
- 1200 = VS 6.0
- 1300 = VS 7.0
- 1310 = VS 7.1
- 1400 = VS 8.0 (v80 toolset)
- 1500 = VS 9.0 (v90 toolset)
- 1600 = VS 10.0 (v100 toolset)
- 1700 = VS 11.0 (v110 toolset)
- 1800 = VS 12.0 (v120 toolset)
- 1900 = VS 14.0 (v140 toolset)
- 1910-1919 = VS 15.0 (v141 toolset)
- 1920-1929 = VS 16.0 (v142 toolset)
- 1930-1949 = VS 17.0 (v143 toolset)
+.. table::
+ :align: left
+
+ ========= ==============
+ Value Version
+ ========= ==============
+ 1200 VS 6.0
+ 1300 VS 7.0
+ 1310 VS 7.1
+ 1400 VS 8.0 (v80 toolset)
+ 1500 VS 9.0 (v90 toolset)
+ 1600 VS 10.0 (v100 toolset)
+ 1700 VS 11.0 (v110 toolset)
+ 1800 VS 12.0 (v120 toolset)
+ 1900 VS 14.0 (v140 toolset)
+ 1910-1919 VS 15.0 (v141 toolset)
+ 1920-1929 VS 16.0 (v142 toolset)
+ 1930-1949 VS 17.0 (v143 toolset)
+ ========= ==============
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` and
:variable:`MSVC_TOOLSET_VERSION` variable.
diff --git a/LICENSE.rst b/LICENSE.rst
new file mode 100644
index 0000000..782e365
--- /dev/null
+++ b/LICENSE.rst
@@ -0,0 +1,28 @@
+Copyright 2000-2025 Kitware, Inc. and `Contributors <CONTRIBUTORS.rst>`_
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+* Neither the name of Kitware, Inc. nor the names of 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 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake
index 13b2600..13828f2 100644
--- a/Modules/AddFileDependencies.cmake
+++ b/Modules/AddFileDependencies.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
AddFileDependencies
diff --git a/Modules/AndroidTestUtilities.cmake b/Modules/AndroidTestUtilities.cmake
index 319710b..e8c8ee6 100644
--- a/Modules/AndroidTestUtilities.cmake
+++ b/Modules/AndroidTestUtilities.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[======================================================================[.rst:
AndroidTestUtilities
diff --git a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
index fccff67..f6389d6 100644
--- a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
+++ b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This function handles pushing all of the test files needed to the device.
# It places the data files in the object store and makes links to them from
@@ -82,7 +82,7 @@ function(android_push_test_files_to_device)
# dev_object_store : absolute path to the device object store directory.
# link_origin : absolute path to the origin of the link to the dev obj store data file.
function(push_and_link data_path dev_object_store link_origin)
- FILE(SHA1 ${data_path} hash_val)
+ file(SHA1 ${data_path} hash_val)
set(obj_store_dst ${dev_object_store}/${hash_val})
check_device_file_exists(${obj_store_dst} obj_store_file_exists)
# TODO: Verify that the object store file is indeed hashed correctly. Could use md5.
@@ -95,7 +95,7 @@ function(android_push_test_files_to_device)
endif()
foreach(ex ${arg_no_link_regex})
filename_regex(${data_path} ${ex})
- LIST(APPEND match_ex ${filename_match})
+ list(APPEND match_ex ${filename_match})
endforeach()
if(match_ex)
execute_adb_command(shell cp ${obj_store_dst} ${link_origin})
@@ -109,38 +109,38 @@ function(android_push_test_files_to_device)
#----------------------------------------------------------------------------
set(oneValueArgs FILES_DEST LIBS_DEST DEV_TEST_DIR DEV_OBJ_STORE)
set(multiValueArgs FILES LIBS)
- cmake_parse_arguments(_ptd "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_arg "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Setup of object store and test dir.
- check_device_file_exists(${_ptd_DEV_OBJ_STORE} dev_obj_store_exists)
+ check_device_file_exists(${_arg_DEV_OBJ_STORE} dev_obj_store_exists)
if(NOT dev_obj_store_exists)
- execute_adb_command(shell mkdir -p ${_ptd_DEV_OBJ_STORE})
+ execute_adb_command(shell mkdir -p ${_arg_DEV_OBJ_STORE})
endif()
- check_device_file_exists(${_ptd_DEV_TEST_DIR} test_dir_exists)
+ check_device_file_exists(${_arg_DEV_TEST_DIR} test_dir_exists)
if(test_dir_exists)
# This is protected in the SetupProjectTests module.
- execute_adb_command(shell rm -r ${_ptd_DEV_TEST_DIR})
+ execute_adb_command(shell rm -r ${_arg_DEV_TEST_DIR})
endif()
- execute_adb_command(shell mkdir -p ${_ptd_DEV_TEST_DIR})
+ execute_adb_command(shell mkdir -p ${_arg_DEV_TEST_DIR})
# Looping over the various types of test data possible.
foreach(TYPE ${multiValueArgs})
- if(_ptd_${TYPE})
+ if(_arg_${TYPE})
# determine if the data type destination has been explicitly specified.
- if(_ptd_${TYPE}_DEST)
- set(dest ${_ptd_${TYPE}_DEST})
+ if(_arg_${TYPE}_DEST)
+ set(dest ${_arg_${TYPE}_DEST})
else()
if(${TYPE} STREQUAL LIBS)
- set(dest ${_ptd_DEV_TEST_DIR}/lib)
+ set(dest ${_arg_DEV_TEST_DIR}/lib)
else()
- set(dest ${_ptd_DEV_TEST_DIR})
+ set(dest ${_arg_DEV_TEST_DIR})
endif()
endif()
execute_adb_command(shell mkdir -p ${dest})
# Loop over the files passed in
- foreach(relative_path ${_ptd_${TYPE}})
+ foreach(relative_path ${_arg_${TYPE}})
# The absolute path can be through the source directory or the build directory.
# If the file/dir exists in the build directory that version is chosen.
set_absolute_path(${relative_path} absolute_path)
@@ -154,9 +154,9 @@ function(android_push_test_files_to_device)
execute_adb_command(shell mkdir -p ${on_dev_dir})
if(IS_SYMLINK ${absolute_path})
get_filename_component(real_data_origin ${absolute_path} REALPATH)
- push_and_link(${real_data_origin} ${_ptd_DEV_OBJ_STORE} ${cur_dest})
+ push_and_link(${real_data_origin} ${_arg_DEV_OBJ_STORE} ${cur_dest})
else()
- push_and_link(${absolute_path} ${_ptd_DEV_OBJ_STORE} ${cur_dest})
+ push_and_link(${absolute_path} ${_arg_DEV_OBJ_STORE} ${cur_dest})
endif()
else() # LIBS
execute_adb_command(push ${absolute_path} ${dest})
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 5307901..1189e92 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
BundleUtilities
@@ -10,226 +10,250 @@ Functions to help assemble a standalone bundle application.
A collection of CMake utility functions useful for dealing with ``.app``
bundles on the Mac and bundle-like directories on any OS.
+.. note::
+
+ Do not use these functions at configure time (from ``CMakeLists.txt``).
+ Instead, invoke them from an :command:`install(CODE)` or
+ :command:`install(SCRIPT)`.
+
+Functions
+^^^^^^^^^
+
The following functions are provided by this module:
-.. code-block:: cmake
+.. command:: fixup_bundle
+
+ .. code-block:: cmake
+
+ fixup_bundle(<app> <libs> <dirs> [IGNORE_ITEM <file>...])
+
+ Fix up ``<app>`` bundle in-place and make it standalone, such that it can be
+ drag-n-drop copied to another machine and run on that machine as long
+ as all of the system libraries are compatible.
+
+ If you pass plugins to ``fixup_bundle`` as the libs parameter, you should
+ install them or copy them into the bundle before calling ``fixup_bundle``.
+ The ``<libs>`` parameter is a list of libraries that must be fixed up, but
+ that cannot be determined by ``otool`` output analysis (i.e. ``plugins``).
+
+ Gather all the keys for all the executables and libraries in a bundle,
+ and then, for each key, copy each prerequisite into the bundle. Then
+ fix each one up according to its own list of prerequisites.
+
+ Then clear all the keys and call ``verify_app`` on the final bundle to
+ ensure that it is truly standalone.
+
+ .. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be
+ passed, which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``).
+
+.. command:: copy_and_fixup_bundle
- fixup_bundle
- copy_and_fixup_bundle
- verify_app
- get_bundle_main_executable
- get_dotapp_dir
- get_bundle_and_executable
- get_bundle_all_executables
- get_item_key
- get_item_rpaths
- clear_bundle_keys
- set_bundle_key_values
- get_bundle_keys
- copy_resolved_item_into_bundle
- copy_resolved_framework_into_bundle
- fixup_bundle_item
- verify_bundle_prerequisites
- verify_bundle_symlinks
+ .. code-block:: cmake
-Requires CMake 2.6 or greater because it uses function, break and
-``PARENT_SCOPE``. Also depends on ``GetPrerequisites.cmake``.
+ copy_and_fixup_bundle(<src> <dst> <libs> <dirs>)
-DO NOT USE THESE FUNCTIONS AT CONFIGURE TIME (from ``CMakeLists.txt``)!
-Instead, invoke them from an :command:`install(CODE)` or
-:command:`install(SCRIPT)` rule.
+ Makes a copy of the bundle ``<src>`` at location ``<dst>`` and then fixes up
+ the new copied bundle in-place at ``<dst>``.
-.. code-block:: cmake
+.. command:: verify_app
- fixup_bundle(<app> <libs> <dirs>)
+ .. code-block:: cmake
-Fix up ``<app>`` bundle in-place and make it standalone, such that it can be
-drag-n-drop copied to another machine and run on that machine as long
-as all of the system libraries are compatible.
+ verify_app(<app> [IGNORE_ITEM <file>...])
-If you pass plugins to ``fixup_bundle`` as the libs parameter, you should
-install them or copy them into the bundle before calling ``fixup_bundle``.
-The ``<libs>`` parameter is a list of libraries that must be fixed up, but
-that cannot be determined by ``otool`` output analysis (i.e. ``plugins``).
+ Verifies that an application ``<app>`` appears valid based on running
+ analysis tools on it. Calls :command:`message(FATAL_ERROR)` if the
+ application is not verified.
-Gather all the keys for all the executables and libraries in a bundle,
-and then, for each key, copy each prerequisite into the bundle. Then
-fix each one up according to its own list of prerequisites.
+ .. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be
+ passed, which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
-Then clear all the keys and call ``verify_app`` on the final bundle to
-ensure that it is truly standalone.
+.. command:: get_bundle_main_executable
-.. versionadded:: 3.6
- As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
- which are then ignored
- (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``).
+ .. code-block:: cmake
-.. code-block:: cmake
+ get_bundle_main_executable(<bundle> <result_var>)
- copy_and_fixup_bundle(<src> <dst> <libs> <dirs>)
+ The result will be the full path name of the bundle's main executable
+ file or an ``error:`` prefixed string if it could not be determined.
-Makes a copy of the bundle ``<src>`` at location ``<dst>`` and then fixes up
-the new copied bundle in-place at ``<dst>``.
+.. command:: get_dotapp_dir
-.. code-block:: cmake
+ .. code-block:: cmake
- verify_app(<app>)
+ get_dotapp_dir(<exe> <dotapp_dir_var>)
-Verifies that an application ``<app>`` appears valid based on running
-analysis tools on it. Calls :command:`message(FATAL_ERROR)` if the application
-is not verified.
+ Returns the nearest parent dir whose name ends with ``.app`` given the
+ full path to an executable. If there is no such parent dir, then
+ simply return the dir containing the executable.
-.. versionadded:: 3.6
- As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
- which are then ignored
- (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+ The returned directory may or may not exist.
-.. code-block:: cmake
+.. command:: get_bundle_and_executable
- get_bundle_main_executable(<bundle> <result_var>)
+ .. code-block:: cmake
-The result will be the full path name of the bundle's main executable
-file or an ``error:`` prefixed string if it could not be determined.
+ get_bundle_and_executable(<app> <bundle_var> <executable_var> <valid_var>)
-.. code-block:: cmake
+ Takes either a ``.app`` directory name or the name of an executable
+ nested inside a ``.app`` directory and returns the path to the ``.app``
+ directory in ``<bundle_var>`` and the path to its main executable in
+ ``<executable_var>``.
- get_dotapp_dir(<exe> <dotapp_dir_var>)
+.. command:: get_bundle_all_executables
-Returns the nearest parent dir whose name ends with ``.app`` given the
-full path to an executable. If there is no such parent dir, then
-simply return the dir containing the executable.
+ .. code-block:: cmake
-The returned directory may or may not exist.
+ get_bundle_all_executables(<bundle> <exes_var>)
-.. code-block:: cmake
+ Scans ``<bundle>`` bundle recursively for all ``<exes_var>`` executable
+ files and accumulates them into a variable.
- get_bundle_and_executable(<app> <bundle_var> <executable_var> <valid_var>)
+.. command:: get_item_key
-Takes either a ``.app`` directory name or the name of an executable
-nested inside a ``.app`` directory and returns the path to the ``.app``
-directory in ``<bundle_var>`` and the path to its main executable in
-``<executable_var>``.
+ .. code-block:: cmake
-.. code-block:: cmake
+ get_item_key(<item> <key_var>)
- get_bundle_all_executables(<bundle> <exes_var>)
+ Given ``<item>`` file name, generate ``<key_var>`` key that should be unique
+ considering the set of libraries that need copying or fixing up to
+ make a bundle standalone. This is essentially the file name including
+ extension with ``.`` replaced by ``_``
-Scans ``<bundle>`` bundle recursively for all ``<exes_var>`` executable
-files and accumulates them into a variable.
+ This key is used as a prefix for CMake variables so that we can
+ associate a set of variables with a given item based on its key.
-.. code-block:: cmake
+.. command:: get_item_rpaths
- get_item_key(<item> <key_var>)
+ .. code-block:: cmake
-Given ``<item>`` file name, generate ``<key_var>`` key that should be unique
-considering the set of libraries that need copying or fixing up to
-make a bundle standalone. This is essentially the file name including
-extension with ``.`` replaced by ``_``
+ get_item_rpaths(<item> <rpaths_var>)
-This key is used as a prefix for CMake variables so that we can
-associate a set of variables with a given item based on its key.
+ Get RPATHS of the ``<item>`` file name and store them to the variable with
+ provided name ``<rpaths_var>``.
-.. code-block:: cmake
+.. command:: clear_bundle_keys
- clear_bundle_keys(<keys_var>)
+ .. code-block:: cmake
-Loop over the ``<keys_var>`` list of keys, clearing all the variables
-associated with each key. After the loop, clear the list of keys itself.
+ clear_bundle_keys(<keys_var>)
-Caller of ``get_bundle_keys`` should call ``clear_bundle_keys`` when done with
-list of keys.
+ Loop over the ``<keys_var>`` list of keys, clearing all the variables
+ associated with each key. After the loop, clear the list of keys itself.
-.. code-block:: cmake
+ Caller of ``get_bundle_keys`` should call ``clear_bundle_keys`` when done with
+ list of keys.
- set_bundle_key_values(<keys_var> <context> <item> <exepath> <dirs>
- <copyflag> [<rpaths>])
+.. command:: set_bundle_key_values
-Add ``<keys_var>`` key to the list (if necessary) for the given item.
-If added, also set all the variables associated with that key.
+ .. code-block:: cmake
-.. code-block:: cmake
+ set_bundle_key_values(<keys_var> <context> <item> <exepath> <dirs>
+ <copyflag> [<rpaths>])
- get_bundle_keys(<app> <libs> <dirs> <keys_var>)
+ Add ``<keys_var>`` key to the list (if necessary) for the given item.
+ If added, also set all the variables associated with that key.
-Loop over all the executable and library files within ``<app>`` bundle (and
-given as extra ``<libs>``) and accumulate a list of keys representing
-them. Set values associated with each key such that we can loop over
-all of them and copy prerequisite libs into the bundle and then do
-appropriate ``install_name_tool`` fixups.
+.. command:: get_bundle_keys
-.. versionadded:: 3.6
- As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
- which are then ignored
- (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+ .. code-block:: cmake
-.. code-block:: cmake
+ get_bundle_keys(<app> <libs> <dirs> <keys_var> [IGNORE_ITEM <file>...])
- copy_resolved_item_into_bundle(<resolved_item> <resolved_embedded_item>)
+ Loop over all the executable and library files within ``<app>`` bundle (and
+ given as extra ``<libs>``) and accumulate a list of keys representing
+ them. Set values associated with each key such that we can loop over
+ all of them and copy prerequisite libs into the bundle and then do
+ appropriate ``install_name_tool`` fixups.
-Copy a resolved item into the bundle if necessary.
-Copy is not necessary, if the ``<resolved_item>`` is "the same as" the
-``<resolved_embedded_item>``.
+ .. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be
+ passed, which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
-.. code-block:: cmake
+.. command:: copy_resolved_item_into_bundle
- copy_resolved_framework_into_bundle(<resolved_item> <resolved_embedded_item>)
+ .. code-block:: cmake
-Copy a resolved framework into the bundle if necessary.
-Copy is not necessary, if the ``<resolved_item>`` is "the same as" the
-``<resolved_embedded_item>``.
+ copy_resolved_item_into_bundle(<resolved_item> <resolved_embedded_item>)
-By default, ``BU_COPY_FULL_FRAMEWORK_CONTENTS`` is not set. If you want
-full frameworks embedded in your bundles, set
-``BU_COPY_FULL_FRAMEWORK_CONTENTS`` to ``ON`` before calling fixup_bundle. By
-default, ``COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE`` copies the framework
-dylib itself plus the framework ``Resources`` directory.
+ Copy a resolved item into the bundle if necessary.
+ Copy is not necessary, if the ``<resolved_item>`` is "the same as" the
+ ``<resolved_embedded_item>``.
-.. code-block:: cmake
+.. command:: copy_resolved_framework_into_bundle
- fixup_bundle_item(<resolved_embedded_item> <exepath> <dirs>)
+ .. code-block:: cmake
-Get the direct/non-system prerequisites of the ``<resolved_embedded_item>``.
-For each prerequisite, change the way it is referenced to the value of
-the ``_EMBEDDED_ITEM`` keyed variable for that prerequisite. (Most likely
-changing to an ``@executable_path`` style reference.)
+ copy_resolved_framework_into_bundle(<resolved_item> <resolved_embedded_item>)
-This function requires that the ``<resolved_embedded_item>`` be ``inside``
-the bundle already. In other words, if you pass plugins to ``fixup_bundle``
-as the libs parameter, you should install them or copy them into the
-bundle before calling ``fixup_bundle``. The ``libs`` parameter is a list of
-libraries that must be fixed up, but that cannot be determined by
-otool output analysis. (i.e., ``plugins``)
+ Copy a resolved framework into the bundle if necessary.
+ Copy is not necessary, if the ``<resolved_item>`` is "the same as" the
+ ``<resolved_embedded_item>``.
-Also, change the id of the item being fixed up to its own
-``_EMBEDDED_ITEM`` value.
+ By default, ``BU_COPY_FULL_FRAMEWORK_CONTENTS`` is not set. If you want
+ full frameworks embedded in your bundles, set
+ ``BU_COPY_FULL_FRAMEWORK_CONTENTS`` to ``ON`` before calling fixup_bundle. By
+ default, ``COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE`` copies the framework
+ dylib itself plus the framework ``Resources`` directory.
-Accumulate changes in a local variable and make *one* call to
-``install_name_tool`` at the end of the function with all the changes at
-once.
+.. command:: fixup_bundle_item
-If the ``BU_CHMOD_BUNDLE_ITEMS`` variable is set then bundle items will be
-marked writable before ``install_name_tool`` tries to change them.
+ .. code-block:: cmake
-.. code-block:: cmake
+ fixup_bundle_item(<resolved_embedded_item> <exepath> <dirs>)
- verify_bundle_prerequisites(<bundle> <result_var> <info_var>)
+ Get the direct/non-system prerequisites of the ``<resolved_embedded_item>``.
+ For each prerequisite, change the way it is referenced to the value of
+ the ``_EMBEDDED_ITEM`` keyed variable for that prerequisite. (Most likely
+ changing to an ``@executable_path`` style reference.)
-Verifies that the sum of all prerequisites of all files inside the
-bundle are contained within the bundle or are ``system`` libraries,
-presumed to exist everywhere.
+ This function requires that the ``<resolved_embedded_item>`` be ``inside``
+ the bundle already. In other words, if you pass plugins to ``fixup_bundle``
+ as the libs parameter, you should install them or copy them into the
+ bundle before calling ``fixup_bundle``. The ``libs`` parameter is a list of
+ libraries that must be fixed up, but that cannot be determined by
+ otool output analysis. (i.e., ``plugins``)
-.. versionadded:: 3.6
- As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
- which are then ignored
- (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+ Also, change the id of the item being fixed up to its own
+ ``_EMBEDDED_ITEM`` value.
-.. code-block:: cmake
+ Accumulate changes in a local variable and make *one* call to
+ ``install_name_tool`` at the end of the function with all the changes at
+ once.
- verify_bundle_symlinks(<bundle> <result_var> <info_var>)
+ If the ``BU_CHMOD_BUNDLE_ITEMS`` variable is set then bundle items will be
+ marked writable before ``install_name_tool`` tries to change them.
-Verifies that any symlinks found in the ``<bundle>`` bundle point to other files
-that are already also in the bundle... Anything that points to an
-external file causes this function to fail the verification.
+.. command:: verify_bundle_prerequisites
+
+ .. code-block:: cmake
+
+ verify_bundle_prerequisites(<bundle> <result_var> <info_var>
+ [IGNORE_ITEM <file>...])
+
+ Verifies that the sum of all prerequisites of all files inside the
+ bundle are contained within the bundle or are ``system`` libraries,
+ presumed to exist everywhere.
+
+ .. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be
+ passed, which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+
+.. command:: verify_bundle_symlinks
+
+ .. code-block:: cmake
+
+ verify_bundle_symlinks(<bundle> <result_var> <info_var>)
+
+ Verifies that any symlinks found in the ``<bundle>`` bundle point to other
+ files that are already also in the bundle... Anything that points to an
+ external file causes this function to fail the verification.
#]=======================================================================]
function(_warn_cmp0080)
@@ -247,9 +271,6 @@ if(DEFINED CMAKE_GENERATOR)
endif()
endif()
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
# The functions defined in this file depend on the get_prerequisites function
# (and possibly others) found in:
#
@@ -1127,5 +1148,3 @@ function(verify_app app)
message(FATAL_ERROR "error: verify_app failed")
endif()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/CMake.cmake b/Modules/CMake.cmake
index caa5479..62d2b37 100644
--- a/Modules/CMake.cmake
+++ b/Modules/CMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by cmake.cxx to compute the CMAKE_ROOT location.
diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake
index d1970a2..eee7a7d 100644
--- a/Modules/CMakeASM-ATTInformation.cmake
+++ b/Modules/CMakeASM-ATTInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for AT&T syntax assemblers, e.g. GNU as
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index 7030034..7530070 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(UNIX)
@@ -98,4 +98,4 @@ endif()
set(CMAKE_ASM${ASM_DIALECT}_USE_LINKER_INFORMATION TRUE)
-set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)
+set(CMAKE_ASM${ASM_DIALECT}_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeASM_MARMASMInformation.cmake b/Modules/CMakeASM_MARMASMInformation.cmake
index 51bd313..eed980c 100644
--- a/Modules/CMakeASM_MARMASMInformation.cmake
+++ b/Modules/CMakeASM_MARMASMInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for the MS ARM assembler, marmasm and marmasm64
@@ -11,12 +11,15 @@ set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
-# The ASM_MARMASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
+# The ASM_MARMASM compiler id for this compiler is "MSVC", so fill out the abstraction tables.
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
-
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded "-g")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue "")
diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake
index 64ae070..c3c9e7b 100644
--- a/Modules/CMakeASM_MASMInformation.cmake
+++ b/Modules/CMakeASM_MASMInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for the MS assembler, masm and masm64
@@ -11,12 +11,15 @@ set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c -Fo <OBJECT> <SOURCE>")
set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
-# The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
+# The ASM_MASM compiler id for this compiler is "MSVC", so fill out the abstraction tables.
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
-
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded "-Zi")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue "")
diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake
index 898b823..5ce4978 100644
--- a/Modules/CMakeASM_NASMInformation.cmake
+++ b/Modules/CMakeASM_NASMInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for the nasm assembler
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 69a8417..dca6d23 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeAddFortranSubdirectory
@@ -18,7 +18,7 @@ built into a dll, so :variable:`BUILD_SHARED_LIBS` is turned on in
the project. In addition the :variable:`CMAKE_GNUtoMS` option is set
to on, so that Microsoft ``.lib`` files are created. Usage is as follows:
-::
+.. code-block:: cmake
cmake_add_fortran_subdirectory(
<subdir> # name of subdirectory
diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt
index 011195c..a911289 100644
--- a/Modules/CMakeAddNewLanguage.txt
+++ b/Modules/CMakeAddNewLanguage.txt
@@ -30,7 +30,7 @@ CMake(LANG)Information.cmake => set compiler configuration:
CMAKE_(LANG)_USE_LINKER_INFORMATION
CMakeTest(LANG)Compiler.cmake -> test the compiler and set:
- SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "")
+ set(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "")
If the variable CMAKE_(LANG)_USE_LINKER_INFORMATION has value TRUE, the file CMake(LANG)LinkerInformation.cmake
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake
index 775a513..2076cf9 100644
--- a/Modules/CMakeBackwardCompatibilityC.cmake
+++ b/Modules/CMakeBackwardCompatibilityC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
@@ -15,24 +15,24 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
endif()
include (CheckTypeSize)
- CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
- CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
- CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
- CHECK_TYPE_SIZE(char CMAKE_SIZEOF_CHAR)
- CHECK_TYPE_SIZE(short CMAKE_SIZEOF_SHORT)
- CHECK_TYPE_SIZE(float CMAKE_SIZEOF_FLOAT)
- CHECK_TYPE_SIZE(double CMAKE_SIZEOF_DOUBLE)
+ check_type_size(int CMAKE_SIZEOF_INT)
+ check_type_size(long CMAKE_SIZEOF_LONG)
+ check_type_size("void*" CMAKE_SIZEOF_VOID_P)
+ check_type_size(char CMAKE_SIZEOF_CHAR)
+ check_type_size(short CMAKE_SIZEOF_SHORT)
+ check_type_size(float CMAKE_SIZEOF_FLOAT)
+ check_type_size(double CMAKE_SIZEOF_DOUBLE)
include (CheckIncludeFile)
- CHECK_INCLUDE_FILE("limits.h" CMAKE_HAVE_LIMITS_H)
- CHECK_INCLUDE_FILE("unistd.h" CMAKE_HAVE_UNISTD_H)
- CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ check_include_file("limits.h" CMAKE_HAVE_LIMITS_H)
+ check_include_file("unistd.h" CMAKE_HAVE_UNISTD_H)
+ check_include_file("pthread.h" CMAKE_HAVE_PTHREAD_H)
include (CheckIncludeFiles)
- CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SYS_PRCTL_H)
+ check_include_files("sys/types.h;sys/prctl.h" CMAKE_HAVE_SYS_PRCTL_H)
include (TestBigEndian)
- TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
+ test_big_endian(CMAKE_WORDS_BIGENDIAN)
include (FindX11)
if("${X11_X11_INCLUDE_PATH}" STREQUAL "/usr/include")
@@ -73,4 +73,3 @@ CMAKE_USE_WIN32_THREADS
CMAKE_X_CFLAGS
CMAKE_X_LIBS
)
-
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake
index 02744a9..e6b87f6 100644
--- a/Modules/CMakeBackwardCompatibilityCXX.cmake
+++ b/Modules/CMakeBackwardCompatibilityCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeBackwardCompatibilityCXX
@@ -46,4 +46,3 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
include(TestForSSTREAM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
endif()
-
diff --git a/Modules/CMakeBorlandFindMake.cmake b/Modules/CMakeBorlandFindMake.cmake
index 18b9962..e0ac0d1 100644
--- a/Modules/CMakeBorlandFindMake.cmake
+++ b/Modules/CMakeBorlandFindMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set (CMAKE_MAKE_PROGRAM "make" CACHE STRING
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 5642f99..01d2885 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -17,6 +17,7 @@ set(CMAKE_C23_COMPILE_FEATURES "@CMAKE_C23_COMPILE_FEATURES@")
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "@CMAKE_C_COMPILER_FRONTEND_VARIANT@")
+set(CMAKE_C_COMPILER_APPLE_SYSROOT "@CMAKE_C_COMPILER_APPLE_SYSROOT@")
set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
@_SET_CMAKE_C_COMPILER_ARCHITECTURE_ID@
@_SET_CMAKE_C_COMPILER_SYSROOT@
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 759cdf4..ae53f91 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -96,7 +96,7 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
-#ifdef COMPILER_VERSION_INTERNAL
+#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR)
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 977e51a..98b97de 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the C language in CMake.
diff --git a/Modules/CMakeCSharpInformation.cmake b/Modules/CMakeCSharpInformation.cmake
index f698bdf..6b7ab00 100644
--- a/Modules/CMakeCSharpInformation.cmake
+++ b/Modules/CMakeCSharpInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the C# language in CMake.
# It also loads the available platform file for the system-compiler
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index fa197b2..49a4270 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(UNIX)
set(CMAKE_CUDA_OUTPUT_EXTENSION .o)
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index b1de7fb..799c88c 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -19,6 +19,7 @@ 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@")
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "@CMAKE_CXX_COMPILER_FRONTEND_VARIANT@")
+set(CMAKE_CXX_COMPILER_APPLE_SYSROOT "@CMAKE_CXX_COMPILER_APPLE_SYSROOT@")
set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
@_SET_CMAKE_CXX_COMPILER_ARCHITECTURE_ID@
@_SET_CMAKE_CXX_COMPILER_SYSROOT@
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 1cd8006..5287e50 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -127,7 +127,7 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
-#ifdef COMPILER_VERSION_INTERNAL
+#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR)
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index cc130ae..99f7201 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the C++ language in CMake.
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index bda1d71..ef9f138 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Do NOT include this module directly into any of your code. It is meant as
@@ -19,14 +19,18 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
FAIL_REGEX "invalid argument .*option" # Intel
FAIL_REGEX "ignoring option .*argument required" # Intel
FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
+ # noqa: spellcheck off
FAIL_REGEX "[Uu]nknown option" # HP
+ # noqa: spellcheck on
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
FAIL_REGEX "command option .* contains an incorrect subargument" # XL
FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL
FAIL_REGEX "not supported in this configuration. ignored" # AIX
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
+ # noqa: spellcheck off
FAIL_REGEX "[Uu]nknown switch" # PGI
+ # noqa: spellcheck on
FAIL_REGEX "WARNING: unknown flag:" # Open64
FAIL_REGEX "Incorrect command line option:" # Borland
FAIL_REGEX "Warning: illegal option" # SunStudio 12
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index 4907a28..831dc4a 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# this file has flags that are shared across languages and sets
diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h
index 8c9ab8f..621e3f8 100644
--- a/Modules/CMakeCompilerABI.h
+++ b/Modules/CMakeCompilerABI.h
@@ -1,7 +1,7 @@
/* Size of a pointer-to-data in bytes. */
#define SIZEOF_DPTR (sizeof(void*))
-const char info_sizeof_dptr[] = {
+char const info_sizeof_dptr[] = {
/* clang-format off */
'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't',
'r', '[', ('0' + ((SIZEOF_DPTR / 10) % 10)), ('0' + (SIZEOF_DPTR % 10)), ']',
diff --git a/Modules/CMakeCompilerCUDAArch.h b/Modules/CMakeCompilerCUDAArch.h
index dcb030f..080c495 100644
--- a/Modules/CMakeCompilerCUDAArch.h
+++ b/Modules/CMakeCompilerCUDAArch.h
@@ -11,7 +11,7 @@ static bool cmakeCompilerCUDAArch()
}
bool found = false;
- const char* sep = "";
+ char const* sep = "";
for (int device = 0; device < count; ++device) {
cudaDeviceProp prop;
if (cudaGetDeviceProperties(&prop, device) == cudaSuccess) {
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 2817d37..dbbb65a 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(_readFile file)
diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake
index 9a3c940..acafd56 100644
--- a/Modules/CMakeDependentOption.cmake
+++ b/Modules/CMakeDependentOption.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeDependentOption
@@ -29,7 +29,14 @@ conditions are true.
``<depends>`` condition within the scope of the caller because it is a local
variable.
-Example invocation:
+.. versionadded:: 3.22
+
+ Full :ref:`Condition Syntax` is now supported. See policy :policy:`CMP0127`.
+
+Examples
+^^^^^^^^
+
+Semicolon-separated list of conditions:
.. code-block:: cmake
@@ -41,10 +48,18 @@ hides the option from the user. If the status of ``USE_BAR`` or ``USE_ZOT``
ever changes, any value for the ``USE_FOO`` option is saved so that when the
option is re-enabled it retains its old value.
-.. versionadded:: 3.22
+Full condition syntax:
- Full :ref:`Condition Syntax` is now supported. See policy :policy:`CMP0127`.
+.. code-block:: cmake
+
+ cmake_dependent_option(USE_FOO "Use Foo" ON "USE_A AND (USE_B OR USE_C)" OFF)
+Similar to the previous example, if the argument with full condition syntax
+evaluates to true, this provides an option called ``USE_FOO`` that defaults to
+ON. Otherwise, it sets ``USE_FOO`` to OFF and hides the option from the user in
+the GUI. When condition changes, option is saved in similar way as described
+above. This enables using entire condition syntax as being the ``if`` clause
+argument, such as grouping conditions with parens and similar.
#]=======================================================================]
macro(CMAKE_DEPENDENT_OPTION option doc default depends force)
diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake
index a2efb6a..9a3f7a0 100644
--- a/Modules/CMakeDetermineASM-ATTCompiler.cmake
+++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for ASM using AT&T syntax, e.g. GNU as
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 2042e64..9124285 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for ASM programs
@@ -130,6 +130,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_QCC "-V")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_QCC "gcc_nto")
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Tasking)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Tasking "--version")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Tasking "TASKING")
+
include(CMakeDetermineCompilerId)
set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
diff --git a/Modules/CMakeDetermineASM_MARMASMCompiler.cmake b/Modules/CMakeDetermineASM_MARMASMCompiler.cmake
index 26714dd..24fe11d 100644
--- a/Modules/CMakeDetermineASM_MARMASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_MARMASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Find the MS ARM assembler (marmasm or marmasm64)
diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake
index 80188fb..c90e181 100644
--- a/Modules/CMakeDetermineASM_MASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Find the MS assembler (masm or masm64)
diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake
index dd75310..f110efd 100644
--- a/Modules/CMakeDetermineASM_NASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 73b6cee..214bca1 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for C programs
diff --git a/Modules/CMakeDetermineCSharpCompiler.cmake b/Modules/CMakeDetermineCSharpCompiler.cmake
index 6506894..0528252 100644
--- a/Modules/CMakeDetermineCSharpCompiler.cmake
+++ b/Modules/CMakeDetermineCSharpCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio")
message(FATAL_ERROR
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 4f9fb49..47f7140 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 891ba6e..895f558 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for C++ programs
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index fc0b714..06e8bed 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
macro(_cmake_find_compiler lang)
@@ -82,34 +82,6 @@ macro(_cmake_find_compiler lang)
endif()
unset(_${lang}_COMPILER_HINTS)
unset(_languages)
-
- # Look for a make tool provided by Xcode
- if(CMAKE_HOST_APPLE)
- macro(_query_xcrun compiler_name result_var_keyword result_var)
- if(NOT "x${result_var_keyword}" STREQUAL "xRESULT_VAR")
- message(FATAL_ERROR "Bad arguments to macro")
- endif()
- execute_process(COMMAND xcrun --find ${compiler_name}
- OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _xcrun_err)
- set("${result_var}" "${_xcrun_out}")
- endmacro()
-
- set(xcrun_result)
- if (CMAKE_${lang}_COMPILER MATCHES "^/usr/bin/(.+)$")
- _query_xcrun("${CMAKE_MATCH_1}" RESULT_VAR xcrun_result)
- elseif (CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND")
- foreach(comp IN LISTS CMAKE_${lang}_COMPILER_LIST)
- _query_xcrun("${comp}" RESULT_VAR xcrun_result)
- if(xcrun_result)
- break()
- endif()
- endforeach()
- endif()
- if (xcrun_result)
- set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${xcrun_result}")
- endif()
- endif()
endmacro()
macro(_cmake_find_compiler_path lang)
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 4a75e25..acd372e 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Function to compile a source file to identify the compiler ABI.
@@ -52,14 +52,23 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
__TestCompiler_setTryCompileTargetType()
- # Avoid failing ABI detection on warnings.
+ # Avoid failing ABI detection caused by non-functionally relevant
+ # compiler arguments
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})
+ # Avoid failing ABI detection on warnings.
string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " ${v} "${${v}}")
+ # Avoid passing of "-pipe" when determining the compiler internals. With
+ # "-pipe" GCC will use pipes to pass data between the involved
+ # executables. This may lead to issues when their stderr output (which
+ # contains the relevant compiler internals) becomes interweaved.
+ string(REGEX REPLACE "(^| )-pipe( |$)" " " ${v} "${${v}}")
+ # Suppress any formatting of warnings and/or errors
+ string(REGEX REPLACE "(-f|/)diagnostics(-|:)color(=[a-z]+)?" "" ${v} "${${v}}")
endforeach()
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
@@ -247,6 +256,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
endif()
endif()
+ # Filter out implicit link directories excluded by our Platform/<os>* modules.
+ if(DEFINED CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES_EXCLUDE)
+ list(REMOVE_ITEM implicit_dirs ${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
+ endif()
+
+ # Filter out implicit link directories excluded by the environment.
if(DEFINED ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
list(REMOVE_ITEM implicit_dirs $ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
endif()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index e5dc8ea..85c9754 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
macro(__determine_compiler_id_test testflags_var userflags_var)
set(_CMAKE_${lang}_COMPILER_ID_LOG "")
@@ -32,7 +32,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS})
elseif(DEFINED ENV{${flagvar}})
set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}})
- else(CMAKE_${lang}_FLAGS_INIT)
+ else()
set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS_INIT})
endif()
separate_arguments(CMAKE_${lang}_COMPILER_ID_FLAGS_LIST NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
@@ -256,6 +256,46 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "")
endif()
+ if(CMAKE_EFFECTIVE_SYSTEM_NAME STREQUAL "Apple" AND CMAKE_${lang}_COMPILER_ID MATCHES "Clang$")
+ cmake_path(GET src EXTENSION LAST_ONLY ext)
+ set(apple_sdk_dir "${CMAKE_${lang}_COMPILER_ID_DIR}")
+ set(apple_sdk_src "apple-sdk${ext}")
+ file(WRITE "${apple_sdk_dir}/${apple_sdk_src}" "#include <AvailabilityMacros.h>\n")
+ set(apple_sdk_cmd
+ "${CMAKE_${lang}_COMPILER}"
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ -E ${apple_sdk_src}
+ )
+ execute_process(
+ COMMAND ${apple_sdk_cmd}
+ WORKING_DIRECTORY ${apple_sdk_dir}
+ OUTPUT_VARIABLE apple_sdk_out
+ ERROR_VARIABLE apple_sdk_out
+ RESULT_VARIABLE apple_sdk_res
+ )
+ string(JOIN "\" \"" apple_sdk_cmd ${apple_sdk_cmd})
+ if(apple_sdk_res EQUAL 0 AND apple_sdk_out MATCHES [["([^"]*)/usr/include/AvailabilityMacros\.h"]])
+ if(CMAKE_MATCH_1)
+ set(CMAKE_${lang}_COMPILER_APPLE_SYSROOT "${CMAKE_MATCH_1}")
+ else()
+ set(CMAKE_${lang}_COMPILER_APPLE_SYSROOT "/")
+ endif()
+ set(apple_sdk_msg "Found apple sysroot: ${CMAKE_${lang}_COMPILER_APPLE_SYSROOT}")
+ else()
+ set(CMAKE_${lang}_COMPILER_APPLE_SYSROOT "")
+ set(apple_sdk_msg "No apple sysroot found.")
+ endif()
+ string(REPLACE "\n" "\n " apple_sdk_out " ${apple_sdk_out}")
+ message(CONFIGURE_LOG
+ "Detecting ${lang} compiler apple sysroot: \"${apple_sdk_cmd}\"\n"
+ "${apple_sdk_out}\n"
+ "${apple_sdk_msg}"
+ )
+ else()
+ set(CMAKE_${lang}_COMPILER_APPLE_SYSROOT "")
+ endif()
+
set(_variant "")
if("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xClang"
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIntelLLVM")
@@ -281,6 +321,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xGNU"
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAppleClang"
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang"
+ OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIBMClang"
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xTIClang")
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU")
elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
@@ -391,6 +432,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
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)
+ set(CMAKE_${lang}_COMPILER_APPLE_SYSROOT "${CMAKE_${lang}_COMPILER_APPLE_SYSROOT}" PARENT_SCOPE)
endfunction()
include(CMakeCompilerIdDetection)
@@ -718,9 +760,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR
CMAKE_OSX_SYSROOT MATCHES "(^|/)[Xx][Rr]" OR
- CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]")
- set(id_product_type "com.apple.product-type.bundle.unit-test")
- elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]")
+ CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]" OR
+ CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]")
set(id_product_type "com.apple.product-type.framework")
endif()
else()
@@ -858,7 +899,9 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
string(APPEND _CMAKE_${lang}_COMPILER_ID_LOG "${MSG}")
endif()
- string(APPEND _CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG "${MSG}")
+ # Display in reverse order so that attempts with user flags
+ # won't be lost due to console limits / scrollback
+ string(PREPEND _CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG "${MSG}")
# Some languages may know the correct/desired set of flags and want to fail right away if they don't work.
# This is currently only used by CUDA.
@@ -1091,17 +1134,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# The offset to the PE signature is stored at 0x3c.
file(READ ${file} peoffsethex LIMIT 1 OFFSET 60 HEX)
if(NOT peoffsethex STREQUAL "")
- string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
- string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
- set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
- string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
- math(EXPR peoffset "${peoffsetexpression}")
-
+ math(EXPR peoffset "0x${peoffsethex}")
file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
if(peheader STREQUAL "50450000a201")
set(ARCHITECTURE_ID "SH3")
diff --git a/Modules/CMakeDetermineCompilerSupport.cmake b/Modules/CMakeDetermineCompilerSupport.cmake
index d561e7b..c22bf07 100644
--- a/Modules/CMakeDetermineCompilerSupport.cmake
+++ b/Modules/CMakeDetermineCompilerSupport.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(cmake_determine_compiler_support lang)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index f051163..e0f9bef 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for Fortran programs
diff --git a/Modules/CMakeDetermineHIPCompiler.cmake b/Modules/CMakeDetermineHIPCompiler.cmake
index d7a99b0..041302a 100644
--- a/Modules/CMakeDetermineHIPCompiler.cmake
+++ b/Modules/CMakeDetermineHIPCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
diff --git a/Modules/CMakeDetermineISPCCompiler.cmake b/Modules/CMakeDetermineISPCCompiler.cmake
index ff2bf20..9b7866c 100644
--- a/Modules/CMakeDetermineISPCCompiler.cmake
+++ b/Modules/CMakeDetermineISPCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for ISPC programs
diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake
index db456c0..b20a255 100644
--- a/Modules/CMakeDetermineJavaCompiler.cmake
+++ b/Modules/CMakeDetermineJavaCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for Java programs
diff --git a/Modules/CMakeDetermineOBJCCompiler.cmake b/Modules/CMakeDetermineOBJCCompiler.cmake
index 4b84c8a..280be74 100644
--- a/Modules/CMakeDetermineOBJCCompiler.cmake
+++ b/Modules/CMakeDetermineOBJCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for Objective-C programs
diff --git a/Modules/CMakeDetermineOBJCXXCompiler.cmake b/Modules/CMakeDetermineOBJCXXCompiler.cmake
index 7403847..24f9175 100644
--- a/Modules/CMakeDetermineOBJCXXCompiler.cmake
+++ b/Modules/CMakeDetermineOBJCXXCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for Objective-C++ programs
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake
index d22741b..354fef4 100644
--- a/Modules/CMakeDetermineRCCompiler.cmake
+++ b/Modules/CMakeDetermineRCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# determine the compiler to use for RC programs
diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake
index 7239424..a7dc150 100644
--- a/Modules/CMakeDetermineSwiftCompiler.cmake
+++ b/Modules/CMakeDetermineSwiftCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index b330ed9..dc26258 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is used by the Makefile generator to determine the following variables:
@@ -139,17 +139,24 @@ endif()
# variables around so they can be used in CMakeLists.txt.
# In all other cases, the host and target platform are the same.
if(CMAKE_TOOLCHAIN_FILE)
- # at first try to load it as path relative to the directory from which cmake has been run
- include("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
- if(NOT _INCLUDED_TOOLCHAIN_FILE)
- # if the file isn't found there, check the default locations
- include("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
- endif()
-
- if(_INCLUDED_TOOLCHAIN_FILE)
- set(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE)
+ if(IS_ABSOLUTE "${CMAKE_TOOLCHAIN_FILE}" AND EXISTS "${CMAKE_TOOLCHAIN_FILE}")
+ # Normalize the absolute path.
+ set(CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE)
+ set(CMAKE_TOOLCHAIN_FILE "$CACHE{CMAKE_TOOLCHAIN_FILE}")
+ include("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
else()
- message(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
+ # at first try to load it as path relative to the directory from which cmake has been run
+ include("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
+ if(NOT _INCLUDED_TOOLCHAIN_FILE)
+ # if the file isn't found there, check the default locations
+ include("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
+ endif()
+ if(_INCLUDED_TOOLCHAIN_FILE)
+ set(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE)
+ endif()
+ endif()
+ if(NOT _INCLUDED_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "Could not find toolchain file:\n \"${CMAKE_TOOLCHAIN_FILE}\"")
endif()
endif()
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index 0d360b5..b2dfd1d 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeDetermineVSServicePack
@@ -15,12 +15,14 @@ the compiler version number.
Determine the Visual Studio service pack of the 'cl' in use.
-Usage::
+Usage:
+
+.. code-block:: cmake
if(MSVC)
include(CMakeDetermineVSServicePack)
- DetermineVSServicePack( my_service_pack )
- if( my_service_pack )
+ DetermineVSServicePack(my_service_pack)
+ if(my_service_pack)
message(STATUS "Detected: ${my_service_pack}")
endif()
endif()
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index b8f471c..4fad7f6 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeExpandImportedTargets
@@ -20,7 +20,7 @@ behavior or use of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property
because :manual:`generator expressions <cmake-generator-expressions(7)>`
cannot be evaluated during configuration.
-::
+.. code-block:: cmake
CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
[CONFIGURATION <config>])
@@ -33,7 +33,7 @@ respective configuration of the imported targets if it exists. If no
CONFIGURATION is given, it uses the first configuration from
${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.
-::
+.. code-block:: cmake
cmake_expand_imported_targets(expandedLibs
LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake
index cafc830..af2d748 100644
--- a/Modules/CMakeExportBuildSettings.cmake
+++ b/Modules/CMakeExportBuildSettings.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is purposely no longer documented. It does nothing useful.
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 5d7d430..0b21e36 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included by CMakeFindEclipseCDT4.cmake and CMakeFindCodeBlocks.cmake
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 4efcd55..9a441ad 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# search for additional tools required for C/C++ (and other languages ?)
@@ -15,14 +15,12 @@
# CMAKE_RANLIB
# CMAKE_LINKER
# CMAKE_MT
+# CMAKE_OBJDUMP
# CMAKE_STRIP
# CMAKE_INSTALL_NAME_TOOL
# on UNIX, cygwin and mingw
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
# Resolve full path of CMAKE_TOOL from user-defined name and SEARCH_PATH.
function(__resolve_tool_path CMAKE_TOOL SEARCH_PATH DOCSTRING)
@@ -274,5 +272,3 @@ if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$")
set(CMAKE_IAR_LINKER "${CMAKE_LINKER}" CACHE FILEPATH "The IAR ILINK linker")
mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_AR)
endif()
-
-cmake_policy(POP)
diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake
index bf27ec1..fc769a1 100644
--- a/Modules/CMakeFindCodeBlocks.cmake
+++ b/Modules/CMakeFindCodeBlocks.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included in CMakeSystemSpecificInformation.cmake if
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
index 2c04abe..99624d2 100644
--- a/Modules/CMakeFindDependencyMacro.cmake
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeFindDependencyMacro
@@ -8,7 +8,9 @@ CMakeFindDependencyMacro
.. command:: find_dependency
The ``find_dependency()`` macro wraps a :command:`find_package` call for
- a package dependency::
+ a package dependency:
+
+ .. code-block:: cmake
find_dependency(<dep> [...])
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index e563a12..b980fa4 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included in CMakeSystemSpecificInformation.cmake if
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
index 46010f5..87ad38b 100644
--- a/Modules/CMakeFindFrameworks.cmake
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeFindFrameworks
diff --git a/Modules/CMakeFindJavaCommon.cmake b/Modules/CMakeFindJavaCommon.cmake
index c6e3348..95ca9b5 100644
--- a/Modules/CMakeFindJavaCommon.cmake
+++ b/Modules/CMakeFindJavaCommon.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Do not include this module directly from code outside CMake!
diff --git a/Modules/CMakeFindKate.cmake b/Modules/CMakeFindKate.cmake
index 521bc5c..a4bf2ed 100644
--- a/Modules/CMakeFindKate.cmake
+++ b/Modules/CMakeFindKate.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included in CMakeSystemSpecificInformation.cmake if
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index a6bbcc4..eaf1574 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeFindPackageMode
diff --git a/Modules/CMakeFindSublimeText2.cmake b/Modules/CMakeFindSublimeText2.cmake
index 7f67bf0..fc0ec31 100644
--- a/Modules/CMakeFindSublimeText2.cmake
+++ b/Modules/CMakeFindSublimeText2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included in CMakeSystemSpecificInformation.cmake if
diff --git a/Modules/CMakeFindWMake.cmake b/Modules/CMakeFindWMake.cmake
index a20d069..0e7a264 100644
--- a/Modules/CMakeFindWMake.cmake
+++ b/Modules/CMakeFindWMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING
diff --git a/Modules/CMakeFindXCode.cmake b/Modules/CMakeFindXCode.cmake
index 281af96..f2d11da 100644
--- a/Modules/CMakeFindXCode.cmake
+++ b/Modules/CMakeFindXCode.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Empty placeholder for input dependencies in existing
diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake
index 7048806..e85c3f9 100644
--- a/Modules/CMakeForceCompiler.cmake
+++ b/Modules/CMakeForceCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeForceCompiler
@@ -27,7 +27,7 @@ toolchain file instead.
Macro ``CMAKE_FORCE_C_COMPILER`` has the following signature:
-::
+.. code-block:: cmake
CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
@@ -39,7 +39,7 @@ compiler information tests.
Macro ``CMAKE_FORCE_CXX_COMPILER`` has the following signature:
-::
+.. code-block:: cmake
CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
@@ -51,7 +51,7 @@ compiler information tests.
Macro ``CMAKE_FORCE_Fortran_COMPILER`` has the following signature:
-::
+.. code-block:: cmake
CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
@@ -63,7 +63,7 @@ compiler information tests.
So a simple toolchain file could look like this:
-::
+.. code-block:: cmake
include (CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index a376e10..8d8ff20 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(CMakeLanguageInformation)
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 88e3bfa..ac5da58 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(CMakeInitializeConfigs)
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index 7086722..1d7dc0f 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeGraphVizOptions
diff --git a/Modules/CMakeHIPInformation.cmake b/Modules/CMakeHIPInformation.cmake
index c013df8..f015cdf 100644
--- a/Modules/CMakeHIPInformation.cmake
+++ b/Modules/CMakeHIPInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(UNIX)
set(CMAKE_HIP_OUTPUT_EXTENSION .o)
diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake
index b022217..78d2e0e 100644
--- a/Modules/CMakeIOSInstallCombined.cmake
+++ b/Modules/CMakeIOSInstallCombined.cmake
@@ -1,9 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Function to print messages of this module
function(_ios_install_combined_message)
@@ -60,9 +56,6 @@ endfunction()
# Get architectures of given SDK (iphonesimulator/iphoneos)
function(_ios_install_combined_get_valid_archs sdk resultvar)
- cmake_policy(PUSH)
- cmake_policy(SET CMP0007 NEW)
-
if("${resultvar}" STREQUAL "")
message(FATAL_ERROR "`resultvar` is empty")
endif()
@@ -77,8 +70,6 @@ function(_ios_install_combined_get_valid_archs sdk resultvar)
_ios_install_combined_message("Architectures (${sdk}): ${printable}")
set("${resultvar}" "${valid_archs}" PARENT_SCOPE)
-
- cmake_policy(POP)
endfunction()
# Make both arch lists a disjoint set by preferring the current SDK
@@ -325,5 +316,3 @@ function(ios_install_combined target destination)
_ios_install_combined_message("Install done: ${destination}")
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/CMakeISPCInformation.cmake b/Modules/CMakeISPCInformation.cmake
index 4a4b72a..8f86ae1 100644
--- a/Modules/CMakeISPCInformation.cmake
+++ b/Modules/CMakeISPCInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(UNIX)
set(CMAKE_ISPC_OUTPUT_EXTENSION .o)
diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake
index ec1effb..4dc16e1 100644
--- a/Modules/CMakeImportBuildSettings.cmake
+++ b/Modules/CMakeImportBuildSettings.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is purposely no longer documented. It does nothing useful.
diff --git a/Modules/CMakeInitializeConfigs.cmake b/Modules/CMakeInitializeConfigs.cmake
index 9dfe040..609f79e 100644
--- a/Modules/CMakeInitializeConfigs.cmake
+++ b/Modules/CMakeInitializeConfigs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
diff --git a/Modules/CMakeJOMFindMake.cmake b/Modules/CMakeJOMFindMake.cmake
index f56a588..3a98be4 100644
--- a/Modules/CMakeJOMFindMake.cmake
+++ b/Modules/CMakeJOMFindMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set (CMAKE_MAKE_PROGRAM "jom" CACHE STRING
diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake
index 0ca8395..a31955b 100644
--- a/Modules/CMakeJavaInformation.cmake
+++ b/Modules/CMakeJavaInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This should be included before the _INIT variables are
diff --git a/Modules/CMakeLanguageInformation.cmake b/Modules/CMakeLanguageInformation.cmake
index 674ab86..84a513b 100644
--- a/Modules/CMakeLanguageInformation.cmake
+++ b/Modules/CMakeLanguageInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file contains common code blocks used by all the language information
diff --git a/Modules/CMakeMSYSFindMake.cmake b/Modules/CMakeMSYSFindMake.cmake
index 96fdb37..a186c5b 100644
--- a/Modules/CMakeMSYSFindMake.cmake
+++ b/Modules/CMakeMSYSFindMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
find_program(CMAKE_MAKE_PROGRAM make
diff --git a/Modules/CMakeMinGWFindMake.cmake b/Modules/CMakeMinGWFindMake.cmake
index f026e9a..cb2edad 100644
--- a/Modules/CMakeMinGWFindMake.cmake
+++ b/Modules/CMakeMinGWFindMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
find_program(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS
diff --git a/Modules/CMakeNMakeFindMake.cmake b/Modules/CMakeNMakeFindMake.cmake
index 0335744..38051a7 100644
--- a/Modules/CMakeNMakeFindMake.cmake
+++ b/Modules/CMakeNMakeFindMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set (CMAKE_MAKE_PROGRAM "nmake" CACHE STRING
diff --git a/Modules/CMakeNinjaFindMake.cmake b/Modules/CMakeNinjaFindMake.cmake
index 32f78da..0dfd7e4 100644
--- a/Modules/CMakeNinjaFindMake.cmake
+++ b/Modules/CMakeNinjaFindMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
find_program(CMAKE_MAKE_PROGRAM
diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in
index 23175b2..fd453e3 100644
--- a/Modules/CMakeOBJCCompiler.cmake.in
+++ b/Modules/CMakeOBJCCompiler.cmake.in
@@ -17,6 +17,7 @@ set(CMAKE_OBJC23_COMPILE_FEATURES "@CMAKE_OBJC23_COMPILE_FEATURES@")
set(CMAKE_OBJC_PLATFORM_ID "@CMAKE_OBJC_PLATFORM_ID@")
set(CMAKE_OBJC_SIMULATE_ID "@CMAKE_OBJC_SIMULATE_ID@")
set(CMAKE_OBJC_COMPILER_FRONTEND_VARIANT "@CMAKE_OBJC_COMPILER_FRONTEND_VARIANT@")
+set(CMAKE_OBJC_COMPILER_APPLE_SYSROOT "@CMAKE_OBJC_COMPILER_APPLE_SYSROOT@")
set(CMAKE_OBJC_SIMULATE_VERSION "@CMAKE_OBJC_SIMULATE_VERSION@")
@_SET_CMAKE_OBJC_COMPILER_ARCHITECTURE_ID@
@SET_CMAKE_XCODE_ARCHS@
diff --git a/Modules/CMakeOBJCCompilerId.m.in b/Modules/CMakeOBJCCompilerId.m.in
index e88bb6f..3c8a82a 100644
--- a/Modules/CMakeOBJCCompilerId.m.in
+++ b/Modules/CMakeOBJCCompilerId.m.in
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
-#ifdef COMPILER_VERSION_INTERNAL
+#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR)
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
diff --git a/Modules/CMakeOBJCInformation.cmake b/Modules/CMakeOBJCInformation.cmake
index 56e8239..bac6673 100644
--- a/Modules/CMakeOBJCInformation.cmake
+++ b/Modules/CMakeOBJCInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the Objective-C language in CMake.
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index a374acd..393eb87 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -18,6 +18,7 @@ set(CMAKE_OBJCXX23_COMPILE_FEATURES "@CMAKE_OBJCXX23_COMPILE_FEATURES@")
set(CMAKE_OBJCXX_PLATFORM_ID "@CMAKE_OBJCXX_PLATFORM_ID@")
set(CMAKE_OBJCXX_SIMULATE_ID "@CMAKE_OBJCXX_SIMULATE_ID@")
set(CMAKE_OBJCXX_COMPILER_FRONTEND_VARIANT "@CMAKE_OBJCXX_COMPILER_FRONTEND_VARIANT@")
+set(CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT "@CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT@")
set(CMAKE_OBJCXX_SIMULATE_VERSION "@CMAKE_OBJCXX_SIMULATE_VERSION@")
@_SET_CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID@
@SET_CMAKE_XCODE_ARCHS@
diff --git a/Modules/CMakeOBJCXXCompilerId.mm.in b/Modules/CMakeOBJCXXCompilerId.mm.in
index cadbaff..f417844 100644
--- a/Modules/CMakeOBJCXXCompilerId.mm.in
+++ b/Modules/CMakeOBJCXXCompilerId.mm.in
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
-#ifdef COMPILER_VERSION_INTERNAL
+#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR)
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
diff --git a/Modules/CMakeOBJCXXInformation.cmake b/Modules/CMakeOBJCXXInformation.cmake
index a242dab..8a7a42c 100644
--- a/Modules/CMakeOBJCXXInformation.cmake
+++ b/Modules/CMakeOBJCXXInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the Objective-C++ language in CMake.
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 6e74efd..ba03080 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakePackageConfigHelpers
@@ -13,7 +13,9 @@ Generating a Package Configuration File
.. command:: configure_package_config_file
- Create a config file for a project::
+ Create a config file for a project:
+
+ .. code-block:: cmake
configure_package_config_file(<input> <output>
INSTALL_DESTINATION <path>
@@ -132,7 +134,9 @@ Generating a Package Version File
.. command:: write_basic_package_version_file
- Create a version file for a project::
+ Create a version file for a project:
+
+ .. code-block:: cmake
write_basic_package_version_file(<filename>
[VERSION <major.minor.patch>]
@@ -394,6 +398,7 @@ Example using both the :command:`configure_package_config_file` and
set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
check_required_components(Foo)
+
#]=======================================================================]
include(WriteBasicConfigVersionFile)
diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake
index c753b7f..0d9c373 100644
--- a/Modules/CMakeParseArguments.cmake
+++ b/Modules/CMakeParseArguments.cmake
@@ -1,10 +1,12 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeParseArguments
-------------------
+.. deprecated:: 3.5
+
This module once implemented the :command:`cmake_parse_arguments` command
that is now implemented natively by CMake. It is now an empty placeholder
for compatibility with projects that include it to get the command from
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
index 1ebd887..a6d1335 100644
--- a/Modules/CMakeParseImplicitIncludeInfo.cmake
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This is used internally by CMake and should not be included by user code.
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index d9ecbd8..d9f6bad 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -1,9 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-cmake_policy(PUSH)
-cmake_policy(SET CMP0053 NEW)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Function to parse implicit linker options.
#
@@ -61,7 +57,7 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
endif()
endif()
# Parse implicit linker arguments.
- set(linker "ld[0-9]*(\\.[a-z]+)?")
+ set(linker "ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)")
if(is_lfortran_less_0_40)
# lfortran < 0.40 has no way to pass -v to clang/gcc driver.
string(APPEND linker "|clang|gcc")
@@ -401,5 +397,3 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${implicit_objs}" PARENT_SCOPE)
endif()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/CMakeParseLibraryArchitecture.cmake b/Modules/CMakeParseLibraryArchitecture.cmake
index f7a4b29..7a8557e 100644
--- a/Modules/CMakeParseLibraryArchitecture.cmake
+++ b/Modules/CMakeParseLibraryArchitecture.cmake
@@ -1,9 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-cmake_policy(PUSH)
-cmake_policy(SET CMP0053 NEW)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Function parse implicit linker options.
# This is used internally by CMake and should not be included by user
@@ -50,5 +46,3 @@ function(cmake_parse_library_architecture lang implicit_dirs implicit_objs outpu
set(${output_var} "${library_arch}" PARENT_SCOPE)
endif()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 0d92412..24c8567 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -258,7 +258,7 @@
# elif defined(__CMCS__)
# define ARCHITECTURE_ID "MCS"
-# elif defined(__CARM__)
+# elif defined(__CARM__) || defined(__CPARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__CARC__)
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index fb201dc..98555aa 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakePrintHelpers
@@ -8,40 +8,69 @@ CMakePrintHelpers
Convenience functions for printing properties and variables, useful
e.g. for debugging.
-::
+Commands
+^^^^^^^^
- cmake_print_properties(<TARGETS [<target1> ...] |
- SOURCES [<source1> ...] |
- DIRECTORIES [<dir1> ...] |
- TESTS [<test1> ...] |
- CACHE_ENTRIES [<entry1> ...] >
- PROPERTIES [<prop1> ...] )
+.. command:: cmake_print_properties
-This function prints the values of the properties of the given targets,
-source files, directories, tests or cache entries. Exactly one of the
-scope keywords must be used. The scope keyword and its arguments must
-come before the ``PROPERTIES`` keyword, in the arguments list.
+ .. code-block:: cmake
-Example::
+ cmake_print_properties(<TARGETS [<target1> ...] |
+ SOURCES [<source1> ...] |
+ DIRECTORIES [<dir1> ...] |
+ TESTS [<test1> ...] |
+ CACHE_ENTRIES [<entry1> ...] >
+ PROPERTIES [<prop1> ...])
- cmake_print_properties(TARGETS foo bar PROPERTIES
- LOCATION INTERFACE_INCLUDE_DIRECTORIES)
+ This function prints the values of the properties of the given targets,
+ source files, directories, tests or cache entries. Exactly one of the
+ scope keywords must be used. The scope keyword and its arguments must
+ come before the ``PROPERTIES`` keyword in the arguments list.
-This will print the LOCATION and INTERFACE_INCLUDE_DIRECTORIES properties for
-both targets foo and bar.
+.. command:: cmake_print_variables
-::
+ .. code-block:: cmake
- cmake_print_variables(var1 var2 .. varN)
+ cmake_print_variables([var1 [var2 ... [varN]]])
-This function will print the name of each variable followed by its value.
-Example::
+ This function prints the name of each variable followed by its value.
- cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST)
+Examples
+^^^^^^^^
+
+Printing the ``LOCATION`` and ``INTERFACE_INCLUDE_DIRECTORIES`` properties for
+both targets ``foo`` and ``bar``:
+
+.. code-block:: cmake
+
+ include(CMakePrintHelpers)
+
+ cmake_print_properties(
+ TARGETS foo bar
+ PROPERTIES LOCATION INTERFACE_INCLUDE_DIRECTORIES
+ )
+
+Gives::
+
+ --
+ Properties for TARGET foo:
+ foo.LOCATION = "/usr/lib/libfoo.so"
+ foo.INTERFACE_INCLUDE_DIRECTORIES = "/usr/include;/usr/include/foo"
+ Properties for TARGET bar:
+ bar.LOCATION = "/usr/lib/libbar.so"
+ bar.INTERFACE_INCLUDE_DIRECTORIES = "/usr/include;/usr/include/bar"
+
+Printing given variables:
+
+.. code-block:: cmake
+
+ include(CMakePrintHelpers)
+
+ cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION NOT_EXISTS)
Gives::
- -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST=""
+ -- CMAKE_C_COMPILER="/usr/bin/cc" ; CMAKE_MAJOR_VERSION="3" ; NOT_EXISTS=""
#]=======================================================================]
function(cmake_print_variables)
diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake
index d44e933..45ad38e 100644
--- a/Modules/CMakePrintSystemInformation.cmake
+++ b/Modules/CMakePrintSystemInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakePrintSystemInformation
diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake
index 50bd90b..a179670 100644
--- a/Modules/CMakePushCheckState.cmake
+++ b/Modules/CMakePushCheckState.cmake
@@ -1,42 +1,138 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include_guard(GLOBAL)
#[=======================================================================[.rst:
CMakePushCheckState
-------------------
+This module provides macros for managing the state of variables that influence
+how various CMake check commands (e.g., ``check_symbol_exists()``, etc.) are
+performed. These macros save, reset, and restore the following variables:
+
+* ``CMAKE_REQUIRED_FLAGS``
+* ``CMAKE_REQUIRED_DEFINITIONS``
+* ``CMAKE_REQUIRED_INCLUDES``
+* ``CMAKE_REQUIRED_LINK_OPTIONS``
+* ``CMAKE_REQUIRED_LIBRARIES``
+* ``CMAKE_REQUIRED_LINK_DIRECTORIES``
+* ``CMAKE_REQUIRED_QUIET``
+* ``CMAKE_EXTRA_INCLUDE_FILES``
+
+Macros
+^^^^^^
+
+.. command:: cmake_push_check_state
+
+ Saves (pushes) the current states of the above variables onto a stack. This
+ is typically used to preserve the current configuration before making
+ temporary modifications for specific checks.
+
+ .. code-block:: cmake
+
+ cmake_push_check_state([RESET])
+
+ ``RESET``
+ When this option is specified, the macro not only saves the current states
+ of the listed variables but also resets them to empty, allowing them to be
+ reconfigured from a clean state.
+
+.. command:: cmake_reset_check_state
+
+ Resets (clears) the contents of the variables listed above to empty states.
+
+ .. code-block:: cmake
+
+ cmake_reset_check_state()
+
+ This macro can be used, for example, when performing multiple sequential
+ checks that require entirely new configurations, ensuring no previous
+ configuration unintentionally carries over.
+
+.. command:: cmake_pop_check_state
+
+ Restores the states of the variables listed above to their values at the time
+ of the most recent ``cmake_push_check_state()`` call.
+
+ .. code-block:: cmake
+
+ cmake_pop_check_state()
+ This macro is used to revert temporary changes made during a check. To
+ prevent unexpected behavior, pair each ``cmake_push_check_state()`` with a
+ corresponding ``cmake_pop_check_state()``.
-This module defines three macros: ``CMAKE_PUSH_CHECK_STATE()``
-``CMAKE_POP_CHECK_STATE()`` and ``CMAKE_RESET_CHECK_STATE()`` These macros can
-be used to save, restore and reset (i.e., clear contents) the state of
-the variables ``CMAKE_REQUIRED_FLAGS``, ``CMAKE_REQUIRED_DEFINITIONS``,
-``CMAKE_REQUIRED_LINK_OPTIONS``, ``CMAKE_REQUIRED_LIBRARIES``,
-``CMAKE_REQUIRED_LINK_DIRECTORIES``,
-``CMAKE_REQUIRED_INCLUDES`` and ``CMAKE_EXTRA_INCLUDE_FILES`` used by the
-various Check-files coming with CMake, like e.g. ``check_function_exists()``
-etc.
-The variable contents are pushed on a stack, pushing multiple times is
-supported. This is useful e.g. when executing such tests in a Find-module,
-where they have to be set, but after the Find-module has been executed they
-should have the same value as they had before.
+These macros are useful for scoped configuration, for example, in
+:ref:`Find modules <Find Modules>` or when performing checks in a controlled
+environment, ensuring that temporary modifications are isolated to the scope of
+the check and do not propagate into other parts of the build system.
-``CMAKE_PUSH_CHECK_STATE()`` macro receives optional argument ``RESET``.
-Whether it's specified, ``CMAKE_PUSH_CHECK_STATE()`` will set all
-``CMAKE_REQUIRED_*`` variables to empty values, same as
-``CMAKE_RESET_CHECK_STATE()`` call will do.
+.. note::
-Usage:
+ Other CMake variables, such as ``CMAKE_<LANG>_FLAGS``, propagate to all checks
+ regardless of these macros, as those fundamental variables are designed to
+ influence the global state of the build system.
+
+Examples
+^^^^^^^^
.. code-block:: cmake
- cmake_push_check_state(RESET)
- set(CMAKE_REQUIRED_DEFINITIONS -DSOME_MORE_DEF)
- check_function_exists(...)
- cmake_reset_check_state()
- set(CMAKE_REQUIRED_DEFINITIONS -DANOTHER_DEF)
- check_function_exists(...)
- cmake_pop_check_state()
+ include(CMakePushCheckState)
+
+ # Save and reset the current state
+ cmake_push_check_state(RESET)
+
+ # Perform check with specific compile definitions
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+ include(CheckSymbolExists)
+ check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
+
+ # Restore the original state
+ cmake_pop_check_state()
+
+Variable states can be pushed onto the stack multiple times, allowing for nested
+or sequential configurations. Each ``cmake_pop_check_state()`` restores the
+most recent pushed states.
+
+.. code-block:: cmake
+
+ include(CMakePushCheckState)
+
+ # Save and reset the current state
+ cmake_push_check_state(RESET)
+
+ # Perform the first check with additional libraries
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
+ include(CheckSymbolExists)
+ check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN)
+
+ # Save current state
+ cmake_push_check_state()
+
+ # Perform the second check with libraries and additional compile definitions
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+ check_symbol_exists(dladdr "dlfcn.h" HAVE_DLADDR)
+
+ message(STATUS "${CMAKE_REQUIRED_DEFINITIONS}")
+ # Output: -D_GNU_SOURCE
+
+ # Restore the previous state
+ cmake_pop_check_state()
+
+ message(STATUS "${CMAKE_REQUIRED_DEFINITIONS}")
+ # Output here is empty
+
+ # Reset variables to prepare for the next check
+ cmake_reset_check_state()
+
+ # Perform the next check only with additional compile definitions
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+ check_symbol_exists(dl_iterate_phdr "link.h" HAVE_DL_ITERATE_PHDR)
+
+ # Restore the original state
+ cmake_pop_check_state()
#]=======================================================================]
macro(CMAKE_RESET_CHECK_STATE)
diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake
index d716469..cd991a0 100644
--- a/Modules/CMakeRCInformation.cmake
+++ b/Modules/CMakeRCInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the Windows Resource Compiler.
diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in
index b385190..9210880 100644
--- a/Modules/CMakeSwiftCompiler.cmake.in
+++ b/Modules/CMakeSwiftCompiler.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set(CMAKE_Swift_COMPILER "@CMAKE_Swift_COMPILER@")
set(CMAKE_Swift_COMPILER_ID "@CMAKE_Swift_COMPILER_ID@")
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 904a528..63ffcc3 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(UNIX)
set(CMAKE_Swift_OUTPUT_EXTENSION .o)
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index 70bcf5c..bb1a4bd 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included by cmGlobalGenerator::EnableLanguage.
diff --git a/Modules/CMakeSystemSpecificInitialize.cmake b/Modules/CMakeSystemSpecificInitialize.cmake
index ee8cb86..13f1eff 100644
--- a/Modules/CMakeSystemSpecificInitialize.cmake
+++ b/Modules/CMakeSystemSpecificInitialize.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is included by cmGlobalGenerator::EnableLanguage.
@@ -17,6 +17,7 @@ unset(MSYS)
unset(WIN32)
unset(BSD)
unset(LINUX)
+unset(AIX)
# The CMAKE_EFFECTIVE_SYSTEM_NAME is used to load compiler and compiler
# wrapper configuration files. By default it equals to CMAKE_SYSTEM_NAME
diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake
index df735c4..53f5034 100644
--- a/Modules/CMakeTestASM-ATTCompiler.cmake
+++ b/Modules/CMakeTestASM-ATTCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake
index 7f0b9a7..329cb25 100644
--- a/Modules/CMakeTestASMCompiler.cmake
+++ b/Modules/CMakeTestASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestASM_MARMASMCompiler.cmake b/Modules/CMakeTestASM_MARMASMCompiler.cmake
index a6de04c..8703172 100644
--- a/Modules/CMakeTestASM_MARMASMCompiler.cmake
+++ b/Modules/CMakeTestASM_MARMASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake
index c1308ff..c2ee7d5 100644
--- a/Modules/CMakeTestASM_MASMCompiler.cmake
+++ b/Modules/CMakeTestASM_MASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake
index a9ee39d..20f161d 100644
--- a/Modules/CMakeTestASM_NASMCompiler.cmake
+++ b/Modules/CMakeTestASM_NASMCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 8ebe570..d32fb6c 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_C_COMPILER_FORCED)
diff --git a/Modules/CMakeTestCSharpCompiler.cmake b/Modules/CMakeTestCSharpCompiler.cmake
index 9f4b99f..d34ae92 100644
--- a/Modules/CMakeTestCSharpCompiler.cmake
+++ b/Modules/CMakeTestCSharpCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_CSharp_COMPILER_FORCED)
# The compiler configuration was forced by the user.
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake
index ef97f55..fbeadf7 100644
--- a/Modules/CMakeTestCUDACompiler.cmake
+++ b/Modules/CMakeTestCUDACompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_CUDA_COMPILER_FORCED)
# The compiler configuration was forced by the user.
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index 6f5b36c..5c35426 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_CXX_COMPILER_FORCED)
diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake
index da7c007..1b4dd6d 100644
--- a/Modules/CMakeTestCompilerCommon.cmake
+++ b/Modules/CMakeTestCompilerCommon.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(PrintTestCompilerStatus LANG)
diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake
index 1baa18d..bf4100e 100644
--- a/Modules/CMakeTestFortranCompiler.cmake
+++ b/Modules/CMakeTestFortranCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_Fortran_COMPILER_FORCED)
diff --git a/Modules/CMakeTestHIPCompiler.cmake b/Modules/CMakeTestHIPCompiler.cmake
index 5b49c0d..60b2121 100644
--- a/Modules/CMakeTestHIPCompiler.cmake
+++ b/Modules/CMakeTestHIPCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_HIP_COMPILER_FORCED)
diff --git a/Modules/CMakeTestISPCCompiler.cmake b/Modules/CMakeTestISPCCompiler.cmake
index 6b16393..c2e157c 100644
--- a/Modules/CMakeTestISPCCompiler.cmake
+++ b/Modules/CMakeTestISPCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
diff --git a/Modules/CMakeTestJavaCompiler.cmake b/Modules/CMakeTestJavaCompiler.cmake
index 3c33573..ece8dd5 100644
--- a/Modules/CMakeTestJavaCompiler.cmake
+++ b/Modules/CMakeTestJavaCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestOBJCCompiler.cmake b/Modules/CMakeTestOBJCCompiler.cmake
index bcb3e1e..8003415 100644
--- a/Modules/CMakeTestOBJCCompiler.cmake
+++ b/Modules/CMakeTestOBJCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_OBJC_COMPILER_FORCED)
diff --git a/Modules/CMakeTestOBJCXXCompiler.cmake b/Modules/CMakeTestOBJCXXCompiler.cmake
index 68b3871..1b4bf60 100644
--- a/Modules/CMakeTestOBJCXXCompiler.cmake
+++ b/Modules/CMakeTestOBJCXXCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_OBJCXX_COMPILER_FORCED)
diff --git a/Modules/CMakeTestRCCompiler.cmake b/Modules/CMakeTestRCCompiler.cmake
index 3123a6c..8089270 100644
--- a/Modules/CMakeTestRCCompiler.cmake
+++ b/Modules/CMakeTestRCCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
index d89e606..0abaabe 100644
--- a/Modules/CMakeTestSwiftCompiler.cmake
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_Swift_COMPILER_FORCED)
# The compiler configuration was forced by the user.
diff --git a/Modules/CMakeUnixFindMake.cmake b/Modules/CMakeUnixFindMake.cmake
index 1165656..854e993 100644
--- a/Modules/CMakeUnixFindMake.cmake
+++ b/Modules/CMakeUnixFindMake.cmake
@@ -1,16 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
find_program(CMAKE_MAKE_PROGRAM NAMES gmake make smake)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
-
-# Look for a make tool provided by Xcode
-if(NOT CMAKE_MAKE_PROGRAM AND CMAKE_HOST_APPLE)
- execute_process(COMMAND xcrun --find make
- OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _xcrun_err)
- if(_xcrun_out)
- set_property(CACHE CMAKE_MAKE_PROGRAM PROPERTY VALUE "${_xcrun_out}")
- endif()
-endif()
diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake
index 19827f1..d98a49e 100644
--- a/Modules/CMakeVerifyManifest.cmake
+++ b/Modules/CMakeVerifyManifest.cmake
@@ -1,29 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeVerifyManifest
-------------------
+Use this script to verify that embedded manifests and side-by-side
+manifests for a project match.
+This script first recursively globs ``*.manifest`` files from
+the current directory and creates a list of allowed version.
+Additional versions can be passed by setting ``allow_versions``
+from the invocation command.
+Next, the script globs ``*.exe`` and ``*.dll`` files. Each
+``.exe`` and ``.dll`` file is scanned for embedded manifests and
+the versions of CRT are checked to be in the list of allowed
+version.
-CMakeVerifyManifest.cmake
+Example
+^^^^^^^
-This script is used to verify that embedded manifests and side by side
-manifests for a project match. To run this script, cd to a directory
-and run the script with cmake -P. On the command line you can pass in
-versions that are OK even if not found in the .manifest files. For
-example, cmake -Dallow_versions=8.0.50608.0
--PCmakeVerifyManifest.cmake could be used to allow an embedded manifest
-of 8.0.50608.0 to be used in a project even if that version was not
-found in the .manifest file.
-#]=======================================================================]
+To run this script, navigate to a directory and run the script
+with ``cmake -P``.
+
+::
-# This script first recursively globs *.manifest files from
-# the current directory. Then globs *.exe and *.dll. Each
-# .exe and .dll is scanned for embedded manifests and the versions
-# of CRT are compared to those found in the .manifest files
-# from the first glob.
+ cmake -Dallow_versions=8.0.50608.0 -PCMakeVerifyManifest.cmake
+
+This call allows an embedded manifest of 8.0.50608.0 to be used
+in a project, even if that version was not found in a
+``.manifest`` file.
+#]=======================================================================]
# crt_version:
# function to extract the CRT version from a file
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 3afe082..026b8c0 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CPack
@@ -176,7 +176,9 @@ installers. The most commonly-used variables are:
The name of the package file to generate, not including the
extension. For example, ``cmake-2.6.1-Linux-i686``. The default value
- is::
+ is:
+
+ .. code-block:: cmake
${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}
@@ -197,7 +199,9 @@ installers. The most commonly-used variables are:
.. versionadded:: 3.7
An algorithm that will be used to generate an additional file with the
- checksum of the package. The output file name will be::
+ checksum of the package. The output file name will be:
+
+ .. code-block:: cmake
${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}
@@ -479,7 +483,7 @@ The following variables are for advanced uses of CPack:
Specify the ``readelf`` executable path used by CPack.
The default value will be taken from the ``CMAKE_READELF`` variable, if set,
- which may be populated by an internal CMake module. If ``CMAKE_READELF``
+ which may be populated CMake when enabling languages. If ``CMAKE_READELF``
is not set, CPack will use :command:`find_program` to determine the
``readelf`` path when needed.
@@ -489,7 +493,7 @@ The following variables are for advanced uses of CPack:
Specify the ``objcopy`` executable path used by CPack.
The default value will be taken from the ``CMAKE_OBJCOPY`` variable, if set,
- which may be populated by an internal CMake module. If ``CMAKE_OBJCOPY``
+ which may be populated by CMake when enabling languages. If ``CMAKE_OBJCOPY``
is not set, CPack will use :command:`find_program` to determine the
``objcopy`` path when needed.
@@ -498,8 +502,8 @@ The following variables are for advanced uses of CPack:
.. versionadded:: 3.25
Specify the ``objdump`` executable path used by CPack.
- The default value will be taken from the ``CMAKE_OBJDUMP`` variable, if set,
- which may be populated by an internal CMake module. If ``CMAKE_OBJDUMP``
+ The default value will be taken from the :variable:`CMAKE_OBJDUMP` variable,
+ which may be populated by CMake when enabling languages. If ``CMAKE_OBJDUMP``
is not set, CPack will use :command:`find_program` to determine the
``objdump`` path when needed.
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 3b23b9f..3197fc3 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CPackComponent
@@ -47,7 +47,9 @@ The following variables influence the component-specific packaging:
list. The :command:`get_cmake_property` command can be used to obtain the
``COMPONENTS`` property, then the :command:`list(REMOVE_ITEM)` command can be
used to remove the unwanted ones. For example, to use all defined components
- except ``foo`` and ``bar``::
+ except ``foo`` and ``bar``:
+
+ .. code-block:: cmake
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "foo" "bar")
@@ -113,7 +115,7 @@ Add component
Describe an installation component.
-::
+.. code-block:: cmake
cpack_add_component(compname
[DISPLAY_NAME name]
@@ -190,7 +192,7 @@ Add component group
Describes a group of related CPack installation components.
-::
+.. code-block:: cmake
cpack_add_component_group(groupname
[DISPLAY_NAME name]
@@ -242,7 +244,7 @@ Add installation type
Add a new installation type containing
a set of predefined component selections to the graphical installer.
-::
+.. code-block:: cmake
cpack_add_install_type(typename
[DISPLAY_NAME name])
@@ -269,7 +271,7 @@ Configure downloads
Configure CPack to download
selected components on-the-fly as part of the installation process.
-::
+.. code-block:: cmake
cpack_configure_downloads(site
[UPLOAD_DIRECTORY dirname]
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 2338b79..2a2f478 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CPackIFW
@@ -23,7 +23,7 @@ The module defines the following commands:
Sets the arguments specific to the CPack IFW generator.
- ::
+ .. code-block:: cmake
cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
[FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
@@ -176,7 +176,7 @@ The module defines the following commands:
Sets the arguments specific to the CPack IFW generator.
- ::
+ .. code-block:: cmake
cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
[FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
@@ -317,7 +317,7 @@ The module defines the following commands:
Add QtIFW specific remote repository to binary installer.
- ::
+ .. code-block:: cmake
cpack_ifw_add_repository(<reponame> [DISABLED]
URL <url>
@@ -350,7 +350,7 @@ The module defines the following commands:
Update QtIFW specific repository from remote repository.
- ::
+ .. code-block:: cmake
cpack_ifw_update_repository(<reponame>
[[ADD|REMOVE] URL <url>]|
@@ -387,7 +387,7 @@ The module defines the following commands:
Add additional resources in the installer binary.
- ::
+ .. code-block:: cmake
cpack_ifw_add_package_resources(<file_path> <file_path> ...)
@@ -651,7 +651,7 @@ macro(_cpack_ifw_resolve_lisenses _variable)
set(_ifw_license_file TRUE)
endif()
list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}")
- endforeach(_ifw_licenses_arg)
+ endforeach()
set(${_variable} "${_ifw_licenses_fix}")
endif()
endmacro()
@@ -667,7 +667,7 @@ macro(_cpack_ifw_resolve_file_list _variable)
else()
message(WARNING "CPack IFW: page file \"${_ifw_file_arg}\" does not exist. Skipping")
endif()
- endforeach(_ifw_file_arg)
+ endforeach()
set(${_variable} "${_ifw_list_fix}")
endif()
endmacro()
diff --git a/Modules/CPackIFWConfigureFile.cmake b/Modules/CPackIFWConfigureFile.cmake
index 296b13f..6759c9c 100644
--- a/Modules/CPackIFWConfigureFile.cmake
+++ b/Modules/CPackIFWConfigureFile.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CPackIFWConfigureFile
@@ -20,7 +20,7 @@ The module defines the following commands:
Copy a file to another location and modify its contents.
- ::
+ .. code-block:: cmake
cpack_ifw_configure_file(<input> <output>)
diff --git a/Modules/CSharpUtilities.cmake b/Modules/CSharpUtilities.cmake
index cd44169..cf6300f 100644
--- a/Modules/CSharpUtilities.cmake
+++ b/Modules/CSharpUtilities.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CSharpUtilities
@@ -32,7 +32,9 @@ Main functions provided by the module
.. command:: csharp_set_windows_forms_properties
Sets source file properties for use of Windows Forms. Use this, if your CSharp
- target uses Windows Forms::
+ target uses Windows Forms:
+
+ .. code-block:: cmake
csharp_set_windows_forms_properties([<file1> [<file2> [...]]])
@@ -64,7 +66,9 @@ Main functions provided by the module
Sets source file properties of ``.Designer.cs`` files depending on
sibling filenames. Use this, if your CSharp target does **not**
use Windows Forms (for Windows Forms use
- :command:`csharp_set_windows_forms_properties` instead)::
+ :command:`csharp_set_windows_forms_properties` instead):
+
+ .. code-block:: cmake
csharp_set_designer_cs_properties([<file1> [<file2> [...]]])
@@ -80,17 +84,20 @@ Main functions provided by the module
are set depending on the extension of the matched file:
if match is **.resx** file:
- - VS_CSHARP_AutoGen "True"
- - VS_CSHARP_DesignTime "True"
- - VS_CSHARP_DependentUpon <resx-filename>
+
+ - VS_CSHARP_AutoGen "True"
+ - VS_CSHARP_DesignTime "True"
+ - VS_CSHARP_DependentUpon <resx-filename>
if match is **.cs** file:
- - VS_CSHARP_DependentUpon <cs-filename>
+
+ - VS_CSHARP_DependentUpon <cs-filename>
if match is **.settings** file:
- - VS_CSHARP_AutoGen "True"
- - VS_CSHARP_DesignTimeSharedInput "True"
- - VS_CSHARP_DependentUpon <settings-filename>
+
+ - VS_CSHARP_AutoGen "True"
+ - VS_CSHARP_DesignTimeSharedInput "True"
+ - VS_CSHARP_DependentUpon <settings-filename>
.. note::
@@ -101,7 +108,9 @@ Main functions provided by the module
.. command:: csharp_set_xaml_cs_properties
Sets source file properties for use of Windows Presentation Foundation (WPF) and
- XAML. Use this, if your CSharp target uses WPF/XAML::
+ XAML. Use this, if your CSharp target uses WPF/XAML:
+
+ .. code-block:: cmake
csharp_set_xaml_cs_properties([<file1> [<file2> [...]]])
@@ -116,7 +125,7 @@ Main functions provided by the module
If a match is found, the source file properties of the ``.xaml.cs``
file are set:
- - VS_CSHARP_DependentUpon <xaml-filename>
+ - VS_CSHARP_DependentUpon <xaml-filename>
Helper functions which are used by the above ones
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -125,7 +134,9 @@ Helper functions which are used by the above ones
Helper function which computes a list of key values to identify
source files independently of relative/absolute paths given in cmake
- and eliminates case sensitivity::
+ and eliminates case sensitivity:
+
+ .. code-block:: cmake
csharp_get_filename_keys(OUT [<file1> [<file2> [...]]])
@@ -158,7 +169,9 @@ Helper functions which are used by the above ones
Returns the full filepath and name **without** extension of a key.
KEY is expected to be a key from csharp_get_filename_keys. In BASE
- the value of KEY without the file extension is returned::
+ the value of KEY without the file extension is returned:
+
+ .. code-block:: cmake
csharp_get_filename_key_base(BASE KEY)
@@ -172,7 +185,9 @@ Helper functions which are used by the above ones
.. command:: csharp_get_dependentupon_name
Computes a string which can be used as value for the source file property
- :prop_sf:`VS_CSHARP_<tagname>` with *target* being ``DependentUpon``::
+ :prop_sf:`VS_CSHARP_<tagname>` with *target* being ``DependentUpon``:
+
+ .. code-block:: cmake
csharp_get_dependentupon_name(NAME FILE)
@@ -186,9 +201,6 @@ Helper functions which are used by the above ones
#]=======================================================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
function(csharp_get_filename_keys OUT)
set(${OUT} "")
foreach(f ${ARGN})
@@ -309,5 +321,3 @@ function(csharp_set_xaml_cs_properties)
endif()
endforeach()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 16283d6..06d11bb 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CTest
@@ -8,15 +8,24 @@ CTest
Configure a project for testing with CTest/CDash
Include this module in the top CMakeLists.txt file of a project to
-enable testing with CTest and dashboard submissions to CDash::
+enable testing with CTest and dashboard submissions to CDash:
+
+.. code-block:: cmake
project(MyProject)
...
include(CTest)
-The module automatically creates a ``BUILD_TESTING`` option that selects
-whether to enable testing support (``ON`` by default). After including
-the module, use code like::
+The module automatically creates the following variables:
+
+:variable:`BUILD_TESTING`
+
+ Option selecting whether ``include(CTest)`` calls :command:`enable_testing`.
+ The option is ``ON`` by default when created by the module.
+
+After including the module, use code like:
+
+.. code-block:: cmake
if(BUILD_TESTING)
# ... CMake code to create tests ...
@@ -25,7 +34,9 @@ the module, use code like::
to creating tests when testing is enabled.
To enable submissions to a CDash server, create a ``CTestConfig.cmake``
-file at the top of the project with content such as::
+file at the top of the project with content such as:
+
+.. code-block:: cmake
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_SUBMIT_URL "http://my.cdash.org/submit.php?project=MyProject")
@@ -40,7 +51,9 @@ build output for errors and warnings and reports them with surrounding
context from the build log. This generic approach works for all build
tools, but does not give details about the command invocation that
produced a given problem. One may get more detailed reports by setting
-the :variable:`CTEST_USE_LAUNCHERS` variable::
+the :variable:`CTEST_USE_LAUNCHERS` variable:
+
+.. code-block:: cmake
set(CTEST_USE_LAUNCHERS 1)
@@ -90,7 +103,7 @@ if(BUILD_TESTING)
SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}")
SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}")
SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}")
- SET_IF_SET_AND_NOT_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}")
+ SET_IF_SET_AND_NOT_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASSWORD}")
SET_IF_SET_AND_NOT_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}")
SET_IF_SET_AND_NOT_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}")
SET_IF_SET_AND_NOT_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}")
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index a6fa3a4..0b4f374 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CTestCoverageCollectGCOV
@@ -24,7 +24,7 @@ After generating this tar file, it can be sent to CDash for display with the
.. command:: ctest_coverage_collect_gcov
- ::
+ .. code-block:: cmake
ctest_coverage_collect_gcov(TARBALL <tarfile>
[SOURCE <source_dir>][BUILD <build_dir>]
diff --git a/Modules/CTestScriptMode.cmake b/Modules/CTestScriptMode.cmake
index 7af3577..d5dbddb 100644
--- a/Modules/CTestScriptMode.cmake
+++ b/Modules/CTestScriptMode.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CTestScriptMode
@@ -17,4 +17,3 @@ include(CMakeDetermineSystem)
# Also load the system specific file, which sets up e.g. the search paths.
# This makes the FIND_XXX() calls work much better
include(CMakeSystemSpecificInformation)
-
diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
index 5e8a07d..0a08b71 100644
--- a/Modules/CTestTargets.cmake
+++ b/Modules/CTestTargets.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT RUN_FROM_CTEST_OR_DART)
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index 5c544f8..5578c3d 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CTestUseLaunchers
@@ -46,7 +46,7 @@ endif()
if(CTEST_USE_LAUNCHERS)
set(__launch_common_options
- "--target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR>")
+ "--target-name <TARGET_NAME> --current-build-dir <CMAKE_CURRENT_BINARY_DIR>")
set(__launch_compile_options
"${__launch_common_options} --output <OBJECT> --source <SOURCE> --language <LANGUAGE>")
diff --git a/Modules/CXX-DetectStdlib.h b/Modules/CXX-DetectStdlib.h
index 0214dee..11cb93f 100644
--- a/Modules/CXX-DetectStdlib.h
+++ b/Modules/CXX-DetectStdlib.h
@@ -7,4 +7,4 @@ CMAKE-STDLIB-DETECT: libstdc++
#else
CMAKE-STDLIB-DETECT: UNKNOWN
#endif
- // clang-format on
+ // clang-format on
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index 7e58012..4d09a7f 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCCompilerFlag
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 74c54fa..8b12343 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCSourceCompiles
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index 4559215..8fcf22b 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCSourceRuns
@@ -19,9 +19,9 @@ subsequently be run.
function.
The result is stored in the internal cache variable specified by
- ``<resultVar>``. Success of build and run is indicated by boolean ``true``.
- Failure to build or run is indicated by boolean ``false`` such as an empty
- string or an error message.
+ ``<resultVar>``. If the code builds and runs with exit code ``0``, success is
+ indicated by boolean ``true``. Failure to build or run is indicated by boolean
+ ``false``, such as an empty string or an error message.
See also :command:`check_source_runs` for a more general command syntax.
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index ec719e1..f1933f3 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCXXCompilerFlag
@@ -11,7 +11,7 @@ Check once whether the CXX compiler supports a given flag.
.. code-block:: cmake
- check_cxx_compiler_flag(<flag> <var>)
+ check_cxx_compiler_flag(<flag> <resultVar>)
Check once that the ``<flag>`` is accepted by the compiler without a diagnostic.
The result is stored in the internal cache variable specified by
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index 90c3e6a..c0402e9 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCXXSourceCompiles
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index f0a5ffc..b131a6f 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCXXSourceRuns
@@ -19,9 +19,9 @@ subsequently be run.
function.
The result is stored in the internal cache variable specified by
- ``<resultVar>``. Success of build and run is indicated by boolean ``true``.
- Failure to build or run is indicated by boolean ``false`` such as an empty
- string or an error message.
+ ``<resultVar>``. If the code builds and runs with exit code ``0``, success is
+ indicated by boolean ``true``. Failure to build or run is indicated by boolean
+ ``false``, such as an empty string or an error message.
See also :command:`check_source_runs` for a more general command syntax.
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
index bcd514f..ada708a 100644
--- a/Modules/CheckCXXSymbolExists.cmake
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCXXSymbolExists
diff --git a/Modules/CheckCompilerFlag.cmake b/Modules/CheckCompilerFlag.cmake
index d505142..2854fa8 100644
--- a/Modules/CheckCompilerFlag.cmake
+++ b/Modules/CheckCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckCompilerFlag
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
index eee7deb..c04f26c 100644
--- a/Modules/CheckFortranCompilerFlag.cmake
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckFortranCompilerFlag
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 6583c9a..1c73604 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckFortranFunctionExists
@@ -7,11 +7,11 @@ CheckFortranFunctionExists
Check if a Fortran function exists.
-.. command:: CHECK_FORTRAN_FUNCTION_EXISTS
+.. command:: check_fortran_function_exists
.. code-block:: cmake
- CHECK_FORTRAN_FUNCTION_EXISTS(<function> <result>)
+ check_fortran_function_exists(<function> <result>)
where
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index 68e289c..39176e2 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckFortranSourceCompiles
diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake
index 808baf6..62c6ac5 100644
--- a/Modules/CheckFortranSourceRuns.cmake
+++ b/Modules/CheckFortranSourceRuns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckFortranSourceRuns
@@ -21,9 +21,9 @@ subsequently be run.
executable, and then run. The ``<code>`` must contain a Fortran ``program``.
The result is stored in the internal cache variable specified by
- ``<resultVar>``. Success of build and run is indicated by boolean ``true``.
- Failure to build or run is indicated by boolean ``false`` such as an empty
- string or an error message.
+ ``<resultVar>``. If the code builds and runs with exit code ``0``, success is
+ indicated by boolean ``true``. Failure to build or run is indicated by boolean
+ ``false``, such as an empty string or an error message.
.. code-block:: cmake
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index 7111509..4c73ea6 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckFunctionExists
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index fe27295..9c4f61e 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckIPOSupported
@@ -13,7 +13,7 @@ property.
.. command:: check_ipo_supported
- ::
+ .. code-block:: cmake
check_ipo_supported([RESULT <result>] [OUTPUT <output>]
[LANGUAGES <lang>...])
@@ -28,13 +28,29 @@ property.
Set ``<output>`` variable with details about any error.
``LANGUAGES <lang>...``
Specify languages whose compilers to check.
- Languages ``C``, ``CXX``, and ``Fortran`` are supported.
-It makes no sense to use this module when :policy:`CMP0069` is set to ``OLD`` so
-module will return error in this case. See policy :policy:`CMP0069` for details.
+ The following languages are supported:
+
+ * ``C``
+
+ * ``CXX``
+
+ * ``CUDA``
+
+ .. versionadded:: 3.25
+
+ * ``Fortran``
+
+ If this option is not given, the default languages are picked from
+ the current :prop_gbl:`ENABLED_LANGUAGES` global property.
+
+.. note::
+
+ To use ``check_ipo_supported()``, policy :policy:`CMP0069` must be set to
+ ``NEW``; otherwise, a fatal error will occur.
.. versionadded:: 3.13
- Add support for Visual Studio generators.
+ Support for Visual Studio generators.
.. versionadded:: 3.24
The check uses the caller's :variable:`CMAKE_<LANG>_FLAGS`
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index d16c9f8..f070ba5 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckIncludeFile
@@ -7,11 +7,11 @@ CheckIncludeFile
Provides a macro to check if a header file can be included in ``C``.
-.. command:: CHECK_INCLUDE_FILE
+.. command:: check_include_file
.. code-block:: cmake
- CHECK_INCLUDE_FILE(<include> <variable> [<flags>])
+ check_include_file(<include> <variable> [<flags>])
Check if the given ``<include>`` file may be included in a ``C``
source file and store the result in an internal cache entry named
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index f4ac0cf..ec02b36 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckIncludeFileCXX
@@ -7,11 +7,11 @@ CheckIncludeFileCXX
Provides a macro to check if a header file can be included in ``CXX``.
-.. command:: CHECK_INCLUDE_FILE_CXX
+.. command:: check_include_file_cxx
.. code-block:: cmake
- CHECK_INCLUDE_FILE_CXX(<include> <variable> [<flags>])
+ check_include_file_cxx(<include> <variable> [<flags>])
Check if the given ``<include>`` file may be included in a ``CXX``
source file and store the result in an internal cache entry named
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 3327222..6dfb41d 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckIncludeFiles
@@ -8,11 +8,11 @@ CheckIncludeFiles
Provides a macro to check if a list of one or more header files can
be included together.
-.. command:: CHECK_INCLUDE_FILES
+.. command:: check_include_files
.. code-block:: cmake
- CHECK_INCLUDE_FILES("<includes>" <variable> [LANGUAGE <language>])
+ check_include_files("<includes>" <variable> [LANGUAGE <language>])
Check if the given ``<includes>`` list may be included together
in a source file and store the result in an internal cache
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 35ad036..5ca5f68 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckLanguage
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 58be342..e739955 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckLibraryExists
@@ -7,18 +7,16 @@ CheckLibraryExists
Check once if the function exists in system or specified library.
-.. command:: CHECK_LIBRARY_EXISTS
+.. command:: check_library_exists
.. code-block:: cmake
- CHECK_LIBRARY_EXISTS(LIBRARY FUNCTION LOCATION VARIABLE)
+ check_library_exists(<library> <function> <location> <variable>)
- ::
-
- LIBRARY - the name of the library you are looking for
- FUNCTION - the name of the function
- LOCATION - location where the library should be found
- VARIABLE - internal cache variable to store the result
+ Check that the library ``<library>`` exists in the given location
+ ``<location>`` and has the specified ``<function>``. The result is stored in
+ an internal cache variable ``<variable>``. If ``<location>`` is empty string,
+ default directories are searched.
Prefer using :module:`CheckSymbolExists` or :module:`CheckSourceCompiles`
instead of this module for more robust detection if a function is available in
@@ -39,6 +37,42 @@ the way the check is run:
.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+Examples
+^^^^^^^^
+
+This module can be useful for performing so-called sanity checks to verify that
+the specified library provides the expected functionality and is indeed the
+correct one being located.
+
+For example, to check if the ``curl`` library exists in the default paths and
+has the ``curl_easy_perform`` function:
+
+.. code-block:: cmake
+
+ include(CheckLibraryExists)
+ check_library_exists(curl curl_easy_perform "" HAVE_LIBRARY_CURL)
+
+To check if library exists in specific non-standard location and has a specified
+function:
+
+.. code-block:: cmake
+
+ include(CheckLibraryExists)
+ check_library_exists(curl curl_easy_perform "/opt/curl/lib" HAVE_LIBRARY_CURL)
+
+Also :ref:`IMPORTED library <add_library imported libraries>` (for example,
+from the ``find_package()`` call) can be used:
+
+.. code-block:: cmake
+
+ find_package(CURL)
+
+ # ...
+
+ if(TARGET CURL::libcurl)
+ include(CheckLibraryExists)
+ check_library_exists(CURL::libcurl curl_easy_perform "" HAVE_LIBRARY_CURL)
+ endif()
#]=======================================================================]
include_guard(GLOBAL)
diff --git a/Modules/CheckLinkerFlag.cmake b/Modules/CheckLinkerFlag.cmake
index 8319216..ca37ab5 100644
--- a/Modules/CheckLinkerFlag.cmake
+++ b/Modules/CheckLinkerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckLinkerFlag
diff --git a/Modules/CheckOBJCCompilerFlag.cmake b/Modules/CheckOBJCCompilerFlag.cmake
index 183c7ec..9d00d04 100644
--- a/Modules/CheckOBJCCompilerFlag.cmake
+++ b/Modules/CheckOBJCCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckOBJCCompilerFlag
diff --git a/Modules/CheckOBJCSourceCompiles.cmake b/Modules/CheckOBJCSourceCompiles.cmake
index 11d8ea9..bea3de9 100644
--- a/Modules/CheckOBJCSourceCompiles.cmake
+++ b/Modules/CheckOBJCSourceCompiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckOBJCSourceCompiles
diff --git a/Modules/CheckOBJCSourceRuns.cmake b/Modules/CheckOBJCSourceRuns.cmake
index 0611d67..1c33837 100644
--- a/Modules/CheckOBJCSourceRuns.cmake
+++ b/Modules/CheckOBJCSourceRuns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckOBJCSourceRuns
@@ -21,9 +21,9 @@ can subsequently be run.
function.
The result is stored in the internal cache variable specified by
- ``<resultVar>``. Success of build and run is indicated by boolean ``true``.
- Failure to build or run is indicated by boolean ``false`` such as an empty
- string or an error message.
+ ``<resultVar>``. If the code builds and runs with exit code ``0``, success is
+ indicated by boolean ``true``. Failure to build or run is indicated by boolean
+ ``false``, such as an empty string or an error message.
See also :command:`check_source_runs` for a more general command syntax.
diff --git a/Modules/CheckOBJCXXCompilerFlag.cmake b/Modules/CheckOBJCXXCompilerFlag.cmake
index e185a31..a853475 100644
--- a/Modules/CheckOBJCXXCompilerFlag.cmake
+++ b/Modules/CheckOBJCXXCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckOBJCXXCompilerFlag
diff --git a/Modules/CheckOBJCXXSourceCompiles.cmake b/Modules/CheckOBJCXXSourceCompiles.cmake
index 35024d7..dd1a209 100644
--- a/Modules/CheckOBJCXXSourceCompiles.cmake
+++ b/Modules/CheckOBJCXXSourceCompiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckOBJCXXSourceCompiles
diff --git a/Modules/CheckOBJCXXSourceRuns.cmake b/Modules/CheckOBJCXXSourceRuns.cmake
index 1192ff3..93ac155 100644
--- a/Modules/CheckOBJCXXSourceRuns.cmake
+++ b/Modules/CheckOBJCXXSourceRuns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckOBJCXXSourceRuns
@@ -21,9 +21,9 @@ and can subsequently be run.
function.
The result is stored in the internal cache variable specified by
- ``<resultVar>``. Success of build and run is indicated by boolean ``true``.
- Failure to build or run is indicated by boolean ``false`` such as an empty
- string or an error message.
+ ``<resultVar>``. If the code builds and runs with exit code ``0``, success is
+ indicated by boolean ``true``. Failure to build or run is indicated by boolean
+ ``false``, such as an empty string or an error message.
See also :command:`check_source_runs` for a more general command syntax.
diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake
index 452348b..9922aec 100644
--- a/Modules/CheckPIESupported.cmake
+++ b/Modules/CheckPIESupported.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckPIESupported
@@ -14,7 +14,7 @@ property for executables will be honored at link time.
.. command:: check_pie_supported
- ::
+ .. code-block:: cmake
check_pie_supported([OUTPUT_VARIABLE <output>]
[LANGUAGES <lang>...])
@@ -120,6 +120,8 @@ function (check_pie_supported)
foreach(lang IN LISTS CHECK_PIE_LANGUAGES)
if(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER)
if(NOT DEFINED CMAKE_${lang}_LINK_PIE_SUPPORTED)
+ # ensure PIE compile flags are also used
+ list(JOIN CMAKE_${lang}_COMPILE_OPTIONS_PIE " " CMAKE_REQUIRED_FLAGS)
cmake_check_linker_flag(${lang}
"${CMAKE_${lang}_LINK_OPTIONS_PIE}"
CMAKE_${lang}_LINK_PIE_SUPPORTED
@@ -127,6 +129,7 @@ function (check_pie_supported)
if (NOT CMAKE_${lang}_LINK_PIE_SUPPORTED)
string (APPEND outputs "PIE (${lang}): ${output}\n")
endif()
+ unset(CMAKE_REQUIRED_FLAGS)
endif()
if(NOT DEFINED CMAKE_${lang}_LINK_NO_PIE_SUPPORTED)
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index e2bba1e..8854613 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -1,36 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckPrototypeDefinition
------------------------
-Check if the prototype we expect is correct.
+Check if a ``C`` function has the expected prototype.
.. command:: check_prototype_definition
.. code-block:: cmake
- check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
-
- ::
-
- FUNCTION - The name of the function (used to check if prototype exists)
- PROTOTYPE- The prototype to check.
- RETURN - The return value of the function.
- HEADER - The header files required.
- VARIABLE - The variable to store the result.
- Will be created as an internal cache variable.
-
- Example:
-
- .. code-block:: cmake
-
- check_prototype_definition(getpwent_r
- "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
- "NULL"
- "unistd.h;pwd.h"
- SOLARIS_GETPWENT_R)
+ check_prototype_definition(<function> <prototype> <return> <headers> <variable>)
+
+ ``<function>``
+ The name of the function whose prototype is being checked.
+ ``<prototype>``
+ The expected prototype of the function, provided as a string.
+ ``<return>``
+ The return value of the function. This will be used as a return value in
+ the function definition body of the generated test program to verify that
+ the function's return type matches the expected type.
+ ``<headers>``
+ A :ref:`semicolon-separated list <CMake Language Lists>` of header file
+ names required for checking the function prototype.
+ ``<variable>``
+ The name of the variable to store the check result. This variable will be
+ created as an internal cache variable.
+
+ This command generates a test program and verifies that it builds without
+ errors. The generated test program includes specified ``<headers>``, defines
+ a function with given literal ``<prototype>`` and ``<return>`` value and
+ then uses the specified ``<function>``. The simplified test program can be
+ illustrated as:
+
+ .. code-block:: c
+
+ #include <headers>
+ // ...
+ <prototype> { return <return>; }
+ int main(...) { ...<function>()... }
The following variables may be set before calling this function to modify
the way the check is run:
@@ -49,6 +58,23 @@ the way the check is run:
.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+Examples
+^^^^^^^^
+
+Checking if the ``getpwent_r()`` function on Solaris/illumos systems has the
+expected prototype:
+
+.. code-block:: cmake
+
+ include(CheckPrototypeDefinition)
+
+ check_prototype_definition(
+ getpwent_r
+ "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
+ "NULL"
+ "unistd.h;pwd.h"
+ HAVE_SOLARIS_GETPWENT_R
+ )
#]=======================================================================]
#
diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake
index bd439e1..f8b9bdb 100644
--- a/Modules/CheckSizeOf.cmake
+++ b/Modules/CheckSizeOf.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
message(SEND_ERROR
diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake
index 2ce6e85..97e3252 100644
--- a/Modules/CheckSourceCompiles.cmake
+++ b/Modules/CheckSourceCompiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
diff --git a/Modules/CheckSourceRuns.cmake b/Modules/CheckSourceRuns.cmake
index a0ddfee..7a18a4a 100644
--- a/Modules/CheckSourceRuns.cmake
+++ b/Modules/CheckSourceRuns.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
@@ -23,9 +23,9 @@ subsequently be run.
a ``main()`` function, or in Fortran a ``program``.
The result is stored in the internal cache variable specified by
- ``<resultVar>``. Success of build and run is indicated by boolean ``true``.
- Failure to build or run is indicated by boolean ``false`` such as an empty
- string or an error message.
+ ``<resultVar>``. If the code builds and runs with exit code ``0``, success is
+ indicated by boolean ``true``. Failure to build or run is indicated by boolean
+ ``false``, such as an empty string or an error message.
By default, the test source file will be given a file extension that matches
the requested language. The ``SRC_EXT`` option can be used to override this
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index a088202..f1d39bd 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckStructHasMember
@@ -7,21 +7,25 @@ CheckStructHasMember
Check if the given struct or class has the specified member variable
-.. command:: CHECK_STRUCT_HAS_MEMBER
+.. command:: check_struct_has_member
.. code-block:: cmake
- CHECK_STRUCT_HAS_MEMBER(<struct> <member> <header> <variable>
+ check_struct_has_member(<struct> <member> <headers> <variable>
[LANGUAGE <language>])
- ::
+ Check that the struct or class ``<struct>`` has the specified ``<member>``
+ after including the given header(s) ``<headers>`` where the prototype should
+ be declared. Specify the list of header files in one argument as a
+ semicolon-separated list. The result is stored in an internal cache variable
+ ``<variable>``.
- <struct> - the name of the struct or class you are interested in
- <member> - the member which existence you want to check
- <header> - the header(s) where the prototype should be declared
- <variable> - variable to store the result
- <language> - the compiler to use (C or CXX)
+ The options are:
+ ``LANGUAGE <language>``
+ Use the ``<language>`` compiler to perform the check.
+ Acceptable values are ``C`` and ``CXX``.
+ If not specified, it defaults to ``C``.
The following variables may be set before calling this macro to modify
the way the check is run:
@@ -40,12 +44,14 @@ the way the check is run:
.. include:: /module/CMAKE_REQUIRED_QUIET.txt
-
-Example:
+Example
+^^^^^^^
.. code-block:: cmake
- CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h
+ include(CheckStructHasMember)
+
+ check_struct_has_member("struct timeval" tv_sec sys/select.h
HAVE_TIMEVAL_TV_SEC LANGUAGE C)
#]=======================================================================]
@@ -76,9 +82,9 @@ int main(void)
")
if("${_lang}" STREQUAL "C")
- CHECK_SOURCE_COMPILES(C "${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ check_source_compiles(C "${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
elseif("${_lang}" STREQUAL "CXX")
- CHECK_SOURCE_COMPILES(CXX "${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ check_source_compiles(CXX "${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
else()
message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
endif()
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index a4950df..6d9301c 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckSymbolExists
@@ -59,9 +59,6 @@ For example:
include_guard(GLOBAL)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
if(CMAKE_C_COMPILER_LOADED)
__CHECK_SYMBOL_EXISTS_FILTER_FLAGS(C)
@@ -185,5 +182,3 @@ int main(int argc, char** argv)
unset(_CSE_SOURCE)
endif()
endmacro()
-
-endblock()
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index ee54d92..c733aae 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckTypeSize
@@ -54,6 +54,7 @@ Check sizeof a type
``LANGUAGE <language>``
Use the ``<language>`` compiler to perform the check.
Acceptable values are ``C`` and ``CXX``.
+ If not specified, it defaults to ``C``.
Despite the name of the macro you may use it to check the size of more
complex expressions, too. To check e.g. for the size of a struct
@@ -83,6 +84,62 @@ the way the check is run:
``CMAKE_EXTRA_INCLUDE_FILES``
list of extra headers to include.
+
+Examples
+^^^^^^^^
+
+Consider the code:
+
+.. code-block:: cmake
+
+ include(CheckTypeSize)
+
+ # Check for size of long.
+ check_type_size(long SIZEOF_LONG)
+ message("HAVE_SIZEOF_LONG: ${HAVE_SIZEOF_LONG}")
+ message("SIZEOF_LONG: ${SIZEOF_LONG}")
+ message("SIZEOF_LONG_CODE: ${SIZEOF_LONG_CODE}")
+
+On a 64-bit architecture, the output may look something like this::
+
+ HAVE_SIZEOF_LONG: TRUE
+ SIZEOF_LONG: 8
+ SIZEOF_LONG_CODE: #define SIZEOF_LONG 8
+
+On Apple platforms, when :variable:`CMAKE_OSX_ARCHITECTURES` has multiple
+architectures, types may have architecture-dependent sizes.
+For example, with the code
+
+.. code-block:: cmake
+
+ include(CheckTypeSize)
+
+ check_type_size(long SIZEOF_LONG)
+ message("HAVE_SIZEOF_LONG: ${HAVE_SIZEOF_LONG}")
+ message("SIZEOF_LONG: ${SIZEOF_LONG}")
+ foreach(key IN LISTS SIZE_OF_LONG_KEYS)
+ message("key: ${key}")
+ message("value: ${SIZE_OF_LONG-${key}}")
+ endforeach()
+ message("SIZEOF_LONG_CODE:
+ ${SIZEOF_LONG_CODE}")
+
+the result may be::
+
+ HAVE_SIZEOF_LONG: TRUE
+ SIZEOF_LONG: 0
+ key: __i386
+ value: 4
+ key: __x86_64
+ value: 8
+ SIZEOF_LONG_CODE:
+ #if defined(__i386)
+ # define SIZE_OF_LONG 4
+ #elif defined(__x86_64)
+ # define SIZE_OF_LONG 8
+ #else
+ # error SIZE_OF_LONG unknown
+ #endif
#]=======================================================================]
include(CheckIncludeFile)
@@ -93,7 +150,6 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
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>
#-----------------------------------------------------------------------------
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index 37bef1b..25d871e 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckVariableExists
@@ -7,19 +7,14 @@ CheckVariableExists
Check if the variable exists.
-.. command:: CHECK_VARIABLE_EXISTS
+.. command:: check_variable_exists
.. code-block:: cmake
- CHECK_VARIABLE_EXISTS(VAR VARIABLE)
-
-
- ::
-
- VAR - the name of the variable
- VARIABLE - variable to store the result
- Will be created as an internal cache variable.
+ check_variable_exists(<var> <variable>)
+ Check if the variable ``<var>`` exists and store the result in an internal
+ cache variable ``<variable>``.
This macro is only for ``C`` variables.
diff --git a/Modules/Compiler/ADSP.cmake b/Modules/Compiler/ADSP.cmake
index 39dcf39..6af58d1 100644
--- a/Modules/Compiler/ADSP.cmake
+++ b/Modules/Compiler/ADSP.cmake
@@ -8,6 +8,8 @@ macro(__compiler_adsp lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-flags-link" " ")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
set(_CMAKE_${lang}_ADSP_FLAGS "-proc=${CMAKE_ADSP_PROCESSOR}")
set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -Mo <DEP_FILE>")
diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake
index f4f1854..ba64c28 100644
--- a/Modules/Compiler/ARMCC.cmake
+++ b/Modules/Compiler/ARMCC.cmake
@@ -30,6 +30,8 @@ macro(__compiler_armcc lang)
set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "--via=")
+ set(CMAKE_${lang}_LINK_MODE LINKER)
+
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Compiler/ARMClang.cmake b/Modules/Compiler/ARMClang.cmake
index c839220..f85da96 100644
--- a/Modules/Compiler/ARMClang.cmake
+++ b/Modules/Compiler/ARMClang.cmake
@@ -12,9 +12,6 @@ set(_ARMClang_CMAKE_LOADED TRUE)
# Save the CMP0123 setting in a variable used both below and by try_compile.
cmake_policy(GET CMP0123 CMAKE_ARMClang_CMP0123)
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
if (CMAKE_LINKER MATCHES "armlink")
@@ -135,12 +132,10 @@ macro(__compiler_armclang lang)
else()
set(__CMAKE_ARMClang_USING_armlink_WRAPPER "-Xlinker")
endif()
- set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> ${__CMAKE_ARMClang_USING_armlink_WRAPPER} --list=<TARGET_BASE>.map")
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> ${__CMAKE_ARMClang_USING_armlink_WRAPPER}")
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "${__CMAKE_ARMClang_USING_armlink_WRAPPER} --via=")
set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
endmacro()
-
-cmake_policy(POP)
diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake
index 8724f85..57f248a 100644
--- a/Modules/Compiler/Absoft-Fortran.cmake
+++ b/Modules/Compiler/Absoft-Fortran.cmake
@@ -11,3 +11,5 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-X")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-no-cpp")
+
+set(CMAKE_Fortran_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake b/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake
index f67082c..6fa9a40 100644
--- a/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake
@@ -14,7 +14,7 @@
# Xcode_60 - Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
# Xcode_61 - Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
-# There is some non-correspondance. __has_feature(cxx_user_literals) is
+# There is some non-correspondence. __has_feature(cxx_user_literals) is
# false for AppleClang 4.0 and 4.1, although it is reported as
# supported in the reference link for Clang 3.1. The compiler does not pass
# the CompileFeatures/cxx_user_literals.cpp test.
diff --git a/Modules/Compiler/Bruce-C.cmake b/Modules/Compiler/Bruce-C.cmake
index 6b64e58..a4b89fa 100644
--- a/Modules/Compiler/Bruce-C.cmake
+++ b/Modules/Compiler/Bruce-C.cmake
@@ -7,3 +7,5 @@ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
set(CMAKE_C_LINKER_WRAPPER_FLAG "-X")
+
+set(CMAKE_C_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index ffd02ec..067aa6f 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages and compilers; use include guard
if (__COMPILER_CMAKE_COMMON_COMPILER_MACROS)
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index c9b1669..2df31de 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -1,11 +1,6 @@
include(Compiler/Clang)
__compiler_clang(C)
-cmake_policy(GET CMP0025 appleClangPolicy)
-if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
- return()
-endif()
-
if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake
index 3874921..c95615b 100644
--- a/Modules/Compiler/Clang-CUDA.cmake
+++ b/Modules/Compiler/Clang-CUDA.cmake
@@ -26,6 +26,8 @@ set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S")
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG ${CMAKE_CUDA_LINKER_WRAPPER_FLAG})
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ${CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP})
+set(CMAKE_CUDA_DEVICE_LINK_MODE DRIVER)
+
# RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default.
set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 46fc48d..87a4cdd 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -15,11 +15,6 @@ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
-cmake_policy(GET CMP0025 appleClangPolicy)
-if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
- return()
-endif()
-
if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index f834f7a..d01d704 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -262,7 +262,9 @@ macro(__compiler_clang_cxx_standards lang)
# files that also have C sources.
set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-clang:-std=c++23")
set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-clang:-std=c++23")
- set(CMAKE_${lang}_STANDARD_LATEST 23)
+ set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_${lang}_STANDARD_LATEST 26)
elseif(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")
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index 51f8cc4..7d79fb3 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/Cray)
__compiler_cray(C)
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index 9a40b98..713dcae 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/Cray)
__compiler_cray(CXX)
diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake
index 0d5e1c7..3fdc906 100644
--- a/Modules/Compiler/Cray-Fortran.cmake
+++ b/Modules/Compiler/Cray-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/Cray)
__compiler_cray(Fortran)
diff --git a/Modules/Compiler/Cray.cmake b/Modules/Compiler/Cray.cmake
index c214afc..c693589 100644
--- a/Modules/Compiler/Cray.cmake
+++ b/Modules/Compiler/Cray.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_CRAY)
@@ -14,4 +14,6 @@ macro(__compiler_cray lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC -h PIC)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE -h PIC)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-h PIC")
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
diff --git a/Modules/Compiler/CrayClang-C.cmake b/Modules/Compiler/CrayClang-C.cmake
index 96e46be..fa2c197 100644
--- a/Modules/Compiler/CrayClang-C.cmake
+++ b/Modules/Compiler/CrayClang-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/CrayClang)
__compiler_cray_clang(C)
diff --git a/Modules/Compiler/CrayClang-CXX.cmake b/Modules/Compiler/CrayClang-CXX.cmake
index a61edfa..015f7ce 100644
--- a/Modules/Compiler/CrayClang-CXX.cmake
+++ b/Modules/Compiler/CrayClang-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/CrayClang)
__compiler_cray_clang(CXX)
diff --git a/Modules/Compiler/CrayClang.cmake b/Modules/Compiler/CrayClang.cmake
index d2db9dd..eced82b 100644
--- a/Modules/Compiler/CrayClang.cmake
+++ b/Modules/Compiler/CrayClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_CRAYCLANG)
diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake
index f6e46ac..8bdc982 100644
--- a/Modules/Compiler/CrayPrgEnv.cmake
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -7,9 +7,6 @@ set(__cmake_craype_crayprgenv 1)
# CrayPrgEnv: loaded when compiling through the Cray compiler wrapper.
# The compiler wrapper can run on a front-end node or a compute node.
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
# One-time setup of the craype environment. First, check the wrapper config.
# The wrapper's selection of a compiler (gcc, clang, intel, etc.) and
# default include/library paths is selected using the "module" command.
@@ -132,5 +129,3 @@ macro(__CrayPrgEnv_setup lang)
endif()
endmacro()
-
-cmake_policy(POP)
diff --git a/Modules/Compiler/Fujitsu-C.cmake b/Modules/Compiler/Fujitsu-C.cmake
index 0ffa82d..ddbb769 100644
--- a/Modules/Compiler/Fujitsu-C.cmake
+++ b/Modules/Compiler/Fujitsu-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/Fujitsu)
__compiler_fujitsu(C)
diff --git a/Modules/Compiler/Fujitsu-CXX.cmake b/Modules/Compiler/Fujitsu-CXX.cmake
index 56f16c1..3bb7629 100644
--- a/Modules/Compiler/Fujitsu-CXX.cmake
+++ b/Modules/Compiler/Fujitsu-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/Fujitsu)
__compiler_fujitsu(CXX)
diff --git a/Modules/Compiler/Fujitsu.cmake b/Modules/Compiler/Fujitsu.cmake
index 55c2aa4..554061d 100644
--- a/Modules/Compiler/Fujitsu.cmake
+++ b/Modules/Compiler/Fujitsu.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_FUJITSU)
@@ -27,6 +27,8 @@ macro(__compiler_fujitsu lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
# IPO flag
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
if ("${lang}" STREQUAL "Fortran")
diff --git a/Modules/Compiler/FujitsuClang.cmake b/Modules/Compiler/FujitsuClang.cmake
index a848248..029b5e5 100644
--- a/Modules/Compiler/FujitsuClang.cmake
+++ b/Modules/Compiler/FujitsuClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake
index 5dba04e..c46795c 100644
--- a/Modules/Compiler/G95-Fortran.cmake
+++ b/Modules/Compiler/G95-Fortran.cmake
@@ -11,3 +11,5 @@ set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-no-cpp")
+
+set(CMAKE_Fortran_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 793261e..141838e 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -39,6 +39,8 @@ macro(__compiler_gnu lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
# header file as a warning if depfiles are enabled, causing check_header_file
# tests to always succeed. Work around this by disabling dependency tracking
diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake
index 8fa4c08..2571d8f 100644
--- a/Modules/Compiler/HP-C.cmake
+++ b/Modules/Compiler/HP-C.cmake
@@ -5,3 +5,5 @@ set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES>
set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+
+set(CMAKE_C_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake
index 5726b64..b7503e9 100644
--- a/Modules/Compiler/HP-CXX.cmake
+++ b/Modules/Compiler/HP-CXX.cmake
@@ -6,6 +6,8 @@ set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUD
set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",")
+set(CMAKE_CXX_LINK_MODE DRIVER)
+
# HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98
# template support. It is known that version 6.25 doesn't need that flag.
# Current assumption: the flag is needed for every version from 3.80 to 4
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index 7dd03f3..bd74e2b 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -16,9 +16,6 @@ endif()
# Whenever needed, override this default behavior using CMAKE_IAR_CXX_FLAG in your toolchain file.
if(NOT CMAKE_IAR_CXX_FLAG)
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
set(_CMAKE_IAR_MODERNCXX_LIST 14 17)
if(${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} IN_LIST _CMAKE_IAR_MODERNCXX_LIST OR
("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" AND ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} EQUAL 98))
@@ -27,8 +24,6 @@ if(NOT CMAKE_IAR_CXX_FLAG)
set(CMAKE_IAR_CXX_FLAG --eec++)
endif()
unset(_CMAKE_IAR_MODERNCXX_LIST)
-
- cmake_policy(POP)
endif()
set(CMAKE_CXX_STANDARD_COMPILE_OPTION "")
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index 8dadb76..01420ba 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -21,6 +21,8 @@ macro(__compiler_iar_common lang)
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Oh -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Ohz -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG")
+
+ set(CMAKE_${lang}_LINK_MODE LINKER)
endif()
set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
diff --git a/Modules/Compiler/IBMClang-ASM.cmake b/Modules/Compiler/IBMClang-ASM.cmake
index dffc085..b9f9f46 100644
--- a/Modules/Compiler/IBMClang-ASM.cmake
+++ b/Modules/Compiler/IBMClang-ASM.cmake
@@ -1,5 +1,11 @@
include(Compiler/IBMClang)
+set(_ibmclang_version_asm "${CMAKE_ASM_COMPILER_VERSION}")
+set(CMAKE_ASM_COMPILER_VERSION "${CMAKE_ASM_COMPILER_VERSION_INTERNAL}")
+include(Compiler/Clang-ASM)
+set(CMAKE_ASM_COMPILER_VERSION "${_ibmclang_version_asm}")
+unset(_ibmclang_version_asm)
+
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
__compiler_ibmclang(ASM)
diff --git a/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake b/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake
index 623c8af..d25b1e2 100644
--- a/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake
@@ -5,4 +5,5 @@ set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__open_xl_release__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__open_xl_modification__)
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__open_xl_ptf_fix_level__)
+# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__
")
diff --git a/Modules/Compiler/IBMClang-C.cmake b/Modules/Compiler/IBMClang-C.cmake
index fde6a3b..0039f1c 100644
--- a/Modules/Compiler/IBMClang-C.cmake
+++ b/Modules/Compiler/IBMClang-C.cmake
@@ -1,4 +1,11 @@
include(Compiler/IBMClang)
+
+set(_ibmclang_version_c "${CMAKE_C_COMPILER_VERSION}")
+set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
+include(Compiler/Clang-C)
+set(CMAKE_C_COMPILER_VERSION "${_ibmclang_version_c}")
+unset(_ibmclang_version_c)
+
__compiler_ibmclang(C)
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
diff --git a/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake
index 623c8af..d25b1e2 100644
--- a/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake
@@ -5,4 +5,5 @@ set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__open_xl_release__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__open_xl_modification__)
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__open_xl_ptf_fix_level__)
+# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__
")
diff --git a/Modules/Compiler/IBMClang-CXX.cmake b/Modules/Compiler/IBMClang-CXX.cmake
index ec97381..071eec8 100644
--- a/Modules/Compiler/IBMClang-CXX.cmake
+++ b/Modules/Compiler/IBMClang-CXX.cmake
@@ -1,42 +1,12 @@
include(Compiler/IBMClang)
-__compiler_ibmclang(CXX)
-
-if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
- if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
- AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
- AND CMAKE_DEPFILE_FLAGS_CXX)
- # dependencies are computed by the compiler itself
- set(CMAKE_CXX_DEPFILE_FORMAT gcc)
- set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
- endif()
-
- set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
- set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
-endif()
-
-set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
-set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
-set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
-set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+set(_ibmclang_version_cxx "${CMAKE_CXX_COMPILER_VERSION}")
+set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
+include(Compiler/Clang-CXX)
+set(CMAKE_CXX_COMPILER_VERSION "${_ibmclang_version_cxx}")
+unset(_ibmclang_version_cxx)
-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")
- 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 23)
-endif()
+__compiler_ibmclang(CXX)
__compiler_check_default_language_standard(CXX 17.1.0 17)
diff --git a/Modules/Compiler/IBMClang-FindBinUtils.cmake b/Modules/Compiler/IBMClang-FindBinUtils.cmake
new file mode 100644
index 0000000..e721c87
--- /dev/null
+++ b/Modules/Compiler/IBMClang-FindBinUtils.cmake
@@ -0,0 +1 @@
+include(Compiler/Clang-FindBinUtils)
diff --git a/Modules/Compiler/IBMClang.cmake b/Modules/Compiler/IBMClang.cmake
index 58645aa..6505451 100644
--- a/Modules/Compiler/IBMClang.cmake
+++ b/Modules/Compiler/IBMClang.cmake
@@ -1,6 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_IBMClang)
@@ -8,18 +7,9 @@ if(__COMPILER_IBMClang)
endif()
set(__COMPILER_IBMClang 1)
-include(Compiler/CMakeCommonCompilerMacros)
-
-set(__pch_header_C "c-header")
-set(__pch_header_CXX "c++-header")
-set(__pch_header_OBJC "objective-c-header")
-set(__pch_header_OBJCXX "objective-c++-header")
-
-include(Compiler/GNU)
-
+# Macro to set ibm-clang unique config. This should be called after common
+# clang config is included and include only what isn't common.
macro(__compiler_ibmclang lang)
- __compiler_gnu(${lang})
-
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
@@ -27,58 +17,16 @@ macro(__compiler_ibmclang lang)
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
- set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
- set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-
- set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
- set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
-
- set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
- set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
-
if(CMAKE_${lang}_COMPILER_TARGET AND "${lang}" STREQUAL "CXX")
list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
endif()
- set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
- set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
-
# Thin LTO is not yet supported on AIX.
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX"))
set(_CMAKE_LTO_THIN TRUE)
endif()
- if(_CMAKE_LTO_THIN)
- set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
- else()
- set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
- endif()
-
- set(__ar "${CMAKE_${lang}_COMPILER_AR}")
- set(__ranlib "${CMAKE_${lang}_COMPILER_RANLIB}")
-
- set(CMAKE_${lang}_ARCHIVE_CREATE_IPO
- "\"${__ar}\" qc <TARGET> <LINK_FLAGS> <OBJECTS>"
- )
-
- set(CMAKE_${lang}_ARCHIVE_APPEND_IPO
- "\"${__ar}\" q <TARGET> <LINK_FLAGS> <OBJECTS>"
- )
-
- set(CMAKE_${lang}_ARCHIVE_FINISH_IPO
- "\"${__ranlib}\" <TARGET>"
- )
-
if("${lang}" STREQUAL "CXX")
list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-dM" "-E" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
endif()
-
- set(CMAKE_PCH_EXTENSION .pch)
-
- set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
-
- set(CMAKE_${lang}_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
-
- set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
- set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
endmacro()
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake
index bc6f50f..55c0861 100644
--- a/Modules/Compiler/Intel.cmake
+++ b/Modules/Compiler/Intel.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -18,6 +18,8 @@ if(CMAKE_HOST_WIN32)
else()
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
endif()
+
+ set(CMAKE_${lang}_LINK_MODE LINKER)
endmacro()
else()
# GNU-like
@@ -57,5 +59,7 @@ else()
# COMPILE_WARNING_AS_ERROR
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
endif()
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
endif()
diff --git a/Modules/Compiler/IntelLLVM.cmake b/Modules/Compiler/IntelLLVM.cmake
index d3d1bc3..8218f03 100644
--- a/Modules/Compiler/IntelLLVM.cmake
+++ b/Modules/Compiler/IntelLLVM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -22,6 +22,8 @@ macro(__compiler_intel_llvm_common lang)
set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "\"${CMAKE_${lang}_COMPILER_AR}\" qc <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND_IPO "\"${CMAKE_${lang}_COMPILER_AR}\" q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH_IPO "\"${CMAKE_${lang}_COMPILER_RANLIB}\" <TARGET>")
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
if(CMAKE_HOST_WIN32)
@@ -73,6 +75,8 @@ else()
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
# distcc does not transform -o to -MT when invoking the preprocessor
# internally, as it ought to. Work around this bug by setting -MT here
# even though it isn't strictly necessary.
diff --git a/Modules/Compiler/LCC.cmake b/Modules/Compiler/LCC.cmake
index 9cf957d..5657db1 100644
--- a/Modules/Compiler/LCC.cmake
+++ b/Modules/Compiler/LCC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -35,6 +35,8 @@ macro(__compiler_lcc lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
# header file as a warning if depfiles are enabled, causing check_header_file
# tests to always succeed. Work around this by disabling dependency tracking
diff --git a/Modules/Compiler/LFortran-Fortran.cmake b/Modules/Compiler/LFortran-Fortran.cmake
index f3f28cc..b7b3084 100644
--- a/Modules/Compiler/LFortran-Fortran.cmake
+++ b/Modules/Compiler/LFortran-Fortran.cmake
@@ -12,3 +12,5 @@ set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> --cpp <DEFINES> <I
set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> --cpp-infer <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> -o <OBJECT>")
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "--shared")
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-export-dynamic")
+
+set(CMAKE_Fortran_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/LLVMFlang-Fortran.cmake b/Modules/Compiler/LLVMFlang-Fortran.cmake
index 0a432a9..5b7aee4 100644
--- a/Modules/Compiler/LLVMFlang-Fortran.cmake
+++ b/Modules/Compiler/LLVMFlang-Fortran.cmake
@@ -18,9 +18,13 @@ set(CMAKE_Fortran_COMPILE_OPTIONS_TARGET "--target=")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
-if(NOT "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
+if("x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_Fortran_LINK_MODE LINKER)
+else()
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
+ set(CMAKE_Fortran_LINK_MODE DRIVER)
+
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -O0 -g")
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
index d7fbf9f..7de6039 100644
--- a/Modules/Compiler/MSVC-C.cmake
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/MSVC)
__compiler_msvc(C)
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index f30983e..d4d11ea 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/MSVC)
__compiler_msvc(CXX)
diff --git a/Modules/Compiler/MSVC.cmake b/Modules/Compiler/MSVC.cmake
index 9c09af1..40517b9 100644
--- a/Modules/Compiler/MSVC.cmake
+++ b/Modules/Compiler/MSVC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_MSVC)
@@ -22,4 +22,6 @@ macro(__compiler_msvc lang)
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-external:I")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang}_WARNING "-external:W0 ")
endif ()
+
+ set(CMAKE_${lang}_LINK_MODE LINKER)
endmacro()
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index a6636c4..50b2991 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -47,5 +47,7 @@ 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_LINK_MODE DRIVER)
+
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/NVHPC.cmake b/Modules/Compiler/NVHPC.cmake
index 0593456..ff8808a 100644
--- a/Modules/Compiler/NVHPC.cmake
+++ b/Modules/Compiler/NVHPC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -13,5 +13,8 @@ include(Compiler/PGI)
macro(__compiler_nvhpc lang)
# Logic specific to NVHPC.
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror")
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 93ad182..208daea 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -21,3 +21,5 @@ set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG "-Xcompiler=")
set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG_SEP ",")
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG "-Xlinker=")
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ",")
+
+set(CMAKE_CUDA_DEVICE_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/NVIDIA.cmake b/Modules/Compiler/NVIDIA.cmake
index 21e71cc..0d0f03a 100644
--- a/Modules/Compiler/NVIDIA.cmake
+++ b/Modules/Compiler/NVIDIA.cmake
@@ -155,6 +155,12 @@ macro(__compiler_nvidia_cuda_flags lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
endif()
+ if (CMAKE_${lang}_SIMULATE_ID STREQUAL "MSVC")
+ set(CMAKE_${lang}_LINK_MODE LINKER)
+ else()
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+ endif()
+
set(CMAKE_${lang}_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
set(CMAKE_${lang}_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
set(CMAKE_${lang}_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
diff --git a/Modules/Compiler/OpenWatcom.cmake b/Modules/Compiler/OpenWatcom.cmake
index 8cfe683..e048bc8 100644
--- a/Modules/Compiler/OpenWatcom.cmake
+++ b/Modules/Compiler/OpenWatcom.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
@@ -40,6 +40,8 @@ foreach(lang C CXX)
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -s -os -d0 -dNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -s -ot -d0 -dNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -s -ot -d1 -dNDEBUG")
+
+ set(CMAKE_${lang}_LINK_MODE LINKER)
endforeach()
# C create import library
diff --git a/Modules/Compiler/OrangeC.cmake b/Modules/Compiler/OrangeC.cmake
index fbb245b..71ed04c 100644
--- a/Modules/Compiler/OrangeC.cmake
+++ b/Modules/Compiler/OrangeC.cmake
@@ -12,6 +12,8 @@ macro(__compiler_orangec lang)
set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
set(CMAKE_${lang}_DEPENDS_USE_COMPILER TRUE)
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2 -DNDEBUG")
diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index b037fbc..4a29a43 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -28,6 +28,8 @@ macro(__compiler_pgi lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le AND (NOT CMAKE_HOST_WIN32 OR CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 16.3) AND CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 23.3)
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
diff --git a/Modules/Compiler/PathScale.cmake b/Modules/Compiler/PathScale.cmake
index d5f8cb1..351f6c6 100644
--- a/Modules/Compiler/PathScale.cmake
+++ b/Modules/Compiler/PathScale.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -12,6 +12,8 @@ macro(__compiler_pathscale lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
# Initial configuration flags.
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake
index b5dca3e..d16b2d4 100644
--- a/Modules/Compiler/QCC.cmake
+++ b/Modules/Compiler/QCC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/GNU)
diff --git a/Modules/Compiler/SCO.cmake b/Modules/Compiler/SCO.cmake
index 7f643d9..aefe5a0 100644
--- a/Modules/Compiler/SCO.cmake
+++ b/Modules/Compiler/SCO.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -18,4 +18,6 @@ macro(__compiler_sco lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 35dbdcd..d76b854 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/SunPro)
__compiler_sunpro(C)
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 33ce9fc..6dd363b 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/SunPro)
__compiler_sunpro(CXX)
diff --git a/Modules/Compiler/SunPro.cmake b/Modules/Compiler/SunPro.cmake
index 331cdfc..88eca39 100644
--- a/Modules/Compiler/SunPro.cmake
+++ b/Modules/Compiler/SunPro.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_SUNPRO)
@@ -11,4 +11,6 @@ include(Compiler/CMakeCommonCompilerMacros)
macro(__compiler_sunpro lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-errwarn=%all")
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake
index 6cb115b..9462dcd 100644
--- a/Modules/Compiler/TI.cmake
+++ b/Modules/Compiler/TI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -25,6 +25,8 @@ macro(__compiler_ti lang)
set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=")
set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=<DEP_FILE>")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> --preproc_only ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> --compile_only --skip_assembler ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/TIClang.cmake b/Modules/Compiler/TIClang.cmake
index 4965e62..d069e94 100644
--- a/Modules/Compiler/TIClang.cmake
+++ b/Modules/Compiler/TIClang.cmake
@@ -23,6 +23,8 @@ macro(__compiler_ticlang lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
set(CMAKE_EXECUTABLE_SUFFIX ".out")
diff --git a/Modules/Compiler/Tasking-ASM.cmake b/Modules/Compiler/Tasking-ASM.cmake
index 19bce19..eabc77b 100644
--- a/Modules/Compiler/Tasking-ASM.cmake
+++ b/Modules/Compiler/Tasking-ASM.cmake
@@ -1,7 +1,6 @@
include(Compiler/Tasking)
+__compiler_tasking(ASM)
set(CMAKE_ASM_OUTPUT_EXTENSION ".o")
-set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)
-set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
-set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS S;s;asm;msa)
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;src)
diff --git a/Modules/Compiler/Tasking-C.cmake b/Modules/Compiler/Tasking-C.cmake
index 915090a..d0ed386 100644
--- a/Modules/Compiler/Tasking-C.cmake
+++ b/Modules/Compiler/Tasking-C.cmake
@@ -1,13 +1,13 @@
include(Compiler/Tasking)
__compiler_tasking(C)
-set(CMAKE_C90_STANDARD_COMPILE_OPTION "--iso=90" "--strict")
+# Extension flags are not tied to the standard level flags.
+# Avoid passing them here so users/projects can control them independently.
+set(CMAKE_C90_STANDARD_COMPILE_OPTION "--iso=90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--iso=90")
-
-set(CMAKE_C99_STANDARD_COMPILE_OPTION "--iso=99" "--strict")
+set(CMAKE_C99_STANDARD_COMPILE_OPTION "--iso=99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--iso=99")
-
-set(CMAKE_C11_STANDARD_COMPILE_OPTION "--iso=11" "--strict")
+set(CMAKE_C11_STANDARD_COMPILE_OPTION "--iso=11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--iso=11")
set(CMAKE_C_STANDARD_LATEST 11)
diff --git a/Modules/Compiler/Tasking-CXX.cmake b/Modules/Compiler/Tasking-CXX.cmake
index 1aa840a..3570bb0 100644
--- a/Modules/Compiler/Tasking-CXX.cmake
+++ b/Modules/Compiler/Tasking-CXX.cmake
@@ -1,15 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Compiler/Tasking)
__compiler_tasking(CXX)
-set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--c++=03" "--strict")
+# Extension flags are not tied to the standard level flags.
+# Avoid passing them here so users/projects can control them independently.
+set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--c++=03")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--c++=03")
-
-set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "--c++=11" "--strict")
+set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "--c++=11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "--c++=11")
-
-set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++=14" "--strict")
+set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++=14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "--c++=14")
set(CMAKE_CXX_STANDARD_LATEST 14)
diff --git a/Modules/Compiler/Tasking-DetermineCompiler.cmake b/Modules/Compiler/Tasking-DetermineCompiler.cmake
index a40be19..f12487c 100644
--- a/Modules/Compiler/Tasking-DetermineCompiler.cmake
+++ b/Modules/Compiler/Tasking-DetermineCompiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set(_compiler_id_pp_test "defined(__TASKING__)")
set(_compiler_id_version_compute "
diff --git a/Modules/Compiler/Tasking-FindBinUtils.cmake b/Modules/Compiler/Tasking-FindBinUtils.cmake
index eab31d7..d81a741 100644
--- a/Modules/Compiler/Tasking-FindBinUtils.cmake
+++ b/Modules/Compiler/Tasking-FindBinUtils.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Find the archiver for the compiler architecture, which is always in the same
# directory as the compiler.
diff --git a/Modules/Compiler/Tasking.cmake b/Modules/Compiler/Tasking.cmake
index 82622fa..14c0e60 100644
--- a/Modules/Compiler/Tasking.cmake
+++ b/Modules/Compiler/Tasking.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(_Tasking_CMAKE_LOADED)
@@ -22,13 +22,25 @@ if(NOT CMAKE_TASKING_TOOLSET)
endif()
macro(__compiler_tasking lang)
+ set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "--pic")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl" " ")
+ set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-f ")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ")
set(CMAKE_DEPFILE_FLAGS_${lang} "--dep-file=<DEP_FILE>")
- set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "--warning-as-errors")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "--warnings-as-errors")
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+ # Features for LINK_LIBRARY generator expression
+ if( CMAKE_TASKING_TOOLSET STREQUAL "SmartCode"
+ OR (CMAKE_TASKING_TOOLSET STREQUAL "TriCore" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2))
+ ## WHOLE_ARCHIVE: Force loading all members of an archive
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive=<LINK_ITEM>")
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
+ set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
+ endif()
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -O0 -g")
diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake
index 6367695..b2f733a 100644
--- a/Modules/Compiler/TinyCC-C.cmake
+++ b/Modules/Compiler/TinyCC-C.cmake
@@ -9,3 +9,5 @@ string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+
+set(CMAKE_C_LINK_MODE DRIVER)
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 844fcfd..48dcdc8 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -24,6 +24,8 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O")
diff --git a/Modules/Compiler/XLClang.cmake b/Modules/Compiler/XLClang.cmake
index 8c3e5e9..01c4bc9 100644
--- a/Modules/Compiler/XLClang.cmake
+++ b/Modules/Compiler/XLClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake
index 3610012..e7967a0 100644
--- a/Modules/Dart.cmake
+++ b/Modules/Dart.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Dart
@@ -18,7 +18,7 @@ submissions as well as testing with CTest. This module should be
included in the CMakeLists.txt file at the top of a project. Typical
usage:
-::
+.. code-block:: cmake
include(Dart)
if(BUILD_TESTING)
@@ -141,4 +141,3 @@ endif()
#
# End of Dart.cmake
#
-
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 9aa4383..39443cf 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
DeployQt4
@@ -24,13 +24,13 @@ The following functions are provided by this module:
Requires CMake 2.6 or greater because it uses function and
PARENT_SCOPE. Also depends on BundleUtilities.cmake.
-::
+.. code-block:: cmake
write_qt4_conf(<qt_conf_dir> <qt_conf_contents>)
Writes a qt.conf file with the <qt_conf_contents> into <qt_conf_dir>.
-::
+.. code-block:: cmake
resolve_qt4_paths(<paths_var> [<executable_path>])
@@ -38,7 +38,7 @@ Loop through <paths_var> list and if any don't exist resolve them
relative to the <executable_path> (if supplied) or the
CMAKE_INSTALL_PREFIX.
-::
+.. code-block:: cmake
fixup_qt4_executable(<executable>
[<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
@@ -65,7 +65,7 @@ directories to be searched to find library dependencies.
<request_qt_conf> will force a qt.conf file to be written even if not
needed.
-::
+.. code-block:: cmake
install_qt4_plugin_path(plugin executable copy installed_plugin_path_var
<plugins_dir> <component> <configurations>)
@@ -80,7 +80,7 @@ rather than install time.
If <component> is set then anything installed will use this COMPONENT.
-::
+.. code-block:: cmake
install_qt4_plugin(plugin executable copy installed_plugin_path_var
<plugins_dir> <component>)
@@ -90,7 +90,7 @@ directory (or <plugins_dir>) relative to <executable> and store the
result in <installed_plugin_path_var>. See documentation of
INSTALL_QT4_PLUGIN_PATH.
-::
+.. code-block:: cmake
install_qt4_executable(<executable>
[<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake
index 2430f85..bd30068 100644
--- a/Modules/Documentation.cmake
+++ b/Modules/Documentation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Documentation
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 055a0ee..5d28929 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
ExternalData
@@ -47,7 +47,9 @@ Module Functions
.. command:: ExternalData_Expand_Arguments
The ``ExternalData_Expand_Arguments`` function evaluates ``DATA{}``
- references in its arguments and constructs a new list of arguments::
+ references in its arguments and constructs a new list of arguments:
+
+ .. code-block:: cmake
ExternalData_Expand_Arguments(
<target> # Name of data management target
@@ -62,7 +64,9 @@ Module Functions
The ``ExternalData_Add_Test`` function wraps around the CMake
:command:`add_test` command but supports ``DATA{}`` references in
- its arguments::
+ its arguments:
+
+ .. code-block:: cmake
ExternalData_Add_Test(
<target> # Name of data management target
@@ -81,7 +85,9 @@ Module Functions
.. command:: ExternalData_Add_Target
The ``ExternalData_Add_Target`` function creates a custom target to
- manage local instances of data files stored externally::
+ manage local instances of data files stored externally:
+
+ .. code-block:: cmake
ExternalData_Add_Target(
<target> # Name of data management target
@@ -127,6 +133,14 @@ calling any of the functions provided by this module.
``<key>`` in entries of the ``ExternalData_URL_TEMPLATES`` list.
See `Custom Fetch Scripts`_.
+.. variable:: ExternalData_HTTPHEADERS
+
+ .. versionadded:: 4.0
+
+ The ``ExternalData_HTTPHEADERS`` variable may be used to supply a list of
+ headers, each element containing one header with the form ``Key: Value``.
+ See the :command:`file(DOWNLOAD)` command's ``HTTPHEADER`` option.
+
.. variable:: ExternalData_LINK_CONTENT
The ``ExternalData_LINK_CONTENT`` variable may be set to the name of a
@@ -238,21 +252,22 @@ members of a series are fetched, only the file originally named by the
recognizes file series names ending with ``#.ext``, ``_#.ext``, ``.#.ext``,
or ``-#.ext`` where ``#`` is a sequence of decimal digits and ``.ext`` is
any single extension. Configure it with a regex that parses ``<number>``
-and ``<suffix>`` parts from the end of ``<name>``::
+and ``<suffix>`` parts from the end of ``<name>``:
- ExternalData_SERIES_PARSE = regex of the form (<number>)(<suffix>)$
+ ``ExternalData_SERIES_PARSE`` - regex of the form ``(<number>)(<suffix>)$``.
-For more complicated cases set::
+For more complicated cases set:
- ExternalData_SERIES_PARSE = regex with at least two () groups
- ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any
- ExternalData_SERIES_PARSE_NUMBER = <number> regex group number
- ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number
+* ``ExternalData_SERIES_PARSE`` - regex with at least two ``()`` groups.
+* ``ExternalData_SERIES_PARSE_PREFIX`` - regex group number of the ``<prefix>``, if any.
+* ``ExternalData_SERIES_PARSE_NUMBER`` - regex group number of the ``<number>``.
+* ``ExternalData_SERIES_PARSE_SUFFIX`` - regex group number of the ``<suffix>``.
Configure series number matching with a regex that matches the
-``<number>`` part of series members named ``<prefix><number><suffix>``::
+``<number>`` part of series members named ``<prefix><number><suffix>``:
- ExternalData_SERIES_MATCH = regex matching <number> in all series members
+ ``ExternalData_SERIES_MATCH`` - regex matching ``<number>`` in all series
+ members
Note that the ``<suffix>`` of a series does not include a hash-algorithm
extension.
@@ -292,20 +307,22 @@ source directory.
Hash Algorithms
^^^^^^^^^^^^^^^
-The following hash algorithms are supported::
-
- %(algo) <ext> Description
- ------- ----- -----------
- MD5 .md5 Message-Digest Algorithm 5, RFC 1321
- SHA1 .sha1 US Secure Hash Algorithm 1, RFC 3174
- SHA224 .sha224 US Secure Hash Algorithms, RFC 4634
- SHA256 .sha256 US Secure Hash Algorithms, RFC 4634
- SHA384 .sha384 US Secure Hash Algorithms, RFC 4634
- SHA512 .sha512 US Secure Hash Algorithms, RFC 4634
- SHA3_224 .sha3-224 Keccak SHA-3
- SHA3_256 .sha3-256 Keccak SHA-3
- SHA3_384 .sha3-384 Keccak SHA-3
- SHA3_512 .sha3-512 Keccak SHA-3
+The following hash algorithms are supported:
+
+ ============ ============= ============
+ %(algo) <ext> Description
+ ============ ============= ============
+ ``MD5`` ``.md5`` Message-Digest Algorithm 5, RFC 1321
+ ``SHA1`` ``.sha1`` US Secure Hash Algorithm 1, RFC 3174
+ ``SHA224`` ``.sha224`` US Secure Hash Algorithms, RFC 4634
+ ``SHA256`` ``.sha256`` US Secure Hash Algorithms, RFC 4634
+ ``SHA384`` ``.sha384`` US Secure Hash Algorithms, RFC 4634
+ ``SHA512`` ``.sha512`` US Secure Hash Algorithms, RFC 4634
+ ``SHA3_224`` ``.sha3-224`` Keccak SHA-3
+ ``SHA3_256`` ``.sha3-256`` Keccak SHA-3
+ ``SHA3_384`` ``.sha3-384`` Keccak SHA-3
+ ``SHA3_512`` ``.sha3-512`` Keccak SHA-3
+ ============ ============= ============
.. versionadded:: 3.8
Added the ``SHA3_*`` hash algorithms.
@@ -453,6 +470,19 @@ function(ExternalData_add_target target)
endif()
endforeach()
+ # Store http headers.
+ if(ExternalData_HTTPHEADERS)
+ message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/${target}_config.cmake")
+ string(CONCAT _ExternalData_CONFIG_CODE "${_ExternalData_CONFIG_CODE}\n"
+ "set(ExternalData_HTTPHEADERS)")
+ foreach(h IN LISTS ExternalData_HTTPHEADERS)
+ string(REPLACE "\\" "\\\\" tmp "${h}")
+ string(REPLACE "\"" "\\\"" h "${tmp}")
+ string(CONCAT _ExternalData_CONFIG_CODE "${_ExternalData_CONFIG_CODE}\n"
+ "list(APPEND ExternalData_HTTPHEADERS \"${h}\")")
+ endforeach()
+ endif()
+
# Store configuration for use by build-time script.
set(config ${CMAKE_CURRENT_BINARY_DIR}/${target}_config.cmake)
configure_file(${_ExternalData_SELF_DIR}/ExternalData_config.cmake.in ${config} @ONLY)
@@ -869,10 +899,7 @@ macro(_ExternalData_arg_series)
endmacro()
function(_ExternalData_arg_find_files glob pattern regex)
- cmake_policy(PUSH)
- cmake_policy(SET CMP0009 NEW)
file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
- cmake_policy(POP)
set(externals_count -1)
foreach(entry IN LISTS globbed)
if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
@@ -976,6 +1003,12 @@ function(_ExternalData_download_file url file err_var msg_var)
set(retry 3)
while(retry)
math(EXPR retry "${retry} - 1")
+ set(httpheader_args)
+ if (ExternalData_HTTPHEADERS)
+ foreach(h IN LISTS ExternalData_HTTPHEADERS)
+ list(APPEND httpheader_args HTTPHEADER "${h}")
+ endforeach()
+ endif()
if(ExternalData_TIMEOUT_INACTIVITY)
set(inactivity_timeout INACTIVITY_TIMEOUT ${ExternalData_TIMEOUT_INACTIVITY})
elseif(NOT "${ExternalData_TIMEOUT_INACTIVITY}" EQUAL 0)
@@ -994,7 +1027,7 @@ function(_ExternalData_download_file url file err_var msg_var)
if (ExternalData_SHOW_PROGRESS)
list(APPEND show_progress_args SHOW_PROGRESS)
endif ()
- file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} ${show_progress_args})
+ file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${httpheader_args} ${inactivity_timeout} ${absolute_timeout} ${show_progress_args})
list(GET status 0 err)
list(GET status 1 msg)
if(err)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3f43542..37bd39c 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
@@ -749,6 +749,14 @@ step. This can be overridden with custom install commands if required.
install step's own underlying call to :command:`add_custom_command`, which
has additional documentation.
+``INSTALL_JOB_SERVER_AWARE <bool>``
+ .. versionadded:: 4.0
+
+ Specifies that the install step is aware of the GNU Make job server.
+ See the :command:`add_custom_command` documentation of its
+ ``JOB_SERVER_AWARE`` option for details. This option is relevant
+ only when an explicit ``INSTALL_COMMAND`` is specified.
+
.. note::
If the :envvar:`CMAKE_INSTALL_MODE` environment variable is set when the
main project is built, it will only have an effect if the following
@@ -1292,16 +1300,32 @@ The custom step could then be triggered from the main build like so::
include(${CMAKE_CURRENT_LIST_DIR}/ExternalProject/shared_internal_commands.cmake)
-cmake_policy(PUSH)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
-
define_property(DIRECTORY PROPERTY "EP_BASE" INHERITED)
define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED)
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)
+# file(TO_CMAKE_PATH) will interpret a platform-specific character as a path
+# separator, and if its input contains that character, it will treat the input
+# as a list. Sometimes we have a string that we know is always a single path,
+# but it may contain the separator character. To prevent it being treated as a
+# list of paths, this function masks the separator character while calling
+# file(TO_CMAKE_PATH).
+function(_ep_to_single_cmake_path out_var input)
+ if(WIN32)
+ set(unsafe_char ";")
+ else()
+ set(unsafe_char ":")
+ endif()
+
+ string(REPLACE "${unsafe_char}" "__EP_MARKER__" safe_input "${input}")
+ file(TO_CMAKE_PATH "${safe_input}" converted_input)
+ string(REPLACE "__EP_MARKER__" "${unsafe_char}" output "${converted_input}")
+
+ set(${out_var} "${output}" PARENT_SCOPE)
+endfunction()
+
function(_ep_set_directories name)
get_property(prefix TARGET ${name} PROPERTY _EP_PREFIX)
if(NOT prefix)
@@ -1314,7 +1338,7 @@ function(_ep_set_directories name)
endif()
endif()
if(prefix)
- file(TO_CMAKE_PATH "${prefix}" prefix)
+ _ep_to_single_cmake_path(prefix "${prefix}")
set(tmp_default "${prefix}/tmp")
set(download_default "${prefix}/src")
set(source_default "${prefix}/src/${name}")
@@ -1322,7 +1346,7 @@ function(_ep_set_directories name)
set(stamp_default "${prefix}/src/${name}-stamp")
set(install_default "${prefix}")
else()
- file(TO_CMAKE_PATH "${base}" base)
+ _ep_to_single_cmake_path(base "${base}")
set(tmp_default "${base}/tmp/${name}")
set(download_default "${base}/Download/${name}")
set(source_default "${base}/Source/${name}")
@@ -1352,7 +1376,7 @@ function(_ep_set_directories name)
if(NOT IS_ABSOLUTE "${${var}_dir}")
get_filename_component(${var}_dir "${top}/${${var}_dir}" ABSOLUTE)
endif()
- file(TO_CMAKE_PATH "${${var}_dir}" ${var}_dir)
+ _ep_to_single_cmake_path(${var}_dir "${${var}_dir}")
set_property(TARGET ${name} PROPERTY _EP_${VAR}_DIR "${${var}_dir}")
set(_EP_${VAR}_DIR "${${var}_dir}" PARENT_SCOPE)
endforeach()
@@ -1365,7 +1389,7 @@ function(_ep_set_directories name)
if(NOT IS_ABSOLUTE "${log_dir}")
get_filename_component(log_dir "${top}/${log_dir}" ABSOLUTE)
endif()
- file(TO_CMAKE_PATH "${log_dir}" log_dir)
+ _ep_to_single_cmake_path(log_dir "${log_dir}")
set_property(TARGET ${name} PROPERTY _EP_LOG_DIR "${log_dir}")
set(_EP_LOG_DIR "${log_dir}" PARENT_SCOPE)
@@ -1380,7 +1404,7 @@ function(_ep_set_directories name)
else()
# Prefix with a slash so that when appended to the source directory, it
# behaves as expected.
- file(TO_CMAKE_PATH "${source_subdir}" source_subdir)
+ _ep_to_single_cmake_path(source_subdir "${source_subdir}")
set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "/${source_subdir}")
set(_EP_SOURCE_SUBDIR "/${source_subdir}" PARENT_SCOPE)
endif()
@@ -2819,6 +2843,16 @@ function(_ep_add_install_command name)
PROPERTY _EP_INSTALL_BYPRODUCTS
)
+ get_property(install_job_server_aware
+ TARGET ${name}
+ PROPERTY _EP_INSTALL_JOB_SERVER_AWARE
+ )
+ if(install_job_server_aware)
+ set(maybe_JOB_SERVER_AWARE "JOB_SERVER_AWARE 1")
+ else()
+ set(maybe_JOB_SERVER_AWARE "")
+ endif()
+
set(__cmdQuoted)
foreach(__item IN LISTS cmd)
string(APPEND __cmdQuoted " [==[${__item}]==]")
@@ -2831,6 +2865,7 @@ function(_ep_add_install_command name)
WORKING_DIRECTORY \${binary_dir}
DEPENDEES build
ALWAYS \${always}
+ ${maybe_JOB_SERVER_AWARE}
${log}
${uses_terminal}
)"
@@ -3050,5 +3085,3 @@ function(ExternalProject_Add name)
#
_ep_add_test_command(${name})
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/ExternalProject/download.cmake.in b/Modules/ExternalProject/download.cmake.in
index 5e8c42f..ae2a8ab 100644
--- a/Modules/ExternalProject/download.cmake.in
+++ b/Modules/ExternalProject/download.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/ExternalProject/extractfile.cmake.in b/Modules/ExternalProject/extractfile.cmake.in
index a601bd7..c6ba9a8 100644
--- a/Modules/ExternalProject/extractfile.cmake.in
+++ b/Modules/ExternalProject/extractfile.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/ExternalProject/gitclone.cmake.in b/Modules/ExternalProject/gitclone.cmake.in
index 77d6be2..449bcb3 100644
--- a/Modules/ExternalProject/gitclone.cmake.in
+++ b/Modules/ExternalProject/gitclone.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/ExternalProject/gitupdate.cmake.in b/Modules/ExternalProject/gitupdate.cmake.in
index 8a214df..2d4bbd2 100644
--- a/Modules/ExternalProject/gitupdate.cmake.in
+++ b/Modules/ExternalProject/gitupdate.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/ExternalProject/hgclone.cmake.in b/Modules/ExternalProject/hgclone.cmake.in
index 5d5e8ca..6fc9745 100644
--- a/Modules/ExternalProject/hgclone.cmake.in
+++ b/Modules/ExternalProject/hgclone.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/ExternalProject/mkdirs.cmake.in b/Modules/ExternalProject/mkdirs.cmake.in
index 6d2ed28..65b68dd 100644
--- a/Modules/ExternalProject/mkdirs.cmake.in
+++ b/Modules/ExternalProject/mkdirs.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake
index 149a8a7..ac5d2bd 100644
--- a/Modules/ExternalProject/shared_internal_commands.cmake
+++ b/Modules/ExternalProject/shared_internal_commands.cmake
@@ -1934,6 +1934,7 @@ macro(_ep_get_add_keywords out_var)
#
INSTALL_COMMAND
INSTALL_BYPRODUCTS
+ INSTALL_JOB_SERVER_AWARE
#
# Test step options
#
diff --git a/Modules/ExternalProject/verify.cmake.in b/Modules/ExternalProject/verify.cmake.in
index 3cf768f..d2797cf 100644
--- a/Modules/ExternalProject/verify.cmake.in
+++ b/Modules/ExternalProject/verify.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
diff --git a/Modules/FLTKCompatibility.cmake b/Modules/FLTKCompatibility.cmake
index e91531f..9572f58 100644
--- a/Modules/FLTKCompatibility.cmake
+++ b/Modules/FLTKCompatibility.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(CheckIncludeFile)
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 009ca38..c4b27da 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -1,5 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include_guard(GLOBAL)
#[=======================================================================[.rst:
FeatureSummary
@@ -8,73 +10,84 @@ FeatureSummary
Functions for generating a summary of enabled/disabled features.
These functions can be used to generate a summary of enabled and disabled
-packages and/or feature for a build tree such as::
+packages and/or features for a build tree such as::
+
+ -- The following features have been enabled:
+
+ * Example, usage example
-- The following OPTIONAL packages have been found:
- LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org>
- * Enables HTML-import in MyWordProcessor
- * Enables odt-export in MyWordProcessor
- PNG, A PNG image library., <http://www.libpng.org/pub/png/>
- * Enables saving screenshots
+
+ * LibXml2 (required version >= 2.4), XML library, <http://xmlsoft.org>
+ Enables HTML-import in MyWordProcessor
+ Enables odt-export in MyWordProcessor
+ * PNG, image library, <http://www.libpng.org/pub/png/>
+ Enables saving screenshots
+
-- The following OPTIONAL packages have not been found:
- Lua51, The Lua scripting language., <https://www.lua.org>
- * Enables macros in MyWordProcessor
- Foo, Foo provides cool stuff.
+
+ * Lua, the Lua scripting language, <https://www.lua.org>
+ Enables macros in MyWordProcessor
+ * OpenGL, Open Graphics Library
Global Properties
^^^^^^^^^^^^^^^^^
.. variable:: FeatureSummary_PKG_TYPES
-The global property :variable:`FeatureSummary_PKG_TYPES` defines the type of
-packages used by `FeatureSummary`.
+ .. versionadded:: 3.8
-The order in this list is important, the first package type in the list is the
-least important, the last is the most important. the of a package can only be
-changed to higher types.
+ This global property defines a
+ :ref:`semicolon-separated list <CMake Language Lists>` of package types used
+ by the ``FeatureSummary`` module.
-The default package types are , ``RUNTIME``, ``OPTIONAL``, ``RECOMMENDED`` and
-``REQUIRED``, and their importance is
-``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``.
+ The order in this list is important, the first package type in the list has
+ the lowest importance, while the last has the highest importance. The type of
+ a package can only be changed to a type with higher importance.
+ The default package types are ``RUNTIME``, ``OPTIONAL``, ``RECOMMENDED`` and
+ ``REQUIRED``, with their importance ranked as
+ ``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``.
.. variable:: FeatureSummary_REQUIRED_PKG_TYPES
-The global property :variable:`FeatureSummary_REQUIRED_PKG_TYPES` defines which
-package types are required.
+ .. versionadded:: 3.8
-If one or more package in this categories has not been found, CMake will abort
-when calling :command:`feature_summary` with the
-'FATAL_ON_MISSING_REQUIRED_PACKAGES' option enabled.
+ This global property defines a
+ :ref:`semicolon-separated list <CMake Language Lists>` of package types that
+ are considered required.
-The default value for this global property is ``REQUIRED``.
+ If one or more packages in these categories are not found, CMake will abort
+ when the :command:`feature_summary()` command is called with the
+ ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` option enabled.
+ The default value for this global property is ``REQUIRED``.
.. variable:: FeatureSummary_DEFAULT_PKG_TYPE
-The global property :variable:`FeatureSummary_DEFAULT_PKG_TYPE` defines which
-package type is the default one.
-When calling :command:`feature_summary`, if the user did not set the package type
-explicitly, the package will be assigned to this category.
+ .. versionadded:: 3.8
-This value must be one of the types defined in the
-:variable:`FeatureSummary_PKG_TYPES` global property unless the package type
-is set for all the packages.
+ This global property defines the default package type.
-The default value for this global property is ``OPTIONAL``.
+ When the :command:`feature_summary()` command is called, and the user has not
+ explicitly set a type of some package, its type will be set to this value.
+ This value must be one of the types defined in the
+ :variable:`FeatureSummary_PKG_TYPES` global property.
-.. variable:: FeatureSummary_<TYPE>_DESCRIPTION
+ The default value for this global property is ``OPTIONAL``.
-.. versionadded:: 3.9
+.. variable:: FeatureSummary_<TYPE>_DESCRIPTION
-The global property :variable:`FeatureSummary_<TYPE>_DESCRIPTION` can be defined
-for each type to replace the type name with the specified string whenever the
-package type is used in an output string.
+ .. versionadded:: 3.9
-If not set, the string "``<TYPE>`` packages" is used.
+ This global property can be defined for each package ``<TYPE>`` to a string
+ that will be used in the output titles of the
+ :command:`feature_summary()` command. For example::
+ The following <FeatureSummary_<TYPE>_DESCRIPTION> have been found:
+ If not set, default string ``<TYPE> packages`` is used.
#]=======================================================================]
get_property(_fsPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_PKG_TYPES SET)
@@ -123,7 +136,7 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
get_property(_EnabledFeatures GLOBAL PROPERTY ${_property})
if(_EnabledFeatures)
list(REMOVE_DUPLICATES _EnabledFeatures)
- endif(_EnabledFeatures)
+ endif()
foreach(_currentFeature ${_EnabledFeatures})
@@ -199,90 +212,112 @@ endfunction()
#[=======================================================================[.rst:
.. command:: feature_summary
- ::
-
- feature_summary( [FILENAME <file>]
- [APPEND]
- [VAR <variable_name>]
- [INCLUDE_QUIET_PACKAGES]
- [FATAL_ON_MISSING_REQUIRED_PACKAGES]
- [DESCRIPTION "<description>" | DEFAULT_DESCRIPTION]
- [QUIET_ON_EMPTY]
- WHAT (ALL
- | PACKAGES_FOUND | PACKAGES_NOT_FOUND
- | <TYPE>_PACKAGES_FOUND | <TYPE>_PACKAGES_NOT_FOUND
- | ENABLED_FEATURES | DISABLED_FEATURES)
+ .. code-block:: cmake
+
+ feature_summary([FILENAME <file>]
+ [APPEND]
+ [VAR <variable_name>]
+ [INCLUDE_QUIET_PACKAGES]
+ [FATAL_ON_MISSING_REQUIRED_PACKAGES]
+ [DESCRIPTION <description> | DEFAULT_DESCRIPTION]
+ [QUIET_ON_EMPTY]
+ WHAT (ALL
+ | PACKAGES_FOUND | PACKAGES_NOT_FOUND
+ | <TYPE>_PACKAGES_FOUND | <TYPE>_PACKAGES_NOT_FOUND
+ | ENABLED_FEATURES | DISABLED_FEATURES)
)
- The ``feature_summary()`` macro can be used to print information about
- enabled or disabled packages or features of a project. By default,
+ This function can be used to print information about
+ enabled or disabled packages and features of a project. By default,
only the names of the features/packages will be printed and their
- required version when one was specified. Use ``set_package_properties()``
- to add more useful information, like e.g. a download URL for the
- respective package or their purpose in the project.
-
- The ``WHAT`` option is the only mandatory option. Here you specify what
- information will be printed:
-
- ``ALL``
- print everything
- ``ENABLED_FEATURES``
- the list of all features which are enabled
- ``DISABLED_FEATURES``
- the list of all features which are disabled
- ``PACKAGES_FOUND``
- the list of all packages which have been found
- ``PACKAGES_NOT_FOUND``
- the list of all packages which have not been found
-
- For each package type ``<TYPE>`` defined by the
- :variable:`FeatureSummary_PKG_TYPES` global property, the following
- information can also be used:
-
- ``<TYPE>_PACKAGES_FOUND``
- only those packages which have been found which have the type <TYPE>
- ``<TYPE>_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type <TYPE>
-
- .. versionchanged:: 3.1
- With the exception of the ``ALL`` value, these values can be combined
- in order to customize the output. For example:
+ required version when one was specified. Use
+ :command:`set_package_properties()` to add more useful information, like e.g.
+ a homepage URL for the respective package or their purpose in the project.
+
+ The options are:
+
+ ``WHAT``
+ This is the only mandatory option. It specifies what information will be
+ printed:
+
+ ``ALL``
+ Print everything.
+ ``ENABLED_FEATURES``
+ The list of all features which are enabled.
+ ``DISABLED_FEATURES``
+ The list of all features which are disabled.
+ ``PACKAGES_FOUND``
+ The list of all packages which have been found.
+ ``PACKAGES_NOT_FOUND``
+ The list of all packages which have not been found.
+
+ For each package type ``<TYPE>`` defined by the
+ :variable:`FeatureSummary_PKG_TYPES` global property, the following
+ information can also be used:
+
+ ``<TYPE>_PACKAGES_FOUND``
+ The list of only packages of type ``<TYPE>`` which have been found.
+ ``<TYPE>_PACKAGES_NOT_FOUND``
+ The list of only packages of type ``<TYPE>`` which have not been found.
+
+ .. versionchanged:: 3.1
+ The ``WHAT`` option is now a multi-value keyword, so that these values can
+ be combined, with the exception of the ``ALL`` value, in order to
+ customize the output. For example:
.. code-block:: cmake
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
- If a ``FILENAME`` is given, the information is printed into this file. If
- ``APPEND`` is used, it is appended to this file, otherwise the file is
- overwritten if it already existed. If the VAR option is used, the
- information is "printed" into the specified variable. If ``FILENAME`` is
- not used, the information is printed to the terminal. Using the
- ``DESCRIPTION`` option a description or headline can be set which will be
- printed above the actual content. If only one type of
- package was requested, no title is printed, unless it is explicitly set using
- either ``DESCRIPTION`` to use a custom string, or ``DEFAULT_DESCRIPTION`` to
- use a default title for the requested type.
- If ``INCLUDE_QUIET_PACKAGES`` is given, packages which have been searched with
- ``find_package(... QUIET)`` will also be listed. By default they are skipped.
- If ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a
- package which is marked as one of the package types listed in the
- :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global property has not been
- found.
- The default value for the :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global
- property is ``REQUIRED``.
+ ``FILENAME <file>``
+ If this option is given, the information is printed into this file instead
+ of the terminal. Relative ``<file>`` path is interpreted as being relative
+ to the current source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`).
- .. versionadded:: 3.9
- The ``DEFAULT_DESCRIPTION`` option.
+ ``APPEND``
+ If this option is given, the output is appended to the ``<file>`` provided
+ by the ``FILENAME`` option, otherwise the file is overwritten if it already
+ exists.
+
+ ``VAR <variable_name>``
+ If this option is given, the information is stored into the specified
+ variable ``<variable_name>`` instead of the terminal.
+
+ ``DESCRIPTION <description>``
+ A description or headline which will be printed above the actual content.
+ Without this option, if only one package type was requested, no title is
+ printed, unless a custom string is explicitly set using this option or
+ ``DEFAULT_DESCRIPTION`` option is used that outputs a default title for the
+ requested type.
+
+ ``DEFAULT_DESCRIPTION``
+ .. versionadded:: 3.9
+
+ The default description or headline to be printed above the content as
+ opposed to the customizable ``DESCRIPTION <description>``.
+
+ ``INCLUDE_QUIET_PACKAGES``
+ If this option is given, packages which have been searched with
+ :command:`find_package(... QUIET)` will also be listed. By default they are
+ skipped.
+
+ ``FATAL_ON_MISSING_REQUIRED_PACKAGES``
+ If this option is given, CMake will abort with fatal error if a package
+ which is marked as one of the package types listed in the
+ :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global property has not been
+ found.
The :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global property can be
modified to change the default package type assigned when not explicitly
assigned by the user.
- .. versionadded:: 3.8
- If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was
- requested, and no packages belonging to that category were found, then no
- output (including the ``DESCRIPTION``) is printed or added to the ``VAR``
- variable.
+ ``QUIET_ON_EMPTY``
+ .. versionadded:: 3.8
+
+ If this option is given, when only one package type was requested, and no
+ packages belonging to that category were found, then no output (including
+ the ``DESCRIPTION``) is printed nor added to the ``FILENAME``, or the
+ ``VAR`` variable.
Example 1, append everything to a file:
@@ -293,37 +328,37 @@ endfunction()
FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND)
Example 2, print the enabled features into the variable
- enabledFeaturesText, including QUIET packages:
+ ``enabledFeaturesText``, including the ``QUIET`` packages:
.. code-block:: cmake
- include(FeatureSummary)
- feature_summary(WHAT ENABLED_FEATURES
+ include(FeatureSummary)
+ feature_summary(WHAT ENABLED_FEATURES
INCLUDE_QUIET_PACKAGES
DESCRIPTION "Enabled Features:"
VAR enabledFeaturesText)
- message(STATUS "${enabledFeaturesText}")
+ message(STATUS "${enabledFeaturesText}")
- Example 3, change default package types and print only the categories that
- are not empty:
+ Example 3, add custom package type and print only the categories that are not
+ empty:
.. code-block:: cmake
- include(FeatureSummary)
- set_property(GLOBAL APPEND PROPERTY FeatureSummary_PKG_TYPES BUILD)
- find_package(FOO)
- set_package_properties(FOO PROPERTIES TYPE BUILD)
- feature_summary(WHAT BUILD_PACKAGES_FOUND
- Description "Build tools found:"
- QUIET_ON_EMPTY)
- feature_summary(WHAT BUILD_PACKAGES_NOT_FOUND
- Description "Build tools not found:"
- QUIET_ON_EMPTY)
+ include(FeatureSummary)
+ set_property(GLOBAL APPEND PROPERTY FeatureSummary_PKG_TYPES BUILD)
+ find_package(FOO)
+ set_package_properties(FOO PROPERTIES TYPE BUILD)
+ feature_summary(WHAT BUILD_PACKAGES_FOUND
+ DESCRIPTION "Build tools found:"
+ QUIET_ON_EMPTY)
+ feature_summary(WHAT BUILD_PACKAGES_NOT_FOUND
+ DESCRIPTION "Build tools not found:"
+ QUIET_ON_EMPTY)
#]=======================================================================]
function(FEATURE_SUMMARY)
-# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+# cmake_parse_arguments(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
set(options APPEND
INCLUDE_QUIET_PACKAGES
FATAL_ON_MISSING_REQUIRED_PACKAGES
@@ -334,7 +369,7 @@ function(FEATURE_SUMMARY)
DESCRIPTION)
set(multiValueArgs WHAT)
- CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
+ cmake_parse_arguments(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
if(_FS_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to FEATURE_SUMMARY(): \"${_FS_UNPARSED_ARGUMENTS}\"")
@@ -469,28 +504,32 @@ endfunction()
#[=======================================================================[.rst:
.. command:: set_package_properties
- ::
+ .. code-block:: cmake
set_package_properties(<name> PROPERTIES
- [ URL <url> ]
- [ DESCRIPTION <description> ]
- [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
- [ PURPOSE <purpose> ]
+ [URL <url>]
+ [DESCRIPTION <description>]
+ [TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED)]
+ [PURPOSE <purpose>]
)
- Use this macro to set up information about the named package, which
- can then be displayed via FEATURE_SUMMARY(). This can be done either
- directly in the Find-module or in the project which uses the module
- after the find_package() call. The features for which information can
- be set are added automatically by the find_package() command.
+ Use this function to configure and provide information about the package named
+ ``<name>``, which can then be displayed using the
+ :command:`feature_summary()` command. This can be performed either directly
+ within the corresponding :ref:`Find module <Find Modules>` or in the project
+ that uses the module after invoking the :command:`find_package()` call. The
+ features for which information can be set are determined automatically after
+ the :command:`find_package()` command.
``URL <url>``
This should be the homepage of the package, or something similar.
- Ideally this is set already directly in the Find-module.
+ Ideally this is set already directly in the
+ :ref:`Find module <Find Modules>`.
``DESCRIPTION <description>``
A short description what that package is, at most one sentence.
- Ideally this is set already directly in the Find-module.
+ Ideally this is set already directly in the
+ :ref:`Find module <Find Modules>`.
``TYPE <type>``
What type of dependency has the using project on that package.
@@ -500,36 +539,38 @@ endfunction()
the package is not present, but the functionality of the resulting
binaries will be severely limited. If a ``REQUIRED`` package is not
available at buildtime, the project may not even build. This can be
- combined with the ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` argument for
- ``feature_summary()``. Last, a ``RUNTIME`` package is a package which is
- actually not used at all during the build, but which is required for
- actually running the resulting binaries. So if such a package is
+ combined with the
+ :command:`feature_summary(FATAL_ON_MISSING_REQUIRED_PACKAGES)` command
+ option. Last, a ``RUNTIME`` package is a package which is actually not used
+ at all during the build, but which is required for actually running the
+ resulting binaries. So if such a package is
missing, the project can still be built, but it may not work later on.
If ``set_package_properties()`` is called multiple times for the same
package with different TYPEs, the ``TYPE`` is only changed to higher
TYPEs (``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``), lower TYPEs are
ignored. The ``TYPE`` property is project-specific, so it cannot be set
- by the Find-module, but must be set in the project.
- Type accepted can be changed by setting the
+ by the :ref:`Find module <Find Modules>`, but must be set in the project.
+ The accepted types can be changed by setting the
:variable:`FeatureSummary_PKG_TYPES` global property.
``PURPOSE <purpose>``
This describes which features this package enables in the
- project, i.e. it tells the user what functionality he gets in the
- resulting binaries. If set_package_properties() is called multiple
- times for a package, all PURPOSE properties are appended to a list of
- purposes of the package in the project. As the TYPE property, also
- the PURPOSE property is project-specific, so it cannot be set by the
- Find-module, but must be set in the project.
+ project, i.e. it tells the user what functionality they get in the
+ resulting binaries. If ``set_package_properties()`` is called multiple
+ times for a package, all ``PURPOSE`` properties are appended to a list of
+ purposes of the package in the project. As the ``TYPE`` property, also
+ the ``PURPOSE`` property is project-specific, so it cannot be set by the
+ :ref:`Find module <Find Modules>`, but must be set in the project.
Example for setting the info for a package:
.. code-block:: cmake
+ include(FeatureSummary)
find_package(LibXml2)
set_package_properties(LibXml2 PROPERTIES
- DESCRIPTION "A XML processing library."
- URL "http://xmlsoft.org/")
+ DESCRIPTION "XML library"
+ URL "http://xmlsoft.org")
# or
set_package_properties(LibXml2 PROPERTIES
TYPE RECOMMENDED
@@ -553,7 +594,7 @@ function(SET_PACKAGE_PROPERTIES _name _props)
set(oneValueArgs DESCRIPTION URL TYPE PURPOSE )
set(multiValueArgs ) # none
- CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(_SPP_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"")
@@ -613,37 +654,86 @@ endfunction()
#[=======================================================================[.rst:
.. command:: add_feature_info
- ::
+ .. code-block:: cmake
add_feature_info(<name> <enabled> <description>)
- Use this macro to add information about a feature with the given ``<name>``.
- ``<enabled>`` contains whether this feature is enabled or not. It can be a
- variable or a list of conditions.
+ Use this function to add information about a feature identified with a given
+ ``<name>``. The ``<enabled>`` contains whether this feature is enabled or
+ not. It can be a variable or a list of conditions.
``<description>`` is a text describing the feature. The information can
- be displayed using ``feature_summary()`` for ``ENABLED_FEATURES`` and
+ be displayed using :command:`feature_summary()` for ``ENABLED_FEATURES`` and
``DISABLED_FEATURES`` respectively.
.. versionchanged:: 3.8
``<enabled>`` can be a list of conditions.
+ .. versionchanged:: 4.0
+ Full :ref:`Condition Syntax` is now supported for ``<enabled>``.
+ See policy :policy:`CMP0183`.
+
Example for setting the info for a feature:
.. code-block:: cmake
- option(WITH_FOO "Help for foo" ON)
- add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
+ include(FeatureSummary)
+
+ option(WITH_FOO "Help for foo" ON)
+ add_feature_info(Foo WITH_FOO "this feature provides very cool stuff")
+
+ Example for setting feature info based on a list of conditions:
+
+ .. code-block:: cmake
+
+ option(WITH_FOO "Help for foo" ON)
+ option(WITH_BAR "Help for bar" OFF)
+ add_feature_info(
+ FooBar
+ "WITH_FOO;NOT WITH_BAR"
+ "this feature is enabled when WITH_FOO is ON and WITH_BAR turned OFF"
+ )
+
+ Example for setting feature info depending on a full condition syntax:
+
+ Unlike semicolon-separated list of conditions, this enables using entire
+ condition syntax as being the ``if`` clause argument, such as grouping
+ conditions with parens and similar.
+
+ .. code-block:: cmake
+
+ option(WITH_FOO "Help for foo" ON)
+ option(WITH_BAR "Help for bar" ON)
+ option(WITH_BAZ "Help for baz" OFF)
+ add_feature_info(
+ FooBarBaz
+ "WITH_FOO AND (WITH_BAR OR WITH_BAZ)"
+ "this feature is enabled when the entire condition is true"
+ )
#]=======================================================================]
function(ADD_FEATURE_INFO _name _depends _desc)
+ cmake_policy(GET CMP0183 _CDO_CMP0183
+ PARENT_SCOPE # undocumented, do not use outside of CMake
+ )
set(_enabled 1)
- foreach(_d ${_depends})
- string(REGEX REPLACE " +" ";" _d "${_d}")
- if(${_d})
- else()
- set(_enabled 0)
- break()
- endif()
- endforeach()
+ if("x${_CDO_CMP0183}x" STREQUAL "xNEWx")
+ foreach(_d ${_depends})
+ cmake_language(EVAL CODE "
+ if(${_d})
+ else()
+ set(_enabled 0)
+ endif()"
+ )
+ endforeach()
+ else()
+ foreach(_d ${_depends})
+ string(REGEX REPLACE " +" ";" _d "${_d}")
+ if(${_d})
+ else()
+ set(_enabled 0)
+ break()
+ endif()
+ endforeach()
+ endif()
if (${_enabled})
set_property(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
else ()
@@ -651,29 +741,41 @@ function(ADD_FEATURE_INFO _name _depends _desc)
endif ()
set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
+
+ if("x${_CDO_CMP0183}x" STREQUAL "xx" AND "x${_depends}x" MATCHES "[^A-Za-z0-9_.; ]")
+ cmake_policy(GET_WARNING CMP0183 _CDO_CMP0183_WARNING)
+ message(AUTHOR_WARNING "${_CDO_CMP0183_WARNING}")
+ endif()
+ unset(_CDO_CMP0183)
endfunction()
# The stuff below is only kept for compatibility
#[=======================================================================[.rst:
-Legacy Macros
-^^^^^^^^^^^^^
+Deprecated Functions
+^^^^^^^^^^^^^^^^^^^^
-The following macros are provided for compatibility with previous
-CMake versions:
+The following legacy and deprecated functions are provided for backward
+compatibility with previous CMake versions:
.. command:: set_package_info
- ::
+ .. deprecated:: 3.8
+
+ .. code-block:: cmake
set_package_info(<name> <description> [ <url> [<purpose>] ])
- Use this macro to set up information about the named package, which
- can then be displayed via ``feature_summary()``. This can be done either
- directly in the Find-module or in the project which uses the module
- after the :command:`find_package` call. The features for which information
- can be set are added automatically by the ``find_package()`` command.
+ Set up information about the package ``<name>``, which can then be displayed
+ via :command:`feature_summary()`. This can be done either directly in the
+ :ref:`Find module <Find Modules>` or in the project which uses the
+ ``FeatureSummary`` module after the :command:`find_package()` call. The
+ features for which information can be set are added automatically by the
+ ``find_package()`` command.
+
+ This function is deprecated. Use the :command:`set_package_properties()`, and
+ :command:`add_feature_info()` functions instead.
#]=======================================================================]
function(SET_PACKAGE_INFO _name _desc)
message(DEPRECATION "SET_PACKAGE_INFO is deprecated. Use SET_PACKAGE_PROPERTIES instead.")
@@ -697,27 +799,33 @@ endfunction()
#[=======================================================================[.rst:
.. command:: set_feature_info
- ::
+ .. deprecated:: 3.8
+
+ .. code-block:: cmake
set_feature_info(<name> <description> [<url>])
- Does the same as::
+ Does the same as:
+
+ .. code-block:: cmake
- set_package_info(<name> <description> <url>)
+ set_package_info(<name> <description> [<url>])
#]=======================================================================]
function(SET_FEATURE_INFO)
message(DEPRECATION "SET_FEATURE_INFO is deprecated. Use ADD_FEATURE_INFO instead.")
- SET_PACKAGE_INFO(${ARGN})
+ set_package_info(${ARGN})
endfunction()
#[=======================================================================[.rst:
.. command:: print_enabled_features
- ::
+ .. deprecated:: 3.8
+
+ .. code-block:: cmake
print_enabled_features()
- Does the same as
+ Does the same as:
.. code-block:: cmake
@@ -726,17 +834,19 @@ endfunction()
function(PRINT_ENABLED_FEATURES)
message(DEPRECATION "PRINT_ENABLED_FEATURES is deprecated. Use
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION \"Enabled features:\")")
- FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
+ feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
endfunction()
#[=======================================================================[.rst:
.. command:: print_disabled_features
- ::
+ .. deprecated:: 3.8
+
+ .. code-block:: cmake
print_disabled_features()
- Does the same as
+ Does the same as:
.. code-block:: cmake
@@ -745,5 +855,5 @@ endfunction()
function(PRINT_DISABLED_FEATURES)
message(DEPRECATION "PRINT_DISABLED_FEATURES is deprecated. Use
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION \"Disabled features:\")")
- FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
+ feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
endfunction()
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 8488c12..2088549 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FetchContent
diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in
index 8adb533..8fef8c2 100644
--- a/Modules/FetchContent/CMakeLists.cmake.in
+++ b/Modules/FetchContent/CMakeLists.cmake.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION @CMAKE_VERSION@)
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index e332c14..0b7670f 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindALSA
@@ -9,7 +9,7 @@ Find Advanced Linux Sound Architecture (ALSA)
Find the alsa libraries (``asound``)
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
@@ -61,8 +61,8 @@ if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
unset(alsa_version_str)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ALSA
REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
VERSION_VAR ALSA_VERSION_STRING)
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
index c2d29e2..10d61ac 100644
--- a/Modules/FindASPELL.cmake
+++ b/Modules/FindASPELL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindASPELL
@@ -26,7 +26,7 @@ find_program(ASPELL_EXECUTABLE
find_library(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR ASPELL_EXECUTABLE)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR ASPELL_EXECUTABLE)
mark_as_advanced(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES ASPELL_EXECUTABLE)
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index 9763e1f..4798c34 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindAVIFile
@@ -28,8 +28,8 @@ if (UNIX)
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
if (AVIFILE_FOUND)
set(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY})
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index 8faa653..1cde7de 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindArmadillo
@@ -13,7 +13,7 @@ Armadillo is a library for linear algebra & scientific computing.
Using Armadillo:
-::
+.. code-block:: cmake
find_package(Armadillo REQUIRED)
include_directories(${ARMADILLO_INCLUDE_DIRS})
@@ -81,7 +81,7 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
string(REGEX MATCH "ARMA_USE_HDF5" _ARMA_USE_HDF5 "${_ARMA_CONFIG_CONTENTS}")
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# If _ARMA_USE_WRAPPER is set, then we just link to armadillo, but if it's not then we need support libraries instead
set(_ARMA_SUPPORT_LIBRARIES)
@@ -99,8 +99,13 @@ if(_ARMA_USE_WRAPPER)
mark_as_advanced(ARMADILLO_LIBRARY)
set(_ARMA_REQUIRED_VARS ARMADILLO_LIBRARY)
else()
- # Link directly to individual components.
set(ARMADILLO_LIBRARY "")
+endif()
+
+# Transitive linking with the wrapper does not work with MSVC,
+# so we must *also* link against Armadillo's dependencies.
+if(NOT _ARMA_USE_WRAPPER OR MSVC)
+ # Link directly to individual components.
foreach(pkg
LAPACK
BLAS
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 3515bf0..cbda5cd 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindBISON
@@ -9,30 +9,35 @@ Find ``bison`` executable and provide a macro to generate custom build rules.
The module defines the following variables:
+``BISON_FOUND``
+ True if the program was found.
+
``BISON_EXECUTABLE``
- path to the ``bison`` program
+ The path to the ``bison`` program.
``BISON_VERSION``
- version of ``bison``
-
-``BISON_FOUND``
- "True" if the program was found
+ The version of ``bison``.
The minimum required version of ``bison`` can be specified using the
-standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`.
+standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`.
+
+If ``bison`` is found, the module defines the macro:
-If ``bison`` is found, the module defines the macro::
+.. command:: bison_target
- BISON_TARGET(<Name> <YaccInput> <CodeOutput>
- [COMPILE_FLAGS <flags>]
- [DEFINES_FILE <file>]
- [VERBOSE [<file>]]
- [REPORT_FILE <file>]
- )
+ .. code-block:: cmake
+
+ bison_target(<Name> <YaccInput> <CodeOutput>
+ [OPTIONS <options>...]
+ [COMPILE_FLAGS <string>]
+ [DEFINES_FILE <file>]
+ [VERBOSE [<file>]]
+ [REPORT_FILE <file>]
+ )
which will create a custom rule to generate a parser. ``<YaccInput>`` is
the path to a yacc file. ``<CodeOutput>`` is the name of the source file
-generated by bison. A header file is also be generated, and contains
+generated by bison. A header file can also be generated, and contains
the token list.
.. versionchanged:: 3.14
@@ -41,8 +46,18 @@ the token list.
The options are:
-``COMPILE_FLAGS <flags>``
- Specify flags to be added to the ``bison`` command line.
+``OPTIONS <options>...``
+ .. versionadded:: 4.0
+
+ A :ref:`semicolon-separated list <CMake Language Lists>` of options added to
+ the ``bison`` command line.
+
+``COMPILE_FLAGS <string>``
+ .. deprecated:: 4.0
+
+ Space-separated bison options added to the ``bison`` command line.
+ A :ref:`;-list <CMake Language Lists>` will not work.
+ This option is deprecated in favor of ``OPTIONS <options>...``.
``DEFINES_FILE <file>``
.. versionadded:: 3.4
@@ -65,31 +80,64 @@ The options are:
The macro defines the following variables:
``BISON_<Name>_DEFINED``
- ``True`` is the macro ran successfully
+ True if the macro ran successfully.
``BISON_<Name>_INPUT``
- The input source file, an alias for <YaccInput>
+ The input source file, an alias for ``<YaccInput>``.
``BISON_<Name>_OUTPUT_SOURCE``
- The source file generated by bison
+ The source file generated by ``bison``.
``BISON_<Name>_OUTPUT_HEADER``
- The header file generated by bison
+ The header file generated by ``bison``.
``BISON_<Name>_OUTPUTS``
- All files generated by bison including the source, the header and the report
+ All files generated by ``bison`` including the source, the header and the
+ report.
+
+``BISON_<Name>_OPTIONS``
+ .. versionadded:: 4.0
+
+ Options used in the ``bison`` command line.
``BISON_<Name>_COMPILE_FLAGS``
- Options used in the ``bison`` command line
+ .. deprecated:: 4.0
+
+ Options used in the ``bison`` command line. This variable is deprecated in
+ favor of ``BISON_<Name>_OPTIONS`` variable.
-Example usage:
+Examples
+^^^^^^^^
.. code-block:: cmake
find_package(BISON)
- BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
+ bison_target(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h)
add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+
+Adding additional command-line options to the ``bison`` executable can be passed
+as a list. For example, adding the ``-Wall`` option to report all warnings, and
+``--no-lines`` (``-l``) to not generate ``#line`` directives.
+
+.. code-block:: cmake
+
+ find_package(BISON)
+
+ if(BISON_FOUND)
+ bison_target(MyParser parser.y parser.cpp OPTIONS -Wall --no-lines)
+ endif()
+
+Generator expressions can be used in ``OPTIONS <options...``. For example, to
+add the ``--debug`` (``-t``) option only for the ``Debug`` build type:
+
+.. code-block:: cmake
+
+ find_package(BISON)
+
+ if(BISON_FOUND)
+ bison_target(MyParser parser.y parser.cpp OPTIONS $<$<CONFIG:Debug>:-t>)
+ endif()
#]=======================================================================]
find_program(BISON_EXECUTABLE NAMES bison win-bison win_bison DOC "path to the bison executable")
@@ -229,6 +277,7 @@ if(BISON_EXECUTABLE)
REPORT_FILE
)
set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS
+ OPTIONS
VERBOSE
)
cmake_parse_arguments(
@@ -247,6 +296,11 @@ if(BISON_EXECUTABLE)
else()
BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}")
+
+ if(BISON_TARGET_ARG_OPTIONS)
+ list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_ARG_OPTIONS})
+ endif()
+
BISON_TARGET_option_defines("${BisonOutput}" "${BISON_TARGET_ARG_DEFINES_FILE}")
BISON_TARGET_option_report_file("${BisonOutput}" "${BISON_TARGET_ARG_REPORT_FILE}")
if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "")
@@ -276,12 +330,33 @@ if(BISON_EXECUTABLE)
endif()
unset(_BISON_CMP0088)
+ # Bison cannot create output directories. Create any missing determined
+ # directories where the files will be generated if they don't exist yet.
+ set(_BisonMakeDirectoryCommand "")
+ foreach(output IN LISTS BISON_TARGET_outputs)
+ cmake_path(GET output PARENT_PATH dir)
+ if(dir)
+ list(APPEND _BisonMakeDirectoryCommand ${dir})
+ endif()
+ unset(dir)
+ endforeach()
+ if(_BisonMakeDirectoryCommand)
+ list(REMOVE_DUPLICATES _BisonMakeDirectoryCommand)
+ list(
+ PREPEND
+ _BisonMakeDirectoryCommand
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ )
+ endif()
+
add_custom_command(OUTPUT ${BISON_TARGET_outputs}
+ ${_BisonMakeDirectoryCommand}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${_BisonInput}
VERBATIM
DEPENDS ${_BisonInput}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
- WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY})
+ WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY}
+ COMMAND_EXPAND_LISTS)
unset(_BISON_WORKING_DIRECTORY)
@@ -289,12 +364,13 @@ if(BISON_EXECUTABLE)
set(BISON_${Name}_DEFINED TRUE)
set(BISON_${Name}_INPUT ${_BisonInput})
set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs})
+ set(BISON_${Name}_OPTIONS ${BISON_TARGET_cmdopt})
set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}")
unset(_BisonInput)
-
+ unset(_BisonMakeDirectoryCommand)
endif()
endmacro()
#
@@ -302,6 +378,6 @@ if(BISON_EXECUTABLE)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(BISON REQUIRED_VARS BISON_EXECUTABLE
VERSION_VAR BISON_VERSION)
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 0bbd5a8..53d74bc 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindBLAS
@@ -54,7 +54,7 @@ The following variables may be set to influence this module's behavior:
Search for any BLAS/LAPACK.
Most likely, a BLAS/LAPACK with 32-bit integer interfaces will be found.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
@@ -286,7 +286,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
else()
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if(BLA_PREFER_PKGCONFIG)
if(NOT BLA_PKGCONFIG_BLAS)
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index a04251c..b214f30 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindBZip2
@@ -7,7 +7,7 @@ FindBZip2
Try to find BZip2
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
@@ -73,7 +73,7 @@ if (NOT BZIP2_LIBRARIES)
find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d libbz2d libbzip2d NAMES_PER_DIR ${_BZIP2_PATHS} PATH_SUFFIXES lib)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
- SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
+ select_library_configurations(BZIP2)
else ()
file(TO_CMAKE_PATH "${BZIP2_LIBRARIES}" BZIP2_LIBRARIES)
endif ()
@@ -84,8 +84,8 @@ if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
set(BZIP2_VERSION ${BZIP2_VERSION_STRING})
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(BZip2
REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR
VERSION_VAR BZIP2_VERSION)
@@ -97,7 +97,7 @@ if (BZIP2_FOUND)
set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY})
set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES})
- CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX)
+ check_symbol_exists(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX)
cmake_pop_check_state()
if(NOT TARGET BZip2::BZip2)
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index 4d3186c..ca768f9 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindBacktrace
@@ -28,7 +28,9 @@ The following cache variables are also available to set or use:
The directory holding the ``backtrace(3)`` header.
Typical usage is to generate of header file using :command:`configure_file`
-with the contents like the following::
+with the contents like the following:
+
+.. code-block:: c
#cmakedefine01 Backtrace_FOUND
#if Backtrace_FOUND
@@ -51,16 +53,16 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
include(CMakePushCheckState)
include(CheckSymbolExists)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# List of variables to be provided to find_package_handle_standard_args()
set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR)
if(Backtrace_HEADER)
set(_Backtrace_HEADER_TRY "${Backtrace_HEADER}")
-else(Backtrace_HEADER)
+else()
set(_Backtrace_HEADER_TRY "execinfo.h")
-endif(Backtrace_HEADER)
+endif()
find_path(Backtrace_INCLUDE_DIR "${_Backtrace_HEADER_TRY}")
set(Backtrace_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
@@ -98,7 +100,7 @@ endif()
set(Backtrace_LIBRARIES ${Backtrace_LIBRARY})
set(Backtrace_HEADER "${_Backtrace_HEADER_TRY}" CACHE STRING "Header providing backtrace(3) facility")
-find_package_handle_standard_args(Backtrace FOUND_VAR Backtrace_FOUND REQUIRED_VARS ${_Backtrace_STD_ARGS})
+find_package_handle_standard_args(Backtrace REQUIRED_VARS ${_Backtrace_STD_ARGS})
mark_as_advanced(Backtrace_HEADER Backtrace_INCLUDE_DIR Backtrace_LIBRARY)
if(Backtrace_FOUND AND NOT TARGET Backtrace::Backtrace)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 39ddfbe..7436336 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindBoost
@@ -396,11 +396,10 @@ endif()
# The FPHSA helper provides standard way of reporting final search results to
# the user including the version and component checks.
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# Save project's policies
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>
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
index 6d64185..f9250ae 100644
--- a/Modules/FindBullet.cmake
+++ b/Modules/FindBullet.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindBullet
@@ -79,8 +79,8 @@ _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody)
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_Debug BulletSoftBody_d)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Bullet DEFAULT_MSG
BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
BULLET_SOFTBODY_LIBRARY BULLET_INCLUDE_DIR)
diff --git a/Modules/FindCABLE.cmake b/Modules/FindCABLE.cmake
index 1f4ae76..4d72897 100644
--- a/Modules/FindCABLE.cmake
+++ b/Modules/FindCABLE.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCABLE
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 73cac25..4323fda 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -308,9 +308,11 @@ Values for ``target_CUDA_architecture``:
Returns list of flags to be added to ``CUDA_NVCC_FLAGS`` in ``<out_variable>``.
Additionally, sets ``<out_variable>_readable`` to the resulting numeric list.
-Example::
+Example:
- cuda_select_nvcc_arch_flags(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
+.. code-block:: cmake
+
+ cuda_select_nvcc_arch_flags(ARCH_FLAGS "3.0" "3.5+PTX" "5.2(5.0)" "Maxwell")
list(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA.
@@ -888,7 +890,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
endif ()
if(CMAKE_CROSSCOMPILING)
- SET (CUDA_TOOLKIT_ROOT $ENV{CUDA_TOOLKIT_ROOT})
+ set(CUDA_TOOLKIT_ROOT $ENV{CUDA_TOOLKIT_ROOT})
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
# Support for NVPACK
set (CUDA_TOOLKIT_TARGET_NAMES "armv7-linux-androideabi")
@@ -903,13 +905,13 @@ if(CMAKE_CROSSCOMPILING)
set(CUDA_TOOLKIT_TARGET_NAMES "aarch64-qnx")
else()
set(CUDA_TOOLKIT_TARGET_NAMES "aarch64-linux" "sbsa-linux")
- endif (ANDROID_ARCH_NAME STREQUAL "arm64")
+ endif()
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)
+ set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT} CACHE PATH "Toolkit location." FORCE)
mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
break()
endif()
@@ -929,7 +931,7 @@ else()
macro( cuda_find_host_program )
find_program( ${ARGN} )
endmacro()
- SET (CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR})
+ set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR})
endif()
@@ -1289,7 +1291,7 @@ set(CUDA_TOOLKIT_TARGET_DIR_INTERNAL "${CUDA_TOOLKIT_TARGET_DIR}" CACHE INTERNAL
set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL
"This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUDA
REQUIRED_VARS
@@ -1561,7 +1563,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(CUDA_NVCC_COMPILE_DEFINITIONS "${_dir_compile_defs}")
else()
# Append the include directories for this target via generator expression, which is
- # expanded by the FILE(GENERATE) call below. This generator expression captures all
+ # expanded by the file(GENERATE) call below. This generator expression captures all
# include dirs set by the user, whether via directory properties or target properties
list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>")
@@ -2007,7 +2009,7 @@ macro(CUDA_ADD_LIBRARY cuda_target)
${_cmake_options} ${_cuda_shared_flag}
OPTIONS ${_options} )
- # Compute the file name of the intermedate link file used for separable
+ # Compute the file name of the intermediate link file used for separable
# compilation.
CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME(link_file ${cuda_target} "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")
@@ -2057,7 +2059,7 @@ macro(CUDA_ADD_EXECUTABLE cuda_target)
# Create custom commands and targets for each file.
CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources} OPTIONS ${_options} )
- # Compute the file name of the intermedate link file used for separable
+ # Compute the file name of the intermediate link file used for separable
# compilation.
CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME(link_file ${cuda_target} "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")
diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake
index 626c8a2..25ceb49 100644
--- a/Modules/FindCUDA/parse_cubin.cmake
+++ b/Modules/FindCUDA/parse_cubin.cmake
@@ -107,5 +107,3 @@ if (NOT "${file_text}" STREQUAL "")
else()
# message("FOUND NO DEPENDS")
endif()
-
-
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index 17e12f8..32c5268 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -50,8 +50,6 @@
# generated_cubin_file:STRING=<> File to generate. This argument must be passed
# in if build_cubin is true.
-cmake_policy(PUSH)
-cmake_policy(SET CMP0007 NEW)
if(NOT generated_file)
message(FATAL_ERROR "You must specify generated_file on the command line")
endif()
@@ -302,5 +300,3 @@ if( build_cubin )
)
endif()
-
-cmake_policy(POP)
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
index 5fad337..f213c1a 100644
--- a/Modules/FindCUDA/select_compute_arch.cmake
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -12,7 +12,7 @@
# Additionally, sets ${out_variable}_readable to the resulting numeric list
# Example:
# CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
-# LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
+# list(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
#
# More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA
#
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 9406796..e161f2f 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCUDAToolkit
@@ -102,7 +102,7 @@ Options
If specified, the CUDA Toolkit is considered found only if the exact
``VERSION`` specified is recovered.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
An :ref:`imported target <Imported targets>` named ``CUDA::toolkit`` is provided.
@@ -782,13 +782,13 @@ else()
function(_CUDAToolkit_parse_version_file version_file)
if(version_file)
- file(READ "${version_file}" file_conents)
+ file(READ "${version_file}" file_contents)
cmake_path(GET version_file EXTENSION LAST_ONLY version_ext)
if(version_ext STREQUAL ".json")
- string(JSON cuda_version_info GET "${file_conents}" "cuda" "version")
+ string(JSON cuda_version_info GET "${file_contents}" "cuda" "version")
set(cuda_version_match_regex [=[([0-9]+)\.([0-9]+)\.([0-9]+)]=])
elseif(version_ext STREQUAL ".txt")
- set(cuda_version_info "${file_conents}")
+ set(cuda_version_info "${file_contents}")
set(cuda_version_match_regex [=[CUDA Version ([0-9]+)\.([0-9]+)\.([0-9]+)]=])
endif()
@@ -1066,7 +1066,7 @@ endif()
#-----------------------------------------------------------------------------
# Perform version comparison and validate all required variables are set.
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUDAToolkit
REQUIRED_VARS
CUDAToolkit_INCLUDE_DIRECTORIES
@@ -1215,7 +1215,7 @@ if(CUDAToolkit_FOUND)
# when CUDA language is disabled
if(NOT TARGET CUDA::cudart_static_deps)
add_library(CUDA::cudart_static_deps IMPORTED INTERFACE)
- if(UNIX AND (CMAKE_C_COMPILER OR CMAKE_CXX_COMPILER))
+ if(UNIX AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
find_package(Threads REQUIRED)
target_link_libraries(CUDA::cudart_static_deps INTERFACE Threads::Threads ${CMAKE_DL_LIBS})
endif()
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 5ce8a90..d4b4b6b 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCURL
@@ -18,7 +18,7 @@ Find the native CURL headers and libraries.
FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO
Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
@@ -40,8 +40,15 @@ This module defines the following variables:
``CURL_LIBRARIES``
List of libraries when using ``curl``.
+``CURL_VERSION``
+ .. versionadded:: 4.0
+
+ The version of ``curl`` found.
+ This supersedes ``CURL_VERSION_STRING``.
+
``CURL_VERSION_STRING``
The version of ``curl`` found.
+ Superseded by ``CURL_VERSION``.
.. versionadded:: 3.13
Debug and Release variants are found separately.
@@ -75,7 +82,7 @@ Hints
cmake_policy(PUSH)
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if(NOT CURL_NO_CURL_CMAKE)
# do a find package call to specifically look for the CMake version
@@ -147,7 +154,8 @@ if(CURL_INCLUDE_DIR)
if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
- string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
+ string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION "${curl_version_str}")
+ set(CURL_VERSION_STRING "${CURL_VERSION}")
unset(curl_version_str)
break()
endif()
@@ -202,7 +210,7 @@ endif()
find_package_handle_standard_args(CURL
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
- VERSION_VAR CURL_VERSION_STRING
+ VERSION_VAR CURL_VERSION
HANDLE_COMPONENTS)
if(CURL_FOUND)
@@ -239,9 +247,24 @@ if(CURL_FOUND)
IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}")
endif()
- if(CURL_USE_STATIC_LIBS AND MSVC)
- set_target_properties(CURL::libcurl PROPERTIES
- INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib")
+ if(PC_CURL_FOUND)
+ if(PC_CURL_LINK_LIBRARIES)
+ set_property(TARGET CURL::libcurl PROPERTY
+ INTERFACE_LINK_LIBRARIES "${PC_CURL_LINK_LIBRARIES}")
+ endif()
+ if(PC_CURL_LDFLAGS_OTHER)
+ set_property(TARGET CURL::libcurl PROPERTY
+ INTERFACE_LINK_OPTIONS "${PC_CURL_LDFLAGS_OTHER}")
+ endif()
+ if(PC_CURL_CFLAGS_OTHER)
+ set_property(TARGET CURL::libcurl PROPERTY
+ INTERFACE_COMPILE_OPTIONS "${PC_CURL_CFLAGS_OTHER}")
+ endif()
+ else()
+ if(CURL_USE_STATIC_LIBS AND MSVC)
+ set_target_properties(CURL::libcurl PROPERTIES
+ INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib")
+ endif()
endif()
endif()
diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake
index f819800..9ae6d8c 100644
--- a/Modules/FindCVS.cmake
+++ b/Modules/FindCVS.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCVS
@@ -16,7 +16,7 @@ The module defines the following variables:
Example usage:
-::
+.. code-block:: cmake
find_package(CVS)
if(CVS_FOUND)
@@ -69,5 +69,5 @@ mark_as_advanced(CVS_EXECUTABLE)
# Handle the QUIETLY and REQUIRED arguments and set CVS_FOUND to TRUE if
# all listed variables are TRUE
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CVS DEFAULT_MSG CVS_EXECUTABLE)
diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake
index 5910ad1..f517f3b 100644
--- a/Modules/FindCoin3D.cmake
+++ b/Modules/FindCoin3D.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCoin3D
@@ -71,7 +71,7 @@ else ()
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS)
mark_as_advanced(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES )
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index ceed009..c5355f1 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCups
@@ -10,7 +10,7 @@ Find the Common UNIX Printing System (CUPS).
Set ``CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE`` to ``TRUE`` if you need a version which
features this function (i.e. at least ``1.1.19``)
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.15
@@ -55,7 +55,7 @@ if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY})
# ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
- CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+ check_library_exists(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
cmake_pop_check_state()
endif ()
@@ -78,14 +78,14 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
endforeach()
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
+ find_package_handle_standard_args(Cups
REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR CUPS_HAS_IPP_DELETE_ATTRIBUTE
VERSION_VAR CUPS_VERSION_STRING)
else ()
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
+ find_package_handle_standard_args(Cups
REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR
VERSION_VAR CUPS_VERSION_STRING)
endif ()
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index bfa1d6f..b166e68 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCurses
@@ -104,11 +104,11 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
- CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
+ check_library_exists("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
- CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
+ check_library_exists("${CURSES_NCURSES_LIBRARY}"
wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
if( CURSES_NCURSES_HAS_WSYNCUP)
set(CURSES_USE_NCURSES TRUE)
@@ -158,9 +158,9 @@ if(CURSES_USE_NCURSES)
set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
endif()
- CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
+ check_library_exists("${CURSES_NCURSES_LIBRARY}"
cbreak "" CURSES_NCURSES_HAS_CBREAK)
- CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
+ check_library_exists("${CURSES_NCURSES_LIBRARY}"
nodelay "" CURSES_NCURSES_HAS_NODELAY)
if(NOT CURSES_NCURSES_HAS_CBREAK OR NOT CURSES_NCURSES_HAS_NODELAY)
find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}")
@@ -264,8 +264,8 @@ if(PKG_CONFIG_FOUND)
set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER})
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Curses DEFAULT_MSG
CURSES_LIBRARY CURSES_INCLUDE_PATH)
mark_as_advanced(
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index ceb6e29..8fd7285 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCxxTest
@@ -68,7 +68,9 @@ Module Commands
.. command:: cxxtest_add_test
- Create a CxxTest runner and adds it to the CTest testing suite::
+ Create a CxxTest runner and adds it to the CTest testing suite:
+
+ .. code-block:: cmake
CXXTEST_ADD_TEST(<test_name> <gen_source_file>
<input_files_to_testgen>...)
@@ -193,7 +195,7 @@ find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
PATHS ${CXXTEST_INCLUDE_DIR})
if(PYTHON_FOUND OR PERL_FOUND)
- include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ include(FindPackageHandleStandardArgs)
if(PYTHON_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON))
set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
@@ -204,13 +206,13 @@ if(PYTHON_FOUND OR PERL_FOUND)
else()
set(CXXTEST_TESTGEN_INTERPRETER ${Python_EXECUTABLE})
endif()
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
+ find_package_handle_standard_args(CxxTest DEFAULT_MSG
CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE)
elseif(PERL_FOUND)
set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
+ find_package_handle_standard_args(CxxTest DEFAULT_MSG
CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE)
endif()
diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake
index 5bbc802..30bed56 100644
--- a/Modules/FindCygwin.cmake
+++ b/Modules/FindCygwin.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCygwin
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
index 0154a05..4e0ff47 100644
--- a/Modules/FindDCMTK.cmake
+++ b/Modules/FindDCMTK.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindDCMTK
@@ -302,7 +302,7 @@ endif()
# Compatibility: This variable is deprecated
set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DCMTK
REQUIRED_VARS ${DCMTK_INCLUDE_DIR_NAMES} DCMTK_LIBRARIES
FAIL_MESSAGE "Please set DCMTK_DIR and re-run configure")
diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake
index fed50e1..96cce45 100644
--- a/Modules/FindDart.cmake
+++ b/Modules/FindDart.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindDart
@@ -35,7 +35,7 @@ find_path(DART_ROOT README.INSTALL
DOC "If you have Dart installed, where is it located?"
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Dart DEFAULT_MSG DART_ROOT)
mark_as_advanced(DART_ROOT)
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index 611d761..e012f91 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindDevIL
@@ -8,7 +8,7 @@ FindDevIL
This module locates the Developer's Image Library,
`DevIL <https://openil.sourceforge.net/>`_.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.21
@@ -64,7 +64,7 @@ This module sets:
# TODO: Add version support.
# Tested under Linux and Windows (MSVC)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_path(IL_INCLUDE_DIR il.h
PATH_SUFFIXES include IL
@@ -97,7 +97,7 @@ find_library(ILU_LIBRARIES
#message("ILU_LIBRARIES is ${ILU_LIBRARIES}")
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG
+find_package_handle_standard_args(DevIL DEFAULT_MSG
IL_LIBRARIES ILU_LIBRARIES
IL_INCLUDE_DIR)
# provide legacy variable for compatibility
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index 9903e37..41979ee 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindDoxygen
@@ -39,21 +39,22 @@ The following variables are defined by this module:
The version reported by ``doxygen --version``.
-.. versionadded:: 3.9
- The module defines ``IMPORTED`` targets for Doxygen and each component found.
- These can be used as part of custom commands, etc. and should be preferred over
- old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The
- following import targets are defined if their corresponding executable could be
- found (the component import targets will only be defined if that component was
- requested):
+Imported Targets
+^^^^^^^^^^^^^^^^
-::
+.. versionadded:: 3.9
- Doxygen::doxygen
- Doxygen::dot
- Doxygen::mscgen
- Doxygen::dia
+The module defines ``IMPORTED`` targets for Doxygen and each component found.
+These can be used as part of custom commands, etc. and should be preferred over
+old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The
+following import targets are defined if their corresponding executable could be
+found (the component import targets will only be defined if that component was
+requested):
+* ``Doxygen::doxygen``
+* ``Doxygen::dot``
+* ``Doxygen::mscgen``
+* ``Doxygen::dia``
Functions
^^^^^^^^^
@@ -69,7 +70,7 @@ Functions
ability to customize the Doxygen configuration used to build the
documentation.
- ::
+ .. code-block:: cmake
doxygen_add_docs(targetName
[filesOrDirs...]
@@ -231,94 +232,94 @@ options and will convert their associated CMake variable's contents into the
required form if set. CMake variables are named ``DOXYGEN_<name>`` for the
Doxygen settings specified here.
-::
-
- ABBREVIATE_BRIEF
- ALIASES
- CITE_BIB_FILES
- DIAFILE_DIRS
- DOTFILE_DIRS
- DOT_FONTPATH
- ENABLED_SECTIONS
- EXAMPLE_PATH
- EXAMPLE_PATTERNS
- EXCLUDE
- EXCLUDE_PATTERNS
- EXCLUDE_SYMBOLS
- EXPAND_AS_DEFINED
- EXTENSION_MAPPING
- EXTRA_PACKAGES
- EXTRA_SEARCH_MAPPINGS
- FILE_PATTERNS
- FILTER_PATTERNS
- FILTER_SOURCE_PATTERNS
- HTML_EXTRA_FILES
- HTML_EXTRA_STYLESHEET
- IGNORE_PREFIX
- IMAGE_PATH
- INCLUDE_FILE_PATTERNS
- INCLUDE_PATH
- INPUT
- LATEX_EXTRA_FILES
- LATEX_EXTRA_STYLESHEET
- MATHJAX_EXTENSIONS
- MSCFILE_DIRS
- PLANTUML_INCLUDE_PATH
- PREDEFINED
- QHP_CUST_FILTER_ATTRS
- QHP_SECT_FILTER_ATTRS
- STRIP_FROM_INC_PATH
- STRIP_FROM_PATH
- TAGFILES
- TCL_SUBST
+.. hlist::
+
+ - ``ABBREVIATE_BRIEF``
+ - ``ALIASES``
+ - ``CITE_BIB_FILES``
+ - ``DIAFILE_DIRS``
+ - ``DOTFILE_DIRS``
+ - ``DOT_FONTPATH``
+ - ``ENABLED_SECTIONS``
+ - ``EXAMPLE_PATH``
+ - ``EXAMPLE_PATTERNS``
+ - ``EXCLUDE``
+ - ``EXCLUDE_PATTERNS``
+ - ``EXCLUDE_SYMBOLS``
+ - ``EXPAND_AS_DEFINED``
+ - ``EXTENSION_MAPPING``
+ - ``EXTRA_PACKAGES``
+ - ``EXTRA_SEARCH_MAPPINGS``
+ - ``FILE_PATTERNS``
+ - ``FILTER_PATTERNS``
+ - ``FILTER_SOURCE_PATTERNS``
+ - ``HTML_EXTRA_FILES``
+ - ``HTML_EXTRA_STYLESHEET``
+ - ``IGNORE_PREFIX``
+ - ``IMAGE_PATH``
+ - ``INCLUDE_FILE_PATTERNS``
+ - ``INCLUDE_PATH``
+ - ``INPUT``
+ - ``LATEX_EXTRA_FILES``
+ - ``LATEX_EXTRA_STYLESHEET``
+ - ``MATHJAX_EXTENSIONS``
+ - ``MSCFILE_DIRS``
+ - ``PLANTUML_INCLUDE_PATH``
+ - ``PREDEFINED``
+ - ``QHP_CUST_FILTER_ATTRS``
+ - ``QHP_SECT_FILTER_ATTRS``
+ - ``STRIP_FROM_INC_PATH``
+ - ``STRIP_FROM_PATH``
+ - ``TAGFILES``
+ - ``TCL_SUBST``
The following single value Doxygen options will be quoted automatically
if they contain at least one space:
-::
-
- CHM_FILE
- DIA_PATH
- DOCBOOK_OUTPUT
- DOCSET_FEEDNAME
- DOCSET_PUBLISHER_NAME
- DOT_FONTNAME
- DOT_PATH
- EXTERNAL_SEARCH_ID
- FILE_VERSION_FILTER
- GENERATE_TAGFILE
- HHC_LOCATION
- HTML_FOOTER
- HTML_HEADER
- HTML_OUTPUT
- HTML_STYLESHEET
- INPUT_FILTER
- LATEX_FOOTER
- LATEX_HEADER
- LATEX_OUTPUT
- LAYOUT_FILE
- MAN_OUTPUT
- MAN_SUBDIR
- MATHJAX_CODEFILE
- MSCGEN_PATH
- OUTPUT_DIRECTORY
- PERL_PATH
- PLANTUML_JAR_PATH
- PROJECT_BRIEF
- PROJECT_LOGO
- PROJECT_NAME
- QCH_FILE
- QHG_LOCATION
- QHP_CUST_FILTER_NAME
- QHP_VIRTUAL_FOLDER
- RTF_EXTENSIONS_FILE
- RTF_OUTPUT
- RTF_STYLESHEET_FILE
- SEARCHDATA_FILE
- USE_MDFILE_AS_MAINPAGE
- WARN_FORMAT
- WARN_LOGFILE
- XML_OUTPUT
+.. hlist::
+
+ - ``CHM_FILE``
+ - ``DIA_PATH``
+ - ``DOCBOOK_OUTPUT``
+ - ``DOCSET_FEEDNAME``
+ - ``DOCSET_PUBLISHER_NAME``
+ - ``DOT_FONTNAME``
+ - ``DOT_PATH``
+ - ``EXTERNAL_SEARCH_ID``
+ - ``FILE_VERSION_FILTER``
+ - ``GENERATE_TAGFILE``
+ - ``HHC_LOCATION``
+ - ``HTML_FOOTER``
+ - ``HTML_HEADER``
+ - ``HTML_OUTPUT``
+ - ``HTML_STYLESHEET``
+ - ``INPUT_FILTER``
+ - ``LATEX_FOOTER``
+ - ``LATEX_HEADER``
+ - ``LATEX_OUTPUT``
+ - ``LAYOUT_FILE``
+ - ``MAN_OUTPUT``
+ - ``MAN_SUBDIR``
+ - ``MATHJAX_CODEFILE``
+ - ``MSCGEN_PATH``
+ - ``OUTPUT_DIRECTORY``
+ - ``PERL_PATH``
+ - ``PLANTUML_JAR_PATH``
+ - ``PROJECT_BRIEF``
+ - ``PROJECT_LOGO``
+ - ``PROJECT_NAME``
+ - ``QCH_FILE``
+ - ``QHG_LOCATION``
+ - ``QHP_CUST_FILTER_NAME``
+ - ``QHP_VIRTUAL_FOLDER``
+ - ``RTF_EXTENSIONS_FILE``
+ - ``RTF_OUTPUT``
+ - ``RTF_STYLESHEET_FILE``
+ - ``SEARCHDATA_FILE``
+ - ``USE_MDFILE_AS_MAINPAGE``
+ - ``WARN_FORMAT``
+ - ``WARN_LOGFILE``
+ - ``XML_OUTPUT``
.. versionadded:: 3.11
There are situations where it may be undesirable for a particular config option
@@ -400,10 +401,6 @@ Deprecated Hint Variables
#]=======================================================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0054 NEW) # quoted if arguments
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
# For backwards compatibility support
if(Doxygen_FIND_QUIETLY)
set(DOXYGEN_FIND_QUIETLY TRUE)
@@ -437,7 +434,7 @@ endif()
# or use something like homebrew.
# ============== End OSX stuff ================
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
#
# Find Doxygen...
@@ -743,7 +740,7 @@ if(TARGET Doxygen::doxygen)
endif()
# Write a do-not-edit header to files we are going to generate...
- set(_Doxygen_dne_header
+ set(_Doxygen_do_not_edit_header
[[
#
# DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE!
@@ -813,9 +810,9 @@ endif()
"Unexpected line format! Code review required!\nFault line: ${_Doxygen_param}")
endif()
endforeach()
- file(WRITE "${_doxyfile_defaults}" "${_Doxygen_dne_header}"
+ file(WRITE "${_doxyfile_defaults}" "${_Doxygen_do_not_edit_header}"
"${_doxyfile_defaults_contents}")
- file(WRITE "${_doxyfile_in}" "${_Doxygen_dne_header}"
+ file(WRITE "${_doxyfile_in}" "${_Doxygen_do_not_edit_header}"
"${_doxyfile_in_contents}")
# Ok, dumped defaults are not needed anymore...
@@ -823,7 +820,7 @@ endif()
unset(_Doxygen_param)
unset(_Doxygen_tpl_params)
- unset(_Doxygen_dne_header)
+ unset(_Doxygen_do_not_edit_header)
unset(_Doxygen_tpl)
endif()
@@ -1026,7 +1023,7 @@ doxygen_add_docs() for target ${targetName}")
"CMakeCache.txt"
)
- # Now bring in Doxgen's defaults for those things the project has not
+ # Now bring in Doxygen's defaults for those things the project has not
# already set and we have not provided above
include("${CMAKE_BINARY_DIR}/CMakeDoxygenDefaults.cmake" OPTIONAL)
@@ -1216,5 +1213,3 @@ doxygen_add_docs() for target ${targetName}")
endif()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 825b7a6..0dcf361 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindEXPAT
@@ -138,8 +138,8 @@ if(EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
endforeach()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(EXPAT
REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
VERSION_VAR EXPAT_VERSION_STRING)
diff --git a/Modules/FindEnvModules.cmake b/Modules/FindEnvModules.cmake
index 5337e4f..37901fc 100644
--- a/Modules/FindEnvModules.cmake
+++ b/Modules/FindEnvModules.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindEnvModules
@@ -241,7 +241,7 @@ function(env_module)
if(MOD_ARGS_RESULT_VARIABLE)
set(${MOD_ARGS_RESULT_VARIABLE} ${ret_var} PARENT_SCOPE)
endif()
-endfunction(env_module)
+endfunction()
#------------------------------------------------------------------------------
function(env_module_swap out_mod in_mod)
@@ -268,7 +268,6 @@ endfunction()
#------------------------------------------------------------------------------
function(env_module_list out_var)
- cmake_policy(SET CMP0007 NEW)
env_module(COMMAND -t list OUTPUT_VARIABLE tmp_out)
# Convert output into a CMake list
@@ -286,8 +285,6 @@ endfunction()
#------------------------------------------------------------------------------
function(env_module_avail)
- cmake_policy(SET CMP0007 NEW)
-
if(ARGC EQUAL 1)
set(mod_prefix)
set(out_var ${ARGV0})
@@ -331,5 +328,5 @@ find_program(EnvModules_COMMAND
PATH_SUFFIXES libexec
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EnvModules DEFAULT_MSG EnvModules_COMMAND)
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index e67e931..b7a6e5f 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -1,50 +1,69 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFLEX
--------
-Find Fast Lexical Analyzer (Flex) executable and provides a macro
-to generate custom build rules
+Find Fast Lexical Analyzer (Flex) executable and provide a macro
+to generate custom build rules.
+The module defines the following variables:
+``FLEX_FOUND``
+ True if ``flex`` executable is found.
-The module defines the following variables:
+``FLEX_EXECUTABLE``
+ The path to the ``flex`` executable.
+
+``FLEX_VERSION``
+ The version of ``flex``.
+
+``FLEX_LIBRARIES``
+ The ``flex`` libraries.
+
+``FLEX_INCLUDE_DIRS``
+ The path to the ``flex`` headers.
-::
+The minimum required version of ``flex`` can be specified using the
+standard CMake syntax, e.g. :command:`find_package(FLEX 2.5.13)`.
- FLEX_FOUND - True is flex executable is found
- FLEX_EXECUTABLE - the path to the flex executable
- FLEX_VERSION - the version of flex
- FLEX_LIBRARIES - The flex libraries
- FLEX_INCLUDE_DIRS - The path to the flex headers
+If ``flex`` is found on the system, the module defines the macro:
+.. command:: flex_target
+ .. code-block:: cmake
-The minimum required version of flex can be specified using the
-standard syntax, e.g. :command:`find_package(FLEX 2.5.13)`
+ flex_target(<Name> <FlexInput> <FlexOutput>
+ [OPTIONS <options>...]
+ [COMPILE_FLAGS <string>]
+ [DEFINES_FILE <string>]
+ )
+which creates a custom command to generate the ``<FlexOutput>`` file from
+the ``<FlexInput>`` file. ``<Name>`` is an alias used to get details of this
+custom command.
+The options are:
-If flex is found on the system, the module provides the macro:
+``OPTIONS <options>...``
+ .. versionadded:: 4.0
-::
+ A :ref:`semicolon-separated list <CMake Language Lists>` of flex options added
+ to the ``flex`` command line.
- FLEX_TARGET(Name FlexInput FlexOutput
- [COMPILE_FLAGS <string>]
- [DEFINES_FILE <string>]
- )
+``COMPILE_FLAGS <string>``
+ .. deprecated:: 4.0
-which creates a custom command to generate the ``FlexOutput`` file from
-the ``FlexInput`` file. Name is an alias used to get details of this custom
-command. If ``COMPILE_FLAGS`` option is specified, the next
-parameter is added to the flex command line.
+ Space-separated flex options added to the ``flex`` command line.
+ A :ref:`;-list <CMake Language Lists>` will not work.
+ This option is deprecated in favor of ``OPTIONS <options>...``.
-.. versionadded:: 3.5
- If flex is configured to
- output a header file, the ``DEFINES_FILE`` option may be used to specify its
- name.
+``DEFINES_FILE <string>``
+ .. versionadded:: 3.5
+
+ If flex is configured to output a header file, this option may be used to
+ specify its name.
.. versionchanged:: 3.17
When :policy:`CMP0098` is set to ``NEW``, ``flex`` runs in the
@@ -52,60 +71,79 @@ parameter is added to the flex command line.
The macro defines the following variables:
-::
+``FLEX_<Name>_DEFINED``
+ True if the macro ran successfully.
+
+``FLEX_<Name>_OUTPUTS``
+ The source file generated by the custom rule, an alias for ``<FlexOutput>``.
+
+``FLEX_<Name>_INPUT``
+ The flex source file, an alias for ``<FlexInput>``.
- FLEX_${Name}_DEFINED - true is the macro ran successfully
- FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
- alias for FlexOutput
- FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
- FLEX_${Name}_OUTPUT_HEADER - the header flex output, if any.
+``FLEX_<Name>_OUTPUT_HEADER``
+ The header flex output, if any.
+``FLEX_<Name>_OPTIONS``
+ .. versionadded:: 4.0
+ Options used in the ``flex`` command line.
Flex scanners often use tokens defined by Bison: the code generated
by Flex depends of the header generated by Bison. This module also
defines a macro:
-::
+.. command:: add_flex_bison_dependency
- ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
+ .. code-block:: cmake
-which adds the required dependency between a scanner and a parser
-where ``FlexTarget`` and ``BisonTarget`` are the first parameters of
-respectively ``FLEX_TARGET`` and ``BISON_TARGET`` macros.
+ add_flex_bison_dependency(<FlexTarget> <BisonTarget>)
-::
+which adds the required dependency between a scanner and a parser
+where ``<FlexTarget>`` and ``<BisonTarget>`` are the first parameters of
+respectively ``flex_target`` and ``bison_target`` macros.
- ====================================================================
- Example:
+Examples
+^^^^^^^^
+.. code-block:: cmake
+ find_package(BISON)
+ find_package(FLEX)
-::
+ bison_target(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
+ flex_target(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
+ add_flex_bison_dependency(MyScanner MyParser)
- find_package(BISON)
- find_package(FLEX)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ add_executable(Foo
+ Foo.cc
+ ${BISON_MyParser_OUTPUTS}
+ ${FLEX_MyScanner_OUTPUTS}
+ )
+ target_link_libraries(Foo ${FLEX_LIBRARIES})
+Adding additional command-line options to the ``flex`` executable can be passed
+as a list. For example, adding the ``--warn`` option to report warnings, and the
+``--noline`` (``-L``) to not generate ``#line`` directives.
+.. code-block:: cmake
-::
+ find_package(FLEX)
- BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
- FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
- ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
+ if(FLEX_FOUND)
+ flex_target(MyScanner lexer.l lexer.cpp OPTIONS --warn --noline)
+ endif()
+Generator expressions can be used in ``OPTIONS <options...``. For example, to
+add the ``--debug`` (``-d``) option only for the ``Debug`` build type:
+.. code-block:: cmake
-::
+ find_package(FLEX)
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
- add_executable(Foo
- Foo.cc
- ${BISON_MyParser_OUTPUTS}
- ${FLEX_MyScanner_OUTPUTS}
- )
- target_link_libraries(Foo ${FLEX_LIBRARIES})
- ====================================================================
+ if(FLEX_FOUND)
+ flex_target(MyScanner lexer.l lexer.cpp OPTIONS $<$<CONFIG:Debug>:--debug>)
+ endif()
#]=======================================================================]
find_program(FLEX_EXECUTABLE NAMES flex win-flex win_flex DOC "path to the flex executable")
@@ -157,20 +195,35 @@ if(FLEX_EXECUTABLE)
COMPILE_FLAGS
DEFINES_FILE
)
- set(FLEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS)
+ set(FLEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS OPTIONS)
cmake_parse_arguments(
FLEX_TARGET_ARG
"${FLEX_TARGET_PARAM_OPTIONS}"
"${FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS}"
- "${FLEX_TARGET_MULTI_VALUE_KEYWORDS}"
+ "${FLEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS}"
${ARGN}
)
- set(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>] [DEFINES_FILE <string>]")
+ string(
+ JOIN "\n" FLEX_TARGET_usage
+ "Usage:"
+ " flex_target("
+ " <Name>"
+ " <Input>"
+ " <Output>"
+ " [OPTIONS <options>...]"
+ " [COMPILE_FLAGS <string>]"
+ " [DEFINES_FILE <string>]"
+ " )"
+ )
if(NOT "${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
- message(SEND_ERROR ${FLEX_TARGET_usage})
+ message(
+ SEND_ERROR
+ "Unrecognized arguments: ${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}\n"
+ "${FLEX_TARGET_usage}"
+ )
else()
cmake_policy(GET CMP0098 _flex_CMP0098
@@ -199,6 +252,10 @@ if(FLEX_EXECUTABLE)
separate_arguments(_flex_EXE_OPTS)
endif()
+ if(FLEX_TARGET_ARG_OPTIONS)
+ list(APPEND _flex_EXE_OPTS ${FLEX_TARGET_ARG_OPTIONS})
+ endif()
+
set(_flex_OUTPUT_HEADER "")
if(NOT "${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
set(_flex_OUTPUT_HEADER "${FLEX_TARGET_ARG_DEFINES_FILE}")
@@ -211,29 +268,51 @@ if(FLEX_EXECUTABLE)
list(APPEND _flex_EXE_OPTS --header-file=${_flex_OUTPUT_HEADER_ABS})
endif()
+ # Flex cannot create output directories. Create any missing determined
+ # directories where the files will be generated if they don't exist yet.
+ set(_flex_MAKE_DIRECTORY_COMMAND "")
+ foreach(output IN LISTS _flex_TARGET_OUTPUTS)
+ cmake_path(GET output PARENT_PATH dir)
+ if(dir)
+ list(APPEND _flex_MAKE_DIRECTORY_COMMAND ${dir})
+ endif()
+ unset(dir)
+ endforeach()
+ if(_flex_MAKE_DIRECTORY_COMMAND)
+ list(REMOVE_DUPLICATES _flex_MAKE_DIRECTORY_COMMAND)
+ list(
+ PREPEND
+ _flex_MAKE_DIRECTORY_COMMAND
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ )
+ endif()
+
get_filename_component(_flex_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE)
add_custom_command(OUTPUT ${_flex_TARGET_OUTPUTS}
+ ${_flex_MAKE_DIRECTORY_COMMAND}
COMMAND ${FLEX_EXECUTABLE} ${_flex_EXE_OPTS} -o${_flex_OUTPUT} ${_flex_INPUT}
VERBATIM
DEPENDS ${_flex_INPUT}
COMMENT "[FLEX][${Name}] Building scanner with ${_flex_EXE_NAME_WE} ${FLEX_VERSION}"
- WORKING_DIRECTORY ${_flex_WORKING_DIR})
+ WORKING_DIRECTORY ${_flex_WORKING_DIR}
+ COMMAND_EXPAND_LISTS)
set(FLEX_${Name}_DEFINED TRUE)
set(FLEX_${Name}_OUTPUTS ${_flex_TARGET_OUTPUTS})
set(FLEX_${Name}_INPUT ${_flex_INPUT})
+ set(FLEX_${Name}_OPTIONS ${_flex_EXE_OPTS})
set(FLEX_${Name}_COMPILE_FLAGS ${_flex_EXE_OPTS})
set(FLEX_${Name}_OUTPUT_HEADER ${_flex_OUTPUT_HEADER})
unset(_flex_EXE_NAME_WE)
unset(_flex_EXE_OPTS)
unset(_flex_INPUT)
+ unset(_flex_MAKE_DIRECTORY_COMMAND)
unset(_flex_OUTPUT)
unset(_flex_OUTPUT_HEADER)
unset(_flex_OUTPUT_HEADER_ABS)
unset(_flex_TARGET_OUTPUTS)
unset(_flex_WORKING_DIR)
-
endif()
endmacro()
#============================================================
@@ -260,6 +339,6 @@ if(FLEX_EXECUTABLE)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FLEX REQUIRED_VARS FLEX_EXECUTABLE
VERSION_VAR FLEX_VERSION)
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index a245c6c..8305b65 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFLTK
@@ -187,10 +187,10 @@ if(FLTK_BUILT_WITH_CMAKE)
# Add the extra libraries
load_cache(${FLTK_DIR}
- READ_WITH_PREFIX
- FL FLTK_USE_SYSTEM_JPEG
- FL FLTK_USE_SYSTEM_PNG
- FL FLTK_USE_SYSTEM_ZLIB
+ READ_WITH_PREFIX FL
+ FLTK_USE_SYSTEM_JPEG
+ FLTK_USE_SYSTEM_PNG
+ FLTK_USE_SYSTEM_ZLIB
)
set(FLTK_IMAGES_LIBS "")
@@ -322,11 +322,11 @@ if(NOT FLTK_SKIP_OPENGL)
endif()
list(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if(FLTK_SKIP_FLUID)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR)
+ find_package_handle_standard_args(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR)
else()
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR FLTK_FLUID_EXECUTABLE)
+ find_package_handle_standard_args(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR FLTK_FLUID_EXECUTABLE)
endif()
if(FLTK_FOUND)
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
index 2f6e41d..83c5d20 100644
--- a/Modules/FindFLTK2.cmake
+++ b/Modules/FindFLTK2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFLTK2
@@ -138,10 +138,10 @@ if(FLTK2_DIR)
# Add the extra libraries
load_cache(${FLTK2_DIR}
- READ_WITH_PREFIX
- FL FLTK2_USE_SYSTEM_JPEG
- FL FLTK2_USE_SYSTEM_PNG
- FL FLTK2_USE_SYSTEM_ZLIB
+ READ_WITH_PREFIX FL
+ FLTK2_USE_SYSTEM_JPEG
+ FLTK2_USE_SYSTEM_PNG
+ FLTK2_USE_SYSTEM_ZLIB
)
set(FLTK2_IMAGES_LIBS "")
diff --git a/Modules/FindFontconfig.cmake b/Modules/FindFontconfig.cmake
index 1cd84c1..a4546fd 100644
--- a/Modules/FindFontconfig.cmake
+++ b/Modules/FindFontconfig.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFontconfig
@@ -80,8 +80,6 @@ endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Fontconfig
- FOUND_VAR
- Fontconfig_FOUND
REQUIRED_VARS
Fontconfig_LIBRARY
Fontconfig_INCLUDE_DIR
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 6d0ed68..8a8e002 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFreetype
@@ -160,7 +160,7 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
endforeach()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Freetype
diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake
index e6c7f24..43ca395 100644
--- a/Modules/FindGCCXML.cmake
+++ b/Modules/FindGCCXML.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGCCXML
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index a9c5740..b952949 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGDAL
@@ -7,7 +7,13 @@ FindGDAL
Find Geospatial Data Abstraction Library (GDAL).
-IMPORTED Targets
+.. deprecated:: 4.0
+ GDAL 3.5 and above provide a ``GDALConfig.cmake`` package configuration file.
+ Call ``find_package(GDAL CONFIG)`` to find it directly and avoid using this
+ find module. For further details, see `GDAL's documentation on CMake
+ integration <https://gdal.org/en/latest/development/cmake.html>`_.
+
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.14
@@ -184,8 +190,20 @@ else ()
set(GDAL_VERSION GDAL_VERSION-NOTFOUND)
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL
+if (GDAL_FIND_VERSION VERSION_GREATER_EQUAL 3.5)
+ message(DEPRECATION
+ "The FindGDAL module is deprecated. "
+ "GDAL 3.5 and above provide a CMake package configuration file. "
+ "Since at least version ${GDAL_FIND_VERSION} is requested, this "
+ "project can be ported to find GDAL's CMake package directly:\n"
+ " find_package(GDAL CONFIG)\n"
+ "For further details, see:\n"
+ " https://gdal.org/en/latest/development/cmake.html\n"
+ )
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GDAL
VERSION_VAR GDAL_VERSION
REQUIRED_VARS GDAL_LIBRARY GDAL_INCLUDE_DIR)
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 9a11b88..81c5080 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGIF
@@ -7,7 +7,7 @@ FindGIF
This finds the Graphics Interchange Format (GIF) library (``giflib``)
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` target:
@@ -79,7 +79,7 @@ find_library(GIF_LIBRARY
if(GIF_INCLUDE_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
- CMAKE_PUSH_CHECK_STATE()
+ cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY})
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
@@ -93,7 +93,7 @@ if(GIF_INCLUDE_DIR)
set(GIF_VERSION "${_GIF_MAJ}.${_GIF_MIN}.${_GIF_REL}")
else()
# use UserData field to sniff version instead
- CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
+ check_struct_has_member(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
if(GIF_GifFileType_UserData)
set(GIF_VERSION 4)
else()
@@ -105,11 +105,11 @@ if(GIF_INCLUDE_DIR)
unset(_GIF_MIN)
unset(_GIF_REL)
unset(_GIF_DEFS)
- CMAKE_POP_CHECK_STATE()
+ cmake_pop_check_state()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
VERSION_VAR GIF_VERSION )
if(GIF_FOUND)
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index f6b7b1a..083217e 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGLEW
@@ -62,7 +62,7 @@ This module defines the following variables:
#]=======================================================================]
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
find_package(GLEW CONFIG QUIET)
diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake
index 9892805..8f1efe0 100644
--- a/Modules/FindGLU.cmake
+++ b/Modules/FindGLU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Use of this file is deprecated, and is here for backwards compatibility with CMake 1.4
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 613d315..3704e85 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGLUT
@@ -7,7 +7,7 @@ FindGLUT
Find OpenGL Utility Toolkit (GLUT) library and include files.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.1
@@ -65,7 +65,7 @@ The following variables may also be provided, for backwards compatibility:
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
@@ -165,7 +165,7 @@ else()
unset(_GLUT_glut_LIB_DIR)
endif()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
+find_package_handle_standard_args(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
if (GLUT_FOUND)
# Is -lXi and -lXmu required on all platforms that have it?
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 3bb9272..5714979 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGSL
@@ -62,7 +62,7 @@ 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)
+include(FindPackageHandleStandardArgs)
#=============================================================================
# If the user has provided ``GSL_ROOT_DIR``, use it! Choose items found
@@ -153,8 +153,6 @@ endif()
# handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE if all
# listed variables are TRUE
find_package_handle_standard_args( GSL
- FOUND_VAR
- GSL_FOUND
REQUIRED_VARS
GSL_INCLUDE_DIR
GSL_LIBRARY
diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake
index 552b19a..c10f0c8 100644
--- a/Modules/FindGTK.cmake
+++ b/Modules/FindGTK.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGTK
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index f91d2fd..7b1e8ab 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGTK2
@@ -915,7 +915,7 @@ endif()
set(_GTK2_did_we_find_everything true) # This gets set to GTK2_FOUND
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
@@ -924,7 +924,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
set(FPHSA_NAME_MISMATCHED 1)
if(_GTK2_component STREQUAL "gtk")
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
+ find_package_handle_standard_args(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
GTK2_GTK_LIBRARY
GTK2_GTK_INCLUDE_DIR
@@ -937,7 +937,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
GTK2_GLIB_LIBRARY
)
elseif(_GTK2_component STREQUAL "gtkmm")
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found."
+ find_package_handle_standard_args(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found."
GTK2_GTKMM_LIBRARY
GTK2_GTKMM_INCLUDE_DIR
GTK2_GTKMMCONFIG_INCLUDE_DIR
@@ -954,12 +954,12 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
FREETYPE_INCLUDE_DIR_freetype2
)
elseif(_GTK2_component STREQUAL "glade")
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
+ find_package_handle_standard_args(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
GTK2_GLADE_LIBRARY
GTK2_GLADE_INCLUDE_DIR
)
elseif(_GTK2_component STREQUAL "glademm")
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glademm library was not found."
+ find_package_handle_standard_args(GTK2_${_COMPONENT_UPPER} "The glademm library was not found."
GTK2_GLADEMM_LIBRARY
GTK2_GLADEMM_INCLUDE_DIR
GTK2_GLADEMMCONFIG_INCLUDE_DIR
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index c2128a9..83fbe3a 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGTest
@@ -10,7 +10,7 @@ Locate the Google C++ Testing Framework.
.. versionadded:: 3.20
Upstream ``GTestConfig.cmake`` is used if possible.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.20
@@ -77,7 +77,7 @@ The following cache variables may also be set:
Example usage
^^^^^^^^^^^^^
-::
+.. code-block:: cmake
enable_testing()
find_package(GTest REQUIRED)
@@ -191,7 +191,7 @@ endfunction()
#
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# first specifically look for the CMake version of GTest
find_package(GTest QUIET NO_MODULE)
@@ -199,7 +199,7 @@ find_package(GTest QUIET NO_MODULE)
# if we found the GTest cmake package then we are done, and
# can print what we found and return.
if(GTest_FOUND)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest HANDLE_COMPONENTS CONFIG_MODE)
+ find_package_handle_standard_args(GTest HANDLE_COMPONENTS CONFIG_MODE)
set(GTEST_LIBRARIES GTest::gtest)
set(GTEST_MAIN_LIBRARIES GTest::gtest_main)
@@ -270,7 +270,7 @@ else()
__gtest_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_maind)
endif()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
+find_package_handle_standard_args(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
if(GMOCK_LIBRARY AND GMOCK_MAIN_LIBRARY)
set(GMock_FOUND True)
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 99e2887..9aae486 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -1,61 +1,87 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGettext
-----------
-Find GNU gettext tools
+Find GNU gettext tools.
-This module looks for the GNU gettext tools. This module defines the
-following values:
+This module looks for the GNU gettext tools.
-::
+Result Variables
+^^^^^^^^^^^^^^^^
- GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
- GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
- GETTEXT_FOUND: True if gettext has been found.
- GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
+This module defines the following variables:
+``GETTEXT_FOUND``
+ True if gettext has been found.
+``GETTEXT_VERSION_STRING``
+ The version of gettext found.
-Additionally it provides the following macros:
+``GETTEXT_MSGMERGE_EXECUTABLE``
+ The full path to the msgmerge tool.
-GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
+``GETTEXT_MSGFMT_EXECUTABLE``
+ The full path to the msgfmt tool.
-::
+Functions
+^^^^^^^^^
- This will create a target "translations" which will convert the
- given input po files into the binary output mo file. If the
- ALL option is used, the translations will also be created when
- building the default target.
+This module provides several function.
-GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
-LANGUAGES <lang1> <lang2> ... )
+.. command:: gettext_create_translations
-::
+ .. code-block:: cmake
- Process the given pot file to mo files.
- If INSTALL_DESTINATION is given then automatically install rules will
- be created, the language subdirectory will be taken into account
- (by default use share/locale/).
- If ALL is specified, the pot file is processed when building the all target.
- It creates a custom target "potfile".
+ gettext_create_translations(<mofile> [ALL] <file>...)
-GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
-PO_FILES <po1> <po2> ... )
+ This will create a target "translations" which will convert the
+ given input .po files into the binary output .mo file. Options:
-::
+ ``ALL``
+ The translations will be created when building the default target.
- Process the given po files to mo files for the given language.
- If INSTALL_DESTINATION is given then automatically install rules will
- be created, the language subdirectory will be taken into account
- (by default use share/locale/).
- If ALL is specified, the po files are processed when building the all target.
- It creates a custom target "pofiles".
+.. command:: gettext_process_pot_file
+
+ .. code-block:: cmake
+
+ gettext_process_pot_file(<potfile> [ALL]
+ [INSTALL_DESTINATION <destdir>]
+ LANGUAGES <lang>...)
+
+ This function creates a custom target "potfile" which processes the given
+ .pot file to .mo files. Options:
+
+ ``ALL``
+ The .pot file will be processed when building the default target.
+
+ ``INSTALL_DESTINATION``
+ Install the results into the given directory (``share/locale/`` by
+ default). The language subdirectory will be taken into account.
+
+.. command:: gettext_process_po_files
+
+ .. code-block:: cmake
+
+ gettext_process_po_files(<lang> [ALL]
+ [INSTALL_DESTINATION <dir>]
+ PO_FILES <pofile>...)
+
+ This function creates a custom target "pofiles", which processes the given
+ .po files to .mo files for the given language. Options:
+
+ ``ALL``
+ The .po files will be processed when building the default target.
+
+ ``INSTALL_DESTINATION``
+ Install the results into the given directory (``share/locale/`` by
+ default). The language subdirectory will be taken into account .
.. versionadded:: 3.2
- If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
+ If you wish to use the Gettext runtime library (libintl), use
+ :module:`FindIntl`.
#]=======================================================================]
find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
@@ -77,8 +103,8 @@ if(GETTEXT_MSGMERGE_EXECUTABLE)
unset(msgmerge_namewe)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gettext
REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
VERSION_VAR GETTEXT_VERSION_STRING)
@@ -145,7 +171,7 @@ function(GETTEXT_PROCESS_POT_FILE _potFile)
set(_oneValueArgs INSTALL_DESTINATION)
set(_multiValueArgs LANGUAGES)
- CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
get_filename_component(_potName ${_potFile} NAME)
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
@@ -196,7 +222,7 @@ function(GETTEXT_PROCESS_PO_FILES _lang)
set(_multiValueArgs PO_FILES)
set(_gmoFiles)
- CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
get_filename_component(_name ${_current_PO_FILE} NAME)
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 08a386a..f0caf4e 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGit
@@ -124,7 +124,7 @@ if(GIT_EXECUTABLE)
unset(_findgit_role)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Git
REQUIRED_VARS GIT_EXECUTABLE
VERSION_VAR GIT_VERSION_STRING)
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index e4c42f3..2f1033b 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGnuTLS
@@ -7,7 +7,7 @@ FindGnuTLS
Find the GNU Transport Layer Security library (gnutls)
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.16
@@ -44,7 +44,7 @@ if (NOT WIN32)
# also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
+ pkg_check_modules(PC_GNUTLS QUIET gnutls)
endif()
set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
set(GNUTLS_VERSION ${PC_GNUTLS_VERSION})
@@ -66,8 +66,8 @@ find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GnuTLS
REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
VERSION_VAR GNUTLS_VERSION_STRING)
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index b4ea6ab..851f193 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -1,25 +1,25 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGnuplot
-----------
-this module looks for gnuplot
+This module looks for gnuplot.
+Result Variables
+^^^^^^^^^^^^^^^^
+``GNUPLOT_FOUND``
+ System has Gnuplot.
-Once done this will define
+``GNUPLOT_EXECUTABLE``
+ The Gnuplot executable.
-::
+``GNUPLOT_VERSION_STRING``
+ The version of Gnuplot found.
- GNUPLOT_FOUND - system has Gnuplot
- GNUPLOT_EXECUTABLE - the Gnuplot executable
- GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
-
-
-
-GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
+ .. note:: Version string detection will not work for old versions like 3.7.1.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
@@ -49,8 +49,8 @@ endif()
# for compatibility
set(GNUPLOT ${GNUPLOT_EXECUTABLE})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gnuplot
REQUIRED_VARS GNUPLOT_EXECUTABLE
VERSION_VAR GNUPLOT_VERSION_STRING)
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 242d36f..2f0c3c1 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindHDF5
@@ -155,7 +155,7 @@ 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)
+include(FindPackageHandleStandardArgs)
cmake_policy(PUSH)
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
@@ -481,15 +481,12 @@ function(_HDF5_select_imported_config target imported_conf)
message(STATUS "Start search through imported configurations in the following order: ${_preferred_confs}")
endif()
# Now find the first of these that is present in imported_conf
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW) # support IN_LISTS
foreach (_conf IN LISTS _preferred_confs)
if (${_conf} IN_LIST _imported_conf)
set(_imported_conf ${_conf})
break()
endif()
endforeach()
- cmake_policy(POP)
endif()
if(HDF5_FIND_DEBUG)
message(STATUS "Selected imported configuration: ${_imported_conf}")
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index ca09444..8644ab7 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindHSPELL
@@ -40,8 +40,8 @@ if (HSPELL_INCLUDE_DIR)
unset(HSPELL_H)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HSPELL
REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
VERSION_VAR HSPELL_VERSION_STRING)
diff --git a/Modules/FindHTMLHelp.cmake b/Modules/FindHTMLHelp.cmake
index a11ad4d..c6ee4bc 100644
--- a/Modules/FindHTMLHelp.cmake
+++ b/Modules/FindHTMLHelp.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindHTMLHelp
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index e9f2c82..a26e01f 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindHg
@@ -18,7 +18,7 @@ The module defines the following variables:
.. versionadded:: 3.1
If the command line client executable is found the following macro is defined:
-::
+.. code-block:: cmake
HG_WC_INFO(<dir> <var-prefix>)
@@ -32,7 +32,7 @@ at a given location. This macro defines the following variables:
Example usage:
-::
+.. code-block:: cmake
find_package(Hg)
if(HG_FOUND)
@@ -84,15 +84,15 @@ if(HG_EXECUTABLE)
OUTPUT_VARIABLE ${prefix}_WC_DATA
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${hg_id_result} EQUAL 0)
- message(SEND_ERROR "Command \"${HG_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}")
+ message(SEND_ERROR "Command \"${HG_EXECUTABLE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}")
endif()
string(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA})
string(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA})
- endmacro(HG_WC_INFO)
+ endmacro()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Hg
REQUIRED_VARS HG_EXECUTABLE
VERSION_VAR HG_VERSION_STRING)
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index 63c2576..a7b0569 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindICU
@@ -215,7 +215,7 @@ function(_ICU_FIND)
endif()
if(component STREQUAL "in")
list(APPEND component_libnames "icui18n")
- list(APPEND component_debug_libnames "icui18nd")
+ list(APPEND component_debug_libnames "icui18nd") # noqa: spellcheck disable-line
endif()
if(static_prefix)
@@ -295,7 +295,7 @@ endfunction()
_ICU_FIND()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ICU
REQUIRED_VARS
ICU_INCLUDE_DIR
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
index 543e10c..a8bf311 100644
--- a/Modules/FindIce.cmake
+++ b/Modules/FindIce.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindIce
@@ -540,9 +540,8 @@ endfunction()
_Ice_FIND()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice
- FOUND_VAR Ice_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Ice
REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE
Ice_INCLUDE_DIR
Ice_SLICE_DIR
diff --git a/Modules/FindIconv.cmake b/Modules/FindIconv.cmake
index 876af8d..2c6e3b4 100644
--- a/Modules/FindIconv.cmake
+++ b/Modules/FindIconv.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindIconv
@@ -166,7 +166,7 @@ if(Iconv_INCLUDE_DIR AND EXISTS "${Iconv_INCLUDE_DIR}/iconv.h")
unset(Iconv_VERSION_NUMBER)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Iconv
REQUIRED_VARS ${_Iconv_REQUIRED_VARS}
VERSION_VAR Iconv_VERSION)
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index d19c145..14c14da 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindIcotool
@@ -40,8 +40,8 @@ if(ICOTOOL_EXECUTABLE)
unset(_icotool_version)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
Icotool
REQUIRED_VARS ICOTOOL_EXECUTABLE
VERSION_VAR ICOTOOL_VERSION_STRING
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 809fec7..ff0a6a6 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindImageMagick
@@ -39,7 +39,7 @@ There are also components for the following ImageMagick APIs:
* ``MagickCore``: ImageMagick MagickCore low-level C API, if found.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.26
@@ -322,13 +322,11 @@ endif()
#---------------------------------------------------------------------
# Standard Package Output
#---------------------------------------------------------------------
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ImageMagick
REQUIRED_VARS ${ImageMagick_REQUIRED_VARS}
VERSION_VAR ImageMagick_VERSION_STRING
)
-# Maintain consistency with all other variables.
-set(ImageMagick_FOUND ${IMAGEMAGICK_FOUND})
#---------------------------------------------------------------------
# DEPRECATED: Setting variables for backward compatibility.
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index 04f5a23..1c93dea 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindIntl
@@ -160,9 +160,8 @@ if(Intl_INCLUDE_DIR AND EXISTS "${Intl_INCLUDE_DIR}/libintl.h")
unset(Intl_VERSION_NUMBER)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
- FOUND_VAR Intl_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Intl
REQUIRED_VARS ${_Intl_REQUIRED_VARS}
VERSION_VAR Intl_VERSION
FAIL_MESSAGE "Failed to find Gettext libintl")
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 82e3d88..59c2634 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJNI
@@ -91,16 +91,13 @@ The following cache variables are also available to set or use:
``JAVA_INCLUDE_PATH``
The include path to ``jni.h``.
``JAVA_INCLUDE_PATH2``
- The include path to machine-dependant headers ``jni_md.h`` and ``jniport.h``.
+ The include path to machine-dependent headers ``jni_md.h`` and ``jniport.h``.
The variable is defined only if ``jni.h`` depends on one of these headers. In
contrast, Android NDK ``jni.h`` can be typically used standalone.
``JAVA_AWT_INCLUDE_PATH``
The include path to ``jawt.h``.
#]=======================================================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW)
-
include(CheckSourceCompiles)
include(CMakePushCheckState)
include(FindPackageHandleStandardArgs)
@@ -114,7 +111,7 @@ if(NOT JNI_FIND_COMPONENTS)
set(JNI_FIND_COMPONENTS NativeHelper)
set(JNI_FIND_REQUIRED_NativeHelper TRUE)
endif()
- else(ANDROID)
+ else()
set(JNI_FIND_COMPONENTS AWT JVM)
# For compatibility purposes, if no components are specified both are
# considered required.
@@ -437,7 +434,7 @@ foreach(search IN LISTS _JNI_SEARCHES)
find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM}
DOC "Java Virtual Machine library"
)
- endif(JVM IN_LIST JNI_FIND_COMPONENTS)
+ endif()
if(AWT IN_LIST JNI_FIND_COMPONENTS)
find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT}
@@ -541,7 +538,7 @@ endif()
# JVM is available even on Android referencing the nativehelper library
if(JAVA_JVM_LIBRARY)
set(JNI_JVM_FOUND TRUE)
-else(JAVA_JVM_LIBRARY)
+else()
set(JNI_JVM_FOUND FALSE)
endif()
@@ -649,7 +646,7 @@ if(JNI_FOUND)
if(JNI_AWT_FOUND)
if(NOT TARGET JNI::AWT)
add_library(JNI::AWT IMPORTED UNKNOWN)
- endif(NOT TARGET JNI::AWT)
+ endif()
set_property(TARGET JNI::AWT PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${JAVA_AWT_INCLUDE_PATH})
@@ -672,7 +669,7 @@ if(JNI_FOUND)
else()
add_library(JNI::JVM IMPORTED INTERFACE)
endif()
- endif(NOT TARGET JNI::JVM)
+ endif()
set_property(TARGET JNI::JVM PROPERTY INTERFACE_LINK_LIBRARIES JNI::JNI)
get_property(_JNI_JVM_TYPE TARGET JNI::JVM PROPERTY TYPE)
@@ -692,5 +689,3 @@ if(JNI_FOUND)
unset(_JNI_JVM_TYPE)
endif()
endif()
-
-cmake_policy(POP)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index a2c5e4e..f12945b 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJPEG
@@ -7,7 +7,7 @@ FindJPEG
Find the Joint Photographic Experts Group (JPEG) library (``libjpeg``)
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
@@ -103,7 +103,7 @@ if(JPEG_INCLUDE_DIR)
unset(_JPEG_CONFIG_HEADERS_DEBIAN)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JPEG
REQUIRED_VARS JPEG_LIBRARY JPEG_INCLUDE_DIR
VERSION_VAR JPEG_VERSION)
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index 79afcd5..2c2cbbf 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJasper
@@ -7,7 +7,7 @@ FindJasper
Find the Jasper JPEG2000 library.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
``Jasper::Jasper``
@@ -61,7 +61,7 @@ if(JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Jasper
REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
VERSION_VAR JASPER_VERSION_STRING)
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 74e424b..1413acd 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJava
@@ -73,7 +73,7 @@ For these components the following variables are set:
Example Usages:
-::
+.. code-block:: cmake
find_package(Java)
find_package(Java 1.8 REQUIRED)
@@ -270,7 +270,7 @@ find_program(Java_JARSIGNER_EXECUTABLE
PATHS ${_JAVA_PATHS}
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if(Java_FIND_COMPONENTS)
set(_JAVA_REQUIRED_VARS)
foreach(component IN LISTS Java_FIND_COMPONENTS)
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index 30ea5e6..a2e0219 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindKDE3
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
index 695e9ac..220906b 100644
--- a/Modules/FindKDE4.cmake
+++ b/Modules/FindKDE4.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindKDE4
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index b237a90..86c438a 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLAPACK
@@ -55,7 +55,7 @@ The following variables may be set to influence this module's behavior:
Search for any BLAS/LAPACK.
Most likely, a BLAS/LAPACK with 32-bit integer interfaces will be found.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
@@ -110,7 +110,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
else()
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
function(_add_lapack_target)
if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK)
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index 9d7168e..c4b99ad 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLATEX
@@ -50,7 +50,9 @@ Possible components are::
LATEX2HTML
HTLATEX
-Example Usages::
+Example Usages:
+
+.. code-block:: cmake
find_package(LATEX)
find_package(LATEX COMPONENTS PDFLATEX)
@@ -71,17 +73,17 @@ if (WIN32)
mark_as_advanced(MIKTEX_BINARY_PATH)
# Try to find the GhostScript binary path (look for gswin32).
- get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00
+ get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTRY_8_00
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL]" PATH
)
- get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04
+ get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTRY_7_04
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\7.04;GS_DLL]" PATH
)
find_path(GHOSTSCRIPT_BINARY_PATH gswin32.exe
- ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00}
- ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04}
+ ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTRY_8_00}
+ ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTRY_7_04}
DOC "Path to the GhostScript binary directory."
)
mark_as_advanced(GHOSTSCRIPT_BINARY_PATH)
@@ -280,7 +282,7 @@ mark_as_advanced(
HTLATEX_COMPILER
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LATEX
REQUIRED_VARS LATEX_COMPILER
HANDLE_COMPONENTS
diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake
index 34b2e82..a5ee9a9 100644
--- a/Modules/FindLTTngUST.cmake
+++ b/Modules/FindLTTngUST.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLTTngUST
@@ -97,8 +97,8 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
set(LTTNGUST_LIBRARIES ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-find_package_handle_standard_args(LTTngUST FOUND_VAR LTTNGUST_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LTTngUST
REQUIRED_VARS LTTNGUST_LIBRARIES
LTTNGUST_INCLUDE_DIRS
VERSION_VAR LTTNGUST_VERSION_STRING)
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 38a43db..538b654 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibArchive
@@ -66,7 +66,7 @@ if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive.h")
unset(_LibArchive_VERSION_STRING)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibArchive
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
VERSION_VAR LibArchive_VERSION
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index 7b0c530..f42dccd 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibLZMA
@@ -97,14 +97,14 @@ if (LIBLZMA_LIBRARY)
elseif(LIBLZMA_LIBRARY_DEBUG)
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_DEBUG})
endif()
- CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
- CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
- CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
+ check_library_exists(${LIBLZMA_LIBRARY_check} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
+ check_library_exists(${LIBLZMA_LIBRARY_check} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
+ check_library_exists(${LIBLZMA_LIBRARY_check} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
unset(LIBLZMA_LIBRARY_check)
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY
LIBLZMA_INCLUDE_DIR
LIBLZMA_HAS_AUTO_DECODER
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index cc2d630..befed4f 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibXml2
@@ -7,7 +7,7 @@ FindLibXml2
Find the XML processing library (libxml2).
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
@@ -59,7 +59,7 @@ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
+ pkg_check_modules(PC_LIBXML QUIET libxml-2.0)
endif()
find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
@@ -109,8 +109,8 @@ foreach(libxml2_pc_lib_dir IN LISTS PC_LIBXML_LIBDIR PC_LIBXML_LIBRARY_DIRS)
endif()
endforeach()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibXml2
REQUIRED_VARS LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR
VERSION_VAR LIBXML2_VERSION_STRING)
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index 11d12cb..f9f1dad 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibXslt
@@ -8,7 +8,7 @@ FindLibXslt
Find the XSL Transformations, Extensible Stylesheet Language
Transformations (XSLT) library (LibXslt)
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.18
@@ -52,7 +52,7 @@ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- PKG_CHECK_MODULES(PC_LIBXSLT QUIET libxslt)
+ pkg_check_modules(PC_LIBXSLT QUIET libxslt)
endif()
set(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER})
@@ -78,7 +78,7 @@ find_library(LIBXSLT_LIBRARY NAMES xslt libxslt
set(LIBXSLT_LIBRARIES ${LIBXSLT_LIBRARY})
if(PKG_CONFIG_FOUND)
- PKG_CHECK_MODULES(PC_LIBXSLT_EXSLT QUIET libexslt)
+ pkg_check_modules(PC_LIBXSLT_EXSLT QUIET libexslt)
endif()
set(LIBXSLT_EXSLT_DEFINITIONS ${PC_LIBXSLT_EXSLT_CFLAGS_OTHER})
@@ -111,8 +111,8 @@ elseif(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig
unset(libxslt_version_str)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibXslt
REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR
VERSION_VAR LIBXSLT_VERSION_STRING)
diff --git a/Modules/FindLibinput.cmake b/Modules/FindLibinput.cmake
index 291d828..68208c2 100644
--- a/Modules/FindLibinput.cmake
+++ b/Modules/FindLibinput.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibinput
@@ -60,8 +60,6 @@ find_library(Libinput_LIBRARY
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libinput
- FOUND_VAR
- Libinput_FOUND
REQUIRED_VARS
Libinput_LIBRARY
Libinput_INCLUDE_DIR
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index b4106c4..396e7d1 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLua
@@ -29,13 +29,13 @@ This module defines:
Note that the expected include convention is
-::
+.. code-block:: c
#include "lua.h"
and not
-::
+.. code-block:: c
#include <lua/lua.h>
@@ -44,7 +44,6 @@ 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)
@@ -107,7 +106,7 @@ function(_lua_set_version_vars)
endforeach ()
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
-endfunction(_lua_set_version_vars)
+endfunction()
function(_lua_get_header_version)
unset(LUA_VERSION_STRING PARENT_SCOPE)
@@ -146,7 +145,7 @@ function(_lua_get_header_version)
return()
endif ()
endforeach ()
-endfunction(_lua_get_header_version)
+endfunction()
function(_lua_find_header)
_lua_set_version_vars()
@@ -231,10 +230,10 @@ if (LUA_LIBRARY)
endif ()
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
+find_package_handle_standard_args(Lua
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
index 6ba9008..e440b98 100644
--- a/Modules/FindLua50.cmake
+++ b/Modules/FindLua50.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLua50
@@ -13,11 +13,15 @@ This module defines::
LUA_LIBRARIES, both lua and lualib
LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
-Note that the expected include convention is::
+Note that the expected include convention is:
+
+.. code-block:: c
#include "lua.h"
-and not::
+and not:
+
+.. code-block:: c
#include <lua/lua.h>
@@ -73,9 +77,9 @@ else()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
+find_package_handle_standard_args(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES)
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index 2249ab1..b6c66f3 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLua51
@@ -14,11 +14,15 @@ This module defines::
LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
-Note that the expected include convention is::
+Note that the expected include convention is:
+
+.. code-block:: c
#include "lua.h"
-and not::
+and not:
+
+.. code-block:: c
#include <lua/lua.h>
@@ -68,10 +72,10 @@ if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
unset(lua_version_str)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
+find_package_handle_standard_args(Lua51
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake
index 38259c3..f34c328 100644
--- a/Modules/FindMFC.cmake
+++ b/Modules/FindMFC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMFC
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
index e5a80e3..26f8be4 100644
--- a/Modules/FindMPEG.cmake
+++ b/Modules/FindMPEG.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMPEG
@@ -30,8 +30,8 @@ find_library(MPEG_mpeg2_LIBRARY mpeg2)
find_library(MPEG_vo_LIBRARY vo)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_mpeg2_LIBRARY MPEG_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MPEG DEFAULT_MSG MPEG_mpeg2_LIBRARY MPEG_INCLUDE_DIR)
if(MPEG_FOUND)
set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} )
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index 763d86a..66a0ed0 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMPEG2
@@ -30,8 +30,8 @@ find_library(MPEG2_mpeg2_LIBRARY mpeg2)
find_library(MPEG2_vo_LIBRARY vo)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
if(MPEG2_FOUND)
set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY})
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 0f06c57..c6a25a7 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMPI
@@ -207,7 +207,7 @@ Usage of mpiexec
When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically
use all of the ``MPIEXEC_EXECUTABLE`` flags as follows:
-::
+.. code-block:: cmake
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
@@ -264,10 +264,9 @@ 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)
+include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
# Generic compiler names
@@ -439,25 +438,25 @@ function (_MPI_interrogate_compiler LANG)
# It's possible to have a per-compiler configuration in these MPI implementations and
# a particular MPICH derivate might check compiler interoperability.
# Intel MPI in particular does this with I_MPI_CHECK_COMPILER.
- file(TO_NATIVE_PATH "${CMAKE_${LANG}_COMPILER}" _MPI_UNDERLAYING_COMPILER)
+ file(TO_NATIVE_PATH "${CMAKE_${LANG}_COMPILER}" _MPI_UNDERLYING_COMPILER)
# On Windows, the Intel MPI batch scripts can only work with filenames - Full paths will break them.
# Due to the lack of other MPICH-based wrappers for Visual C++, we may treat this as default.
if(MSVC)
- get_filename_component(_MPI_UNDERLAYING_COMPILER "${_MPI_UNDERLAYING_COMPILER}" NAME)
+ get_filename_component(_MPI_UNDERLYING_COMPILER "${_MPI_UNDERLYING_COMPILER}" NAME)
endif()
if(LANG STREQUAL "C")
- _MPI_env_set_ifnot(I_MPI_CC _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(MPICH_CC _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_CC _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_CC _MPI_UNDERLYING_COMPILER)
elseif(LANG STREQUAL "CXX")
- _MPI_env_set_ifnot(I_MPI_CXX _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(MPICH_CXX _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_CXX _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_CXX _MPI_UNDERLYING_COMPILER)
elseif(LANG STREQUAL "Fortran")
- _MPI_env_set_ifnot(I_MPI_FC _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(MPICH_FC _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(I_MPI_F77 _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(MPICH_F77 _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(I_MPI_F90 _MPI_UNDERLAYING_COMPILER)
- _MPI_env_set_ifnot(MPICH_F90 _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_FC _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_FC _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_F77 _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_F77 _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_F90 _MPI_UNDERLYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_F90 _MPI_UNDERLYING_COMPILER)
endif()
# Set these two variables for Intel MPI:
@@ -618,11 +617,13 @@ function (_MPI_interrogate_compiler LANG)
# At this point, we obtained some output from a compiler wrapper that works.
# We'll now try to parse it into variables with meaning to us.
if(LANG STREQUAL "Fortran")
+ # noqa: spellcheck off
# If MPICH (and derivates) didn't recognize the Fortran compiler include flag during configuration,
# they'll return a set of three commands, consisting out of a symlink command for mpif.h,
# the actual compiler command and deletion of the created symlink.
# Especially with M(VA)PICH-1, this appears to happen erroneously, and therefore we should translate
# this output into an additional include directory and then drop it from the output.
+ # noqa: spellcheck on
if(MPI_COMPILE_CMDLINE MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h")
get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY)
string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
@@ -687,7 +688,7 @@ function (_MPI_interrogate_compiler LANG)
MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
# If extracting failed to work, we'll try using -showme:incdirs.
- # Unlike before, we do this without the environment variables set up, but since only MPICH derivates are affected by any of them, and
+ # Unlike before, we do this without the environment variables set up, but since only MPICH derivatives are affected by any of them, and
# -showme:... is only supported by Open MPI and LAM/MPI, this isn't a concern.
if (NOT MPI_ALL_INCLUDE_PATHS)
_MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN)
@@ -955,6 +956,7 @@ function(_MPI_guess_settings LANG)
# Should a user be employing PGI or have built its own set and provided it via cache variables, the
# splitting routine would have located the module files.
+ # noqa: spellcheck off
# For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran
# we need some extra library to glue Fortran support together:
# MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names
@@ -964,6 +966,7 @@ function(_MPI_guess_settings LANG)
# The second difference is the last but one letter, if it's an e(nd), the length of a string argument is
# passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed),
# it's passed immediately after the string address.
+ # noqa: spellcheck on
# To summarize:
# - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention
@@ -1313,7 +1316,7 @@ macro(_MPI_check_lang_works LANG SUPPRESS_ERRORS)
set(MPI_${LANG}_HAVE_${mpimethod} FALSE)
endif()
endforeach()
- # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it.
+ # MPI-1 versions had no MPI_INTEGER_KIND defined, so we need to try without it.
# However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header.
unset(MPI_Fortran_INTEGER_LINE)
if(NOT MPI_${LANG}_WORKS)
diff --git a/Modules/FindMPI/test_mpi.c b/Modules/FindMPI/test_mpi.c
index 36b5dfd..1489c50 100644
--- a/Modules/FindMPI/test_mpi.c
+++ b/Modules/FindMPI/test_mpi.c
@@ -7,7 +7,7 @@
#endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
-static const char mpiver_str[] = { 'I', 'N',
+static char const mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 82b4543..d7927a4 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMatlab
@@ -110,7 +110,7 @@ behavior:
additional versions of Matlab for the automatic retrieval of the installed
versions.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.22
@@ -278,7 +278,9 @@ Reference
If set, specifies additional versions of Matlab that may be looked for.
The variable should be a list of strings, organized by pairs of release
- name and versions, such as follows::
+ name and versions, such as follows:
+
+ .. code-block:: cmake
set(MATLAB_ADDITIONAL_VERSIONS
"release_name1=corresponding_version1"
@@ -286,7 +288,9 @@ Reference
...
)
- Example::
+ Example:
+
+ .. code-block:: cmake
set(MATLAB_ADDITIONAL_VERSIONS
"R2013b=8.2"
@@ -299,12 +303,11 @@ 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(FindPackageHandleStandardArgs)
if(NOT WIN32 AND NOT APPLE AND NOT Threads_FOUND
AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
@@ -2081,7 +2084,6 @@ set(Matlab_VERSION ${Matlab_VERSION_STRING})
find_package_handle_standard_args(
Matlab
- FOUND_VAR Matlab_FOUND
REQUIRED_VARS ${_matlab_required_variables}
VERSION_VAR Matlab_VERSION
HANDLE_VERSION_RANGE
diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake
index 4f7080a..44edfcd 100644
--- a/Modules/FindMotif.cmake
+++ b/Modules/FindMotif.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMotif
@@ -31,8 +31,8 @@ if(UNIX)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR)
mark_as_advanced(
MOTIF_INCLUDE_DIR
diff --git a/Modules/FindMsys.cmake b/Modules/FindMsys.cmake
index 86597c2..58155ba 100644
--- a/Modules/FindMsys.cmake
+++ b/Modules/FindMsys.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMsys
diff --git a/Modules/FindODBC.cmake b/Modules/FindODBC.cmake
index 884653c..982a005 100644
--- a/Modules/FindODBC.cmake
+++ b/Modules/FindODBC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindODBC
@@ -25,7 +25,7 @@ first from unixODBC, then from iODBC.
If no config program found, this module searches for ODBC header
and library in list of known locations.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
diff --git a/Modules/FindOpenACC.cmake b/Modules/FindOpenACC.cmake
index d5d26a1..b78d381 100644
--- a/Modules/FindOpenACC.cmake
+++ b/Modules/FindOpenACC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenACC
@@ -260,7 +260,7 @@ macro(_OPENACC_SET_VERSION_BY_SPEC_DATE LANG)
endmacro()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
foreach (LANG IN ITEMS C CXX Fortran)
if(CMAKE_${LANG}_COMPILER_LOADED)
set(OpenACC_${LANG}_FIND_QUIETLY ${OpenACC_FIND_QUIETLY})
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index c8e295b..0466b9c 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenAL
@@ -29,7 +29,7 @@ OpenAL is searched in the following order:
5. Manually compiled framework: ``/Library/Frameworks``.
6. Add-on package: ``/opt``.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.25
@@ -96,7 +96,7 @@ find_library(OPENAL_LIBRARY
unset(_OpenAL_ARCH_DIR)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
OpenAL
REQUIRED_VARS OPENAL_LIBRARY OPENAL_INCLUDE_DIR
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 55be667..e896e97 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenCL
@@ -12,7 +12,7 @@ Finds Open Computing Language (OpenCL)
.. versionadded:: 3.10
Detection of OpenCL 2.1 and 2.2.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.7
@@ -46,17 +46,17 @@ function(_FIND_OPENCL_VERSION)
include(CMakePushCheckState)
set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
- CMAKE_PUSH_CHECK_STATE()
+ cmake_push_check_state()
foreach(VERSION "3_0" "2_2" "2_1" "2_0" "1_2" "1_1" "1_0")
set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
if(EXISTS ${OpenCL_INCLUDE_DIR}/Headers/cl.h)
- CHECK_SYMBOL_EXISTS(
+ check_symbol_exists(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/Headers/cl.h"
OPENCL_VERSION_${VERSION})
else()
- CHECK_SYMBOL_EXISTS(
+ check_symbol_exists(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/CL/cl.h"
OPENCL_VERSION_${VERSION})
@@ -73,7 +73,7 @@ function(_FIND_OPENCL_VERSION)
break()
endif()
endforeach()
- CMAKE_POP_CHECK_STATE()
+ cmake_pop_check_state()
endfunction()
find_path(OpenCL_INCLUDE_DIR
@@ -173,10 +173,9 @@ unset(_OPENCL_x86)
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
OpenCL
- FOUND_VAR OpenCL_FOUND
REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
VERSION_VAR OpenCL_VERSION_STRING)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 0c77cfc..a842756 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenGL
@@ -39,7 +39,7 @@ This module respects several optional COMPONENTS:
A subset of OpenGL API for embedded systems with more capabilities.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.8
@@ -569,14 +569,14 @@ if(OPENGL_EGL_INCLUDE_DIR)
set(OPENGL_EGL_INCLUDE_DIRS ${OPENGL_EGL_INCLUDE_DIR})
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if (CMAKE_FIND_PACKAGE_NAME STREQUAL "GLU")
# FindGLU include()'s this module. It's an old pattern, but rather than
# trying to suppress this from outside the module (which is then sensitive to
# the contents, detect the case in this module and suppress it explicitly.
set(FPHSA_NAME_MISMATCHED 1)
endif ()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}
+find_package_handle_standard_args(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}
HANDLE_COMPONENTS)
unset(FPHSA_NAME_MISMATCHED)
unset(_OpenGL_REQUIRED_VARS)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 07eaf66..99c6765 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenMP
@@ -111,9 +111,6 @@ to know what include directories are needed.
#]=======================================================================]
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)
@@ -150,6 +147,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
set(OMP_FLAG_NVHPC "-mp")
set(OMP_FLAG_PGI "-mp")
set(OMP_FLAG_Flang "-fopenmp")
+ set(OMP_FLAG_LLVMFlang "-fopenmp")
set(OMP_FLAG_SunPro "-xopenmp")
set(OMP_FLAG_XL "-qsmp=omp")
# Cray compiler activate OpenMP with -h omp, which is enabled by default.
@@ -377,6 +375,43 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
break()
endif()
endif()
+ elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "LLVMFlang" AND WIN32)
+ find_library(OpenMP_libomp_LIBRARY
+ NAMES omp
+ HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
+ )
+ mark_as_advanced(OpenMP_libomp_LIBRARY)
+
+ if(OpenMP_libomp_LIBRARY)
+ # Try without specifying include directory first. We only want to
+ # explicitly add a search path if the header can't be found on the
+ # default header search path already.
+ try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
+ SOURCE_FROM_VAR "${_OPENMP_TEST_SRC_NAME}" _OPENMP_TEST_SRC_CONTENT
+ LOG_DESCRIPTION "Trying ${LANG} OpenMP compiler with '${OpenMP_libomp_LIBRARY}'"
+ COMPILE_DEFINITIONS ${OPENMP_FLAG}
+ LINK_LIBRARIES ${OpenMP_libomp_LIBRARY}
+ )
+ if(NOT OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG})
+ find_path(OpenMP_${LANG}_INCLUDE_DIR omp_lib.mod)
+ mark_as_advanced(OpenMP_${LANG}_INCLUDE_DIR)
+ set(OpenMP_${LANG}_INCLUDE_DIR "${OpenMP_${LANG}_INCLUDE_DIR}" PARENT_SCOPE)
+ if(OpenMP_${LANG}_INCLUDE_DIR)
+ try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
+ SOURCE_FROM_VAR "${_OPENMP_TEST_SRC_NAME}" _OPENMP_TEST_SRC_CONTENT
+ LOG_DESCRIPTION "Trying ${LANG} OpenMP compiler with '${OpenMP_libomp_LIBRARY}' and '${OpenMP_${LANG}_INCLUDE_DIR}'"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${OpenMP_${LANG}_INCLUDE_DIR}"
+ COMPILE_DEFINITIONS ${OPENMP_FLAG}
+ LINK_LIBRARIES ${OpenMP_libomp_LIBRARY}
+ )
+ endif()
+ endif()
+ if(OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG})
+ set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE)
+ set("${OPENMP_LIB_NAMES_VAR}" "libomp" PARENT_SCOPE)
+ break()
+ endif()
+ endif()
elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Clang" AND WIN32)
# Check for separate OpenMP library for Clang on Windows
find_library(OpenMP_libomp_LIBRARY
@@ -588,7 +623,7 @@ endif()
unset(_OpenMP_MIN_VERSION)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
foreach(LANG IN LISTS OpenMP_FINDLIST)
if(CMAKE_${LANG}_COMPILER_LOADED)
@@ -671,8 +706,6 @@ find_package_handle_standard_args(OpenMP
VERSION_VAR ${_OpenMP_MIN_VERSION}
HANDLE_COMPONENTS)
-set(OPENMP_FOUND ${OpenMP_FOUND})
-
if(CMAKE_Fortran_COMPILER_LOADED AND OpenMP_Fortran_FOUND)
if(NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE)
set(OpenMP_Fortran_HAVE_OMPLIB_MODULE FALSE CACHE BOOL INTERNAL "")
diff --git a/Modules/FindOpenSP.cmake b/Modules/FindOpenSP.cmake
index 4255aef..605c294 100644
--- a/Modules/FindOpenSP.cmake
+++ b/Modules/FindOpenSP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenSP
@@ -44,7 +44,7 @@ This will define the following variables:
``SP_MULTI_BYTE`` to match this value in order to avoid issues with character
decoding.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the :prop_tgt:`IMPORTED` target ``OpenSP::OpenSP``, if
@@ -122,7 +122,6 @@ endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSP
- FOUND_VAR OpenSP_FOUND
REQUIRED_VARS OpenSP_LIBRARY OpenSP_INCLUDE_DIR
VERSION_VAR OpenSP_VERSION
)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 33a0765..033460b 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenSSL
@@ -573,37 +573,6 @@ if(_OpenSSL_has_dependencies)
_OpenSSL_add_dependencies( OPENSSL_LIBRARIES )
endif()
-function(from_hex HEX DEC)
- string(TOUPPER "${HEX}" HEX)
- set(_res 0)
- string(LENGTH "${HEX}" _strlen)
-
- while (_strlen GREATER 0)
- math(EXPR _res "${_res} * 16")
- string(SUBSTRING "${HEX}" 0 1 NIBBLE)
- string(SUBSTRING "${HEX}" 1 -1 HEX)
- if (NIBBLE STREQUAL "A")
- math(EXPR _res "${_res} + 10")
- elseif (NIBBLE STREQUAL "B")
- math(EXPR _res "${_res} + 11")
- elseif (NIBBLE STREQUAL "C")
- math(EXPR _res "${_res} + 12")
- elseif (NIBBLE STREQUAL "D")
- math(EXPR _res "${_res} + 13")
- elseif (NIBBLE STREQUAL "E")
- math(EXPR _res "${_res} + 14")
- elseif (NIBBLE STREQUAL "F")
- math(EXPR _res "${_res} + 15")
- else()
- math(EXPR _res "${_res} + ${NIBBLE}")
- endif()
-
- string(LENGTH "${HEX}" _strlen)
- endwhile()
-
- set(${DEC} ${_res} PARENT_SCOPE)
-endfunction()
-
if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
@@ -620,16 +589,14 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
- from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
+ math(EXPR OPENSSL_VERSION_MINOR "0x${OPENSSL_VERSION_MINOR}")
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
- from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
+ math(EXPR OPENSSL_VERSION_FIX "0x${OPENSSL_VERSION_FIX}")
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
- from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
# 96 is the ASCII code of 'a' minus 1
- math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
- unset(_tmp)
+ math(EXPR OPENSSL_VERSION_PATCH_ASCII "0x${OPENSSL_VERSION_PATCH} + 96")
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
# this should be updated to handle that, too. This has not happened yet
# so it is simply ignored here for now.
@@ -687,7 +654,7 @@ foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
endforeach()
unset(_comp)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSSL
REQUIRED_VARS
OPENSSL_CRYPTO_LIBRARY
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 9df2a62..d4ffa10 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenSceneGraph
@@ -87,7 +87,7 @@ This module defines the following output variables:
================================== Example Usage:
-::
+.. code-block:: cmake
find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil)
# libOpenThreads & libosg automatically searched
@@ -95,7 +95,7 @@ This module defines the following output variables:
-::
+.. code-block:: cmake
add_executable(foo foo.cc)
target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})
@@ -225,8 +225,8 @@ if(OpenSceneGraph_FIND_REQUIRED)
endforeach()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenSceneGraph
REQUIRED_VARS OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR ${_osg_component_founds}
VERSION_VAR OPENSCENEGRAPH_VERSION)
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index 6be3422..d91dc05 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenThreads
@@ -104,6 +104,6 @@ find_library(OPENTHREADS_LIBRARY_DEBUG
select_library_configurations(OPENTHREADS)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenThreads DEFAULT_MSG
OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)
diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake
index 34b4adb..a5d9707 100644
--- a/Modules/FindPHP4.cmake
+++ b/Modules/FindPHP4.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPHP4
@@ -78,5 +78,5 @@ if(APPLE)
endforeach()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 4294326..52d137f 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPNG
@@ -7,7 +7,7 @@ FindPNG
Find libpng, the official reference library for the PNG image format.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.5
@@ -176,7 +176,7 @@ if(ZLIB_FOUND)
endif ()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
VERSION_VAR PNG_VERSION_STRING)
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index c6db433..c2eeb49 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPackageHandleStandardArgs
@@ -56,7 +56,8 @@ implementing :command:`find_package(<PackageName>)` calls.
Specifies either ``<PackageName>_FOUND`` or
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
for compatibility with older versions of CMake and is now ignored.
- Result variables of both names are always set for compatibility.
+ Result variables of both names are now always set for compatibility
+ also with or without this option.
``REQUIRED_VARS <required-var>...``
Specify the variables which are required for this package.
@@ -203,39 +204,32 @@ Example for the usage:
find_package_check_version(1.2.3 result HANDLE_VERSION_RANGE
RESULT_MESSAGE_VARIABLE reason)
- if (result)
- message (STATUS "${reason}")
+ if(result)
+ message(STATUS "${reason}")
else()
- message (FATAL_ERROR "${reason}")
+ message(FATAL_ERROR "${reason}")
endif()
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
-cmake_policy(PUSH)
-# numbers and boolean constants
-cmake_policy (SET CMP0012 NEW)
-# IN_LIST operator
-cmake_policy (SET CMP0057 NEW)
-
-
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
- set (__msg "${_msg}")
- if (FPHSA_REASON_FAILURE_MESSAGE)
+ 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)
+ elseif(NOT DEFINED PROJECT_NAME AND NOT CMAKE_SCRIPT_MODE_FILE)
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)
+ if(${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${__msg}")
- else ()
- if (NOT ${_NAME}_FIND_QUIETLY)
+ else()
+ if(NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${__msg}")
- endif ()
- endif ()
+ endif()
+ endif()
endmacro()
@@ -249,15 +243,11 @@ macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# List them all in the error message:
if(${_NAME}_CONSIDERED_CONFIGS)
set(configsText "")
- list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
- math(EXPR configsCount "${configsCount} - 1")
- foreach(currentConfigIndex RANGE ${configsCount})
- list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
- list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
+ foreach(filename version IN ZIP_LISTS ${_NAME}_CONSIDERED_CONFIGS ${_NAME}_CONSIDERED_VERSIONS)
string(APPEND configsText "\n ${filename} (version ${version})")
endforeach()
- if (${_NAME}_NOT_FOUND_MESSAGE)
- if (FPHSA_REASON_FAILURE_MESSAGE)
+ if(${_NAME}_NOT_FOUND_MESSAGE)
+ if(FPHSA_REASON_FAILURE_MESSAGE)
string(PREPEND FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}\n ")
else()
set(FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}")
@@ -276,101 +266,100 @@ endmacro()
function(FIND_PACKAGE_CHECK_VERSION version result)
- cmake_parse_arguments (PARSE_ARGV 2 FPCV "HANDLE_VERSION_RANGE;NO_AUTHOR_WARNING_VERSION_RANGE" "RESULT_MESSAGE_VARIABLE" "")
+ cmake_parse_arguments(PARSE_ARGV 2 FPCV "HANDLE_VERSION_RANGE;NO_AUTHOR_WARNING_VERSION_RANGE" "RESULT_MESSAGE_VARIABLE" "")
- if (FPCV_UNPARSED_ARGUMENTS)
- message (FATAL_ERROR "find_package_check_version(): ${FPCV_UNPARSED_ARGUMENTS}: unexpected arguments")
+ if(FPCV_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "find_package_check_version(): ${FPCV_UNPARSED_ARGUMENTS}: unexpected arguments")
endif()
- if ("RESULT_MESSAGE_VARIABLE" IN_LIST FPCV_KEYWORDS_MISSING_VALUES)
- message (FATAL_ERROR "find_package_check_version(): RESULT_MESSAGE_VARIABLE expects an argument")
+ if("RESULT_MESSAGE_VARIABLE" IN_LIST FPCV_KEYWORDS_MISSING_VALUES)
+ message(FATAL_ERROR "find_package_check_version(): RESULT_MESSAGE_VARIABLE expects an argument")
endif()
- set (${result} FALSE PARENT_SCOPE)
- if (FPCV_RESULT_MESSAGE_VARIABLE)
+ set(${result} FALSE PARENT_SCOPE)
+ if(FPCV_RESULT_MESSAGE_VARIABLE)
unset (${FPCV_RESULT_MESSAGE_VARIABLE} PARENT_SCOPE)
endif()
- if (_CMAKE_FPHSA_PACKAGE_NAME)
- set (package "${_CMAKE_FPHSA_PACKAGE_NAME}")
- elseif (CMAKE_FIND_PACKAGE_NAME)
- set (package "${CMAKE_FIND_PACKAGE_NAME}")
+ if(_CMAKE_FPHSA_PACKAGE_NAME)
+ set(package "${_CMAKE_FPHSA_PACKAGE_NAME}")
+ elseif(CMAKE_FIND_PACKAGE_NAME)
+ set(package "${CMAKE_FIND_PACKAGE_NAME}")
else()
- message (FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'")
+ message(FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'")
endif()
- if (NOT FPCV_NO_AUTHOR_WARNING_VERSION_RANGE
+ if(NOT FPCV_NO_AUTHOR_WARNING_VERSION_RANGE
AND ${package}_FIND_VERSION_RANGE AND NOT FPCV_HANDLE_VERSION_RANGE)
message(AUTHOR_WARNING
- "`find_package()` specify a version range but the option "
- "HANDLE_VERSION_RANGE` is not passed to `find_package_check_version()`. "
+ "find_package() specify a version range but the option "
+ "HANDLE_VERSION_RANGE` is not passed to find_package_check_version(). "
"Only the lower endpoint of the range will be used.")
endif()
-
- set (version_ok FALSE)
+ set(version_ok FALSE)
unset (version_msg)
- if (FPCV_HANDLE_VERSION_RANGE AND ${package}_FIND_VERSION_RANGE)
- if ((${package}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE"
+ if(FPCV_HANDLE_VERSION_RANGE AND ${package}_FIND_VERSION_RANGE)
+ if((${package}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE"
AND version VERSION_GREATER_EQUAL ${package}_FIND_VERSION_MIN)
AND ((${package}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
AND version VERSION_LESS_EQUAL ${package}_FIND_VERSION_MAX)
OR (${package}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
AND version VERSION_LESS ${package}_FIND_VERSION_MAX)))
- set (version_ok TRUE)
+ set(version_ok TRUE)
set(version_msg "(found suitable version \"${version}\", required range is \"${${package}_FIND_VERSION_RANGE}\")")
else()
set(version_msg "Found unsuitable version \"${version}\", required range is \"${${package}_FIND_VERSION_RANGE}\"")
endif()
- elseif (DEFINED ${package}_FIND_VERSION)
+ elseif(DEFINED ${package}_FIND_VERSION)
if(${package}_FIND_VERSION_EXACT) # exact version required
# count the dots in the version string
string(REGEX REPLACE "[^.]" "" version_dots "${version}")
# add one dot because there is one dot more than there are components
string(LENGTH "${version_dots}." version_dots)
- if (version_dots GREATER ${package}_FIND_VERSION_COUNT)
+ if(version_dots GREATER ${package}_FIND_VERSION_COUNT)
# Because of the C++ implementation of find_package() ${package}_FIND_VERSION_COUNT
# is at most 4 here. Therefore a simple lookup table is used.
- if (${package}_FIND_VERSION_COUNT EQUAL 1)
+ if(${package}_FIND_VERSION_COUNT EQUAL 1)
set(version_regex "[^.]*")
- elseif (${package}_FIND_VERSION_COUNT EQUAL 2)
+ elseif(${package}_FIND_VERSION_COUNT EQUAL 2)
set(version_regex "[^.]*\\.[^.]*")
- elseif (${package}_FIND_VERSION_COUNT EQUAL 3)
+ elseif(${package}_FIND_VERSION_COUNT EQUAL 3)
set(version_regex "[^.]*\\.[^.]*\\.[^.]*")
else()
set(version_regex "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
endif()
string(REGEX REPLACE "^(${version_regex})\\..*" "\\1" version_head "${version}")
- if (NOT ${package}_FIND_VERSION VERSION_EQUAL version_head)
+ if(NOT ${package}_FIND_VERSION VERSION_EQUAL version_head)
set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"")
- else ()
+ else()
set(version_ok TRUE)
set(version_msg "(found suitable exact version \"${version}\")")
- endif ()
- else ()
- if (NOT ${package}_FIND_VERSION VERSION_EQUAL version)
+ endif()
+ else()
+ if(NOT ${package}_FIND_VERSION VERSION_EQUAL version)
set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"")
- else ()
+ else()
set(version_ok TRUE)
set(version_msg "(found suitable exact version \"${version}\")")
- endif ()
- endif ()
+ endif()
+ endif()
else() # minimum version
- if (${package}_FIND_VERSION VERSION_GREATER version)
+ if(${package}_FIND_VERSION VERSION_GREATER version)
set(version_msg "Found unsuitable version \"${version}\", but required is at least \"${${package}_FIND_VERSION}\"")
else()
set(version_ok TRUE)
set(version_msg "(found suitable version \"${version}\", minimum required is \"${${package}_FIND_VERSION}\")")
endif()
endif()
- else ()
+ else()
set(version_ok TRUE)
set(version_msg "(found version \"${version}\")")
endif()
- set (${result} ${version_ok} PARENT_SCOPE)
- if (FPCV_RESULT_MESSAGE_VARIABLE)
- set (${FPCV_RESULT_MESSAGE_VARIABLE} "${version_msg}" PARENT_SCOPE)
+ set(${result} ${version_ok} PARENT_SCOPE)
+ if(FPCV_RESULT_MESSAGE_VARIABLE)
+ set(${FPCV_RESULT_MESSAGE_VARIABLE} "${version_msg}" PARENT_SCOPE)
endif()
endfunction()
@@ -387,21 +376,21 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
unset(FPHSA_NAME_MISMATCHED_override)
- if (DEFINED FPHSA_NAME_MISMATCHED)
+ if(DEFINED FPHSA_NAME_MISMATCHED)
# If the variable NAME_MISMATCHED variable is set, error if it is passed as
# an argument. The former is for old signatures, the latter is for new
# signatures.
list(FIND ARGN "NAME_MISMATCHED" name_mismatched_idx)
- if (NOT name_mismatched_idx EQUAL "-1")
+ if(NOT name_mismatched_idx EQUAL "-1")
message(FATAL_ERROR
- "The `NAME_MISMATCHED` argument may only be specified by the argument or "
+ "The NAME_MISMATCHED argument may only be specified by the argument or "
"the variable, not both.")
- endif ()
+ endif()
# But use the variable if it is not an argument to avoid forcing minimum
# CMake version bumps for calling modules.
set(FPHSA_NAME_MISMATCHED_override "${FPHSA_NAME_MISMATCHED}")
- endif ()
+ endif()
if(${INDEX} EQUAL -1)
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
@@ -411,7 +400,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
if(FPHSA_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
+ message(FATAL_ERROR "Unknown keywords given to find_package_handle_standard_args(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
endif()
if(NOT FPHSA_FAIL_MESSAGE)
@@ -427,28 +416,28 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif()
if(NOT FPHSA_REQUIRED_VARS AND NOT FPHSA_HANDLE_COMPONENTS)
- message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
+ message(FATAL_ERROR "No REQUIRED_VARS specified for find_package_handle_standard_args()")
endif()
endif()
- if (DEFINED FPHSA_NAME_MISMATCHED_override)
+ if(DEFINED FPHSA_NAME_MISMATCHED_override)
set(FPHSA_NAME_MISMATCHED "${FPHSA_NAME_MISMATCHED_override}")
- endif ()
+ endif()
- if (DEFINED CMAKE_FIND_PACKAGE_NAME
+ if(DEFINED CMAKE_FIND_PACKAGE_NAME
AND NOT FPHSA_NAME_MISMATCHED
AND NOT _NAME STREQUAL CMAKE_FIND_PACKAGE_NAME)
message(AUTHOR_WARNING
- "The package name passed to `find_package_handle_standard_args` "
+ "The package name passed to find_package_handle_standard_args() "
"(${_NAME}) does not match the name of the calling package "
"(${CMAKE_FIND_PACKAGE_NAME}). This can lead to problems in calling "
- "code that expects `find_package` result variables (e.g., `_FOUND`) "
+ "code that expects find_package() result variables (e.g., `_FOUND`) "
"to follow a certain pattern.")
- endif ()
+ endif()
- if (${_NAME}_FIND_VERSION_RANGE AND NOT FPHSA_HANDLE_VERSION_RANGE)
+ if(${_NAME}_FIND_VERSION_RANGE AND NOT FPHSA_HANDLE_VERSION_RANGE)
message(AUTHOR_WARNING
- "`find_package()` specify a version range but the module ${_NAME} does "
+ "find_package() specify a version range but the module ${_NAME} does "
"not support this capability. Only the lower endpoint of the range "
"will be used.")
endif()
@@ -462,7 +451,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
- if (FPHSA_REQUIRED_VARS)
+ if(FPHSA_REQUIRED_VARS)
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
endif()
@@ -472,13 +461,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
if(FPHSA_FOUND_VAR)
set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND)
set(_FOUND_VAR_MIXED ${_NAME}_FOUND)
- if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER)
- set(_FOUND_VAR ${FPHSA_FOUND_VAR})
- else()
+ if(
+ NOT FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED
+ AND NOT FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER
+ )
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.")
endif()
- else()
- set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
endif()
# collect all variables which were not found, so they can be printed, so the
@@ -531,7 +519,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif()
endforeach()
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
- string(APPEND DETAILS "[c${COMPONENT_MSG}]")
+ string(APPEND DETAILS "[${COMPONENT_MSG}]")
endif()
# version handling:
@@ -539,17 +527,17 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(VERSION_OK TRUE)
# check that the version variable is not empty to avoid emitting a misleading
- # message (i.e. `Found unsuitable version ""`)
- if (DEFINED ${_NAME}_FIND_VERSION)
+ # message(i.e. `Found unsuitable version ""`)
+ if(DEFINED ${_NAME}_FIND_VERSION)
if(DEFINED ${FPHSA_VERSION_VAR})
if(NOT "${${FPHSA_VERSION_VAR}}" STREQUAL "")
set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
- if (FPHSA_HANDLE_VERSION_RANGE)
- set (FPCV_HANDLE_VERSION_RANGE HANDLE_VERSION_RANGE)
+ if(FPHSA_HANDLE_VERSION_RANGE)
+ set(FPCV_HANDLE_VERSION_RANGE HANDLE_VERSION_RANGE)
else()
set(FPCV_HANDLE_VERSION_RANGE NO_AUTHOR_WARNING_VERSION_RANGE)
endif()
- find_package_check_version ("${_FOUND_VERSION}" VERSION_OK RESULT_MESSAGE_VARIABLE VERSION_MSG
+ find_package_check_version("${_FOUND_VERSION}" VERSION_OK RESULT_MESSAGE_VARIABLE VERSION_MSG
${FPCV_HANDLE_VERSION_RANGE})
else()
set(VERSION_OK FALSE)
@@ -559,18 +547,18 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# if the package was not found, but a version was given, add that to the output:
if(${_NAME}_FIND_VERSION_EXACT)
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
- elseif (FPHSA_HANDLE_VERSION_RANGE AND ${_NAME}_FIND_VERSION_RANGE)
+ elseif(FPHSA_HANDLE_VERSION_RANGE AND ${_NAME}_FIND_VERSION_RANGE)
set(VERSION_MSG "(Required is version range \"${${_NAME}_FIND_VERSION_RANGE}\")")
else()
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
endif()
endif()
- else ()
+ else()
# Check with DEFINED as the found version may be 0.
if(DEFINED ${FPHSA_VERSION_VAR})
set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")")
endif()
- endif ()
+ endif()
if(VERSION_OK)
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
@@ -580,23 +568,23 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# print the result:
- if (${_NAME}_FOUND)
+ if(${_NAME}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
- else ()
+ else()
if(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
else()
if(NOT VERSION_OK)
set(RESULT_MSG)
- if (_FIRST_REQUIRED_VAR)
- string (APPEND RESULT_MSG "found ${${_FIRST_REQUIRED_VAR}}")
+ if(_FIRST_REQUIRED_VAR)
+ string(APPEND RESULT_MSG "found ${${_FIRST_REQUIRED_VAR}}")
endif()
- if (COMPONENT_MSG)
- if (RESULT_MSG)
- string (APPEND RESULT_MSG ", ")
+ if(COMPONENT_MSG)
+ if(RESULT_MSG)
+ string(APPEND RESULT_MSG ", ")
endif()
- string (APPEND RESULT_MSG "${FOUND_COMPONENTS_MSG}")
+ string(APPEND RESULT_MSG "${FOUND_COMPONENTS_MSG}")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (${RESULT_MSG})")
else()
@@ -604,11 +592,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif()
endif()
- endif ()
+ endif()
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
endfunction()
-
-
-cmake_policy(POP)
diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake
index 7efbe18..a9f2d2b 100644
--- a/Modules/FindPackageMessage.cmake
+++ b/Modules/FindPackageMessage.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPackageMessage
diff --git a/Modules/FindPatch.cmake b/Modules/FindPatch.cmake
index f4fe4a6..009a598 100644
--- a/Modules/FindPatch.cmake
+++ b/Modules/FindPatch.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPatch
@@ -19,6 +19,9 @@ The following :prop_tgt:`IMPORTED` targets are also defined:
``Patch::patch``
The command-line executable.
+ .. versionchanged:: 4.0
+ Imported target is defined only when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
+
Example usage:
.. code-block:: cmake
@@ -58,14 +61,23 @@ if(CMAKE_HOST_WIN32)
)
endif()
-if(Patch_EXECUTABLE AND NOT TARGET Patch::patch)
+mark_as_advanced(Patch_EXECUTABLE)
+
+get_property(_patch_role GLOBAL PROPERTY CMAKE_ROLE)
+
+if(
+ _patch_role STREQUAL "PROJECT"
+ AND Patch_EXECUTABLE
+ AND NOT TARGET Patch::patch
+)
add_executable(Patch::patch IMPORTED)
set_property(TARGET Patch::patch PROPERTY IMPORTED_LOCATION ${Patch_EXECUTABLE})
endif()
unset(_patch_path)
+unset(_patch_role)
unset(_doc)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Patch
REQUIRED_VARS Patch_EXECUTABLE)
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index 49bc54c..2bc6a61 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPerl
@@ -79,14 +79,14 @@ endif()
# Deprecated settings for compatibility with CMake1.4
set(PERL ${PERL_EXECUTABLE})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if (CMAKE_FIND_PACKAGE_NAME STREQUAL "PerlLibs")
# FindPerlLibs include()'s this module. It's an old pattern, but rather than
# trying to suppress this from outside the module (which is then sensitive to
# the contents, detect the case in this module and suppress it explicitly.
set(FPHSA_NAME_MISMATCHED 1)
endif ()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl
+find_package_handle_standard_args(Perl
REQUIRED_VARS PERL_EXECUTABLE
VERSION_VAR PERL_VERSION_STRING)
unset(FPHSA_NAME_MISMATCHED)
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index d576b86..b275061 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPerlLibs
@@ -145,7 +145,7 @@ if (PERL_EXECUTABLE)
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH
VERSION_VAR PERL_VERSION_STRING)
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
index 19e5ba9..bbb9856 100644
--- a/Modules/FindPhysFS.cmake
+++ b/Modules/FindPhysFS.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPhysFS
@@ -42,5 +42,5 @@ find_library(PHYSFS_LIBRARY
/opt
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake
index b78db2a..5ad5c4f 100644
--- a/Modules/FindPike.cmake
+++ b/Modules/FindPike.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPike
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 450acf4..e2c322a 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[========================================[.rst:
FindPkgConfig
@@ -33,10 +33,6 @@ for how these variables are initialized.
#]========================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
@@ -110,7 +106,7 @@ if (PKG_CONFIG_EXECUTABLE)
unset(_PKG_CONFIG_VERSION_RESULT)
endif ()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PkgConfig
REQUIRED_VARS PKG_CONFIG_EXECUTABLE
REASON_FAILURE_MESSAGE "${_PKG_CONFIG_FAILURE_MESSAGE}"
@@ -730,7 +726,7 @@ endmacro()
When the ``QUIET`` argument is given, no status messages will be printed.
- .. versionadded:: 3.1
+ .. versionadded:: 3.3
The :variable:`CMAKE_PREFIX_PATH`,
:variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` cache
and environment variables will be added to the ``pkg-config`` search path.
@@ -740,14 +736,14 @@ endmacro()
The :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` variable set to ``FALSE``
disables this behavior globally.
- .. This didn't actually work until 3.3.
+ .. This was actually added in 3.1, but didn't work until 3.3.
- .. versionadded:: 3.6
+ .. versionadded:: 3.7
The ``IMPORTED_TARGET`` argument will create an imported target named
``PkgConfig::<prefix>`` that can be passed directly as an argument to
:command:`target_link_libraries`.
- .. This didn't actually work until 3.7.
+ .. This was actually added in 3.6, but didn't work until 3.7.
.. versionadded:: 3.13
The ``GLOBAL`` argument will make the
@@ -978,7 +974,7 @@ endmacro()
function (pkg_get_variable result pkg variable)
set(_multiValueArgs DEFINE_VARIABLES)
- CMAKE_PARSE_ARGUMENTS(_parsedArguments "" "" "${_multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_parsedArguments "" "" "${_multiValueArgs}" ${ARGN})
set(defined_variables )
foreach(_def_var ${_parsedArguments_DEFINE_VARIABLES})
if(NOT _def_var MATCHES "^.+=.*$")
@@ -1047,5 +1043,3 @@ Variables Affecting Behavior
### Local Variables:
### mode: cmake
### End:
-
-cmake_policy(POP)
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 1984e18..5b70d53 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPostgreSQL
@@ -7,7 +7,7 @@ FindPostgreSQL
Find the PostgreSQL installation.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.14
@@ -92,7 +92,6 @@ 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")
@@ -269,12 +268,11 @@ if("Server" IN_LIST PostgreSQL_FIND_COMPONENTS)
endif()
# Did we find anything?
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PostgreSQL
REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR
HANDLE_COMPONENTS
VERSION_VAR PostgreSQL_VERSION_STRING)
-set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
function(__postgresql_import_library _target _var _config)
if(_config)
diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake
index 8a16e8a..9833658 100644
--- a/Modules/FindProducer.cmake
+++ b/Modules/FindProducer.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindProducer
@@ -65,6 +65,6 @@ find_library(PRODUCER_LIBRARY
/opt
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Producer DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Producer DEFAULT_MSG
PRODUCER_LIBRARY PRODUCER_INCLUDE_DIR)
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 197e71f..89a6cfd 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindProtobuf
@@ -106,104 +106,139 @@ Example:
.. command:: protobuf_generate_cpp
- Add custom commands to process ``.proto`` files to C++::
+ Add custom commands to process ``.proto`` files to C++:
- protobuf_generate_cpp (<SRCS> <HDRS>
- [DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
+ .. code-block:: cmake
- ``SRCS``
+ protobuf_generate_cpp (
+ <srcs-var> <hdrs-var>
+ [DESCRIPTORS <var>]
+ [EXPORT_MACRO <macro>]
+ [<proto-file>...])
+
+ ``<srcs-var>``
Variable to define with autogenerated source files
- ``HDRS``
+
+ ``<hdrs-var>``
Variable to define with autogenerated header files
- ``DESCRIPTORS``
+
+ ``DESCRIPTORS <var>``
.. versionadded:: 3.10
Variable to define with autogenerated descriptor files, if requested.
- ``EXPORT_MACRO``
+
+ ``EXPORT_MACRO <macro>``
is a macro which should expand to ``__declspec(dllexport)`` or
``__declspec(dllimport)`` depending on what is being compiled.
- ``ARGN``
+
+ ``<proto-file>...``
``.proto`` files
.. command:: protobuf_generate_python
.. versionadded:: 3.4
- Add custom commands to process ``.proto`` files to Python::
+ Add custom commands to process ``.proto`` files to Python:
+
+ .. code-block:: cmake
- protobuf_generate_python (<PY> [<ARGN>...])
+ protobuf_generate_python (<py-srcs-var> [<proto-file>...])
- ``PY``
+ ``<py-srcs-var>``
Variable to define with autogenerated Python files
- ``ARGN``
+
+ ``<proto-file>...``
``.proto`` files
.. command:: protobuf_generate
.. versionadded:: 3.13
- Automatically generate source files from ``.proto`` schema files at build time::
+ Automatically generate source files from ``.proto`` schema files at build time:
+
+ .. code-block:: cmake
protobuf_generate (
TARGET <target>
[LANGUAGE <lang>]
- [OUT_VAR <out_var>]
+ [OUT_VAR <var>]
[EXPORT_MACRO <macro>]
[PROTOC_OUT_DIR <dir>]
[PLUGIN <plugin>]
- [PLUGIN_OPTIONS <plugin_options>]
- [DEPENDENCIES <depends]
- [PROTOS <protobuf_files>]
- [IMPORT_DIRS <dirs>]
- [GENERATE_EXTENSIONS <extensions>]
- [PROTOC_OPTIONS <protoc_options>]
+ [PLUGIN_OPTIONS <plugin-options>]
+ [DEPENDENCIES <dependencies>]
+ [PROTOS <proto-file>...]
+ [IMPORT_DIRS <dir>...]
+ [GENERATE_EXTENSIONS <extension>...]
+ [PROTOC_OPTIONS <option>...]
+ [PROTOC_EXE <executable>]
[APPEND_PATH])
``APPEND_PATH``
A flag that causes the base path of all proto schema files to be added to
``IMPORT_DIRS``.
- ``LANGUAGE``
+
+ ``LANGUAGE <lang>``
A single value: cpp or python. Determines what kind of source files are
being generated. Defaults to cpp.
- ``OUT_VAR``
+
+ ``OUT_VAR <var>``
Name of a CMake variable that will be filled with the paths to the generated
source files.
- ``EXPORT_MACRO``
+
+ ``EXPORT_MACRO <macro>``
Name of a macro that is applied to all generated Protobuf message classes
and extern variables. It can, for example, be used to declare DLL exports.
- ``PROTOC_OUT_DIR``
+
+ ``PROTOC_OUT_DIR <dir>``
Output directory of generated source files. Defaults to ``CMAKE_CURRENT_BINARY_DIR``.
- ``PLUGIN``
+
+ ``PLUGIN <plugin>``
.. versionadded:: 3.21
An optional plugin executable. This could, for example, be the path to
``grpc_cpp_plugin``.
- ``PLUGIN_OPTIONS``
+
+ ``PLUGIN_OPTIONS <plugin-options>``
.. versionadded:: 3.28
Additional options provided to the plugin, such as ``generate_mock_code=true``
for the gRPC cpp plugin.
- ``DEPENDENCIES``
+
+ ``DEPENDENCIES <dependencies>``
.. versionadded:: 3.28
Arguments forwarded to the ``DEPENDS`` of the underlying ``add_custom_command``
invocation.
- ``TARGET``
+
+ ``TARGET <target>``
CMake target that will have the generated files added as sources.
- ``PROTOS``
+
+ ``PROTOS <proto-file>...``
List of proto schema files. If omitted, then every source file ending in *proto* of ``TARGET`` will be used.
- ``IMPORT_DIRS``
+
+ ``IMPORT_DIRS <dir>...``
A common parent directory for the schema files. For example, if the schema file is
``proto/helloworld/helloworld.proto`` and the import directory ``proto/`` then the
generated files are ``${PROTOC_OUT_DIR}/helloworld/helloworld.pb.h`` and
``${PROTOC_OUT_DIR}/helloworld/helloworld.pb.cc``.
- ``GENERATE_EXTENSIONS``
+
+ ``GENERATE_EXTENSIONS <extension>...``
If LANGUAGE is omitted then this must be set to the extensions that protoc generates.
- ``PROTOC_OPTIONS``
+
+ ``PROTOC_OPTIONS <option>...``
.. versionadded:: 3.28
Additional arguments that are forwarded to protoc.
- Example::
+ ``PROTOC_EXE <executable>``
+ .. versionadded:: 4.0
+
+ Command name, path, or CMake executable used to generate protobuf bindings.
+ If omitted, ``protobuf::protoc`` is used.
+
+ Example:
+
+ .. code-block:: cmake
find_package(gRPC CONFIG REQUIRED)
find_package(Protobuf REQUIRED)
@@ -223,7 +258,7 @@ 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)
+ set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES PROTOC_EXE)
if(COMMAND target_sources)
list(APPEND _singleargs TARGET)
endif()
@@ -292,10 +327,14 @@ function(protobuf_generate)
return()
endif()
- if(NOT TARGET protobuf::protoc)
- message(SEND_ERROR "protoc executable not found. "
- "Please define the Protobuf_PROTOC_EXECUTABLE variable or ensure that protoc is in CMake's search path.")
- return()
+ if(NOT protobuf_generate_PROTOC_EXE)
+ if(NOT TARGET protobuf::protoc)
+ message(SEND_ERROR "protoc executable not found. "
+ "Please define the Protobuf_PROTOC_EXECUTABLE variable, or pass PROTOC_EXE to protobuf_generate, or ensure that protoc is in CMake's search path.")
+ return()
+ endif()
+ # Default to using the CMake executable
+ set(protobuf_generate_PROTOC_EXE protobuf::protoc)
endif()
if(protobuf_generate_APPEND_PATH)
@@ -368,7 +407,7 @@ function(protobuf_generate)
add_custom_command(
OUTPUT ${_generated_srcs}
- COMMAND protobuf::protoc
+ COMMAND ${protobuf_generate_PROTOC_EXE}
ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file}
DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES}
COMMENT ${_comment}
@@ -768,8 +807,8 @@ if(Protobuf_INCLUDE_DIR)
endif()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Protobuf
REQUIRED_VARS Protobuf_LIBRARIES Protobuf_INCLUDE_DIR
VERSION_VAR Protobuf_VERSION
)
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index a6f4bf5..73d41dd 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPython
@@ -50,7 +50,9 @@ If component ``Development`` is specified, it implies sub-components
To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` (or one of its sub-components) and ``NumPy``, specify all
-components at the same time::
+components at the same time:
+
+.. code-block:: cmake
find_package (Python COMPONENTS Interpreter Development)
@@ -340,14 +342,18 @@ Hints
``pydebug`` and ``gil_disabled``, ``debug`` and ``free threaded`` versions
will be searched **after** ``non-debug`` and ``non-gil-disabled`` ones.
- For example, if we have::
+ For example, if we have:
+
+ .. code-block:: cmake
set (Python_FIND_ABI "ON" "ANY" "ANY" "ON")
The following flags combinations will be appended, in that order, to the
artifact names: ``tdmu``, ``tdm``, ``tdu``, and ``td``.
- And to search any possible ABIs::
+ And to search any possible ABIs:
+
+ .. code-block:: cmake
set (Python_FIND_ABI "ANY" "ANY" "ANY" "ANY")
@@ -433,9 +439,9 @@ Hints
.. note::
- If the component ``Development`` is requested, it is **strongly**
- recommended to also include the component ``Interpreter`` to get expected
- result.
+ If the component ``Development`` is requested (or one of its
+ sub-components) and is not found or the wrong artifacts are returned,
+ including also the component ``Interpreter`` may be helpful.
``Python_FIND_IMPLEMENTATIONS``
.. versionadded:: 3.18
@@ -559,6 +565,31 @@ can be controlled with the following variable:
* If set to ``FALSE`` or undefined: Enable multiple version/component
requirements.
+``Python_ARTIFACTS_PREFIX``
+ .. versionadded:: 4.0
+
+ Define a custom prefix which will be used for the definition of all the
+ result variables, targets, and commands. By using this variable, this module
+ supports multiple calls in the same directory with different
+ version/component requirements.
+ For example, in case of cross-compilation, development components are needed
+ but the native python interpreter can also be required:
+
+ .. code-block:: cmake
+
+ find_package(Python COMPONENTS Development)
+
+ set(Python_ARTIFACTS_PREFIX "_HOST")
+ find_package(Python COMPONENTS Interpreter)
+
+ # Here Python_HOST_EXECUTABLE and Python_HOST::Interpreter artifacts are defined
+
+ .. note::
+
+ For consistency with standard behavior of modules, the various standard
+ ``_FOUND`` variables (i.e. without the custom prefix) are also defined by
+ each call to the :command:`find_package` command.
+
Commands
^^^^^^^^
@@ -567,7 +598,9 @@ This module defines the command ``Python_add_library`` (when
:command:`add_library` and adds a dependency to target ``Python::Python`` or,
when library type is ``MODULE``, to target ``Python::Module`` or
``Python::SABIModule`` (when ``USE_SABI`` option is specified) and takes care
-of Python module naming rules::
+of Python module naming rules:
+
+.. code-block:: cmake
Python_add_library (<name> [STATIC | SHARED | MODULE [USE_SABI <version>] [WITH_SOABI]]
<source1> [<source2> ...])
@@ -598,80 +631,86 @@ If the library type is not specified, ``MODULE`` is assumed.
cmake_policy(PUSH)
-# numbers and boolean constants
-cmake_policy (SET CMP0012 NEW)
+# foreach loop variable scope
+cmake_policy (SET CMP0124 NEW)
+
+set (_PYTHON_BASE Python)
+if(${_PYTHON_BASE}_ARTIFACTS_PREFIX)
+ set(_PYTHON_PREFIX "${_PYTHON_BASE}${${_PYTHON_BASE}_ARTIFACTS_PREFIX}")
+else()
+ set(_PYTHON_PREFIX "${_PYTHON_BASE}")
+endif()
-set (_PYTHON_PREFIX Python)
-unset (_Python_REQUIRED_VERSION_MAJOR)
-unset (_Python_REQUIRED_VERSIONS)
+unset (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+unset (_${_PYTHON_PREFIX}_REQUIRED_VERSIONS)
if (Python_FIND_VERSION_RANGE)
# compute list of major versions
- foreach (_Python_MAJOR IN ITEMS 3 2)
- if (_Python_MAJOR VERSION_GREATER_EQUAL Python_FIND_VERSION_MIN_MAJOR
- AND ((Python_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND _Python_MAJOR VERSION_LESS_EQUAL Python_FIND_VERSION_MAX)
- OR (Python_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND _Python_MAJOR VERSION_LESS Python_FIND_VERSION_MAX)))
- list (APPEND _Python_REQUIRED_VERSIONS ${_Python_MAJOR})
+ foreach (version_major IN ITEMS 3 2)
+ if (version_major VERSION_GREATER_EQUAL Python_FIND_VERSION_MIN_MAJOR
+ AND ((Python_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND version_major VERSION_LESS_EQUAL Python_FIND_VERSION_MAX)
+ OR (Python_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND version_major VERSION_LESS Python_FIND_VERSION_MAX)))
+ list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VERSIONS ${version_major})
endif()
endforeach()
- list (LENGTH _Python_REQUIRED_VERSIONS _Python_VERSION_COUNT)
- if (_Python_VERSION_COUNT EQUAL 0)
- unset (_Python_REQUIRED_VERSIONS)
- elseif (_Python_VERSION_COUNT EQUAL 1)
- set (_Python_REQUIRED_VERSION_MAJOR ${_Python_REQUIRED_VERSIONS})
+ list (LENGTH _${_PYTHON_PREFIX}_REQUIRED_VERSIONS _${_PYTHON_PREFIX}_VERSION_COUNT)
+ if (_${_PYTHON_PREFIX}_VERSION_COUNT EQUAL 0)
+ unset (_${_PYTHON_PREFIX}_REQUIRED_VERSIONS)
+ elseif (_${_PYTHON_PREFIX}_VERSION_COUNT EQUAL 1)
+ set (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR ${_${_PYTHON_PREFIX}_REQUIRED_VERSIONS})
endif()
elseif (DEFINED Python_FIND_VERSION)
- set (_Python_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR})
+ set (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR})
else()
- set (_Python_REQUIRED_VERSIONS 3 2)
+ set (_${_PYTHON_PREFIX}_REQUIRED_VERSIONS 3 2)
endif()
-if (_Python_REQUIRED_VERSION_MAJOR)
+if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
-elseif (_Python_REQUIRED_VERSIONS)
+elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSIONS)
# iterate over versions in quiet and NOT required modes to avoid multiple
# "Found" messages and prematurally failure.
- set (_Python_QUIETLY ${Python_FIND_QUIETLY})
- set (_Python_REQUIRED ${Python_FIND_REQUIRED})
+ set (_${_PYTHON_PREFIX}_QUIETLY ${Python_FIND_QUIETLY})
+ set (_${_PYTHON_PREFIX}_REQUIRED ${Python_FIND_REQUIRED})
set (Python_FIND_QUIETLY TRUE)
set (Python_FIND_REQUIRED FALSE)
- set (_Python_REQUIRED_VERSION_LAST 2)
+ set (_${_PYTHON_PREFIX}_REQUIRED_VERSION_LAST 2)
- unset (_Python_INPUT_VARS)
- foreach (_Python_ITEM IN ITEMS Python_EXECUTABLE Python_COMPILER Python_LIBRARY
- Python_INCLUDE_DIR Python_NumPy_INCLUDE_DIR)
- if (NOT DEFINED ${_Python_ITEM})
- list (APPEND _Python_INPUT_VARS ${_Python_ITEM})
+ unset (_${_PYTHON_PREFIX}_INPUT_VARS)
+ foreach (item IN ITEMS Python_EXECUTABLE Python_COMPILER Python_LIBRARY
+ Python_INCLUDE_DIR Python_NumPy_INCLUDE_DIR)
+ if (NOT DEFINED ${item})
+ list (APPEND _${_PYTHON_PREFIX}_INPUT_VARS ${item})
endif()
endforeach()
- foreach (_Python_REQUIRED_VERSION_MAJOR IN LISTS _Python_REQUIRED_VERSIONS)
- set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR})
+ foreach (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR IN LISTS _${_PYTHON_PREFIX}_REQUIRED_VERSIONS)
+ set (Python_FIND_VERSION ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR})
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
if (Python_FOUND OR
- _Python_REQUIRED_VERSION_MAJOR EQUAL _Python_REQUIRED_VERSION_LAST)
+ _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_LAST)
break()
endif()
# clean-up INPUT variables not set by the user
- foreach (_Python_ITEM IN LISTS _Python_INPUT_VARS)
- unset (${_Python_ITEM})
+ foreach (item IN LISTS _${_PYTHON_PREFIX}_INPUT_VARS)
+ unset (${item})
endforeach()
# clean-up some CACHE variables to ensure look-up restart from scratch
- foreach (_Python_ITEM IN LISTS _Python_CACHED_VARS)
- unset (${_Python_ITEM} CACHE)
+ foreach (item IN LISTS _${_PYTHON_PREFIX}_CACHED_VARS)
+ unset (${item} CACHE)
endforeach()
endforeach()
unset (Python_FIND_VERSION)
- set (Python_FIND_QUIETLY ${_Python_QUIETLY})
- set (Python_FIND_REQUIRED ${_Python_REQUIRED})
+ set (Python_FIND_QUIETLY ${_${_PYTHON_PREFIX}_QUIETLY})
+ set (Python_FIND_REQUIRED ${_${_PYTHON_PREFIX}_REQUIRED})
if (Python_FIND_REQUIRED OR NOT Python_FIND_QUIETLY)
# call again validation command to get "Found" or error message
find_package_handle_standard_args (Python HANDLE_COMPONENTS HANDLE_VERSION_RANGE
- REQUIRED_VARS ${_Python_REQUIRED_VARS}
+ REQUIRED_VARS ${_${_PYTHON_PREFIX}_REQUIRED_VARS}
VERSION_VAR Python_VERSION)
endif()
else()
@@ -681,18 +720,20 @@ else()
set (Python_FIND_REQUIRED_Interpreter TRUE)
endif()
- include (${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args (Python HANDLE_COMPONENTS HANDLE_VERSION_RANGE
VERSION_VAR Python_VERSION
REASON_FAILURE_MESSAGE "Version range specified \"${Python_FIND_VERSION_RANGE}\" does not include supported versions")
endif()
-if (COMMAND __Python_add_library)
- macro (Python_add_library)
- __Python_add_library (Python ${ARGV})
- endmacro()
+if (COMMAND __${_PYTHON_PREFIX}_add_library AND NOT COMMAND ${_PYTHON_PREFIX}_add_library)
+ cmake_language(EVAL CODE
+ "macro (${_PYTHON_PREFIX}_add_library)
+ __${_PYTHON_PREFIX}_add_library (${_PYTHON_PREFIX} \${ARGV})
+ endmacro()")
endif()
+unset (_PYTHON_BASE)
unset (_PYTHON_PREFIX)
cmake_policy(POP)
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 2997650..3cd77e4 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#
# This file is a "template" file used by various FindPython modules.
@@ -10,12 +10,6 @@
#
cmake_policy(PUSH)
-# list supports empty elements
-cmake_policy (SET CMP0007 NEW)
-# numbers and boolean constants
-cmake_policy (SET CMP0012 NEW)
-# IN_LIST operator
-cmake_policy (SET CMP0057 NEW)
# foreach loop variable scope
cmake_policy (SET CMP0124 NEW)
# registry view behavior
@@ -39,23 +33,24 @@ endif()
get_property(_${_PYTHON_PREFIX}_CMAKE_ROLE GLOBAL PROPERTY CMAKE_ROLE)
-include (${CMAKE_CURRENT_LIST_DIR}/../FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
#
# helper commands
#
macro (_PYTHON_DISPLAY_FAILURE _PYTHON_MSG)
- if (${_PYTHON_PREFIX}_FIND_REQUIRED)
+ if (${_PYTHON_BASE}_FIND_REQUIRED)
message (FATAL_ERROR "${_PYTHON_MSG}")
else()
- if (NOT ${_PYTHON_PREFIX}_FIND_QUIETLY)
+ if (NOT ${_PYTHON_BASE}_FIND_QUIETLY)
message(STATUS "${_PYTHON_MSG}")
endif ()
endif()
+ set (${_PYTHON_BASE}_FOUND FALSE)
set (${_PYTHON_PREFIX}_FOUND FALSE)
- string (TOUPPER "${_PYTHON_PREFIX}" _${_PYTHON_PREFIX}_UPPER_PREFIX)
- set (${_PYTHON_UPPER_PREFIX}_FOUND FALSE)
+ string (TOUPPER "${_PYTHON_BASE}" _${_PYTHON_BASE}_UPPER_PREFIX)
+ set (${_${_PYTHON_BASE}_UPPER_PREFIX}_FOUND FALSE)
endmacro()
@@ -532,7 +527,8 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endif()
endif()
- if (_${_PYTHON_PREFIX}_EXECUTABLE AND NOT CMAKE_CROSSCOMPILING)
+ if ("Interpreter" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS AND _${_PYTHON_PREFIX}_EXECUTABLE
+ AND NOT CMAKE_CROSSCOMPILING)
if (NAME STREQUAL "PREFIX")
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))"
RESULT_VARIABLE _result
@@ -1000,9 +996,9 @@ function (_PYTHON_VALIDATE_INTERPRETER)
endif()
endif()
- if (CMAKE_SIZEOF_VOID_P AND ("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- OR "Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ if (CMAKE_SIZEOF_VOID_P AND ("Development.Module" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
+ OR "Development.SABIModule" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
+ OR "Development.Embed" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
AND NOT CMAKE_CROSSCOMPILING)
# In this case, interpreter must have same architecture as environment
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
@@ -1368,7 +1364,7 @@ endfunction()
function (_PYTHON_SET_DEVELOPMENT_MODULE_FOUND module)
- if ("Development.${module}" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ if ("Development.${module}" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
if (module STREQUAL "SABIModule"
AND "${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR}" VERSION_LESS "3.2")
# Stable API was introduced in version 3.2
@@ -1398,23 +1394,23 @@ function (_PYTHON_SET_DEVELOPMENT_MODULE_FOUND module)
endfunction()
-if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+if (${_PYTHON_BASE}_FIND_VERSION_RANGE)
# range must include internal major version
- if (${_PYTHON_PREFIX}_FIND_VERSION_MIN_MAJOR VERSION_GREATER _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR
- OR ((${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
- AND ${_PYTHON_PREFIX}_FIND_VERSION_MAX VERSION_LESS _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
- OR (${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
- AND ${_PYTHON_PREFIX}_FIND_VERSION_MAX VERSION_LESS_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)))
- _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong version range specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_RANGE}\", but expected version range must include major version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
+ if (${_PYTHON_BASE}_FIND_VERSION_MIN_MAJOR VERSION_GREATER _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR
+ OR ((${_PYTHON_BASE}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
+ AND ${_PYTHON_BASE}_FIND_VERSION_MAX VERSION_LESS _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+ OR (${_PYTHON_BASE}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
+ AND ${_PYTHON_BASE}_FIND_VERSION_MAX VERSION_LESS_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)))
+ _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong version range specified is \"${${_PYTHON_BASE}_FIND_VERSION_RANGE}\", but expected version range must include major version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
cmake_policy(POP)
return()
endif()
else()
- if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR
- AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+ if (DEFINED ${_PYTHON_BASE}_FIND_VERSION_MAJOR
+ AND NOT ${_PYTHON_BASE}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
# If major version is specified, it must be the same as internal major version
- _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
+ _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_BASE}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
cmake_policy(POP)
return()
@@ -1423,42 +1419,42 @@ endif()
# handle components
-if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS)
- set (${_PYTHON_PREFIX}_FIND_COMPONENTS Interpreter)
- set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE)
+if (NOT ${_PYTHON_BASE}_FIND_COMPONENTS)
+ set (${_PYTHON_BASE}_FIND_COMPONENTS Interpreter)
+ set (${_PYTHON_BASE}_FIND_REQUIRED_Interpreter TRUE)
endif()
-if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
- list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development.Module")
+if ("NumPy" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
+ list (APPEND ${_PYTHON_BASE}_FIND_COMPONENTS "Interpreter" "Development.Module")
endif()
-if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
- list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Development.Module" "Development.Embed")
+if ("Development" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
+ list (APPEND ${_PYTHON_BASE}_FIND_COMPONENTS "Development.Module" "Development.Embed")
endif()
-list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS)
-foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Interpreter Compiler Development Development.Module Development.SABIModule Development.Embed NumPy)
- set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE)
+list (REMOVE_DUPLICATES ${_PYTHON_BASE}_FIND_COMPONENTS)
+foreach (component IN ITEMS Interpreter Compiler Development Development.Module Development.SABIModule Development.Embed NumPy)
+ set (${_PYTHON_PREFIX}_${component}_FOUND FALSE)
endforeach()
-if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development)
- set (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Module TRUE)
- set (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Embed TRUE)
+if (${_PYTHON_BASE}_FIND_REQUIRED_Development)
+ set (${_PYTHON_BASE}_FIND_REQUIRED_Development.Module TRUE)
+ set (${_PYTHON_BASE}_FIND_REQUIRED_Development.Embed TRUE)
endif()
unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS)
unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_SABIMODULE_ARTIFACTS)
unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS)
-if ("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+if ("Development.Module" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
if (CMAKE_SYSTEM_NAME MATCHES "^(Windows.*|CYGWIN|MSYS)$")
list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS "LIBRARY")
endif()
list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS "INCLUDE_DIR")
endif()
-if ("Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+if ("Development.SABIModule" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
if (CMAKE_SYSTEM_NAME MATCHES "^(Windows.*|CYGWIN|MSYS)$")
list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_SABIMODULE_ARTIFACTS "SABI_LIBRARY")
endif()
list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_SABIMODULE_ARTIFACTS "INCLUDE_DIR")
endif()
-if ("Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+if ("Development.Embed" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS "LIBRARY" "INCLUDE_DIR")
endif()
set (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS} ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_SABIMODULE_ARTIFACTS} ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS})
@@ -1469,29 +1465,29 @@ list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSIONS})
unset (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
-if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+if (${_PYTHON_BASE}_FIND_VERSION_RANGE)
unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
- foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
- if ((${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE"
- AND _${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL ${_PYTHON_PREFIX}_FIND_VERSION_MIN)
- AND ((${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
- AND _${_PYTHON_PREFIX}_VERSION VERSION_LESS_EQUAL ${_PYTHON_PREFIX}_FIND_VERSION_MAX)
- OR (${_PYTHON_PREFIX}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
- AND _${_PYTHON_PREFIX}_VERSION VERSION_LESS ${_PYTHON_PREFIX}_FIND_VERSION_MAX)))
- list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION})
+ foreach (version IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
+ if ((${_PYTHON_BASE}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE"
+ AND version VERSION_GREATER_EQUAL ${_PYTHON_BASE}_FIND_VERSION_MIN)
+ AND ((${_PYTHON_BASE}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
+ AND version VERSION_LESS_EQUAL ${_PYTHON_BASE}_FIND_VERSION_MAX)
+ OR (${_PYTHON_BASE}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
+ AND version VERSION_LESS ${_PYTHON_BASE}_FIND_VERSION_MAX)))
+ list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${version})
endif()
endforeach()
else()
- if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER 1)
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
+ if (${_PYTHON_BASE}_FIND_VERSION_COUNT GREATER 1)
+ if (${_PYTHON_BASE}_FIND_VERSION_EXACT)
set (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT "EXACT")
- set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR})
+ set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_BASE}_FIND_VERSION_MAJOR}.${${_PYTHON_BASE}_FIND_VERSION_MINOR})
else()
unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
# add all compatible versions
- foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
- if (_${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL "${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR}")
- list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION})
+ foreach (version IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
+ if (version VERSION_GREATER_EQUAL "${${_PYTHON_BASE}_FIND_VERSION_MAJOR}.${${_PYTHON_BASE}_FIND_VERSION_MINOR}")
+ list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${version})
endif()
endforeach()
endif()
@@ -1550,9 +1546,9 @@ endif()
unset (_${_PYTHON_PREFIX}_REGISTRY_VIEW)
if (CMAKE_SIZEOF_VOID_P)
math (EXPR _${_PYTHON_PREFIX}_ARCH "${CMAKE_SIZEOF_VOID_P} * 8")
- if ("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- OR "Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ if ("Development.Module" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
+ OR "Development.SABIModule" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
+ OR "Development.Embed" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
# In this case, search only for 64bit or 32bit
set (_${_PYTHON_PREFIX}_REGISTRY_VIEW REGISTRY_VIEW ${_${_PYTHON_PREFIX}_ARCH})
if (WIN32 AND (NOT CMAKE_GENERATOR_PLATFORM AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM"
@@ -1725,7 +1721,22 @@ if (DEFINED ENV{VIRTUAL_ENV} OR DEFINED ENV{CONDA_PREFIX})
else()
set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV STANDARD)
endif()
-
+if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$" AND DEFINED ENV{VIRTUAL_ENV})
+ # retrieve root_dir of python installation
+ block(SCOPE_FOR VARIABLES PROPAGATE _${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR)
+ if (IS_READABLE "$ENV{VIRTUAL_ENV}/pyvenv.cfg")
+ file(STRINGS "$ENV{VIRTUAL_ENV}/pyvenv.cfg" python_home REGEX "^home = .+")
+ if(python_home MATCHES "^home = (.+)$")
+ cmake_path(SET _${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR "${CMAKE_MATCH_1}")
+ if (_${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR MATCHES "bin$")
+ cmake_path(GET _${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR PARENT_PATH _${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR)
+ endif()
+ endif()
+ endif()
+ endblock()
+else()
+ unset(_${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR)
+endif()
# Python naming handling
if (DEFINED ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES)
@@ -1754,7 +1765,7 @@ if (CMAKE_HOST_WIN32)
endif()
function (_PYTHON_CHECK_DEVELOPMENT_SIGNATURE module)
- if ("Development.${module}" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ if ("Development.${module}" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
string (TOUPPER "${module}" id)
set (signature "${_${_PYTHON_PREFIX}_SIGNATURE}:")
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
@@ -1769,12 +1780,12 @@ function (_PYTHON_CHECK_DEVELOPMENT_SIGNATURE module)
string (MD5 signature "${signature}")
if (signature STREQUAL _${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- _python_validate_library (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
- elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_EXACT)
+ _python_validate_library (VERSION ${${_PYTHON_BASE}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_BASE}_FIND_VERSION_RANGE)
_python_validate_library (IN_RANGE CHECK_EXISTS)
- elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
- _python_validate_library (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ elseif (DEFINED ${_PYTHON_BASE}_FIND_VERSION)
+ _python_validate_library (VERSION ${${_PYTHON_BASE}_FIND_VERSION} CHECK_EXISTS)
else()
_python_validate_library (CHECK_EXISTS)
endif()
@@ -1783,12 +1794,12 @@ function (_PYTHON_CHECK_DEVELOPMENT_SIGNATURE module)
_python_validate_sabi_library (CHECK_EXISTS)
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- _python_validate_include_dir (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
- elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_EXACT)
+ _python_validate_include_dir (VERSION ${${_PYTHON_BASE}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_BASE}_FIND_VERSION_RANGE)
_python_validate_include_dir (IN_RANGE CHECK_EXISTS)
- elseif (${_PYTHON_PREFIX}_FIND_VERSION)
- _python_validate_include_dir (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ elseif (${_PYTHON_BASE}_FIND_VERSION)
+ _python_validate_include_dir (VERSION ${${_PYTHON_BASE}_FIND_VERSION} CHECK_EXISTS)
else()
_python_validate_include_dir (CHECK_EXISTS)
endif()
@@ -1864,11 +1875,11 @@ endif()
# first step, search for the interpreter
-if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+if ("Interpreter" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE
_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG
_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
- if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter)
+ if (${_PYTHON_BASE}_FIND_REQUIRED_Interpreter)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
endif()
@@ -1885,12 +1896,12 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
string (MD5 __${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_EXECUTABLE}")
if (__${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE)
# check version validity
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- _python_validate_interpreter (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
- elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_EXACT)
+ _python_validate_interpreter (VERSION ${${_PYTHON_BASE}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_BASE}_FIND_VERSION_RANGE)
_python_validate_interpreter (IN_RANGE CHECK_EXISTS)
- elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
- _python_validate_interpreter (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ elseif (DEFINED ${_PYTHON_BASE}_FIND_VERSION)
+ _python_validate_interpreter (VERSION ${${_PYTHON_BASE}_FIND_VERSION} CHECK_EXISTS)
else()
_python_validate_interpreter (CHECK_EXISTS)
endif()
@@ -1918,10 +1929,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
_python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
set (_${_PYTHON_PREFIX}_VALIDATE_OPTIONS ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
- if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_RANGE)
list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE)
- elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
- list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS VERSION ${${_PYTHON_PREFIX}_FIND_VERSION})
+ elseif (DEFINED ${_PYTHON_BASE}_FIND_VERSION)
+ list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS VERSION ${${_PYTHON_BASE}_FIND_VERSION})
endif()
while (TRUE)
@@ -2035,7 +2046,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
else()
# look-up for various versions and locations
set (_${_PYTHON_PREFIX}_COMMON_VALIDATE_OPTIONS EXACT)
- if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_RANGE)
list (APPEND _${_PYTHON_PREFIX}_COMMON_VALIDATE_OPTIONS IN_RANGE)
endif()
@@ -2365,9 +2376,9 @@ endif()
# second step, search for compiler (IronPython)
-if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+if ("Compiler" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_COMPILER)
- if (${_PYTHON_PREFIX}_FIND_REQUIRED_Compiler)
+ if (${_PYTHON_BASE}_FIND_REQUIRED_Compiler)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_COMPILER)
endif()
@@ -2382,12 +2393,12 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
string (MD5 __${_PYTHON_PREFIX}_COMPILER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_COMPILER}")
if (__${_PYTHON_PREFIX}_COMPILER_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_COMPILER_SIGNATURE)
# check version validity
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- _python_validate_compiler (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS)
- elseif (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_EXACT)
+ _python_validate_compiler (VERSION ${${_PYTHON_BASE}_FIND_VERSION} EXACT CHECK_EXISTS)
+ elseif (${_PYTHON_BASE}_FIND_VERSION_RANGE)
_python_validate_compiler (IN_RANGE CHECK_EXISTS)
- elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
- _python_validate_compiler (VERSION ${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS)
+ elseif (DEFINED ${_PYTHON_BASE}_FIND_VERSION)
+ _python_validate_compiler (VERSION ${${_PYTHON_BASE}_FIND_VERSION} CHECK_EXISTS)
else()
_python_validate_compiler (CHECK_EXISTS)
endif()
@@ -2425,10 +2436,10 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
set (_${_PYTHON_PREFIX}_VALIDATE_OPTIONS ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
- if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_RANGE)
list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE)
- elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION)
- list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS VERSION ${${_PYTHON_PREFIX}_FIND_VERSION})
+ elseif (DEFINED ${_PYTHON_BASE}_FIND_VERSION)
+ list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS VERSION ${${_PYTHON_BASE}_FIND_VERSION})
endif()
while (TRUE)
@@ -2523,7 +2534,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
else()
# try using root dir and registry
set (_${_PYTHON_PREFIX}_COMMON_VALIDATE_OPTIONS EXACT)
- if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE)
+ if (${_PYTHON_BASE}_FIND_VERSION_RANGE)
list (APPEND _${_PYTHON_PREFIX}_COMMON_VALIDATE_OPTIONS IN_RANGE)
endif()
@@ -2535,7 +2546,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
_python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES
IMPLEMENTATIONS IronPython
- VERSION ${_${_PYTHON_PREFIX}_FIND_VERSION}
+ VERSION ${_${_PYTHON_PREFIX}_VERSION}
COMPILER)
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS
@@ -2719,7 +2730,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# third step, search for the development artifacts
-if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Module)
+if (${_PYTHON_BASE}_FIND_REQUIRED_Development.Module)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARIES)
endif()
@@ -2727,7 +2738,7 @@ if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Module)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_INCLUDE_DIRS)
endif()
endif()
-if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.SABIModule)
+if (${_PYTHON_BASE}_FIND_REQUIRED_Development.SABIModule)
if ("SABI_LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_SABIMODULE_ARTIFACTS)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_SABI_LIBRARIES)
endif()
@@ -2735,7 +2746,7 @@ if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.SABIModule)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_INCLUDE_DIRS)
endif()
endif()
-if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Embed)
+if (${_PYTHON_BASE}_FIND_REQUIRED_Development.Embed)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARIES)
endif()
@@ -2745,9 +2756,9 @@ if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Embed)
endif()
list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_REQUIRED_VARS)
## Development environment is not compatible with IronPython interpreter
-if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- OR "Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+if (("Development.Module" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
+ OR "Development.SABIModule" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
+ OR "Development.Embed" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS)
AND ((${_PYTHON_PREFIX}_Interpreter_FOUND
AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython")
OR NOT ${_PYTHON_PREFIX}_Interpreter_FOUND))
@@ -2819,7 +2830,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS "${_${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR}" ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
@@ -2827,37 +2838,69 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
# Framework Paths
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
- # Apple frameworks handling
- if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ while (TRUE)
+ # Virtual environments handling
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
+ find_program (_${_PYTHON_PREFIX}_CONFIG
+ NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ PATH_SUFFIXES bin
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "ONLY")
+ break()
+ endif()
+ endif()
+
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ find_program (_${_PYTHON_PREFIX}_CONFIG
+ NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES bin
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
+ endif()
+
find_program (_${_PYTHON_PREFIX}_CONFIG
NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
+ PATH_SUFFIXES bin)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
- find_program (_${_PYTHON_PREFIX}_CONFIG
- NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
- NAMES_PER_DIR
- HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- PATH_SUFFIXES bin)
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ find_program (_${_PYTHON_PREFIX}_CONFIG
+ NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
+ NAMES_PER_DIR
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES bin
+ NO_DEFAULT_PATH)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
+ endif()
- # Apple frameworks handling
- if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
- find_program (_${_PYTHON_PREFIX}_CONFIG
- NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
- NAMES_PER_DIR
- PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
- NO_DEFAULT_PATH)
- endif()
+ break()
+ endwhile()
_python_get_launcher (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER CONFIG "${_${_PYTHON_PREFIX}_CONFIG}")
@@ -2917,37 +2960,69 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
# Framework Paths
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
- # Apple frameworks handling
- if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ while (TRUE)
+ # Virtual environments handling
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
+ find_program (_${_PYTHON_PREFIX}_CONFIG
+ NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ PATH_SUFFIXES bin
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "ONLY")
+ break()
+ endif()
+ endif()
+
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ find_program (_${_PYTHON_PREFIX}_CONFIG
+ NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES bin
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
+ endif()
+
find_program (_${_PYTHON_PREFIX}_CONFIG
NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
+ PATH_SUFFIXES bin)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
- find_program (_${_PYTHON_PREFIX}_CONFIG
- NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
- NAMES_PER_DIR
- HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- PATH_SUFFIXES bin)
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ find_program (_${_PYTHON_PREFIX}_CONFIG
+ NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
+ NAMES_PER_DIR
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES bin
+ NO_DEFAULT_PATH)
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ break()
+ endif()
+ endif()
- # Apple frameworks handling
- if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
- find_program (_${_PYTHON_PREFIX}_CONFIG
- NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES}
- NAMES_PER_DIR
- PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
- NO_DEFAULT_PATH)
- endif()
+ break()
+ endwhile()
unset (_${_PYTHON_PREFIX}_CONFIG_NAMES)
@@ -3055,13 +3130,13 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS "${_${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR}" ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
# library names
_python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} WIN32 POSIX LIBRARY)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} WIN32 DEBUG)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} WIN32 DEBUG LIBRARY)
# Paths suffixes
_python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} LIBRARY)
@@ -3128,7 +3203,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
else()
foreach (_${_PYTHON_PREFIX}_LIB_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
_python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 POSIX LIBRARY)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 DEBUG)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 DEBUG LIBRARY)
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION})
_python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION})
@@ -3226,7 +3301,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (WIN32 AND _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
# search for debug library
# use release library location as a hint
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG LIBRARY)
get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
find_library (_${_PYTHON_PREFIX}_LIBRARY_DEBUG
NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
@@ -3254,7 +3329,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
PATH_SUFFIXES bin)
endif()
if (_${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG LIBRARY)
get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}" DIRECTORY)
get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
_python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
@@ -3270,7 +3345,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (NOT _${_PYTHON_PREFIX}_SABI_LIBRARY_RELEASE)
## compute artifact names
_python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} WIN32 POSIX LIBRARY)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} WIN32 DEBUG)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} WIN32 DEBUG LIBRARY)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS
AND _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
@@ -3322,7 +3397,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS "${_${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR}" ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
@@ -3484,6 +3559,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (WIN32 AND _${_PYTHON_PREFIX}_SABI_LIBRARY_RELEASE)
# search for debug library
+ # use release library location as a hint
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} WIN32 DEBUG LIBRARY)
get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_SABI_LIBRARY_RELEASE}" DIRECTORY)
find_library (_${_PYTHON_PREFIX}_SABI_LIBRARY_DEBUG
NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
@@ -3500,6 +3577,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
# retrieve runtime libraries
if (_${_PYTHON_PREFIX}_SABI_LIBRARY_RELEASE)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} WIN32 POSIX LIBRARY)
get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_SABI_LIBRARY_RELEASE}" DIRECTORY)
get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
_python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_SABI_LIBRARY_RELEASE
@@ -3528,11 +3606,11 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
set (_${_PYTHON_PREFIX}_SABI_LIBRARY_REQUIRED FALSE)
foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Module SABIModule Embed)
string (TOUPPER "${_${_PYTHON_PREFIX}_COMPONENT}" _${_PYTHON_PREFIX}_ID)
- if ("Development.${_${_PYTHON_PREFIX}_COMPONENT}" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ if ("Development.${_${_PYTHON_PREFIX}_COMPONENT}" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND "LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${_${_PYTHON_PREFIX}_ID}_ARTIFACTS)
set (_${_PYTHON_PREFIX}_LIBRARY_REQUIRED TRUE)
endif()
- if ("Development.${_${_PYTHON_PREFIX}_COMPONENT}" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ if ("Development.${_${_PYTHON_PREFIX}_COMPONENT}" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND "SABI_LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${_${_PYTHON_PREFIX}_ID}_ARTIFACTS)
set (_${_PYTHON_PREFIX}_SABI_LIBRARY_REQUIRED TRUE)
endif()
@@ -3559,7 +3637,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS "${_${_PYTHON_PREFIX}_VIRTUALENV_ROOT_DIR}" ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
unset (_${_PYTHON_PREFIX}_INCLUDE_HINTS)
@@ -3794,7 +3872,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
endif()
- if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ if ("Development" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Development.Module_FOUND
AND ${_PYTHON_PREFIX}_Development.Embed_FOUND)
set (${_PYTHON_PREFIX}_Development_FOUND TRUE)
@@ -3881,10 +3959,10 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
_${_PYTHON_PREFIX}_DEVELOPMENT_EMBED_SIGNATURE)
endif()
-if (${_PYTHON_PREFIX}_FIND_REQUIRED_NumPy)
+if (${_PYTHON_BASE}_FIND_REQUIRED_NumPy)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIRS)
endif()
-if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
+if ("NumPy" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
if (DEFINED ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR
@@ -3997,16 +4075,22 @@ foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Interpreter Compiler Development
endif()
endforeach()
-find_package_handle_standard_args (${_PYTHON_PREFIX}
+foreach (component IN ITEMS Interpreter Compiler Development Development.Module Development.SABIModule Development.Embed NumPy)
+ set(${_PYTHON_BASE}_${component}_FOUND ${${_PYTHON_PREFIX}_${component}_FOUND})
+endforeach()
+
+find_package_handle_standard_args (${_PYTHON_BASE}
REQUIRED_VARS ${_${_PYTHON_PREFIX}_REQUIRED_VARS}
VERSION_VAR ${_PYTHON_PREFIX}_VERSION
HANDLE_VERSION_RANGE
HANDLE_COMPONENTS
REASON_FAILURE_MESSAGE "${_${_PYTHON_PREFIX}_REASON_FAILURE}")
+set(${_PYTHON_PREFIX}_FOUND ${${_PYTHON_BASE}_FOUND})
+
# Create imported targets and helper functions
if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
- if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ if ("Interpreter" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
if(NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
@@ -4030,7 +4114,7 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
endif()
endif()
- if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ if ("Compiler" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Compiler_FOUND
AND NOT TARGET ${_PYTHON_PREFIX}::Compiler)
add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED)
@@ -4038,11 +4122,11 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}")
endif()
- if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ if (("Development.Module" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Development.Module_FOUND)
- OR ("Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ OR ("Development.SABIModule" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Development.SABIModule_FOUND)
- OR ("Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ OR ("Development.Embed" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Development.Embed_FOUND))
macro (__PYTHON_IMPORT_LIBRARY __name)
@@ -4082,7 +4166,7 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
set_target_properties (${__name}
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_${_PREFIX}LIBRARY_RELEASE}"
- IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_${_PREFIX}RUNTIME_LIBRARY_RELEASE}")
+ IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_${_PREFIX}LIBRARY_RELEASE}")
set_target_properties (${__name}
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_${_PREFIX}LIBRARY_DEBUG}"
@@ -4289,7 +4373,7 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
endfunction()
endif()
- if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_NumPy_FOUND
+ if ("NumPy" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_NumPy_FOUND
AND NOT TARGET ${_PYTHON_PREFIX}::NumPy AND TARGET ${_PYTHON_PREFIX}::Module)
add_library (${_PYTHON_PREFIX}::NumPy INTERFACE IMPORTED)
set_property (TARGET ${_PYTHON_PREFIX}::NumPy
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index bf541ee..ce9a7d5 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPython2
@@ -43,7 +43,9 @@ If component ``Development`` is specified, it implies sub-components
To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` (or one of its sub-components) and ``NumPy``, specify all
-components at the same time::
+components at the same time:
+
+.. code-block:: cmake
find_package (Python2 COMPONENTS Interpreter Development)
@@ -321,9 +323,9 @@ Hints
.. note::
- If the component ``Development`` is requested, it is **strongly**
- recommended to also include the component ``Interpreter`` to get expected
- result.
+ If the component ``Development`` is requested (or one of its
+ sub-components) and is not found or the wrong artifacts are returned,
+ including also the component ``Interpreter`` may be helpful.
``Python2_FIND_IMPLEMENTATIONS``
.. versionadded:: 3.18
@@ -440,6 +442,31 @@ can be controlled with the following variable:
* If set to ``FALSE`` or undefined: Enable multiple version/component
requirements.
+``Python2_ARTIFACTS_PREFIX``
+ .. versionadded:: 4.0
+
+ Define a custom prefix which will be used for the definition of all the
+ result variables, targets, and commands. By using this variable, this module
+ supports multiple calls in the same directory with different
+ version/component requirements.
+ For example, in case of cross-compilation, development components are needed
+ but the native python interpreter can also be required:
+
+ .. code-block:: cmake
+
+ find_package(Python2 COMPONENTS Development)
+
+ set(Python2_ARTIFACTS_PREFIX "_HOST")
+ find_package(Python2 COMPONENTS Interpreter)
+
+ # Here Python2_HOST_EXECUTABLE and Python2_HOST::Interpreter artifacts are defined
+
+ .. note::
+
+ For consistency with standard behavior of modules, the various standard
+ ``_FOUND`` variables (i.e. without the custom prefix) are also defined by
+ each call to the :command:`find_package` command.
+
Commands
^^^^^^^^
@@ -447,7 +474,9 @@ This module defines the command ``Python2_add_library`` (when
:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
:command:`add_library` and adds a dependency to target ``Python2::Python`` or,
when library type is ``MODULE``, to target ``Python2::Module`` and takes care
-of Python module naming rules::
+of Python module naming rules:
+
+.. code-block:: cmake
Python2_add_library (<name> [STATIC | SHARED | MODULE]
<source1> [<source2> ...])
@@ -460,16 +489,23 @@ If library type is not specified, ``MODULE`` is assumed.
#]=======================================================================]
-set (_PYTHON_PREFIX Python2)
+set (_PYTHON_BASE Python2)
+if(${_PYTHON_BASE}_ARTIFACTS_PREFIX)
+ set(_PYTHON_PREFIX "${_PYTHON_BASE}${${_PYTHON_BASE}_ARTIFACTS_PREFIX}")
+else()
+ set(_PYTHON_PREFIX "${_PYTHON_BASE}")
+endif()
-set (_Python2_REQUIRED_VERSION_MAJOR 2)
+set (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR 2)
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
-if (COMMAND __Python2_add_library)
- macro (Python2_add_library)
- __Python2_add_library (Python2 ${ARGV})
- endmacro()
+if (COMMAND __${_PYTHON_PREFIX}_add_library AND NOT COMMAND ${_PYTHON_PREFIX}_add_library)
+ cmake_language(EVAL CODE
+ "macro (${_PYTHON_PREFIX}_add_library)
+ __${_PYTHON_PREFIX}_add_library (${_PYTHON_PREFIX} \${ARGV})
+ endmacro()")
endif()
+unset (_PYTHON_BASE)
unset (_PYTHON_PREFIX)
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index cf93ecb..5edc087 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPython3
@@ -50,7 +50,9 @@ If component ``Development`` is specified, it implies sub-components
To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` (or one of its sub-components) and ``NumPy``, specify all
-components at the same time::
+components at the same time:
+
+.. code-block:: cmake
find_package (Python3 COMPONENTS Interpreter Development)
@@ -338,14 +340,18 @@ Hints
``pydebug`` and ``gil_disabled``, ``debug`` and ``free threaded`` versions
will be searched **after** ``non-debug`` and ``non-gil-disabled`` ones.
- For example, if we have::
+ For example, if we have:
+
+ .. code-block:: cmake
set (Python3_FIND_ABI "ON" "ANY" "ANY" "ON")
The following flags combinations will be appended, in that order, to the
artifact names: ``tdmu``, ``tdm``, ``tdu``, and ``td``.
- And to search any possible ABIs::
+ And to search any possible ABIs:
+
+ .. code-block:: cmake
set (Python3_FIND_ABI "ANY" "ANY" "ANY" "ANY")
@@ -431,9 +437,9 @@ Hints
.. note::
- If the component ``Development`` is requested, it is **strongly**
- recommended to also include the component ``Interpreter`` to get expected
- result.
+ If the component ``Development`` is requested (or one of its
+ sub-components) and is not found or the wrong artifacts are returned,
+ including also the component ``Interpreter`` may be helpful.
``Python3_FIND_IMPLEMENTATIONS``
.. versionadded:: 3.18
@@ -557,6 +563,31 @@ can be controlled with the following variable:
* If set to ``FALSE`` or undefined: Enable multiple version/component
requirements.
+``Python3_ARTIFACTS_PREFIX``
+ .. versionadded:: 4.0
+
+ Define a custom prefix which will be used for the definition of all the
+ result variables, targets, and commands. By using this variable, this module
+ supports multiple calls in the same directory with different
+ version/component requirements.
+ For example, in case of cross-compilation, development components are needed
+ but the native python interpreter can also be required:
+
+ .. code-block:: cmake
+
+ find_package(Python3 COMPONENTS Development)
+
+ set(Python3_ARTIFACTS_PREFIX "_HOST")
+ find_package(Python3 COMPONENTS Interpreter)
+
+ # Here Python3_HOST_EXECUTABLE and Python3_HOST::Interpreter artifacts are defined
+
+ .. note::
+
+ For consistency with standard behavior of modules, the various standard
+ ``_FOUND`` variables (i.e. without the custom prefix) are also defined by
+ each call to the :command:`find_package` command.
+
Commands
^^^^^^^^
@@ -565,7 +596,9 @@ This module defines the command ``Python3_add_library`` (when
:command:`add_library` and adds a dependency to target ``Python3::Python`` or,
when library type is ``MODULE``, to target ``Python3::Module`` or
``Python3::SABIModule`` (when ``USE_SABI`` option is specified) and takes care
-of Python module naming rules::
+of Python module naming rules:
+
+.. code-block:: cmake
Python3_add_library (<name> [STATIC | SHARED | MODULE [USE_SABI <version>] [WITH_SOABI]]
<source1> [<source2> ...])
@@ -595,16 +628,23 @@ If the library type is not specified, ``MODULE`` is assumed.
#]=======================================================================]
-set (_PYTHON_PREFIX Python3)
+set (_PYTHON_BASE Python3)
+if(${_PYTHON_BASE}_ARTIFACTS_PREFIX)
+ set(_PYTHON_PREFIX "${_PYTHON_BASE}${${_PYTHON_BASE}_ARTIFACTS_PREFIX}")
+else()
+ set(_PYTHON_PREFIX "${_PYTHON_BASE}")
+endif()
-set (_Python3_REQUIRED_VERSION_MAJOR 3)
+set (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR 3)
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
-if (COMMAND __Python3_add_library)
- macro (Python3_add_library)
- __Python3_add_library (Python3 ${ARGV})
- endmacro()
+if (COMMAND __${_PYTHON_PREFIX}_add_library AND NOT COMMAND ${_PYTHON_PREFIX}_add_library)
+ cmake_language(EVAL CODE
+ "macro (${_PYTHON_PREFIX}_add_library)
+ __${_PYTHON_PREFIX}_add_library (${_PYTHON_PREFIX} \${ARGV})
+ endmacro()")
endif()
+unset (_PYTHON_BASE)
unset (_PYTHON_PREFIX)
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index e5bcb5f..e236112 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPythonInterp
@@ -178,7 +178,7 @@ if(PYTHON_EXECUTABLE)
unset(_VERSION)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
mark_as_advanced(PYTHON_EXECUTABLE)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 6bf244e..3d7b536 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPythonLibs
@@ -308,12 +308,12 @@ set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
# These variables have been historically named in this module different from
-# what SELECT_LIBRARY_CONFIGURATIONS() expects.
+# what select_library_configurations() expects.
set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}")
set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
-SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
-# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
+select_library_configurations(PYTHON)
+# select_library_configurations() sets ${PREFIX}_FOUND if it has a library.
# Unset this, this prefix doesn't match the module prefix, they are different
# for historical reasons.
unset(PYTHON_FOUND)
@@ -326,8 +326,8 @@ else()
unset(CMAKE_FIND_FRAMEWORK)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PythonLibs
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
VERSION_VAR PYTHONLIBS_VERSION_STRING)
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index 604f8e3..31d4c0b 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindQt
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 5a0037c..594fc63 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindQt3
@@ -207,14 +207,14 @@ if(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION)
endif()
# if the include a library are found then we have it
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if (CMAKE_FIND_PACKAGE_NAME STREQUAL "Qt")
# FindQt include()'s this module. It's an old pattern, but rather than trying
# to suppress this from outside the module (which is then sensitive to the
# contents, detect the case in this module and suppress it explicitly.
set(FPHSA_NAME_MISMATCHED 1)
endif ()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3
+find_package_handle_standard_args(Qt3
REQUIRED_VARS QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE
VERSION_VAR QT_VERSION_STRING)
unset(FPHSA_NAME_MISMATCHED)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 9174bee..580e1e2 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindQt4
@@ -203,7 +203,7 @@ more-manual way. Several macros are available to add targets for such uses.
same argument to the target_link_libraries call.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
A particular Qt library may be used by using the corresponding
@@ -334,7 +334,7 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
@@ -753,19 +753,19 @@ if (QT_QMAKE_EXECUTABLE AND
list(APPEND CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY})
# Check for Window system symbols (note: only one should end up being set)
- CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
- CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
- CHECK_CXX_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
- CHECK_CXX_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
+ check_cxx_symbol_exists(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
+ check_cxx_symbol_exists(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
+ check_cxx_symbol_exists(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
+ check_cxx_symbol_exists(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
if(Q_WS_MAC)
if(QT_QMAKE_CHANGED)
unset(QT_MAC_USE_COCOA CACHE)
endif()
- CHECK_CXX_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
+ check_cxx_symbol_exists(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
endif()
if (QT_QTCOPY_REQUIRED)
- CHECK_CXX_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
+ check_cxx_symbol_exists(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
if (NOT QT_IS_QTCOPY)
message(FATAL_ERROR "qt-copy is required, but hasn't been found")
endif ()
@@ -1080,23 +1080,21 @@ if (QT_QMAKE_EXECUTABLE AND
set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>)
set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN>>>)
- set(_isPolicyNEW $<TARGET_POLICY:CMP0020>)
get_target_property(_configs Qt4::QtCore IMPORTED_CONFIGURATIONS)
set_property(TARGET Qt4::QtCore APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
- $<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain>
+ $<$<AND:${_isExe},${_isWin32},${_isNotExcluded}>:Qt4::qtmain>
)
foreach(_config ${_configs})
set_property(TARGET Qt4::QtCore APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
- $<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain>
+ $<$<AND:${_isExe},${_isWin32},${_isNotExcluded}>:Qt4::qtmain>
)
endforeach()
unset(_configs)
unset(_isExe)
unset(_isWin32)
unset(_isNotExcluded)
- unset(_isPolicyNEW)
endif()
#######################################
@@ -1325,7 +1323,7 @@ else()
# explicitly.
set(FPHSA_NAME_MISMATCHED 1)
endif ()
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 FOUND_VAR Qt4_FOUND
+ find_package_handle_standard_args(Qt4
REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
VERSION_VAR QTVERSION
)
@@ -1343,4 +1341,3 @@ set (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
set( QT_QT_LIBRARY "")
set(QT4_FOUND ${Qt4_FOUND})
set(QT_FOUND ${Qt4_FOUND})
-
diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake
index 89be2a6..5df14ca 100644
--- a/Modules/FindQuickTime.cmake
+++ b/Modules/FindQuickTime.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindQuickTime
@@ -32,5 +32,5 @@ find_library(QUICKTIME_LIBRARY QuickTime
lib
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR)
diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake
index 54d2bec..0431f09 100644
--- a/Modules/FindRTI.cmake
+++ b/Modules/FindRTI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindRTI
@@ -42,6 +42,7 @@ endmacro()
set(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM")
+# noqa: spellcheck off
# Detect the CERTI installation, http://www.cert.fr/CERTI
# Detect the MAK Technologies RTI installation, http://www.mak.com/products/rti.php
# note: the following list is ordered to find the most recent version first
@@ -55,6 +56,7 @@ set(RTI_POSSIBLE_DIRS
set(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# The MAK RTI has the "lib" prefix even on Windows.
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
+# noqa: spellcheck on
find_library(RTI_LIBRARY
NAMES RTI RTI-NG
@@ -95,8 +97,8 @@ endif ()
# Set the modified system variables back to the original value.
set(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}")
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(RTI DEFAULT_MSG
RTI_LIBRARY RTI_INCLUDE_DIR)
# $Id$
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 1da066a..3881319 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindRuby
@@ -17,8 +17,7 @@ standard syntax, e.g.
# OR
find_package(Ruby 3.2)
-Virtual environments such as RVM are handled as well, by passing
-the argument ``Ruby_FIND_VIRTUALENV``
+Virtual environments, such as RVM or RBENV, are supported.
Result Variables
^^^^^^^^^^^^^^^^
@@ -45,251 +44,230 @@ This module will set the following variables in your project:
.. versionchanged:: 3.18
Previous versions of CMake used the ``RUBY_`` prefix for all variables.
- The following variables are provided for compatibility reasons,
- don't use them in new code:
-
-``RUBY_EXECUTABLE``
- same as Ruby_EXECUTABLE.
-``RUBY_INCLUDE_DIRS``
- same as Ruby_INCLUDE_DIRS.
-``RUBY_INCLUDE_PATH``
- same as Ruby_INCLUDE_DIRS.
-``RUBY_LIBRARY``
- same as Ruby_LIBRARY.
-``RUBY_VERSION``
- same as Ruby_VERSION.
-``RUBY_FOUND``
- same as Ruby_FOUND.
+
+.. deprecated:: 4.0
+ The following variables are deprecated. See policy :policy:`CMP0185`.
+
+ ``RUBY_EXECUTABLE``
+ same as ``Ruby_EXECUTABLE``.
+ ``RUBY_INCLUDE_DIRS``
+ same as ``Ruby_INCLUDE_DIRS``.
+ ``RUBY_INCLUDE_PATH``
+ same as ``Ruby_INCLUDE_DIRS``.
+ ``RUBY_LIBRARY``
+ same as ``Ruby_LIBRARY``.
+ ``RUBY_VERSION``
+ same as ``Ruby_VERSION``.
+ ``RUBY_FOUND``
+ same as ``Ruby_FOUND``.
Hints
^^^^^
-.. versionadded:: 3.18
-
``Ruby_FIND_VIRTUALENV``
- This variable defines the handling of virtual environments managed by
- ``rvm``. It is meaningful only when a virtual environment
- is active (i.e. the ``rvm`` script has been evaluated or at least the
- ``MY_RUBY_HOME`` environment variable is set).
- The ``Ruby_FIND_VIRTUALENV`` variable can be set to empty or
- one of the following:
-
- * ``FIRST``: The virtual environment is used before any other standard
- paths to look-up for the interpreter. This is the default.
- * ``ONLY``: Only the virtual environment is used to look-up for the
- interpreter.
- * ``STANDARD``: The virtual environment is not used to look-up for the
- interpreter (assuming it isn't still in the PATH...)
+ .. versionadded:: 3.18
-#]=======================================================================]
+ This variable defines the handling of virtual environments.
+ It can be left empty or be set to one of the following values:
-# Backwards compatibility
-# Define camel case versions of input variables
-foreach(UPPER
- RUBY_EXECUTABLE
- RUBY_LIBRARY
- RUBY_INCLUDE_DIR
- RUBY_CONFIG_INCLUDE_DIR
- )
- if (DEFINED ${UPPER})
- string(REPLACE "RUBY_" "Ruby_" Camel ${UPPER})
- if (NOT DEFINED ${Camel})
- set(${Camel} ${${UPPER}})
- endif()
- endif()
-endforeach()
+ * ``FIRST``: Virtual Ruby environments are searched for first,
+ then the system Ruby installation.
+ This is the default.
+ * ``ONLY``: Only virtual environments are searched
+ * ``STANDARD``: Only the system Ruby installation is searched.
-# Ruby_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
-# Ruby_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
-# Ruby_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
-# Ruby_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
-# Ruby_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
+ Virtual environments may be provided by:
-# uncomment the following line to get debug output for this file
-# set(_Ruby_DEBUG_OUTPUT TRUE)
+ ``rvm``
+ Requires that the ``MY_RUBY_HOME`` environment environment is defined.
-# Determine the list of possible names of the ruby executable depending
-# on which version of ruby is required
-set(_Ruby_POSSIBLE_EXECUTABLE_NAMES ruby)
+ ``rbenv``
+ Requires that ``rbenv`` is installed in ``~/.rbenv/bin``
+ or that the ``RBENV_ROOT`` environment variable is defined.
+#]=======================================================================]
-# If not specified, allow everything as far back as 1.8.0
-if(NOT DEFINED Ruby_FIND_VERSION_MAJOR)
- set(Ruby_FIND_VERSION "1.8.0")
- set(Ruby_FIND_VERSION_MAJOR 1)
- set(Ruby_FIND_VERSION_MINOR 8)
- set(Ruby_FIND_VERSION_PATCH 0)
-endif()
+cmake_policy(GET CMP0185 _Ruby_CMP0185)
-if(_Ruby_DEBUG_OUTPUT)
- message("Ruby_FIND_VERSION=${Ruby_FIND_VERSION}")
- message("Ruby_FIND_VERSION_MAJOR=${Ruby_FIND_VERSION_MAJOR}")
- message("Ruby_FIND_VERSION_MINOR=${Ruby_FIND_VERSION_MINOR}")
- message("Ruby_FIND_VERSION_PATCH=${Ruby_FIND_VERSION_PATCH}")
+if(NOT _Ruby_CMP0185 STREQUAL "NEW")
+ # Backwards compatibility
+ # Define camel case versions of input variables
+ foreach (UPPER
+ RUBY_EXECUTABLE
+ RUBY_LIBRARY
+ RUBY_INCLUDE_DIR
+ RUBY_CONFIG_INCLUDE_DIR)
+ if (DEFINED ${UPPER})
+ string(REPLACE "RUBY_" "Ruby_" Camel ${UPPER})
+ if (NOT DEFINED ${Camel})
+ set(${Camel} ${${UPPER}})
+ endif ()
+ endif ()
+ endforeach ()
endif()
-set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR}")
+# Uncomment the following line to get debug output for this file
+# set(CMAKE_MESSAGE_LOG_LEVEL DEBUG)
-# Set name of possible executables, ignoring the minor
-# Eg:
-# 3.2.6 => from ruby34 to ruby32 included
-# 3.2 => from ruby34 to ruby32 included
-# 3 => from ruby34 to ruby30 included
-# empty => from ruby34 to ruby18 included
-if(NOT Ruby_FIND_VERSION_EXACT)
+# Determine the list of possible names of the ruby executable depending
+# on which version of ruby is required
+set(_Ruby_POSSIBLE_EXECUTABLE_NAMES ruby)
- foreach(_ruby_version RANGE 34 18 -1)
+# If the user has not specified a Ruby version, create a list of Ruby versions
+# to check going from 1.8 to 3.4
+if (NOT Ruby_FIND_VERSION_EXACT)
+ foreach (_ruby_version RANGE 34 18 -1)
string(SUBSTRING "${_ruby_version}" 0 1 _ruby_major_version)
string(SUBSTRING "${_ruby_version}" 1 1 _ruby_minor_version)
+ # Append both rubyX.Y and rubyXY (eg: ruby3.4 ruby34)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby${_ruby_major_version}.${_ruby_minor_version} ruby${_ruby_major_version}${_ruby_minor_version})
+ endforeach ()
+endif ()
+
+# Virtual environment handling
+if (DEFINED Ruby_FIND_VIRTUALENV AND NOT Ruby_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY|STANDARD)$")
+ message(AUTHOR_WARNING "FindRuby: ${Ruby_FIND_VIRTUALENV}: invalid value for 'Ruby_FIND_VIRTUALENV'. 'FIRST', 'ONLY' or 'STANDARD' expected. 'FIRST' will be used instead.")
+ set(Ruby_FIND_VIRTUALENV "FIRST")
+elseif (NOT DEFINED Ruby_FIND_VIRTUALENV)
+ # Default is to search for virtual environments first
+ set(Ruby_FIND_VIRTUALENV "FIRST")
+endif ()
+
+# Validate the found Ruby interpreter to make sure that it is
+# callable and that its version matches the requested version
+function(_RUBY_VALIDATE_INTERPRETER result_var path)
+ # Get the interpreter version
+ execute_process(COMMAND "${path}" -e "puts RUBY_VERSION"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (NOT result EQUAL 0)
+ set(_Ruby_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${path}\"")
+ set(${result_var} FALSE PARENT_SCOPE)
+ return()
+ endif ()
+
+ if (Ruby_FIND_VERSION)
+ if (Ruby_FIND_VERSION_EXACT AND NOT version VERSION_EQUAL Ruby_FIND_VERSION)
+ message(DEBUG "Incorrect Ruby found. Requested: ${Ruby_FIND_VERSION}. Found: ${version}. Path: \"${path}\"")
+ set(${result_var} FALSE PARENT_SCOPE)
+ return()
+ elseif (version VERSION_LESS Ruby_FIND_VERSION)
+ message(DEBUG "Ruby version is too old. Minimum: ${Ruby_FIND_VERSION}. Found: ${version}. Path: \"${path}\"")
+ set(${result_var} FALSE PARENT_SCOPE)
+ return()
+ endif ()
+ endif ()
+
+ # Found valid Ruby interpreter!
+ set(${result_var} TRUE PARENT_SCOPE)
+endfunction()
- if(NOT "${_ruby_major_version}${_ruby_minor_version}" VERSION_LESS ${Ruby_FIND_VERSION_SHORT_NODOT})
- # Append both rubyX.Y and rubyXY (eg: ruby2.7 ruby27)
- list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby${_ruby_major_version}.${_ruby_minor_version} ruby${_ruby_major_version}${_ruby_minor_version})
- else()
- break()
- endif()
-
- endforeach()
-
- list(REMOVE_DUPLICATES _Ruby_POSSIBLE_EXECUTABLE_NAMES)
-endif()
+# Query Ruby RBConfig module for the specified variable (_RUBY_CONFIG_VAR)
+function(_RUBY_CONFIG_VAR RBVAR OUTVAR)
+ execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _Ruby_SUCCESS
+ OUTPUT_VARIABLE _Ruby_OUTPUT
+ ERROR_QUIET)
+
+ # Config was deprecated in Ruby 1.9 and then removed in Ruby 2 - so this is for ancient code
+ if (_Ruby_SUCCESS OR _Ruby_OUTPUT STREQUAL "")
+ execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _Ruby_SUCCESS
+ OUTPUT_VARIABLE _Ruby_OUTPUT
+ ERROR_QUIET)
+ endif ()
+
+ set(${OUTVAR} "${_Ruby_OUTPUT}" PARENT_SCOPE)
+endfunction()
-# virtual environments handling (eg RVM)
-if (DEFINED ENV{MY_RUBY_HOME})
- if(_Ruby_DEBUG_OUTPUT)
- message("My ruby home is defined: $ENV{MY_RUBY_HOME}")
- endif()
-
- if (DEFINED Ruby_FIND_VIRTUALENV)
- if (NOT Ruby_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY|STANDARD)$")
- message (AUTHOR_WARNING "FindRuby: ${Ruby_FIND_VIRTUALENV}: invalid value for 'Ruby_FIND_VIRTUALENV'. 'FIRST', 'ONLY' or 'STANDARD' expected. 'FIRST' will be used instead.")
- set (_Ruby_FIND_VIRTUALENV "FIRST")
- else()
- set (_Ruby_FIND_VIRTUALENV ${Ruby_FIND_VIRTUALENV})
- endif()
- else()
- set (_Ruby_FIND_VIRTUALENV FIRST)
- endif()
-else()
- if (DEFINED Ruby_FIND_VIRTUALENV)
- message("Environment variable MY_RUBY_HOME isn't set, defaulting back to Ruby_FIND_VIRTUALENV=STANDARD")
- endif()
- set (_Ruby_FIND_VIRTUALENV STANDARD)
-endif()
+# Check for RVM virtual environments
+function(_RUBY_CHECK_RVM)
+ if (NOT DEFINED ENV{MY_RUBY_HOME})
+ return()
+ endif ()
+
+ find_program(Ruby_EXECUTABLE
+ NAMES ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}
+ NAMES_PER_DIR
+ PATHS ENV MY_RUBY_HOME
+ PATH_SUFFIXES bin Scripts
+ VALIDATOR _RUBY_VALIDATE_INTERPRETER
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
-if(_Ruby_DEBUG_OUTPUT)
- message("_Ruby_POSSIBLE_EXECUTABLE_NAMES=${_Ruby_POSSIBLE_EXECUTABLE_NAMES}")
- message("_Ruby_FIND_VIRTUALENV=${_Ruby_FIND_VIRTUALENV}")
-endif()
+ if (Ruby_EXECUTABLE)
+ set(Ruby_ENV "RVM" CACHE INTERNAL "Ruby environment")
+ endif ()
+endfunction()
-function (_RUBY_VALIDATE_INTERPRETER)
- if (NOT Ruby_EXECUTABLE)
+# Check for RBENV virtual environments
+function(_RUBY_CHECK_RBENV)
+ find_program(Ruby_RBENV_EXECUTABLE
+ NAMES rbenv
+ NAMES_PER_DIR
+ PATHS "$ENV{HOME}/.rbenv/bin/rbenv" ENV RBENV_ROOT
+ PATH_SUFFIXES bin Scripts
+ NO_CACHE
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+
+ execute_process(COMMAND "${Ruby_RBENV_EXECUTABLE}" "which" "ruby"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE ruby_exe
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (NOT result EQUAL 0)
return()
- endif()
-
- cmake_parse_arguments (PARSE_ARGV 0 _RVI "EXACT;CHECK_EXISTS" "" "")
- if (_RVI_UNPARSED_ARGUMENTS)
- set (expected_version ${_RVI_UNPARSED_ARGUMENTS})
- else()
- unset (expected_version)
- endif()
-
- if (_RVI_CHECK_EXISTS AND NOT EXISTS "${Ruby_EXECUTABLE}")
- # interpreter does not exist anymore
- set (_Ruby_Interpreter_REASON_FAILURE "Cannot find the interpreter \"${Ruby_EXECUTABLE}\"")
- set_property (CACHE Ruby_EXECUTABLE PROPERTY VALUE "Ruby_EXECUTABLE-NOTFOUND")
- return()
- endif()
-
- # Check the version it returns
- # executable found must have a specific version
- execute_process (COMMAND "${Ruby_EXECUTABLE}" -e "puts RUBY_VERSION"
- RESULT_VARIABLE result
- OUTPUT_VARIABLE version
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (result OR (_RVI_EXACT AND NOT version VERSION_EQUAL expected_version) OR (version VERSION_LESS expected_version))
- # interpreter not usable or has wrong major version
- if (result)
- set (_Ruby_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${Ruby_EXECUTABLE}\"")
- else()
- set (_Ruby_Interpreter_REASON_FAILURE "Wrong major version for the interpreter \"${Ruby_EXECUTABLE}\"")
- endif()
- set_property (CACHE Ruby_EXECUTABLE PROPERTY VALUE "Ruby_EXECUTABLE-NOTFOUND")
- return()
- endif()
+ endif ()
+ cmake_path(GET ruby_exe PARENT_PATH ruby_dir)
-endfunction()
+ find_program(Ruby_EXECUTABLE
+ NAMES ruby
+ NAMES_PER_DIR
+ PATHS ${ruby_dir}
+ VALIDATOR _RUBY_VALIDATE_INTERPRETER
+ NO_DEFAULT_PATH)
-while(1)
- # Virtual environments handling
- if(_Ruby_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- if(_Ruby_DEBUG_OUTPUT)
- message("Inside Matches")
- endif()
- find_program (Ruby_EXECUTABLE
- NAMES ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}
- NAMES_PER_DIR
- PATHS ENV MY_RUBY_HOME
- PATH_SUFFIXES bin Scripts
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
-
- if(_Ruby_DEBUG_OUTPUT)
- message("Ruby_EXECUTABLE=${Ruby_EXECUTABLE}")
- endif()
-
- _RUBY_VALIDATE_INTERPRETER (${Ruby_FIND_VERSION}})
- if(Ruby_EXECUTABLE)
- break()
- endif()
- if(NOT _Ruby_FIND_VIRTUALENV STREQUAL "ONLY")
- break()
- endif()
- elseif(_Ruby_DEBUG_OUTPUT)
- message("_Ruby_FIND_VIRTUALENV doesn't match: ${_Ruby_FIND_VIRTUALENV}")
- endif()
-
- # try using standard paths
- find_program (Ruby_EXECUTABLE
- NAMES ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}
- NAMES_PER_DIR)
- _RUBY_VALIDATE_INTERPRETER (${Ruby_FIND_VERSION})
if (Ruby_EXECUTABLE)
- break()
- else()
- # Remove first entry from names list.
- LIST(REMOVE_AT _Ruby_POSSIBLE_EXECUTABLE_NAMES 0)
-
- # If the list is now empty, abort.
- if (NOT _Ruby_POSSIBLE_EXECUTABLE_NAMES)
- break()
- else()
- # Otherwise, continue with the remaining list. Make sure that we clear
- # the cached variable.
- unset(Ruby_EXECUTABLE CACHE)
- endif()
- endif()
-
-endwhile()
-
-if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
- function(_RUBY_CONFIG_VAR RBVAR OUTVAR)
- execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']"
- RESULT_VARIABLE _Ruby_SUCCESS
- OUTPUT_VARIABLE _Ruby_OUTPUT
- ERROR_QUIET)
- if(_Ruby_SUCCESS OR _Ruby_OUTPUT STREQUAL "")
- execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
- RESULT_VARIABLE _Ruby_SUCCESS
- OUTPUT_VARIABLE _Ruby_OUTPUT
- ERROR_QUIET)
- endif()
- set(${OUTVAR} "${_Ruby_OUTPUT}" PARENT_SCOPE)
- endfunction()
+ set(Ruby_ENV "RBENV" CACHE INTERNAL "Ruby environment")
+ endif ()
+endfunction()
+# Check system installed Ruby
+function(_RUBY_CHECK_SYSTEM)
+ find_program(Ruby_EXECUTABLE
+ NAMES ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}
+ NAMES_PER_DIR
+ VALIDATOR _RUBY_VALIDATE_INTERPRETER)
+
+ if (Ruby_EXECUTABLE)
+ set(Ruby_ENV "Standard" CACHE INTERNAL "Ruby environment")
+ endif ()
+endfunction()
+# Find Ruby
+if (NOT Ruby_EXECUTABLE AND Ruby_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
+ # First check for RVM virtual environments
+ _RUBY_CHECK_RVM()
+ # Second check for RBENV virtual environments
+ if (NOT Ruby_EXECUTABLE)
+ _RUBY_CHECK_RBENV()
+ endif ()
+endif ()
+
+# Fallback to system installed Ruby
+if (NOT Ruby_EXECUTABLE AND NOT Ruby_FIND_VIRTUALENV STREQUAL "ONLY")
+ _RUBY_CHECK_SYSTEM()
+endif ()
+
+# We found a new Ruby or a Ruby that is different than the last one we found.
+# So reload a number of variables by querying the Ruby interpreter.
+if (Ruby_EXECUTABLE AND NOT Ruby_EXECUTABLE STREQUAL "${_Ruby_EXECUTABLE_LAST_QUERIED}")
# query the ruby version
_RUBY_CONFIG_VAR("MAJOR" Ruby_VERSION_MAJOR)
_RUBY_CONFIG_VAR("MINOR" Ruby_VERSION_MINOR)
@@ -300,7 +278,7 @@ if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
_RUBY_CONFIG_VAR("arch" Ruby_ARCH)
_RUBY_CONFIG_VAR("rubyhdrdir" Ruby_HDR_DIR)
_RUBY_CONFIG_VAR("rubyarchhdrdir" Ruby_ARCHHDR_DIR)
- _RUBY_CONFIG_VAR("libdir" Ruby_POSSIBLE_LIB_DIR)
+ _RUBY_CONFIG_VAR("libdir" _Ruby_POSSIBLE_LIB_DIR)
_RUBY_CONFIG_VAR("rubylibdir" Ruby_RUBY_LIB_DIR)
# site_ruby
@@ -309,202 +287,199 @@ if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
# vendor_ruby available ?
execute_process(COMMAND ${Ruby_EXECUTABLE} -r vendor-specific -e "print 'true'"
- OUTPUT_VARIABLE Ruby_HAS_VENDOR_RUBY ERROR_QUIET)
+ OUTPUT_VARIABLE Ruby_HAS_VENDOR_RUBY ERROR_QUIET)
- if(Ruby_HAS_VENDOR_RUBY)
+ if (Ruby_HAS_VENDOR_RUBY)
_RUBY_CONFIG_VAR("vendorlibdir" Ruby_VENDORLIB_DIR)
_RUBY_CONFIG_VAR("vendorarchdir" Ruby_VENDORARCH_DIR)
- endif()
+ endif ()
# save the results in the cache so we don't have to run ruby the next time again
- set(Ruby_VERSION_MAJOR ${Ruby_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE)
- set(Ruby_VERSION_MINOR ${Ruby_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE)
- set(Ruby_VERSION_PATCH ${Ruby_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE)
- set(Ruby_ARCH_DIR ${Ruby_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE)
- set(Ruby_HDR_DIR ${Ruby_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE)
- set(Ruby_ARCHHDR_DIR ${Ruby_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE)
- set(Ruby_POSSIBLE_LIB_DIR ${Ruby_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE)
- set(Ruby_RUBY_LIB_DIR ${Ruby_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE)
- set(Ruby_SITEARCH_DIR ${Ruby_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE)
- set(Ruby_SITELIB_DIR ${Ruby_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE)
- set(Ruby_HAS_VENDOR_RUBY ${Ruby_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE)
- set(Ruby_VENDORARCH_DIR ${Ruby_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE)
- set(Ruby_VENDORLIB_DIR ${Ruby_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE)
+ set(_Ruby_EXECUTABLE_LAST_QUERIED "${Ruby_EXECUTABLE}" CACHE INTERNAL "The ruby executable last queried for version and path info")
+ set(Ruby_VERSION_MAJOR ${Ruby_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE)
+ set(Ruby_VERSION_MINOR ${Ruby_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE)
+ set(Ruby_VERSION_PATCH ${Ruby_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE)
+ set(Ruby_ARCH_DIR ${Ruby_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE)
+ set(Ruby_HDR_DIR ${Ruby_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE)
+ set(Ruby_ARCHHDR_DIR ${Ruby_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE)
+ set(_Ruby_POSSIBLE_LIB_DIR ${_Ruby_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE)
+ set(Ruby_RUBY_LIB_DIR ${Ruby_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE)
+ set(Ruby_SITEARCH_DIR ${Ruby_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE)
+ set(Ruby_SITELIB_DIR ${Ruby_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE)
+ set(Ruby_HAS_VENDOR_RUBY ${Ruby_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE)
+ set(Ruby_VENDORARCH_DIR ${Ruby_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE)
+ set(Ruby_VENDORLIB_DIR ${Ruby_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE)
mark_as_advanced(
- Ruby_ARCH_DIR
- Ruby_ARCH
- Ruby_HDR_DIR
- Ruby_ARCHHDR_DIR
- Ruby_POSSIBLE_LIB_DIR
- Ruby_RUBY_LIB_DIR
- Ruby_SITEARCH_DIR
- Ruby_SITELIB_DIR
- Ruby_HAS_VENDOR_RUBY
- Ruby_VENDORARCH_DIR
- Ruby_VENDORLIB_DIR
- Ruby_VERSION_MAJOR
- Ruby_VERSION_MINOR
- Ruby_VERSION_PATCH
- )
-endif()
+ Ruby_ARCH_DIR
+ Ruby_ARCH
+ Ruby_HDR_DIR
+ Ruby_ARCHHDR_DIR
+ _Ruby_POSSIBLE_LIB_DIR
+ Ruby_RUBY_LIB_DIR
+ Ruby_SITEARCH_DIR
+ Ruby_SITELIB_DIR
+ Ruby_HAS_VENDOR_RUBY
+ Ruby_VENDORARCH_DIR
+ Ruby_VENDORLIB_DIR
+ Ruby_VERSION_MAJOR
+ Ruby_VERSION_MINOR
+ Ruby_VERSION_PATCH
+ )
+endif ()
# In case Ruby_EXECUTABLE could not be executed (e.g. cross compiling)
# try to detect which version we found. This is not too good.
-if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
+if (Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
# by default assume 1.8.0
set(Ruby_VERSION_MAJOR 1)
set(Ruby_VERSION_MINOR 8)
set(Ruby_VERSION_PATCH 0)
# check whether we found 1.9.x
- if(${Ruby_EXECUTABLE} MATCHES "ruby1\\.?9")
+ if (${Ruby_EXECUTABLE} MATCHES "ruby1\\.?9")
set(Ruby_VERSION_MAJOR 1)
set(Ruby_VERSION_MINOR 9)
- endif()
+ endif ()
# check whether we found 2.[0-7].x
- if(${Ruby_EXECUTABLE} MATCHES "ruby2")
+ if (${Ruby_EXECUTABLE} MATCHES "ruby2")
set(Ruby_VERSION_MAJOR 2)
string(REGEX_REPLACE ${Ruby_EXECUTABLE} "ruby2\\.?([0-7])" "\\1" Ruby_VERSION_MINOR)
- endif()
+ endif ()
# check whether we found 3.[0-1].x
- if(${Ruby_EXECUTABLE} MATCHES "ruby3")
+ if (${Ruby_EXECUTABLE} MATCHES "ruby3")
set(Ruby_VERSION_MAJOR 3)
string(REGEX_REPLACE ${Ruby_EXECUTABLE} "ruby3\\.?([0-1])" "\\1" Ruby_VERSION_MINOR)
- endif()
+ endif ()
+endif ()
-endif()
-
-if(Ruby_VERSION_MAJOR)
+if (Ruby_VERSION_MAJOR)
set(Ruby_VERSION "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}.${Ruby_VERSION_PATCH}")
set(_Ruby_VERSION_SHORT "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}")
set(_Ruby_VERSION_SHORT_NODOT "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}")
set(_Ruby_NODOT_VERSION "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}${Ruby_VERSION_PATCH}")
set(_Ruby_NODOT_VERSION_ZERO_PATCH "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}0")
-endif()
+endif ()
# FIXME: Currently we require both the interpreter and development components to be found
# in order to use either. See issue #20474.
find_path(Ruby_INCLUDE_DIR
- NAMES ruby.h
- HINTS
- ${Ruby_HDR_DIR}
- ${Ruby_ARCH_DIR}
- /usr/lib/ruby/${_Ruby_VERSION_SHORT}/i586-linux-gnu/
+ NAMES ruby.h
+ HINTS
+ ${Ruby_HDR_DIR}
+ ${Ruby_ARCH_DIR}
+ /usr/lib/ruby/${_Ruby_VERSION_SHORT}/i586-linux-gnu/
)
set(Ruby_INCLUDE_DIRS ${Ruby_INCLUDE_DIR})
# if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir
-if( Ruby_FIND_VERSION VERSION_GREATER_EQUAL "1.9" OR Ruby_VERSION VERSION_GREATER_EQUAL "1.9" OR Ruby_HDR_DIR)
+if (Ruby_FIND_VERSION VERSION_GREATER_EQUAL "1.9" OR Ruby_VERSION VERSION_GREATER_EQUAL "1.9" OR Ruby_HDR_DIR)
find_path(Ruby_CONFIG_INCLUDE_DIR
- NAMES ruby/config.h config.h
- HINTS
- ${Ruby_HDR_DIR}/${Ruby_ARCH}
- ${Ruby_ARCH_DIR}
- ${Ruby_ARCHHDR_DIR}
+ NAMES ruby/config.h config.h
+ HINTS
+ ${Ruby_HDR_DIR}/${Ruby_ARCH}
+ ${Ruby_ARCH_DIR}
+ ${Ruby_ARCHHDR_DIR}
)
- set(Ruby_INCLUDE_DIRS ${Ruby_INCLUDE_DIRS} ${Ruby_CONFIG_INCLUDE_DIR} )
-endif()
-
+ set(Ruby_INCLUDE_DIRS ${Ruby_INCLUDE_DIRS} ${Ruby_CONFIG_INCLUDE_DIR})
+endif ()
-# Determine the list of possible names for the ruby library
+# Determine the list of possible names for the Ruby shared library
set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby${_Ruby_NODOT_VERSION} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION})
-if(WIN32)
+if (WIN32)
set(_Ruby_POSSIBLE_MSVC_RUNTIMES "ucrt;msvcrt;vcruntime140;vcruntime140_1")
- if(MSVC_TOOLSET_VERSION)
+ if (MSVC_TOOLSET_VERSION)
list(APPEND _Ruby_POSSIBLE_MSVC_RUNTIMES "msvcr${MSVC_TOOLSET_VERSION}")
- else()
+ else ()
list(APPEND _Ruby_POSSIBLE_MSVC_RUNTIMES "msvcr")
- endif()
+ endif ()
set(_Ruby_POSSIBLE_VERSION_SUFFICES "${_Ruby_NODOT_VERSION};${_Ruby_NODOT_VERSION_ZERO_PATCH}")
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_Ruby_POSSIBLE_ARCH_PREFIXS "libx64-;x64-")
- else()
+ else ()
set(_Ruby_POSSIBLE_ARCH_PREFIXS "lib")
- endif()
+ endif ()
- foreach(_Ruby_MSVC_RUNTIME ${_Ruby_POSSIBLE_MSVC_RUNTIMES})
- foreach(_Ruby_VERSION_SUFFIX ${_Ruby_POSSIBLE_VERSION_SUFFICES})
- foreach(_Ruby_ARCH_PREFIX ${_Ruby_POSSIBLE_ARCH_PREFIXS})
+ foreach (_Ruby_MSVC_RUNTIME ${_Ruby_POSSIBLE_MSVC_RUNTIMES})
+ foreach (_Ruby_VERSION_SUFFIX ${_Ruby_POSSIBLE_VERSION_SUFFICES})
+ foreach (_Ruby_ARCH_PREFIX ${_Ruby_POSSIBLE_ARCH_PREFIXS})
list(APPEND _Ruby_POSSIBLE_LIB_NAMES
- "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}"
- "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}-static")
- endforeach()
- endforeach()
- endforeach()
-endif()
+ "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}"
+ "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}-static")
+ endforeach ()
+ endforeach ()
+ endforeach ()
+endif ()
-find_library(Ruby_LIBRARY NAMES ${_Ruby_POSSIBLE_LIB_NAMES} HINTS ${Ruby_POSSIBLE_LIB_DIR} )
+find_library(Ruby_LIBRARY NAMES ${_Ruby_POSSIBLE_LIB_NAMES} HINTS ${_Ruby_POSSIBLE_LIB_DIR})
set(_Ruby_REQUIRED_VARS Ruby_EXECUTABLE Ruby_INCLUDE_DIR Ruby_LIBRARY)
-if(_Ruby_VERSION_SHORT_NODOT GREATER 18)
+if (_Ruby_VERSION_SHORT_NODOT GREATER 18)
list(APPEND _Ruby_REQUIRED_VARS Ruby_CONFIG_INCLUDE_DIR)
-endif()
-
-if(_Ruby_DEBUG_OUTPUT)
- message(STATUS "--------FindRuby.cmake debug------------")
- message(STATUS "_Ruby_POSSIBLE_EXECUTABLE_NAMES: ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}")
- message(STATUS "_Ruby_POSSIBLE_LIB_NAMES: ${_Ruby_POSSIBLE_LIB_NAMES}")
- message(STATUS "Ruby_ARCH_DIR: ${Ruby_ARCH_DIR}")
- message(STATUS "Ruby_HDR_DIR: ${Ruby_HDR_DIR}")
- message(STATUS "Ruby_POSSIBLE_LIB_DIR: ${Ruby_POSSIBLE_LIB_DIR}")
- message(STATUS "Found Ruby_VERSION: \"${Ruby_VERSION}\" , short: \"${_Ruby_VERSION_SHORT}\", nodot: \"${_Ruby_VERSION_SHORT_NODOT}\"")
- message(STATUS "_Ruby_REQUIRED_VARS: ${_Ruby_REQUIRED_VARS}")
- message(STATUS "Ruby_EXECUTABLE: ${Ruby_EXECUTABLE}")
- message(STATUS "Ruby_LIBRARY: ${Ruby_LIBRARY}")
- message(STATUS "Ruby_INCLUDE_DIR: ${Ruby_INCLUDE_DIR}")
- message(STATUS "Ruby_CONFIG_INCLUDE_DIR: ${Ruby_CONFIG_INCLUDE_DIR}")
- message(STATUS "--------------------")
-endif()
-
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_Ruby_REQUIRED_VARS}
- VERSION_VAR Ruby_VERSION )
-
-if(Ruby_FOUND)
+endif ()
+
+message(DEBUG "--------FindRuby.cmake debug------------")
+message(DEBUG "_Ruby_POSSIBLE_EXECUTABLE_NAMES: ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}")
+message(DEBUG "_Ruby_POSSIBLE_LIB_DIR: ${_Ruby_POSSIBLE_LIB_DIR}")
+message(DEBUG "_Ruby_POSSIBLE_LIB_NAMES: ${_Ruby_POSSIBLE_LIB_NAMES}")
+message(DEBUG "Ruby_FIND_VIRTUALENV=${Ruby_FIND_VIRTUALENV}")
+message(DEBUG "Ruby_ENV: ${Ruby_ENV}")
+message(DEBUG "Found Ruby_VERSION: \"${Ruby_VERSION}\"")
+message(DEBUG "Ruby_EXECUTABLE: ${Ruby_EXECUTABLE}")
+message(DEBUG "Ruby_LIBRARY: ${Ruby_LIBRARY}")
+message(DEBUG "Ruby_INCLUDE_DIR: ${Ruby_INCLUDE_DIR}")
+message(DEBUG "Ruby_CONFIG_INCLUDE_DIR: ${Ruby_CONFIG_INCLUDE_DIR}")
+message(DEBUG "Ruby_HDR_DIR: ${Ruby_HDR_DIR}")
+message(DEBUG "Ruby_ARCH_DIR: ${Ruby_ARCH_DIR}")
+message(DEBUG "--------------------")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Ruby REQUIRED_VARS ${_Ruby_REQUIRED_VARS}
+ VERSION_VAR Ruby_VERSION)
+
+if (Ruby_FOUND)
set(Ruby_LIBRARIES ${Ruby_LIBRARY})
-endif()
+endif ()
mark_as_advanced(
- Ruby_EXECUTABLE
- Ruby_LIBRARY
- Ruby_INCLUDE_DIR
- Ruby_CONFIG_INCLUDE_DIR
- )
-
-# Set some variables for compatibility with previous version of this file (no need to provide a CamelCase version of that...)
-set(RUBY_POSSIBLE_LIB_PATH ${Ruby_POSSIBLE_LIB_DIR})
-set(RUBY_RUBY_LIB_PATH ${Ruby_RUBY_LIB_DIR})
-set(RUBY_INCLUDE_PATH ${Ruby_INCLUDE_DIRS})
-
-# Backwards compatibility
-# Define upper case versions of output variables
-foreach(Camel
Ruby_EXECUTABLE
- Ruby_INCLUDE_DIRS
Ruby_LIBRARY
- Ruby_VERSION
- Ruby_VERSION_MAJOR
- Ruby_VERSION_MINOR
- Ruby_VERSION_PATCH
-
- Ruby_ARCH_DIR
- Ruby_ARCH
- Ruby_HDR_DIR
- Ruby_ARCHHDR_DIR
- Ruby_POSSIBLE_LIB_DIR
- Ruby_RUBY_LIB_DIR
- Ruby_SITEARCH_DIR
- Ruby_SITELIB_DIR
- Ruby_HAS_VENDOR_RUBY
- Ruby_VENDORARCH_DIR
- Ruby_VENDORLIB_DIR
-
- )
+ Ruby_INCLUDE_DIR
+ Ruby_CONFIG_INCLUDE_DIR
+)
+
+if(NOT _Ruby_CMP0185 STREQUAL "NEW")
+ # Set some variables for compatibility with previous version of this file (no need to provide a CamelCase version of that...)
+ set(RUBY_POSSIBLE_LIB_PATH ${_Ruby_POSSIBLE_LIB_DIR})
+ set(RUBY_RUBY_LIB_PATH ${Ruby_RUBY_LIB_DIR})
+ set(RUBY_INCLUDE_PATH ${Ruby_INCLUDE_DIRS})
+
+ # Backwards compatibility
+ # Define upper case versions of output variables
+ foreach (Camel
+ Ruby_EXECUTABLE
+ Ruby_INCLUDE_DIRS
+ Ruby_LIBRARY
+ Ruby_VERSION
+ Ruby_VERSION_MAJOR
+ Ruby_VERSION_MINOR
+ Ruby_VERSION_PATCH
+
+ Ruby_ARCH_DIR
+ Ruby_ARCH
+ Ruby_HDR_DIR
+ Ruby_ARCHHDR_DIR
+ Ruby_RUBY_LIB_DIR
+ Ruby_SITEARCH_DIR
+ Ruby_SITELIB_DIR
+ Ruby_HAS_VENDOR_RUBY
+ Ruby_VENDORARCH_DIR
+ Ruby_VENDORLIB_DIR)
string(TOUPPER ${Camel} UPPER)
set(${UPPER} ${${Camel}})
-endforeach()
+ endforeach ()
+endif()
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index a4c8668..0e85990 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL
@@ -8,7 +8,7 @@ FindSDL
Locate the SDL library
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.19
@@ -222,9 +222,9 @@ if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h")
set(SDL_VERSION_STRING ${SDL_VERSION})
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
+find_package_handle_standard_args(SDL
REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
VERSION_VAR SDL_VERSION_STRING)
diff --git a/Modules/FindSDL_gfx.cmake b/Modules/FindSDL_gfx.cmake
index 82c2039..fb066c9 100644
--- a/Modules/FindSDL_gfx.cmake
+++ b/Modules/FindSDL_gfx.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL_gfx
@@ -75,7 +75,7 @@ endif()
include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_gfx
+find_package_handle_standard_args(SDL_gfx
REQUIRED_VARS SDL_GFX_LIBRARIES SDL_GFX_INCLUDE_DIRS
VERSION_VAR SDL_GFX_VERSION_STRING)
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
index 33a0695..995baaa 100644
--- a/Modules/FindSDL_image.cmake
+++ b/Modules/FindSDL_image.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL_image
@@ -86,9 +86,9 @@ endif()
set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY})
set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image
+find_package_handle_standard_args(SDL_image
REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS
VERSION_VAR SDL_IMAGE_VERSION_STRING)
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
index f48015e..5219f84 100644
--- a/Modules/FindSDL_mixer.cmake
+++ b/Modules/FindSDL_mixer.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL_mixer
@@ -86,9 +86,9 @@ endif()
set(SDL_MIXER_LIBRARIES ${SDL_MIXER_LIBRARY})
set(SDL_MIXER_INCLUDE_DIRS ${SDL_MIXER_INCLUDE_DIR})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_mixer
+find_package_handle_standard_args(SDL_mixer
REQUIRED_VARS SDL_MIXER_LIBRARIES SDL_MIXER_INCLUDE_DIRS
VERSION_VAR SDL_MIXER_VERSION_STRING)
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
index 9d0b949..a8189fb 100644
--- a/Modules/FindSDL_net.cmake
+++ b/Modules/FindSDL_net.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL_net
@@ -85,9 +85,9 @@ endif()
set(SDL_NET_LIBRARIES ${SDL_NET_LIBRARY})
set(SDL_NET_INCLUDE_DIRS ${SDL_NET_INCLUDE_DIR})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_net
+find_package_handle_standard_args(SDL_net
REQUIRED_VARS SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS
VERSION_VAR SDL_NET_VERSION_STRING)
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index 50b4b55..30a89aa 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL_sound
@@ -217,8 +217,8 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
)
if(MIKMOD_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY})
- endif(MIKMOD_LIBRARY)
- endif("${MY_OUTPUT}" MATCHES "MikMod_")
+ endif()
+ endif()
# Find ModPlug
if("${MY_OUTPUT}" MATCHES "MODPLUG_")
@@ -369,9 +369,9 @@ if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h")
unset(SDL_SOUND_VERSION_PATCH)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound
+find_package_handle_standard_args(SDL_sound
REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR
VERSION_VAR SDL_SOUND_VERSION_STRING)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
index 8f3b02a..080705f 100644
--- a/Modules/FindSDL_ttf.cmake
+++ b/Modules/FindSDL_ttf.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSDL_ttf
@@ -85,9 +85,9 @@ endif()
set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY})
set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf
+find_package_handle_standard_args(SDL_ttf
REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS
VERSION_VAR SDL_TTF_VERSION_STRING)
diff --git a/Modules/FindSQLite3.cmake b/Modules/FindSQLite3.cmake
index e5fead7..fcacbef 100644
--- a/Modules/FindSQLite3.cmake
+++ b/Modules/FindSQLite3.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSQLite3
@@ -9,7 +9,7 @@ FindSQLite3
Find the SQLite libraries, v3
-IMPORTED targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` target:
@@ -64,7 +64,7 @@ if(SQLite3_INCLUDE_DIR)
unset(_ver_line)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SQLite3
REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
VERSION_VAR SQLite3_VERSION)
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 3104b2c..57303e5 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSWIG
@@ -58,7 +58,7 @@ optional Fortran support:
#]=======================================================================]
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
function(_swig_get_version _swig_executable _swig_version)
unset(${_swig_version} PARENT_SCOPE)
diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake
index a6eb6e5..f83766b 100644
--- a/Modules/FindSelfPackers.cmake
+++ b/Modules/FindSelfPackers.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSelfPackers
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index bb4caa1..986db16 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSquish
@@ -41,7 +41,7 @@ This module can be used to find Squish.
It provides the function squish_add_test() for adding a squish test
to cmake using Squish >= 4.x:
-::
+.. code-block:: cmake
squish_add_test(cmakeTestName
AUT targetName SUITE suiteName TEST squishTestName
@@ -74,7 +74,7 @@ The arguments have the following meaning:
-::
+.. code-block:: cmake
enable_testing()
find_package(Squish 6.5)
@@ -93,14 +93,14 @@ The arguments have the following meaning:
For users of Squish version 3.x the macro squish_v3_add_test() is
provided:
-::
+.. code-block:: cmake
squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper)
Use this macro to add a test using Squish 3.x.
-::
+.. code-block:: cmake
enable_testing()
find_package(Squish 3.0)
@@ -188,14 +188,14 @@ else()
endif()
# record if Squish was found
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Squish REQUIRED_VARS SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE
VERSION_VAR SQUISH_VERSION )
set(_SQUISH_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}")
-macro(squish_v3_add_test testName testAUT testCase envVars testWraper)
+macro(squish_v3_add_test testName testAUT testCase envVars testWrapper)
if("${SQUISH_VERSION_MAJOR}" STRGREATER "3")
message(STATUS "Using squish_v3_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
endif()
@@ -211,7 +211,7 @@ macro(squish_v3_add_test testName testAUT testCase envVars testWraper)
"-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}"
"-Dsquish_test_case:STRING=${testCase}"
"-Dsquish_env_vars:STRING=${envVars}"
- "-Dsquish_wrapper:STRING=${testWraper}"
+ "-Dsquish_wrapper:STRING=${testWrapper}"
"-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
-P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake"
)
@@ -273,7 +273,7 @@ function(squish_v4_add_test testName)
"-Dsquish_test_suite:STRING=${absTestSuite}"
"-Dsquish_test_case:STRING=${_SQUISH_TEST}"
"-Dsquish_env_vars:STRING=${envVars}"
- "-Dsquish_wrapper:STRING=${testWraper}"
+ "-Dsquish_wrapper:STRING=${testWrapper}"
"-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
"-Dsquish_pre_command:STRING=${_SQUISH_PRE_COMMAND}"
"-Dsquish_post_command:STRING=${_SQUISH_POST_COMMAND}"
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index 7a9c440..294f415 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindSubversion
@@ -23,7 +23,7 @@ standard syntax, e.g. ``find_package(Subversion 1.4)``.
If the command line client executable is found two macros are defined:
-::
+.. code-block:: cmake
Subversion_WC_INFO(<dir> <var-prefix> [IGNORE_SVN_FAILURE])
Subversion_WC_LOG(<dir> <var-prefix>)
@@ -57,7 +57,7 @@ subversion working copy at a given location. This macro defines the variable:
Example usage:
-::
+.. code-block:: cmake
find_package(Subversion)
if(SUBVERSION_FOUND)
@@ -160,10 +160,9 @@ if(Subversion_SVN_EXECUTABLE)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE
VERSION_VAR Subversion_VERSION_SVN )
# for compatibility
-set(Subversion_FOUND ${SUBVERSION_FOUND})
set(Subversion_SVN_FOUND ${SUBVERSION_FOUND})
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index eb53667..1273e8d 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindTCL
@@ -224,7 +224,7 @@ find_path(TK_INCLUDE_PATH
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TclStub")
# FindTclStub include()'s this module. It's an old pattern, but rather than
@@ -232,14 +232,14 @@ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TclStub")
# the contents, detect the case in this module and suppress it explicitly.
set(FPHSA_NAME_MISMATCHED 1)
endif ()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
+find_package_handle_standard_args(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
set(FPHSA_NAME_MISMATCHED 1)
set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
set(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCLTK DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_INCLUDE_PATH)
+find_package_handle_standard_args(TCLTK DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_INCLUDE_PATH)
set(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
set(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TK DEFAULT_MSG TK_LIBRARY TK_INCLUDE_PATH)
+find_package_handle_standard_args(TK DEFAULT_MSG TK_LIBRARY TK_INCLUDE_PATH)
unset(FPHSA_NAME_MISMATCHED)
mark_as_advanced(
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index 27beaa0..ad4b3c6 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindTIFF
@@ -14,7 +14,7 @@ This module supports the optional component `CXX`, for use with the COMPONENTS
argument of the :command:`find_package` command. This component has an associated
imported target, as described below.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.5
@@ -66,7 +66,6 @@ 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)
@@ -208,7 +207,7 @@ if (Tiff_FOUND)
endforeach ()
unset(_TIFF_component)
- include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TIFF
HANDLE_COMPONENTS
REQUIRED_VARS Tiff_DIR
@@ -270,8 +269,8 @@ unset(_comp)
unset(TIFF_NAMES)
unset(TIFF_NAMES_DEBUG)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(TIFF
HANDLE_COMPONENTS
REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
VERSION_VAR TIFF_VERSION_STRING)
diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake
index 8f63480..62e5ef2 100644
--- a/Modules/FindTclStub.cmake
+++ b/Modules/FindTclStub.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindTclStub
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index 594d0ec..878735a 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindTclsh
@@ -84,7 +84,7 @@ if(TCL_TCLSH)
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TCL" OR
CMAKE_FIND_PACKAGE_NAME STREQUAL "TclStub")
# FindTCL include()'s this module. It's an old pattern, but rather than
@@ -93,7 +93,7 @@ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TCL" OR
# Transitively, FindTclStub includes FindTCL.
set(FPHSA_NAME_MISMATCHED 1)
endif ()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
+find_package_handle_standard_args(Tclsh
REQUIRED_VARS TCL_TCLSH
VERSION_VAR TCLSH_VERSION_STRING)
unset(FPHSA_NAME_MISMATCHED)
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 0fa6ae7..26bd7d3 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindThreads
@@ -94,9 +94,9 @@ int main(void)
macro(_threads_check_libc)
if(NOT Threads_FOUND)
if(CMAKE_C_COMPILER_LOADED)
- CHECK_C_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
+ check_c_source_compiles("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
elseif(CMAKE_CXX_COMPILER_LOADED)
- CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
+ check_cxx_source_compiles("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
endif()
if(CMAKE_HAVE_LIBC_PTHREAD)
set(CMAKE_THREAD_LIBS_INIT "")
@@ -109,7 +109,7 @@ endmacro()
# Do NOT even think about using it outside of this file!
macro(_threads_check_lib LIBNAME FUNCNAME VARNAME)
if(NOT Threads_FOUND)
- CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME})
+ check_library_exists(${LIBNAME} ${FUNCNAME} "" ${VARNAME})
if(${VARNAME})
set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}")
set(Threads_FOUND TRUE)
@@ -199,7 +199,7 @@ if(CMAKE_USE_PTHREADS_INIT)
# but we need to maintain compatibility here.
# The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads
# are available.
- CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA)
+ check_library_exists(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA)
if(CMAKE_HAVE_HP_CMA)
set(CMAKE_THREAD_LIBS_INIT "-lcma")
set(CMAKE_HP_PTHREADS_INIT 1)
@@ -222,8 +222,8 @@ if(CMAKE_USE_PTHREADS_INIT)
endif()
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Threads DEFAULT_MSG Threads_FOUND)
if(THREADS_FOUND AND NOT TARGET Threads::Threads)
add_library(Threads::Threads INTERFACE IMPORTED)
diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake
index d71518f..12f1169 100644
--- a/Modules/FindUnixCommands.cmake
+++ b/Modules/FindUnixCommands.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindUnixCommands
@@ -76,7 +76,7 @@ mark_as_advanced(
TAR
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UnixCommands
REQUIRED_VARS BASH CP GZIP MV RM TAR
)
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index 2262119..fab9806 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindVulkan
@@ -44,7 +44,7 @@ There are corresponding imported targets for each of these.
The ``glslc`` and ``glslangValidator`` components are provided even
if not explicitly requested (for backward compatibility).
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found:
@@ -220,7 +220,6 @@ 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
@@ -591,7 +590,7 @@ if(Vulkan_MoltenVK_FOUND)
endif()
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan
REQUIRED_VARS
Vulkan_LIBRARY
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
index d0b6fdf..9e3226a 100644
--- a/Modules/FindWget.cmake
+++ b/Modules/FindWget.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindWget
@@ -24,8 +24,8 @@ find_program(WGET_EXECUTABLE
${MSYS_INSTALL_PATH}/usr/bin
)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wget DEFAULT_MSG WGET_EXECUTABLE)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Wget DEFAULT_MSG WGET_EXECUTABLE)
mark_as_advanced( WGET_EXECUTABLE )
diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake
index b332bde..9e39d36 100644
--- a/Modules/FindWish.cmake
+++ b/Modules/FindWish.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindWish
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 491ea46..cfbcc30 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindX11
@@ -80,6 +80,7 @@ and also the following more fine grained variables and targets:
X11_xkbfile_INCLUDE_PATH, X11_xkbfile_LIB, X11_xkbfile_FOUND, X11::xkbfile
X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND, X11::Xmu
X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND, X11::Xpm
+ X11_Xpresent_INCLUDE_PATH, X11_Xpresent_LIB, X11_Xpresent_FOUND, X11::Xpresent
X11_Xtst_INCLUDE_PATH, X11_Xtst_LIB, X11_Xtst_FOUND, X11::Xtst
X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND, X11::Xrandr
X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND, X11::Xrender
@@ -222,6 +223,7 @@ if (UNIX)
find_path(X11_xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xpresent_INCLUDE_PATH X11/extensions/Xpresent.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xtst_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
find_path(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
@@ -299,6 +301,7 @@ if (UNIX)
find_library(X11_xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH})
find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH})
find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
+ find_library(X11_Xpresent_LIB Xpresent ${X11_LIB_SEARCH_PATH})
find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH})
@@ -523,6 +526,11 @@ if (UNIX)
list(APPEND X11_INCLUDE_DIR ${X11_Xpm_INCLUDE_PATH})
endif ()
+ if (X11_Xpresent_INCLUDE_PATH AND X11_Xpresent_LIB)
+ set(X11_Xpresent_FOUND TRUE)
+ list(APPEND X11_INCLUDE_DIR ${X11_Xpresent_INCLUDE_PATH})
+ endif ()
+
if (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB)
set(X11_Xcomposite_FOUND TRUE)
list(APPEND X11_INCLUDE_DIR ${X11_Xcomposite_INCLUDE_PATH})
@@ -665,7 +673,7 @@ if (UNIX)
set(X11_FOUND 1)
endif ()
- include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ include(FindPackageHandleStandardArgs)
if (CMAKE_FIND_PACKAGE_NAME STREQUAL "FLTK")
# FindFLTK include()'s this module. It's an old pattern, but rather than
# trying to suppress this from outside the module (which is then sensitive
@@ -1169,6 +1177,14 @@ if (UNIX)
INTERFACE_LINK_LIBRARIES "X11::X11")
endif ()
+ if (X11_Xpresent_FOUND AND NOT TARGET X11::Xpresent)
+ add_library(X11::Xpresent UNKNOWN IMPORTED)
+ set_target_properties(X11::Xpresent PROPERTIES
+ IMPORTED_LOCATION "${X11_Xpresent_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xpresent_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11;X11::Xext;X11::Xfixes;X11::Xrandr")
+ endif ()
+
if (X11_Xtst_FOUND AND NOT TARGET X11::Xtst)
add_library(X11::Xtst UNKNOWN IMPORTED)
set_target_properties(X11::Xtst PROPERTIES
@@ -1356,6 +1372,8 @@ if (UNIX)
X11_Xss_LIB
X11_Xpm_INCLUDE_PATH
X11_Xpm_LIB
+ X11_Xpresent_INCLUDE_PATH
+ X11_Xpresent_LIB
X11_Xft_LIB
X11_Xft_INCLUDE_PATH
X11_Xshape_INCLUDE_PATH
diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake
index 92ee25d..e6c846b 100644
--- a/Modules/FindXCTest.cmake
+++ b/Modules/FindXCTest.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindXCTest
@@ -22,7 +22,9 @@ Module Functions
The ``xctest_add_bundle`` function creates a XCTest bundle named
<target> which will test the target <testee>. Supported target types
- for testee are Frameworks and App Bundles::
+ for testee are Frameworks and App Bundles:
+
+ .. code-block:: cmake
xctest_add_bundle(
<target> # Name of the XCTest bundle
@@ -33,7 +35,9 @@ Module Functions
The ``xctest_add_test`` function adds an XCTest bundle to the
project to be run by :manual:`ctest(1)`. The test will be named
- <name> and tests <bundle>::
+ <name> and tests <bundle>:
+
+ .. code-block:: cmake
xctest_add_test(
<name> # Test name
@@ -101,21 +105,20 @@ if(_xcrun_out)
mark_as_advanced(XCTest_EXECUTABLE)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XCTest
- FOUND_VAR XCTest_FOUND
REQUIRED_VARS XCTest_LIBRARY XCTest_INCLUDE_DIR XCTest_EXECUTABLE)
if(XCTest_FOUND)
set(XCTest_INCLUDE_DIRS "${XCTest_INCLUDE_DIR}")
set(XCTest_LIBRARIES "${XCTest_LIBRARY}")
-endif(XCTest_FOUND)
+endif()
function(xctest_add_bundle target testee)
if(NOT XCTest_FOUND)
message(FATAL_ERROR "XCTest is required to create a XCTest Bundle.")
- endif(NOT XCTest_FOUND)
+ endif()
if(NOT CMAKE_OSX_SYSROOT)
message(FATAL_ERROR "Adding XCTest bundles requires CMAKE_OSX_SYSROOT to be set.")
@@ -155,27 +158,22 @@ function(xctest_add_bundle target testee)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)"
XCODE_ATTRIBUTE_TEST_HOST "$<TARGET_FILE:${testee}>")
- if(XCODE_VERSION VERSION_GREATER_EQUAL 7.3)
- # The Xcode "new build system" used a different path until Xcode 12.5.
- if(CMAKE_XCODE_BUILD_SYSTEM EQUAL 12 AND
- XCODE_VERSION VERSION_LESS 12.5 AND
- NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- set(_output_directory "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>")
- else()
- set(_output_directory "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>/PlugIns")
- endif()
- set_target_properties(${target} PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY "${_output_directory}")
- endif()
- else(XCODE)
- target_link_libraries(${target}
- PRIVATE -bundle_loader $<TARGET_FILE:${testee}>)
- endif(XCODE)
+ # TEST_HOST overrides ${target}'s artifact path, but the relative
+ # path from TEST_HOST to ${testee}'s PlugIns folder must not leave
+ # ${target}'s TARGET_BUILD_DIR. If the project sets an explicit
+ # RUNTIME_OUTPUT_DIRECTORY for ${testee}, put ${target} there too.
+ # If not, just suppress the project's CMAKE_LIBRARY_OUTPUT_DIRECTORY.
+ get_property(testee_RUNTIME_OUTPUT_DIRECTORY TARGET ${testee} PROPERTY RUNTIME_OUTPUT_DIRECTORY)
+ set_property(TARGET ${target} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${testee_RUNTIME_OUTPUT_DIRECTORY})
+ else()
+ target_link_options(${target}
+ PRIVATE "SHELL:-bundle_loader \"$<TARGET_FILE:${testee}>\"")
+ endif()
else()
message(FATAL_ERROR "Testee ${testee} is of unsupported type.")
endif()
-endfunction(xctest_add_bundle)
+endfunction()
function(xctest_add_test name bundle)
@@ -187,7 +185,7 @@ function(xctest_add_test name bundle)
if(NOT TARGET ${bundle})
message(FATAL_ERROR "${bundle} is not a target.")
- endif(NOT TARGET ${bundle})
+ endif()
get_property(_test_type TARGET ${bundle} PROPERTY TYPE)
get_property(_test_bundle TARGET ${bundle} PROPERTY BUNDLE)
@@ -207,6 +205,24 @@ function(xctest_add_test name bundle)
get_property(_testee_type TARGET ${_testee} PROPERTY TYPE)
get_property(_testee_framework TARGET ${_testee} PROPERTY FRAMEWORK)
+ get_property(_testee_macosx_bundle TARGET ${_testee} PROPERTY MACOSX_BUNDLE)
+
+ # Determine the path to the test module artifact on disk.
+ set(_test_bundle_dir "$<TARGET_BUNDLE_DIR:${bundle}>")
+ if(XCODE AND _testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle)
+ # Xcode's TEST_HOST setting places the test module inside the testee bundle.
+ if(XCODE_VERSION VERSION_GREATER_EQUAL 7.3)
+ # The Xcode "new build system" used a different path until Xcode 12.5.
+ if(CMAKE_XCODE_BUILD_SYSTEM EQUAL 12 AND
+ XCODE_VERSION VERSION_LESS 12.5 AND
+ NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(_test_bundle_dir "$<TARGET_BUNDLE_CONTENT_DIR:${_testee}>")
+ else()
+ set(_test_bundle_dir "$<TARGET_BUNDLE_CONTENT_DIR:${_testee}>/PlugIns")
+ endif()
+ string(APPEND _test_bundle_dir "/$<TARGET_BUNDLE_DIR_NAME:${bundle}>")
+ endif()
+ endif()
# register test
@@ -214,7 +230,7 @@ function(xctest_add_test name bundle)
# here for CMP0178.
add_test(
NAME ${name}
- COMMAND ${XCTest_EXECUTABLE} $<TARGET_BUNDLE_DIR:${bundle}>)
+ COMMAND ${XCTest_EXECUTABLE} ${_test_bundle_dir})
# point loader to testee in case rpath is disabled
@@ -222,4 +238,4 @@ function(xctest_add_test name bundle)
set_property(TEST ${name} APPEND PROPERTY
ENVIRONMENT DYLD_FRAMEWORK_PATH=$<TARGET_LINKER_FILE_DIR:${_testee}>/..)
endif()
-endfunction(xctest_add_test)
+endfunction()
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index 69e6df2..edc4dfd 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindXMLRPC
@@ -27,7 +27,7 @@ Modules may be listed by running "xmlrpc-c-config". Modules include:
Typical usage:
-::
+.. code-block:: cmake
find_package(XMLRPC REQUIRED libwww-client)
#]=======================================================================]
@@ -122,8 +122,8 @@ if(XMLRPC_C_FOUND)
endif()
# Report the results.
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
XMLRPC
REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES
FAIL_MESSAGE "XMLRPC was not found. Make sure the entries XMLRPC_* are set.")
diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake
index 338d0c0..11d2551 100644
--- a/Modules/FindXalanC.cmake
+++ b/Modules/FindXalanC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindXalanC
@@ -9,7 +9,7 @@ FindXalanC
Find the Apache Xalan-C++ XSL transform processor headers and libraries.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
@@ -113,9 +113,8 @@ endif()
find_package(XercesC ${XalanC_XERCESC_REQUIRED})
unset(XalanC_XERCESC_REQUIRED)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(XalanC
- FOUND_VAR XalanC_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XalanC
REQUIRED_VARS XalanC_LIBRARY
XalanC_INCLUDE_DIR
XalanC_VERSION
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index ee6a401..68e6e70 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindXercesC
@@ -9,7 +9,7 @@ FindXercesC
Find the Apache Xerces-C++ validating XML parser headers and libraries.
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.5
@@ -111,9 +111,8 @@ unset(XercesC_VERSION_MAJOR)
unset(XercesC_VERSION_MINOR)
unset(XercesC_VERSION_PATCH)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC
- FOUND_VAR XercesC_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XercesC
REQUIRED_VARS XercesC_LIBRARY
XercesC_INCLUDE_DIR
XercesC_VERSION
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 0842f4c..2920934 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindZLIB
@@ -7,7 +7,7 @@ FindZLIB
Find the native ZLIB includes and library.
-IMPORTED Targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.1
@@ -198,8 +198,8 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
set(ZLIB_VERSION "${ZLIB_VERSION_STRING}")
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
VERSION_VAR ZLIB_VERSION
HANDLE_COMPONENTS)
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
index 9e952c9..4256c19 100644
--- a/Modules/Findosg.cmake
+++ b/Modules/Findosg.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Findosg
@@ -53,5 +53,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSG osg/PositionAttitudeTransform)
OSG_FIND_LIBRARY(OSG osg)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR)
diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake
index e31987e..300022b 100644
--- a/Modules/FindosgAnimation.cmake
+++ b/Modules/FindosgAnimation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgAnimation
@@ -47,6 +47,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation)
OSG_FIND_LIBRARY(OSGANIMATION osgAnimation)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgAnimation DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgAnimation DEFAULT_MSG
OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR)
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
index 9366d21..5d7fd5c 100644
--- a/Modules/FindosgDB.cmake
+++ b/Modules/FindosgDB.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgDB
@@ -51,6 +51,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGDB osgDB/DatabasePager)
OSG_FIND_LIBRARY(OSGDB osgDB)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgDB DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgDB DEFAULT_MSG
OSGDB_LIBRARY OSGDB_INCLUDE_DIR)
diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake
index 79362ef..191b65f 100644
--- a/Modules/FindosgFX.cmake
+++ b/Modules/FindosgFX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgFX
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGFX osgFX/BumpMapping)
OSG_FIND_LIBRARY(OSGFX osgFX)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgFX DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgFX DEFAULT_MSG
OSGFX_LIBRARY OSGFX_INCLUDE_DIR)
diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake
index 7ebcce8..192da78 100644
--- a/Modules/FindosgGA.cmake
+++ b/Modules/FindosgGA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgGA
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGGA osgGA/FlightManipulator)
OSG_FIND_LIBRARY(OSGGA osgGA)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgGA DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgGA DEFAULT_MSG
OSGGA_LIBRARY OSGGA_INCLUDE_DIR)
diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake
index c0c28f2..fc40421 100644
--- a/Modules/FindosgIntrospection.cmake
+++ b/Modules/FindosgIntrospection.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgIntrospection
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection)
OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgIntrospection DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgIntrospection DEFAULT_MSG
OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR)
diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake
index 47c74f6..908c767 100644
--- a/Modules/FindosgManipulator.cmake
+++ b/Modules/FindosgManipulator.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgManipulator
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger)
OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgManipulator DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgManipulator DEFAULT_MSG
OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR)
diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake
index cbe033d..1a9c278 100644
--- a/Modules/FindosgParticle.cmake
+++ b/Modules/FindosgParticle.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgParticle
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect)
OSG_FIND_LIBRARY(OSGPARTICLE osgParticle)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgParticle DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgParticle DEFAULT_MSG
OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR)
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
index e8c8b4f..07f022e 100644
--- a/Modules/FindosgPresentation.cmake
+++ b/Modules/FindosgPresentation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgPresentation
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGPRESENTATION osgPresentation/SlideEventHandler)
OSG_FIND_LIBRARY(OSGPRESENTATION osgPresentation)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgPresentation DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgPresentation DEFAULT_MSG
OSGPRESENTATION_LIBRARY OSGPRESENTATION_INCLUDE_DIR)
diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake
index 92f0d20..ca949b7 100644
--- a/Modules/FindosgProducer.cmake
+++ b/Modules/FindosgProducer.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgProducer
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler)
OSG_FIND_LIBRARY(OSGPRODUCER osgProducer)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgProducer DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgProducer DEFAULT_MSG
OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR)
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
index 2ad7174..3f170fe 100644
--- a/Modules/FindosgQt.cmake
+++ b/Modules/FindosgQt.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgQt
@@ -49,6 +49,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGQT osgQt/GraphicsWindowQt)
OSG_FIND_LIBRARY(OSGQT osgQt)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgQt DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgQt DEFAULT_MSG
OSGQT_LIBRARY OSGQT_INCLUDE_DIR)
diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake
index 12eb9da..e168146 100644
--- a/Modules/FindosgShadow.cmake
+++ b/Modules/FindosgShadow.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgShadow
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture)
OSG_FIND_LIBRARY(OSGSHADOW osgShadow)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgShadow DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgShadow DEFAULT_MSG
OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR)
diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake
index 37ef03c..b152584 100644
--- a/Modules/FindosgSim.cmake
+++ b/Modules/FindosgSim.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgSim
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite)
OSG_FIND_LIBRARY(OSGSIM osgSim)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgSim DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgSim DEFAULT_MSG
OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR)
diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake
index a2de4ea..4bebf87 100644
--- a/Modules/FindosgTerrain.cmake
+++ b/Modules/FindosgTerrain.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgTerrain
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain)
OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgTerrain DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgTerrain DEFAULT_MSG
OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR)
diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake
index 7646ad0..21e6a80 100644
--- a/Modules/FindosgText.cmake
+++ b/Modules/FindosgText.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgText
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGTEXT osgText/Text)
OSG_FIND_LIBRARY(OSGTEXT osgText)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgText DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgText DEFAULT_MSG
OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR)
diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake
index a34fea0..2ab0de7 100644
--- a/Modules/FindosgUtil.cmake
+++ b/Modules/FindosgUtil.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgUtil
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGUTIL osgUtil/SceneView)
OSG_FIND_LIBRARY(OSGUTIL osgUtil)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgUtil DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgUtil DEFAULT_MSG
OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR)
diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake
index c3834e8..23e7d6b33 100644
--- a/Modules/FindosgViewer.cmake
+++ b/Modules/FindosgViewer.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgViewer
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer)
OSG_FIND_LIBRARY(OSGVIEWER osgViewer)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgViewer DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgViewer DEFAULT_MSG
OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR)
diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake
index 58d9f7a..da45d29 100644
--- a/Modules/FindosgVolume.cmake
+++ b/Modules/FindosgVolume.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgVolume
@@ -48,6 +48,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGVOLUME osgVolume/Volume)
OSG_FIND_LIBRARY(OSGVOLUME osgVolume)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgVolume DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgVolume DEFAULT_MSG
OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR)
diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake
index 4049fad..75dee17 100644
--- a/Modules/FindosgWidget.cmake
+++ b/Modules/FindosgWidget.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindosgWidget
@@ -49,6 +49,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGWIDGET osgWidget/Widget)
OSG_FIND_LIBRARY(OSGWIDGET osgWidget)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgWidget DEFAULT_MSG
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(osgWidget DEFAULT_MSG
OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR)
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index 5226102..9fdeb95 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Findosg_functions
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 88aaf96..86f34ee 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindwxWidgets
@@ -58,7 +58,7 @@ options that need to be passed to the wx-config utility. For example,
to use the base toolkit found in the /usr/local path, set the variable
(before calling the FIND_PACKAGE command) as such:
-::
+.. code-block:: cmake
set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)
@@ -93,7 +93,7 @@ and unix style:
Sample usage:
-::
+.. code-block:: cmake
# Note that for MinGW users the order of libs is important!
find_package(wxWidgets COMPONENTS gl core base OPTIONAL_COMPONENTS net)
@@ -107,14 +107,14 @@ Sample usage:
If wxWidgets is required (i.e., not an optional part):
-::
+.. code-block:: cmake
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
include(${wxWidgets_USE_FILE})
# and for each of your dependent executable/library targets:
target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
-Imported targets
+Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.27
@@ -188,9 +188,6 @@ macro(DBG_MSG_V _MSG)
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
endmacro()
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
# Clear return values in case the module is loaded more than once.
set(wxWidgets_FOUND FALSE)
set(wxWidgets_INCLUDE_DIRS "")
@@ -1003,7 +1000,7 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}")
#=====================================================================
#=====================================================================
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
# FIXME: set wxWidgets_<comp>_FOUND for wx-config branch
# and use HANDLE_COMPONENTS on Unix too
@@ -1241,5 +1238,3 @@ function(WXWIDGETS_ADD_RESOURCES _outfiles)
set(${_outfiles} ${${_outfiles}} PARENT_SCOPE)
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index d1b25e1..83d6018 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindwxWindows
@@ -34,7 +34,7 @@ the name of the library is. This code sets the following variables:
OPTIONS If you need OpenGL support please
-::
+.. code-block:: cmake
set(WXWINDOWS_USE_GL 1)
@@ -52,7 +52,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
USAGE
-::
+.. code-block:: cmake
set(WXWINDOWS_USE_GL 1)
find_package(wxWindows)
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 81481a7..685f310 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FortranCInterface
@@ -79,14 +79,18 @@ Module Functions
.. command:: FortranCInterface_HEADER
The ``FortranCInterface_HEADER`` function is provided to generate a
- C header file containing macros to mangle symbol names::
+ C header file containing macros to mangle symbol names:
+
+ .. code-block:: cmake
FortranCInterface_HEADER(<file>
[MACRO_NAMESPACE <macro-ns>]
[SYMBOL_NAMESPACE <ns>]
[SYMBOLS [<module>:]<function> ...])
- It generates in ``<file>`` definitions of the following macros::
+ It generates in ``<file>`` definitions of the following macros:
+
+ .. code-block:: c
#define FortranCInterface_GLOBAL (name,NAME) ...
#define FortranCInterface_GLOBAL_(name,NAME) ...
@@ -125,7 +129,9 @@ Module Functions
.. command:: FortranCInterface_VERIFY
The ``FortranCInterface_VERIFY`` function is provided to verify
- that the Fortran and C/C++ compilers work together::
+ that the Fortran and C/C++ compilers work together:
+
+ .. code-block:: cmake
FortranCInterface_VERIFY([CXX] [QUIET])
@@ -195,9 +201,6 @@ if(FortranCInterface_SOURCE_DIR)
return()
endif()
-cmake_policy(PUSH)
-cmake_policy(SET CMP0007 NEW)
-
#-----------------------------------------------------------------------------
# Verify that C and Fortran are available.
foreach(lang C Fortran)
@@ -351,12 +354,7 @@ function(FortranCInterface_VERIFY)
set(_FortranCInterface_OSX_ARCH "")
endif()
- cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
- if(_FortranCInterface_CMP0056 STREQUAL "NEW")
- set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
- else()
- set(_FortranCInterface_EXE_LINKER_FLAGS "")
- endif()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
@@ -402,6 +400,3 @@ function(FortranCInterface_VERIFY)
"The output was:\n ${_output}")
endif()
endfunction()
-
-# Restore including context policies.
-cmake_policy(POP)
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index bc33096..c0a9256 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(FortranCInterface C Fortran)
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 00b8ad5..177fdf8 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in
${FortranCInterface_BINARY_DIR}/Input.cmake @ONLY)
@@ -36,13 +36,7 @@ else()
set(_FortranCInterface_OSX_ARCH "")
endif()
-cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
-if(_FortranCInterface_CMP0056 STREQUAL "NEW")
- set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
-else()
- set(_FortranCInterface_EXE_LINKER_FLAGS "")
-endif()
-unset(_FortranCInterface_CMP0056)
+set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
diff --git a/Modules/FortranCInterface/Verify/CMakeLists.txt b/Modules/FortranCInterface/Verify/CMakeLists.txt
index caf4206..7367968 100644
--- a/Modules/FortranCInterface/Verify/CMakeLists.txt
+++ b/Modules/FortranCInterface/Verify/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(VerifyFortranC C Fortran)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index ed34c4a..162c829 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
GNUInstallDirs
@@ -131,7 +131,7 @@ Macros
.. command:: GNUInstallDirs_get_absolute_install_dir
- ::
+ .. code-block:: cmake
GNUInstallDirs_get_absolute_install_dir(absvar var dirname)
@@ -151,9 +151,6 @@ Macros
this value through the variable ``${dir}``.
#]=======================================================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-
# Convert a cache variable to PATH type
macro(_GNUInstallDirs_cache_convert_to_path var description)
@@ -452,5 +449,3 @@ foreach(dir
)
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir} ${dir})
endforeach()
-
-cmake_policy(POP)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index c959168..a4e904c 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -1,22 +1,25 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
GenerateExportHeader
--------------------
-Function for generation of export macros for libraries
-
-This module provides the function ``GENERATE_EXPORT_HEADER()``.
+This module provides the ``generate_export_header()`` function to generate
+export macros for libraries.
.. versionadded:: 3.12
Added support for C projects. Previous versions supported C++ project only.
-The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file
-suitable for preprocessor inclusion which contains EXPORT macros to be
-used in library classes::
+.. command:: generate_export_header
+
+ The ``generate_export_header()`` function can be used to generate a file
+ suitable for preprocessor inclusion which contains EXPORT macros to be
+ used in library classes:
+
+ .. code-block:: cmake
- GENERATE_EXPORT_HEADER( LIBRARY_TARGET
+ generate_export_header(LIBRARY_TARGET
[BASE_NAME <base_name>]
[EXPORT_MACRO_NAME <export_macro_name>]
[EXPORT_FILE_NAME <export_file_name>]
@@ -28,7 +31,7 @@ used in library classes::
[DEFINE_NO_DEPRECATED]
[PREFIX_NAME <prefix_name>]
[CUSTOM_CONTENT_FROM_VARIABLE <variable>]
- )
+ )
The target properties :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>`
and :prop_tgt:`VISIBILITY_INLINES_HIDDEN` can be used to add the appropriate
@@ -37,7 +40,7 @@ and the convenience variables
:variable:`CMAKE_CXX_VISIBILITY_PRESET <CMAKE_<LANG>_VISIBILITY_PRESET>` and
:variable:`CMAKE_VISIBILITY_INLINES_HIDDEN`.
-By default ``GENERATE_EXPORT_HEADER()`` generates macro names in a file
+By default ``generate_export_header()`` generates macro names in a file
name determined by the name of the library. This means that in the
simplest case, users of ``GenerateExportHeader`` will be equivalent to:
@@ -181,19 +184,22 @@ Generates the macros ``VTK_SOMELIB_EXPORT`` etc.
.. versionadded:: 3.11
Added the ``INCLUDE_GUARD_NAME`` option.
-::
+.. command:: add_compiler_export_flags
+
+ .. code-block:: cmake
+
+ add_compiler_export_flags([<output_variable>])
- ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
+ .. deprecated:: 3.0
-.. deprecated:: 3.0
- Set the target properties
- :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
- :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
+ Set the target properties
+ :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
+ :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
-The ``ADD_COMPILER_EXPORT_FLAGS`` function adds ``-fvisibility=hidden`` to
+The ``add_compiler_export_flags()`` function adds ``-fvisibility=hidden`` to
:variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` if supported, and is a no-op
on Windows which does not need extra compiler flags for exporting support.
-You may optionally pass a single argument to ``ADD_COMPILER_EXPORT_FLAGS``
+You may optionally pass a single argument to ``add_compiler_export_flags()``
that will be populated with the ``CXX_FLAGS`` required to enable visibility
support for the compiler/architecture in use.
#]=======================================================================]
@@ -343,7 +349,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
"${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_DEPRECATED")
if(_GEH_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to GENERATE_EXPORT_HEADER(): \"${_GEH_UNPARSED_ARGUMENTS}\"")
+ message(FATAL_ERROR "Unknown keywords given to generate_export_header(): \"${_GEH_UNPARSED_ARGUMENTS}\"")
endif()
if(_GEH_EXPORT_MACRO_NAME)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index b77f650..4f9d3e7 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
GetPrerequisites
@@ -26,7 +26,8 @@ files:
otool (Mac OSX)
.. versionchanged:: 3.16
- The tool specified by ``CMAKE_OBJDUMP`` will be used, if set.
+ The tool specified by the :variable:`CMAKE_OBJDUMP` variable
+ will be used, if set.
The following functions are provided by this module:
@@ -45,7 +46,7 @@ The following functions are provided by this module:
(projects can override with gp_resolved_file_type_override)
gp_file_type
-::
+.. code-block:: cmake
GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse>
<exepath> <dirs> [<rpaths>])
@@ -71,7 +72,7 @@ locations, /usr/lib...
The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose
output.
-::
+.. code-block:: cmake
LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]])
@@ -85,7 +86,7 @@ indicating whether to include or exclude "system" prerequisites. With
<verbose> set to 0 only the full path names of the prerequisites are
printed, set to 1 extra information will be displayed.
-::
+.. code-block:: cmake
LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>)
@@ -98,21 +99,21 @@ matching file is executable, its prerequisites are listed.
Any additional (optional) arguments provided are passed along as the
optional arguments to the list_prerequisites calls.
-::
+.. code-block:: cmake
GP_APPEND_UNIQUE(<list_var> <value>)
Append <value> to the list variable <list_var> only if the value is
not already in the list.
-::
+.. code-block:: cmake
IS_FILE_EXECUTABLE(<file> <result_var>)
Return 1 in <result_var> if <file> is a binary executable, 0
otherwise.
-::
+.. code-block:: cmake
GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)
@@ -122,7 +123,7 @@ is embedded inside a bundle.
Override on a per-project basis by providing a project-specific
gp_item_default_embedded_path_override function.
-::
+.. code-block:: cmake
GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>
[<rpaths>])
@@ -132,7 +133,7 @@ Resolve an item into an existing full path file.
Override on a per-project basis by providing a project-specific
gp_resolve_item_override function.
-::
+.. code-block:: cmake
GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>
[<rpaths>])
@@ -156,7 +157,7 @@ Possible types are:
Override on a per-project basis by providing a project-specific
gp_resolved_file_type_override function.
-::
+.. code-block:: cmake
GP_FILE_TYPE(<original_file> <file> <type_var>)
@@ -174,9 +175,6 @@ Possible types are:
other
#]=======================================================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
function(gp_append_unique list_var value)
if(NOT value IN_LIST ${list_var})
set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
@@ -662,7 +660,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# Check for a script by extension (.bat,.sh,...) or if the file starts with "#!" (shebang)
file(READ ${target} file_contents LIMIT 5)
if(target MATCHES "\\.(bat|c?sh|bash|ksh|cmd)$" OR file_contents MATCHES "^#!")
- message(STATUS "GetPrequisites(${target}) : ignoring script file")
+ message(STATUS "GetPrerequisites(${target}) : ignoring script file")
# Clear var
set(${prerequisites_var} "" PARENT_SCOPE)
return()
@@ -832,7 +830,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
string(SUBSTRING "${gp_cmd_ov}" 0 ${gp_delayload_pos} gp_cmd_ov_no_delayload_deps)
string(SUBSTRING "${gp_cmd_ov}" ${gp_delayload_pos} -1 gp_cmd_ov_delayload_deps)
if (verbose)
- message(STATUS "GetPrequisites(${target}) : ignoring the following delay load dependencies :\n ${gp_cmd_ov_delayload_deps}")
+ message(STATUS "GetPrerequisites(${target}) : ignoring the following delay load dependencies :\n ${gp_cmd_ov_delayload_deps}")
endif()
set(gp_cmd_ov ${gp_cmd_ov_no_delayload_deps})
endif()
@@ -1046,5 +1044,3 @@ function(list_prerequisites_by_glob glob_arg glob_exp)
endif()
endforeach()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 456a39c..ebf0ba0 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
GoogleTest
@@ -38,7 +38,9 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
.. command:: gtest_add_tests
Automatically add tests with CTest by scanning source code for Google Test
- macros::
+ macros:
+
+ .. code-block:: cmake
gtest_add_tests(TARGET target
[SOURCES src1...]
@@ -127,7 +129,9 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
set_tests_properties(${noArgsTests} PROPERTIES TIMEOUT 10)
set_tests_properties(${withArgsTests} PROPERTIES TIMEOUT 20)
- For backward compatibility, the following form is also supported::
+ For backward compatibility, the following form is also supported:
+
+ .. code-block:: cmake
gtest_add_tests(exe args files...)
@@ -152,7 +156,9 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
.. command:: gtest_discover_tests
Automatically add tests with CTest by querying the compiled test executable
- for available tests::
+ for available tests:
+
+ .. code-block:: cmake
gtest_discover_tests(target
[EXTRA_ARGS args...]
@@ -433,10 +439,10 @@ function(gtest_add_tests)
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")
+ 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)
+ string(REGEX MATCH "[ \t]*${gtest_test_type_regex}[ \t]*[\\(]*" accumulate_start_hit "${line_str}")
+ if(accumulate_start_hit)
set(accumulate_line "${line}")
endif()
# Append the current line to the accumulated string
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index afed307..3af16f8 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.30)
cmake_policy(SET CMP0174 NEW) # TODO: Remove this when we can update the above to 3.31
diff --git a/Modules/ITKCompatibility.cmake b/Modules/ITKCompatibility.cmake
index 7d211b6..36733b3 100644
--- a/Modules/ITKCompatibility.cmake
+++ b/Modules/ITKCompatibility.cmake
@@ -1,7 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# work around an old bug in ITK prior to version 3.0
set(TIFF_RIGHT_VERSION 1)
-
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index d5e5fd2..4d7aff3 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
InstallRequiredSystemLibraries
@@ -65,9 +65,6 @@ may be set prior to including the module to adjust behavior:
Support for installing Intel compiler runtimes.
#]=======================================================================]
-cmake_policy(PUSH)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-
set(_IRSL_HAVE_Intel FALSE)
set(_IRSL_HAVE_MSVC FALSE)
foreach(LANG IN ITEMS C CXX Fortran)
@@ -806,5 +803,3 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
)
endif()
endif()
-
-cmake_policy(POP)
diff --git a/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake b/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake
index 5e3ae78..150f712 100644
--- a/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake
+++ b/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for AT&T syntax assemblers, e.g. GNU as
diff --git a/Modules/Internal/CMakeASMLinkerInformation.cmake b/Modules/Internal/CMakeASMLinkerInformation.cmake
index 2d547dc..bbdba62 100644
--- a/Modules/Internal/CMakeASMLinkerInformation.cmake
+++ b/Modules/Internal/CMakeASMLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the C compiler in CMake.
diff --git a/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake b/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake
index d262de8..3ae6dc4 100644
--- a/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake
+++ b/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for the MS assembler, marmasm and marmasm64
diff --git a/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake b/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake
index 62497f2..7049623 100644
--- a/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake
+++ b/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for the MS assembler, masm and masm64
diff --git a/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake b/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake
index d48a018..5d00615 100644
--- a/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake
+++ b/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# support for the nasm assembler
diff --git a/Modules/Internal/CMakeCLinkerInformation.cmake b/Modules/Internal/CMakeCLinkerInformation.cmake
index ddc9827..73b168f 100644
--- a/Modules/Internal/CMakeCLinkerInformation.cmake
+++ b/Modules/Internal/CMakeCLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the C compiler in CMake.
diff --git a/Modules/Internal/CMakeCUDAArchitecturesAll.cmake b/Modules/Internal/CMakeCUDAArchitecturesAll.cmake
index 1d2f47f..1c095d1 100644
--- a/Modules/Internal/CMakeCUDAArchitecturesAll.cmake
+++ b/Modules/Internal/CMakeCUDAArchitecturesAll.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# See supported GPUs on Wikipedia
# https://en.wikipedia.org/wiki/CUDA#GPUs_supported
diff --git a/Modules/Internal/CMakeCUDAArchitecturesNative.cmake b/Modules/Internal/CMakeCUDAArchitecturesNative.cmake
index 4185eda..dd43bf3 100644
--- a/Modules/Internal/CMakeCUDAArchitecturesNative.cmake
+++ b/Modules/Internal/CMakeCUDAArchitecturesNative.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(cmake_cuda_architectures_native lang)
# Run the test binary to detect the native architectures.
diff --git a/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake b/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake
index 35bc7f2..57dd7e3 100644
--- a/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake
+++ b/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(cmake_cuda_architectures_validate lang)
if(DEFINED CMAKE_${lang}_ARCHITECTURES)
diff --git a/Modules/Internal/CMakeCUDAFilterImplicitLibs.cmake b/Modules/Internal/CMakeCUDAFilterImplicitLibs.cmake
index 60287af..493b8e2 100644
--- a/Modules/Internal/CMakeCUDAFilterImplicitLibs.cmake
+++ b/Modules/Internal/CMakeCUDAFilterImplicitLibs.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# In CMakeDetermineCUDACompiler and CMakeTestCUDACompiler we detect
# libraries that the CUDA compiler implicitly passes to the host linker.
diff --git a/Modules/Internal/CMakeCUDAFindToolkit.cmake b/Modules/Internal/CMakeCUDAFindToolkit.cmake
index 58d1e55..8fd4089 100644
--- a/Modules/Internal/CMakeCUDAFindToolkit.cmake
+++ b/Modules/Internal/CMakeCUDAFindToolkit.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
macro(cmake_cuda_find_toolkit lang lang_var_)
# This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors
diff --git a/Modules/Internal/CMakeCUDALinkerInformation.cmake b/Modules/Internal/CMakeCUDALinkerInformation.cmake
index 1d375f2..6d256fe 100644
--- a/Modules/Internal/CMakeCUDALinkerInformation.cmake
+++ b/Modules/Internal/CMakeCUDALinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the C compiler in CMake.
diff --git a/Modules/Internal/CMakeCXXLinkerInformation.cmake b/Modules/Internal/CMakeCXXLinkerInformation.cmake
index 2398b50..cedc6ad 100644
--- a/Modules/Internal/CMakeCXXLinkerInformation.cmake
+++ b/Modules/Internal/CMakeCXXLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the C++ compiler in CMake.
diff --git a/Modules/Internal/CMakeCommonLinkerInformation.cmake b/Modules/Internal/CMakeCommonLinkerInformation.cmake
index 245e068..2815e3f 100644
--- a/Modules/Internal/CMakeCommonLinkerInformation.cmake
+++ b/Modules/Internal/CMakeCommonLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file contains common code blocks used by all the linker information
diff --git a/Modules/Internal/CMakeDetermineLinkerId.cmake b/Modules/Internal/CMakeDetermineLinkerId.cmake
index 45499a5..2b17036 100644
--- a/Modules/Internal/CMakeDetermineLinkerId.cmake
+++ b/Modules/Internal/CMakeDetermineLinkerId.cmake
@@ -1,15 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Function to identify the linker. This is used internally by CMake and should
# not be included by user code.
# If successful, sets CMAKE_<lang>_COMPILER_LINKER_ID and
# CMAKE_<lang>_COMPILER_LINKER_VERSION
-cmake_policy(PUSH)
-cmake_policy(SET CMP0053 NEW)
-cmake_policy(SET CMP0054 NEW)
-
function(cmake_determine_linker_id lang linker)
if (NOT linker)
# linker was not identified
@@ -103,5 +99,3 @@ function(cmake_determine_linker_id lang linker)
unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE)
endif()
endfunction()
-
-cmake_policy(POP)
diff --git a/Modules/Internal/CMakeFortranLinkerInformation.cmake b/Modules/Internal/CMakeFortranLinkerInformation.cmake
index cddd0e9..05fa352 100644
--- a/Modules/Internal/CMakeFortranLinkerInformation.cmake
+++ b/Modules/Internal/CMakeFortranLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the C compiler in CMake.
diff --git a/Modules/Internal/CMakeHIPLinkerInformation.cmake b/Modules/Internal/CMakeHIPLinkerInformation.cmake
index e996889..e1531ef 100644
--- a/Modules/Internal/CMakeHIPLinkerInformation.cmake
+++ b/Modules/Internal/CMakeHIPLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the C compiler in CMake.
diff --git a/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake b/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
index dee7580..54b5b9c 100644
--- a/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
+++ b/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
macro(cmake_nvcc_filter_implicit_info lang lang_var_)
# Remove the CUDA Toolkit include directories from the set of
diff --git a/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake b/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake
index cc8dd26..7369847 100644
--- a/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake
+++ b/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
macro(cmake_nvcc_parse_implicit_info lang lang_var_)
set(_nvcc_log "")
diff --git a/Modules/Internal/CMakeOBJCLinkerInformation.cmake b/Modules/Internal/CMakeOBJCLinkerInformation.cmake
index a26fa42..5768c66 100644
--- a/Modules/Internal/CMakeOBJCLinkerInformation.cmake
+++ b/Modules/Internal/CMakeOBJCLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the Objective-C compiler in CMake.
diff --git a/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake b/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake
index d61dd1a..e4f69c4 100644
--- a/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake
+++ b/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the Objective-C++ compiler in CMake.
diff --git a/Modules/Internal/CMakeSwiftLinkerInformation.cmake b/Modules/Internal/CMakeSwiftLinkerInformation.cmake
index f3a1d07..3e21797 100644
--- a/Modules/Internal/CMakeSwiftLinkerInformation.cmake
+++ b/Modules/Internal/CMakeSwiftLinkerInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This file sets the basic flags for the linker used by the Swift compiler in CMake.
diff --git a/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake
index b671b4a..e5523b2 100644
--- a/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake
+++ b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=[
diff --git a/Modules/Internal/CPack/.gitattributes b/Modules/Internal/CPack/.gitattributes
new file mode 100644
index 0000000..ecc9de5
--- /dev/null
+++ b/Modules/Internal/CPack/.gitattributes
@@ -0,0 +1,2 @@
+# TODO Check if `CPack.distribution.dist.in` could use spaces
+CPack.distribution.dist.in tab-indent
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 0169f61..873c7bc 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# CPack script for creating Debian package
# Author: Mathieu Malaterre
@@ -10,9 +10,6 @@ if(CMAKE_BINARY_DIR)
message(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
endif()
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
function(cpack_deb_variable_fallback OUTPUT_VAR_NAME)
set(FALLBACK_VAR_NAMES ${ARGN})
@@ -88,7 +85,7 @@ function(get_sanitized_dirname dirname outvar)
# defined in the C++ function `CPackGenerator::GetSanitizedDirOrFileName`!
set(prohibited_chars_pattern "[<]|[>]|[\"]|[/]|[\\]|[|]|[?]|[*]|[`]")
if("${dirname}" MATCHES "${prohibited_chars_pattern}")
- string(MD5 santized_dirname "${dirname}")
+ string(MD5 sanitized_dirname "${dirname}")
set(${outvar} "${sanitized_dirname}" PARENT_SCOPE)
else()
set(${outvar} "${dirname}" PARENT_SCOPE)
@@ -886,5 +883,3 @@ function(cpack_deb_prepare_package_vars)
endfunction()
cpack_deb_prepare_package_vars()
-
-cmake_policy(POP)
diff --git a/Modules/Internal/CPack/CPackExternal.cmake b/Modules/Internal/CPack/CPackExternal.cmake
index e4d055a..4736a99 100644
--- a/Modules/Internal/CPack/CPackExternal.cmake
+++ b/Modules/Internal/CPack/CPackExternal.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT "${CPACK_EXTERNAL_REQUESTED_VERSIONS}" STREQUAL "")
unset(_found_major)
diff --git a/Modules/Internal/CPack/CPackFreeBSD.cmake b/Modules/Internal/CPack/CPackFreeBSD.cmake
index 46a7bf7..cfe22ed 100644
--- a/Modules/Internal/CPack/CPackFreeBSD.cmake
+++ b/Modules/Internal/CPack/CPackFreeBSD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_BINARY_DIR)
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 83a8f43..9b6cc91 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Author: Alex Turbov
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index e3f8f5e..7776ee2 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1,11 +1,8 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Author: Eric Noulard with the help of Alexander Neundorf.
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
function(set_spec_script_if_enabled TYPE PACKAGE_NAME VAR)
if(NOT "${VAR}" STREQUAL "" AND NOT "${VAR}" STREQUAL "\n")
if(PACKAGE_NAME)
@@ -811,25 +808,26 @@ function(cpack_rpm_generate_package)
# rpmbuild is the basic command for building RPM package
# it may be a simple (symbolic) link to rpm command.
find_program(RPMBUILD_EXECUTABLE rpmbuild)
+ if(NOT RPMBUILD_EXECUTABLE)
+ message(FATAL_ERROR "RPM package requires rpmbuild executable")
+ endif()
+
+ # rpm is used for fallback queries in some older versions,
+ # but is not required in general.
+ find_program(RPM_EXECUTABLE rpm)
# Check version of the rpmbuild tool this would be easier to
# track bugs with users and CPackRPM debug mode.
# We may use RPM version in order to check for available version dependent features
- if(RPMBUILD_EXECUTABLE)
- execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version
- OUTPUT_VARIABLE _TMP_VERSION
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "^.* " ""
- RPMBUILD_EXECUTABLE_VERSION
- ${_TMP_VERSION})
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")
- endif()
- endif()
-
- if(NOT RPMBUILD_EXECUTABLE)
- message(FATAL_ERROR "RPM package requires rpmbuild executable")
+ execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version
+ OUTPUT_VARIABLE _TMP_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "^.* " ""
+ RPMBUILD_EXECUTABLE_VERSION
+ ${_TMP_VERSION})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")
endif()
# Display lsb_release output if DEBUG mode enable
@@ -859,16 +857,6 @@ function(cpack_rpm_generate_package)
message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.")
endif()
- # If rpmbuild is found
- # we try to discover alien since we may be on non RPM distro like Debian.
- # In this case we may try to use more advanced features
- # like generating RPM directly from DEB using alien.
- # FIXME feature not finished (yet)
- find_program(ALIEN_EXECUTABLE alien)
- if(ALIEN_EXECUTABLE)
- message(STATUS "alien found, we may be on a Debian based distro.")
- endif()
-
# Are we packaging components ?
if(CPACK_RPM_PACKAGE_COMPONENT)
string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER)
@@ -1088,22 +1076,32 @@ function(cpack_rpm_generate_package)
execute_process(
COMMAND "${RPMBUILD_EXECUTABLE}" --querytags
OUTPUT_VARIABLE RPMBUILD_TAG_LIST
+ RESULT_VARIABLE RPMBUILD_QUERYTAGS_SUCCESS
+ ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ # In some versions of RPM, rpmbuild does not understand --querytags parameter,
+ # but rpm does.
+ if(NOT RPMBUILD_QUERYTAGS_SUCCESS EQUAL 0 AND RPM_EXECUTABLE)
+ execute_process(
+ COMMAND "${RPM_EXECUTABLE}" --querytags
+ OUTPUT_VARIABLE RPMBUILD_TAG_LIST
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}")
# In some versions of RPM, weak dependency tags are present in the --querytags
# list, but unsupported by rpmbuild. A different method must be used to check
# if they are supported.
-
- execute_process(
- COMMAND ${RPM_EXECUTABLE} --suggests
- ERROR_QUIET
- RESULT_VARIABLE RPMBUILD_SUGGESTS_RESULT)
-
- if(NOT RPMBUILD_SUGGESTS_RESULT EQUAL 0)
- foreach(_WEAK_DEP SUGGESTS RECOMMENDS SUPPLEMENTS ENHANCES)
- list(REMOVE_ITEM RPMBUILD_TAG_LIST ${_WEAK_DEP})
- endforeach()
+ if(RPM_EXECUTABLE)
+ execute_process(
+ COMMAND "${RPM_EXECUTABLE}" --suggests
+ ERROR_QUIET
+ RESULT_VARIABLE RPM_SUGGESTS_RESULT)
+ if(NOT RPM_SUGGESTS_RESULT EQUAL 0)
+ foreach(_WEAK_DEP SUGGESTS RECOMMENDS SUPPLEMENTS ENHANCES)
+ list(REMOVE_ITEM RPMBUILD_TAG_LIST ${_WEAK_DEP})
+ endforeach()
+ endif()
endif()
if(CPACK_RPM_PACKAGE_EPOCH)
@@ -1885,31 +1883,25 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
endif()
if(NOT GENERATE_SPEC_PARTS) # generate package
- if(RPMBUILD_EXECUTABLE)
- # Now call rpmbuild using the SPECFILE
- execute_process(
- COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
- --define "_topdir ${CPACK_RPM_DIRECTORY}"
- --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
- "${CPACK_RPM_BINARY_SPECFILE}"
- WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
- ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
- OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
- if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
- message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
- message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
- message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
- endif()
- else()
- if(ALIEN_EXECUTABLE)
- message(FATAL_ERROR "RPM packaging through alien not done (yet)")
- endif()
+ # Now call rpmbuild using the SPECFILE
+ execute_process(
+ COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
+ --define "_topdir ${CPACK_RPM_DIRECTORY}"
+ --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
+ "${CPACK_RPM_BINARY_SPECFILE}"
+ WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
+ ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
+ OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
+ message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
+ message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
endif()
# find generated rpm files and take their names
@@ -1989,5 +1981,3 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
endfunction()
cpack_rpm_generate_package()
-
-cmake_policy(POP)
diff --git a/Modules/Internal/CPack/CPackWIX.cmake b/Modules/Internal/CPack/CPackWIX.cmake
index 9980bc2..4fdf17c 100644
--- a/Modules/Internal/CPack/CPackWIX.cmake
+++ b/Modules/Internal/CPack/CPackWIX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT CPACK_WIX_ROOT)
string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}")
diff --git a/Modules/Internal/CPack/CPackZIP.cmake b/Modules/Internal/CPack/CPackZIP.cmake
index f619de4..06fa375 100644
--- a/Modules/Internal/CPack/CPackZIP.cmake
+++ b/Modules/Internal/CPack/CPackZIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_BINARY_DIR)
diff --git a/Modules/Internal/CPack/ISComponents.pas b/Modules/Internal/CPack/ISComponents.pas
index 8b5c8b4..cfcbe4f 100644
--- a/Modules/Internal/CPack/ISComponents.pas
+++ b/Modules/Internal/CPack/ISComponents.pas
@@ -1,5 +1,5 @@
{ Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-file Copyright.txt or https://cmake.org/licensing for details. }
+file LICENSE.rst or https://cmake.org/licensing for details. }
function CPackGetCustomInstallationMessage(Param: String): String;
begin
diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake
index 910f426..341b969 100644
--- a/Modules/Internal/CheckCompilerFlag.cmake
+++ b/Modules/Internal/CheckCompilerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
include(Internal/CheckFlagCommonConfig)
diff --git a/Modules/Internal/CheckFlagCommonConfig.cmake b/Modules/Internal/CheckFlagCommonConfig.cmake
index 557e9c7..3403c1d 100644
--- a/Modules/Internal/CheckFlagCommonConfig.cmake
+++ b/Modules/Internal/CheckFlagCommonConfig.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Do NOT include this module directly into any of your code. It is meant as
@@ -8,10 +8,6 @@
include_guard(GLOBAL)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
-
macro(CMAKE_CHECK_FLAG_COMMON_INIT _FUNC _LANG _SRC _PATTERNS)
if("${_LANG}" STREQUAL "C")
set(${_SRC} "int main(void) { return 0; }")
@@ -75,5 +71,3 @@ macro(CMAKE_CHECK_FLAG_COMMON_FINISH)
set(ENV{${v}} ${_CMAKE_CHECK_FLAG_COMMON_CONFIG_locale_vars_saved_${v}})
endforeach()
endmacro()
-
-endblock()
diff --git a/Modules/Internal/CheckLinkerFlag.cmake b/Modules/Internal/CheckLinkerFlag.cmake
index b872b51..64fdff8 100644
--- a/Modules/Internal/CheckLinkerFlag.cmake
+++ b/Modules/Internal/CheckLinkerFlag.cmake
@@ -1,14 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
include(Internal/CheckFlagCommonConfig)
include(Internal/CheckSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-
function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var)
# link step supports less languages than the compiler
# so do a first check about the requested language
@@ -48,5 +45,3 @@ function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var)
cmake_check_flag_common_finish()
endfunction()
-
-endblock()
diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake
index 1eadc80..e5c0ef1 100644
--- a/Modules/Internal/CheckSourceCompiles.cmake
+++ b/Modules/Internal/CheckSourceCompiles.cmake
@@ -1,12 +1,8 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
-
function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
if(NOT DEFINED "${_var}")
set(_lang_filename "src")
@@ -139,5 +135,3 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
endif()
endif()
endfunction()
-
-endblock()
diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake
index 761598f..5df37e0 100644
--- a/Modules/Internal/CheckSourceRuns.cmake
+++ b/Modules/Internal/CheckSourceRuns.cmake
@@ -1,12 +1,8 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
-
function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
if(NOT DEFINED "${_var}")
@@ -131,5 +127,3 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
endif()
endif()
endfunction()
-
-endblock()
diff --git a/Modules/Internal/HeaderpadWorkaround.cmake b/Modules/Internal/HeaderpadWorkaround.cmake
index fccfaae..0555ded 100644
--- a/Modules/Internal/HeaderpadWorkaround.cmake
+++ b/Modules/Internal/HeaderpadWorkaround.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Do NOT include this module directly into any of your code. It is used by
@@ -9,9 +9,6 @@ if(NOT APPLE)
return()
endif()
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
-
function(__cmake_internal_workaround_headerpad_flag_conflict _LANG)
# Until we can avoid hard-coding -Wl,-headerpad_max_install_names in the
@@ -65,5 +62,3 @@ foreach(__lang IN LISTS __enabled_languages)
endforeach()
unset(__lang)
unset(__enabled_languages)
-
-endblock()
diff --git a/Modules/Internal/OSRelease/010-TryOldCentOS.cmake b/Modules/Internal/OSRelease/010-TryOldCentOS.cmake
index ff35897..a73c4d0 100644
--- a/Modules/Internal/OSRelease/010-TryOldCentOS.cmake
+++ b/Modules/Internal/OSRelease/010-TryOldCentOS.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Author: Alex Turbov
diff --git a/Modules/Internal/OSRelease/020-TryDebianVersion.cmake b/Modules/Internal/OSRelease/020-TryDebianVersion.cmake
index 8ebe19a..8e46193 100644
--- a/Modules/Internal/OSRelease/020-TryDebianVersion.cmake
+++ b/Modules/Internal/OSRelease/020-TryDebianVersion.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Author: Alex Turbov
diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake
index 42f6d2c..da65561 100644
--- a/Modules/KDE3Macros.cmake
+++ b/Modules/KDE3Macros.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#
@@ -399,5 +399,3 @@ macro(KDE3_ADD_EXECUTABLE _target_NAME )
# endif ()
endmacro()
-
-
diff --git a/Modules/Linker/AIX-ASM.cmake b/Modules/Linker/AIX-ASM.cmake
index 0c748fc..20c7974 100644
--- a/Modules/Linker/AIX-ASM.cmake
+++ b/Modules/Linker/AIX-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/AIX)
diff --git a/Modules/Linker/AIX-C.cmake b/Modules/Linker/AIX-C.cmake
index c1bfd45..bddcca2 100644
--- a/Modules/Linker/AIX-C.cmake
+++ b/Modules/Linker/AIX-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/AIX)
diff --git a/Modules/Linker/AIX-CXX.cmake b/Modules/Linker/AIX-CXX.cmake
index 34cdf20..0a8ed72 100644
--- a/Modules/Linker/AIX-CXX.cmake
+++ b/Modules/Linker/AIX-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/AIX)
diff --git a/Modules/Linker/AIX-Fortran.cmake b/Modules/Linker/AIX-Fortran.cmake
index cf74076..badf1e6 100644
--- a/Modules/Linker/AIX-Fortran.cmake
+++ b/Modules/Linker/AIX-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/AIX)
diff --git a/Modules/Linker/AIX.cmake b/Modules/Linker/AIX.cmake
index 6639df3..e4ac586 100644
--- a/Modules/Linker/AIX.cmake
+++ b/Modules/Linker/AIX.cmake
@@ -1,9 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple linkers; use include blocker.
include_guard()
macro(__linker_aix lang)
+ # Linker warning as error
+ set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-bhalt:0")
endmacro()
diff --git a/Modules/Linker/AppleClang.cmake b/Modules/Linker/AppleClang.cmake
index 4e48998..0dff63c 100644
--- a/Modules/Linker/AppleClang.cmake
+++ b/Modules/Linker/AppleClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple linkers; use include blocker.
@@ -7,4 +7,6 @@
include_guard()
macro(__linker_appleclang lang)
+ # Linker warning as error
+ set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-fatal_warnings")
endmacro()
diff --git a/Modules/Linker/GNU-ASM.cmake b/Modules/Linker/GNU-ASM.cmake
index d927106..68f46c0 100644
--- a/Modules/Linker/GNU-ASM.cmake
+++ b/Modules/Linker/GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNU)
diff --git a/Modules/Linker/GNU-C.cmake b/Modules/Linker/GNU-C.cmake
index 9a19e7d..8d641de 100644
--- a/Modules/Linker/GNU-C.cmake
+++ b/Modules/Linker/GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNU)
diff --git a/Modules/Linker/GNU-CUDA.cmake b/Modules/Linker/GNU-CUDA.cmake
index 82e887f..5bde83d 100644
--- a/Modules/Linker/GNU-CUDA.cmake
+++ b/Modules/Linker/GNU-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNU)
diff --git a/Modules/Linker/GNU-CXX.cmake b/Modules/Linker/GNU-CXX.cmake
index 6b4d719..cec3767 100644
--- a/Modules/Linker/GNU-CXX.cmake
+++ b/Modules/Linker/GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNU)
diff --git a/Modules/Linker/GNU-Fortran.cmake b/Modules/Linker/GNU-Fortran.cmake
index b4f688a..a671b10 100644
--- a/Modules/Linker/GNU-Fortran.cmake
+++ b/Modules/Linker/GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNU)
diff --git a/Modules/Linker/GNU-HIP.cmake b/Modules/Linker/GNU-HIP.cmake
index b2d0b2e..1ea4195 100644
--- a/Modules/Linker/GNU-HIP.cmake
+++ b/Modules/Linker/GNU-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNU)
diff --git a/Modules/Linker/GNU.cmake b/Modules/Linker/GNU.cmake
index 978ac12..2ac5ea6 100644
--- a/Modules/Linker/GNU.cmake
+++ b/Modules/Linker/GNU.cmake
@@ -1,12 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple linkers; use include blocker.
include_guard()
block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0140 NEW)
function(__linker_gnu lang)
@@ -65,10 +64,14 @@ function(__linker_gnu lang)
set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
endif()
+ # Linker warning as error
+ set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:--fatal-warnings")
+
return(PROPAGATE CMAKE_${lang}_LINKER_DEPFILE_FLAGS
CMAKE_${lang}_LINKER_DEPFILE_FORMAT
CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED
- CMAKE_${lang}_LINK_DEPENDS_USE_LINKER)
+ CMAKE_${lang}_LINK_DEPENDS_USE_LINKER
+ CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR)
endfunction()
endblock()
diff --git a/Modules/Linker/GNUgold-ASM.cmake b/Modules/Linker/GNUgold-ASM.cmake
index 9f920e5..39071c3 100644
--- a/Modules/Linker/GNUgold-ASM.cmake
+++ b/Modules/Linker/GNUgold-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNUgold)
diff --git a/Modules/Linker/GNUgold-C.cmake b/Modules/Linker/GNUgold-C.cmake
index a510626..62fedd2 100644
--- a/Modules/Linker/GNUgold-C.cmake
+++ b/Modules/Linker/GNUgold-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNUgold)
diff --git a/Modules/Linker/GNUgold-CUDA.cmake b/Modules/Linker/GNUgold-CUDA.cmake
index 9cd52e0..ed32603 100644
--- a/Modules/Linker/GNUgold-CUDA.cmake
+++ b/Modules/Linker/GNUgold-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNUgold)
diff --git a/Modules/Linker/GNUgold-CXX.cmake b/Modules/Linker/GNUgold-CXX.cmake
index eeb624b..6cda1e6 100644
--- a/Modules/Linker/GNUgold-CXX.cmake
+++ b/Modules/Linker/GNUgold-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNUgold)
diff --git a/Modules/Linker/GNUgold-Fortran.cmake b/Modules/Linker/GNUgold-Fortran.cmake
index 97298ed..28d16d7 100644
--- a/Modules/Linker/GNUgold-Fortran.cmake
+++ b/Modules/Linker/GNUgold-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNUgold)
diff --git a/Modules/Linker/GNUgold-HIP.cmake b/Modules/Linker/GNUgold-HIP.cmake
index 900b9aa..bfd24c6 100644
--- a/Modules/Linker/GNUgold-HIP.cmake
+++ b/Modules/Linker/GNUgold-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/GNUgold)
diff --git a/Modules/Linker/GNUgold.cmake b/Modules/Linker/GNUgold.cmake
index 4680564..ad20064 100644
--- a/Modules/Linker/GNUgold.cmake
+++ b/Modules/Linker/GNUgold.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple linkers; use include blocker.
diff --git a/Modules/Linker/LLD-ASM.cmake b/Modules/Linker/LLD-ASM.cmake
index 255f8c5..c138410 100644
--- a/Modules/Linker/LLD-ASM.cmake
+++ b/Modules/Linker/LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-C.cmake b/Modules/Linker/LLD-C.cmake
index d3036b0..825918f 100644
--- a/Modules/Linker/LLD-C.cmake
+++ b/Modules/Linker/LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-CUDA.cmake b/Modules/Linker/LLD-CUDA.cmake
index aa72413..11f6670 100644
--- a/Modules/Linker/LLD-CUDA.cmake
+++ b/Modules/Linker/LLD-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-CXX.cmake b/Modules/Linker/LLD-CXX.cmake
index 0a0d2de..f459d78 100644
--- a/Modules/Linker/LLD-CXX.cmake
+++ b/Modules/Linker/LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-Fortran.cmake b/Modules/Linker/LLD-Fortran.cmake
index babcd9a..e39c4f8 100644
--- a/Modules/Linker/LLD-Fortran.cmake
+++ b/Modules/Linker/LLD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-HIP.cmake b/Modules/Linker/LLD-HIP.cmake
index 8535830..b343f23 100644
--- a/Modules/Linker/LLD-HIP.cmake
+++ b/Modules/Linker/LLD-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-OBJC.cmake b/Modules/Linker/LLD-OBJC.cmake
index 7a2af76..d9c4ffd 100644
--- a/Modules/Linker/LLD-OBJC.cmake
+++ b/Modules/Linker/LLD-OBJC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD-OBJCXX.cmake b/Modules/Linker/LLD-OBJCXX.cmake
index 2361e90..36021be 100644
--- a/Modules/Linker/LLD-OBJCXX.cmake
+++ b/Modules/Linker/LLD-OBJCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/LLD)
diff --git a/Modules/Linker/LLD.cmake b/Modules/Linker/LLD.cmake
index 6695f98..012b6f1 100644
--- a/Modules/Linker/LLD.cmake
+++ b/Modules/Linker/LLD.cmake
@@ -1,10 +1,16 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard()
-include(Linker/GNU)
-
macro(__linker_lld lang)
- __linker_gnu(${lang})
+ if(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT STREQUAL "MSVC")
+ include(Linker/MSVC)
+
+ __linker_msvc(${lang})
+ else()
+ include(Linker/GNU)
+
+ __linker_gnu(${lang})
+ endif()
endmacro()
diff --git a/Modules/Linker/MOLD-ASM.cmake b/Modules/Linker/MOLD-ASM.cmake
index d927106..d32cf49 100644
--- a/Modules/Linker/MOLD-ASM.cmake
+++ b/Modules/Linker/MOLD-ASM.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(ASM)
+__linker_mold(ASM)
diff --git a/Modules/Linker/MOLD-C.cmake b/Modules/Linker/MOLD-C.cmake
index 9a19e7d..ee866ac 100644
--- a/Modules/Linker/MOLD-C.cmake
+++ b/Modules/Linker/MOLD-C.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(C)
+__linker_mold(C)
diff --git a/Modules/Linker/MOLD-CUDA.cmake b/Modules/Linker/MOLD-CUDA.cmake
index 82e887f..d64476c 100644
--- a/Modules/Linker/MOLD-CUDA.cmake
+++ b/Modules/Linker/MOLD-CUDA.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(CUDA)
+__linker_mold(CUDA)
diff --git a/Modules/Linker/MOLD-CXX.cmake b/Modules/Linker/MOLD-CXX.cmake
index 6b4d719..c5a6318 100644
--- a/Modules/Linker/MOLD-CXX.cmake
+++ b/Modules/Linker/MOLD-CXX.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(CXX)
+__linker_mold(CXX)
diff --git a/Modules/Linker/MOLD-Fortran.cmake b/Modules/Linker/MOLD-Fortran.cmake
index b4f688a..f85dfde 100644
--- a/Modules/Linker/MOLD-Fortran.cmake
+++ b/Modules/Linker/MOLD-Fortran.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(Fortran)
+__linker_mold(Fortran)
diff --git a/Modules/Linker/MOLD-HIP.cmake b/Modules/Linker/MOLD-HIP.cmake
index b2d0b2e..49f2a21 100644
--- a/Modules/Linker/MOLD-HIP.cmake
+++ b/Modules/Linker/MOLD-HIP.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(HIP)
+__linker_mold(HIP)
diff --git a/Modules/Linker/MOLD-OBJC.cmake b/Modules/Linker/MOLD-OBJC.cmake
index a3c668d..f35b97b 100644
--- a/Modules/Linker/MOLD-OBJC.cmake
+++ b/Modules/Linker/MOLD-OBJC.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(OBJC)
+__linker_mold(OBJC)
diff --git a/Modules/Linker/MOLD-OBJCXX.cmake b/Modules/Linker/MOLD-OBJCXX.cmake
index 0b73003..7980b6d 100644
--- a/Modules/Linker/MOLD-OBJCXX.cmake
+++ b/Modules/Linker/MOLD-OBJCXX.cmake
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
-include(Linker/GNU)
+include(Linker/MOLD)
-__linker_gnu(OBJCXX)
+__linker_mold(OBJCXX)
diff --git a/Modules/Linker/MOLD.cmake b/Modules/Linker/MOLD.cmake
new file mode 100644
index 0000000..fb2d5d3
--- /dev/null
+++ b/Modules/Linker/MOLD.cmake
@@ -0,0 +1,18 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple linkers; use include blocker.
+include_guard()
+
+macro(__linker_mold lang)
+ if(CMAKE_EFFECTIVE_SYSTEM_NAME STREQUAL "Apple")
+ include(Linker/AppleClang)
+
+ __linker_appleclang(${lang})
+ else()
+ include(Linker/GNU)
+
+ __linker_gnu(${lang})
+ endif()
+endmacro()
diff --git a/Modules/Linker/MSVC-ASM.cmake b/Modules/Linker/MSVC-ASM.cmake
new file mode 100644
index 0000000..b34107e
--- /dev/null
+++ b/Modules/Linker/MSVC-ASM.cmake
@@ -0,0 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include(Linker/MSVC)
+
+__linker_msvc(ASM)
diff --git a/Modules/Linker/MSVC-C.cmake b/Modules/Linker/MSVC-C.cmake
new file mode 100644
index 0000000..a0ea96f
--- /dev/null
+++ b/Modules/Linker/MSVC-C.cmake
@@ -0,0 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include(Linker/MSVC)
+
+__linker_msvc(C)
diff --git a/Modules/Linker/MSVC-CUDA.cmake b/Modules/Linker/MSVC-CUDA.cmake
new file mode 100644
index 0000000..3a56713
--- /dev/null
+++ b/Modules/Linker/MSVC-CUDA.cmake
@@ -0,0 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include(Linker/MSVC)
+
+__linker_msvc(CUDA)
diff --git a/Modules/Linker/MSVC-CXX.cmake b/Modules/Linker/MSVC-CXX.cmake
new file mode 100644
index 0000000..6bc459a
--- /dev/null
+++ b/Modules/Linker/MSVC-CXX.cmake
@@ -0,0 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include(Linker/MSVC)
+
+__linker_msvc(CXX)
diff --git a/Modules/Linker/MSVC-Fortran.cmake b/Modules/Linker/MSVC-Fortran.cmake
new file mode 100644
index 0000000..57b3a5d
--- /dev/null
+++ b/Modules/Linker/MSVC-Fortran.cmake
@@ -0,0 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include(Linker/MSVC)
+
+__linker_msvc(Fortran)
diff --git a/Modules/Linker/MSVC-HIP.cmake b/Modules/Linker/MSVC-HIP.cmake
new file mode 100644
index 0000000..7b1c637
--- /dev/null
+++ b/Modules/Linker/MSVC-HIP.cmake
@@ -0,0 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+include(Linker/MSVC)
+
+__linker_msvc(HIP)
diff --git a/Modules/Linker/MSVC.cmake b/Modules/Linker/MSVC.cmake
new file mode 100644
index 0000000..c6e2269
--- /dev/null
+++ b/Modules/Linker/MSVC.cmake
@@ -0,0 +1,12 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple linkers; use include blocker.
+include_guard()
+
+
+macro(__linker_msvc lang)
+ # Linker warning as error
+ set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-WX")
+endmacro()
diff --git a/Modules/Linker/Solaris-ASM.cmake b/Modules/Linker/Solaris-ASM.cmake
index 2bcdd71..a525e80 100644
--- a/Modules/Linker/Solaris-ASM.cmake
+++ b/Modules/Linker/Solaris-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/Solaris)
diff --git a/Modules/Linker/Solaris-C.cmake b/Modules/Linker/Solaris-C.cmake
index 23458d5..8d00a71 100644
--- a/Modules/Linker/Solaris-C.cmake
+++ b/Modules/Linker/Solaris-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/Solaris)
diff --git a/Modules/Linker/Solaris-CXX.cmake b/Modules/Linker/Solaris-CXX.cmake
index 8ddf909..f4376e5 100644
--- a/Modules/Linker/Solaris-CXX.cmake
+++ b/Modules/Linker/Solaris-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/Solaris)
diff --git a/Modules/Linker/Solaris-Fortran.cmake b/Modules/Linker/Solaris-Fortran.cmake
index 111cf11..ad43d05 100644
--- a/Modules/Linker/Solaris-Fortran.cmake
+++ b/Modules/Linker/Solaris-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Linker/Solaris)
diff --git a/Modules/Linker/Solaris.cmake b/Modules/Linker/Solaris.cmake
index fbd1199..c85caab 100644
--- a/Modules/Linker/Solaris.cmake
+++ b/Modules/Linker/Solaris.cmake
@@ -1,9 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple linkers; use include blocker.
include_guard()
macro(__linker_solaris lang)
+ # Linker warning as error
+ set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-z,fatal-warnings")
endmacro()
diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake
index 8fdc264..80f7b32 100644
--- a/Modules/MacroAddFileDependencies.cmake
+++ b/Modules/MacroAddFileDependencies.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
MacroAddFileDependencies
@@ -7,7 +7,7 @@ MacroAddFileDependencies
.. deprecated:: 3.14
-::
+.. code-block:: cmake
MACRO_ADD_FILE_DEPENDENCIES(<source> <files>...)
diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake
index 8973231..a52ff02 100644
--- a/Modules/MatlabTestsRedirect.cmake
+++ b/Modules/MatlabTestsRedirect.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This is an undocumented internal helper for the FindMatlab
# module ``matlab_add_unit_test`` command.
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index c9f01a6..111aa83 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -12,7 +12,7 @@ macro(__aix_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-bnoipath")
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall")
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
diff --git a/Modules/Platform/AIX-IBMClang.cmake b/Modules/Platform/AIX-IBMClang.cmake
index 4e5205e..471e20e 100644
--- a/Modules/Platform/AIX-IBMClang.cmake
+++ b/Modules/Platform/AIX-IBMClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/AIX-Initialize.cmake b/Modules/Platform/AIX-Initialize.cmake
index 0b117a7..b42e58e 100644
--- a/Modules/Platform/AIX-Initialize.cmake
+++ b/Modules/Platform/AIX-Initialize.cmake
@@ -1 +1,2 @@
+set(AIX 1)
set(UNIX 1)
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
index f7cab25..24477ce 100644
--- a/Modules/Platform/AIX-XL.cmake
+++ b/Modules/Platform/AIX-XL.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -12,7 +12,7 @@ macro(__aix_compiler_xl lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-bnoipath")
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ")
set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
diff --git a/Modules/Platform/AIX-XLClang.cmake b/Modules/Platform/AIX-XLClang.cmake
index c932095..b6df732 100644
--- a/Modules/Platform/AIX-XLClang.cmake
+++ b/Modules/Platform/AIX-XLClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/AIX/ExportImportList b/Modules/Platform/AIX/ExportImportList
index 7c269fd..67c53eb 100755
--- a/Modules/Platform/AIX/ExportImportList
+++ b/Modules/Platform/AIX/ExportImportList
@@ -1,6 +1,6 @@
#!/bin/sh
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This script is internal to CMake and meant only to be
# invoked by CMake-generated build systems on AIX.
@@ -63,7 +63,7 @@ if test -z "$no_objects"; then
V["EXPORTED"]=" export"
V["PROTECTED"]=" protected"
}
- /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|tdata|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / {
+ /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|tdata|bss|tbss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / {
if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) {
print $NF V[$(NF-1)]
}
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
index aaaae9b..d4be244 100644
--- a/Modules/Platform/Android-Clang.cmake
+++ b/Modules/Platform/Android-Clang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__ANDROID_COMPILER_CLANG)
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index f1deaca..60e1617 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__ANDROID_COMPILER_COMMON)
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index bab6042..ff4290e 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# When CMAKE_SYSTEM_NAME is "Android", CMakeDetermineSystem loads this module.
# This module detects platform-wide information about the Android target
@@ -31,7 +31,6 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android")
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
diff --git a/Modules/Platform/Android-GNU.cmake b/Modules/Platform/Android-GNU.cmake
index e1f79ca..eb02024 100644
--- a/Modules/Platform/Android-GNU.cmake
+++ b/Modules/Platform/Android-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__ANDROID_COMPILER_GNU)
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
index e2b2bd5..75851ac 100644
--- a/Modules/Platform/Android-Initialize.cmake
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this
# module.
diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
index 4e58d69..3e94f1c 100644
--- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake
+++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# In Android NDK r19 and above there is a single clang toolchain.
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
diff --git a/Modules/Platform/Android/Determine-Compiler-Standalone.cmake b/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
index 5095aff..2da1ad3 100644
--- a/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
+++ b/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set(_ANDROID_TOOL_C_COMPILER "")
set(_ANDROID_TOOL_CXX_COMPILER "")
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
index f8eae62..bbc3b82 100644
--- a/Modules/Platform/Android/Determine-Compiler.cmake
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__ANDROID_DETERMINE_COMPILER)
diff --git a/Modules/Platform/Apple-Absoft-Fortran.cmake b/Modules/Platform/Apple-Absoft-Fortran.cmake
index 8caa202..b928321 100644
--- a/Modules/Platform/Apple-Absoft-Fortran.cmake
+++ b/Modules/Platform/Apple-Absoft-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood.
diff --git a/Modules/Platform/Apple-Apple-Swift.cmake b/Modules/Platform/Apple-Apple-Swift.cmake
index 9f27efa..f8c376d 100644
--- a/Modules/Platform/Apple-Apple-Swift.cmake
+++ b/Modules/Platform/Apple-Apple-Swift.cmake
@@ -15,3 +15,5 @@ else()
set(CMAKE_SHARED_MODULE_LOADER_Swift_FLAG "-Xclang-linker -Wl,-bundle_loader,")
set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS "-Xlinker -bundle")
endif()
+
+set(CMAKE_Swift_LINK_MODE DRIVER)
diff --git a/Modules/Platform/Apple-Clang.cmake b/Modules/Platform/Apple-Clang.cmake
index 83357a7..da695f6 100644
--- a/Modules/Platform/Apple-Clang.cmake
+++ b/Modules/Platform/Apple-Clang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -26,6 +26,10 @@ macro(__apple_compiler_clang lang)
set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
set(CMAKE_${lang}_USING_LINKER_SOLD "-fuse-ld=sold")
+ if(NOT CMAKE_${lang}_COMPILER_APPLE_SYSROOT)
+ set(CMAKE_${lang}_COMPILER_APPLE_SYSROOT_REQUIRED 1)
+ endif()
+
if(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneOS")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-miphoneos-version-min=")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneSimulator")
diff --git a/Modules/Platform/Apple-GNU-Fortran.cmake b/Modules/Platform/Apple-GNU-Fortran.cmake
index 2f53603..481f729 100644
--- a/Modules/Platform/Apple-GNU-Fortran.cmake
+++ b/Modules/Platform/Apple-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Apple-GNU)
__apple_compiler_gnu(Fortran)
diff --git a/Modules/Platform/Apple-GNU.cmake b/Modules/Platform/Apple-GNU.cmake
index bc4147e..69ccb40 100644
--- a/Modules/Platform/Apple-GNU.cmake
+++ b/Modules/Platform/Apple-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Apple-Intel-Fortran.cmake b/Modules/Platform/Apple-Intel-Fortran.cmake
index e54e237..6f41d08 100644
--- a/Modules/Platform/Apple-Intel-Fortran.cmake
+++ b/Modules/Platform/Apple-Intel-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Apple-Intel)
__apple_compiler_intel(Fortran)
diff --git a/Modules/Platform/Apple-Intel.cmake b/Modules/Platform/Apple-Intel.cmake
index a854be9..3bab6a5 100644
--- a/Modules/Platform/Apple-Intel.cmake
+++ b/Modules/Platform/Apple-Intel.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Apple-IntelLLVM-Fortran.cmake b/Modules/Platform/Apple-IntelLLVM-Fortran.cmake
index d0486ed..4852c02 100644
--- a/Modules/Platform/Apple-IntelLLVM-Fortran.cmake
+++ b/Modules/Platform/Apple-IntelLLVM-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Apple-IntelLLVM)
__apple_compiler_intel_llvm(Fortran)
diff --git a/Modules/Platform/Apple-IntelLLVM.cmake b/Modules/Platform/Apple-IntelLLVM.cmake
index 2f9f0ca..2d0ce71 100644
--- a/Modules/Platform/Apple-IntelLLVM.cmake
+++ b/Modules/Platform/Apple-IntelLLVM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Apple-NAG-Fortran.cmake b/Modules/Platform/Apple-NAG-Fortran.cmake
index 828d7ab..41dd55b 100644
--- a/Modules/Platform/Apple-NAG-Fortran.cmake
+++ b/Modules/Platform/Apple-NAG-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
diff --git a/Modules/Platform/Apple-PGI.cmake b/Modules/Platform/Apple-PGI.cmake
index 8d343b7..5a5718d 100644
--- a/Modules/Platform/Apple-PGI.cmake
+++ b/Modules/Platform/Apple-PGI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
diff --git a/Modules/Platform/BSDOS.cmake b/Modules/Platform/BSDOS.cmake
index 47852f8..54a156b 100644
--- a/Modules/Platform/BSDOS.cmake
+++ b/Modules/Platform/BSDOS.cmake
@@ -1,2 +1 @@
include(Platform/UnixPaths)
-
diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake
index 3c06215..86078d7 100644
--- a/Modules/Platform/BlueGeneP-base.cmake
+++ b/Modules/Platform/BlueGeneP-base.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#
diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake
index 3491870..fd3e84a 100644
--- a/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_dynamic_flags(GNU C)
diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake
index d3c946b..caadba9 100644
--- a/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_dynamic_flags(GNU CXX)
diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake
index 9db75be..48f5d7a 100644
--- a/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_dynamic_flags(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
index 918ee70..832a60b 100644
--- a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_dynamic_flags(XL C)
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
index cfefb0b..f5723e1 100644
--- a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_dynamic_flags(XL CXX)
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake
index 9c295bd..6b0e0ab 100644
--- a/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_dynamic_flags(XL Fortran)
diff --git a/Modules/Platform/BlueGeneP-dynamic.cmake b/Modules/Platform/BlueGeneP-dynamic.cmake
index daebab3..e0bf247 100644
--- a/Modules/Platform/BlueGeneP-dynamic.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/BlueGeneP-base)
diff --git a/Modules/Platform/BlueGeneP-static-GNU-C.cmake b/Modules/Platform/BlueGeneP-static-GNU-C.cmake
index 7c60794..f0e239c 100644
--- a/Modules/Platform/BlueGeneP-static-GNU-C.cmake
+++ b/Modules/Platform/BlueGeneP-static-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_static_flags(GNU C)
diff --git a/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake
index edceaad..bd40d58 100644
--- a/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake
+++ b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_static_flags(GNU CXX)
diff --git a/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake
index 6b2265a..ad3d6cc 100644
--- a/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake
+++ b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_static_flags(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake
index 7d4fc13..4ebfb2b 100644
--- a/Modules/Platform/BlueGeneP-static-XL-C.cmake
+++ b/Modules/Platform/BlueGeneP-static-XL-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_static_flags(XL C)
diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
index 1df276e..1e48ce8 100644
--- a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_static_flags(XL CXX)
diff --git a/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake
index 2bdb6d9..3dc136b 100644
--- a/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake
+++ b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneP_set_static_flags(XL Fortran)
diff --git a/Modules/Platform/BlueGeneP-static.cmake b/Modules/Platform/BlueGeneP-static.cmake
index 3675ed2..9ee5888 100644
--- a/Modules/Platform/BlueGeneP-static.cmake
+++ b/Modules/Platform/BlueGeneP-static.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/BlueGeneP-base)
diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake
index ea4b789..555da9d 100644
--- a/Modules/Platform/BlueGeneQ-base.cmake
+++ b/Modules/Platform/BlueGeneQ-base.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#
diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake
index 6758304..f4948e3 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_dynamic(GNU C)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake
index 5d40f9f..a6f19f5 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_dynamic(GNU CXX)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake
index 6105999..4d8a382 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_dynamic(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
index c51dacb..679cdd7 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_dynamic(XL C)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
index 5dbc836..79b9730 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_dynamic(XL CXX)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake
index a6ac03b..503ff7e 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_dynamic(XL Fortran)
diff --git a/Modules/Platform/BlueGeneQ-dynamic.cmake b/Modules/Platform/BlueGeneQ-dynamic.cmake
index 9440a3e..a5b5be7 100644
--- a/Modules/Platform/BlueGeneQ-dynamic.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/BlueGeneQ-base)
diff --git a/Modules/Platform/BlueGeneQ-static-GNU-C.cmake b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake
index 5fdc25c..08531a7 100644
--- a/Modules/Platform/BlueGeneQ-static-GNU-C.cmake
+++ b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_static(GNU C)
diff --git a/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake
index ad7c092..2aa5b33 100644
--- a/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake
+++ b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_static(GNU CXX)
diff --git a/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake
index f32d1d4..ab382ec 100644
--- a/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake
+++ b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_static(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake
index 67cd57d..704bd9a 100644
--- a/Modules/Platform/BlueGeneQ-static-XL-C.cmake
+++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_static(XL C)
diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
index a171e7f..f1325ef 100644
--- a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_static(XL CXX)
diff --git a/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake
index c7fbb44..8e5fb70 100644
--- a/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake
+++ b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
__BlueGeneQ_setup_static(XL Fortran)
diff --git a/Modules/Platform/BlueGeneQ-static.cmake b/Modules/Platform/BlueGeneQ-static.cmake
index 79cd391..015a3c1 100644
--- a/Modules/Platform/BlueGeneQ-static.cmake
+++ b/Modules/Platform/BlueGeneQ-static.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/BlueGeneQ-base)
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index f372955..925f51b 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index 1b9cece..245170c 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -80,50 +80,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL visionOS)
set(_CMAKE_OSX_SYSROOT_DEFAULT "xros")
elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
set(_CMAKE_OSX_SYSROOT_DEFAULT "watchos")
-elseif("${CMAKE_GENERATOR}" MATCHES Xcode
- OR CMAKE_OSX_DEPLOYMENT_TARGET
- OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
- OR NOT EXISTS "/usr/include/sys/types.h")
- # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
- set(_CMAKE_OSX_SDKS_DIR "")
- if(OSX_DEVELOPER_ROOT)
- foreach(_d Platforms/MacOSX.platform/Developer/SDKs SDKs)
- file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${_d}/*)
- if(_CMAKE_OSX_SDKS)
- set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${_d})
- break()
- endif()
- endforeach()
- endif()
-
- if(_CMAKE_OSX_SDKS_DIR)
- # Find the latest SDK as recommended by Apple (Technical Q&A QA1806)
- set(_CMAKE_OSX_LATEST_SDK_VERSION "0.0")
- file(GLOB _CMAKE_OSX_SDKS RELATIVE "${_CMAKE_OSX_SDKS_DIR}" "${_CMAKE_OSX_SDKS_DIR}/MacOSX*.sdk")
- foreach(_SDK ${_CMAKE_OSX_SDKS})
- if(IS_DIRECTORY "${_CMAKE_OSX_SDKS_DIR}/${_SDK}"
- AND _SDK MATCHES "MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk"
- AND CMAKE_MATCH_1 VERSION_GREATER ${_CMAKE_OSX_LATEST_SDK_VERSION})
- set(_CMAKE_OSX_LATEST_SDK_VERSION "${CMAKE_MATCH_1}")
- endif()
- endforeach()
-
- if(NOT _CMAKE_OSX_LATEST_SDK_VERSION STREQUAL "0.0")
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_LATEST_SDK_VERSION}.sdk")
- else()
- message(WARNING "Could not find any valid SDKs in ${_CMAKE_OSX_SDKS_DIR}")
- endif()
-
- if(NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_OSX_DEPLOYMENT_TARGET
- AND (_CURRENT_OSX_VERSION VERSION_LESS _CMAKE_OSX_LATEST_SDK_VERSION
- OR _CMAKE_OSX_LATEST_SDK_VERSION STREQUAL "0.0"))
- set(CMAKE_OSX_DEPLOYMENT_TARGET ${_CURRENT_OSX_VERSION} CACHE STRING
- "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value." FORCE)
- endif()
- else()
- # Assume developer files are in root (such as Xcode 4.5 command-line tools).
- set(_CMAKE_OSX_SYSROOT_DEFAULT "")
- endif()
+else()
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "")
endif()
# Set cache variable - end user may change this during ccmake or cmake-gui configure.
@@ -244,7 +202,7 @@ function(_apple_resolve_multi_arch_sysroots)
return() # Only apply to multi-arch
endif()
- if(CMAKE_OSX_SYSROOT STREQUAL "macosx")
+ if(NOT CMAKE_OSX_SYSROOT OR CMAKE_OSX_SYSROOT STREQUAL "macosx")
# macOS doesn't have a simulator sdk / sysroot, so there is no need to handle per-sdk arches.
return()
endif()
@@ -256,7 +214,7 @@ function(_apple_resolve_multi_arch_sysroots)
return()
endif()
- string(REPLACE "os" "simulator" _simulator_sdk ${CMAKE_OSX_SYSROOT})
+ string(REPLACE "os" "simulator" _simulator_sdk "${CMAKE_OSX_SYSROOT}")
set(_sdks "${CMAKE_OSX_SYSROOT};${_simulator_sdk}")
foreach(sdk ${_sdks})
_apple_resolve_sdk_path(${sdk} _sdk_path)
@@ -302,25 +260,43 @@ endfunction()
_apple_resolve_multi_arch_sysroots()
-# Transform CMAKE_OSX_SYSROOT to absolute path
-set(_CMAKE_OSX_SYSROOT_PATH "")
-if(CMAKE_OSX_SYSROOT)
- if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
- # This is a path to the SDK. Make sure it exists.
- if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
- message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
- "because the directory does not exist.")
- set(CMAKE_OSX_SYSROOT "")
- endif()
- set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
+if(CMAKE_OSX_SYSROOT MATCHES "/")
+ # This is a path to a SDK. Make sure it exists.
+ if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
+ message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
+ "because the directory does not exist.")
+ set(CMAKE_OSX_SYSROOT "")
+ endif()
+ set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
+elseif(CMAKE_OSX_SYSROOT)
+ # This is the name of a SDK. Transform it to a path.
+ _apple_resolve_sdk_path("${CMAKE_OSX_SYSROOT}" _CMAKE_OSX_SYSROOT_PATH)
+ # Use the path for non-Xcode generators.
+ if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_PATH}" AND NOT CMAKE_GENERATOR MATCHES "Xcode")
+ set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
+ endif()
+endif()
+if(NOT CMAKE_OSX_SYSROOT)
+ # Without any explicit SDK we rely on the toolchain default,
+ # which we assume to be what wrappers like /usr/bin/cc use.
+ if(CMAKE_GENERATOR STREQUAL "Xcode")
+ set(_sdk_macosx --sdk macosx)
else()
- _apple_resolve_sdk_path(${CMAKE_OSX_SYSROOT} _sdk_path)
- if(IS_DIRECTORY "${_sdk_path}")
- set(_CMAKE_OSX_SYSROOT_PATH "${_sdk_path}")
- # For non-Xcode generators use the path.
- if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
- set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
- endif()
- endif()
+ set(_sdk_macosx)
endif()
+ execute_process(
+ COMMAND xcrun ${_sdk_macosx} --show-sdk-path
+ OUTPUT_VARIABLE _CMAKE_OSX_SYSROOT_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _result
+ )
+ unset(_sdk_macosx)
+
+ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES_EXCLUDE
+ # Without -isysroot, some compiler drivers implicitly pass -L/usr/local/lib
+ # to the linker. Since the macOS dynamic loader does not search it by
+ # default, it is not a fully-implemented implicit link directory.
+ /usr/local/lib
+ )
endif()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index f334c5f..97e972a 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -36,7 +36,7 @@ if(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST)
endif()
# More desirable, but does not work:
#include(CheckCXXCompilerFlag)
- #CHECK_CXX_COMPILER_FLAG("-Wl,-search_paths_first" HAVE_FLAG_SEARCH_PATHS_FIRST)
+ #check_cxx_compiler_flag("-Wl,-search_paths_first" HAVE_FLAG_SEARCH_PATHS_FIRST)
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
@@ -182,9 +182,9 @@ if(_CMAKE_OSX_SYSROOT_PATH)
# Xcode 5 OSX
${_CMAKE_OSX_SYSROOT_PATH}/../../../../../Library/Frameworks
)
- get_filename_component(_abolute_path "${_path}" ABSOLUTE)
- if(EXISTS "${_abolute_path}")
- list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}")
+ get_filename_component(_absolute_path "${_path}" ABSOLUTE)
+ if(EXISTS "${_absolute_path}")
+ list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_absolute_path}")
break()
endif()
endforeach()
@@ -205,7 +205,7 @@ list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
/Network/Library/Frameworks
/System/Library/Frameworks)
-# Warn about known system mis-configuration case.
+# Warn about known system misconfiguration case.
if(CMAKE_OSX_SYSROOT)
get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
if(NOT _IN_TC AND
@@ -248,10 +248,26 @@ unset(_apps_paths)
include(Platform/UnixPaths)
-if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
- list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
- /opt/homebrew # Brew on Apple Silicon
- )
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ execute_process(
+ COMMAND brew --prefix
+ OUTPUT_VARIABLE _cmake_homebrew_prefix
+ RESULT_VARIABLE _brew_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if (_brew_result EQUAL 0 AND IS_DIRECTORY "${_cmake_homebrew_prefix}")
+ list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${_cmake_homebrew_prefix}")
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+ list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
+ /opt/homebrew # Brew on Apple Silicon
+ )
+ else()
+ list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
+ /usr/local # Brew on Intel
+ )
+ endif()
+ unset(_cmake_homebrew_prefix)
+ unset(_brew_result)
endif()
if(_CMAKE_OSX_SYSROOT_PATH)
diff --git a/Modules/Platform/GHS-MULTI-Determine.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake
index 67464f7..9fb4b8a 100644
--- a/Modules/Platform/GHS-MULTI-Determine.cmake
+++ b/Modules/Platform/GHS-MULTI-Determine.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Setup variables used for Green Hills MULTI generator
# -- Allow users to override these values.
@@ -72,9 +72,9 @@ if(_ghs_os_dir AND NOT DEFINED GHS_OS_DIR)
if(EXISTS ${GHS_OS_ROOT})
# Get all directories in root directory
- FILE(GLOB GHS_CANDIDATE_OS_DIRS
+ file(GLOB GHS_CANDIDATE_OS_DIRS
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
- FILE(GLOB GHS_CANDIDATE_OS_FILES
+ file(GLOB GHS_CANDIDATE_OS_FILES
LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
if(GHS_CANDIDATE_OS_FILES)
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
diff --git a/Modules/Platform/GHS-MULTI.cmake b/Modules/Platform/GHS-MULTI.cmake
index 5b28f29..bcf32e6 100644
--- a/Modules/Platform/GHS-MULTI.cmake
+++ b/Modules/Platform/GHS-MULTI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/GNU-GNU-C.cmake b/Modules/Platform/GNU-GNU-C.cmake
new file mode 100644
index 0000000..2e433dc
--- /dev/null
+++ b/Modules/Platform/GNU-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/GNU-GNU)
+__gnu_compiler_gnu(C)
diff --git a/Modules/Platform/GNU-GNU-CXX.cmake b/Modules/Platform/GNU-GNU-CXX.cmake
new file mode 100644
index 0000000..1c213bd
--- /dev/null
+++ b/Modules/Platform/GNU-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/GNU-GNU)
+__gnu_compiler_gnu(CXX)
diff --git a/Modules/Platform/GNU-GNU-Fortran.cmake b/Modules/Platform/GNU-GNU-Fortran.cmake
new file mode 100644
index 0000000..b552b16
--- /dev/null
+++ b/Modules/Platform/GNU-GNU-Fortran.cmake
@@ -0,0 +1,3 @@
+include(Platform/GNU-GNU)
+__gnu_compiler_gnu(Fortran)
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
diff --git a/Modules/Platform/GNU-GNU.cmake b/Modules/Platform/GNU-GNU.cmake
new file mode 100644
index 0000000..6605de7
--- /dev/null
+++ b/Modules/Platform/GNU-GNU.cmake
@@ -0,0 +1,27 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file LICENSE.rst or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__GNU_COMPILER_GNU)
+ return()
+endif()
+set(__GNU_COMPILER_GNU 1)
+
+macro(__gnu_compiler_gnu lang)
+ # We pass this for historical reasons. Projects may have
+ # executables that use dlopen but do not set ENABLE_EXPORTS.
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+ set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
+ set(CMAKE_${lang}_USING_LINKER_GOLD "-fuse-ld=gold")
+ if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
+ set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
+ endif()
+endmacro()
diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake
index 188135b..6a25b00 100644
--- a/Modules/Platform/GNU.cmake
+++ b/Modules/Platform/GNU.cmake
@@ -4,10 +4,32 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+# Shared libraries with no builtin soname may not be linked safely by
+# specifying the file path.
+set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
+ set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+endforeach()
+
+
+# Features for LINK_GROUP generator expression
+## RESCAN: request the linker to rescan static libraries until there is
+## no pending undefined symbols
+set(CMAKE_LINK_GROUP_USING_RESCAN "LINKER:--start-group" "LINKER:--end-group")
+set(CMAKE_LINK_GROUP_USING_RESCAN_SUPPORTED TRUE)
+
+
# Debian policy requires that shared libraries be installed without
# executable permission. Fedora policy requires that shared libraries
# be installed with the executable permission. Since the native tools
diff --git a/Modules/Platform/Generic-ADSP-ASM.cmake b/Modules/Platform/Generic-ADSP-ASM.cmake
index e718bec..ed729f4 100644
--- a/Modules/Platform/Generic-ADSP-ASM.cmake
+++ b/Modules/Platform/Generic-ADSP-ASM.cmake
@@ -4,4 +4,3 @@ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
set(CMAKE_ASM_OUTPUT_EXTENSION ".doj" )
set(CMAKE_ASM_COMPILE_OBJECT
"<CMAKE_ASM_COMPILER> <INCLUDES> <FLAGS> -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <OBJECT> <SOURCE>")
-
diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake
index 699c4aa..30e1327 100644
--- a/Modules/Platform/HP-UX-GNU.cmake
+++ b/Modules/Platform/HP-UX-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake
index b301d17..11f5caa 100644
--- a/Modules/Platform/HP-UX-HP.cmake
+++ b/Modules/Platform/HP-UX-HP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
index 425a13f..7aa6aa4 100644
--- a/Modules/Platform/HP-UX.cmake
+++ b/Modules/Platform/HP-UX.cmake
@@ -44,4 +44,3 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-a,default")
endforeach()
endforeach()
-
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 7d9a737..3610389 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -58,7 +58,7 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/boot/system
)
-LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+list(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
/boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/system/develop/headers/os
/boot/system/develop/headers/os/app
@@ -91,31 +91,31 @@ LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
/boot/system/develop/headers/posix
/boot/system/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
)
-IF (CMAKE_HAIKU_SECONDARY_ARCH)
- LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+if(CMAKE_HAIKU_SECONDARY_ARCH)
+ list(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
/boot/system/develop/headers
)
-ENDIF (CMAKE_HAIKU_SECONDARY_ARCH)
+endif()
-LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES
+list(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES
${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}
)
-LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
+list(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES})
-LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES})
+list(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES})
-LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES
+list(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES
/boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
)
-LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}
)
-LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
+list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH
diff --git a/Modules/Platform/Linker/AIX-AIX-ASM.cmake b/Modules/Platform/Linker/AIX-AIX-ASM.cmake
index 714e6a8..701f2e7 100644
--- a/Modules/Platform/Linker/AIX-AIX-ASM.cmake
+++ b/Modules/Platform/Linker/AIX-AIX-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/AIX-AIX)
diff --git a/Modules/Platform/Linker/AIX-AIX-C.cmake b/Modules/Platform/Linker/AIX-AIX-C.cmake
index 4cd4b9c..5a8575e 100644
--- a/Modules/Platform/Linker/AIX-AIX-C.cmake
+++ b/Modules/Platform/Linker/AIX-AIX-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/AIX-AIX)
diff --git a/Modules/Platform/Linker/AIX-AIX-CXX.cmake b/Modules/Platform/Linker/AIX-AIX-CXX.cmake
index 4c6f917..de6e83a 100644
--- a/Modules/Platform/Linker/AIX-AIX-CXX.cmake
+++ b/Modules/Platform/Linker/AIX-AIX-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/AIX-AIX)
diff --git a/Modules/Platform/Linker/AIX-AIX-Fortran.cmake b/Modules/Platform/Linker/AIX-AIX-Fortran.cmake
index c7a43c5..a9c4880 100644
--- a/Modules/Platform/Linker/AIX-AIX-Fortran.cmake
+++ b/Modules/Platform/Linker/AIX-AIX-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/AIX-AIX)
diff --git a/Modules/Platform/Linker/AIX-AIX.cmake b/Modules/Platform/Linker/AIX-AIX.cmake
index 553168b..70765fe 100644
--- a/Modules/Platform/Linker/AIX-AIX.cmake
+++ b/Modules/Platform/Linker/AIX-AIX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/AIX-ASM.cmake b/Modules/Platform/Linker/AIX-ASM.cmake
index 6699054..14dee4e 100644
--- a/Modules/Platform/Linker/AIX-ASM.cmake
+++ b/Modules/Platform/Linker/AIX-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AIX is the default linker
include(Platform/Linker/AIX-AIX-ASM)
diff --git a/Modules/Platform/Linker/AIX-C.cmake b/Modules/Platform/Linker/AIX-C.cmake
index 5eae8d9..a5d9672 100644
--- a/Modules/Platform/Linker/AIX-C.cmake
+++ b/Modules/Platform/Linker/AIX-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AIX is the default linker
include(Platform/Linker/AIX-AIX-C)
diff --git a/Modules/Platform/Linker/AIX-CXX.cmake b/Modules/Platform/Linker/AIX-CXX.cmake
index bd77011..e3bd804 100644
--- a/Modules/Platform/Linker/AIX-CXX.cmake
+++ b/Modules/Platform/Linker/AIX-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AIX is the default linker
include(Platform/Linker/AIX-AIX-CXX)
diff --git a/Modules/Platform/Linker/AIX-Fortran.cmake b/Modules/Platform/Linker/AIX-Fortran.cmake
index 182af9b..d82c93a 100644
--- a/Modules/Platform/Linker/AIX-Fortran.cmake
+++ b/Modules/Platform/Linker/AIX-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AIX is the default linker
include(Platform/Linker/AIX-AIX-Fortran)
diff --git a/Modules/Platform/Linker/Android-ASM.cmake b/Modules/Platform/Linker/Android-ASM.cmake
index 8e44baf..8be11e2 100644
--- a/Modules/Platform/Linker/Android-ASM.cmake
+++ b/Modules/Platform/Linker/Android-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Android-GNU-ASM)
diff --git a/Modules/Platform/Linker/Android-C.cmake b/Modules/Platform/Linker/Android-C.cmake
index d3df948..e44de45 100644
--- a/Modules/Platform/Linker/Android-C.cmake
+++ b/Modules/Platform/Linker/Android-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Android-GNU-C)
diff --git a/Modules/Platform/Linker/Android-CXX.cmake b/Modules/Platform/Linker/Android-CXX.cmake
index aff308b..cb689be 100644
--- a/Modules/Platform/Linker/Android-CXX.cmake
+++ b/Modules/Platform/Linker/Android-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Android-GNU-CXX)
diff --git a/Modules/Platform/Linker/Android-GNU-ASM.cmake b/Modules/Platform/Linker/Android-GNU-ASM.cmake
index bfef8b9..1652b8b 100644
--- a/Modules/Platform/Linker/Android-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/Android-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-ASM)
diff --git a/Modules/Platform/Linker/Android-GNU-C.cmake b/Modules/Platform/Linker/Android-GNU-C.cmake
index 2d0efda..fb43ed8 100644
--- a/Modules/Platform/Linker/Android-GNU-C.cmake
+++ b/Modules/Platform/Linker/Android-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-C)
diff --git a/Modules/Platform/Linker/Android-GNU-CXX.cmake b/Modules/Platform/Linker/Android-GNU-CXX.cmake
index 33c46d5..fb8f90c 100644
--- a/Modules/Platform/Linker/Android-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/Android-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linker/Android-LLD-ASM.cmake b/Modules/Platform/Linker/Android-LLD-ASM.cmake
index 870e59e..2ad48f3 100644
--- a/Modules/Platform/Linker/Android-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/Android-LLD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD-ASM)
diff --git a/Modules/Platform/Linker/Android-LLD-C.cmake b/Modules/Platform/Linker/Android-LLD-C.cmake
index efeeb16..21b2183 100644
--- a/Modules/Platform/Linker/Android-LLD-C.cmake
+++ b/Modules/Platform/Linker/Android-LLD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD-C)
diff --git a/Modules/Platform/Linker/Android-LLD-CXX.cmake b/Modules/Platform/Linker/Android-LLD-CXX.cmake
index 46a516c..9a2c35e 100644
--- a/Modules/Platform/Linker/Android-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/Android-LLD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD-CXX)
diff --git a/Modules/Platform/Linker/Apple-ASM.cmake b/Modules/Platform/Linker/Apple-ASM.cmake
index 8dc7684..16c4887 100644
--- a/Modules/Platform/Linker/Apple-ASM.cmake
+++ b/Modules/Platform/Linker/Apple-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-ASM)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake b/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake
index 9cf9ff2..b852d46 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-C.cmake b/Modules/Platform/Linker/Apple-AppleClang-C.cmake
index 5333074..1e6ad65 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-C.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake b/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake
index 87fa306..0e492e6 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake b/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake
index d414824..c4d71ea 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake b/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake
index 5637f0f..3ddc05d 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake b/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake
index 4e39bdd..5151628 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake b/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake
index 2779197..d8aadb0 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang-Swift.cmake b/Modules/Platform/Linker/Apple-AppleClang-Swift.cmake
index 633cc90..7081ad4 100644
--- a/Modules/Platform/Linker/Apple-AppleClang-Swift.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang)
diff --git a/Modules/Platform/Linker/Apple-AppleClang.cmake b/Modules/Platform/Linker/Apple-AppleClang.cmake
index 643cbbd..882e1b1 100644
--- a/Modules/Platform/Linker/Apple-AppleClang.cmake
+++ b/Modules/Platform/Linker/Apple-AppleClang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/Apple-C.cmake b/Modules/Platform/Linker/Apple-C.cmake
index 02a1da9..6ac42c8 100644
--- a/Modules/Platform/Linker/Apple-C.cmake
+++ b/Modules/Platform/Linker/Apple-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-C)
diff --git a/Modules/Platform/Linker/Apple-CUDA.cmake b/Modules/Platform/Linker/Apple-CUDA.cmake
index 27b466d..154c056 100644
--- a/Modules/Platform/Linker/Apple-CUDA.cmake
+++ b/Modules/Platform/Linker/Apple-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-CUDA)
diff --git a/Modules/Platform/Linker/Apple-CXX.cmake b/Modules/Platform/Linker/Apple-CXX.cmake
index b2bc90b..6ba8bd1 100644
--- a/Modules/Platform/Linker/Apple-CXX.cmake
+++ b/Modules/Platform/Linker/Apple-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-CXX)
diff --git a/Modules/Platform/Linker/Apple-Fortran.cmake b/Modules/Platform/Linker/Apple-Fortran.cmake
index a39e7ae..580cbab 100644
--- a/Modules/Platform/Linker/Apple-Fortran.cmake
+++ b/Modules/Platform/Linker/Apple-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-Fortran)
diff --git a/Modules/Platform/Linker/Apple-LLD-C.cmake b/Modules/Platform/Linker/Apple-LLD-C.cmake
index 64d9591..4581948 100644
--- a/Modules/Platform/Linker/Apple-LLD-C.cmake
+++ b/Modules/Platform/Linker/Apple-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-C)
diff --git a/Modules/Platform/Linker/Apple-LLD-CXX.cmake b/Modules/Platform/Linker/Apple-LLD-CXX.cmake
index deaa558..5faf494 100644
--- a/Modules/Platform/Linker/Apple-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/Apple-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-CXX)
diff --git a/Modules/Platform/Linker/Apple-LLD-OBJC.cmake b/Modules/Platform/Linker/Apple-LLD-OBJC.cmake
index 1879034..9f87cdd 100644
--- a/Modules/Platform/Linker/Apple-LLD-OBJC.cmake
+++ b/Modules/Platform/Linker/Apple-LLD-OBJC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-OBJC)
diff --git a/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake b/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake
index 71844d9..0c1bf40 100644
--- a/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake
+++ b/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-OBJCXX)
diff --git a/Modules/Platform/Linker/Apple-MOLD-C.cmake b/Modules/Platform/Linker/Apple-MOLD-C.cmake
index 14347bb..09a4710 100644
--- a/Modules/Platform/Linker/Apple-MOLD-C.cmake
+++ b/Modules/Platform/Linker/Apple-MOLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-C)
diff --git a/Modules/Platform/Linker/Apple-MOLD-CXX.cmake b/Modules/Platform/Linker/Apple-MOLD-CXX.cmake
index 416b8b5..b8a8e08 100644
--- a/Modules/Platform/Linker/Apple-MOLD-CXX.cmake
+++ b/Modules/Platform/Linker/Apple-MOLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-CXX)
diff --git a/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake b/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake
index e18281b..6d40300 100644
--- a/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake
+++ b/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-OBJC)
diff --git a/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake b/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake
index 3a7d48d..1052a97 100644
--- a/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake
+++ b/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Apple-AppleClang-OBJCXX)
diff --git a/Modules/Platform/Linker/Apple-OBJC.cmake b/Modules/Platform/Linker/Apple-OBJC.cmake
index 316d253..4f68df1 100644
--- a/Modules/Platform/Linker/Apple-OBJC.cmake
+++ b/Modules/Platform/Linker/Apple-OBJC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-OBJC)
diff --git a/Modules/Platform/Linker/Apple-OBJCXX.cmake b/Modules/Platform/Linker/Apple-OBJCXX.cmake
index 23db50f..d84428a 100644
--- a/Modules/Platform/Linker/Apple-OBJCXX.cmake
+++ b/Modules/Platform/Linker/Apple-OBJCXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-OBJCXX)
diff --git a/Modules/Platform/Linker/Apple-Swift.cmake b/Modules/Platform/Linker/Apple-Swift.cmake
index f5404fa..5c5041a 100644
--- a/Modules/Platform/Linker/Apple-Swift.cmake
+++ b/Modules/Platform/Linker/Apple-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# AppleClang is the default linker
include(Platform/Linker/Apple-AppleClang-Swift)
diff --git a/Modules/Platform/Linker/BSD-Linker-Initialize.cmake b/Modules/Platform/Linker/BSD-Linker-Initialize.cmake
index 3de1dab..b28dc06 100644
--- a/Modules/Platform/Linker/BSD-Linker-Initialize.cmake
+++ b/Modules/Platform/Linker/BSD-Linker-Initialize.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT _CMAKE_SYSTEM_LINKER_TYPE)
block(SCOPE_FOR VARIABLES)
@@ -18,5 +15,3 @@ if(NOT _CMAKE_SYSTEM_LINKER_TYPE)
endif()
endblock()
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/CYGWIN-ASM.cmake b/Modules/Platform/Linker/CYGWIN-ASM.cmake
index ab95f4c..540842b 100644
--- a/Modules/Platform/Linker/CYGWIN-ASM.cmake
+++ b/Modules/Platform/Linker/CYGWIN-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/CYGWIN-GNU-ASM)
diff --git a/Modules/Platform/Linker/CYGWIN-C.cmake b/Modules/Platform/Linker/CYGWIN-C.cmake
index 703624d..5c9cd2f 100644
--- a/Modules/Platform/Linker/CYGWIN-C.cmake
+++ b/Modules/Platform/Linker/CYGWIN-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/CYGWIN-GNU-C)
diff --git a/Modules/Platform/Linker/CYGWIN-CXX.cmake b/Modules/Platform/Linker/CYGWIN-CXX.cmake
index 7837188..69049ef 100644
--- a/Modules/Platform/Linker/CYGWIN-CXX.cmake
+++ b/Modules/Platform/Linker/CYGWIN-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/CYGWIN-GNU-CXX)
diff --git a/Modules/Platform/Linker/CYGWIN-Fortran.cmake b/Modules/Platform/Linker/CYGWIN-Fortran.cmake
index 18ce085..aa7b634 100644
--- a/Modules/Platform/Linker/CYGWIN-Fortran.cmake
+++ b/Modules/Platform/Linker/CYGWIN-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/CYGWIN-GNU-Fortran)
diff --git a/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake b/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake
index e65d0a0..543fd7f 100644
--- a/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU)
diff --git a/Modules/Platform/Linker/CYGWIN-GNU-C.cmake b/Modules/Platform/Linker/CYGWIN-GNU-C.cmake
index dc0a678..59f4df0 100644
--- a/Modules/Platform/Linker/CYGWIN-GNU-C.cmake
+++ b/Modules/Platform/Linker/CYGWIN-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU)
diff --git a/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake b/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake
index a45b3cd..6b5b715 100644
--- a/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU)
diff --git a/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake b/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake
index 7eba12a..db2c042 100644
--- a/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU)
diff --git a/Modules/Platform/Linker/CYGWIN-GNU.cmake b/Modules/Platform/Linker/CYGWIN-GNU.cmake
index 0ac407f..7a7e6f8 100644
--- a/Modules/Platform/Linker/CYGWIN-GNU.cmake
+++ b/Modules/Platform/Linker/CYGWIN-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake b/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake
index 1c65875..672dd91 100644
--- a/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD)
diff --git a/Modules/Platform/Linker/CYGWIN-LLD-C.cmake b/Modules/Platform/Linker/CYGWIN-LLD-C.cmake
index a4f3063..4467b9e 100644
--- a/Modules/Platform/Linker/CYGWIN-LLD-C.cmake
+++ b/Modules/Platform/Linker/CYGWIN-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD)
diff --git a/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake b/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake
index 5bd5063..52c1e72 100644
--- a/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD)
diff --git a/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake b/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake
index 3034b18..552ec06 100644
--- a/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake
+++ b/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD)
diff --git a/Modules/Platform/Linker/CYGWIN-LLD.cmake b/Modules/Platform/Linker/CYGWIN-LLD.cmake
index 1b637e2..3d2b090 100644
--- a/Modules/Platform/Linker/CYGWIN-LLD.cmake
+++ b/Modules/Platform/Linker/CYGWIN-LLD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/DragonFly-ASM.cmake b/Modules/Platform/Linker/DragonFly-ASM.cmake
index b046488..fa886d1 100644
--- a/Modules/Platform/Linker/DragonFly-ASM.cmake
+++ b/Modules/Platform/Linker/DragonFly-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-ASM)
diff --git a/Modules/Platform/Linker/DragonFly-C.cmake b/Modules/Platform/Linker/DragonFly-C.cmake
index 6fedac2..5361770 100644
--- a/Modules/Platform/Linker/DragonFly-C.cmake
+++ b/Modules/Platform/Linker/DragonFly-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-C)
diff --git a/Modules/Platform/Linker/DragonFly-CXX.cmake b/Modules/Platform/Linker/DragonFly-CXX.cmake
index 8064bf4..5dd6124 100644
--- a/Modules/Platform/Linker/DragonFly-CXX.cmake
+++ b/Modules/Platform/Linker/DragonFly-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-CXX)
diff --git a/Modules/Platform/Linker/DragonFly-Fortran.cmake b/Modules/Platform/Linker/DragonFly-Fortran.cmake
index 64ea904..ddb2fe6 100644
--- a/Modules/Platform/Linker/DragonFly-Fortran.cmake
+++ b/Modules/Platform/Linker/DragonFly-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-Fortran)
diff --git a/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake b/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake
index e643a97..bef9efb 100644
--- a/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU-ASM)
diff --git a/Modules/Platform/Linker/DragonFly-GNU-C.cmake b/Modules/Platform/Linker/DragonFly-GNU-C.cmake
index 729e68d..c597602 100644
--- a/Modules/Platform/Linker/DragonFly-GNU-C.cmake
+++ b/Modules/Platform/Linker/DragonFly-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU-C)
diff --git a/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake b/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake
index d9907ae..b2ea453 100644
--- a/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU-CXX)
diff --git a/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake b/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake
index f696be9..ae9eba6 100644
--- a/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU-Fortran)
diff --git a/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake b/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake
index d4774cd..b6106de 100644
--- a/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD-ASM)
diff --git a/Modules/Platform/Linker/DragonFly-LLD-C.cmake b/Modules/Platform/Linker/DragonFly-LLD-C.cmake
index 5ec3b76..e10eaa5 100644
--- a/Modules/Platform/Linker/DragonFly-LLD-C.cmake
+++ b/Modules/Platform/Linker/DragonFly-LLD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD-C)
diff --git a/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake b/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake
index 11ab59e..fa4387f 100644
--- a/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD-CXX)
diff --git a/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake b/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake
index a2b5141..81542e3 100644
--- a/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake
+++ b/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD-Fortran)
diff --git a/Modules/Platform/Linker/FreeBSD-ASM.cmake b/Modules/Platform/Linker/FreeBSD-ASM.cmake
index d8c8c86..e113df8 100644
--- a/Modules/Platform/Linker/FreeBSD-ASM.cmake
+++ b/Modules/Platform/Linker/FreeBSD-ASM.cmake
@@ -1,15 +1,9 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/FreeBSD-GNU-ASM)
else()
include(Platform/Linker/FreeBSD-LLD-ASM)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/FreeBSD-C.cmake b/Modules/Platform/Linker/FreeBSD-C.cmake
index 09975ad..0a0377e 100644
--- a/Modules/Platform/Linker/FreeBSD-C.cmake
+++ b/Modules/Platform/Linker/FreeBSD-C.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/FreeBSD-GNU-C)
else()
include(Platform/Linker/FreeBSD-LLD-C)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/FreeBSD-CXX.cmake b/Modules/Platform/Linker/FreeBSD-CXX.cmake
index 9dcb17a..4ea1200 100644
--- a/Modules/Platform/Linker/FreeBSD-CXX.cmake
+++ b/Modules/Platform/Linker/FreeBSD-CXX.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/FreeBSD-GNU-CXX)
else()
include(Platform/Linker/FreeBSD-LLD-CXX)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/FreeBSD-Fortran.cmake b/Modules/Platform/Linker/FreeBSD-Fortran.cmake
index 793e0a6..987ff16 100644
--- a/Modules/Platform/Linker/FreeBSD-Fortran.cmake
+++ b/Modules/Platform/Linker/FreeBSD-Fortran.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/FreeBSD-GNU-Fortran)
else()
include(Platform/Linker/FreeBSD-LLD-Fortran)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake b/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake
index 5ff8ed8..08826f3 100644
--- a/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU)
diff --git a/Modules/Platform/Linker/FreeBSD-GNU-C.cmake b/Modules/Platform/Linker/FreeBSD-GNU-C.cmake
index 8b6f0fd..ee92f3e 100644
--- a/Modules/Platform/Linker/FreeBSD-GNU-C.cmake
+++ b/Modules/Platform/Linker/FreeBSD-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU)
diff --git a/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake b/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake
index ecc5533..86bb88f 100644
--- a/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU)
diff --git a/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake
index 0e20437..41743f8 100644
--- a/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-GNU)
diff --git a/Modules/Platform/Linker/FreeBSD-GNU.cmake b/Modules/Platform/Linker/FreeBSD-GNU.cmake
index 5b26c03..8912c36 100644
--- a/Modules/Platform/Linker/FreeBSD-GNU.cmake
+++ b/Modules/Platform/Linker/FreeBSD-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake b/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake
index 0b36298..8aa7078 100644
--- a/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD)
diff --git a/Modules/Platform/Linker/FreeBSD-LLD-C.cmake b/Modules/Platform/Linker/FreeBSD-LLD-C.cmake
index 0120dac..4fee39c 100644
--- a/Modules/Platform/Linker/FreeBSD-LLD-C.cmake
+++ b/Modules/Platform/Linker/FreeBSD-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD)
diff --git a/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake b/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake
index 0d8aea8..a477a3b 100644
--- a/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD)
diff --git a/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake b/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake
index fa0991d..dc3a0b8 100644
--- a/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake
+++ b/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/FreeBSD-LLD)
diff --git a/Modules/Platform/Linker/FreeBSD-LLD.cmake b/Modules/Platform/Linker/FreeBSD-LLD.cmake
index 19f4df5..72d5946 100644
--- a/Modules/Platform/Linker/FreeBSD-LLD.cmake
+++ b/Modules/Platform/Linker/FreeBSD-LLD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/GNU-ASM.cmake b/Modules/Platform/Linker/GNU-ASM.cmake
index e78201c..2e9b603 100644
--- a/Modules/Platform/Linker/GNU-ASM.cmake
+++ b/Modules/Platform/Linker/GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/GNU-GNU-ASM)
diff --git a/Modules/Platform/Linker/GNU-C.cmake b/Modules/Platform/Linker/GNU-C.cmake
index 7667940..bbf12bf 100644
--- a/Modules/Platform/Linker/GNU-C.cmake
+++ b/Modules/Platform/Linker/GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/GNU-GNU-C)
diff --git a/Modules/Platform/Linker/GNU-CXX.cmake b/Modules/Platform/Linker/GNU-CXX.cmake
index d653f34..7578d44 100644
--- a/Modules/Platform/Linker/GNU-CXX.cmake
+++ b/Modules/Platform/Linker/GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/GNU-GNU-CXX)
diff --git a/Modules/Platform/Linker/GNU-Fortran.cmake b/Modules/Platform/Linker/GNU-Fortran.cmake
index 99bcb76..5bf2a4d 100644
--- a/Modules/Platform/Linker/GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/GNU-GNU-Fortran)
diff --git a/Modules/Platform/Linker/GNU-GNU-ASM.cmake b/Modules/Platform/Linker/GNU-GNU-ASM.cmake
index 39316b9..724fee5 100644
--- a/Modules/Platform/Linker/GNU-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/GNU-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/GNU-GNU)
diff --git a/Modules/Platform/Linker/GNU-GNU-C.cmake b/Modules/Platform/Linker/GNU-GNU-C.cmake
index 12a9883..63481d5 100644
--- a/Modules/Platform/Linker/GNU-GNU-C.cmake
+++ b/Modules/Platform/Linker/GNU-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/GNU-GNU)
diff --git a/Modules/Platform/Linker/GNU-GNU-CXX.cmake b/Modules/Platform/Linker/GNU-GNU-CXX.cmake
index 776f604..ea7398b 100644
--- a/Modules/Platform/Linker/GNU-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/GNU-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/GNU-GNU)
diff --git a/Modules/Platform/Linker/GNU-GNU-Fortran.cmake b/Modules/Platform/Linker/GNU-GNU-Fortran.cmake
index 87b5c9b..2dfab73 100644
--- a/Modules/Platform/Linker/GNU-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/GNU-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/GNU-GNU)
diff --git a/Modules/Platform/Linker/GNU-GNU.cmake b/Modules/Platform/Linker/GNU-GNU.cmake
index 274b876..9038f03 100644
--- a/Modules/Platform/Linker/GNU-GNU.cmake
+++ b/Modules/Platform/Linker/GNU-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/GNU.cmake b/Modules/Platform/Linker/GNU.cmake
index 3d66329..979aa98 100644
--- a/Modules/Platform/Linker/GNU.cmake
+++ b/Modules/Platform/Linker/GNU.cmake
@@ -1,13 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
# WHOLE_ARCHIVE Feature for LINK_LIBRARY generator expression
## check linker capabilities
function(__cmake_set_whole_archive_feature __linker)
@@ -49,5 +46,3 @@ endfunction()
## Configure system linker
__cmake_set_whole_archive_feature("${CMAKE_LINKER}")
-
-endblock()
diff --git a/Modules/Platform/Linker/Haiku-ASM.cmake b/Modules/Platform/Linker/Haiku-ASM.cmake
index 9e8a2b3..a63409b 100644
--- a/Modules/Platform/Linker/Haiku-ASM.cmake
+++ b/Modules/Platform/Linker/Haiku-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Haiku-GNU-ASM)
diff --git a/Modules/Platform/Linker/Haiku-C.cmake b/Modules/Platform/Linker/Haiku-C.cmake
index 4abf4a7..6f74474 100644
--- a/Modules/Platform/Linker/Haiku-C.cmake
+++ b/Modules/Platform/Linker/Haiku-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Haiku-GNU-C)
diff --git a/Modules/Platform/Linker/Haiku-CXX.cmake b/Modules/Platform/Linker/Haiku-CXX.cmake
index 96fd0f8..2c5c8b6 100644
--- a/Modules/Platform/Linker/Haiku-CXX.cmake
+++ b/Modules/Platform/Linker/Haiku-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Haiku-GNU-CXX)
diff --git a/Modules/Platform/Linker/Haiku-GNU-ASM.cmake b/Modules/Platform/Linker/Haiku-GNU-ASM.cmake
index bfef8b9..1652b8b 100644
--- a/Modules/Platform/Linker/Haiku-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/Haiku-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-ASM)
diff --git a/Modules/Platform/Linker/Haiku-GNU-C.cmake b/Modules/Platform/Linker/Haiku-GNU-C.cmake
index 2d0efda..fb43ed8 100644
--- a/Modules/Platform/Linker/Haiku-GNU-C.cmake
+++ b/Modules/Platform/Linker/Haiku-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-C)
diff --git a/Modules/Platform/Linker/Haiku-GNU-CXX.cmake b/Modules/Platform/Linker/Haiku-GNU-CXX.cmake
index 33c46d5..fb8f90c 100644
--- a/Modules/Platform/Linker/Haiku-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/Haiku-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linker/Haiku-LLD-ASM.cmake b/Modules/Platform/Linker/Haiku-LLD-ASM.cmake
index 870e59e..2ad48f3 100644
--- a/Modules/Platform/Linker/Haiku-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/Haiku-LLD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD-ASM)
diff --git a/Modules/Platform/Linker/Haiku-LLD-C.cmake b/Modules/Platform/Linker/Haiku-LLD-C.cmake
index efeeb16..21b2183 100644
--- a/Modules/Platform/Linker/Haiku-LLD-C.cmake
+++ b/Modules/Platform/Linker/Haiku-LLD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD-C)
diff --git a/Modules/Platform/Linker/Haiku-LLD-CXX.cmake b/Modules/Platform/Linker/Haiku-LLD-CXX.cmake
index 46a516c..9a2c35e 100644
--- a/Modules/Platform/Linker/Haiku-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/Haiku-LLD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD-CXX)
diff --git a/Modules/Platform/Linker/Linux-ASM.cmake b/Modules/Platform/Linker/Linux-ASM.cmake
index 67e8e79..f815ce3 100644
--- a/Modules/Platform/Linker/Linux-ASM.cmake
+++ b/Modules/Platform/Linker/Linux-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-ASM)
diff --git a/Modules/Platform/Linker/Linux-C.cmake b/Modules/Platform/Linker/Linux-C.cmake
index f40c631..fe2d3ce 100644
--- a/Modules/Platform/Linker/Linux-C.cmake
+++ b/Modules/Platform/Linker/Linux-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-C)
diff --git a/Modules/Platform/Linker/Linux-CUDA.cmake b/Modules/Platform/Linker/Linux-CUDA.cmake
index 191c347..04da668 100644
--- a/Modules/Platform/Linker/Linux-CUDA.cmake
+++ b/Modules/Platform/Linker/Linux-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-CUDA)
diff --git a/Modules/Platform/Linker/Linux-CXX.cmake b/Modules/Platform/Linker/Linux-CXX.cmake
index 638f3c7..9287e8b 100644
--- a/Modules/Platform/Linker/Linux-CXX.cmake
+++ b/Modules/Platform/Linker/Linux-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linker/Linux-Fortran.cmake b/Modules/Platform/Linker/Linux-Fortran.cmake
index 6bfcc69..c589290 100644
--- a/Modules/Platform/Linker/Linux-Fortran.cmake
+++ b/Modules/Platform/Linker/Linux-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-Fortran)
diff --git a/Modules/Platform/Linker/Linux-GNU-ASM.cmake b/Modules/Platform/Linker/Linux-GNU-ASM.cmake
index 5812c08..581d82a 100644
--- a/Modules/Platform/Linker/Linux-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU-C.cmake b/Modules/Platform/Linker/Linux-GNU-C.cmake
index 5bb3224..e175930 100644
--- a/Modules/Platform/Linker/Linux-GNU-C.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU-CUDA.cmake b/Modules/Platform/Linker/Linux-GNU-CUDA.cmake
index 5a3faa4..d1de040 100644
--- a/Modules/Platform/Linker/Linux-GNU-CUDA.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU-CXX.cmake b/Modules/Platform/Linker/Linux-GNU-CXX.cmake
index 8b0afa7..59d91db 100644
--- a/Modules/Platform/Linker/Linux-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU-Fortran.cmake b/Modules/Platform/Linker/Linux-GNU-Fortran.cmake
index b7f8a16..6de8c44 100644
--- a/Modules/Platform/Linker/Linux-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU-HIP.cmake b/Modules/Platform/Linker/Linux-GNU-HIP.cmake
index 6fb9a06..560d042 100644
--- a/Modules/Platform/Linker/Linux-GNU-HIP.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU-Swift.cmake b/Modules/Platform/Linker/Linux-GNU-Swift.cmake
index 06929ef..aa579ba 100644
--- a/Modules/Platform/Linker/Linux-GNU-Swift.cmake
+++ b/Modules/Platform/Linker/Linux-GNU-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU)
diff --git a/Modules/Platform/Linker/Linux-GNU.cmake b/Modules/Platform/Linker/Linux-GNU.cmake
index 0cffafb..67099b9 100644
--- a/Modules/Platform/Linker/Linux-GNU.cmake
+++ b/Modules/Platform/Linker/Linux-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake b/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake
index 54b4554..bf80396 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-ASM)
diff --git a/Modules/Platform/Linker/Linux-GNUgold-C.cmake b/Modules/Platform/Linker/Linux-GNUgold-C.cmake
index 929ac88..24b769a 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-C.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-C)
diff --git a/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake b/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake
index 0dc4ba2..8340f7a 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-CUDA)
diff --git a/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake b/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake
index f390248..13a6287 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake b/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake
index 531d524..09074a0 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-Fortran)
diff --git a/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake b/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake
index 0b77210..9120aaf 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-HIP)
diff --git a/Modules/Platform/Linker/Linux-GNUgold-Swift.cmake b/Modules/Platform/Linker/Linux-GNUgold-Swift.cmake
index b9b6d15..d3a7a32 100644
--- a/Modules/Platform/Linker/Linux-GNUgold-Swift.cmake
+++ b/Modules/Platform/Linker/Linux-GNUgold-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-GNU-Swift)
diff --git a/Modules/Platform/Linker/Linux-HIP.cmake b/Modules/Platform/Linker/Linux-HIP.cmake
index 4c94abc..228a0e9 100644
--- a/Modules/Platform/Linker/Linux-HIP.cmake
+++ b/Modules/Platform/Linker/Linux-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-HIP)
diff --git a/Modules/Platform/Linker/Linux-LLD-ASM.cmake b/Modules/Platform/Linker/Linux-LLD-ASM.cmake
index 7196133..c171e11 100644
--- a/Modules/Platform/Linker/Linux-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD-C.cmake b/Modules/Platform/Linker/Linux-LLD-C.cmake
index f8a409e..a3fd6a3 100644
--- a/Modules/Platform/Linker/Linux-LLD-C.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD-CUDA.cmake b/Modules/Platform/Linker/Linux-LLD-CUDA.cmake
index 161c7bf..9d3afb8 100644
--- a/Modules/Platform/Linker/Linux-LLD-CUDA.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD-CXX.cmake b/Modules/Platform/Linker/Linux-LLD-CXX.cmake
index 8530a38..69c9ef9 100644
--- a/Modules/Platform/Linker/Linux-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD-Fortran.cmake b/Modules/Platform/Linker/Linux-LLD-Fortran.cmake
index 70cd3b4..c5a93c6 100644
--- a/Modules/Platform/Linker/Linux-LLD-Fortran.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD-HIP.cmake b/Modules/Platform/Linker/Linux-LLD-HIP.cmake
index ee08495..9b3c579 100644
--- a/Modules/Platform/Linker/Linux-LLD-HIP.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD-Swift.cmake b/Modules/Platform/Linker/Linux-LLD-Swift.cmake
index 3428034..e265aba 100644
--- a/Modules/Platform/Linker/Linux-LLD-Swift.cmake
+++ b/Modules/Platform/Linker/Linux-LLD-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-LLD)
diff --git a/Modules/Platform/Linker/Linux-LLD.cmake b/Modules/Platform/Linker/Linux-LLD.cmake
index 86eedd8..9d261e2 100644
--- a/Modules/Platform/Linker/Linux-LLD.cmake
+++ b/Modules/Platform/Linker/Linux-LLD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/Linux-MOLD-ASM.cmake b/Modules/Platform/Linker/Linux-MOLD-ASM.cmake
index 5cc7a71..4680f0b 100644
--- a/Modules/Platform/Linker/Linux-MOLD-ASM.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-MOLD)
diff --git a/Modules/Platform/Linker/Linux-MOLD-C.cmake b/Modules/Platform/Linker/Linux-MOLD-C.cmake
index a62c2c9..9b10e61 100644
--- a/Modules/Platform/Linker/Linux-MOLD-C.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-MOLD)
diff --git a/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake b/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake
index 5248036..2c0a767 100644
--- a/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-MOLD)
diff --git a/Modules/Platform/Linker/Linux-MOLD-CXX.cmake b/Modules/Platform/Linker/Linux-MOLD-CXX.cmake
index 4c43624..e0caa27 100644
--- a/Modules/Platform/Linker/Linux-MOLD-CXX.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-MOLD)
diff --git a/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake b/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake
index e26bd5d..101e7a4 100644
--- a/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-MOLD)
diff --git a/Modules/Platform/Linker/Linux-MOLD-HIP.cmake b/Modules/Platform/Linker/Linux-MOLD-HIP.cmake
index 5dd6c16..bc162f9 100644
--- a/Modules/Platform/Linker/Linux-MOLD-HIP.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Linux-MOLD)
diff --git a/Modules/Platform/Linker/Linux-MOLD.cmake b/Modules/Platform/Linker/Linux-MOLD.cmake
index 2a3d9dc..4b92ff0 100644
--- a/Modules/Platform/Linker/Linux-MOLD.cmake
+++ b/Modules/Platform/Linker/Linux-MOLD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/Linux-Swift.cmake b/Modules/Platform/Linker/Linux-Swift.cmake
index 638f3c7..9287e8b 100644
--- a/Modules/Platform/Linker/Linux-Swift.cmake
+++ b/Modules/Platform/Linker/Linux-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linker/MSYS-ASM.cmake b/Modules/Platform/Linker/MSYS-ASM.cmake
index 9f72f5f..06558c7 100644
--- a/Modules/Platform/Linker/MSYS-ASM.cmake
+++ b/Modules/Platform/Linker/MSYS-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-ASM)
diff --git a/Modules/Platform/Linker/MSYS-C.cmake b/Modules/Platform/Linker/MSYS-C.cmake
index 5ea9f31..b6f7b59 100644
--- a/Modules/Platform/Linker/MSYS-C.cmake
+++ b/Modules/Platform/Linker/MSYS-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-C)
diff --git a/Modules/Platform/Linker/MSYS-CXX.cmake b/Modules/Platform/Linker/MSYS-CXX.cmake
index a64b538..0e10dcf 100644
--- a/Modules/Platform/Linker/MSYS-CXX.cmake
+++ b/Modules/Platform/Linker/MSYS-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-CXX)
diff --git a/Modules/Platform/Linker/MSYS-Fortran.cmake b/Modules/Platform/Linker/MSYS-Fortran.cmake
index 390063d..c3104c1 100644
--- a/Modules/Platform/Linker/MSYS-Fortran.cmake
+++ b/Modules/Platform/Linker/MSYS-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-Fortran)
diff --git a/Modules/Platform/Linker/MSYS-GNU-ASM.cmake b/Modules/Platform/Linker/MSYS-GNU-ASM.cmake
index f85298e..6c2b535 100644
--- a/Modules/Platform/Linker/MSYS-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/MSYS-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU-ASM)
diff --git a/Modules/Platform/Linker/MSYS-GNU-C.cmake b/Modules/Platform/Linker/MSYS-GNU-C.cmake
index 4e6415f..903bedf 100644
--- a/Modules/Platform/Linker/MSYS-GNU-C.cmake
+++ b/Modules/Platform/Linker/MSYS-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU-C)
diff --git a/Modules/Platform/Linker/MSYS-GNU-CXX.cmake b/Modules/Platform/Linker/MSYS-GNU-CXX.cmake
index 2a48ddc..6a75547 100644
--- a/Modules/Platform/Linker/MSYS-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/MSYS-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU-CXX)
diff --git a/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake b/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake
index 5055d22..f2926ef 100644
--- a/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-GNU-Fortran)
diff --git a/Modules/Platform/Linker/MSYS-LLD-ASM.cmake b/Modules/Platform/Linker/MSYS-LLD-ASM.cmake
index 907d084..3a447a5 100644
--- a/Modules/Platform/Linker/MSYS-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/MSYS-LLD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD-ASM)
diff --git a/Modules/Platform/Linker/MSYS-LLD-C.cmake b/Modules/Platform/Linker/MSYS-LLD-C.cmake
index bef158d..002ed05 100644
--- a/Modules/Platform/Linker/MSYS-LLD-C.cmake
+++ b/Modules/Platform/Linker/MSYS-LLD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD-C)
diff --git a/Modules/Platform/Linker/MSYS-LLD-CXX.cmake b/Modules/Platform/Linker/MSYS-LLD-CXX.cmake
index 59d9abc..5d6a995 100644
--- a/Modules/Platform/Linker/MSYS-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/MSYS-LLD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD-CXX)
diff --git a/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake b/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake
index f705b91..f03e7e6 100644
--- a/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake
+++ b/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/CYGWIN-LLD-Fortran)
diff --git a/Modules/Platform/Linker/MirBSD-ASM.cmake b/Modules/Platform/Linker/MirBSD-ASM.cmake
index d2c419e..9389eb2 100644
--- a/Modules/Platform/Linker/MirBSD-ASM.cmake
+++ b/Modules/Platform/Linker/MirBSD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-ASM)
diff --git a/Modules/Platform/Linker/MirBSD-C.cmake b/Modules/Platform/Linker/MirBSD-C.cmake
index c59f251..c64b344 100644
--- a/Modules/Platform/Linker/MirBSD-C.cmake
+++ b/Modules/Platform/Linker/MirBSD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-C)
diff --git a/Modules/Platform/Linker/MirBSD-CXX.cmake b/Modules/Platform/Linker/MirBSD-CXX.cmake
index 9a76d37..d13f2f7 100644
--- a/Modules/Platform/Linker/MirBSD-CXX.cmake
+++ b/Modules/Platform/Linker/MirBSD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-CXX)
diff --git a/Modules/Platform/Linker/MirBSD-Fortran.cmake b/Modules/Platform/Linker/MirBSD-Fortran.cmake
index 9ab9886..fdb246d 100644
--- a/Modules/Platform/Linker/MirBSD-Fortran.cmake
+++ b/Modules/Platform/Linker/MirBSD-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-Fortran)
diff --git a/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake b/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake
index f552a94..1a7788b 100644
--- a/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU-ASM)
diff --git a/Modules/Platform/Linker/MirBSD-GNU-C.cmake b/Modules/Platform/Linker/MirBSD-GNU-C.cmake
index ad337d0..7433430 100644
--- a/Modules/Platform/Linker/MirBSD-GNU-C.cmake
+++ b/Modules/Platform/Linker/MirBSD-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU-C)
diff --git a/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake b/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake
index 1edb8e8..53174b7 100644
--- a/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU-CXX)
diff --git a/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake
index 70890a7..3877d19 100644
--- a/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU-Fortran)
diff --git a/Modules/Platform/Linker/NetBSD-ASM.cmake b/Modules/Platform/Linker/NetBSD-ASM.cmake
index 72a9119..bbfab18 100644
--- a/Modules/Platform/Linker/NetBSD-ASM.cmake
+++ b/Modules/Platform/Linker/NetBSD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/NetBSD-GNU-ASM)
diff --git a/Modules/Platform/Linker/NetBSD-C.cmake b/Modules/Platform/Linker/NetBSD-C.cmake
index 6e08344..024e5de 100644
--- a/Modules/Platform/Linker/NetBSD-C.cmake
+++ b/Modules/Platform/Linker/NetBSD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/NetBSD-GNU-C)
diff --git a/Modules/Platform/Linker/NetBSD-CXX.cmake b/Modules/Platform/Linker/NetBSD-CXX.cmake
index 23d6cac..c57c6e6 100644
--- a/Modules/Platform/Linker/NetBSD-CXX.cmake
+++ b/Modules/Platform/Linker/NetBSD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/NetBSD-GNU-CXX)
diff --git a/Modules/Platform/Linker/NetBSD-Fortran.cmake b/Modules/Platform/Linker/NetBSD-Fortran.cmake
index 6684127..9deb359 100644
--- a/Modules/Platform/Linker/NetBSD-Fortran.cmake
+++ b/Modules/Platform/Linker/NetBSD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/NetBSD-GNU-Fortran)
diff --git a/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake b/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake
index 533589e..7dcb1ea 100644
--- a/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/NetBSD-GNU)
diff --git a/Modules/Platform/Linker/NetBSD-GNU-C.cmake b/Modules/Platform/Linker/NetBSD-GNU-C.cmake
index 2f00856..2882bef 100644
--- a/Modules/Platform/Linker/NetBSD-GNU-C.cmake
+++ b/Modules/Platform/Linker/NetBSD-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/NetBSD-GNU)
diff --git a/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake b/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake
index 6e5da90..1e21529 100644
--- a/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/NetBSD-GNU)
diff --git a/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake
index 83d7784..76773e7 100644
--- a/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/NetBSD-GNU)
diff --git a/Modules/Platform/Linker/NetBSD-GNU.cmake b/Modules/Platform/Linker/NetBSD-GNU.cmake
index 226afcd..9c26654 100644
--- a/Modules/Platform/Linker/NetBSD-GNU.cmake
+++ b/Modules/Platform/Linker/NetBSD-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/OpenBSD-ASM.cmake b/Modules/Platform/Linker/OpenBSD-ASM.cmake
index cd0b25e..4fca12d 100644
--- a/Modules/Platform/Linker/OpenBSD-ASM.cmake
+++ b/Modules/Platform/Linker/OpenBSD-ASM.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/OpenBSD-GNU-ASM)
else()
include(Platform/Linker/OpenBSD-LLD-ASM)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/OpenBSD-C.cmake b/Modules/Platform/Linker/OpenBSD-C.cmake
index 6685807..deb3bba 100644
--- a/Modules/Platform/Linker/OpenBSD-C.cmake
+++ b/Modules/Platform/Linker/OpenBSD-C.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/OpenBSD-GNU-C)
else()
include(Platform/Linker/OpenBSD-LLD-C)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/OpenBSD-CXX.cmake b/Modules/Platform/Linker/OpenBSD-CXX.cmake
index 4a3d6f8..481f8e3 100644
--- a/Modules/Platform/Linker/OpenBSD-CXX.cmake
+++ b/Modules/Platform/Linker/OpenBSD-CXX.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/OpenBSD-GNU-CXX)
else()
include(Platform/Linker/OpenBSD-LLD-CXX)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/OpenBSD-Fortran.cmake b/Modules/Platform/Linker/OpenBSD-Fortran.cmake
index 4ec2fe5..e3883cc 100644
--- a/Modules/Platform/Linker/OpenBSD-Fortran.cmake
+++ b/Modules/Platform/Linker/OpenBSD-Fortran.cmake
@@ -1,15 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/BSD-Linker-Initialize)
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU")
include(Platform/Linker/OpenBSD-GNU-Fortran)
else()
include(Platform/Linker/OpenBSD-LLD-Fortran)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake b/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake
index 6ad992d..f6181f4 100644
--- a/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU)
diff --git a/Modules/Platform/Linker/OpenBSD-GNU-C.cmake b/Modules/Platform/Linker/OpenBSD-GNU-C.cmake
index 64c8adf..3b23375 100644
--- a/Modules/Platform/Linker/OpenBSD-GNU-C.cmake
+++ b/Modules/Platform/Linker/OpenBSD-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU)
diff --git a/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake b/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake
index 98668e56..5c6e7e6 100644
--- a/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU)
diff --git a/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake
index 0f2b11f..41e31c4 100644
--- a/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-GNU)
diff --git a/Modules/Platform/Linker/OpenBSD-GNU.cmake b/Modules/Platform/Linker/OpenBSD-GNU.cmake
index c5821bb..64086e7 100644
--- a/Modules/Platform/Linker/OpenBSD-GNU.cmake
+++ b/Modules/Platform/Linker/OpenBSD-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake b/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake
index 008e79a..7402ebe 100644
--- a/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-LLD)
diff --git a/Modules/Platform/Linker/OpenBSD-LLD-C.cmake b/Modules/Platform/Linker/OpenBSD-LLD-C.cmake
index 20f8d12..e6aa698 100644
--- a/Modules/Platform/Linker/OpenBSD-LLD-C.cmake
+++ b/Modules/Platform/Linker/OpenBSD-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-LLD)
diff --git a/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake b/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake
index d0fd59f..be3ae42 100644
--- a/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-LLD)
diff --git a/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake b/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake
index 55efce3..e5a2dd7 100644
--- a/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake
+++ b/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/OpenBSD-LLD)
diff --git a/Modules/Platform/Linker/OpenBSD-LLD.cmake b/Modules/Platform/Linker/OpenBSD-LLD.cmake
index 05a1017..a942627 100644
--- a/Modules/Platform/Linker/OpenBSD-LLD.cmake
+++ b/Modules/Platform/Linker/OpenBSD-LLD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/SerenityOS-ASM.cmake b/Modules/Platform/Linker/SerenityOS-ASM.cmake
index 98fe46f..def96b4 100644
--- a/Modules/Platform/Linker/SerenityOS-ASM.cmake
+++ b/Modules/Platform/Linker/SerenityOS-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/SerenityOS-GNU-ASM)
diff --git a/Modules/Platform/Linker/SerenityOS-C.cmake b/Modules/Platform/Linker/SerenityOS-C.cmake
index d4aa953..0fcbb35 100644
--- a/Modules/Platform/Linker/SerenityOS-C.cmake
+++ b/Modules/Platform/Linker/SerenityOS-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/SerenityOS-GNU-C)
diff --git a/Modules/Platform/Linker/SerenityOS-CXX.cmake b/Modules/Platform/Linker/SerenityOS-CXX.cmake
index 34e9311..102dae4 100644
--- a/Modules/Platform/Linker/SerenityOS-CXX.cmake
+++ b/Modules/Platform/Linker/SerenityOS-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# GNU is the default linker
include(Platform/Linker/SerenityOS-GNU-CXX)
diff --git a/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake b/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake
index 3ea7242..55bcafc 100644
--- a/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SerenityOS-GNU)
diff --git a/Modules/Platform/Linker/SerenityOS-GNU-C.cmake b/Modules/Platform/Linker/SerenityOS-GNU-C.cmake
index c66d797..53304d7 100644
--- a/Modules/Platform/Linker/SerenityOS-GNU-C.cmake
+++ b/Modules/Platform/Linker/SerenityOS-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SerenityOS-GNU)
diff --git a/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake b/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake
index ff1f677..d71b992 100644
--- a/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SerenityOS-GNU)
diff --git a/Modules/Platform/Linker/SerenityOS-GNU.cmake b/Modules/Platform/Linker/SerenityOS-GNU.cmake
index 45f6505..0e7013c 100644
--- a/Modules/Platform/Linker/SerenityOS-GNU.cmake
+++ b/Modules/Platform/Linker/SerenityOS-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake b/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake
index 23be6bd..f292d76 100644
--- a/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SerenityOS-LLD)
diff --git a/Modules/Platform/Linker/SerenityOS-LLD-C.cmake b/Modules/Platform/Linker/SerenityOS-LLD-C.cmake
index 43b077c..cbad193 100644
--- a/Modules/Platform/Linker/SerenityOS-LLD-C.cmake
+++ b/Modules/Platform/Linker/SerenityOS-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SerenityOS-LLD)
diff --git a/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake b/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake
index 95851ca..5e18be1 100644
--- a/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SerenityOS-LLD)
diff --git a/Modules/Platform/Linker/SerenityOS-LLD.cmake b/Modules/Platform/Linker/SerenityOS-LLD.cmake
index f3c0389..4aa38ae 100644
--- a/Modules/Platform/Linker/SerenityOS-LLD.cmake
+++ b/Modules/Platform/Linker/SerenityOS-LLD.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/SunOS-ASM.cmake b/Modules/Platform/Linker/SunOS-ASM.cmake
index 0013e0b..a2aa9f2 100644
--- a/Modules/Platform/Linker/SunOS-ASM.cmake
+++ b/Modules/Platform/Linker/SunOS-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Solaris is the default linker
include(Platform/Linker/SunOS-Solaris-ASM)
diff --git a/Modules/Platform/Linker/SunOS-C.cmake b/Modules/Platform/Linker/SunOS-C.cmake
index fe90f6a..c4505ea 100644
--- a/Modules/Platform/Linker/SunOS-C.cmake
+++ b/Modules/Platform/Linker/SunOS-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Solaris is the default linker
include(Platform/Linker/SunOS-Solaris-C)
diff --git a/Modules/Platform/Linker/SunOS-CXX.cmake b/Modules/Platform/Linker/SunOS-CXX.cmake
index 0111500..9fc062f 100644
--- a/Modules/Platform/Linker/SunOS-CXX.cmake
+++ b/Modules/Platform/Linker/SunOS-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Solaris is the default linker
include(Platform/Linker/SunOS-Solaris-CXX)
diff --git a/Modules/Platform/Linker/SunOS-Fortran.cmake b/Modules/Platform/Linker/SunOS-Fortran.cmake
index 6252846..cbb0cf7 100644
--- a/Modules/Platform/Linker/SunOS-Fortran.cmake
+++ b/Modules/Platform/Linker/SunOS-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Solaris is the default linker
include(Platform/Linker/SunOS-Solaris-Fortran)
diff --git a/Modules/Platform/Linker/SunOS-GNU-ASM.cmake b/Modules/Platform/Linker/SunOS-GNU-ASM.cmake
index d69b617..1b3e5fe 100644
--- a/Modules/Platform/Linker/SunOS-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/SunOS-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-GNU)
diff --git a/Modules/Platform/Linker/SunOS-GNU-C.cmake b/Modules/Platform/Linker/SunOS-GNU-C.cmake
index 76554ce..ae48a9b 100644
--- a/Modules/Platform/Linker/SunOS-GNU-C.cmake
+++ b/Modules/Platform/Linker/SunOS-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-GNU)
diff --git a/Modules/Platform/Linker/SunOS-GNU-CXX.cmake b/Modules/Platform/Linker/SunOS-GNU-CXX.cmake
index 68b2d8c..0c8e982 100644
--- a/Modules/Platform/Linker/SunOS-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/SunOS-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-GNU)
diff --git a/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake b/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake
index 1a7565d..0ed73f3 100644
--- a/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-GNU)
diff --git a/Modules/Platform/Linker/SunOS-GNU.cmake b/Modules/Platform/Linker/SunOS-GNU.cmake
index ae9697d..0c3b230 100644
--- a/Modules/Platform/Linker/SunOS-GNU.cmake
+++ b/Modules/Platform/Linker/SunOS-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake b/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake
index 35ad149..79c0c2f 100644
--- a/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake
+++ b/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-Solaris)
diff --git a/Modules/Platform/Linker/SunOS-Solaris-C.cmake b/Modules/Platform/Linker/SunOS-Solaris-C.cmake
index 6251dcc..a50f50a 100644
--- a/Modules/Platform/Linker/SunOS-Solaris-C.cmake
+++ b/Modules/Platform/Linker/SunOS-Solaris-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-Solaris)
diff --git a/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake b/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake
index f6e2645..b7dc363 100644
--- a/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake
+++ b/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-Solaris)
diff --git a/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake b/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake
index f55b9f2..9b81034 100644
--- a/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake
+++ b/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/SunOS-Solaris)
diff --git a/Modules/Platform/Linker/SunOS-Solaris.cmake b/Modules/Platform/Linker/SunOS-Solaris.cmake
index 324108c..f2de596 100644
--- a/Modules/Platform/Linker/SunOS-Solaris.cmake
+++ b/Modules/Platform/Linker/SunOS-Solaris.cmake
@@ -1,13 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
macro(__sunos_linker_solaris lang)
set(CMAKE_${lang}_PLATFORM_LINKER_ID Solaris)
# Features for LINK_LIBRARY generator expression
@@ -24,5 +21,3 @@ macro(__sunos_linker_solaris lang)
set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
endmacro()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-ASM.cmake b/Modules/Platform/Linker/Windows-ASM.cmake
index bddaed1..472b7a2 100644
--- a/Modules/Platform/Linker/Windows-ASM.cmake
+++ b/Modules/Platform/Linker/Windows-ASM.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_ASM_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/Windows-GNU-ASM)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-C.cmake b/Modules/Platform/Linker/Windows-C.cmake
index 4a58407..26a0f0c 100644
--- a/Modules/Platform/Linker/Windows-C.cmake
+++ b/Modules/Platform/Linker/Windows-C.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/Windows-GNU-C)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-CUDA.cmake b/Modules/Platform/Linker/Windows-CUDA.cmake
index 7e89791..ed38100 100644
--- a/Modules/Platform/Linker/Windows-CUDA.cmake
+++ b/Modules/Platform/Linker/Windows-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/Windows-MSVC-CUDA)
diff --git a/Modules/Platform/Linker/Windows-CXX.cmake b/Modules/Platform/Linker/Windows-CXX.cmake
index 2976851..b425be5 100644
--- a/Modules/Platform/Linker/Windows-CXX.cmake
+++ b/Modules/Platform/Linker/Windows-CXX.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/Windows-GNU-CXX)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-Fortran.cmake b/Modules/Platform/Linker/Windows-Fortran.cmake
index 928f6d5..d145a90 100644
--- a/Modules/Platform/Linker/Windows-Fortran.cmake
+++ b/Modules/Platform/Linker/Windows-Fortran.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/Windows-GNU-Fortran)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-GNU-ASM.cmake b/Modules/Platform/Linker/Windows-GNU-ASM.cmake
index 7fac7b1..1087ccc 100644
--- a/Modules/Platform/Linker/Windows-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/Windows-GNU-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU)
diff --git a/Modules/Platform/Linker/Windows-GNU-C.cmake b/Modules/Platform/Linker/Windows-GNU-C.cmake
index 833a64d..21cff04 100644
--- a/Modules/Platform/Linker/Windows-GNU-C.cmake
+++ b/Modules/Platform/Linker/Windows-GNU-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU)
diff --git a/Modules/Platform/Linker/Windows-GNU-CXX.cmake b/Modules/Platform/Linker/Windows-GNU-CXX.cmake
index 6bc1af0..d15b5e7 100644
--- a/Modules/Platform/Linker/Windows-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/Windows-GNU-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU)
diff --git a/Modules/Platform/Linker/Windows-GNU-Fortran.cmake b/Modules/Platform/Linker/Windows-GNU-Fortran.cmake
index 4f0c35f..b3a4f23 100644
--- a/Modules/Platform/Linker/Windows-GNU-Fortran.cmake
+++ b/Modules/Platform/Linker/Windows-GNU-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU)
diff --git a/Modules/Platform/Linker/Windows-GNU-HIP.cmake b/Modules/Platform/Linker/Windows-GNU-HIP.cmake
index 4814888..283bd76 100644
--- a/Modules/Platform/Linker/Windows-GNU-HIP.cmake
+++ b/Modules/Platform/Linker/Windows-GNU-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU)
diff --git a/Modules/Platform/Linker/Windows-GNU.cmake b/Modules/Platform/Linker/Windows-GNU.cmake
index 144b03e..c5a968f 100644
--- a/Modules/Platform/Linker/Windows-GNU.cmake
+++ b/Modules/Platform/Linker/Windows-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linker/Windows-HIP.cmake b/Modules/Platform/Linker/Windows-HIP.cmake
index 67b37d1..e45055f 100644
--- a/Modules/Platform/Linker/Windows-HIP.cmake
+++ b/Modules/Platform/Linker/Windows-HIP.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_HIP_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/Windows-GNU-HIP)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-LLD-ASM.cmake b/Modules/Platform/Linker/Windows-LLD-ASM.cmake
index fbcc55d..6e735de 100644
--- a/Modules/Platform/Linker/Windows-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/Windows-LLD-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD)
diff --git a/Modules/Platform/Linker/Windows-LLD-C.cmake b/Modules/Platform/Linker/Windows-LLD-C.cmake
index 8efd87e..c16f384 100644
--- a/Modules/Platform/Linker/Windows-LLD-C.cmake
+++ b/Modules/Platform/Linker/Windows-LLD-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD)
diff --git a/Modules/Platform/Linker/Windows-LLD-CXX.cmake b/Modules/Platform/Linker/Windows-LLD-CXX.cmake
index 7bd3131..2449f28 100644
--- a/Modules/Platform/Linker/Windows-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/Windows-LLD-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD)
diff --git a/Modules/Platform/Linker/Windows-LLD-HIP.cmake b/Modules/Platform/Linker/Windows-LLD-HIP.cmake
index 4b04a79..384b5ea 100644
--- a/Modules/Platform/Linker/Windows-LLD-HIP.cmake
+++ b/Modules/Platform/Linker/Windows-LLD-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD)
diff --git a/Modules/Platform/Linker/Windows-LLD.cmake b/Modules/Platform/Linker/Windows-LLD.cmake
index 5054745..696b342 100644
--- a/Modules/Platform/Linker/Windows-LLD.cmake
+++ b/Modules/Platform/Linker/Windows-LLD.cmake
@@ -1,13 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
macro(__windows_linker_lld lang)
set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD)
# Features for LINK_LIBRARY generator expression
@@ -21,5 +18,3 @@ macro(__windows_linker_lld lang)
__windows_linker_msvc(${lang})
endif()
endmacro()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-MSVC-ASM.cmake b/Modules/Platform/Linker/Windows-MSVC-ASM.cmake
index df3a64b..ae15f52 100644
--- a/Modules/Platform/Linker/Windows-MSVC-ASM.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-ASM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC-C.cmake b/Modules/Platform/Linker/Windows-MSVC-C.cmake
index 467c0f3..28339cc 100644
--- a/Modules/Platform/Linker/Windows-MSVC-C.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake b/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake
index dc3d5e9..02938ef 100644
--- a/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC-CXX.cmake b/Modules/Platform/Linker/Windows-MSVC-CXX.cmake
index f5d3294..df1dbb5 100644
--- a/Modules/Platform/Linker/Windows-MSVC-CXX.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake b/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake
index b5f99f3..8c39540 100644
--- a/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC-HIP.cmake b/Modules/Platform/Linker/Windows-MSVC-HIP.cmake
index cc2a7da..0176db0 100644
--- a/Modules/Platform/Linker/Windows-MSVC-HIP.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-HIP.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC-Swift.cmake b/Modules/Platform/Linker/Windows-MSVC-Swift.cmake
index c29af13..03c31ee 100644
--- a/Modules/Platform/Linker/Windows-MSVC-Swift.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC)
diff --git a/Modules/Platform/Linker/Windows-MSVC.cmake b/Modules/Platform/Linker/Windows-MSVC.cmake
index 18c2102..d4e819c 100644
--- a/Modules/Platform/Linker/Windows-MSVC.cmake
+++ b/Modules/Platform/Linker/Windows-MSVC.cmake
@@ -1,13 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
-
# Features for LINK_LIBRARY generator expression
if(MSVC_VERSION GREATER "1900")
## WHOLE_ARCHIVE: Force loading all members of an archive
@@ -32,5 +29,3 @@ macro(__windows_linker_msvc lang)
endif()
endif()
endmacro()
-
-endblock()
diff --git a/Modules/Platform/Linker/Windows-Swift.cmake b/Modules/Platform/Linker/Windows-Swift.cmake
index 9478d04..10386c3 100644
--- a/Modules/Platform/Linker/Windows-Swift.cmake
+++ b/Modules/Platform/Linker/Windows-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/Windows-MSVC-Swift)
diff --git a/Modules/Platform/Linker/WindowsCE-C.cmake b/Modules/Platform/Linker/WindowsCE-C.cmake
index 2e30d91..35b75a8 100644
--- a/Modules/Platform/Linker/WindowsCE-C.cmake
+++ b/Modules/Platform/Linker/WindowsCE-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/WindowsCE-MSVC-C)
diff --git a/Modules/Platform/Linker/WindowsCE-CXX.cmake b/Modules/Platform/Linker/WindowsCE-CXX.cmake
index e61470c..2cf7008 100644
--- a/Modules/Platform/Linker/WindowsCE-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsCE-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/WindowsCE-MSVC-CXX)
diff --git a/Modules/Platform/Linker/WindowsCE-MSVC-C.cmake b/Modules/Platform/Linker/WindowsCE-MSVC-C.cmake
index 297a160..b1ab444 100644
--- a/Modules/Platform/Linker/WindowsCE-MSVC-C.cmake
+++ b/Modules/Platform/Linker/WindowsCE-MSVC-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-C)
diff --git a/Modules/Platform/Linker/WindowsCE-MSVC-CXX.cmake b/Modules/Platform/Linker/WindowsCE-MSVC-CXX.cmake
index 7accb62..08b9896 100644
--- a/Modules/Platform/Linker/WindowsCE-MSVC-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsCE-MSVC-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-CXX)
diff --git a/Modules/Platform/Linker/WindowsKernelModeDriver-C.cmake b/Modules/Platform/Linker/WindowsKernelModeDriver-C.cmake
index 7d6f303..c39f955 100644
--- a/Modules/Platform/Linker/WindowsKernelModeDriver-C.cmake
+++ b/Modules/Platform/Linker/WindowsKernelModeDriver-C.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/WindowsKernelModeDriver-MSVC-C)
diff --git a/Modules/Platform/Linker/WindowsKernelModeDriver-CXX.cmake b/Modules/Platform/Linker/WindowsKernelModeDriver-CXX.cmake
index ad69d95..3d173a2 100644
--- a/Modules/Platform/Linker/WindowsKernelModeDriver-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsKernelModeDriver-CXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/WindowsKernelModeDriver-MSVC-CXX)
diff --git a/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-C.cmake b/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-C.cmake
index 297a160..b1ab444 100644
--- a/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-C.cmake
+++ b/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-C)
diff --git a/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-CXX.cmake b/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-CXX.cmake
index 7accb62..08b9896 100644
--- a/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsKernelModeDriver-MSVC-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-CXX)
diff --git a/Modules/Platform/Linker/WindowsPhone-ASM.cmake b/Modules/Platform/Linker/WindowsPhone-ASM.cmake
index 39b77f5..89d040d 100644
--- a/Modules/Platform/Linker/WindowsPhone-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-ASM.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_ASM_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/WindowsPhone-GNU-ASM)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/WindowsPhone-C.cmake b/Modules/Platform/Linker/WindowsPhone-C.cmake
index 021310c..47630e4 100644
--- a/Modules/Platform/Linker/WindowsPhone-C.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-C.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/WindowsPhone-GNU-C)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/WindowsPhone-CXX.cmake b/Modules/Platform/Linker/WindowsPhone-CXX.cmake
index a42075f..18301ce 100644
--- a/Modules/Platform/Linker/WindowsPhone-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-CXX.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/WindowsPhone-GNU-CXX)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/WindowsPhone-GNU-ASM.cmake b/Modules/Platform/Linker/WindowsPhone-GNU-ASM.cmake
index ec93c6b..cb42902 100644
--- a/Modules/Platform/Linker/WindowsPhone-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU-ASM)
diff --git a/Modules/Platform/Linker/WindowsPhone-GNU-C.cmake b/Modules/Platform/Linker/WindowsPhone-GNU-C.cmake
index 7a023b8..f91bfca 100644
--- a/Modules/Platform/Linker/WindowsPhone-GNU-C.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU-C)
diff --git a/Modules/Platform/Linker/WindowsPhone-GNU-CXX.cmake b/Modules/Platform/Linker/WindowsPhone-GNU-CXX.cmake
index 2a71ff6..20369f5 100644
--- a/Modules/Platform/Linker/WindowsPhone-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU-CXX)
diff --git a/Modules/Platform/Linker/WindowsPhone-LLD-ASM.cmake b/Modules/Platform/Linker/WindowsPhone-LLD-ASM.cmake
index 71db4da..8e71706 100644
--- a/Modules/Platform/Linker/WindowsPhone-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-LLD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD-ASM)
diff --git a/Modules/Platform/Linker/WindowsPhone-LLD-C.cmake b/Modules/Platform/Linker/WindowsPhone-LLD-C.cmake
index 8b1415f..8843f37 100644
--- a/Modules/Platform/Linker/WindowsPhone-LLD-C.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-LLD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD-C)
diff --git a/Modules/Platform/Linker/WindowsPhone-LLD-CXX.cmake b/Modules/Platform/Linker/WindowsPhone-LLD-CXX.cmake
index fc6c9ea..9c397ce 100644
--- a/Modules/Platform/Linker/WindowsPhone-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-LLD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD-CXX)
diff --git a/Modules/Platform/Linker/WindowsPhone-MSVC-ASM.cmake b/Modules/Platform/Linker/WindowsPhone-MSVC-ASM.cmake
index a891d7c..159e4df 100644
--- a/Modules/Platform/Linker/WindowsPhone-MSVC-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-MSVC-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-ASM)
diff --git a/Modules/Platform/Linker/WindowsPhone-MSVC-C.cmake b/Modules/Platform/Linker/WindowsPhone-MSVC-C.cmake
index 297a160..b1ab444 100644
--- a/Modules/Platform/Linker/WindowsPhone-MSVC-C.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-MSVC-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-C)
diff --git a/Modules/Platform/Linker/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/Linker/WindowsPhone-MSVC-CXX.cmake
index 7accb62..08b9896 100644
--- a/Modules/Platform/Linker/WindowsPhone-MSVC-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-MSVC-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-CXX)
diff --git a/Modules/Platform/Linker/WindowsPhone-MSVC-Swift.cmake b/Modules/Platform/Linker/WindowsPhone-MSVC-Swift.cmake
index 44d5b2d..41e8667 100644
--- a/Modules/Platform/Linker/WindowsPhone-MSVC-Swift.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-MSVC-Swift.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-Swift)
diff --git a/Modules/Platform/Linker/WindowsPhone-Swift.cmake b/Modules/Platform/Linker/WindowsPhone-Swift.cmake
index 6d59769..b2489cd 100644
--- a/Modules/Platform/Linker/WindowsPhone-Swift.cmake
+++ b/Modules/Platform/Linker/WindowsPhone-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/WindowsPhone-MSVC-Swift)
diff --git a/Modules/Platform/Linker/WindowsStore-ASM.cmake b/Modules/Platform/Linker/WindowsStore-ASM.cmake
index 1d753f3..7e317f3 100644
--- a/Modules/Platform/Linker/WindowsStore-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsStore-ASM.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_ASM_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/WindowsStore-GNU-ASM)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/WindowsStore-C.cmake b/Modules/Platform/Linker/WindowsStore-C.cmake
index cfba4bc..46d3c03 100644
--- a/Modules/Platform/Linker/WindowsStore-C.cmake
+++ b/Modules/Platform/Linker/WindowsStore-C.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/WindowsStore-GNU-C)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/WindowsStore-CXX.cmake b/Modules/Platform/Linker/WindowsStore-CXX.cmake
index f2a4e29..810794d 100644
--- a/Modules/Platform/Linker/WindowsStore-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsStore-CXX.cmake
@@ -1,8 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-block(SCOPE_FOR POLICIES)
-cmake_policy(SET CMP0054 NEW)
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
# MSVC is the default linker
@@ -11,5 +8,3 @@ else()
# GNU is the default linker
include(Platform/Linker/WindowsStore-GNU-CXX)
endif()
-
-endblock()
diff --git a/Modules/Platform/Linker/WindowsStore-GNU-ASM.cmake b/Modules/Platform/Linker/WindowsStore-GNU-ASM.cmake
index ec93c6b..cb42902 100644
--- a/Modules/Platform/Linker/WindowsStore-GNU-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsStore-GNU-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU-ASM)
diff --git a/Modules/Platform/Linker/WindowsStore-GNU-C.cmake b/Modules/Platform/Linker/WindowsStore-GNU-C.cmake
index 7a023b8..f91bfca 100644
--- a/Modules/Platform/Linker/WindowsStore-GNU-C.cmake
+++ b/Modules/Platform/Linker/WindowsStore-GNU-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU-C)
diff --git a/Modules/Platform/Linker/WindowsStore-GNU-CXX.cmake b/Modules/Platform/Linker/WindowsStore-GNU-CXX.cmake
index 2a71ff6..20369f5 100644
--- a/Modules/Platform/Linker/WindowsStore-GNU-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsStore-GNU-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-GNU-CXX)
diff --git a/Modules/Platform/Linker/WindowsStore-LLD-ASM.cmake b/Modules/Platform/Linker/WindowsStore-LLD-ASM.cmake
index 71db4da..8e71706 100644
--- a/Modules/Platform/Linker/WindowsStore-LLD-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsStore-LLD-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD-ASM)
diff --git a/Modules/Platform/Linker/WindowsStore-LLD-C.cmake b/Modules/Platform/Linker/WindowsStore-LLD-C.cmake
index 8b1415f..8843f37 100644
--- a/Modules/Platform/Linker/WindowsStore-LLD-C.cmake
+++ b/Modules/Platform/Linker/WindowsStore-LLD-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD-C)
diff --git a/Modules/Platform/Linker/WindowsStore-LLD-CXX.cmake b/Modules/Platform/Linker/WindowsStore-LLD-CXX.cmake
index fc6c9ea..9c397ce 100644
--- a/Modules/Platform/Linker/WindowsStore-LLD-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsStore-LLD-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-LLD-CXX)
diff --git a/Modules/Platform/Linker/WindowsStore-MSVC-ASM.cmake b/Modules/Platform/Linker/WindowsStore-MSVC-ASM.cmake
index a891d7c..159e4df 100644
--- a/Modules/Platform/Linker/WindowsStore-MSVC-ASM.cmake
+++ b/Modules/Platform/Linker/WindowsStore-MSVC-ASM.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-ASM)
diff --git a/Modules/Platform/Linker/WindowsStore-MSVC-C.cmake b/Modules/Platform/Linker/WindowsStore-MSVC-C.cmake
index 297a160..b1ab444 100644
--- a/Modules/Platform/Linker/WindowsStore-MSVC-C.cmake
+++ b/Modules/Platform/Linker/WindowsStore-MSVC-C.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-C)
diff --git a/Modules/Platform/Linker/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/Linker/WindowsStore-MSVC-CXX.cmake
index 7accb62..08b9896 100644
--- a/Modules/Platform/Linker/WindowsStore-MSVC-CXX.cmake
+++ b/Modules/Platform/Linker/WindowsStore-MSVC-CXX.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-CXX)
diff --git a/Modules/Platform/Linker/WindowsStore-MSVC-Swift.cmake b/Modules/Platform/Linker/WindowsStore-MSVC-Swift.cmake
index 44d5b2d..41e8667 100644
--- a/Modules/Platform/Linker/WindowsStore-MSVC-Swift.cmake
+++ b/Modules/Platform/Linker/WindowsStore-MSVC-Swift.cmake
@@ -1,4 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(Platform/Linker/Windows-MSVC-Swift)
diff --git a/Modules/Platform/Linker/WindowsStore-Swift.cmake b/Modules/Platform/Linker/WindowsStore-Swift.cmake
index 9262564..6795a56 100644
--- a/Modules/Platform/Linker/WindowsStore-Swift.cmake
+++ b/Modules/Platform/Linker/WindowsStore-Swift.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# MSVC is the default linker
include(Platform/Linker/WindowsStore-MSVC-Swift)
diff --git a/Modules/Platform/Linux-Apple-Swift.cmake b/Modules/Platform/Linux-Apple-Swift.cmake
index 248d2de..a2b5c88 100644
--- a/Modules/Platform/Linux-Apple-Swift.cmake
+++ b/Modules/Platform/Linux-Apple-Swift.cmake
@@ -5,3 +5,5 @@ set(CMAKE_EXE_EXPORTS_Swift_FLAG "-Xclang-linker -Wl,--export-dynamic")
set(CMAKE_Swift_USING_LINKER_SYSTEM "")
set(CMAKE_Swift_USING_LINKER_GOLD "-use-ld=gold")
set(CMAKE_Swift_USING_LINKER_LLD "-use-ld=lld")
+
+set(CMAKE_Swift_LINK_MODE DRIVER)
diff --git a/Modules/Platform/Linux-Fujitsu.cmake b/Modules/Platform/Linux-Fujitsu.cmake
index be11b0a..e41bf54 100644
--- a/Modules/Platform/Linux-Fujitsu.cmake
+++ b/Modules/Platform/Linux-Fujitsu.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake
index 24bf1bb..66e3a7e 100644
--- a/Modules/Platform/Linux-GNU.cmake
+++ b/Modules/Platform/Linux-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake
index b2ea002..b502061 100644
--- a/Modules/Platform/Linux-Intel.cmake
+++ b/Modules/Platform/Linux-Intel.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-IntelLLVM.cmake b/Modules/Platform/Linux-IntelLLVM.cmake
index 992f80e..fd7064f 100644
--- a/Modules/Platform/Linux-IntelLLVM.cmake
+++ b/Modules/Platform/Linux-IntelLLVM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-LCC.cmake b/Modules/Platform/Linux-LCC.cmake
index a375461..6badc89 100644
--- a/Modules/Platform/Linux-LCC.cmake
+++ b/Modules/Platform/Linux-LCC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-NVHPC.cmake b/Modules/Platform/Linux-NVHPC.cmake
index 602b417..f6a0f3d 100644
--- a/Modules/Platform/Linux-NVHPC.cmake
+++ b/Modules/Platform/Linux-NVHPC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-OpenWatcom.cmake b/Modules/Platform/Linux-OpenWatcom.cmake
index 731fd3c..840c918 100644
--- a/Modules/Platform/Linux-OpenWatcom.cmake
+++ b/Modules/Platform/Linux-OpenWatcom.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
index 0341654..c1a6155 100644
--- a/Modules/Platform/Linux-PGI.cmake
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake
index 6070606..19f69b0 100644
--- a/Modules/Platform/Linux-PathScale.cmake
+++ b/Modules/Platform/Linux-PathScale.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/MP-RAS.cmake b/Modules/Platform/MP-RAS.cmake
index fe8d81a..4cbfd8e 100644
--- a/Modules/Platform/MP-RAS.cmake
+++ b/Modules/Platform/MP-RAS.cmake
@@ -10,5 +10,3 @@ else()
endif()
include(Platform/UnixPaths)
-
-
diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake
index 47334d6..4c231bf 100644
--- a/Modules/Platform/SunOS-GNU.cmake
+++ b/Modules/Platform/SunOS-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/SunOS-PathScale.cmake b/Modules/Platform/SunOS-PathScale.cmake
index 25ead80..b479f66 100644
--- a/Modules/Platform/SunOS-PathScale.cmake
+++ b/Modules/Platform/SunOS-PathScale.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Tru64.cmake b/Modules/Platform/Tru64.cmake
index 47852f8..54a156b 100644
--- a/Modules/Platform/Tru64.cmake
+++ b/Modules/Platform/Tru64.cmake
@@ -1,2 +1 @@
include(Platform/UnixPaths)
-
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index 32bc7bd..e95da44 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Block multiple inclusion because "CMakeCInformation.cmake" includes
diff --git a/Modules/Platform/Windows-Apple-Swift.cmake b/Modules/Platform/Windows-Apple-Swift.cmake
index 87c81d6..3e34985 100644
--- a/Modules/Platform/Windows-Apple-Swift.cmake
+++ b/Modules/Platform/Windows-Apple-Swift.cmake
@@ -6,3 +6,5 @@ set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS "-Xlinker -debug")
set(CMAKE_Swift_USING_LINKER_SYSTEM "-use-ld=link")
set(CMAKE_Swift_USING_LINKER_LLD "-use-ld=lld")
set(CMAKE_Swift_USING_LINKER_MSVC "-use-ld=link")
+
+set(CMAKE_Swift_LINK_MODE DRIVER)
diff --git a/Modules/Platform/Windows-Clang-ASM.cmake b/Modules/Platform/Windows-Clang-ASM.cmake
index c22e3b0..87abade 100644
--- a/Modules/Platform/Windows-Clang-ASM.cmake
+++ b/Modules/Platform/Windows-Clang-ASM.cmake
@@ -1,6 +1,10 @@
include(Platform/Windows-Clang)
__windows_compiler_clang(ASM)
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "")
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 7a05492..c6dc423 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -38,6 +38,8 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
+
set(CMAKE_${lang}_LINKER_MANIFEST_FLAG " -Xlinker /MANIFESTINPUT:")
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror")
@@ -115,6 +117,13 @@ macro(__windows_compiler_clang_gnu lang)
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG${_RTL_FLAGS}")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -DNDEBUG${_DBG_FLAGS}${_RTL_FLAGS}")
+ # clang-cl accepts -RTC* flags but ignores them. Simulate this
+ # with the GNU-like drivers by simply passing no flags at all.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
+
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded -g -Xclang -gcodeview)
#set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase) # not supported by Clang
#set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue) # not supported by Clang
@@ -217,7 +226,9 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
unset(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue) # -ZI not supported by Clang
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-WX")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc")
- endmacro()
+
+ set(CMAKE_${lang}_LINK_MODE LINKER)
+endmacro()
else()
cmake_policy(GET CMP0091 __WINDOWS_CLANG_CMP0091)
if(__WINDOWS_CLANG_CMP0091 STREQUAL "NEW")
@@ -235,6 +246,14 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
endif()
unset(__WINDOWS_MSVC_CMP0141)
+ cmake_policy(GET CMP0184 __WINDOWS_MSVC_CMP0184)
+ if(__WINDOWS_MSVC_CMP0184 STREQUAL "NEW")
+ set(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT "$<$<CONFIG:Debug>:StackFrameErrorCheck;UninitializedVariable>")
+ else()
+ set(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT "")
+ endif()
+ unset(__WINDOWS_MSVC_CMP0184)
+
set(CMAKE_BUILD_TYPE_INIT Debug)
__enable_llvm_rc_preprocessing("" "-x c")
@@ -248,6 +267,8 @@ else()
__enable_llvm_rc_preprocessing("" "-x c")
macro(__windows_compiler_clang_base lang)
__windows_compiler_gnu(${lang})
+
+ set(CMAKE_${lang}_LINK_MODE DRIVER)
endmacro()
endif()
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 4ecc2c2..ad5bb1c 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 7dc92cd..ea7b77b 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -184,7 +184,7 @@ macro(__windows_compiler_gnu_abi lang)
if(_vs_dir)
list(APPEND _vs_installer_paths "${_vs_dir}/VC/Auxiliary/Build")
endif()
- endforeach(vs)
+ endforeach()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake
index c9b70d5..ad2e525 100644
--- a/Modules/Platform/Windows-Intel-Fortran.cmake
+++ b/Modules/Platform/Windows-Intel-Fortran.cmake
@@ -29,6 +29,12 @@ unset(_LIBSDLL)
unset(_DBGLIBS)
unset(_THREADS)
+# icl accepts -RTC* flags but ignores them. ifort accepts -RTCu only.
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable -RTCu)
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
+
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -threads -libs:static)
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -threads -libs:dll)
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -threads -libs:static -dbglibs)
diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake
index 26e0cde..12598a0 100644
--- a/Modules/Platform/Windows-Intel.cmake
+++ b/Modules/Platform/Windows-Intel.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Windows-IntelLLVM-Fortran.cmake b/Modules/Platform/Windows-IntelLLVM-Fortran.cmake
index 202ba23..c8566e0 100644
--- a/Modules/Platform/Windows-IntelLLVM-Fortran.cmake
+++ b/Modules/Platform/Windows-IntelLLVM-Fortran.cmake
@@ -29,6 +29,12 @@ unset(_LIBSDLL)
unset(_DBGLIBS)
unset(_THREADS)
+# icx accepts -RTC* flags but ignores them. ifx accepts -RTCu only.
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable -RTCu)
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
+
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -threads -libs:static)
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -threads -libs:dll)
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -threads -libs:static -dbglibs)
diff --git a/Modules/Platform/Windows-IntelLLVM.cmake b/Modules/Platform/Windows-IntelLLVM.cmake
index ba2cc9c..2b9d83b 100644
--- a/Modules/Platform/Windows-IntelLLVM.cmake
+++ b/Modules/Platform/Windows-IntelLLVM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -12,6 +12,8 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio")
# MSBuild invokes the "link" tool directly.
set(_IntelLLVM_LINKER_WRAPPER_FLAG "")
set(_IntelLLVM_LINKER_WRAPPER_FLAG_SEP "")
+
+ set(CMAKE_${lang}_LINK_MODE LINKER)
else()
# Our rules below drive linking through the compiler front-end.
# Wrap flags meant for the linker.
@@ -27,6 +29,10 @@ macro(__windows_compiler_intel lang)
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "${_IntelLLVM_LINKER_WRAPPER_FLAG}")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP "${_IntelLLVM_LINKER_WRAPPER_FLAG_SEP}")
+ # ARCHIVER: prefix use same values as LINKER: one.
+ set(CMAKE_${lang}_ARCHIVER_WRAPPER_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}")
+ set(CMAKE_${lang}_ARCHIVER_WRAPPER_FLAG_SEP "${CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP}")
+
set(CMAKE_${lang}_CREATE_WIN32_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:windows")
set(CMAKE_${lang}_CREATE_CONSOLE_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:console")
set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:")
diff --git a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
index 10e3b2c..c2ccec6 100644
--- a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
+++ b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
@@ -13,7 +13,7 @@ elseif("x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "-fms-runtime-lib=dll_dbg")
else()
# LLVMFlang < 18.0 does not have MSVC runtime library selection flags.
- # The official distrubtion's `Fortran*.lib` runtime libraries hard-code
+ # The official distribution's `Fortran*.lib` runtime libraries hard-code
# use of msvcrt (MultiThreadedDLL), so we link to it ourselves.
set(_LLVMFlang_LINK_RUNTIME "-defaultlib:msvcrt")
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 0530441..6dce85b 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
@@ -192,6 +192,9 @@ if(WINCE)
set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_")
set(_RTC1 "")
+ set(_RTCc "")
+ set(_RTCs "")
+ set(_RTCu "")
set(_FLAGS_C "")
set(_FLAGS_CXX "${_GR} /EHsc")
@@ -248,17 +251,24 @@ else()
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
# Clang/C2 in MSVC14 Update 1 seems to not support -fsantinize (yet?)
# set(_RTC1 "-fsantinize=memory,safe-stack")
+ # set(_RTCs "-fsantinize=safe-stack")
+ # set(_RTCu "-fsantinize=memory")
set(_FLAGS_CXX " -frtti -fexceptions")
else()
- set(_RTC1 "/RTC1")
+ set(_RTC1 "-RTC1")
+ set(_RTCc "-RTCc")
+ set(_RTCs "-RTCs")
+ set(_RTCu "-RTCu")
set(_FLAGS_CXX "${_GR} /EHsc")
endif()
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
else()
- set(_RTC1 "/GZ")
+ set(_RTC1 "-GZ")
+ set(_RTCs "-GZ")
set(_FLAGS_CXX "${_GR} /GX")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
endif()
+ set(_RTCsu "${_RTC1}")
if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC"))
string(APPEND CMAKE_C_STANDARD_LIBRARIES_INIT " softintrin.lib")
@@ -353,6 +363,13 @@ else()
endif()
unset(__WINDOWS_MSVC_CMP0141)
+cmake_policy(GET CMP0184 __WINDOWS_MSVC_CMP0184)
+if(__WINDOWS_MSVC_CMP0184 STREQUAL "NEW")
+ set(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT "$<$<CONFIG:Debug>:StackFrameErrorCheck;UninitializedVariable>")
+else()
+ set(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT "")
+endif()
+unset(__WINDOWS_MSVC_CMP0184)
macro(__windows_compiler_msvc lang)
if(NOT MSVC_VERSION LESS 1400)
@@ -467,17 +484,23 @@ macro(__windows_compiler_msvc lang)
set(_Zi " /Zi")
endif()
+ if(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT)
+ set(_RTC1_local "")
+ else()
+ string(REPLACE " -" " /" _RTC1_local " ${_RTC1}")
+ endif()
+
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
# note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects
# that include MS's own headers. CMake itself is affected project too.
string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS${_Wall}${_FLAGS_${lang}}")
- string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd} -gline-tables-only -fno-inline -O0 ${_RTC1}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd} -gline-tables-only -fno-inline -O0${_RTC1_local}")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT "${_MD} -O2 -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "${_MD} -gline-tables-only -O2 -fno-inline -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "${_MD} -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
else()
string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS${_W3}${_FLAGS_${lang}}")
- string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd}${_Zi} /Ob0 /Od ${_RTC1}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd}${_Zi} /Ob0 /Od${_RTC1_local}")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT "${_MD} /O2 /Ob2 /DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "${_MD}${_Zi} /O2 /Ob1 /DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "${_MD} /O1 /Ob1 /DNDEBUG")
@@ -487,7 +510,12 @@ macro(__windows_compiler_msvc lang)
unset(_MDd)
unset(_MD)
unset(_Zi)
+ unset(_RTC1_local)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "${_RTCc}")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "${_RTCs}")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "${_RTCu}")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "${_RTCsu}")
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -MT)
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -MD)
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -MTd)
@@ -510,7 +538,6 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
set(CMAKE_${lang}_USING_LINKER_LLD "${CMAKE_LINKER_LLD}")
set(CMAKE_${lang}_USING_LINKER_MSVC "${CMAKE_LINKER_LINK}")
- set(CMAKE_${lang}_USING_LINKER_MODE TOOL)
endmacro()
macro(__windows_compiler_msvc_enable_rc flags)
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index 6489841..224aa8e 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -51,7 +51,6 @@ unset(__IMPLICIT_DLINK_FLAGS)
set(CMAKE_CUDA_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
set(CMAKE_CUDA_USING_LINKER_LLD "${CMAKE_LINKER_LLD}")
set(CMAKE_CUDA_USING_LINKER_MSVC "${CMAKE_LINKER_LINK}")
-set(CMAKE_CUDA_USING_LINKER_MODE TOOL)
string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
@@ -69,6 +68,12 @@ else()
set(_Zi " -Zi")
endif()
+if(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT)
+ set(_RTC1_local "")
+else()
+ string(REPLACE " -" " /" _RTC1_local " ${_RTC1}")
+endif()
+
cmake_policy(GET CMP0092 _cmp0092)
if(_cmp0092 STREQUAL "NEW")
set(_W3 "")
@@ -78,7 +83,7 @@ endif()
unset(_cmp0092)
string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"")
-string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}${_Zi} -Ob0 -Od ${_RTC1}\"")
+string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}${_Zi} -Ob0 -Od${_RTC1_local}\"")
string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"${_MD}-O2 -Ob2\" -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=\"${_MD}${_Zi} -O2 -Ob1\" -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=\"${_MD}-O1 -Ob1\" -DNDEBUG")
@@ -86,7 +91,12 @@ unset(_W3)
unset(_Zi)
unset(_MDd)
unset(_MD)
+unset(_RTC1_local)
+set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "-Xcompiler=${_RTCc} -D_ALLOW_RTCc_IN_STL")
+set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "-Xcompiler=${_RTCs}")
+set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "-Xcompiler=${_RTCu}")
+set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "-Xcompiler=${_RTCsu}")
set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xcompiler=-MT)
set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -Xcompiler=-MD)
set(CMAKE_CUDA_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -Xcompiler=-MTd)
diff --git a/Modules/Platform/Windows-OpenWatcom.cmake b/Modules/Platform/Windows-OpenWatcom.cmake
index 3e9795e..05d5069 100644
--- a/Modules/Platform/Windows-OpenWatcom.cmake
+++ b/Modules/Platform/Windows-OpenWatcom.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
diff --git a/Modules/Platform/Windows-PGI.cmake b/Modules/Platform/Windows-PGI.cmake
index 8166240..ae68eba 100644
--- a/Modules/Platform/Windows-PGI.cmake
+++ b/Modules/Platform/Windows-PGI.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
index af7335b..449188e 100644
--- a/Modules/Platform/Windows.cmake
+++ b/Modules/Platform/Windows.cmake
@@ -43,4 +43,3 @@ include(Platform/WindowsPaths)
#set(CMAKE_START_TEMP_FILE "")
#set(CMAKE_END_TEMP_FILE "")
#set(CMAKE_VERBOSE_MAKEFILE 1)
-
diff --git a/Modules/Platform/Windows3x-OpenWatcom.cmake b/Modules/Platform/Windows3x-OpenWatcom.cmake
index 0882df6..c1647d3 100644
--- a/Modules/Platform/Windows3x-OpenWatcom.cmake
+++ b/Modules/Platform/Windows3x-OpenWatcom.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
diff --git a/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake b/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake
index 6f0ef33..eb43935 100644
--- a/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake
+++ b/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake
@@ -4,8 +4,4 @@ if(NOT _cmake_windows_kernel_mode_driver_enabled)
message(FATAL_ERROR "Windows kernel-mode driver experimental support is not enabled.")
endif()
-if(CMAKE_GENERATOR MATCHES "Visual Studio")
- message(FATAL_ERROR "Visual Studio generators do not yet support CMAKE_SYSTEM_NAME=WindowsKernelModeDriver.")
-endif()
-
set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index de93338..c56dfaf 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Block multiple inclusion because "CMakeCInformation.cmake" includes
diff --git a/Modules/Platform/Xenix.cmake b/Modules/Platform/Xenix.cmake
index 47852f8..54a156b 100644
--- a/Modules/Platform/Xenix.cmake
+++ b/Modules/Platform/Xenix.cmake
@@ -1,2 +1 @@
include(Platform/UnixPaths)
-
diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake
index 25db028..d6407d0 100644
--- a/Modules/Platform/eCos.cmake
+++ b/Modules/Platform/eCos.cmake
@@ -62,4 +62,3 @@ set(CMAKE_CXX_LINK_SHARED_LIBRARY )
set(CMAKE_CXX_LINK_MODULE_LIBRARY )
set(CMAKE_C_LINK_SHARED_LIBRARY )
set(CMAKE_C_LINK_MODULE_LIBRARY )
-
diff --git a/Modules/Platform/gas.cmake b/Modules/Platform/gas.cmake
index 8484076..12060f7 100644
--- a/Modules/Platform/gas.cmake
+++ b/Modules/Platform/gas.cmake
@@ -16,4 +16,3 @@ set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
# to be done
set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
-
diff --git a/Modules/Platform/iOS-Initialize.cmake b/Modules/Platform/iOS-Initialize.cmake
index 91e3898..2a38bc1 100644
--- a/Modules/Platform/iOS-Initialize.cmake
+++ b/Modules/Platform/iOS-Initialize.cmake
@@ -5,5 +5,3 @@ if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/(iPhoneOS|iPhoneSimulator|MacOSX)")
endif()
set(IOS 1)
-
-set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/tvOS-Initialize.cmake b/Modules/Platform/tvOS-Initialize.cmake
index 6834c80..f265946 100644
--- a/Modules/Platform/tvOS-Initialize.cmake
+++ b/Modules/Platform/tvOS-Initialize.cmake
@@ -3,5 +3,3 @@ include(Platform/Darwin-Initialize)
if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTV(OS|Simulator)")
message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an tvOS SDK")
endif()
-
-set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/visionOS-Initialize.cmake b/Modules/Platform/visionOS-Initialize.cmake
index e8431bc..fee7bf3 100644
--- a/Modules/Platform/visionOS-Initialize.cmake
+++ b/Modules/Platform/visionOS-Initialize.cmake
@@ -3,5 +3,3 @@ include(Platform/Darwin-Initialize)
if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/XR(OS|Simulator)")
message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an visionOS SDK")
endif()
-
-set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/watchOS-Initialize.cmake b/Modules/Platform/watchOS-Initialize.cmake
index 2f396d3..e9705ca 100644
--- a/Modules/Platform/watchOS-Initialize.cmake
+++ b/Modules/Platform/watchOS-Initialize.cmake
@@ -3,5 +3,3 @@ include(Platform/Darwin-Initialize)
if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/Watch(OS|Simulator)")
message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an watchOS SDK")
endif()
-
-set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 9e1d473..13d708f 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
ProcessorCount
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index 4699ecd..f20589e 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Qt4ConfigDependentSettings
@@ -240,7 +240,7 @@ endif()
if(QT_QCONFIG MATCHES "clock-monotonic")
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES rt)
- CHECK_SYMBOL_EXISTS(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS)
+ check_symbol_exists(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
if(QT_POSIX_TIMERS)
find_library(QT_RT_LIBRARY NAMES rt)
@@ -287,4 +287,3 @@ if(Q_WS_MAC)
set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices")
endif()
-
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index cb6ae43..eee413b 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Qt4Macros
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index 4c0e9a8..7227367 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
SelectLibraryConfigurations
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
index b0cb4af..784939e 100644
--- a/Modules/SquishTestScript.cmake
+++ b/Modules/SquishTestScript.cmake
@@ -1,13 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
SquishTestScript
----------------
-
-
-
-
+.. deprecated:: 3.0
This script launches a GUI test using Squish. You should not call the
script directly; instead, you should access it via the SQUISH_ADD_TEST
diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake
index 97f3856..84a40db 100644
--- a/Modules/SystemInformation.cmake
+++ b/Modules/SystemInformation.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION})
@@ -88,4 +88,3 @@ DUMP_FILE("../CMakeFiles/CMakeSystem.cmake")
foreach (EXTRA_FILE ${EXTRA_DUMP_FILES})
DUMP_FILE("${EXTRA_FILE}")
endforeach ()
-
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 03c8588..a64303d 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
TestBigEndian
@@ -52,19 +52,19 @@ macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE)
message(FATAL_ERROR "TEST_BIG_ENDIAN needs either C or CXX language enabled")
endif()
- CHECK_TYPE_SIZE("unsigned short" CMAKE_SIZEOF_UNSIGNED_SHORT LANGUAGE ${_test_language})
+ check_type_size("unsigned short" CMAKE_SIZEOF_UNSIGNED_SHORT LANGUAGE ${_test_language})
if(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
message(CHECK_PASS "Using unsigned short")
set(CMAKE_16BIT_TYPE "unsigned short")
else()
- CHECK_TYPE_SIZE("unsigned int" CMAKE_SIZEOF_UNSIGNED_INT LANGUAGE ${_test_language})
+ check_type_size("unsigned int" CMAKE_SIZEOF_UNSIGNED_INT LANGUAGE ${_test_language})
if(CMAKE_SIZEOF_UNSIGNED_INT)
message(CHECK_PASS "Using unsigned int")
set(CMAKE_16BIT_TYPE "unsigned int")
else()
- CHECK_TYPE_SIZE("unsigned long" CMAKE_SIZEOF_UNSIGNED_LONG LANGUAGE ${_test_language})
+ check_type_size("unsigned long" CMAKE_SIZEOF_UNSIGNED_LONG LANGUAGE ${_test_language})
if(CMAKE_SIZEOF_UNSIGNED_LONG)
message(CHECK_PASS "Using unsigned long")
set(CMAKE_16BIT_TYPE "unsigned long")
@@ -77,55 +77,59 @@ macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE)
endif()
if(_test_language STREQUAL "CXX")
- set(_test_file TestEndianess.cpp)
+ set(_test_file TestEndianness.cpp)
else()
- set(_test_file TestEndianess.c)
+ set(_test_file TestEndianness.c)
endif()
- file(READ "${CMAKE_ROOT}/Modules/TestEndianess.c.in" TEST_ENDIANESS_FILE_CONTENT)
- string(CONFIGURE "${TEST_ENDIANESS_FILE_CONTENT}" TEST_ENDIANESS_FILE_CONTENT @ONLY)
+ file(READ "${CMAKE_ROOT}/Modules/TestEndianness.c.in" TEST_ENDIANNESS_FILE_CONTENT)
+ string(CONFIGURE "${TEST_ENDIANNESS_FILE_CONTENT}" TEST_ENDIANNESS_FILE_CONTENT @ONLY)
try_compile(HAVE_${VARIABLE}
- SOURCE_FROM_VAR "${_test_file}" TEST_ENDIANESS_FILE_CONTENT
- COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" )
+ SOURCE_FROM_VAR "${_test_file}" TEST_ENDIANNESS_FILE_CONTENT
+ COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianness.bin" )
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}/TestEndianness.bin"
+ CMAKE_TEST_ENDIANNESS_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")
+ file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianness.bin"
+ CMAKE_TEST_ENDIANNESS_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)
+ if(CMAKE_TEST_ENDIANNESS_STRINGS_BE AND CMAKE_TEST_ENDIANNESS_STRINGS_LE)
if(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
- set(CMAKE_TEST_ENDIANESS_STRINGS_BE TRUE)
- set(CMAKE_TEST_ENDIANESS_STRINGS_LE FALSE)
+ set(CMAKE_TEST_ENDIANNESS_STRINGS_BE TRUE)
+ set(CMAKE_TEST_ENDIANNESS_STRINGS_LE FALSE)
else()
- set(CMAKE_TEST_ENDIANESS_STRINGS_BE FALSE)
- set(CMAKE_TEST_ENDIANESS_STRINGS_LE TRUE)
+ set(CMAKE_TEST_ENDIANNESS_STRINGS_BE FALSE)
+ set(CMAKE_TEST_ENDIANNESS_STRINGS_LE TRUE)
endif()
- message(STATUS "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
+ message(
+ STATUS
+ "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or "
+ "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !"
+ )
endif()
- if(CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ if(CMAKE_TEST_ENDIANNESS_STRINGS_LE)
set(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
message(CHECK_PASS "little endian")
endif()
- if(CMAKE_TEST_ENDIANESS_STRINGS_BE)
+ if(CMAKE_TEST_ENDIANNESS_STRINGS_BE)
set(${VARIABLE} 1 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
message(CHECK_PASS "big endian")
endif()
- if(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ if(NOT CMAKE_TEST_ENDIANNESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANNESS_STRINGS_LE)
message(CHECK_FAIL "TEST_BIG_ENDIAN found no result!")
message(SEND_ERROR "TEST_BIG_ENDIAN found no result!")
endif()
diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake
index 023d6ba..239db61 100644
--- a/Modules/TestCXXAcceptsFlag.cmake
+++ b/Modules/TestCXXAcceptsFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
TestCXXAcceptsFlag
diff --git a/Modules/TestEndianess.c.in b/Modules/TestEndianness.c.in
index c924f78..c924f78 100644
--- a/Modules/TestEndianess.c.in
+++ b/Modules/TestEndianness.c.in
diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake
index b1a12cf..1224a21 100644
--- a/Modules/TestForANSIForScope.cmake
+++ b/Modules/TestForANSIForScope.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
TestForANSIForScope
@@ -30,8 +30,3 @@ if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
"Does the compiler support ansi for scope.")
endif ()
endif()
-
-
-
-
-
diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake
index e532a71..d156991 100644
--- a/Modules/TestForANSIStreamHeaders.cmake
+++ b/Modules/TestForANSIStreamHeaders.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
TestForANSIStreamHeaders
@@ -18,7 +18,7 @@ check if the compiler supports the standard ANSI iostream header
include(${CMAKE_CURRENT_LIST_DIR}/CheckIncludeFileCXX.cmake)
if(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
- CHECK_INCLUDE_FILE_CXX(iostream CMAKE_ANSI_STREAM_HEADERS)
+ check_include_file_cxx(iostream CMAKE_ANSI_STREAM_HEADERS)
if (CMAKE_ANSI_STREAM_HEADERS)
set (CMAKE_NO_ANSI_STREAM_HEADERS 0 CACHE INTERNAL
"Does the compiler support headers like iostream.")
@@ -29,5 +29,3 @@ if(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
mark_as_advanced(CMAKE_NO_ANSI_STREAM_HEADERS)
endif()
-
-
diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake
index e2cc5b0..40fb373 100644
--- a/Modules/TestForSSTREAM.cmake
+++ b/Modules/TestForSSTREAM.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
TestForSSTREAM
@@ -29,7 +29,3 @@ if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
"Does the compiler support sstream")
endif ()
endif()
-
-
-
-
diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake
index 61e922d..e565e5c 100644
--- a/Modules/TestForSTDNamespace.cmake
+++ b/Modules/TestForSTDNamespace.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
TestForSTDNamespace
@@ -29,7 +29,3 @@ if(NOT DEFINED CMAKE_STD_NAMESPACE)
"Does the compiler support std::.")
endif ()
endif()
-
-
-
-
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index 5e6f606..c217dcc 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
UseEcos
@@ -62,7 +62,7 @@ else ()
message(STATUS "tlcsh found: ${TCL_TCLSH}")
endif ()
-#add the globale include-diretories
+#add the global include-directories
#usage: ECOS_ADD_INCLUDE_DIRECTORIES()
macro(ECOS_ADD_INCLUDE_DIRECTORIES)
#check for ProjectSources.txt one level higher
@@ -243,4 +243,3 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME )
COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst )
endmacro()
-
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 1fcc3af..b977d95 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
UseJava
@@ -39,7 +39,9 @@ Creating And Installing JARs
.. command:: add_jar
- Creates a jar file containing java objects and, optionally, resources::
+ Creates a jar file containing java objects and, optionally, resources:
+
+ .. code-block:: cmake
add_jar(<target_name>
[SOURCES] <source1> [<source2>...] [<resource1>...]
@@ -216,7 +218,9 @@ Creating And Installing JARs
.. command:: install_jar
- This command installs the jar file to the given destination::
+ This command installs the jar file to the given destination:
+
+ .. code-block:: cmake
install_jar(<target_name> <destination>)
install_jar(<target_name> DESTINATION <destination> [COMPONENT <component>])
@@ -246,7 +250,9 @@ Creating And Installing JARs
.. command:: install_jni_symlink
- Installs JNI symlinks for target generated by :ref:`add_jar() <add_jar>`::
+ Installs JNI symlinks for target generated by :ref:`add_jar() <add_jar>`:
+
+ .. code-block:: cmake
install_jni_symlink(<target_name> <destination>)
install_jni_symlink(<target_name> DESTINATION <destination> [COMPONENT <component>])
@@ -283,7 +289,9 @@ Header Generation
.. versionadded:: 3.4
- Generates C header files for java classes::
+ Generates C header files for java classes:
+
+ .. code-block:: cmake
create_javah(TARGET <target> | GENERATED_FILES <VAR>
CLASSES <class>...
@@ -353,7 +361,9 @@ Exporting JAR Targets
.. versionadded:: 3.7
- Installs a target export file::
+ Installs a target export file:
+
+ .. code-block:: cmake
install_jar_exports(TARGETS <jars>...
[NAMESPACE <namespace>]
@@ -390,7 +400,9 @@ Exporting JAR Targets
.. versionadded:: 3.7
- Writes a target export file::
+ Writes a target export file:
+
+ .. code-block:: cmake
export_jars(TARGETS <jars>...
[NAMESPACE <namespace>]
@@ -418,7 +430,9 @@ Finding JARs
.. command:: find_jar
- Finds the specified jar file::
+ Finds the specified jar file:
+
+ .. code-block:: cmake
find_jar(<VAR>
<name> | NAMES <name1> [<name2>...]
@@ -455,7 +469,9 @@ Creating Java Documentation
.. command:: create_javadoc
- Creates java documentation based on files and packages::
+ Creates java documentation based on files and packages:
+
+ .. code-block:: cmake
create_javadoc(<VAR>
(PACKAGES <pkg1> [<pkg2>...] | FILES <file1> [<file2>...])
diff --git a/Modules/UseJava/ClassFilelist.cmake b/Modules/UseJava/ClassFilelist.cmake
index aa9e35d..371094e 100644
--- a/Modules/UseJava/ClassFilelist.cmake
+++ b/Modules/UseJava/ClassFilelist.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This script creates a list of compiled Java class files to be added to
# a jar file. This avoids including cmake files which get created in
diff --git a/Modules/UseJava/ClearClassFiles.cmake b/Modules/UseJava/ClearClassFiles.cmake
index 42a7666..2e28080 100644
--- a/Modules/UseJava/ClearClassFiles.cmake
+++ b/Modules/UseJava/ClearClassFiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# This script deletes compiled Java class files.
diff --git a/Modules/UseJava/Symlinks.cmake b/Modules/UseJava/Symlinks.cmake
index 2788195..3142dca 100644
--- a/Modules/UseJava/Symlinks.cmake
+++ b/Modules/UseJava/Symlinks.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Helper script for UseJava.cmake
diff --git a/Modules/UseJava/javaTargets.cmake.in b/Modules/UseJava/javaTargets.cmake.in
index 6002d4e..11f1f06 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.29)
+cmake_policy(VERSION 2.8.12...3.30)
#----------------------------------------------------------------
# Generated CMake Java target import file.
diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake
index fdf632a..3771db1 100644
--- a/Modules/UsePkgConfig.cmake
+++ b/Modules/UsePkgConfig.cmake
@@ -1,13 +1,12 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
UsePkgConfig
------------
-Obsolete pkg-config module for CMake, use FindPkgConfig instead.
-
-
+.. deprecated:: 3.0
+ Use :module:`FindPkgConfig` instead.
This module defines the following macro:
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index 8fec717..2b8146c 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
UseQt4
@@ -17,9 +17,9 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debu
if(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(${QT_INCLUDE_DIR})
-else(QT_INCLUDE_DIRS_NO_SYSTEM)
+else()
include_directories(SYSTEM ${QT_INCLUDE_DIR})
-endif(QT_INCLUDE_DIRS_NO_SYSTEM)
+endif()
set(QT_LIBRARIES "")
set(QT_LIBRARIES_PLUGINS "")
@@ -85,9 +85,9 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
add_definitions(-DQT_${qt_module_def}_LIB)
if(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(${QT_${module}_INCLUDE_DIR})
- else(QT_INCLUDE_DIRS_NO_SYSTEM)
+ else()
include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR})
- endif(QT_INCLUDE_DIRS_NO_SYSTEM)
+ endif()
endif()
if(QT_USE_${module} OR QT_IS_STATIC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index bc4de91..cc023ee 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
UseSWIG
@@ -21,7 +21,9 @@ The following command is defined for use with ``SWIG``:
.. versionadded:: 3.8
- Define swig module with given name and specified language::
+ Define swig module with given name and specified language:
+
+ .. code-block:: cmake
swig_add_library(<name>
[TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
@@ -372,7 +374,9 @@ Deprecated Commands
Use :command:`target_link_libraries` with the standard target name,
or with ``${SWIG_MODULE_<name>_REAL_NAME}`` for legacy target naming.
- Link libraries to swig module::
+ Link libraries to swig module:
+
+ .. code-block:: cmake
swig_link_libraries(<name> <item>...)
@@ -394,10 +398,6 @@ Deprecated Commands
#]=======================================================================]
cmake_policy(PUSH)
-# numbers and boolean constants
-cmake_policy (SET CMP0012 NEW)
-# IN_LIST operator
-cmake_policy (SET CMP0057 NEW)
# Ninja generator normalizes custom command depfile paths
cmake_policy (SET CMP0116 NEW)
diff --git a/Modules/UseSWIG/ManageSupportFiles.cmake b/Modules/UseSWIG/ManageSupportFiles.cmake
index 6618fd5..5fdc6eb 100644
--- a/Modules/UseSWIG/ManageSupportFiles.cmake
+++ b/Modules/UseSWIG/ManageSupportFiles.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if (ACTION STREQUAL "CLEAN")
diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake
index 782874c..5f46784 100644
--- a/Modules/Use_wxWindows.cmake
+++ b/Modules/Use_wxWindows.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Use_wxWindows
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
index b428a61..7152afe 100644
--- a/Modules/UsewxWidgets.cmake
+++ b/Modules/UsewxWidgets.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
UsewxWidgets
@@ -13,7 +13,7 @@ called.
USAGE
-::
+.. code-block:: cmake
# Note that for MinGW users the order of libs is important!
find_package(wxWidgets REQUIRED net gl core base)
diff --git a/Modules/VTKCompatibility.cmake b/Modules/VTKCompatibility.cmake
index 4ee7643..316e2e1 100644
--- a/Modules/VTKCompatibility.cmake
+++ b/Modules/VTKCompatibility.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# Not needed for "modern" VTK.
if (EXISTS "${VTK_SOURCE_DIR}/CMake/vtkModule.cmake")
@@ -43,4 +43,3 @@ set(TIFF_RIGHT_VERSION 1)
macro(SOURCE_FILES)
message (FATAL_ERROR "You are trying to build a very old version of VTK (prior to VTK 4.2). To do this you need to use CMake 2.0 as it was the last version of CMake to support VTK 4.0.")
endmacro()
-
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 4db725c..4a90aea 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
WriteBasicConfigVersionFile
@@ -10,9 +10,9 @@ WriteBasicConfigVersionFile
Use the identical command :command:`write_basic_package_version_file()`
from module :module:`CMakePackageConfigHelpers`.
-::
+.. code-block:: cmake
- WRITE_BASIC_CONFIG_VERSION_FILE( filename
+ WRITE_BASIC_CONFIG_VERSION_FILE(filename
[VERSION major.minor.patch]
COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion)
[ARCH_INDEPENDENT]
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 0e4e028..954875e 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
WriteCompilerDetectionHeader
@@ -14,7 +14,9 @@ WriteCompilerDetectionHeader
This module provides the function ``write_compiler_detection_header()``.
This function can be used to generate a file suitable for preprocessor
-inclusion which contains macros to be used in source code::
+inclusion which contains macros to be used in source code:
+
+.. code-block:: cmake
write_compiler_detection_header(
FILE <file>
diff --git a/Modules/ecos_clean.cmake b/Modules/ecos_clean.cmake
index 480b1ce..1c091ad 100644
--- a/Modules/ecos_clean.cmake
+++ b/Modules/ecos_clean.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
file(GLOB _files ${ECOS_DIR}/*)
diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake
index b1f73d5..2dfe0f7 100644
--- a/Modules/kde3uic.cmake
+++ b/Modules/kde3uic.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# used internally by KDE3Macros.cmake
@@ -19,4 +19,3 @@ string(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${
file(WRITE ${KDE_UIC_CPP_FILE} "#include <kdialog.h>\n#include <klocale.h>\n\n")
file(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}")
-
diff --git a/Packaging/QtSDK/ToolsCMakeXX.cmake b/Packaging/QtSDK/ToolsCMakeXX.cmake
index 99731fb..f309f94 100644
--- a/Packaging/QtSDK/ToolsCMakeXX.cmake
+++ b/Packaging/QtSDK/ToolsCMakeXX.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# CMake version
include("${CMAKE_CURRENT_LIST_DIR}/../../Source/CMakeVersion.cmake")
diff --git a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in
index e806dd7..b449581 100644
--- a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in
+++ b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in
@@ -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.
+** file LICENSE.rst or https://cmake.org/licensing for details.
**
****************************************************************************/
diff --git a/README.rst b/README.rst
index 8a471db..3eefaf9 100644
--- a/README.rst
+++ b/README.rst
@@ -22,9 +22,9 @@ License
=======
CMake is distributed under the OSI-approved BSD 3-clause License.
-See `Copyright.txt`_ for details.
+See `LICENSE.rst`_ for details.
-.. _`Copyright.txt`: Copyright.txt
+.. _`LICENSE.rst`: LICENSE.rst
Building CMake
==============
diff --git a/Source/CMakeCopyright.cmake b/Source/CMakeCopyright.cmake
new file mode 100644
index 0000000..a9af2d1
--- /dev/null
+++ b/Source/CMakeCopyright.cmake
@@ -0,0 +1,12 @@
+# CMake license file and copyright line.
+set(CMake_LICENSE_FILE "${CMake_SOURCE_DIR}/LICENSE.rst")
+file(STRINGS "${CMake_LICENSE_FILE}" CMake_COPYRIGHT_LINE LIMIT_COUNT 1 REGEX "^Copyright ")
+if(CMake_COPYRIGHT_LINE MATCHES [[^(Copyright 2000-2[0-9][0-9][0-9] Kitware, Inc\. and )`(Contributors) <CONTRIBUTORS.rst>`_$]])
+ set(CMake_COPYRIGHT_LINE "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
+else()
+ message(FATAL_ERROR
+ "The CMake license file:\n"
+ " ${CMake_LICENSE_FILE}\n"
+ "does not contain a copyright line matching the expected pattern."
+ )
+endif()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index c4cd101..1d078ee 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# To ensure maximum portability across various compilers and platforms
# deactivate any compiler extensions. Skip this for QNX, where additional
@@ -62,12 +62,6 @@ add_library(ManifestLib INTERFACE)
add_library(
CMakeLib
# Lexers/Parsers
- LexerParser/cmCommandArgumentLexer.cxx
- LexerParser/cmCommandArgumentLexer.h
- LexerParser/cmCommandArgumentLexer.in.l
- LexerParser/cmCommandArgumentParser.cxx
- LexerParser/cmCommandArgumentParserTokens.h
- LexerParser/cmCommandArgumentParser.y
LexerParser/cmDependsJavaLexer.cxx
LexerParser/cmDependsJavaLexer.h
LexerParser/cmDependsJavaLexer.in.l
@@ -141,7 +135,6 @@ add_library(
cmCMakePresetsGraphReadJSONPackagePresets.cxx
cmCMakePresetsGraphReadJSONTestPresets.cxx
cmCMakePresetsGraphReadJSONWorkflowPresets.cxx
- cmCommandArgumentParserHelper.cxx
cmCommandLineArgument.h
cmCommonTargetGenerator.cxx
cmCommonTargetGenerator.h
@@ -359,6 +352,12 @@ add_library(
cmInstallDirectoryGenerator.cxx
cmInstallScriptHandler.h
cmInstallScriptHandler.cxx
+ cmInstrumentation.h
+ cmInstrumentation.cxx
+ cmInstrumentationCommand.h
+ cmInstrumentationCommand.cxx
+ cmInstrumentationQuery.h
+ cmInstrumentationQuery.cxx
cmJSONHelpers.cxx
cmJSONHelpers.h
cmJSONState.cxx
@@ -412,6 +411,10 @@ add_library(
cmNewLineStyle.cxx
cmOrderDirectories.cxx
cmOrderDirectories.h
+ cmPackageInfoReader.cxx
+ cmPackageInfoReader.h
+ cmPathResolver.cxx
+ cmPathResolver.h
cmPlistParser.cxx
cmPlistParser.h
cmPolicies.h
@@ -443,6 +446,8 @@ add_library(
cmRST.h
cmRuntimeDependencyArchive.cxx
cmRuntimeDependencyArchive.h
+ cmSarifLog.cxx
+ cmSarifLog.h
cmScriptGenerator.h
cmScriptGenerator.cxx
cmSourceFile.cxx
@@ -508,8 +513,6 @@ add_library(
cmake.cxx
cmake.h
- cmCommand.cxx
- cmCommand.h
cmCommands.cxx
cmCommands.h
cmAddCompileDefinitionsCommand.cxx
@@ -540,8 +543,6 @@ add_library(
cmBreakCommand.h
cmBuildCommand.cxx
cmBuildCommand.h
- cmBuildNameCommand.cxx
- cmBuildNameCommand.h
cmCMakeHostSystemInformationCommand.cxx
cmCMakeHostSystemInformationCommand.h
cmCMakeLanguageCommand.cxx
@@ -580,8 +581,6 @@ add_library(
cmExperimental.h
cmExportCommand.cxx
cmExportCommand.h
- cmExportLibraryDependenciesCommand.cxx
- cmExportLibraryDependenciesCommand.h
cmFLTKWrapUICommand.cxx
cmFLTKWrapUICommand.h
cmFileCommand.cxx
@@ -660,8 +659,6 @@ add_library(
cmListCommand.h
cmLoadCacheCommand.cxx
cmLoadCacheCommand.h
- cmLoadCommandCommand.cxx
- cmLoadCommandCommand.h
cmMacroCommand.cxx
cmMacroCommand.h
cmMakeDirectoryCommand.cxx
@@ -675,8 +672,6 @@ add_library(
cmMessageMetadata.h
cmOptionCommand.cxx
cmOptionCommand.h
- cmOutputRequiredFilesCommand.cxx
- cmOutputRequiredFilesCommand.h
cmParseArgumentsCommand.cxx
cmParseArgumentsCommand.h
cmPathLabel.cxx
@@ -722,8 +717,6 @@ add_library(
cmSubcommandTable.h
cmSubdirCommand.cxx
cmSubdirCommand.h
- cmSubdirDependsCommand.cxx
- cmSubdirDependsCommand.h
cmTargetCompileDefinitionsCommand.cxx
cmTargetCompileDefinitionsCommand.h
cmTargetCompileFeaturesCommand.cxx
@@ -752,12 +745,6 @@ add_library(
cmTryRunCommand.h
cmUnsetCommand.cxx
cmUnsetCommand.h
- cmUseMangledMesaCommand.cxx
- cmUseMangledMesaCommand.h
- cmUtilitySourceCommand.cxx
- cmUtilitySourceCommand.h
- cmVariableRequiresCommand.cxx
- cmVariableRequiresCommand.h
cmVariableWatchCommand.cxx
cmVariableWatchCommand.h
cmWhileCommand.cxx
@@ -1026,7 +1013,6 @@ if(CMake_BUILD_PCH)
set_source_files_properties("LexerParser/cmFortranParser.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
else()
set_source_files_properties(
- "LexerParser/cmCommandArgumentLexer.cxx"
"LexerParser/cmGccDepfileLexer.cxx"
"LexerParser/cmExprLexer.cxx"
"LexerParser/cmDependsJavaLexer.cxx"
@@ -1044,6 +1030,15 @@ if(WIN32 AND NOT CYGWIN)
list(APPEND _tools cmcldeps)
endif()
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION STREQUAL "5.10" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(i386|x86_64)$")
+ set_property(SOURCE cmSystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_NO_MKDTEMP)
+endif()
+get_property(targetSupportsSharedLibs GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT targetSupportsSharedLibs)
+ # Disable getpwnam for static linux builds since it depends on shared glibc.
+ set_property(SOURCE cmSystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_NO_GETPWNAM)
+endif()
+
# Some atomic instructions are implemented using libatomic on some platforms.
if(CMake_HAVE_CXX_ATOMIC_LIB)
target_link_libraries(CMakeLib PUBLIC atomic)
@@ -1071,11 +1066,11 @@ add_library(
cmCTest.cxx
CTest/cmProcess.cxx
CTest/cmCTestBinPacker.cxx
- CTest/cmCTestBuildAndTestHandler.cxx
+ CTest/cmCTestBuildAndTest.cxx
CTest/cmCTestBuildCommand.cxx
CTest/cmCTestBuildHandler.cxx
+ CTest/cmCTestCommand.cxx
CTest/cmCTestConfigureCommand.cxx
- CTest/cmCTestConfigureHandler.cxx
CTest/cmCTestCoverageCommand.cxx
CTest/cmCTestCoverageHandler.cxx
CTest/cmCTestCurl.cxx
@@ -1109,10 +1104,9 @@ add_library(
CTest/cmCTestTestCommand.cxx
CTest/cmCTestTestHandler.cxx
CTest/cmCTestTestMeasurementXMLParser.cxx
+ CTest/cmCTestTypes.cxx
CTest/cmCTestUpdateCommand.cxx
- CTest/cmCTestUpdateHandler.cxx
CTest/cmCTestUploadCommand.cxx
- CTest/cmCTestUploadHandler.cxx
CTest/cmCTestVC.cxx
CTest/cmCTestVC.h
@@ -1377,7 +1371,5 @@ foreach(_tool IN LISTS _tools)
install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT})
endforeach()
-install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
-
# Unset temporary variables
unset(_tools)
diff --git a/Source/CMakeVersion.bash b/Source/CMakeVersion.bash
index 853b0ca..f0e4996 100755
--- a/Source/CMakeVersion.bash
+++ b/Source/CMakeVersion.bash
@@ -1,7 +1,17 @@
#!/usr/bin/env bash
# Update the version component if it looks like a date or -f is given.
+version_file="${BASH_SOURCE%/*}/CMakeVersion.cmake"
if test "x$1" = "x-f"; then shift ; n='*' ; else n='\{8\}' ; fi
if test "$#" -gt 0; then echo 1>&2 "usage: CMakeVersion.bash [-f]"; exit 1; fi
sed -i -e '
s/\(^set(CMake_VERSION_PATCH\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/
-' "${BASH_SOURCE%/*}/CMakeVersion.cmake"
+' "$version_file"
+# Update the copyright notice to match the version date's year.
+if version_patch_line=$(grep -E '^set\(CMake_VERSION_PATCH [0-9]{8}\)' "$version_file"); then
+ version_patch_year="${version_patch_line:24:4}"
+ if [[ "$version_patch_year" =~ ^[0-9][0-9][0-9][0-9]$ ]] ; then
+ sed -i -e '
+ s/\(^Copyright 2000-\)[0-9][0-9][0-9][0-9]\( .*\)/\1'"$version_patch_year"'\2/
+ ' "${BASH_SOURCE%/*}/../LICENSE.rst"
+ fi
+fi
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ea0a21c..d7494ce 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 31)
-set(CMake_VERSION_PATCH 8)
+set(CMake_VERSION_MAJOR 4)
+set(CMake_VERSION_MINOR 0)
+set(CMake_VERSION_PATCH 3)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
@@ -24,14 +24,15 @@ if(NOT CMake_VERSION_NO_GIT)
set(git_info [==[$Format:%h %s$]==])
# Otherwise, try to identify the current development source version.
+ get_filename_component(git_toplevel "${CMAKE_CURRENT_LIST_DIR}" PATH)
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
- AND EXISTS ${CMake_SOURCE_DIR}/.git)
+ AND EXISTS "${git_toplevel}/.git")
find_package(Git QUIET)
if(GIT_FOUND)
macro(_git)
execute_process(
COMMAND ${GIT_EXECUTABLE} ${ARGN}
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ WORKING_DIRECTORY "${git_toplevel}"
RESULT_VARIABLE _git_res
OUTPUT_VARIABLE _git_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _git_err ERROR_STRIP_TRAILING_WHITESPACE
@@ -52,9 +53,11 @@ if(NOT CMake_VERSION_NO_GIT)
set(git_subject "${CMAKE_MATCH_2}")
# If this is not the exact commit of a release, add dev info.
+ # noqa: spellcheck off
if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$")
string(APPEND CMake_VERSION "-g${git_hash}")
endif()
+ # noqa: spellcheck on
# If this is a work tree, check whether it is dirty.
if(COMMAND _git)
diff --git a/Source/CMakeVersion.rc.in b/Source/CMakeVersion.rc.in
index 762d9bb..df37348 100644
--- a/Source/CMakeVersion.rc.in
+++ b/Source/CMakeVersion.rc.in
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
1 VERSIONINFO
FILEVERSION @CMake_RCVERSION@
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
index 4a868ae..9b8fc83 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.cxx
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackIFWCommon.h"
#include <cstddef> // IWYU pragma: keep
@@ -20,29 +20,29 @@ cmCPackIFWCommon::cmCPackIFWCommon()
{
}
-cmValue cmCPackIFWCommon::GetOption(const std::string& op) const
+cmValue cmCPackIFWCommon::GetOption(std::string const& op) const
{
return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op)
: nullptr;
}
-bool cmCPackIFWCommon::IsOn(const std::string& op) const
+bool cmCPackIFWCommon::IsOn(std::string const& op) const
{
return this->Generator && this->Generator->cmCPackGenerator::IsOn(op);
}
-bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
+bool cmCPackIFWCommon::IsSetToOff(std::string const& op) const
{
return this->Generator && this->Generator->cmCPackGenerator::IsSetToOff(op);
}
-bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
+bool cmCPackIFWCommon::IsSetToEmpty(std::string const& op) const
{
return this->Generator &&
this->Generator->cmCPackGenerator::IsSetToEmpty(op);
}
-bool cmCPackIFWCommon::IsVersionLess(const char* version) const
+bool cmCPackIFWCommon::IsVersionLess(char const* version) const
{
if (!this->Generator) {
return false;
@@ -52,7 +52,7 @@ bool cmCPackIFWCommon::IsVersionLess(const char* version) const
cmSystemTools::OP_LESS, this->Generator->FrameworkVersion, version);
}
-bool cmCPackIFWCommon::IsVersionGreater(const char* version) const
+bool cmCPackIFWCommon::IsVersionGreater(char const* version) const
{
if (!this->Generator) {
return false;
@@ -62,7 +62,7 @@ bool cmCPackIFWCommon::IsVersionGreater(const char* version) const
cmSystemTools::OP_GREATER, this->Generator->FrameworkVersion, version);
}
-bool cmCPackIFWCommon::IsVersionEqual(const char* version) const
+bool cmCPackIFWCommon::IsVersionEqual(char const* version) const
{
if (!this->Generator) {
return false;
@@ -73,7 +73,7 @@ bool cmCPackIFWCommon::IsVersionEqual(const char* version) const
}
void cmCPackIFWCommon::ExpandListArgument(
- const std::string& arg, std::map<std::string, std::string>& argsOut)
+ std::string const& arg, std::map<std::string, std::string>& argsOut)
{
cmList args{ arg };
if (args.empty()) {
@@ -94,7 +94,7 @@ void cmCPackIFWCommon::ExpandListArgument(
}
void cmCPackIFWCommon::ExpandListArgument(
- const std::string& arg, std::multimap<std::string, std::string>& argsOut)
+ std::string const& arg, std::multimap<std::string, std::string>& argsOut)
{
cmList args{ arg };
if (args.empty()) {
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h
index f2e6b88..da49c68 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.h
+++ b/Source/CPack/IFW/cmCPackIFWCommon.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,32 +28,32 @@ public:
public:
// Internal implementation
- cmValue GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
- bool IsSetToOff(const std::string& op) const;
- bool IsSetToEmpty(const std::string& op) const;
+ cmValue GetOption(std::string const& op) const;
+ bool IsOn(std::string const& op) const;
+ bool IsSetToOff(std::string const& op) const;
+ bool IsSetToEmpty(std::string const& op) const;
/**
* Compare \a version with QtIFW framework version
*/
- bool IsVersionLess(const char* version) const;
+ bool IsVersionLess(char const* version) const;
/**
* Compare \a version with QtIFW framework version
*/
- bool IsVersionGreater(const char* version) const;
+ bool IsVersionGreater(char const* version) const;
/**
* Compare \a version with QtIFW framework version
*/
- bool IsVersionEqual(const char* version) const;
+ bool IsVersionEqual(char const* version) const;
/** Expand the list argument containing the map of the key-value pairs.
* If the number of elements is odd, then the first value is used as the
* default value with an empty key.
* Any values with the same keys will be permanently overwritten.
*/
- static void ExpandListArgument(const std::string& arg,
+ static void ExpandListArgument(std::string const& arg,
std::map<std::string, std::string>& argsOut);
/** Expand the list argument containing the multimap of the key-value pairs.
@@ -61,7 +61,7 @@ public:
* default value with an empty key.
*/
static void ExpandListArgument(
- const std::string& arg, std::multimap<std::string, std::string>& argsOut);
+ std::string const& arg, std::multimap<std::string, std::string>& argsOut);
cmCPackIFWGenerator* Generator;
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 7c82668..1560575 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackIFWGenerator.h"
#include <sstream>
@@ -116,7 +116,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
return ifwCmd;
}
-int cmCPackIFWGenerator::RunRepogen(const std::string& ifwTmpFile)
+int cmCPackIFWGenerator::RunRepogen(std::string const& ifwTmpFile)
{
if (this->Installer.RemoteRepositories.empty()) {
return 1;
@@ -161,7 +161,7 @@ int cmCPackIFWGenerator::RunRepogen(const std::string& ifwTmpFile)
return 1;
}
-std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommmand()
+std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
{
std::vector<std::string> ifwCmd;
std::string ifwArg;
@@ -274,9 +274,9 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommmand()
return ifwCmd;
}
-int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile)
+int cmCPackIFWGenerator::RunBinaryCreator(std::string const& ifwTmpFile)
{
- std::vector<std::string> ifwCmd = this->BuildBinaryCreatorCommmand();
+ std::vector<std::string> ifwCmd = this->BuildBinaryCreatorCommand();
cmCPackIFWLogger(VERBOSE,
"Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
<< std::endl);
@@ -303,9 +303,9 @@ int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile)
return 1;
}
-const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
+char const* cmCPackIFWGenerator::GetPackagingInstallPrefix()
{
- const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
+ char const* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
std::string tmpPref = defPrefix ? defPrefix : "";
@@ -318,7 +318,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX")->c_str();
}
-const char* cmCPackIFWGenerator::GetOutputExtension()
+char const* cmCPackIFWGenerator::GetOutputExtension()
{
return this->OutputExtension.c_str();
}
@@ -327,9 +327,9 @@ int cmCPackIFWGenerator::InitializeInternal()
{
// Search Qt Installer Framework tools
- const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
- const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
- const std::string FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION";
+ std::string const BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
+ std::string const RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
+ std::string const FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION";
if (!this->IsSet(BinCreatorOpt) || !this->IsSet(RepoGenOpt) ||
!this->IsSet(FrameworkVersionOpt)) {
@@ -462,10 +462,10 @@ int cmCPackIFWGenerator::InitializeInternal()
}
std::string cmCPackIFWGenerator::GetComponentInstallSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
- const std::string prefix = "packages/";
- const std::string suffix = "/data";
+ std::string const prefix = "packages/";
+ std::string const suffix = "/data";
if (this->componentPackageMethod == this->ONE_PACKAGE) {
return cmStrCat(prefix, this->GetRootPackageName(), suffix);
@@ -476,10 +476,10 @@ std::string cmCPackIFWGenerator::GetComponentInstallSuffix(
}
std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
- const std::string prefix = "packages/";
- const std::string suffix = "/data";
+ std::string const prefix = "packages/";
+ std::string const suffix = "/data";
if (this->componentPackageMethod == this->ONE_PACKAGE) {
return cmStrCat(prefix, this->GetRootPackageName(), suffix);
@@ -492,7 +492,7 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
}
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
- const std::string& projectName, const std::string& componentName)
+ std::string const& projectName, std::string const& componentName)
{
auto cit = this->Components.find(componentName);
if (cit != this->Components.end()) {
@@ -537,7 +537,7 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
}
cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
- const std::string& projectName, const std::string& groupName)
+ std::string const& projectName, std::string const& groupName)
{
cmCPackComponentGroup* group =
this->cmCPackGenerator::GetComponentGroup(projectName, groupName);
@@ -682,7 +682,7 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
- const std::string& repositoryName)
+ std::string const& repositoryName)
{
auto rit = this->Repositories.find(repositoryName);
if (rit != this->Repositories.end()) {
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index e125be0..85d9eb9 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -59,18 +59,18 @@ protected:
*/
int InitializeInternal() override;
int PackageFiles() override;
- const char* GetPackagingInstallPrefix() override;
+ char const* GetPackagingInstallPrefix() override;
/**
* @brief Target binary extension
* @return Executable suffix or disk image format
*/
- const char* GetOutputExtension() override;
+ char const* GetOutputExtension() override;
std::string GetComponentInstallSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
/**
* @brief Get Component
@@ -81,8 +81,8 @@ protected:
*
* @return Pointer to component
*/
- cmCPackComponent* GetComponent(const std::string& projectName,
- const std::string& componentName) override;
+ cmCPackComponent* GetComponent(std::string const& projectName,
+ std::string const& componentName) override;
/**
* @brief Get group of component
@@ -94,7 +94,7 @@ protected:
* @return Pointer to component group
*/
cmCPackComponentGroup* GetComponentGroup(
- const std::string& projectName, const std::string& groupName) override;
+ std::string const& projectName, std::string const& groupName) override;
enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
const override;
@@ -114,7 +114,7 @@ protected:
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const;
- cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
+ cmCPackIFWRepository* GetRepository(std::string const& repositoryName);
protected:
// Data
@@ -143,10 +143,10 @@ protected:
private:
std::vector<std::string> BuildRepogenCommand();
- int RunRepogen(const std::string& ifwTmpFile);
+ int RunRepogen(std::string const& ifwTmpFile);
- std::vector<std::string> BuildBinaryCreatorCommmand();
- int RunBinaryCreator(const std::string& ifwTmpFile);
+ std::vector<std::string> BuildBinaryCreatorCommand();
+ int RunBinaryCreator(std::string const& ifwTmpFile);
std::string RepoGen;
std::string BinCreator;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index f2d7f1c..da373db 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackIFWInstaller.h"
#include <algorithm>
@@ -23,7 +23,7 @@
cmCPackIFWInstaller::cmCPackIFWInstaller() = default;
void cmCPackIFWInstaller::printSkippedOptionWarning(
- const std::string& optionName, const std::string& optionValue)
+ std::string const& optionName, std::string const& optionValue)
{
cmCPackIFWLogger(
WARNING,
@@ -293,7 +293,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
this->Resources.clear();
cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources);
- for (const auto& file : this->Resources) {
+ for (auto const& file : this->Resources) {
if (!cmSystemTools::FileExists(file)) {
// The warning will say skipped, but there will later be a hard error
// when the binarycreator tool tries to read the missing file.
@@ -308,7 +308,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->ProductImages.clear();
cmExpandList(productImages, this->ProductImages);
- auto erase_missing_file_pred = [this](const std::string& file) -> bool {
+ auto erase_missing_file_pred = [this](std::string const& file) -> bool {
if (!cmSystemTools::FileExists(file)) {
this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_PRODUCT_IMAGES",
file);
@@ -396,7 +396,7 @@ public:
std::string path, basePath;
protected:
- void StartElement(const std::string& name, const char** /*atts*/) override
+ void StartElement(std::string const& name, char const** /*atts*/) override
{
this->file = name == "file";
if (this->file) {
@@ -404,7 +404,7 @@ protected:
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
if (this->file) {
std::string content(data, data + length);
@@ -417,7 +417,7 @@ protected:
}
}
- void EndElement(const std::string& /*name*/) override {}
+ void EndElement(std::string const& /*name*/) override {}
};
void cmCPackIFWInstaller::GenerateInstallerFile()
@@ -621,7 +621,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
// RunProgramArguments
if (!this->RunProgramArguments.empty()) {
xout.StartElement("RunProgramArguments");
- for (const auto& arg : this->RunProgramArguments) {
+ for (auto const& arg : this->RunProgramArguments) {
xout.Element("Argument", arg);
}
xout.EndElement();
@@ -640,7 +640,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
// Product images (copy to config dir)
if (!this->IsVersionLess("4.0") && !this->ProductImages.empty()) {
xout.StartElement("ProductImages");
- const bool hasProductImageUrl = !this->ProductImageUrls.empty();
+ bool const hasProductImageUrl = !this->ProductImageUrls.empty();
for (size_t i = 0; i < this->ProductImages.size(); ++i) {
xout.StartElement("ProductImage");
auto const& srcImg = this->ProductImages[i];
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index fb980d7..fe8f37f 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -158,6 +158,6 @@ public:
std::string Directory;
protected:
- void printSkippedOptionWarning(const std::string& optionName,
- const std::string& optionValue);
+ void printSkippedOptionWarning(std::string const& optionName,
+ std::string const& optionValue);
};
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 083f1ef..5c101e9 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackIFWPackage.h"
#include <cstddef>
@@ -32,7 +32,7 @@ cmCPackIFWPackage::CompareStruct::CompareStruct()
cmCPackIFWPackage::DependenceStruct::DependenceStruct() = default;
cmCPackIFWPackage::DependenceStruct::DependenceStruct(
- const std::string& dependence)
+ std::string const& dependence)
{
// Preferred format is name and version are separated by a colon (:), but
// note that this is only supported with QtIFW 3.1 or later. Backward
@@ -51,7 +51,7 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
return;
}
- const auto versionPart =
+ auto const versionPart =
cm::string_view(dependence.data() + pos, dependence.size() - pos);
if (cmHasLiteralPrefix(versionPart, "<=")) {
@@ -339,7 +339,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
return this->ConfigureFromPrefix(prefix);
}
-int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
+int cmCPackIFWPackage::ConfigureFromGroup(std::string const& groupName)
{
// Group configuration
@@ -373,7 +373,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
}
// Common options for components and groups
-int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
+int cmCPackIFWPackage::ConfigureFromPrefix(std::string const& prefix)
{
// Temporary variable for full option name
std::string option;
@@ -635,7 +635,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Dependencies
- const bool hyphensInNamesUnsupported = this->Generator &&
+ bool const hyphensInNamesUnsupported = this->Generator &&
!this->Generator->FrameworkVersion.empty() && this->IsVersionLess("3.1");
bool warnUnsupportedNames = false;
std::set<DependenceStruct> compDepSet;
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 350f6b2..d6d6ba6 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,14 +44,14 @@ public:
struct DependenceStruct
{
DependenceStruct();
- explicit DependenceStruct(const std::string& dependence);
+ explicit DependenceStruct(std::string const& dependence);
std::string Name;
CompareStruct Compare;
std::string NameWithCompare() const;
- bool operator<(const DependenceStruct& other) const
+ bool operator<(DependenceStruct const& other) const
{
return this->Name < other.Name;
}
@@ -132,8 +132,8 @@ public:
int ConfigureFromOptions();
int ConfigureFromComponent(cmCPackComponent* component);
int ConfigureFromGroup(cmCPackComponentGroup* group);
- int ConfigureFromGroup(const std::string& groupName);
- int ConfigureFromPrefix(const std::string& prefix);
+ int ConfigureFromGroup(std::string const& groupName);
+ int ConfigureFromPrefix(std::string const& prefix);
void GeneratePackageFile();
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 46fc57f..67ef536 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackIFWRepository.h"
#include <cstddef>
@@ -107,13 +107,13 @@ bool cmCPackIFWRepository::ConfigureFromOptions()
return this->IsValid();
}
-/** \class cmCPackeIFWUpdatesPatcher
+/** \class cmCPackIFWUpdatesPatcher
* \brief Helper class that parses and patch Updates.xml file (QtIFW)
*/
-class cmCPackeIFWUpdatesPatcher : public cmXMLParser
+class cmCPackIFWUpdatesPatcher : public cmXMLParser
{
public:
- cmCPackeIFWUpdatesPatcher(cmCPackIFWRepository* r, cmXMLWriter& x)
+ cmCPackIFWUpdatesPatcher(cmCPackIFWRepository* r, cmXMLWriter& x)
: repository(r)
, xout(x)
{
@@ -124,22 +124,22 @@ public:
bool patched = false;
protected:
- void StartElement(const std::string& name, const char** atts) override
+ void StartElement(std::string const& name, char const** atts) override
{
this->xout.StartElement(name);
this->StartFragment(atts);
}
- void StartFragment(const char** atts)
+ void StartFragment(char const** atts)
{
for (size_t i = 0; atts[i]; i += 2) {
- const char* key = atts[i];
- const char* value = atts[i + 1];
+ char const* key = atts[i];
+ char const* value = atts[i + 1];
this->xout.Attribute(key, value);
}
}
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "Updates" && !this->patched) {
this->repository->WriteRepositoryUpdates(this->xout);
@@ -155,7 +155,7 @@ protected:
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
std::string content(data, data + length);
if (content.empty() || content == " " || content == " " ||
@@ -188,7 +188,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
// Patch
{
- cmCPackeIFWUpdatesPatcher patcher(this, xout);
+ cmCPackIFWUpdatesPatcher patcher(this, xout);
patcher.ParseFile(updatesXml.data());
}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
index 0153452..503cf45 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.h
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CPack/WiX/cmCMakeToWixPath.cxx b/Source/CPack/WiX/cmCMakeToWixPath.cxx
index 8738501..d7f37c6 100644
--- a/Source/CPack/WiX/cmCMakeToWixPath.cxx
+++ b/Source/CPack/WiX/cmCMakeToWixPath.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakeToWixPath.h"
#include <string>
@@ -9,7 +9,7 @@
#ifdef __CYGWIN__
# include <sys/cygwin.h>
-std::string CMakeToWixPath(const std::string& cygpath)
+std::string CMakeToWixPath(std::string const& cygpath)
{
std::vector<char> winpath_chars;
ssize_t winpath_size;
@@ -32,7 +32,7 @@ std::string CMakeToWixPath(const std::string& cygpath)
return cmTrimWhitespace(winpath_chars.data());
}
#else
-std::string CMakeToWixPath(const std::string& path)
+std::string CMakeToWixPath(std::string const& path)
{
return path;
}
diff --git a/Source/CPack/WiX/cmCMakeToWixPath.h b/Source/CPack/WiX/cmCMakeToWixPath.h
index 074cc8e..ec685cd 100644
--- a/Source/CPack/WiX/cmCMakeToWixPath.h
+++ b/Source/CPack/WiX/cmCMakeToWixPath.h
@@ -1,9 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" //IWYU pragma: keep
#include <string>
-std::string CMakeToWixPath(const std::string& cygpath);
+std::string CMakeToWixPath(std::string const& cygpath);
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 1e2d202..793e893 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackWIXGenerator.h"
#include <algorithm>
@@ -1224,7 +1224,7 @@ std::string cmCPackWIXGenerator::CreateHashedId(
cmCryptoHash sha1(cmCryptoHash::AlgoSHA1);
std::string const hash = sha1.HashString(path);
- const size_t maxFileNameLength = 52;
+ size_t const maxFileNameLength = 52;
std::string identifier =
cmStrCat(cm::string_view(hash).substr(0, 7), '_',
cm::string_view(normalizedFilename).substr(0, maxFileNameLength));
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 63530d4..49f20a7 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
@@ -24,8 +24,8 @@ public:
cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator);
cmCPackWIXGenerator();
- cmCPackWIXGenerator(const cmCPackWIXGenerator&) = delete;
- const cmCPackWIXGenerator& operator=(const cmCPackWIXGenerator&) = delete;
+ cmCPackWIXGenerator(cmCPackWIXGenerator const&) = delete;
+ cmCPackWIXGenerator const& operator=(cmCPackWIXGenerator const&) = delete;
~cmCPackWIXGenerator();
protected:
@@ -33,7 +33,7 @@ protected:
int PackageFiles() override;
- const char* GetOutputExtension() override { return ".msi"; }
+ char const* GetOutputExtension() override { return ".msi"; }
enum CPackSetDestdirSupport SupportsSetDestdir() const override
{
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
index 0ebe2f4..0755305 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.cxx
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXAccessControlList.h"
#include <cm/string_view>
@@ -50,14 +50,13 @@ void cmWIXAccessControlList::CreatePermissionElement(std::string const& entry)
user = user_and_domain;
}
- std::vector<std::string> permissions = cmTokenize(permission_string, ",");
-
this->SourceWriter.BeginElement("Permission");
this->SourceWriter.AddAttribute("User", std::string(user));
if (!domain.empty()) {
this->SourceWriter.AddAttribute("Domain", std::string(domain));
}
- for (std::string const& permission : permissions) {
+ for (auto permission :
+ cmTokenizedView(permission_string, ',', cmTokenizerMode::New)) {
this->EmitBooleanAttribute(entry, cmTrimWhitespace(permission));
}
this->SourceWriter.EndElement("Permission");
@@ -73,7 +72,7 @@ void cmWIXAccessControlList::ReportError(std::string const& entry,
bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name)
{
- static const char* validAttributes[] = {
+ static char const* validAttributes[] = {
/* clang-format needs this comment to break after the opening brace */
"Append",
"ChangePermission",
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.h b/Source/CPack/WiX/cmWIXAccessControlList.h
index ee5efa5..1543bc6 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.h
+++ b/Source/CPack/WiX/cmWIXAccessControlList.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmCPackLog.h"
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
index b1e7bd2..b6e3cd2 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXDirectoriesSourceWriter.h"
#include <cmext/string_view>
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
index b0aa1e2..5aa194d 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 0d2e6e8..f1ea439 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXFeaturesSourceWriter.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
index 95de8fe..67f0828 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmCPackGenerator.h"
@@ -19,10 +19,10 @@ public:
void CreateCMakePackageRegistryEntry(std::string const& package,
std::string const& upgradeGuid);
- void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group,
+ void EmitFeatureForComponentGroup(cmCPackComponentGroup const& group,
cmWIXPatch& patch);
- void EmitFeatureForComponent(const cmCPackComponent& component,
+ void EmitFeatureForComponent(cmCPackComponent const& component,
cmWIXPatch& patch);
void EmitComponentRef(std::string const& id);
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index 87ac6ac..d5a9f0f 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#if defined(__CYGWIN__)
// For S_IWRITE symbol
# define _DEFAULT_SOURCE
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index f560304..997c674 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx
index c65449c..09c0837 100644
--- a/Source/CPack/WiX/cmWIXPatch.cxx
+++ b/Source/CPack/WiX/cmWIXPatch.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXPatch.h"
#include "cmCPackGenerator.h"
@@ -30,7 +30,7 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
return;
}
- const cmWIXPatchElement& fragment = i->second;
+ cmWIXPatchElement const& fragment = i->second;
for (auto const& attr : fragment.attributes) {
writer.AddAttribute(attr.first, attr.second);
}
@@ -39,22 +39,22 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
Fragments.erase(i);
}
-void cmWIXPatch::ApplyElementChildren(const cmWIXPatchElement& element,
+void cmWIXPatch::ApplyElementChildren(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer)
{
- for (const auto& node : element.children) {
+ for (auto const& node : element.children) {
switch (node->type()) {
case cmWIXPatchNode::ELEMENT:
- ApplyElement(dynamic_cast<const cmWIXPatchElement&>(*node), writer);
+ ApplyElement(dynamic_cast<cmWIXPatchElement const&>(*node), writer);
break;
case cmWIXPatchNode::TEXT:
- writer.AddTextNode(dynamic_cast<const cmWIXPatchText&>(*node).text);
+ writer.AddTextNode(dynamic_cast<cmWIXPatchText const&>(*node).text);
break;
}
}
}
-void cmWIXPatch::ApplyElement(const cmWIXPatchElement& element,
+void cmWIXPatch::ApplyElement(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer)
{
writer.BeginElement(element.name);
diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h
index c78722d..5b71d84 100644
--- a/Source/CPack/WiX/cmWIXPatch.h
+++ b/Source/CPack/WiX/cmWIXPatch.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -22,10 +22,10 @@ public:
bool CheckForUnappliedFragments();
private:
- void ApplyElementChildren(const cmWIXPatchElement& element,
+ void ApplyElementChildren(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer);
- void ApplyElement(const cmWIXPatchElement& element,
+ void ApplyElement(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer);
cmCPackLog* Logger;
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 136eaac..298db22 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXPatchParser.h"
#include <utility>
@@ -35,7 +35,7 @@ cmWIXPatchParser::cmWIXPatchParser(fragment_map_t& fragments,
{
}
-void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
+void cmWIXPatchParser::StartElement(std::string const& name, char const** atts)
{
if (State == BEGIN_DOCUMENT) {
if (name == "CPackWiXPatch"_s) {
@@ -69,13 +69,13 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
}
}
-void cmWIXPatchParser::StartFragment(const char** attributes)
+void cmWIXPatchParser::StartFragment(char const** attributes)
{
cmWIXPatchElement* new_element = nullptr;
/* find the id of for fragment */
for (size_t i = 0; attributes[i]; i += 2) {
- const std::string key = attributes[i];
- const std::string value = attributes[i + 1];
+ std::string const key = attributes[i];
+ std::string const value = attributes[i + 1];
if (key == "Id"_s) {
if (Fragments.find(value) != Fragments.end()) {
@@ -94,8 +94,8 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
ReportValidationError("No 'Id' specified for 'CPackWixFragment' element");
} else {
for (size_t i = 0; attributes[i]; i += 2) {
- const std::string key = attributes[i];
- const std::string value = attributes[i + 1];
+ std::string const key = attributes[i];
+ std::string const value = attributes[i + 1];
if (key != "Id"_s) {
new_element->attributes[key] = value;
@@ -104,7 +104,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
}
}
-void cmWIXPatchParser::EndElement(const std::string& name)
+void cmWIXPatchParser::EndElement(std::string const& name)
{
if (State == INSIDE_FRAGMENT) {
if (name == "CPackWiXFragment"_s) {
@@ -116,9 +116,9 @@ void cmWIXPatchParser::EndElement(const std::string& name)
}
}
-void cmWIXPatchParser::CharacterDataHandler(const char* data, int length)
+void cmWIXPatchParser::CharacterDataHandler(char const* data, int length)
{
- const char* whitespace = "\x20\x09\x0d\x0a";
+ char const* whitespace = "\x20\x09\x0d\x0a";
if (State == INSIDE_FRAGMENT) {
cmWIXPatchElement& parent = *ElementStack.back();
@@ -137,7 +137,7 @@ void cmWIXPatchParser::CharacterDataHandler(const char* data, int length)
}
}
-void cmWIXPatchParser::ReportError(int line, int column, const char* msg)
+void cmWIXPatchParser::ReportError(int line, int column, char const* msg)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while processing XML patch file at "
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index 70a21bc..23ba047 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
@@ -35,8 +35,8 @@ struct cmWIXPatchElement : cmWIXPatchNode
cmWIXPatchElement();
- cmWIXPatchElement(const cmWIXPatchElement&) = delete;
- const cmWIXPatchElement& operator=(const cmWIXPatchElement&) = delete;
+ cmWIXPatchElement(cmWIXPatchElement const&) = delete;
+ cmWIXPatchElement const& operator=(cmWIXPatchElement const&) = delete;
~cmWIXPatchElement();
@@ -59,15 +59,15 @@ public:
cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
private:
- virtual void StartElement(const std::string& name, const char** atts);
+ virtual void StartElement(std::string const& name, char const** atts);
- void StartFragment(const char** attributes);
+ void StartFragment(char const** attributes);
- virtual void EndElement(const std::string& name);
+ virtual void EndElement(std::string const& name);
- virtual void CharacterDataHandler(const char* data, int length);
+ virtual void CharacterDataHandler(char const* data, int length);
- virtual void ReportError(int line, int column, const char* msg);
+ virtual void ReportError(int line, int column, char const* msg);
void ReportValidationError(std::string const& message);
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
index 8a63239..fc15686 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXRichTextFormatWriter.h"
#include "cmVersion.h"
@@ -128,7 +128,7 @@ void cmWIXRichTextFormatWriter::WriteDocumentPrefix()
{
ControlWord("viewkind4");
ControlWord("uc1");
- ControlWord("pard");
+ ControlWord("pard"); // noqa: spellcheck disable-line
ControlWord("f0");
ControlWord("fs14");
}
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index 99471f1..4c8b9f6 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CPack/WiX/cmWIXShortcut.cxx b/Source/CPack/WiX/cmWIXShortcut.cxx
index 1cfb6c1..bcc5af5 100644
--- a/Source/CPack/WiX/cmWIXShortcut.cxx
+++ b/Source/CPack/WiX/cmWIXShortcut.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXShortcut.h"
#include "cmWIXFilesSourceWriter.h"
diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h
index 315b5ea..05a1ae3 100644
--- a/Source/CPack/WiX/cmWIXShortcut.h
+++ b/Source/CPack/WiX/cmWIXShortcut.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index 33e8a70..ed3cbe0 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWIXSourceWriter.h"
#include <windows.h>
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 1089cf5..5e1150d 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index c70a2f1..bf97240 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackArchiveGenerator.h"
-#include <cstring>
#include <map>
#include <ostream>
#include <unordered_map>
@@ -46,8 +45,8 @@ private:
* @return DeduplicateStatus indicating whether to add, skip, or flag an
* error for the file.
*/
- DeduplicateStatus CompareFile(const std::string& path,
- const std::string& localTopLevel)
+ DeduplicateStatus CompareFile(std::string const& path,
+ std::string const& localTopLevel)
{
auto fileItr = this->Files.find(path);
if (fileItr != this->Files.end()) {
@@ -66,7 +65,7 @@ private:
* @param path The path of the folder to compare.
* @return DeduplicateStatus indicating whether to add or skip the folder.
*/
- DeduplicateStatus CompareFolder(const std::string& path)
+ DeduplicateStatus CompareFolder(std::string const& path)
{
if (this->Folders.find(path) != this->Folders.end()) {
return DeduplicateStatus::Skip;
@@ -83,7 +82,7 @@ private:
* @return DeduplicateStatus indicating whether to add, skip, or flag an
* error for the symlink.
*/
- DeduplicateStatus CompareSymlink(const std::string& path)
+ DeduplicateStatus CompareSymlink(std::string const& path)
{
auto symlinkItr = this->Symlink.find(path);
std::string symlinkValue;
@@ -113,8 +112,8 @@ public:
* @return DeduplicateStatus indicating the action to take for the given
* path.
*/
- DeduplicateStatus IsDeduplicate(const std::string& path,
- const std::string& localTopLevel)
+ DeduplicateStatus IsDeduplicate(std::string const& path,
+ std::string const& localTopLevel)
{
DeduplicateStatus status;
if (cmSystemTools::FileIsDirectory(path)) {
@@ -170,6 +169,12 @@ cmCPackGenerator* cmCPackArchiveGenerator::CreateTZSTGenerator()
".tar.zst");
}
+cmCPackGenerator* cmCPackArchiveGenerator::CreateTarGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "gnutar",
+ ".tar");
+}
+
cmCPackGenerator* cmCPackArchiveGenerator::CreateZIPGenerator()
{
return new cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip",
@@ -186,21 +191,35 @@ cmCPackArchiveGenerator::cmCPackArchiveGenerator(
cmCPackArchiveGenerator::~cmCPackArchiveGenerator() = default;
+std::string cmCPackArchiveGenerator::GetArchiveFileName()
+{
+ std::string packageFileName = this->toplevel + "/";
+ if (cmValue v = this->GetOptionIfSet("CPACK_ARCHIVE_FILE_NAME")) {
+ packageFileName += *v;
+ } else {
+ v = this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ packageFileName += *v;
+ }
+ packageFileName += this->GetOutputExtension();
+ return packageFileName;
+}
+
std::string cmCPackArchiveGenerator::GetArchiveComponentFileName(
- const std::string& component, bool isGroupName)
+ std::string const& component, bool isGroupName)
{
std::string componentUpper(cmSystemTools::UpperCase(component));
std::string packageFileName;
- if (this->IsSet("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME")) {
+ if (cmValue v = this->GetOptionIfSet("CPACK_ARCHIVE_" + componentUpper +
+ "_FILE_NAME")) {
+ packageFileName += *v;
+ } else if ((v = this->GetOptionIfSet("CPACK_ARCHIVE_FILE_NAME"))) {
packageFileName +=
- *this->GetOption("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME");
- } else if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) {
- packageFileName += this->GetComponentPackageFileName(
- *this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName);
+ this->GetComponentPackageFileName(*v, component, isGroupName);
} else {
- packageFileName += this->GetComponentPackageFileName(
- *this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName);
+ v = this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ packageFileName +=
+ this->GetComponentPackageFileName(*v, component, isGroupName);
}
packageFileName += this->GetOutputExtension();
@@ -238,10 +257,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
// Change to local toplevel
cmWorkingDirectory workdir(localToplevel);
if (workdir.Failed()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Failed to change working directory to "
- << localToplevel << " : "
- << std::strerror(workdir.GetLastResult()) << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_ERROR, workdir.GetError() << std::endl);
return 0;
}
std::string filePrefix;
@@ -395,16 +411,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne()
{
// reset the package file names
this->packageFileNames.clear();
- this->packageFileNames.emplace_back(this->toplevel);
- this->packageFileNames[0] += "/";
-
- if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) {
- this->packageFileNames[0] += *this->GetOption("CPACK_ARCHIVE_FILE_NAME");
- } else {
- this->packageFileNames[0] += *this->GetOption("CPACK_PACKAGE_FILE_NAME");
- }
-
- this->packageFileNames[0] += this->GetOutputExtension();
+ this->packageFileNames.emplace_back(this->GetArchiveFileName());
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging all groups in one package..."
@@ -445,13 +452,13 @@ int cmCPackArchiveGenerator::PackageFiles()
}
// CASE 3 : NON COMPONENT package.
+ this->packageFileNames.clear();
+ this->packageFileNames.emplace_back(this->GetArchiveFileName());
+
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive);
cmWorkingDirectory workdir(this->toplevel);
if (workdir.Failed()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Failed to change working directory to "
- << this->toplevel << " : "
- << std::strerror(workdir.GetLastResult()) << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_ERROR, workdir.GetError() << std::endl);
return 0;
}
for (std::string const& file : this->files) {
@@ -488,10 +495,10 @@ int cmCPackArchiveGenerator::GetThreadCount() const
int threads = 1;
// CPACK_ARCHIVE_THREADS overrides CPACK_THREADS
- if (this->IsSet("CPACK_ARCHIVE_THREADS")) {
- threads = std::stoi(*this->GetOption("CPACK_ARCHIVE_THREADS"));
- } else if (this->IsSet("CPACK_THREADS")) {
- threads = std::stoi(*this->GetOption("CPACK_THREADS"));
+ if (cmValue v = this->GetOptionIfSet("CPACK_ARCHIVE_THREADS")) {
+ threads = std::stoi(*v);
+ } else if (cmValue v2 = this->GetOptionIfSet("CPACK_THREADS")) {
+ threads = std::stoi(*v2);
}
return threads;
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index b8a1afa..fb56842 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,6 +29,7 @@ public:
static cmCPackGenerator* CreateTXZGenerator();
static cmCPackGenerator* CreateTZGenerator();
static cmCPackGenerator* CreateTZSTGenerator();
+ static cmCPackGenerator* CreateTarGenerator();
static cmCPackGenerator* CreateZIPGenerator();
/**
@@ -43,8 +44,9 @@ public:
bool SupportsComponentInstallation() const override;
private:
+ std::string GetArchiveFileName();
// get archive component filename
- std::string GetArchiveComponentFileName(const std::string& component,
+ std::string GetArchiveComponentFileName(std::string const& component,
bool isGroupName);
class Deduplicator;
@@ -82,9 +84,9 @@ protected:
int PackageComponentsAllInOne();
private:
- const char* GetNameOfClass() override { return "cmCPackArchiveGenerator"; }
+ char const* GetNameOfClass() override { return "cmCPackArchiveGenerator"; }
- const char* GetOutputExtension() override
+ char const* GetOutputExtension() override
{
return this->OutputExtension.c_str();
}
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index 37be798..82a4935 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackBundleGenerator.h"
#include <sstream>
@@ -27,8 +27,7 @@ int cmCPackBundleGenerator::InitializeInternal()
}
if (this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP")) {
- const std::string codesign_path = cmSystemTools::FindProgram(
- "codesign", std::vector<std::string>(), false);
+ std::string const codesign_path = cmSystemTools::FindProgram("codesign");
if (codesign_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -41,7 +40,7 @@ int cmCPackBundleGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
-const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
+char const* cmCPackBundleGenerator::GetPackagingInstallPrefix()
{
this->InstallPrefix = cmStrCat('/', this->GetOption("CPACK_BUNDLE_NAME"),
".app/Contents/Resources");
@@ -176,7 +175,7 @@ bool cmCPackBundleGenerator::SupportsComponentInstallation() const
return false;
}
-int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
+int cmCPackBundleGenerator::SignBundle(std::string const& src_dir)
{
cmValue cpack_apple_cert_app =
this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP");
@@ -189,7 +188,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
cmStrCat(src_dir, '/', this->GetOption("CPACK_BUNDLE_NAME"), ".app");
// A list of additional files to sign, ie. frameworks and plugins.
- const std::string sign_parameter =
+ std::string const sign_parameter =
this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER")
? *this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER")
: "--deep -f";
diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h
index 072d14f..8daf8ef 100644
--- a/Source/CPack/cmCPackBundleGenerator.h
+++ b/Source/CPack/cmCPackBundleGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,9 +24,9 @@ public:
protected:
int InitializeInternal() override;
- const char* GetPackagingInstallPrefix() override;
+ char const* GetPackagingInstallPrefix() override;
int ConstructBundle();
- int SignBundle(const std::string& src_dir);
+ int SignBundle(std::string const& src_dir);
int PackageFiles() override;
bool SupportsComponentInstallation() const override;
diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx
index 4305c7e..dfea6c3 100644
--- a/Source/CPack/cmCPackComponentGroup.cxx
+++ b/Source/CPack/cmCPackComponentGroup.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackComponentGroup.h"
#include <string>
@@ -8,7 +8,7 @@
#include "cmSystemTools.h"
unsigned long cmCPackComponent::GetInstalledSize(
- const std::string& installDir) const
+ std::string const& installDir) const
{
if (this->TotalSize != 0) {
return this->TotalSize;
@@ -23,7 +23,7 @@ unsigned long cmCPackComponent::GetInstalledSize(
}
unsigned long cmCPackComponent::GetInstalledSizeInKbytes(
- const std::string& installDir) const
+ std::string const& installDir) const
{
unsigned long result = (this->GetInstalledSize(installDir) + 512) / 1024;
return result ? result : 1;
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index 6a47b6d..4c70df7 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -94,11 +94,11 @@ public:
/// Get the total installed size of all of the files in this
/// component, in bytes. installDir is the directory into which the
/// component was installed.
- unsigned long GetInstalledSize(const std::string& installDir) const;
+ unsigned long GetInstalledSize(std::string const& installDir) const;
/// Identical to GetInstalledSize, but returns the result in
/// kilobytes.
- unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const;
+ unsigned long GetInstalledSizeInKbytes(std::string const& installDir) const;
private:
mutable unsigned long TotalSize = 0;
diff --git a/Source/CPack/cmCPackConfigure.h.in b/Source/CPack/cmCPackConfigure.h.in
index 2c1302d..523ff80 100644
--- a/Source/CPack/cmCPackConfigure.h.in
+++ b/Source/CPack/cmCPackConfigure.h.in
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#cmakedefine01 ENABLE_BUILD_WIX_GENERATOR
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
index fcb79a2..f5b98c4 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackCygwinBinaryGenerator.h"
#include "cmsys/SystemTools.hxx"
@@ -55,7 +55,7 @@ int cmCPackCygwinBinaryGenerator::PackageFiles()
return this->Superclass::PackageFiles();
}
-const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()
+char const* cmCPackCygwinBinaryGenerator::GetOutputExtension()
{
this->OutputExtension = "-";
cmValue patchNumber = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h
index ca8e0b5..2ddfd18 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.h
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmCPackArchiveGenerator.h"
@@ -21,6 +21,6 @@ public:
protected:
int InitializeInternal() override;
int PackageFiles() override;
- const char* GetOutputExtension() override;
+ char const* GetOutputExtension() override;
std::string OutputExtension;
};
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
index f025a6c..144d699 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackCygwinSourceGenerator.h"
#include "cmsys/SystemTools.hxx"
@@ -48,7 +48,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
// Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files
- const std::string& compressOutFile = packageDirFileName;
+ std::string const& compressOutFile = packageDirFileName;
// at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2
// we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2
@@ -120,7 +120,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
files.clear();
// a source release in cygwin should have the build script used
// to build the package, the patch file that is different from the
- // regular upstream version of the sources, and a bziped tar file
+ // regular upstream version of the sources, and a bzipped tar file
// of the original sources
files.push_back(buildScript);
files.push_back(patchFile);
@@ -135,14 +135,14 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
return 1;
}
-const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
+char const* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
{
this->InstallPrefix =
cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
return this->InstallPrefix.c_str();
}
-const char* cmCPackCygwinSourceGenerator::GetOutputExtension()
+char const* cmCPackCygwinSourceGenerator::GetOutputExtension()
{
this->OutputExtension = "-";
cmValue patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h
index 2207bde..8d81a7c 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.h
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmCPackArchiveGenerator.h"
@@ -19,10 +19,10 @@ public:
~cmCPackCygwinSourceGenerator() override;
protected:
- const char* GetPackagingInstallPrefix() override;
+ char const* GetPackagingInstallPrefix() override;
int InitializeInternal() override;
int PackageFiles() override;
- const char* GetOutputExtension() override;
+ char const* GetOutputExtension() override;
std::string InstallPrefix;
std::string OutputExtension;
};
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 14346b4..fd85b7c 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackDebGenerator.h"
#include <algorithm>
@@ -51,23 +51,23 @@ private:
bool generateDeb() const;
cmCPackLog* Logger;
- const std::string OutputName;
- const std::string WorkDir;
+ std::string const OutputName;
+ std::string const WorkDir;
std::string CompressionSuffix;
- const std::string TopLevelDir;
- const std::string TemporaryDir;
- const std::string DebianArchiveType;
+ std::string const TopLevelDir;
+ std::string const TemporaryDir;
+ std::string const DebianArchiveType;
long NumThreads;
- const std::map<std::string, std::string> ControlValues;
- const bool GenShLibs;
- const std::string ShLibsFilename;
- const bool GenPostInst;
- const std::string PostInst;
- const bool GenPostRm;
- const std::string PostRm;
+ std::map<std::string, std::string> const ControlValues;
+ bool const GenShLibs;
+ std::string const ShLibsFilename;
+ bool const GenPostInst;
+ std::string const PostInst;
+ bool const GenPostRm;
+ std::string const PostRm;
cmValue ControlExtra;
- const bool PermissionStrictPolicy;
- const std::vector<std::string> PackageFiles;
+ bool const PermissionStrictPolicy;
+ std::vector<std::string> const PackageFiles;
cmArchiveWrite::Compress TarCompressionType;
};
@@ -154,7 +154,7 @@ bool DebGenerator::generate() const
void DebGenerator::generateDebianBinaryFile() const
{
// debian-binary file
- const std::string dbfilename = this->WorkDir + "/debian-binary";
+ std::string const dbfilename = this->WorkDir + "/debian-binary";
cmGeneratedFileStream out;
out.Open(dbfilename, false, true);
out << "2.0\n"; // required for valid debian package
@@ -342,9 +342,9 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
and
https://lintian.debian.org/tags/control-file-has-bad-permissions.html
*/
- const mode_t permission644 = 0644;
- const mode_t permissionExecute = 0111;
- const mode_t permission755 = permission644 | permissionExecute;
+ mode_t const permission644 = 0644;
+ mode_t const permissionExecute = 0111;
+ mode_t const permission755 = permission644 | permissionExecute;
// for md5sum and control (that we have generated here), we use 644
// (RW-R--R--)
@@ -420,7 +420,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
if (this->ControlExtra) {
// permissions are now controlled by the original file permissions
- static const char* strictFiles[] = { "config", "postinst", "postrm",
+ static char const* strictFiles[] = { "config", "postinst", "postrm",
"preinst", "prerm" };
std::set<std::string> setStrictFiles(
strictFiles, strictFiles + sizeof(strictFiles) / sizeof(strictFiles[0]));
@@ -501,7 +501,7 @@ bool DebGenerator::generateDeb() const
return true;
}
-std::vector<std::string> findFilesIn(const std::string& path)
+std::vector<std::string> findFilesIn(std::string const& path)
{
cmsys::Glob gl;
std::string findExpr = path + "/*";
@@ -614,7 +614,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
//----------------------------------------------------------------------
int cmCPackDebGenerator::PackageComponentsAllInOne(
- const std::string& compInstDirName)
+ std::string const& compInstDirName)
{
/* Reset package file name list it will be populated during the
* component packaging run*/
@@ -684,12 +684,12 @@ int cmCPackDebGenerator::PackageFiles()
bool cmCPackDebGenerator::createDebPackages()
{
- auto make_package = [this](const std::string& path,
- const char* const output_var,
+ auto make_package = [this](std::string const& path,
+ char const* const output_var,
bool (cmCPackDebGenerator::*creator)()) -> bool {
try {
this->packageFiles = findFilesIn(path);
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
cmCPackLogger(cmCPackLog::LOG_ERROR, ex.what() << std::endl);
return false;
}
@@ -805,12 +805,12 @@ bool cmCPackDebGenerator::createDeb()
controlValues["Multi-Arch"] = *debian_pkg_multiarch;
}
- const std::string strGenWDIR(this->GetOption("GEN_WDIR"));
- const std::string shlibsfilename = strGenWDIR + "/shlibs";
+ std::string const strGenWDIR(this->GetOption("GEN_WDIR"));
+ std::string const shlibsfilename = strGenWDIR + "/shlibs";
cmValue debian_pkg_shlibs =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SHLIBS");
- const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") &&
+ bool const gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") &&
cmNonempty(debian_pkg_shlibs);
if (gen_shibs) {
cmGeneratedFileStream out;
@@ -819,8 +819,8 @@ bool cmCPackDebGenerator::createDeb()
out << '\n';
}
- const std::string postinst = strGenWDIR + "/postinst";
- const std::string postrm = strGenWDIR + "/postrm";
+ std::string const postinst = strGenWDIR + "/postinst";
+ std::string const postrm = strGenWDIR + "/postrm";
if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) {
cmGeneratedFileStream out;
out.Open(postinst, false, true);
@@ -915,7 +915,7 @@ bool cmCPackDebGenerator::SupportsComponentInstallation() const
}
std::string cmCPackDebGenerator::GetComponentInstallSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) {
return componentName;
@@ -935,7 +935,7 @@ std::string cmCPackDebGenerator::GetComponentInstallSuffix(
}
std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index 2a8c194..b450cbf 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -55,14 +55,14 @@ protected:
* Special case of component install where all
* components will be put in a single installer.
*/
- int PackageComponentsAllInOne(const std::string& compInstDirName);
+ int PackageComponentsAllInOne(std::string const& compInstDirName);
int PackageFiles() override;
- const char* GetOutputExtension() override { return ".deb"; }
+ char const* GetOutputExtension() override { return ".deb"; }
bool SupportsComponentInstallation() const override;
std::string GetComponentInstallSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
private:
bool createDebPackages();
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 5968159..1d55274 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackDragNDropGenerator.h"
#include <algorithm>
@@ -36,7 +36,7 @@
# include <CoreServices/CoreServices.h>
#endif
-static const uint16_t DefaultLpic[] = {
+static uint16_t const DefaultLpic[] = {
/* clang-format off */
0x0002, 0x0011, 0x0003, 0x0001, 0x0000, 0x0000, 0x0002, 0x0000,
0x0008, 0x0003, 0x0000, 0x0001, 0x0004, 0x0000, 0x0004, 0x0005,
@@ -48,7 +48,7 @@ static const uint16_t DefaultLpic[] = {
/* clang-format on */
};
-static const std::vector<std::string> DefaultMenu = {
+static std::vector<std::string> const DefaultMenu = {
{ "English", "Agree", "Disagree", "Print", "Save...",
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
"You agree to the License Agreement terms when "
@@ -76,8 +76,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
paths.emplace_back("/Applications/Xcode.app/Contents/Developer/Tools");
paths.emplace_back("/Developer/Tools");
- const std::string hdiutil_path =
- cmSystemTools::FindProgram("hdiutil", std::vector<std::string>(), false);
+ std::string const hdiutil_path = cmSystemTools::FindProgram("hdiutil");
if (hdiutil_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate hdiutil command" << std::endl);
@@ -85,8 +84,8 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_HDIUTIL", hdiutil_path);
- const std::string setfile_path =
- cmSystemTools::FindProgram("SetFile", paths, false);
+ std::string const setfile_path =
+ cmSystemTools::FindProgram("SetFile", paths);
if (setfile_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate SetFile command" << std::endl);
@@ -94,7 +93,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path);
- const std::string rez_path = cmSystemTools::FindProgram("Rez", paths, false);
+ std::string const rez_path = cmSystemTools::FindProgram("Rez", paths);
if (rez_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate Rez command" << std::endl);
@@ -102,13 +101,12 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_REZ", rez_path);
- if (this->IsSet("CPACK_DMG_SLA_DIR")) {
- slaDirectory = this->GetOption("CPACK_DMG_SLA_DIR");
+ if (cmValue v = this->GetOptionIfSet("CPACK_DMG_SLA_DIR")) {
+ slaDirectory = *v;
if (!slaDirectory.empty() &&
this->IsOn("CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE") &&
- this->IsSet("CPACK_RESOURCE_FILE_LICENSE")) {
- std::string license_file =
- this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
+ (v = this->GetOptionIfSet("CPACK_RESOURCE_FILE_LICENSE"))) {
+ std::string license_file = *v;
if (!license_file.empty() &&
(license_file.find("CPack.GenericLicense.txt") ==
std::string::npos)) {
@@ -120,7 +118,8 @@ int cmCPackDragNDropGenerator::InitializeInternal()
singleLicense = true;
}
}
- if (!this->IsSet("CPACK_DMG_SLA_LANGUAGES")) {
+ cmValue lang = this->GetOptionIfSet("CPACK_DMG_SLA_LANGUAGES");
+ if (!lang) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_DMG_SLA_DIR set but no languages defined "
"(set CPACK_DMG_SLA_LANGUAGES)"
@@ -133,7 +132,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
return 0;
}
- cmList languages{ this->GetOption("CPACK_DMG_SLA_LANGUAGES") };
+ cmList languages{ *lang };
if (languages.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl);
@@ -167,7 +166,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
-const char* cmCPackDragNDropGenerator::GetOutputExtension()
+char const* cmCPackDragNDropGenerator::GetOutputExtension()
{
return ".dmg";
}
@@ -267,22 +266,22 @@ bool cmCPackDragNDropGenerator::RunCommand(std::string const& command,
return true;
}
-int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
- const std::string& output_file)
+int cmCPackDragNDropGenerator::CreateDMG(std::string const& src_dir,
+ std::string const& output_file)
{
// Get optional arguments ...
cmValue cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON");
- const std::string cpack_dmg_volume_name =
+ std::string const cpack_dmg_volume_name =
this->GetOption("CPACK_DMG_VOLUME_NAME")
? *this->GetOption("CPACK_DMG_VOLUME_NAME")
: *this->GetOption("CPACK_PACKAGE_FILE_NAME");
- const std::string cpack_dmg_format = this->GetOption("CPACK_DMG_FORMAT")
+ std::string const cpack_dmg_format = this->GetOption("CPACK_DMG_FORMAT")
? *this->GetOption("CPACK_DMG_FORMAT")
: "UDZO";
- const std::string cpack_dmg_filesystem =
+ std::string const cpack_dmg_filesystem =
this->GetOption("CPACK_DMG_FILESYSTEM")
? *this->GetOption("CPACK_DMG_FILESYSTEM")
: "HFS+";
@@ -303,7 +302,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
cmValue cpack_dmg_ds_store_setup_script =
this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT");
- const bool cpack_dmg_disable_applications_symlink =
+ bool const cpack_dmg_disable_applications_symlink =
this->IsOn("CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK");
// only put license on dmg if is user provided
@@ -373,7 +372,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Make sure the background file type is the same as the custom image
// and that the file is hidden so it doesn't show up.
if (!cpack_dmg_background_image->empty()) {
- const std::string extension =
+ std::string const extension =
cmSystemTools::GetFilenameLastExtension(cpack_dmg_background_image);
std::ostringstream package_background_source;
package_background_source << cpack_dmg_background_image;
@@ -710,7 +709,7 @@ bool cmCPackDragNDropGenerator::SupportsComponentInstallation() const
}
std::string cmCPackDragNDropGenerator::GetComponentInstallSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
// we want to group components together that go in the same dmg package
std::string package_file_name = this->GetOption("CPACK_PACKAGE_FILE_NAME");
@@ -743,14 +742,14 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallSuffix(
std::string componentFileName = cmStrCat(
"CPACK_DMG_", cmSystemTools::UpperCase(componentName), "_FILE_NAME");
- if (this->IsSet(componentFileName)) {
- return this->GetOption(componentFileName);
+ if (cmValue v = this->GetOptionIfSet(componentFileName)) {
+ return *v;
}
return GetComponentPackageFileName(package_file_name, componentName, false);
}
std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));
@@ -815,7 +814,7 @@ void cmCPackDragNDropGenerator::WriteRezDict(cmXMLWriter& xml,
bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber,
std::string licenseLanguage,
- const std::string& licenseFile,
+ std::string const& licenseFile,
std::string* error)
{
if (!licenseFile.empty() && !singleLicense) {
@@ -920,11 +919,11 @@ bool cmCPackDragNDropGenerator::ReadFile(std::string const& file,
return true;
}
-bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line,
+bool cmCPackDragNDropGenerator::BreakLongLine(std::string const& line,
std::vector<std::string>& lines,
std::string* error)
{
- const size_t max_line_length = 255;
+ size_t const max_line_length = 255;
size_t line_length = max_line_length;
for (size_t i = 0; i < line.size(); i += line_length) {
line_length = max_line_length;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index 249f73e..accccc0 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,7 +27,7 @@ public:
protected:
int InitializeInternal() override;
- const char* GetOutputExtension() override;
+ char const* GetOutputExtension() override;
int PackageFiles() override;
bool SupportsComponentInstallation() const override;
@@ -36,11 +36,11 @@ protected:
bool RunCommand(std::string const& command, std::string* output = nullptr);
std::string GetComponentInstallSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
- int CreateDMG(const std::string& src_dir, const std::string& output_file);
+ int CreateDMG(std::string const& src_dir, std::string const& output_file);
private:
std::string slaDirectory;
@@ -73,11 +73,11 @@ private:
bool WriteLicense(RezDoc& rez, size_t licenseNumber,
std::string licenseLanguage,
- const std::string& licenseFile, std::string* error);
+ std::string const& licenseFile, std::string* error);
void EncodeLicense(RezDict& dict, std::vector<std::string> const& lines);
void EncodeMenu(RezDict& dict, std::vector<std::string> const& lines);
bool ReadFile(std::string const& file, std::vector<std::string>& lines,
std::string* error);
- bool BreakLongLine(const std::string& line, std::vector<std::string>& lines,
+ bool BreakLongLine(std::string const& line, std::vector<std::string>& lines,
std::string* error);
};
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 76cb876..351dba0 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackExternalGenerator.h"
#include <map>
@@ -95,7 +95,7 @@ bool cmCPackExternalGenerator::SupportsComponentInstallation() const
}
int cmCPackExternalGenerator::InstallProjectViaInstallCommands(
- bool setDestDir, const std::string& tempInstallDirectory)
+ bool setDestDir, std::string const& tempInstallDirectory)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::InstallProjectViaInstallCommands(
@@ -106,7 +106,7 @@ int cmCPackExternalGenerator::InstallProjectViaInstallCommands(
}
int cmCPackExternalGenerator::InstallProjectViaInstallScript(
- bool setDestDir, const std::string& tempInstallDirectory)
+ bool setDestDir, std::string const& tempInstallDirectory)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::InstallProjectViaInstallScript(
@@ -117,8 +117,8 @@ int cmCPackExternalGenerator::InstallProjectViaInstallScript(
}
int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories(
- bool setDestDir, const std::string& tempInstallDirectory,
- const mode_t* default_dir_mode)
+ bool setDestDir, std::string const& tempInstallDirectory,
+ mode_t const* default_dir_mode)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::InstallProjectViaInstalledDirectories(
@@ -129,8 +129,8 @@ int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories(
}
int cmCPackExternalGenerator::RunPreinstallTarget(
- const std::string& installProjectName, const std::string& installDirectory,
- cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
+ std::string const& installProjectName, std::string const& installDirectory,
+ cmGlobalGenerator* globalGenerator, std::string const& buildConfig)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::RunPreinstallTarget(
@@ -141,10 +141,10 @@ int cmCPackExternalGenerator::RunPreinstallTarget(
}
int cmCPackExternalGenerator::InstallCMakeProject(
- bool setDestDir, const std::string& installDirectory,
- const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode,
- const std::string& component, bool componentInstall,
- const std::string& installSubDirectory, const std::string& buildConfig,
+ bool setDestDir, std::string const& installDirectory,
+ std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode,
+ std::string const& component, bool componentInstall,
+ std::string const& installSubDirectory, std::string const& buildConfig,
std::string& absoluteDestFiles)
{
if (this->StagingEnabled()) {
diff --git a/Source/CPack/cmCPackExternalGenerator.h b/Source/CPack/cmCPackExternalGenerator.h
index dfd13e8..2055831 100644
--- a/Source/CPack/cmCPackExternalGenerator.h
+++ b/Source/CPack/cmCPackExternalGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
@@ -22,7 +22,7 @@ class cmCPackExternalGenerator : public cmCPackGenerator
public:
cmCPackTypeMacro(cmCPackExternalGenerator, cmCPackGenerator);
- const char* GetOutputExtension() override { return ".json"; }
+ char const* GetOutputExtension() override { return ".json"; }
protected:
int InitializeInternal() override;
@@ -32,23 +32,23 @@ protected:
bool SupportsComponentInstallation() const override;
int InstallProjectViaInstallCommands(
- bool setDestDir, const std::string& tempInstallDirectory) override;
+ bool setDestDir, std::string const& tempInstallDirectory) override;
int InstallProjectViaInstallScript(
- bool setDestDir, const std::string& tempInstallDirectory) override;
+ bool setDestDir, std::string const& tempInstallDirectory) override;
int InstallProjectViaInstalledDirectories(
- bool setDestDir, const std::string& tempInstallDirectory,
- const mode_t* default_dir_mode) override;
+ bool setDestDir, std::string const& tempInstallDirectory,
+ mode_t const* default_dir_mode) override;
- int RunPreinstallTarget(const std::string& installProjectName,
- const std::string& installDirectory,
+ int RunPreinstallTarget(std::string const& installProjectName,
+ std::string const& installDirectory,
cmGlobalGenerator* globalGenerator,
- const std::string& buildConfig) override;
- int InstallCMakeProject(bool setDestDir, const std::string& installDirectory,
- const std::string& baseTempInstallDirectory,
- const mode_t* default_dir_mode,
- const std::string& component, bool componentInstall,
- const std::string& installSubDirectory,
- const std::string& buildConfig,
+ std::string const& buildConfig) override;
+ int InstallCMakeProject(bool setDestDir, std::string const& installDirectory,
+ std::string const& baseTempInstallDirectory,
+ mode_t const* default_dir_mode,
+ std::string const& component, bool componentInstall,
+ std::string const& installSubDirectory,
+ std::string const& buildConfig,
std::string& absoluteDestFiles) override;
private:
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 6beb644..e4a308c 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackFreeBSDGenerator.h"
#include <algorithm>
@@ -22,8 +22,8 @@
#include "cmWorkingDirectory.h"
// Suffix used to tell libpkg what compression to use
-static const char FreeBSDPackageCompression[] = "txz";
-static const char FreeBSDPackageSuffix_17[] = ".pkg";
+static char const FreeBSDPackageCompression[] = "txz";
+static char const FreeBSDPackageSuffix_17[] = ".pkg";
cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator()
: cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr",
@@ -55,8 +55,8 @@ public:
: d(nullptr)
{
}
- PkgCreate(const std::string& output_dir, const std::string& toplevel_dir,
- const std::string& manifest_name)
+ PkgCreate(std::string const& output_dir, std::string const& toplevel_dir,
+ std::string const& manifest_name)
: d(pkg_create_new())
, manifest(manifest_name)
@@ -106,9 +106,9 @@ private:
class EscapeQuotes
{
public:
- const std::string& value;
+ std::string const& value;
- EscapeQuotes(const std::string& s)
+ EscapeQuotes(std::string const& s)
: value(s)
{
}
@@ -116,7 +116,7 @@ public:
// Output a string as "string" with escaping applied.
cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s,
- const EscapeQuotes& v)
+ EscapeQuotes const& v)
{
s << '"';
for (char c : v.value) {
@@ -179,7 +179,7 @@ class ManifestKeyValue : public ManifestKey
public:
std::string value;
- ManifestKeyValue(const std::string& k, std::string v)
+ ManifestKeyValue(std::string const& k, std::string v)
: ManifestKey(k)
, value(std::move(v))
{
@@ -198,18 +198,18 @@ public:
using VList = std::vector<std::string>;
VList value;
- ManifestKeyListValue(const std::string& k)
+ ManifestKeyListValue(std::string const& k)
: ManifestKey(k)
{
}
- ManifestKeyListValue& operator<<(const std::string& v)
+ ManifestKeyListValue& operator<<(std::string const& v)
{
value.push_back(v);
return *this;
}
- ManifestKeyListValue& operator<<(const std::vector<std::string>& v)
+ ManifestKeyListValue& operator<<(std::vector<std::string> const& v)
{
for (std::string const& e : v) {
(*this) << e;
@@ -237,7 +237,7 @@ public:
class ManifestKeyDepsValue : public ManifestKeyListValue
{
public:
- ManifestKeyDepsValue(const std::string& k)
+ ManifestKeyDepsValue(std::string const& k)
: ManifestKeyListValue(k)
{
}
@@ -254,7 +254,7 @@ public:
// Write one of the key-value classes (above) to the stream @p s
cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s,
- const ManifestKey& v)
+ ManifestKey const& v)
{
s << '"' << v.key << "\": ";
v.write_value(s);
@@ -264,7 +264,7 @@ cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s,
// Look up variable; if no value is set, returns an empty string;
// basically a wrapper that handles the nullptr return from GetOption().
-std::string cmCPackFreeBSDGenerator::var_lookup(const char* var_name)
+std::string cmCPackFreeBSDGenerator::var_lookup(char const* var_name)
{
cmValue pv = this->GetOption(var_name);
if (!pv) {
@@ -312,7 +312,7 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
// Package only actual files; others are ignored (in particular,
// intermediate subdirectories are ignored).
-static bool ignore_file(const std::string& filename)
+static bool ignore_file(std::string const& filename)
{
struct stat statbuf;
return stat(filename.c_str(), &statbuf) < 0 ||
@@ -325,8 +325,8 @@ static bool ignore_file(const std::string& filename)
// to paths relative to @p toplevel, with a leading / (since the paths
// in FreeBSD package files are supposed to be absolute).
void write_manifest_files(cmGeneratedFileStream& s,
- const std::string& toplevel,
- const std::vector<std::string>& files)
+ std::string const& toplevel,
+ std::vector<std::string> const& files)
{
s << "\"files\": {\n";
for (std::string const& file : files) {
@@ -405,7 +405,7 @@ int cmCPackFreeBSDGenerator::PackageFiles()
return 0;
}
- const std::string output_dir = cmSystemTools::GetFilenamePath(toplevel);
+ std::string const output_dir = cmSystemTools::GetFilenamePath(toplevel);
PkgCreate package(output_dir, toplevel, manifestname);
if (package.isValid()) {
if (!package.Create()) {
@@ -431,17 +431,17 @@ int cmCPackFreeBSDGenerator::PackageFiles()
}
}
- const std::string packageFileName =
+ std::string const packageFileName =
var_lookup("CPACK_PACKAGE_FILE_NAME") + FreeBSDPackageSuffix_17;
if (packageFileNames.size() == 1 && !packageFileName.empty() &&
packageFileNames[0] != packageFileName) {
// Since libpkg always writes <name>-<version>.<suffix>,
// if there is a CPACK_PACKAGE_FILE_NAME set, we need to
// rename, and then re-set the name.
- const std::string sourceFile = packageFileNames[0];
- const std::string packageSubDirectory =
+ std::string const sourceFile = packageFileNames[0];
+ std::string const packageSubDirectory =
cmSystemTools::GetParentDirectory(sourceFile);
- const std::string targetFileName =
+ std::string const targetFileName =
packageSubDirectory + '/' + packageFileName;
if (cmSystemTools::RenameFile(sourceFile, targetFileName)) {
this->packageFileNames.clear();
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.h b/Source/CPack/cmCPackFreeBSDGenerator.h
index eed8053..fae7604 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.h
+++ b/Source/CPack/cmCPackFreeBSDGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,6 +29,6 @@ public:
int PackageFiles() override;
protected:
- std::string var_lookup(const char* var_name);
+ std::string var_lookup(char const* var_name);
void write_manifest_fields(cmGeneratedFileStream&);
};
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 44d0ece..f725580 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1,9 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackGenerator.h"
#include <algorithm>
-#include <cstring>
#include <memory>
#include <utility>
@@ -51,11 +50,10 @@ cmCPackGenerator::~cmCPackGenerator()
this->MakefileMap = nullptr;
}
-void cmCPackGenerator::DisplayVerboseOutput(const std::string& msg,
- float progress)
+void cmCPackGenerator::DisplayVerboseOutput(std::string const& msg,
+ float /*unused*/)
{
- (void)progress;
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "" << msg << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, msg << std::endl);
}
int cmCPackGenerator::PrepareNames()
@@ -229,7 +227,7 @@ int cmCPackGenerator::InstallProject()
this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
if (cmNonempty(default_dir_install_permissions)) {
cmList items{ default_dir_install_permissions };
- for (const auto& arg : items) {
+ for (auto const& arg : items) {
if (!cmFSPermissions::stringToModeT(arg, default_dir_mode_v)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Invalid permission value '"
@@ -277,8 +275,8 @@ int cmCPackGenerator::InstallProject()
// Run pre-build actions
cmValue preBuildScripts = this->GetOption("CPACK_PRE_BUILD_SCRIPTS");
if (preBuildScripts) {
- const cmList scripts{ preBuildScripts };
- for (const auto& script : scripts) {
+ cmList const scripts{ preBuildScripts };
+ for (auto const& script : scripts) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Executing pre-build script: " << script << std::endl);
@@ -299,7 +297,7 @@ int cmCPackGenerator::InstallProject()
}
int cmCPackGenerator::InstallProjectViaInstallCommands(
- bool setDestDir, const std::string& tempInstallDirectory)
+ bool setDestDir, std::string const& tempInstallDirectory)
{
(void)setDestDir;
cmValue installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
@@ -335,8 +333,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
}
int cmCPackGenerator::InstallProjectViaInstalledDirectories(
- bool setDestDir, const std::string& tempInstallDirectory,
- const mode_t* default_dir_mode)
+ bool setDestDir, std::string const& tempInstallDirectory,
+ mode_t const* default_dir_mode)
{
(void)setDestDir;
(void)tempInstallDirectory;
@@ -364,7 +362,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
cmList::iterator it;
- const std::string& tempDir = tempInstallDirectory;
+ std::string const& tempDir = tempInstallDirectory;
for (it = installDirectoriesList.begin();
it != installDirectoriesList.end(); ++it) {
std::vector<std::pair<std::string, std::string>> symlinkedFiles;
@@ -434,10 +432,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
cmWorkingDirectory workdir(goToDir);
if (workdir.Failed()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Failed to change working directory to "
- << goToDir << " : "
- << std::strerror(workdir.GetLastResult())
- << std::endl);
+ workdir.GetError() << std::endl);
return 0;
}
for (auto const& symlinked : symlinkedFiles) {
@@ -475,7 +470,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
int cmCPackGenerator::InstallProjectViaInstallScript(
- bool setDestDir, const std::string& tempInstallDirectory)
+ bool setDestDir, std::string const& tempInstallDirectory)
{
cmValue cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPTS");
{
@@ -542,8 +537,8 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
}
int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
- bool setDestDir, const std::string& baseTempInstallDirectory,
- const mode_t* default_dir_mode)
+ bool setDestDir, std::string const& baseTempInstallDirectory,
+ mode_t const* default_dir_mode)
{
cmValue cmakeProjects = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
cmValue cmakeGenerator = this->GetOption("CPACK_CMAKE_GENERATOR");
@@ -684,11 +679,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
int cmCPackGenerator::RunPreinstallTarget(
- const std::string& installProjectName, const std::string& installDirectory,
- cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
+ std::string const& installProjectName, std::string const& installDirectory,
+ cmGlobalGenerator* globalGenerator, std::string const& buildConfig)
{
// Does this generator require pre-install?
- if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) {
+ if (char const* preinstall = globalGenerator->GetPreinstallTargetName()) {
std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
preinstall, buildConfig, "", "", false);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
@@ -722,10 +717,10 @@ int cmCPackGenerator::RunPreinstallTarget(
}
int cmCPackGenerator::InstallCMakeProject(
- bool setDestDir, const std::string& installDirectory,
- const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode,
- const std::string& component, bool componentInstall,
- const std::string& installSubDirectory, const std::string& buildConfig,
+ bool setDestDir, std::string const& installDirectory,
+ std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode,
+ std::string const& component, bool componentInstall,
+ std::string const& installSubDirectory, std::string const& buildConfig,
std::string& absoluteDestFiles)
{
std::string tempInstallDirectory = baseTempInstallDirectory;
@@ -741,7 +736,7 @@ int cmCPackGenerator::InstallCMakeProject(
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cm.AddCMakePaths();
- cm.SetProgressCallback([this](const std::string& msg, float prog) {
+ cm.SetProgressCallback([this](std::string const& msg, float prog) {
this->DisplayVerboseOutput(msg, prog);
});
cm.SetTrace(this->Trace);
@@ -1003,7 +998,7 @@ bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto,
return true;
}
-bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath,
+bool cmCPackGenerator::CopyPackageFile(std::string const& srcFilePath,
cm::string_view filename) const
{
std::string destFilePath =
@@ -1026,7 +1021,7 @@ bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath,
return true;
}
-bool cmCPackGenerator::ReadListFile(const char* moduleName)
+bool cmCPackGenerator::ReadListFile(char const* moduleName)
{
bool retval;
std::string fullPath = this->MakefileMap->GetModulesFile(moduleName);
@@ -1037,7 +1032,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
}
template <typename ValueType>
-void cmCPackGenerator::StoreOptionIfNotSet(const std::string& op,
+void cmCPackGenerator::StoreOptionIfNotSet(std::string const& op,
ValueType value)
{
cmValue def = this->MakefileMap->GetDefinition(op);
@@ -1047,18 +1042,18 @@ void cmCPackGenerator::StoreOptionIfNotSet(const std::string& op,
this->StoreOption(op, value);
}
-void cmCPackGenerator::SetOptionIfNotSet(const std::string& op,
- const char* value)
+void cmCPackGenerator::SetOptionIfNotSet(std::string const& op,
+ char const* value)
{
this->StoreOptionIfNotSet(op, value);
}
-void cmCPackGenerator::SetOptionIfNotSet(const std::string& op, cmValue value)
+void cmCPackGenerator::SetOptionIfNotSet(std::string const& op, cmValue value)
{
this->StoreOptionIfNotSet(op, value);
}
template <typename ValueType>
-void cmCPackGenerator::StoreOption(const std::string& op, ValueType value)
+void cmCPackGenerator::StoreOption(std::string const& op, ValueType value)
{
if (!value) {
this->MakefileMap->RemoveDefinition(op);
@@ -1070,11 +1065,11 @@ void cmCPackGenerator::StoreOption(const std::string& op, ValueType value)
this->MakefileMap->AddDefinition(op, value);
}
-void cmCPackGenerator::SetOption(const std::string& op, const char* value)
+void cmCPackGenerator::SetOption(std::string const& op, char const* value)
{
this->StoreOption(op, value);
}
-void cmCPackGenerator::SetOption(const std::string& op, cmValue value)
+void cmCPackGenerator::SetOption(std::string const& op, cmValue value)
{
this->StoreOption(op, value);
}
@@ -1191,8 +1186,8 @@ int cmCPackGenerator::DoPackage()
this->MakefileMap->AddDefinition(
"CPACK_PACKAGE_FILES", cmList::to_string(this->packageFileNames));
- const cmList scripts{ postBuildScripts };
- for (const auto& script : scripts) {
+ cmList const scripts{ postBuildScripts };
+ for (auto const& script : scripts) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Executing post-build script: " << script << std::endl);
@@ -1235,7 +1230,7 @@ int cmCPackGenerator::DoPackage()
return 1;
}
-int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf)
+int cmCPackGenerator::Initialize(std::string const& name, cmMakefile* mf)
{
this->MakefileMap = mf;
this->Name = name;
@@ -1318,17 +1313,26 @@ int cmCPackGenerator::InitializeInternal()
return 1;
}
-bool cmCPackGenerator::IsSet(const std::string& name) const
+bool cmCPackGenerator::IsSet(std::string const& name) const
{
return this->MakefileMap->IsSet(name);
}
-bool cmCPackGenerator::IsOn(const std::string& name) const
+cmValue cmCPackGenerator::GetOptionIfSet(std::string const& name) const
+{
+ cmValue ret = this->MakefileMap->GetDefinition(name);
+ if (!ret || ret->empty() || cmIsNOTFOUND(*ret)) {
+ return {};
+ }
+ return ret;
+}
+
+bool cmCPackGenerator::IsOn(std::string const& name) const
{
return this->GetOption(name).IsOn();
}
-bool cmCPackGenerator::IsSetToOff(const std::string& op) const
+bool cmCPackGenerator::IsSetToOff(std::string const& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (cmNonempty(ret)) {
@@ -1337,7 +1341,7 @@ bool cmCPackGenerator::IsSetToOff(const std::string& op) const
return false;
}
-bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const
+bool cmCPackGenerator::IsSetToEmpty(std::string const& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (ret) {
@@ -1346,7 +1350,7 @@ bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const
return false;
}
-cmValue cmCPackGenerator::GetOption(const std::string& op) const
+cmValue cmCPackGenerator::GetOption(std::string const& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (!ret) {
@@ -1366,7 +1370,7 @@ int cmCPackGenerator::PackageFiles()
return 0;
}
-const char* cmCPackGenerator::GetInstallPath()
+char const* cmCPackGenerator::GetInstallPath()
{
if (!this->InstallPath.empty()) {
return this->InstallPath.c_str();
@@ -1399,7 +1403,7 @@ const char* cmCPackGenerator::GetInstallPath()
return this->InstallPath.c_str();
}
-const char* cmCPackGenerator::GetPackagingInstallPrefix()
+char const* cmCPackGenerator::GetPackagingInstallPrefix()
{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"GetPackagingInstallPrefix: '"
@@ -1430,15 +1434,15 @@ std::string cmCPackGenerator::FindTemplate(cm::string_view name,
return ffile;
}
-bool cmCPackGenerator::ConfigureString(const std::string& inString,
+bool cmCPackGenerator::ConfigureString(std::string const& inString,
std::string& outString)
{
this->MakefileMap->ConfigureString(inString, outString, true, false);
return true;
}
-bool cmCPackGenerator::ConfigureFile(const std::string& inName,
- const std::string& outName,
+bool cmCPackGenerator::ConfigureFile(std::string const& inName,
+ std::string const& outName,
bool copyOnly /* = false */)
{
return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true,
@@ -1533,7 +1537,7 @@ int cmCPackGenerator::PrepareGroupingKind()
this->componentPackageMethod = method;
}
- const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE",
+ char const* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE",
"ONE_PER_GROUP", "UNKNOWN" };
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
@@ -1546,7 +1550,7 @@ int cmCPackGenerator::PrepareGroupingKind()
}
std::string cmCPackGenerator::GetSanitizedDirOrFileName(
- const std::string& name, bool isFullName) const
+ std::string const& name, bool isFullName) const
{
if (isFullName) {
#ifdef _WIN32
@@ -1573,10 +1577,10 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName(
}
#ifndef _WIN32
- constexpr const char* prohibited_chars = "<>\"/\\|?*`";
+ constexpr char const* prohibited_chars = "<>\"/\\|?*`";
#else
// Note: Windows also excludes the colon.
- constexpr const char* prohibited_chars = "<>\"/\\|?*`:";
+ constexpr char const* prohibited_chars = "<>\"/\\|?*`:";
#endif
// Given name contains non-supported character?
// Then return its MD5 hash.
@@ -1590,21 +1594,21 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName(
}
std::string cmCPackGenerator::GetComponentInstallSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
return componentName;
}
std::string cmCPackGenerator::GetComponentInstallDirNameSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));
}
std::string cmCPackGenerator::GetComponentPackageFileName(
- const std::string& initialPackageFileName,
- const std::string& groupOrComponentName, bool isGroupName)
+ std::string const& initialPackageFileName,
+ std::string const& groupOrComponentName, bool isGroupName)
{
/*
@@ -1663,7 +1667,7 @@ bool cmCPackGenerator::WantsComponentInstallation() const
}
cmCPackInstallationType* cmCPackGenerator::GetInstallationType(
- const std::string& projectName, const std::string& name)
+ std::string const& projectName, std::string const& name)
{
(void)projectName;
bool hasInstallationType = this->InstallationTypes.count(name) != 0;
@@ -1687,7 +1691,7 @@ cmCPackInstallationType* cmCPackGenerator::GetInstallationType(
}
cmCPackComponent* cmCPackGenerator::GetComponent(
- const std::string& projectName, const std::string& name)
+ std::string const& projectName, std::string const& name)
{
bool hasComponent = this->Components.count(name) != 0;
cmCPackComponent* component = &this->Components[name];
@@ -1756,7 +1760,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
}
cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup(
- const std::string& projectName, const std::string& name)
+ std::string const& projectName, std::string const& name)
{
(void)projectName;
std::string macroPrefix =
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 980ab8f..fb12989 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,7 +31,7 @@ class cmMakefile;
class cmCPackGenerator
{
public:
- virtual const char* GetNameOfClass() = 0;
+ virtual char const* GetNameOfClass() = 0;
/**
* If verbose then more information is printed out
*/
@@ -79,7 +79,7 @@ public:
/**
* Initialize generator
*/
- int Initialize(const std::string& name, cmMakefile* mf);
+ int Initialize(std::string const& name, cmMakefile* mf);
/**
* Construct generator
@@ -88,32 +88,33 @@ public:
virtual ~cmCPackGenerator();
//! Set and get the options
- void SetOption(const std::string& op, const char* value);
- void SetOption(const std::string& op, const std::string& value)
+ void SetOption(std::string const& op, char const* value);
+ void SetOption(std::string const& op, std::string const& value)
{
this->SetOption(op, cmValue(value));
}
- void SetOption(const std::string& op, cmValue value);
- void SetOptionIfNotSet(const std::string& op, const char* value);
- void SetOptionIfNotSet(const std::string& op, const std::string& value)
+ void SetOption(std::string const& op, cmValue value);
+ void SetOptionIfNotSet(std::string const& op, char const* value);
+ void SetOptionIfNotSet(std::string const& op, std::string const& value)
{
this->SetOptionIfNotSet(op, cmValue(value));
}
- void SetOptionIfNotSet(const std::string& op, cmValue value);
- cmValue GetOption(const std::string& op) const;
+ void SetOptionIfNotSet(std::string const& op, cmValue value);
+ cmValue GetOption(std::string const& op) const;
std::vector<std::string> GetOptions() const;
- bool IsSet(const std::string& name) const;
- bool IsOn(const std::string& name) const;
- bool IsSetToOff(const std::string& op) const;
- bool IsSetToEmpty(const std::string& op) const;
+ bool IsSet(std::string const& name) const;
+ cmValue GetOptionIfSet(std::string const& name) const;
+ bool IsOn(std::string const& name) const;
+ bool IsSetToOff(std::string const& op) const;
+ bool IsSetToEmpty(std::string const& op) const;
//! Set the logger
void SetLogger(cmCPackLog* log) { this->Logger = log; }
//! Display verbose information via logger
- void DisplayVerboseOutput(const std::string& msg, float progress);
+ void DisplayVerboseOutput(std::string const& msg, float progress);
- bool ReadListFile(const char* moduleName);
+ bool ReadListFile(char const* moduleName);
protected:
/**
@@ -131,8 +132,8 @@ protected:
cmInstalledFile const* GetInstalledFile(std::string const& name) const;
- virtual const char* GetOutputExtension() { return ".cpack"; }
- virtual const char* GetOutputPostfix() { return nullptr; }
+ virtual char const* GetOutputExtension() { return ".cpack"; }
+ virtual char const* GetOutputPostfix() { return nullptr; }
/**
* Prepare requested grouping kind from CPACK_xxx vars
@@ -153,7 +154,7 @@ protected:
* directory or file. (Defaults to true.)
* @return the sanitized name.
*/
- virtual std::string GetSanitizedDirOrFileName(const std::string& name,
+ virtual std::string GetSanitizedDirOrFileName(std::string const& name,
bool isFullName = true) const;
/**
@@ -167,7 +168,7 @@ protected:
* default is "componentName"
*/
virtual std::string GetComponentInstallSuffix(
- const std::string& componentName);
+ std::string const& componentName);
/**
* The value that GetComponentInstallSuffix returns, but sanitized.
@@ -177,7 +178,7 @@ protected:
* default is "componentName".
*/
virtual std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName);
+ std::string const& componentName);
/**
* CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME
@@ -189,8 +190,8 @@ protected:
* false otherwise
*/
virtual std::string GetComponentPackageFileName(
- const std::string& initialPackageFileName,
- const std::string& groupOrComponentName, bool isGroupName);
+ std::string const& initialPackageFileName,
+ std::string const& groupOrComponentName, bool isGroupName);
/**
* Package the list of files and/or components which
@@ -202,44 +203,44 @@ protected:
* the list of packages generated by the specific generator.
*/
virtual int PackageFiles();
- virtual const char* GetInstallPath();
- virtual const char* GetPackagingInstallPrefix();
+ virtual char const* GetInstallPath();
+ virtual char const* GetPackagingInstallPrefix();
bool GenerateChecksumFile(cmCryptoHash& crypto,
cm::string_view filename) const;
- bool CopyPackageFile(const std::string& srcFilePath,
+ bool CopyPackageFile(std::string const& 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,
+ virtual bool ConfigureFile(std::string const& inName,
+ std::string const& outName,
bool copyOnly = false);
- virtual bool ConfigureString(const std::string& input, std::string& output);
+ virtual bool ConfigureString(std::string const& input, std::string& output);
virtual int InitializeInternal();
//! Run install commands if specified
virtual int InstallProjectViaInstallCommands(
- bool setDestDir, const std::string& tempInstallDirectory);
+ bool setDestDir, std::string const& tempInstallDirectory);
virtual int InstallProjectViaInstallScript(
- bool setDestDir, const std::string& tempInstallDirectory);
+ bool setDestDir, std::string const& tempInstallDirectory);
virtual int InstallProjectViaInstalledDirectories(
- bool setDestDir, const std::string& tempInstallDirectory,
- const mode_t* default_dir_mode);
+ bool setDestDir, std::string const& tempInstallDirectory,
+ mode_t const* default_dir_mode);
virtual int InstallProjectViaInstallCMakeProjects(
- bool setDestDir, const std::string& tempInstallDirectory,
- const mode_t* default_dir_mode);
+ bool setDestDir, std::string const& tempInstallDirectory,
+ mode_t const* default_dir_mode);
- virtual int RunPreinstallTarget(const std::string& installProjectName,
- const std::string& installDirectory,
+ virtual int RunPreinstallTarget(std::string const& installProjectName,
+ std::string const& installDirectory,
cmGlobalGenerator* globalGenerator,
- const std::string& buildConfig);
+ std::string const& buildConfig);
virtual int InstallCMakeProject(
- bool setDestDir, const std::string& installDirectory,
- const std::string& baseTempInstallDirectory,
- const mode_t* default_dir_mode, const std::string& component,
- bool componentInstall, const std::string& installSubDirectory,
- const std::string& buildConfig, std::string& absoluteDestFiles);
+ bool setDestDir, std::string const& installDirectory,
+ std::string const& baseTempInstallDirectory,
+ mode_t const* default_dir_mode, std::string const& component,
+ bool componentInstall, std::string const& installSubDirectory,
+ std::string const& buildConfig, std::string& absoluteDestFiles);
/**
* The various level of support of
@@ -290,11 +291,11 @@ protected:
*/
virtual bool WantsComponentInstallation() const;
virtual cmCPackInstallationType* GetInstallationType(
- const std::string& projectName, const std::string& name);
- virtual cmCPackComponent* GetComponent(const std::string& projectName,
- const std::string& name);
+ std::string const& projectName, std::string const& name);
+ virtual cmCPackComponent* GetComponent(std::string const& projectName,
+ std::string const& name);
virtual cmCPackComponentGroup* GetComponentGroup(
- const std::string& projectName, const std::string& name);
+ std::string const& projectName, std::string const& name);
cmSystemTools::OutputOption GeneratorVerbose;
std::string Name;
@@ -369,9 +370,9 @@ protected:
private:
template <typename ValueType>
- void StoreOption(const std::string& op, ValueType value);
+ void StoreOption(std::string const& op, ValueType value);
template <typename ValueType>
- void StoreOptionIfNotSet(const std::string& op, ValueType value);
+ void StoreOptionIfNotSet(std::string const& op, ValueType value);
};
#define cmCPackTypeMacro(klass, superclass) \
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 6ca48bf..daf9fa6 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackGeneratorFactory.h"
#include <ostream>
@@ -54,6 +54,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
cmCPackArchiveGenerator::CreateTZGenerator);
this->RegisterGenerator("TZST", "Tar Zstandard compression",
cmCPackArchiveGenerator::CreateTZSTGenerator);
+ this->RegisterGenerator("TAR", "Tar no compression",
+ cmCPackArchiveGenerator::CreateTarGenerator);
this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackArchiveGenerator::CreateZIPGenerator);
}
@@ -133,7 +135,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
}
std::unique_ptr<cmCPackGenerator> cmCPackGeneratorFactory::NewGenerator(
- const std::string& name)
+ std::string const& name)
{
auto it = this->GeneratorCreators.find(name);
if (it == this->GeneratorCreators.end()) {
@@ -148,7 +150,7 @@ std::unique_ptr<cmCPackGenerator> cmCPackGeneratorFactory::NewGenerator(
}
void cmCPackGeneratorFactory::RegisterGenerator(
- const std::string& name, const char* generatorDescription,
+ std::string const& name, char const* generatorDescription,
CreateGeneratorCall* createGenerator)
{
if (!createGenerator) {
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 52c1b5c..f8f964d 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,18 +23,18 @@ public:
cmCPackGeneratorFactory();
//! Get the generator
- std::unique_ptr<cmCPackGenerator> NewGenerator(const std::string& name);
+ std::unique_ptr<cmCPackGenerator> NewGenerator(std::string const& name);
using CreateGeneratorCall = cmCPackGenerator*();
- void RegisterGenerator(const std::string& name,
- const char* generatorDescription,
+ void RegisterGenerator(std::string const& name,
+ char const* generatorDescription,
CreateGeneratorCall* createGenerator);
void SetLogger(cmCPackLog* logger) { this->Logger = logger; }
using DescriptionsMap = std::map<std::string, std::string>;
- const DescriptionsMap& GetGeneratorsList() const
+ DescriptionsMap const& GetGeneratorsList() const
{
return this->GeneratorDescriptions;
}
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx
index 35d126f..ed0b2c4 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.cxx
+++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-file Copyright.txt or https://cmake.org/licensing for details. */
+file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackInnoSetupGenerator.h"
@@ -46,8 +46,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
#endif
SetOptionIfNotSet("CPACK_INNOSETUP_EXECUTABLE", "ISCC");
- const std::string& isccPath = cmSystemTools::FindProgram(
- GetOption("CPACK_INNOSETUP_EXECUTABLE"), path, false);
+ std::string const& isccPath =
+ cmSystemTools::FindProgram(GetOption("CPACK_INNOSETUP_EXECUTABLE"), path);
if (isccPath.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -58,7 +58,7 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
return 0;
}
- const std::string isccCmd =
+ std::string const isccCmd =
cmStrCat(QuotePath(isccPath, PathType::Native), "/?");
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Test Inno Setup version: " << isccCmd << std::endl);
@@ -76,8 +76,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
return 0;
}
- const int isccVersion = atoi(vRex.match(1).c_str());
- const int minIsccVersion = 6;
+ int const isccVersion = atoi(vRex.match(1).c_str());
+ int const minIsccVersion = 6;
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Inno Setup Version: " << isccVersion << std::endl);
@@ -97,10 +97,9 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
int cmCPackInnoSetupGenerator::PackageFiles()
{
// Includes
- if (IsSet("CPACK_INNOSETUP_EXTRA_SCRIPTS")) {
- const cmList extraScripts(GetOption("CPACK_INNOSETUP_EXTRA_SCRIPTS"));
-
- for (const std::string& i : extraScripts) {
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_EXTRA_SCRIPTS")) {
+ cmList const extraScripts(*v);
+ for (std::string const& i : extraScripts) {
includeDirectives.emplace_back(cmStrCat(
"#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel))));
}
@@ -108,7 +107,7 @@ int cmCPackInnoSetupGenerator::PackageFiles()
// [Languages] section
SetOptionIfNotSet("CPACK_INNOSETUP_LANGUAGES", "english");
- const cmList languages(GetOption("CPACK_INNOSETUP_LANGUAGES"));
+ cmList const languages(GetOption("CPACK_INNOSETUP_LANGUAGES"));
for (std::string i : languages) {
cmCPackInnoSetupKeyValuePairs params;
@@ -133,10 +132,9 @@ int cmCPackInnoSetupGenerator::PackageFiles()
}
// [Code] section
- if (IsSet("CPACK_INNOSETUP_CODE_FILES")) {
- const cmList codeFiles(GetOption("CPACK_INNOSETUP_CODE_FILES"));
-
- for (const std::string& i : codeFiles) {
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_CODE_FILES")) {
+ cmList const codeFiles(*v);
+ for (std::string const& i : codeFiles) {
codeIncludes.emplace_back(cmStrCat(
"#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel))));
}
@@ -168,26 +166,26 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection()
}
setupDirectives["AppPublisher"] = GetOption("CPACK_PACKAGE_VENDOR");
- if (IsSet("CPACK_PACKAGE_HOMEPAGE_URL")) {
- setupDirectives["AppPublisherURL"] =
- GetOption("CPACK_PACKAGE_HOMEPAGE_URL");
- setupDirectives["AppSupportURL"] = GetOption("CPACK_PACKAGE_HOMEPAGE_URL");
- setupDirectives["AppUpdatesURL"] = GetOption("CPACK_PACKAGE_HOMEPAGE_URL");
+ if (cmValue v = GetOptionIfSet("CPACK_PACKAGE_HOMEPAGE_URL")) {
+ setupDirectives["AppPublisherURL"] = *v;
+ setupDirectives["AppSupportURL"] = *v;
+ setupDirectives["AppUpdatesURL"] = *v;
}
SetOptionIfNotSet("CPACK_INNOSETUP_IGNORE_LICENSE_PAGE", "OFF");
- if (IsSet("CPACK_RESOURCE_FILE_LICENSE") &&
- !GetOption("CPACK_INNOSETUP_IGNORE_LICENSE_PAGE").IsOn()) {
- setupDirectives["LicenseFile"] = cmSystemTools::ConvertToWindowsOutputPath(
- GetOption("CPACK_RESOURCE_FILE_LICENSE"));
+ if (!GetOption("CPACK_INNOSETUP_IGNORE_LICENSE_PAGE").IsOn()) {
+ if (cmValue v = GetOptionIfSet("CPACK_RESOURCE_FILE_LICENSE")) {
+ setupDirectives["LicenseFile"] =
+ cmSystemTools::ConvertToWindowsOutputPath(*v);
+ }
}
SetOptionIfNotSet("CPACK_INNOSETUP_IGNORE_README_PAGE", "ON");
- if (IsSet("CPACK_RESOURCE_FILE_README") &&
- !GetOption("CPACK_INNOSETUP_IGNORE_README_PAGE").IsOn()) {
- setupDirectives["InfoBeforeFile"] =
- cmSystemTools::ConvertToWindowsOutputPath(
- GetOption("CPACK_RESOURCE_FILE_README"));
+ if (!GetOption("CPACK_INNOSETUP_IGNORE_README_PAGE").IsOn()) {
+ if (cmValue v = GetOptionIfSet("CPACK_RESOURCE_FILE_README")) {
+ setupDirectives["InfoBeforeFile"] =
+ cmSystemTools::ConvertToWindowsOutputPath(*v);
+ }
}
SetOptionIfNotSet("CPACK_INNOSETUP_USE_MODERN_WIZARD", "OFF");
@@ -201,16 +199,14 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection()
setupDirectives["SetupIconFile"] = "compiler:SetupClassicIcon.ico";
}
- if (IsSet("CPACK_INNOSETUP_ICON_FILE")) {
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_ICON_FILE")) {
setupDirectives["SetupIconFile"] =
- cmSystemTools::ConvertToWindowsOutputPath(
- GetOption("CPACK_INNOSETUP_ICON_FILE"));
+ cmSystemTools::ConvertToWindowsOutputPath(*v);
}
- if (IsSet("CPACK_PACKAGE_ICON")) {
+ if (cmValue v = GetOptionIfSet("CPACK_PACKAGE_ICON")) {
setupDirectives["WizardSmallImageFile"] =
- cmSystemTools::ConvertToWindowsOutputPath(
- GetOption("CPACK_PACKAGE_ICON"));
+ cmSystemTools::ConvertToWindowsOutputPath(*v);
}
if (!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
@@ -238,8 +234,8 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection()
toplevelProgramFolder = false;
}
- if (IsSet("CPACK_INNOSETUP_PASSWORD")) {
- setupDirectives["Password"] = GetOption("CPACK_INNOSETUP_PASSWORD");
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_PASSWORD")) {
+ setupDirectives["Password"] = *v;
setupDirectives["Encryption"] = "yes";
}
@@ -292,9 +288,9 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection()
* Handle custom directives (they have higher priority than other variables,
* so they have to be processed after all other variables)
*/
- for (const std::string& i : GetOptions()) {
+ for (std::string const& i : GetOptions()) {
if (cmHasPrefix(i, "CPACK_INNOSETUP_SETUP_")) {
- const std::string& directive =
+ std::string const& directive =
i.substr(cmStrLen("CPACK_INNOSETUP_SETUP_"));
setupDirectives[directive] = GetOption(i);
}
@@ -306,9 +302,9 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection()
bool cmCPackInnoSetupGenerator::ProcessFiles()
{
std::map<std::string, std::string> customFileInstructions;
- if (IsSet("CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS")) {
- const cmList instructions(
- GetOption("CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS"));
+ if (cmValue v =
+ GetOptionIfSet("CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS")) {
+ cmList const instructions(*v);
if (instructions.size() % 2 != 0) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS should "
@@ -318,18 +314,18 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
}
for (auto it = instructions.begin(); it != instructions.end(); ++it) {
- const std::string& key =
+ std::string const& key =
QuotePath(cmSystemTools::CollapseFullPath(*it, toplevel));
customFileInstructions[key] = *(++it);
}
}
- const std::string& iconsPrefix =
+ std::string const& iconsPrefix =
toplevelProgramFolder ? "{autoprograms}\\" : "{group}\\";
std::map<std::string, std::string> icons;
- if (IsSet("CPACK_PACKAGE_EXECUTABLES")) {
- const cmList executables(GetOption("CPACK_PACKAGE_EXECUTABLES"));
+ if (cmValue v = GetOptionIfSet("CPACK_PACKAGE_EXECUTABLES")) {
+ cmList const executables(*v);
if (executables.size() % 2 != 0) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_PACKAGE_EXECUTABLES should should contain pairs of "
@@ -339,22 +335,22 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
}
for (auto it = executables.begin(); it != executables.end(); ++it) {
- const std::string& key = *it;
+ std::string const& key = *it;
icons[key] = *(++it);
}
}
std::vector<std::string> desktopIcons;
- if (IsSet("CPACK_CREATE_DESKTOP_LINKS")) {
- cmExpandList(GetOption("CPACK_CREATE_DESKTOP_LINKS"), desktopIcons);
+ if (cmValue v = GetOptionIfSet("CPACK_CREATE_DESKTOP_LINKS")) {
+ cmExpandList(*v, desktopIcons);
}
std::vector<std::string> runExecutables;
- if (IsSet("CPACK_INNOSETUP_RUN_EXECUTABLES")) {
- cmExpandList(GetOption("CPACK_INNOSETUP_RUN_EXECUTABLES"), runExecutables);
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_RUN_EXECUTABLES")) {
+ cmExpandList(*v, runExecutables);
}
- for (const std::string& i : files) {
+ for (std::string const& i : files) {
cmCPackInnoSetupKeyValuePairs params;
std::string toplevelDirectory;
@@ -362,12 +358,12 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
cmCPackComponent* component = nullptr;
std::string componentParam;
if (!Components.empty()) {
- const std::string& fileName = cmSystemTools::RelativePath(toplevel, i);
- const std::string::size_type pos = fileName.find('/');
+ std::string const& fileName = cmSystemTools::RelativePath(toplevel, i);
+ std::string::size_type const pos = fileName.find('/');
// Use the custom component install directory if we have one
if (pos != std::string::npos) {
- const std::string& componentName = fileName.substr(0, pos);
+ std::string const& componentName = fileName.substr(0, pos);
component = &Components[componentName];
toplevelDirectory =
@@ -424,10 +420,10 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
params["DestDir"] = QuotePath(destDir);
if (component && component->IsDownloaded) {
- const std::string& archiveName =
+ std::string const& archiveName =
cmSystemTools::GetFilenameWithoutLastExtension(
component->ArchiveFile);
- const std::string& relativePath =
+ std::string const& relativePath =
cmSystemTools::RelativePath(toplevelDirectory, i);
params["Source"] =
@@ -448,9 +444,9 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
fileInstructions.push_back(ISKeyValueLine(params));
// Icon
- const std::string& name =
+ std::string const& name =
cmSystemTools::GetFilenameWithoutLastExtension(i);
- const std::string& extension =
+ std::string const& extension =
cmSystemTools::GetFilenameLastExtension(i);
if ((extension == ".exe" || extension == ".com") && // only .exe, .com
icons.count(name)) {
@@ -507,8 +503,8 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
static cmsys::RegularExpression urlRegex(
"^(mailto:|(ftps?|https?|news)://).*$");
- if (IsSet("CPACK_INNOSETUP_MENU_LINKS")) {
- const cmList menuIcons(GetOption("CPACK_INNOSETUP_MENU_LINKS"));
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_MENU_LINKS")) {
+ cmList const menuIcons(*v);
if (menuIcons.size() % 2 != 0) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_INNOSETUP_MENU_LINKS should "
@@ -518,8 +514,8 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
}
for (auto it = menuIcons.begin(); it != menuIcons.end(); ++it) {
- const std::string& target = *it;
- const std::string& label = *(++it);
+ std::string const& target = *it;
+ std::string const& label = *(++it);
cmCPackInnoSetupKeyValuePairs params;
params["Name"] = QuotePath(cmStrCat(iconsPrefix, label));
@@ -528,7 +524,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
} else {
std::string dir = "{app}";
std::string componentName;
- for (const auto& i : Components) {
+ for (auto const& i : Components) {
if (cmSystemTools::FileExists(cmSystemTools::CollapseFullPath(
cmStrCat(i.second.Name, '\\', target), toplevel))) {
dir = CustomComponentInstallDirectory(&i.second);
@@ -688,10 +684,10 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
}
SetOptionIfNotSet("CPACK_INNOSETUP_VERIFY_DOWNLOADS", "ON");
- const bool verifyDownloads =
+ bool const verifyDownloads =
GetOption("CPACK_INNOSETUP_VERIFY_DOWNLOADS").IsOn();
- const std::string& urlPrefix =
+ std::string const& urlPrefix =
cmHasSuffix(GetOption("CPACK_DOWNLOAD_SITE").GetCStr(), '/')
? GetOption("CPACK_DOWNLOAD_SITE")
: cmStrCat(GetOption("CPACK_DOWNLOAD_SITE"), '/');
@@ -726,7 +722,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
SetOption("CPACK_INNOSETUP_DOWNLOAD_COMPONENTS_INTERNAL",
cmJoin(archiveComponents, ", "));
- static const std::string& downloadLines =
+ static std::string const& downloadLines =
"#define protected CPackDownloadCount "
"@CPACK_INNOSETUP_DOWNLOAD_COUNT_INTERNAL@\n"
"#dim protected CPackDownloadUrls[CPackDownloadCount] "
@@ -746,7 +742,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
}
// Add the required script
- const std::string& componentsScriptTemplate =
+ std::string const& componentsScriptTemplate =
FindTemplate("ISComponents.pas");
if (componentsScriptTemplate.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -763,8 +759,8 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
bool cmCPackInnoSetupGenerator::ConfigureISScript()
{
- const std::string& isScriptTemplate = FindTemplate("ISScript.template.in");
- const std::string& isScriptFile =
+ std::string const& isScriptTemplate = FindTemplate("ISScript.template.in");
+ std::string const& isScriptFile =
cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISScript.iss");
if (isScriptTemplate.empty()) {
@@ -776,16 +772,15 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript()
// Create internal variables
std::vector<std::string> setupSection;
- for (const auto& i : setupDirectives) {
+ for (auto const& i : setupDirectives) {
setupSection.emplace_back(cmStrCat(i.first, '=', TranslateBool(i.second)));
}
// Also create comments if the sections are empty
- const std::string& defaultMessage =
+ std::string const& defaultMessage =
"; CPack didn't find any entries for this section";
- if (IsSet("CPACK_CREATE_DESKTOP_LINKS") &&
- !GetOption("CPACK_CREATE_DESKTOP_LINKS").Get()->empty()) {
+ if (!IsSetToEmpty("CPACK_CREATE_DESKTOP_LINKS")) {
cmCPackInnoSetupKeyValuePairs tasks;
tasks["Name"] = "\"desktopicon\"";
tasks["Description"] = "\"{cm:CreateDesktopIcon}\"";
@@ -842,29 +837,28 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript()
bool cmCPackInnoSetupGenerator::Compile()
{
- const std::string& isScriptFile =
+ std::string const& isScriptFile =
cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISScript.iss");
- const std::string& isccLogFile =
+ std::string const& isccLogFile =
cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISCCOutput.log");
std::vector<std::string> isccArgs;
// Custom defines
- for (const std::string& i : GetOptions()) {
+ for (std::string const& i : GetOptions()) {
if (cmHasPrefix(i, "CPACK_INNOSETUP_DEFINE_")) {
- const std::string& name = i.substr(cmStrLen("CPACK_INNOSETUP_DEFINE_"));
+ std::string const& name = i.substr(cmStrLen("CPACK_INNOSETUP_DEFINE_"));
isccArgs.push_back(
cmStrCat("\"/D", name, '=', TranslateBool(GetOption(i)), '"'));
}
}
- if (IsSet("CPACK_INNOSETUP_EXECUTABLE_ARGUMENTS")) {
- const cmList args(GetOption("CPACK_INNOSETUP_EXECUTABLE_ARGUMENTS"));
-
+ if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_EXECUTABLE_ARGUMENTS")) {
+ cmList const args(*v);
isccArgs.insert(isccArgs.end(), args.begin(), args.end());
}
- const std::string& isccCmd =
+ std::string const& isccCmd =
cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM"), PathType::Native),
' ', cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile));
@@ -872,7 +866,7 @@ bool cmCPackInnoSetupGenerator::Compile()
std::string output;
int retVal = 1;
- const bool res = cmSystemTools::RunSingleCommand(
+ bool const res = cmSystemTools::RunSingleCommand(
isccCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
@@ -891,11 +885,11 @@ bool cmCPackInnoSetupGenerator::Compile()
}
bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
- cmCPackComponent* component, const std::string& uploadDirectory,
+ cmCPackComponent* component, std::string const& uploadDirectory,
std::string* hash)
{
// Remove the old archive, if one exists
- const std::string& archiveFile =
+ std::string const& archiveFile =
uploadDirectory + '/' + component->ArchiveFile;
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Building downloaded component archive: " << archiveFile
@@ -928,16 +922,16 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
}
// The directory where this component's files reside
- const std::string& dirName =
+ std::string const& dirName =
cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), '/', component->Name);
// Build the list of files to go into this archive
- const std::string& zipListFileName =
+ std::string const& zipListFileName =
cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
- const bool needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
+ bool const needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(zipListFileName);
- for (const std::string& i : component->Files) {
+ for (std::string const& i : component->Files) {
out << (needQuotesInFile ? Quote(i) : i) << std::endl;
}
}
@@ -949,7 +943,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
zipListFileName.c_str());
std::string output;
int retVal = -1;
- const bool res = cmSystemTools::RunSingleCommand(
+ bool const res = cmSystemTools::RunSingleCommand(
cmd, &output, &output, &retVal, dirName.c_str(), this->GeneratorVerbose,
cmDuration::zero());
if (!res || retVal) {
@@ -973,12 +967,12 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
}
#ifdef _WIN32
- const std::string& hashCmd =
+ std::string const& hashCmd =
cmStrCat("certutil -hashfile ", QuotePath(archiveFile), " SHA256");
std::string hashOutput;
int hashRetVal = -1;
- const bool hashRes = cmSystemTools::RunSingleCommand(
+ bool const hashRes = cmSystemTools::RunSingleCommand(
hashCmd, &hashOutput, &hashOutput, &hashRetVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
if (!hashRes || hashRetVal) {
@@ -986,7 +980,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
"Problem running certutil command: " << hashCmd
<< std::endl);
}
- *hash = cmTrimWhitespace(cmTokenize(hashOutput, "\n").at(1));
+ *hash = cmTrimWhitespace(cmTokenizedView(hashOutput, '\n').at(1));
if (hash->length() != 64) {
cmCPackLogger(cmCPackLog::LOG_WARNING,
@@ -999,7 +993,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
return true;
}
-cmValue cmCPackInnoSetupGenerator::RequireOption(const std::string& key)
+cmValue cmCPackInnoSetupGenerator::RequireOption(std::string const& key)
{
cmValue value = GetOption(key);
@@ -1012,7 +1006,7 @@ cmValue cmCPackInnoSetupGenerator::RequireOption(const std::string& key)
}
std::string cmCPackInnoSetupGenerator::CustomComponentInstallDirectory(
- const cmCPackComponent* component)
+ cmCPackComponent const* component)
{
cmValue outputDir = GetOption(
cmStrCat("CPACK_INNOSETUP_", component->Name, "_INSTALL_DIRECTORY"));
@@ -1042,7 +1036,7 @@ std::string cmCPackInnoSetupGenerator::CustomComponentInstallDirectory(
return "{app}";
}
-std::string cmCPackInnoSetupGenerator::TranslateBool(const std::string& value)
+std::string cmCPackInnoSetupGenerator::TranslateBool(std::string const& value)
{
if (value.empty()) {
return value;
@@ -1062,13 +1056,13 @@ std::string cmCPackInnoSetupGenerator::TranslateBool(const std::string& value)
}
std::string cmCPackInnoSetupGenerator::ISKeyValueLine(
- const cmCPackInnoSetupKeyValuePairs& params)
+ cmCPackInnoSetupKeyValuePairs const& params)
{
/*
* To simplify readability of the generated code, the keys are sorted.
* Unknown keys are ignored to avoid errors during compilation.
*/
- static const char* const availableKeys[] = {
+ static char const* const availableKeys[] = {
"Source", "DestDir", "Name", "Filename",
"Description", "GroupDescription", "MessagesFile", "Types",
"ExternalSize", "BeforeInstall", "Flags", "Components",
@@ -1076,7 +1070,7 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine(
};
std::vector<std::string> keys;
- for (const char* i : availableKeys) {
+ for (char const* i : availableKeys) {
if (params.count(i)) {
keys.emplace_back(cmStrCat(i, ": ", params.at(i)));
}
@@ -1086,13 +1080,13 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine(
}
std::string cmCPackInnoSetupGenerator::CreateRecursiveComponentPath(
- cmCPackComponentGroup* group, const std::string& path)
+ cmCPackComponentGroup* group, std::string const& path)
{
if (!group) {
return path;
}
- const std::string& newPath =
+ std::string const& newPath =
path.empty() ? group->Name : cmStrCat(group->Name, '\\', path);
return CreateRecursiveComponentPath(group->ParentGroup, newPath);
}
@@ -1120,7 +1114,7 @@ void cmCPackInnoSetupGenerator::CreateRecursiveComponentGroups(
}
}
-std::string cmCPackInnoSetupGenerator::Quote(const std::string& string)
+std::string cmCPackInnoSetupGenerator::Quote(std::string const& string)
{
if (cmHasPrefix(string, '"') && cmHasSuffix(string, '"')) {
return Quote(string.substr(1, string.length() - 2));
@@ -1132,7 +1126,7 @@ std::string cmCPackInnoSetupGenerator::Quote(const std::string& string)
return cmStrCat('"', nString, '"');
}
-std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path,
+std::string cmCPackInnoSetupGenerator::QuotePath(std::string const& path,
PathType type)
{
#ifdef _WIN32
@@ -1146,7 +1140,7 @@ std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path,
}
std::string cmCPackInnoSetupGenerator::PrepareForConstant(
- const std::string& string)
+ std::string const& string)
{
std::string nString = string;
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.h b/Source/CPack/cmCPackInnoSetupGenerator.h
index e057e6c..5d25b9e 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.h
+++ b/Source/CPack/cmCPackInnoSetupGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-file Copyright.txt or https://cmake.org/licensing for details. */
+file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -37,7 +37,7 @@ protected:
int InitializeInternal() override;
int PackageFiles() override;
- inline const char* GetOutputExtension() override { return ".exe"; }
+ inline char const* GetOutputExtension() override { return ".exe"; }
inline cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
const override
@@ -63,22 +63,22 @@ private:
bool Compile();
bool BuildDownloadedComponentArchive(cmCPackComponent* component,
- const std::string& uploadDirectory,
+ std::string const& uploadDirectory,
std::string* hash);
/**
* Returns the option's value or an empty string if the option isn't set.
*/
- cmValue RequireOption(const std::string& key);
+ cmValue RequireOption(std::string const& key);
std::string CustomComponentInstallDirectory(
- const cmCPackComponent* component);
+ cmCPackComponent const* component);
/**
* Translates boolean expressions into "yes" or "no", as required in
* Inno Setup (only if "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT" is on).
*/
- std::string TranslateBool(const std::string& value);
+ std::string TranslateBool(std::string const& value);
/**
* Creates a typical line of key and value pairs using the given map.
@@ -86,10 +86,10 @@ private:
* (e.g.: Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";
* GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked)
*/
- std::string ISKeyValueLine(const cmCPackInnoSetupKeyValuePairs& params);
+ std::string ISKeyValueLine(cmCPackInnoSetupKeyValuePairs const& params);
std::string CreateRecursiveComponentPath(cmCPackComponentGroup* group,
- const std::string& path = "");
+ std::string const& path = "");
void CreateRecursiveComponentGroups(cmCPackComponentGroup* group);
@@ -97,8 +97,8 @@ private:
* These functions add quotes if the given value hasn't already quotes.
* 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 Quote(std::string const& string);
+ std::string QuotePath(std::string const& path,
PathType type = PathType::Windows);
/**
@@ -106,7 +106,7 @@ private:
* '|' '}' ',' '%' '"'
* Required for Inno Setup constants like {cm:...}
*/
- std::string PrepareForConstant(const std::string& string);
+ std::string PrepareForConstant(std::string const& string);
std::vector<std::string> includeDirectives;
cmCPackInnoSetupKeyValuePairs setupDirectives;
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index d37531b..cec9b8d 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackLog.h"
#include <iostream>
@@ -23,7 +23,7 @@ void cmCPackLog::SetLogOutputStream(std::ostream* os)
this->LogOutput = os;
}
-bool cmCPackLog::SetLogOutputFile(const char* fname)
+bool cmCPackLog::SetLogOutputFile(char const* fname)
{
this->LogOutputStream.reset();
if (fname) {
@@ -38,7 +38,7 @@ bool cmCPackLog::SetLogOutputFile(const char* fname)
return this->LogOutput != nullptr;
}
-void cmCPackLog::Log(int tag, const char* file, int line, const char* msg,
+void cmCPackLog::Log(int tag, char const* file, int line, char const* msg,
size_t length)
{
// By default no logging
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 347b0f7..009a391 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,8 +26,8 @@ public:
cmCPackLog();
~cmCPackLog();
- cmCPackLog(const cmCPackLog&) = delete;
- cmCPackLog& operator=(const cmCPackLog&) = delete;
+ cmCPackLog(cmCPackLog const&) = delete;
+ cmCPackLog& operator=(cmCPackLog const&) = delete;
enum cm_log_tags
{
@@ -40,19 +40,19 @@ public:
};
//! Various signatures for logging.
- void Log(const char* file, int line, const char* msg)
+ void Log(char const* file, int line, char const* msg)
{
this->Log(LOG_OUTPUT, file, line, msg);
}
- void Log(const char* file, int line, const char* msg, size_t length)
+ void Log(char const* file, int line, char const* msg, size_t length)
{
this->Log(LOG_OUTPUT, file, line, msg, length);
}
- void Log(int tag, const char* file, int line, const char* msg)
+ void Log(int tag, char const* file, int line, char const* msg)
{
this->Log(tag, file, line, msg, strlen(msg));
}
- void Log(int tag, const char* file, int line, const char* msg,
+ void Log(int tag, char const* file, int line, char const* msg,
size_t length);
//! Set Verbose
@@ -84,7 +84,7 @@ public:
//! Set the log output file. The cmCPackLog will try to create file. If it
// cannot, it will report an error.
- bool SetLogOutputFile(const char* fname);
+ bool SetLogOutputFile(char const* fname);
//! Set the various prefixes for the logging. SetPrefix sets the generic
// prefix that overwrites missing ones.
@@ -121,17 +121,17 @@ private:
class cmCPackLogWrite
{
public:
- cmCPackLogWrite(const char* data, size_t length)
+ cmCPackLogWrite(char const* data, size_t length)
: Data(data)
, Length(length)
{
}
- const char* Data;
+ char const* Data;
std::streamsize Length;
};
-inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c)
+inline std::ostream& operator<<(std::ostream& os, cmCPackLogWrite const& c)
{
os.write(c.Data, c.Length);
os.flush();
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 53871ee..fb8e81b 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackNSISGenerator.h"
#include <algorithm>
@@ -67,7 +67,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::string outputDir = "$INSTDIR";
std::string fileN = cmSystemTools::RelativePath(this->toplevel, file);
if (!this->Components.empty()) {
- const std::string::size_type pos = fileN.find('/');
+ std::string::size_type const pos = fileN.find('/');
// Use the custom component install directory if we have one
if (pos != std::string::npos) {
@@ -111,7 +111,7 @@ int cmCPackNSISGenerator::PackageFiles()
}
std::replace(fileN.begin(), fileN.end(), '/', '\\');
- const std::string componentOutputDir =
+ std::string const componentOutputDir =
this->CustomComponentInstallDirectory(componentName);
dstr << " RMDir \"" << componentOutputDir << "\\" << fileN << "\""
@@ -130,23 +130,20 @@ int cmCPackNSISGenerator::PackageFiles()
if (this->IsSet("CPACK_NSIS_MUI_ICON") ||
this->IsSet("CPACK_NSIS_MUI_UNIICON")) {
std::string installerIconCode;
- if (this->IsSet("CPACK_NSIS_MUI_ICON")) {
- installerIconCode += cmStrCat(
- "!define MUI_ICON \"", this->GetOption("CPACK_NSIS_MUI_ICON"), "\"\n");
+ if (cmValue icon = this->GetOptionIfSet("CPACK_NSIS_MUI_ICON")) {
+ installerIconCode += cmStrCat("!define MUI_ICON \"", *icon, "\"\n");
}
- if (this->IsSet("CPACK_NSIS_MUI_UNIICON")) {
- installerIconCode +=
- cmStrCat("!define MUI_UNICON \"",
- this->GetOption("CPACK_NSIS_MUI_UNIICON"), "\"\n");
+ if (cmValue icon = this->GetOptionIfSet("CPACK_NSIS_MUI_UNIICON")) {
+ installerIconCode += cmStrCat("!define MUI_UNICON \"", *icon, "\"\n");
}
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_ICON_CODE",
installerIconCode.c_str());
}
std::string installerHeaderImage;
- if (this->IsSet("CPACK_NSIS_MUI_HEADERIMAGE")) {
- installerHeaderImage = *this->GetOption("CPACK_NSIS_MUI_HEADERIMAGE");
- } else if (this->IsSet("CPACK_PACKAGE_ICON")) {
- installerHeaderImage = *this->GetOption("CPACK_PACKAGE_ICON");
+ if (cmValue img = this->GetOptionIfSet("CPACK_NSIS_MUI_HEADERIMAGE")) {
+ installerHeaderImage = *img;
+ } else if (cmValue icon = this->GetOptionIfSet("CPACK_PACKAGE_ICON")) {
+ installerHeaderImage = *icon;
}
if (!installerHeaderImage.empty()) {
std::string installerIconCode = cmStrCat(
@@ -155,35 +152,33 @@ int cmCPackNSISGenerator::PackageFiles()
installerIconCode);
}
- if (this->IsSet("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP")) {
- std::string installerBitmapCode = cmStrCat(
- "!define MUI_WELCOMEFINISHPAGE_BITMAP \"",
- this->GetOption("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP"), "\"\n");
+ if (cmValue v =
+ this->GetOptionIfSet("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP")) {
+ std::string installerBitmapCode =
+ cmStrCat("!define MUI_WELCOMEFINISHPAGE_BITMAP \"", *v, "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE",
installerBitmapCode);
}
- if (this->IsSet("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP")) {
- std::string installerBitmapCode = cmStrCat(
- "!define MUI_UNWELCOMEFINISHPAGE_BITMAP \"",
- this->GetOption("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP"), "\"\n");
+ if (cmValue v =
+ this->GetOptionIfSet("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP")) {
+ std::string installerBitmapCode =
+ cmStrCat("!define MUI_UNWELCOMEFINISHPAGE_BITMAP \"", *v, "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE",
installerBitmapCode);
}
- if (this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) {
- std::string installerRunCode =
- cmStrCat("!define MUI_FINISHPAGE_RUN \"$INSTDIR\\",
- this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY"), '\\',
- this->GetOption("CPACK_NSIS_MUI_FINISHPAGE_RUN"), "\"\n");
+ if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) {
+ std::string installerRunCode = cmStrCat(
+ "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\",
+ this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY"), '\\', *v, "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE",
installerRunCode);
}
- if (this->IsSet("CPACK_NSIS_WELCOME_TITLE")) {
+ if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_WELCOME_TITLE")) {
std::string welcomeTitleCode =
- cmStrCat("!define MUI_WELCOMEPAGE_TITLE \"",
- this->GetOption("CPACK_NSIS_WELCOME_TITLE"), "\"");
+ cmStrCat("!define MUI_WELCOMEPAGE_TITLE \"", *v, "\"");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_WELCOME_TITLE_CODE",
welcomeTitleCode);
}
@@ -193,10 +188,9 @@ int cmCPackNSISGenerator::PackageFiles()
"!define MUI_WELCOMEPAGE_TITLE_3LINES");
}
- if (this->IsSet("CPACK_NSIS_FINISH_TITLE")) {
+ if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_FINISH_TITLE")) {
std::string finishTitleCode =
- cmStrCat("!define MUI_FINISHPAGE_TITLE \"",
- this->GetOption("CPACK_NSIS_FINISH_TITLE"), "\"");
+ cmStrCat("!define MUI_FINISHPAGE_TITLE \"", *v, "\"");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_FINISH_TITLE_CODE",
finishTitleCode);
}
@@ -211,36 +205,36 @@ int cmCPackNSISGenerator::PackageFiles()
"ManifestDPIAware true");
}
- if (this->IsSet("CPACK_NSIS_BRANDING_TEXT")) {
+ if (cmValue brandingText =
+ this->GetOptionIfSet("CPACK_NSIS_BRANDING_TEXT")) {
// Default position to LEFT
std::string brandingTextPosition = "LEFT";
- if (this->IsSet("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION")) {
- std::string wantedPosition =
- this->GetOption("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION");
- if (!wantedPosition.empty()) {
- const std::set<std::string> possiblePositions{ "CENTER", "LEFT",
+ if (cmValue wantedPosition =
+ this->GetOptionIfSet("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION")) {
+ if (!wantedPosition->empty()) {
+ std::set<std::string> const possiblePositions{ "CENTER", "LEFT",
"RIGHT" };
- if (possiblePositions.find(wantedPosition) ==
+ if (possiblePositions.find(*wantedPosition) ==
possiblePositions.end()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Unsupported branding text trim position "
- << wantedPosition << std::endl);
+ << *wantedPosition << std::endl);
return false;
}
- brandingTextPosition = wantedPosition;
+ brandingTextPosition = *wantedPosition;
}
}
std::string brandingTextCode =
cmStrCat("BrandingText /TRIM", brandingTextPosition, " \"",
- this->GetOption("CPACK_NSIS_BRANDING_TEXT"), "\"\n");
+ *brandingText, "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_BRANDING_TEXT_CODE", brandingTextCode);
}
if (!this->IsSet("CPACK_NSIS_IGNORE_LICENSE_PAGE")) {
- std::string licenceCode =
+ std::string licenseCode =
cmStrCat("!insertmacro MUI_PAGE_LICENSE \"",
this->GetOption("CPACK_RESOURCE_FILE_LICENSE"), "\"\n");
- this->SetOptionIfNotSet("CPACK_NSIS_LICENSE_PAGE", licenceCode);
+ this->SetOptionIfNotSet("CPACK_NSIS_LICENSE_PAGE", licenseCode);
}
std::string nsisPreArguments;
@@ -472,7 +466,7 @@ int cmCPackNSISGenerator::InitializeInternal()
this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis");
nsisPath = cmSystemTools::FindProgram(
- *this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false);
+ *this->GetOption("CPACK_NSIS_EXECUTABLE"), path);
if (nsisPath.empty()) {
cmCPackLogger(
@@ -557,8 +551,7 @@ int cmCPackNSISGenerator::InitializeInternal()
}
} else {
cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "CPACK_CREATE_DESKTOP_LINKS: "
- << "not set" << std::endl);
+ "CPACK_CREATE_DESKTOP_LINKS: " << "not set" << std::endl);
}
std::ostringstream str;
@@ -636,7 +629,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
cmList::iterator it;
for (it = cpackMenuLinksList.begin(); it != cpackMenuLinksList.end(); ++it) {
std::string sourceName = *it;
- const bool url = urlRegex.find(sourceName);
+ bool const url = urlRegex.find(sourceName);
// Convert / to \ in filenames, but not in urls:
//
@@ -673,12 +666,12 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
}
bool cmCPackNSISGenerator::GetListOfSubdirectories(
- const char* topdir, std::vector<std::string>& dirs)
+ char const* topdir, std::vector<std::string>& dirs)
{
cmsys::Directory dir;
dir.Load(topdir);
for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
- const char* fileName = dir.GetFile(i);
+ char const* fileName = dir.GetFile(i);
if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) {
std::string const fullPath =
std::string(topdir).append("/").append(fileName);
@@ -734,7 +727,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
componentCode += " SectionIn" + out.str() + "\n";
}
- const std::string componentOutputDir =
+ std::string const componentOutputDir =
this->CustomComponentInstallDirectory(component->Name);
componentCode += cmStrCat(" SetOutPath \"", componentOutputDir, "\"\n");
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index ded02de..5aca90d 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,10 +41,10 @@ protected:
int InitializeInternal() override;
void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
int PackageFiles() override;
- const char* GetOutputExtension() override { return ".exe"; }
- const char* GetOutputPostfix() override { return "win32"; }
+ char const* GetOutputExtension() override { return ".exe"; }
+ char const* GetOutputPostfix() override { return "win32"; }
- bool GetListOfSubdirectories(const char* dir,
+ bool GetListOfSubdirectories(char const* dir,
std::vector<std::string>& dirs);
enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx
index 196aaf1..079b4c6 100644
--- a/Source/CPack/cmCPackNuGetGenerator.cxx
+++ b/Source/CPack/cmCPackNuGetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackNuGetGenerator.h"
#include <algorithm>
@@ -129,8 +129,8 @@ void cmCPackNuGetGenerator::AddGeneratedPackageNames()
return;
}
// add the generated packages to package file names list
- const std::string& fileNames = *files_list;
- const char sep = ';';
+ std::string const& fileNames = *files_list;
+ char const sep = ';';
std::string::size_type pos1 = 0;
std::string::size_type pos2 = fileNames.find(sep, pos1 + 1);
while (pos2 != std::string::npos) {
diff --git a/Source/CPack/cmCPackNuGetGenerator.h b/Source/CPack/cmCPackNuGetGenerator.h
index 609ec79..b3f6a45 100644
--- a/Source/CPack/cmCPackNuGetGenerator.h
+++ b/Source/CPack/cmCPackNuGetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmCPackGenerator.h"
@@ -20,7 +20,7 @@ protected:
bool SupportsComponentInstallation() const override;
int PackageFiles() override;
- const char* GetOutputExtension() override { return ".nupkg"; }
+ char const* GetOutputExtension() override { return ".nupkg"; }
bool SupportsAbsoluteDestination() const override { return false; }
/**
* The method used to prepare variables when component
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 6208195..796bfa7 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackPKGGenerator.h"
#include <vector>
@@ -35,7 +35,7 @@ int cmCPackPKGGenerator::InitializeInternal()
}
std::string cmCPackPKGGenerator::GetPackageName(
- const cmCPackComponent& component)
+ cmCPackComponent const& component)
{
if (component.ArchiveFile.empty()) {
std::string packagesDir =
@@ -48,8 +48,8 @@ std::string cmCPackPKGGenerator::GetPackageName(
return cmStrCat(component.ArchiveFile, ".pkg");
}
-void cmCPackPKGGenerator::CreateBackground(const char* themeName,
- const char* metapackageFile,
+void cmCPackPKGGenerator::CreateBackground(char const* themeName,
+ char const* metapackageFile,
cm::string_view genName,
cmXMLWriter& xout)
{
@@ -107,8 +107,8 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName,
xout.EndElement();
}
-void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
- const char* genName)
+void cmCPackPKGGenerator::WriteDistributionFile(char const* metapackageFile,
+ char const* genName)
{
std::string distributionTemplate =
this->FindTemplate("CPack.distribution.dist.in");
@@ -206,7 +206,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
}
void cmCPackPKGGenerator::CreateChoiceOutline(
- const cmCPackComponentGroup& group, cmXMLWriter& xout)
+ cmCPackComponentGroup const& group, cmXMLWriter& xout)
{
xout.StartElement("line");
xout.Attribute("choice", cmStrCat(group.Name, "Choice"));
@@ -223,7 +223,7 @@ void cmCPackPKGGenerator::CreateChoiceOutline(
xout.EndElement();
}
-void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
+void cmCPackPKGGenerator::CreateChoice(cmCPackComponentGroup const& group,
cmXMLWriter& xout)
{
xout.StartElement("choice");
@@ -238,7 +238,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
xout.EndElement();
}
-void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
+void cmCPackPKGGenerator::CreateChoice(cmCPackComponent const& component,
cmXMLWriter& xout)
{
std::string packageId;
@@ -278,7 +278,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
// on (B and A), while selecting something that depends on C--either D
// or E--will automatically cause C to get selected.
std::ostringstream selected("my.choice.selected", std::ios_base::ate);
- std::set<const cmCPackComponent*> visited;
+ std::set<cmCPackComponent const*> visited;
AddDependencyAttributes(component, visited, selected);
visited.clear();
AddReverseDependencyAttributes(component, visited, selected);
@@ -350,8 +350,8 @@ void cmCPackPKGGenerator::CreateDomains(cmXMLWriter& xout)
}
void cmCPackPKGGenerator::AddDependencyAttributes(
- const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
+ cmCPackComponent const& component,
+ std::set<cmCPackComponent const*>& visited, std::ostringstream& out)
{
if (visited.find(&component) != visited.end()) {
return;
@@ -365,8 +365,8 @@ void cmCPackPKGGenerator::AddDependencyAttributes(
}
void cmCPackPKGGenerator::AddReverseDependencyAttributes(
- const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
+ cmCPackComponent const& component,
+ std::set<cmCPackComponent const*>& visited, std::ostringstream& out)
{
if (visited.find(&component) != visited.end()) {
return;
@@ -379,8 +379,8 @@ void cmCPackPKGGenerator::AddReverseDependencyAttributes(
}
}
-bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
- const std::string& dirName)
+bool cmCPackPKGGenerator::CopyCreateResourceFile(std::string const& name,
+ std::string const& dirName)
{
std::string uname = cmSystemTools::UpperCase(name);
std::string cpackVar = cmStrCat("CPACK_RESOURCE_FILE_", uname);
@@ -426,8 +426,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
return true;
}
-bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
- const char* outName)
+bool cmCPackPKGGenerator::CopyResourcePlistFile(std::string const& name,
+ char const* outName)
{
if (!outName) {
outName = name.c_str();
@@ -451,9 +451,9 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
return true;
}
-int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir,
- const std::string& script,
- const std::string& name)
+int cmCPackPKGGenerator::CopyInstallScript(std::string const& resdir,
+ std::string const& script,
+ std::string const& name)
{
std::string dst = cmStrCat(resdir, '/', name);
cmSystemTools::CopyFileAlways(script, dst);
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index 256b334..8881e95 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,61 +34,61 @@ public:
protected:
int InitializeInternal() override;
- const char* GetOutputPostfix() override { return "darwin"; }
+ char const* GetOutputPostfix() override { return "darwin"; }
// Copies or creates the resource file with the given name to the
// package or package staging directory dirName. The variable
// CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
// version of name) specifies the input file to use for this file,
// which will be configured via ConfigureFile.
- bool CopyCreateResourceFile(const std::string& name,
- const std::string& dirName);
- bool CopyResourcePlistFile(const std::string& name,
- const char* outName = nullptr);
+ bool CopyCreateResourceFile(std::string const& name,
+ std::string const& dirName);
+ bool CopyResourcePlistFile(std::string const& name,
+ char const* outName = nullptr);
- int CopyInstallScript(const std::string& resdir, const std::string& script,
- const std::string& name);
+ int CopyInstallScript(std::string const& resdir, std::string const& script,
+ std::string const& name);
// Retrieve the name of package file that will be generated for this
// component. The name is just the file name with extension, and
// does not include the subdirectory.
- std::string GetPackageName(const cmCPackComponent& component);
+ std::string GetPackageName(cmCPackComponent const& component);
// Writes a distribution.dist file, which turns a metapackage into a
// full-fledged distribution. This file is used to describe
// inter-component dependencies. metapackageFile is the name of the
// metapackage for the distribution. Only valid for a
// component-based install.
- void WriteDistributionFile(const char* metapackageFile, const char* genName);
+ void WriteDistributionFile(char const* metapackageFile, char const* genName);
// Subroutine of WriteDistributionFile that writes out the
// dependency attributes for inter-component dependencies.
- void AddDependencyAttributes(const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited,
+ void AddDependencyAttributes(cmCPackComponent const& component,
+ std::set<cmCPackComponent const*>& visited,
std::ostringstream& out);
// Subroutine of WriteDistributionFile that writes out the
// reverse dependency attributes for inter-component dependencies.
void AddReverseDependencyAttributes(
- const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
+ cmCPackComponent const& component,
+ std::set<cmCPackComponent const*>& visited, std::ostringstream& out);
// Generates XML that encodes the hierarchy of component groups and
// their components in a form that can be used by distribution
// metapackages.
- void CreateChoiceOutline(const cmCPackComponentGroup& group,
+ void CreateChoiceOutline(cmCPackComponentGroup const& group,
cmXMLWriter& xout);
/// Create the "choice" XML element to describe a component group
/// for the installer GUI.
- void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
+ void CreateChoice(cmCPackComponentGroup const& group, cmXMLWriter& xout);
/// Create the "choice" XML element to describe a component for the
/// installer GUI.
- void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
+ void CreateChoice(cmCPackComponent const& component, cmXMLWriter& xout);
/// Creates a background in the distribution XML.
- void CreateBackground(const char* themeName, const char* metapackageFile,
+ void CreateBackground(char const* themeName, char const* metapackageFile,
cm::string_view genName, cmXMLWriter& xout);
/// Create the "domains" XML element to indicate where the product can
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index ae3c50e..4193f8c 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackProductBuildGenerator.h"
#include <cstddef>
@@ -60,10 +60,8 @@ int cmCPackProductBuildGenerator::PackageFiles()
std::string resDir = cmStrCat(packageDirFileName, "/Contents");
- if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) {
- std::string userResDir =
- this->GetOption("CPACK_PRODUCTBUILD_RESOURCES_DIR");
-
+ if (cmValue v = this->GetOptionIfSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) {
+ std::string userResDir = *v;
if (!cmSystemTools::CopyADirectory(userResDir, resDir)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem copying the resource files" << std::endl);
@@ -129,9 +127,7 @@ int cmCPackProductBuildGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/Applications");
- std::vector<std::string> no_paths;
- std::string program =
- cmSystemTools::FindProgram("pkgbuild", no_paths, false);
+ std::string program = cmSystemTools::FindProgram("pkgbuild");
if (program.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find pkgbuild executable" << std::endl);
@@ -139,7 +135,7 @@ int cmCPackProductBuildGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_PKGBUILD", program);
- program = cmSystemTools::FindProgram("productbuild", no_paths, false);
+ program = cmSystemTools::FindProgram("productbuild");
if (program.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find productbuild executable" << std::endl);
@@ -150,7 +146,7 @@ int cmCPackProductBuildGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
-bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
+bool cmCPackProductBuildGenerator::RunProductBuild(std::string const& command)
{
std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"),
"/ProductBuildOutput.log");
@@ -177,8 +173,8 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
}
bool cmCPackProductBuildGenerator::GenerateComponentPackage(
- const std::string& packageFileDir, const std::string& packageFileName,
- const std::string& packageDir, const cmCPackComponent* component)
+ std::string const& packageFileDir, std::string const& packageFileName,
+ std::string const& packageDir, cmCPackComponent const* component)
{
std::string packageFile = cmStrCat(packageFileDir, '/', packageFileName);
@@ -186,7 +182,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
"- Building component package: " << packageFile
<< std::endl);
- const char* comp_name = component ? component->Name.c_str() : nullptr;
+ char const* comp_name = component ? component->Name.c_str() : nullptr;
cmValue preflight = this->GetComponentScript("PREFLIGHT", comp_name);
cmValue postflight = this->GetComponentScript("POSTFLIGHT", comp_name);
@@ -269,7 +265,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
}
cmValue cmCPackProductBuildGenerator::GetComponentScript(
- const char* script, const char* component_name)
+ char const* script, char const* component_name)
{
std::string scriptname = cmStrCat("CPACK_", script, '_');
if (component_name) {
diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h
index 31cfafa..66e1330 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.h
+++ b/Source/CPack/cmCPackProductBuildGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,21 +30,21 @@ public:
protected:
int InitializeInternal() override;
int PackageFiles() override;
- const char* GetOutputExtension() override { return ".pkg"; }
+ char const* GetOutputExtension() override { return ".pkg"; }
// Run ProductBuild with the given command line, which will (if
// successful) produce the given package file. Returns true if
// ProductBuild succeeds, false otherwise.
- bool RunProductBuild(const std::string& command);
+ bool RunProductBuild(std::string const& command);
// Generate a package in the file packageFile for the given
// component. All of the files within this component are stored in
// the directory packageDir. Returns true if successful, false
// otherwise.
- bool GenerateComponentPackage(const std::string& packageFileDir,
- const std::string& packageFileName,
- const std::string& packageDir,
- const cmCPackComponent* component);
+ bool GenerateComponentPackage(std::string const& packageFileDir,
+ std::string const& packageFileName,
+ std::string const& packageDir,
+ cmCPackComponent const* component);
- cmValue GetComponentScript(const char* script, const char* script_component);
+ cmValue GetComponentScript(char const* script, char const* script_component);
};
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index a4f4dac..2356d93 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackRPMGenerator.h"
#include <algorithm>
@@ -49,7 +49,7 @@ void cmCPackRPMGenerator::AddGeneratedPackageNames()
{
// add the generated packages to package file names list
std::string fileNames(this->GetOption("GEN_CPACK_OUTPUT_FILES"));
- const char sep = ';';
+ char const sep = ';';
std::string::size_type pos1 = 0;
std::string::size_type pos2 = fileNames.find(sep, pos1 + 1);
while (pos2 != std::string::npos) {
@@ -107,7 +107,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel,
}
std::string cmCPackRPMGenerator::GetSanitizedDirOrFileName(
- const std::string& name, bool isFullName) const
+ std::string const& name, bool isFullName) const
{
auto sanitizedName =
this->cmCPackGenerator::GetSanitizedDirOrFileName(name, isFullName);
@@ -363,7 +363,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
}
int cmCPackRPMGenerator::PackageComponentsAllInOne(
- const std::string& compInstDirName)
+ std::string const& compInstDirName)
{
int retval = 1;
/* Reset package file name list it will be populated during the
@@ -445,7 +445,7 @@ bool cmCPackRPMGenerator::SupportsComponentInstallation() const
}
std::string cmCPackRPMGenerator::GetComponentInstallSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) {
return componentName;
@@ -465,7 +465,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallSuffix(
}
std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
- const std::string& componentName)
+ std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 0e23503..86df55e 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -59,15 +59,15 @@ protected:
* Special case of component install where all
* components will be put in a single installer.
*/
- int PackageComponentsAllInOne(const std::string& compInstDirName);
- const char* GetOutputExtension() override { return ".rpm"; }
- std::string GetSanitizedDirOrFileName(const std::string& name,
+ int PackageComponentsAllInOne(std::string const& compInstDirName);
+ char const* GetOutputExtension() override { return ".rpm"; }
+ std::string GetSanitizedDirOrFileName(std::string const& name,
bool isFullName = true) const override;
bool SupportsComponentInstallation() const override;
std::string GetComponentInstallSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName) override;
+ std::string const& componentName) override;
void AddGeneratedPackageNames();
};
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 2673fee..38cadf4 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCPackSTGZGenerator.h"
#include <cstdio>
@@ -81,7 +81,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
}
this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText);
- const char headerLengthTag[] = "###CPACK_HEADER_LENGTH###";
+ char const headerLengthTag[] = "###CPACK_HEADER_LENGTH###";
// Create the header
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
@@ -96,7 +96,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
this->ConfigureString(packageHeaderText, res);
// Count the lines
- const char* ptr = res.c_str();
+ char const* ptr = res.c_str();
while (*ptr) {
if (*ptr == '\n') {
counter++;
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index d2df1f2..e34c832 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 305ac56..138d8fa 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <algorithm>
#include <cstddef>
@@ -39,14 +39,14 @@
#include "cmake.h"
namespace {
-const cmDocumentationEntry cmDocumentationName = {
+cmDocumentationEntry const cmDocumentationName = {
{},
" cpack - Packaging driver provided by CMake."
};
-const cmDocumentationEntry cmDocumentationUsage = { {}, " cpack [options]" };
+cmDocumentationEntry const cmDocumentationUsage = { {}, " cpack [options]" };
-const cmDocumentationEntry cmDocumentationOptions[14] = {
+cmDocumentationEntry const cmDocumentationOptions[14] = {
{ "-G <generators>", "Override/define CPACK_GENERATOR" },
{ "-C <Configuration>", "Specify the project configuration" },
{ "-D <var>=<value>", "Set a CPack variable." },
@@ -63,22 +63,22 @@ const cmDocumentationEntry cmDocumentationOptions[14] = {
{ "--list-presets", "List available package presets" }
};
-void cpackProgressCallback(const std::string& message, float /*unused*/)
+void cpackProgressCallback(std::string const& message, float /*unused*/)
{
std::cout << "-- " << message << '\n';
}
std::vector<cmDocumentationEntry> makeGeneratorDocs(
- const cmCPackGeneratorFactory& gf)
+ cmCPackGeneratorFactory const& gf)
{
- const auto& generators = gf.GetGeneratorsList();
+ auto const& generators = gf.GetGeneratorsList();
std::vector<cmDocumentationEntry> docs;
docs.reserve(generators.size());
std::transform(
generators.cbegin(), generators.cend(), std::back_inserter(docs),
- [](const std::decay<decltype(generators)>::type::value_type& gen) {
+ [](std::decay<decltype(generators)>::type::value_type const& gen) {
return cmDocumentationEntry{ gen.first, gen.second };
});
return docs;
@@ -113,7 +113,7 @@ int main(int argc, char const* const* argv)
log.SetOutputPrefix("CPack: ");
log.SetVerbosePrefix("CPack Verbose: ");
- if (cmSystemTools::GetCurrentWorkingDirectory().empty()) {
+ if (cmSystemTools::GetLogicalWorkingDirectory().empty()) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Current working directory cannot be established.\n");
return 1;
@@ -139,27 +139,27 @@ int main(int argc, char const* const* argv)
std::map<std::string, std::string> definitions;
- auto const verboseLambda = [&log](const std::string&, cmake*,
+ auto const verboseLambda = [&log](std::string const&, cmake*,
cmMakefile*) -> bool {
log.SetVerbose(true);
cmCPack_Log(&log, cmCPackLog::LOG_OUTPUT, "Enable Verbose\n");
return true;
};
- auto const debugLambda = [&log](const std::string&, cmake*,
+ auto const debugLambda = [&log](std::string const&, cmake*,
cmMakefile*) -> bool {
log.SetDebug(true);
cmCPack_Log(&log, cmCPackLog::LOG_OUTPUT, "Enable Debug\n");
return true;
};
- auto const traceLambda = [](const std::string&, cmake* state,
+ auto const traceLambda = [](std::string const&, cmake* state,
cmMakefile*) -> bool {
state->SetTrace(true);
return true;
};
- auto const traceExpandLambda = [](const std::string&, cmake* state,
+ auto const traceExpandLambda = [](std::string const&, cmake* state,
cmMakefile*) -> bool {
state->SetTrace(true);
state->SetTraceExpand(true);
@@ -208,7 +208,8 @@ int main(int argc, char const* const* argv)
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
CommandArgument::setToTrue(listPresets) },
CommandArgument{ "-D", CommandArgument::Values::One,
- [&log, &definitions](const std::string& arg, cmake*,
+ CommandArgument::RequiresSeparator::No,
+ [&log, &definitions](std::string const& arg, cmake*,
cmMakefile*) -> bool {
std::string value = arg;
size_t pos = value.find_first_of('=');
@@ -254,12 +255,12 @@ int main(int argc, char const* const* argv)
// Set up presets
if (!preset.empty() || listPresets) {
- const auto workingDirectory = cmSystemTools::GetCurrentWorkingDirectory();
+ auto const workingDirectory = cmSystemTools::GetLogicalWorkingDirectory();
auto const presetGeneratorsPresent =
- [&generators](const cmCMakePresetsGraph::PackagePreset& p) {
+ [&generators](cmCMakePresetsGraph::PackagePreset const& p) {
return std::all_of(p.Generators.begin(), p.Generators.end(),
- [&generators](const std::string& gen) {
+ [&generators](std::string const& gen) {
return generators.GetGeneratorsList().count(
gen) != 0;
});
@@ -349,7 +350,8 @@ int main(int argc, char const* const* argv)
return 1;
}
- cmSystemTools::ChangeDirectory(expandedConfigurePreset->BinaryDir);
+ cmSystemTools::SetLogicalWorkingDirectory(
+ expandedConfigurePreset->BinaryDir);
auto presetEnvironment = expandedPreset->Environment;
for (auto const& var : presetEnvironment) {
@@ -405,9 +407,9 @@ int main(int argc, char const* const* argv)
bool cpackConfigFileSpecified = true;
if (!cpackConfigFile.empty()) {
- cpackConfigFile = cmSystemTools::CollapseFullPath(cpackConfigFile);
+ cpackConfigFile = cmSystemTools::ToNormalizedPathOnDisk(cpackConfigFile);
} else {
- cpackConfigFile = cmStrCat(cmSystemTools::GetCurrentWorkingDirectory(),
+ cpackConfigFile = cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(),
"/CPackConfig.cmake");
cpackConfigFileSpecified = false;
}
@@ -479,7 +481,7 @@ int main(int argc, char const* const* argv)
if (!cpackProjectDirectory.empty()) {
// The value has been set on the command line. Ensure it is absolute.
cpackProjectDirectory =
- cmSystemTools::CollapseFullPath(cpackProjectDirectory);
+ cmSystemTools::ToNormalizedPathOnDisk(cpackProjectDirectory);
} else {
// The value has not been set on the command line. Check config file.
if (cmValue pd = globalMF.GetDefinition("CPACK_PACKAGE_DIRECTORY")) {
@@ -487,7 +489,7 @@ int main(int argc, char const* const* argv)
cpackProjectDirectory = cmSystemTools::CollapseFullPath(*pd);
} else {
// Default to the current working directory.
- cpackProjectDirectory = cmSystemTools::GetCurrentWorkingDirectory();
+ cpackProjectDirectory = cmSystemTools::GetLogicalWorkingDirectory();
}
}
globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index 87081f0..474d24e 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestBZR.h"
#include <cstdlib>
@@ -16,14 +16,15 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
+#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
static int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/,
- const XML_Char* name,
+ XML_Char const* name,
XML_Encoding* info)
{
- static const int latin1[] = {
+ static int const latin1[] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011,
0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A,
@@ -70,8 +71,8 @@ static int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/,
return 0;
}
-cmCTestBZR::cmCTestBZR(cmCTest* ct, std::ostream& log)
- : cmCTestGlobalVC(ct, log)
+cmCTestBZR::cmCTestBZR(cmCTest* ct, cmMakefile* mf, std::ostream& log)
+ : cmCTestGlobalVC(ct, mf, log)
{
this->PriorRev = this->Unknown;
// Even though it is specified in the documentation, with bzr 1.13
@@ -85,7 +86,7 @@ cmCTestBZR::~cmCTestBZR() = default;
class cmCTestBZR::InfoParser : public cmCTestVC::LineParser
{
public:
- InfoParser(cmCTestBZR* bzr, const char* prefix)
+ InfoParser(cmCTestBZR* bzr, char const* prefix)
: BZR(bzr)
{
this->SetLog(&bzr->Log, prefix);
@@ -113,7 +114,7 @@ private:
class cmCTestBZR::RevnoParser : public cmCTestVC::LineParser
{
public:
- RevnoParser(cmCTestBZR* bzr, const char* prefix, std::string& rev)
+ RevnoParser(cmCTestBZR* bzr, char const* prefix, std::string& rev)
: Rev(rev)
{
this->SetLog(&bzr->Log, prefix);
@@ -178,7 +179,7 @@ class cmCTestBZR::LogParser
, private cmXMLParser
{
public:
- LogParser(cmCTestBZR* bzr, const char* prefix)
+ LogParser(cmCTestBZR* bzr, char const* prefix)
: OutputLogger(bzr->Log, prefix)
, BZR(bzr)
, EmailRegex("(.*) <([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+)>")
@@ -210,14 +211,14 @@ private:
cmsys::RegularExpression EmailRegex;
- bool ProcessChunk(const char* data, int length) override
+ bool ProcessChunk(char const* data, int length) override
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
- void StartElement(const std::string& name, const char** /*atts*/) override
+ void StartElement(std::string const& name, char const** /*atts*/) override
{
this->CData.clear();
if (name == "log") {
@@ -242,12 +243,12 @@ private:
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
cm::append(this->CData, data, data + length);
}
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "log") {
this->BZR->DoRevision(this->Rev, this->Changes);
@@ -277,7 +278,7 @@ private:
this->CData.clear();
}
- void ReportError(int /*line*/, int /*column*/, const char* msg) override
+ void ReportError(int /*line*/, int /*column*/, char const* msg) override
{
this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n";
}
@@ -286,7 +287,7 @@ private:
class cmCTestBZR::UpdateParser : public cmCTestVC::LineParser
{
public:
- UpdateParser(cmCTestBZR* bzr, const char* prefix)
+ UpdateParser(cmCTestBZR* bzr, char const* prefix)
: BZR(bzr)
{
this->SetLog(&bzr->Log, prefix);
@@ -297,12 +298,12 @@ private:
cmCTestBZR* BZR;
cmsys::RegularExpression RegexUpdate;
- bool ProcessChunk(const char* first, int length) override
+ bool ProcessChunk(char const* first, int length) override
{
bool last_is_new_line = (*first == '\r' || *first == '\n');
- const char* const last = first + length;
- for (const char* c = first; c != last; ++c) {
+ char const* const last = first + length;
+ for (char const* c = first; c != last; ++c) {
if (*c == '\r' || *c == '\n') {
if (!last_is_new_line) {
// Log this line.
@@ -345,8 +346,8 @@ private:
}
cmSystemTools::ConvertToUnixSlashes(path);
- const std::string dir = cmSystemTools::GetFilenamePath(path);
- const std::string name = cmSystemTools::GetFilenameName(path);
+ std::string const dir = cmSystemTools::GetFilenamePath(path);
+ std::string const name = cmSystemTools::GetFilenameName(path);
if (c0 == 'C') {
this->BZR->Dirs[dir][name].Status = PathConflicting;
@@ -363,9 +364,9 @@ private:
bool cmCTestBZR::UpdateImpl()
{
// Get user-specified update options.
- std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_UPDATE_OPTIONS");
if (opts.empty()) {
- opts = this->CTest->GetCTestConfiguration("BZRUpdateOptions");
+ opts = this->Makefile->GetSafeDefinition("CTEST_BZR_UPDATE_OPTIONS");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
@@ -419,7 +420,7 @@ bool cmCTestBZR::LoadRevisions()
class cmCTestBZR::StatusParser : public cmCTestVC::LineParser
{
public:
- StatusParser(cmCTestBZR* bzr, const char* prefix)
+ StatusParser(cmCTestBZR* bzr, char const* prefix)
: BZR(bzr)
{
this->SetLog(&bzr->Log, prefix);
diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h
index eb0dbbe..808dafa 100644
--- a/Source/CTest/cmCTestBZR.h
+++ b/Source/CTest/cmCTestBZR.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,6 +10,7 @@
#include "cmCTestGlobalVC.h"
class cmCTest;
+class cmMakefile;
/** \class cmCTestBZR
* \brief Interaction with bzr command-line tool
@@ -19,7 +20,7 @@ class cmCTestBZR : public cmCTestGlobalVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestBZR(cmCTest* ctest, std::ostream& log);
+ cmCTestBZR(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestBZR() override;
diff --git a/Source/CTest/cmCTestBinPacker.cxx b/Source/CTest/cmCTestBinPacker.cxx
index 6eb45fa..1bea81e 100644
--- a/Source/CTest/cmCTestBinPacker.cxx
+++ b/Source/CTest/cmCTestBinPacker.cxx
@@ -1,19 +1,19 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestBinPacker.h"
#include <algorithm>
#include <utility>
bool cmCTestBinPackerAllocation::operator==(
- const cmCTestBinPackerAllocation& other) const
+ cmCTestBinPackerAllocation const& other) const
{
return this->ProcessIndex == other.ProcessIndex &&
this->SlotsNeeded == other.SlotsNeeded && this->Id == other.Id;
}
bool cmCTestBinPackerAllocation::operator!=(
- const cmCTestBinPackerAllocation& other) const
+ cmCTestBinPackerAllocation const& other) const
{
return !(*this == other);
}
@@ -35,8 +35,8 @@ namespace {
*/
template <typename AllocationStrategy>
bool AllocateCTestResources(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
- const std::vector<std::string>& resourcesSorted, std::size_t currentIndex,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
+ std::vector<std::string> const& resourcesSorted, std::size_t currentIndex,
std::vector<cmCTestBinPackerAllocation*>& allocations)
{
// Iterate through all large enough resources until we find a solution
@@ -83,7 +83,7 @@ bool AllocateCTestResources(
template <typename AllocationStrategy>
bool AllocateCTestResources(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations)
{
// Sort the resource requirements in descending order by slots needed
@@ -115,27 +115,27 @@ class RoundRobinAllocationStrategy
{
public:
static void InitialSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted);
static void IncrementalSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex);
};
void RoundRobinAllocationStrategy::InitialSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted)
{
std::stable_sort(
resourcesSorted.rbegin(), resourcesSorted.rend(),
- [&resources](const std::string& id1, const std::string& id2) {
+ [&resources](std::string const& id1, std::string const& id2) {
return resources.at(id1).Free() < resources.at(id2).Free();
});
}
void RoundRobinAllocationStrategy::IncrementalSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex)
{
auto tmp = resourcesSorted[lastAllocatedIndex];
@@ -153,27 +153,27 @@ class BlockAllocationStrategy
{
public:
static void InitialSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted);
static void IncrementalSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex);
};
void BlockAllocationStrategy::InitialSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted)
{
std::stable_sort(
resourcesSorted.rbegin(), resourcesSorted.rend(),
- [&resources](const std::string& id1, const std::string& id2) {
+ [&resources](std::string const& id1, std::string const& id2) {
return resources.at(id1).Free() < resources.at(id2).Free();
});
}
void BlockAllocationStrategy::IncrementalSort(
- const std::map<std::string, cmCTestResourceAllocator::Resource>&,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const&,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex)
{
auto tmp = resourcesSorted[lastAllocatedIndex];
@@ -187,7 +187,7 @@ void BlockAllocationStrategy::IncrementalSort(
}
bool cmAllocateCTestResourcesRoundRobin(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations)
{
return AllocateCTestResources<RoundRobinAllocationStrategy>(resources,
@@ -195,7 +195,7 @@ bool cmAllocateCTestResourcesRoundRobin(
}
bool cmAllocateCTestResourcesBlock(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations)
{
return AllocateCTestResources<BlockAllocationStrategy>(resources,
diff --git a/Source/CTest/cmCTestBinPacker.h b/Source/CTest/cmCTestBinPacker.h
index e56a437..6390a1c 100644
--- a/Source/CTest/cmCTestBinPacker.h
+++ b/Source/CTest/cmCTestBinPacker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cstddef>
@@ -15,14 +15,14 @@ struct cmCTestBinPackerAllocation
int SlotsNeeded;
std::string Id;
- bool operator==(const cmCTestBinPackerAllocation& other) const;
- bool operator!=(const cmCTestBinPackerAllocation& other) const;
+ bool operator==(cmCTestBinPackerAllocation const& other) const;
+ bool operator!=(cmCTestBinPackerAllocation const& other) const;
};
bool cmAllocateCTestResourcesRoundRobin(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations);
bool cmAllocateCTestResourcesBlock(
- const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
+ std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations);
diff --git a/Source/CTest/cmCTestBuildAndTest.cxx b/Source/CTest/cmCTestBuildAndTest.cxx
new file mode 100644
index 0000000..68ca77a
--- /dev/null
+++ b/Source/CTest/cmCTestBuildAndTest.cxx
@@ -0,0 +1,341 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#include "cmCTestBuildAndTest.h"
+
+#include <chrono>
+#include <cstdint>
+#include <iostream>
+#include <ratio>
+#include <utility>
+
+#include <cm3p/uv.h>
+
+#include "cmBuildOptions.h"
+#include "cmCTest.h"
+#include "cmCTestTestHandler.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmProcessOutput.h"
+#include "cmState.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmUVHandlePtr.h"
+#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
+#include "cmWorkingDirectory.h"
+#include "cmake.h"
+
+struct cmMessageMetadata;
+
+cmCTestBuildAndTest::cmCTestBuildAndTest(cmCTest* ctest)
+ : CTest(ctest)
+{
+}
+
+bool cmCTestBuildAndTest::RunCMake(cmake* cm)
+{
+ std::vector<std::string> args;
+ args.push_back(cmSystemTools::GetCMakeCommand());
+ args.push_back(this->SourceDir);
+ if (!this->BuildGenerator.empty()) {
+ args.push_back("-G" + this->BuildGenerator);
+ }
+ if (!this->BuildGeneratorPlatform.empty()) {
+ args.push_back("-A" + this->BuildGeneratorPlatform);
+ }
+ if (!this->BuildGeneratorToolset.empty()) {
+ args.push_back("-T" + this->BuildGeneratorToolset);
+ }
+
+ char const* config = nullptr;
+ if (!this->CTest->GetConfigType().empty()) {
+ config = this->CTest->GetConfigType().c_str();
+ }
+
+ if (config) {
+ args.push_back("-DCMAKE_BUILD_TYPE:STRING=" + std::string(config));
+ }
+ if (!this->BuildMakeProgram.empty() &&
+ (this->BuildGenerator.find("Make") != std::string::npos ||
+ this->BuildGenerator.find("Ninja") != std::string::npos)) {
+ args.push_back("-DCMAKE_MAKE_PROGRAM:FILEPATH=" + this->BuildMakeProgram);
+ }
+
+ for (std::string const& opt : this->BuildOptions) {
+ args.push_back(opt);
+ }
+ std::cout << "======== CMake output ======\n";
+ if (cm->Run(args) != 0) {
+ std::cout << "======== End CMake output ======\n"
+ "Error: cmake execution failed\n";
+ return false;
+ }
+ // do another config?
+ if (this->BuildTwoConfig) {
+ if (cm->Run(args) != 0) {
+ std::cout << "======== End CMake output ======\n"
+ "Error: cmake execution failed\n";
+ return false;
+ }
+ }
+ std::cout << "======== End CMake output ======\n";
+ return true;
+}
+
+bool cmCTestBuildAndTest::RunTest(std::vector<std::string> const& argv,
+ int* retVal, cmDuration timeout)
+{
+ cmUVProcessChainBuilder builder;
+ builder.AddCommand(argv).SetMergedBuiltinStreams();
+ auto chain = builder.Start();
+
+ cmProcessOutput processOutput(cmProcessOutput::Auto);
+ cm::uv_pipe_ptr outputStream;
+ outputStream.init(chain.GetLoop(), 0);
+ uv_pipe_open(outputStream, chain.OutputStream());
+ auto outputHandle = cmUVStreamRead(
+ outputStream,
+ [&processOutput](std::vector<char> data) {
+ std::string decoded;
+ processOutput.DecodeText(data.data(), data.size(), decoded);
+ std::cout << decoded << std::flush;
+ },
+ []() {});
+
+ bool complete = chain.Wait(static_cast<uint64_t>(timeout.count() * 1000.0));
+
+ bool result = false;
+
+ if (complete) {
+ auto const& status = chain.GetStatus(0);
+ auto exception = status.GetException();
+ switch (exception.first) {
+ case cmUVProcessChain::ExceptionCode::None:
+ *retVal = static_cast<int>(status.ExitStatus);
+ result = true;
+ break;
+ case cmUVProcessChain::ExceptionCode::Spawn: {
+ std::cout << "\n*** ERROR executing: " << exception.second;
+ } break;
+ default: {
+ *retVal = status.TermSignal;
+ std::cout << "\n*** Exception executing: " << exception.second;
+ } break;
+ }
+ }
+
+ return result;
+}
+
+class cmCTestBuildAndTestCaptureRAII
+{
+ cmake& CM;
+
+public:
+ cmCTestBuildAndTestCaptureRAII(cmake& cm)
+ : CM(cm)
+ {
+ cmSystemTools::SetMessageCallback(
+ [](std::string const& msg, cmMessageMetadata const& /* unused */) {
+ std::cout << msg << std::endl;
+ });
+
+ cmSystemTools::SetStdoutCallback(
+ [](std::string const& m) { std::cout << m << std::flush; });
+ cmSystemTools::SetStderrCallback(
+ [](std::string const& m) { std::cout << m << std::flush; });
+
+ this->CM.SetProgressCallback([](std::string const& msg, float prog) {
+ if (prog < 0) {
+ std::cout << msg << std::endl;
+ }
+ });
+ }
+
+ ~cmCTestBuildAndTestCaptureRAII()
+ {
+ this->CM.SetProgressCallback(nullptr);
+ cmSystemTools::SetStderrCallback(nullptr);
+ cmSystemTools::SetStdoutCallback(nullptr);
+ cmSystemTools::SetMessageCallback(nullptr);
+ }
+
+ cmCTestBuildAndTestCaptureRAII(cmCTestBuildAndTestCaptureRAII const&) =
+ delete;
+ cmCTestBuildAndTestCaptureRAII& operator=(
+ cmCTestBuildAndTestCaptureRAII const&) = delete;
+};
+
+int cmCTestBuildAndTest::Run()
+{
+ // if the generator and make program are not specified then it is an error
+ if (this->BuildGenerator.empty()) {
+ std::cout << "--build-and-test requires that the generator "
+ "be provided using the --build-generator "
+ "command line option.\n";
+ return 1;
+ }
+
+ cmake cm(cmake::RoleProject, cmState::Project);
+ cm.SetHomeDirectory("");
+ cm.SetHomeOutputDirectory("");
+ cmCTestBuildAndTestCaptureRAII captureRAII(cm);
+ static_cast<void>(captureRAII);
+
+ if (this->CTest->GetConfigType().empty() && !this->ConfigSample.empty()) {
+ // use the config sample to set the ConfigType
+ std::string fullPath;
+ std::string resultingConfig;
+ std::vector<std::string> extraPaths;
+ std::vector<std::string> failed;
+ fullPath = cmCTestTestHandler::FindExecutable(
+ this->CTest, this->ConfigSample, resultingConfig, extraPaths, failed);
+ if (!fullPath.empty() && !resultingConfig.empty()) {
+ this->CTest->SetConfigType(resultingConfig);
+ }
+ std::cout << "Using config sample with results: " << fullPath << " and "
+ << resultingConfig << std::endl;
+ }
+
+ // we need to honor the timeout specified, the timeout include cmake, build
+ // and test time
+ auto clock_start = std::chrono::steady_clock::now();
+
+ // make sure the binary dir is there
+ std::cout << "Internal cmake changing into directory: " << this->BinaryDir
+ << std::endl;
+ if (!cmSystemTools::FileIsDirectory(this->BinaryDir)) {
+ cmSystemTools::MakeDirectory(this->BinaryDir);
+ }
+ cmWorkingDirectory workdir(this->BinaryDir);
+ if (workdir.Failed()) {
+ std::cout << workdir.GetError() << '\n';
+ return 1;
+ }
+
+ if (this->BuildNoCMake) {
+ // Make the generator available for the Build call below.
+ cm.SetGlobalGenerator(cm.CreateGlobalGenerator(this->BuildGenerator));
+ if (!this->BuildGeneratorPlatform.empty()) {
+ cmMakefile mf(cm.GetGlobalGenerator(), cm.GetCurrentSnapshot());
+ if (!cm.GetGlobalGenerator()->SetGeneratorPlatform(
+ this->BuildGeneratorPlatform, &mf)) {
+ return 1;
+ }
+ }
+
+ // Load the cache to make CMAKE_MAKE_PROGRAM available.
+ cm.LoadCache(this->BinaryDir);
+ } else {
+ // do the cmake step, no timeout here since it is not a sub process
+ if (!this->RunCMake(&cm)) {
+ return 1;
+ }
+ }
+
+ // do the build
+ if (this->BuildTargets.empty()) {
+ this->BuildTargets.emplace_back();
+ }
+ for (std::string const& tar : this->BuildTargets) {
+ cmDuration remainingTime = std::chrono::seconds(0);
+ if (this->Timeout > cmDuration::zero()) {
+ remainingTime =
+ this->Timeout - (std::chrono::steady_clock::now() - clock_start);
+ if (remainingTime <= std::chrono::seconds(0)) {
+ std::cout << "--build-and-test timeout exceeded. ";
+ return 1;
+ }
+ }
+ char const* config = nullptr;
+ if (!this->CTest->GetConfigType().empty()) {
+ config = this->CTest->GetConfigType().c_str();
+ }
+ if (!config) {
+ config = "Debug";
+ }
+
+ cmBuildOptions buildOptions(!this->BuildNoClean, false,
+ PackageResolveMode::Disable);
+ int retVal = cm.GetGlobalGenerator()->Build(
+ cmake::NO_BUILD_PARALLEL_LEVEL, this->SourceDir, this->BinaryDir,
+ this->BuildProject, { tar }, std::cout, this->BuildMakeProgram, config,
+ buildOptions, false, remainingTime, cmSystemTools::OUTPUT_PASSTHROUGH);
+ // if the build failed then return
+ if (retVal) {
+ return 1;
+ }
+ }
+
+ // if no test was specified then we are done
+ if (this->TestCommand.empty()) {
+ return 0;
+ }
+
+ // now run the compiled test if we can find it
+ // store the final location in fullPath
+ std::string fullPath;
+ std::string resultingConfig;
+ std::vector<std::string> extraPaths;
+ // if this->ExecutableDirectory is set try that as well
+ if (!this->ExecutableDirectory.empty()) {
+ std::string tempPath =
+ cmStrCat(this->ExecutableDirectory, '/', this->TestCommand);
+ extraPaths.push_back(tempPath);
+ }
+ std::vector<std::string> failed;
+ fullPath = cmCTestTestHandler::FindExecutable(
+ this->CTest, this->TestCommand, resultingConfig, extraPaths, failed);
+
+ if (!cmSystemTools::FileExists(fullPath)) {
+ std::cout
+ << "Could not find path to executable, perhaps it was not built: "
+ << this->TestCommand << "\n"
+ << "tried to find it in these places:\n"
+ << fullPath << '\n';
+ for (std::string const& fail : failed) {
+ std::cout << fail << '\n';
+ }
+ return 1;
+ }
+
+ std::vector<std::string> testCommand;
+ testCommand.push_back(fullPath);
+ for (std::string const& testCommandArg : this->TestCommandArgs) {
+ testCommand.push_back(testCommandArg);
+ }
+ int retval = 0;
+ // run the test from the this->BuildRunDir if set
+ if (!this->BuildRunDir.empty()) {
+ std::cout << "Run test in directory: " << this->BuildRunDir << '\n';
+ if (!workdir.SetDirectory(this->BuildRunDir)) {
+ std::cout << workdir.GetError() << '\n';
+ return 1;
+ }
+ }
+ std::cout << "Running test command: \"" << fullPath << '"';
+ for (std::string const& testCommandArg : this->TestCommandArgs) {
+ std::cout << " \"" << testCommandArg << '"';
+ }
+ std::cout << '\n';
+
+ // how much time is remaining
+ cmDuration remainingTime = std::chrono::seconds(0);
+ if (this->Timeout > cmDuration::zero()) {
+ remainingTime =
+ this->Timeout - (std::chrono::steady_clock::now() - clock_start);
+ if (remainingTime <= std::chrono::seconds(0)) {
+ std::cout << "--build-and-test timeout exceeded. ";
+ return 1;
+ }
+ }
+
+ bool runTestRes = this->RunTest(testCommand, &retval, remainingTime);
+
+ if (!runTestRes || retval != 0) {
+ std::cout << "\nTest command failed: " << testCommand[0] << '\n';
+ retval = 1;
+ }
+
+ return retval;
+}
diff --git a/Source/CTest/cmCTestBuildAndTest.h b/Source/CTest/cmCTestBuildAndTest.h
new file mode 100644
index 0000000..f1dc3d2
--- /dev/null
+++ b/Source/CTest/cmCTestBuildAndTest.h
@@ -0,0 +1,56 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+#include "cmDuration.h"
+
+class cmake;
+class cmCTest;
+
+/** \class cmCTestBuildAndTest
+ * \brief A class that handles ctest -S invocations
+ *
+ */
+class cmCTestBuildAndTest
+{
+public:
+ /*
+ * The main entry point for this class
+ */
+ int Run();
+
+ cmCTestBuildAndTest(cmCTest* ctest);
+
+private:
+ cmCTest* CTest;
+
+ bool RunCMake(cmake* cm);
+ bool RunTest(std::vector<std::string> const& args, int* retVal,
+ cmDuration timeout);
+
+ std::string BuildGenerator;
+ std::string BuildGeneratorPlatform;
+ std::string BuildGeneratorToolset;
+ std::vector<std::string> BuildOptions;
+ bool BuildTwoConfig = false;
+ std::string BuildMakeProgram;
+ std::string ConfigSample;
+ std::string SourceDir;
+ std::string BinaryDir;
+ std::string BuildProject;
+ std::string TestCommand;
+ bool BuildNoClean = false;
+ std::string BuildRunDir;
+ std::string ExecutableDirectory;
+ std::vector<std::string> TestCommandArgs;
+ std::vector<std::string> BuildTargets;
+ bool BuildNoCMake = false;
+ cmDuration Timeout = cmDuration::zero();
+
+ friend class cmCTest;
+};
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
deleted file mode 100644
index 9faabf7..0000000
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ /dev/null
@@ -1,453 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCTestBuildAndTestHandler.h"
-
-#include <chrono>
-#include <cstdlib>
-#include <cstring>
-#include <ratio>
-
-#include "cmBuildOptions.h"
-#include "cmCTest.h"
-#include "cmCTestTestHandler.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmWorkingDirectory.h"
-#include "cmake.h"
-
-struct cmMessageMetadata;
-
-cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
-{
- this->BuildTwoConfig = false;
- this->BuildNoClean = false;
- this->BuildNoCMake = false;
- this->Timeout = cmDuration::zero();
-}
-
-void cmCTestBuildAndTestHandler::Initialize()
-{
- this->BuildTargets.clear();
- this->Superclass::Initialize();
-}
-
-const char* cmCTestBuildAndTestHandler::GetOutput()
-{
- return this->Output.c_str();
-}
-int cmCTestBuildAndTestHandler::ProcessHandler()
-{
- this->Output.clear();
- std::string output;
- cmSystemTools::ResetErrorOccurredFlag();
- int retv = this->RunCMakeAndTest(&this->Output);
- cmSystemTools::ResetErrorOccurredFlag();
- return retv;
-}
-
-int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
- std::ostringstream& out,
- std::string& cmakeOutString,
- cmake* cm)
-{
- std::vector<std::string> args;
- args.push_back(cmSystemTools::GetCMakeCommand());
- args.push_back(this->SourceDir);
- if (!this->BuildGenerator.empty()) {
- args.push_back("-G" + this->BuildGenerator);
- }
- if (!this->BuildGeneratorPlatform.empty()) {
- args.push_back("-A" + this->BuildGeneratorPlatform);
- }
- if (!this->BuildGeneratorToolset.empty()) {
- args.push_back("-T" + this->BuildGeneratorToolset);
- }
-
- const char* config = nullptr;
- if (!this->CTest->GetConfigType().empty()) {
- config = this->CTest->GetConfigType().c_str();
- }
-
- if (config) {
- args.push_back("-DCMAKE_BUILD_TYPE:STRING=" + std::string(config));
- }
- if (!this->BuildMakeProgram.empty() &&
- (this->BuildGenerator.find("Make") != std::string::npos ||
- this->BuildGenerator.find("Ninja") != std::string::npos)) {
- args.push_back("-DCMAKE_MAKE_PROGRAM:FILEPATH=" + this->BuildMakeProgram);
- }
-
- for (std::string const& opt : this->BuildOptions) {
- args.push_back(opt);
- }
- if (cm->Run(args) != 0) {
- out << "Error: cmake execution failed\n";
- out << cmakeOutString << "\n";
- if (outstring) {
- *outstring = out.str();
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE, out.str() << std::endl);
- }
- return 1;
- }
- // do another config?
- if (this->BuildTwoConfig) {
- if (cm->Run(args) != 0) {
- out << "Error: cmake execution failed\n";
- out << cmakeOutString << "\n";
- if (outstring) {
- *outstring = out.str();
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE, out.str() << std::endl);
- }
- return 1;
- }
- }
- out << "======== CMake output ======\n";
- out << cmakeOutString;
- out << "======== End CMake output ======\n";
- return 0;
-}
-
-class cmCTestBuildAndTestCaptureRAII
-{
- cmake& CM;
-
-public:
- cmCTestBuildAndTestCaptureRAII(cmake& cm, std::string& s)
- : CM(cm)
- {
- cmSystemTools::SetMessageCallback(
- [&s](const std::string& msg, const cmMessageMetadata& /* unused */) {
- s += msg;
- s += "\n";
- });
-
- cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; });
- cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; });
-
- this->CM.SetProgressCallback([&s](const std::string& msg, float prog) {
- if (prog < 0) {
- s += msg;
- s += "\n";
- }
- });
- }
-
- ~cmCTestBuildAndTestCaptureRAII()
- {
- this->CM.SetProgressCallback(nullptr);
- cmSystemTools::SetStderrCallback(nullptr);
- cmSystemTools::SetStdoutCallback(nullptr);
- cmSystemTools::SetMessageCallback(nullptr);
- }
-
- cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) =
- delete;
- cmCTestBuildAndTestCaptureRAII& operator=(
- const cmCTestBuildAndTestCaptureRAII&) = delete;
-};
-
-int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
-{
- // if the generator and make program are not specified then it is an error
- if (this->BuildGenerator.empty()) {
- if (outstring) {
- *outstring = "--build-and-test requires that the generator "
- "be provided using the --build-generator "
- "command line option.\n";
- }
- return 1;
- }
-
- cmake cm(cmake::RoleProject, cmState::Project);
- cm.SetHomeDirectory("");
- cm.SetHomeOutputDirectory("");
- std::string cmakeOutString;
- cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString);
- static_cast<void>(captureRAII);
- std::ostringstream out;
-
- if (this->CTest->GetConfigType().empty() && !this->ConfigSample.empty()) {
- // use the config sample to set the ConfigType
- std::string fullPath;
- std::string resultingConfig;
- std::vector<std::string> extraPaths;
- std::vector<std::string> failed;
- fullPath = cmCTestTestHandler::FindExecutable(
- this->CTest, this->ConfigSample, resultingConfig, extraPaths, failed);
- if (!fullPath.empty() && !resultingConfig.empty()) {
- this->CTest->SetConfigType(resultingConfig);
- }
- out << "Using config sample with results: " << fullPath << " and "
- << resultingConfig << std::endl;
- }
-
- // we need to honor the timeout specified, the timeout include cmake, build
- // and test time
- auto clock_start = std::chrono::steady_clock::now();
-
- // make sure the binary dir is there
- out << "Internal cmake changing into directory: " << this->BinaryDir
- << std::endl;
- if (!cmSystemTools::FileIsDirectory(this->BinaryDir)) {
- cmSystemTools::MakeDirectory(this->BinaryDir);
- }
- cmWorkingDirectory workdir(this->BinaryDir);
- if (workdir.Failed()) {
- auto msg = "Failed to change working directory to " + this->BinaryDir +
- " : " + std::strerror(workdir.GetLastResult()) + "\n";
- if (outstring) {
- *outstring = msg;
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE, msg);
- }
- return 1;
- }
-
- if (this->BuildNoCMake) {
- // Make the generator available for the Build call below.
- cm.SetGlobalGenerator(cm.CreateGlobalGenerator(this->BuildGenerator));
- if (!this->BuildGeneratorPlatform.empty()) {
- cmMakefile mf(cm.GetGlobalGenerator(), cm.GetCurrentSnapshot());
- if (!cm.GetGlobalGenerator()->SetGeneratorPlatform(
- this->BuildGeneratorPlatform, &mf)) {
- return 1;
- }
- }
-
- // Load the cache to make CMAKE_MAKE_PROGRAM available.
- cm.LoadCache(this->BinaryDir);
- } else {
- // do the cmake step, no timeout here since it is not a sub process
- if (this->RunCMake(outstring, out, cmakeOutString, &cm)) {
- return 1;
- }
- }
-
- // do the build
- if (this->BuildTargets.empty()) {
- this->BuildTargets.emplace_back();
- }
- for (std::string const& tar : this->BuildTargets) {
- cmDuration remainingTime = std::chrono::seconds(0);
- if (this->Timeout > cmDuration::zero()) {
- remainingTime =
- this->Timeout - (std::chrono::steady_clock::now() - clock_start);
- if (remainingTime <= std::chrono::seconds(0)) {
- if (outstring) {
- *outstring = "--build-and-test timeout exceeded. ";
- }
- return 1;
- }
- }
- const char* config = nullptr;
- if (!this->CTest->GetConfigType().empty()) {
- config = this->CTest->GetConfigType().c_str();
- }
- if (!config) {
- config = "Debug";
- }
-
- cmBuildOptions buildOptions(!this->BuildNoClean, false,
- PackageResolveMode::Disable);
- int retVal = cm.GetGlobalGenerator()->Build(
- cmake::NO_BUILD_PARALLEL_LEVEL, this->SourceDir, this->BinaryDir,
- this->BuildProject, { tar }, out, this->BuildMakeProgram, config,
- buildOptions, false, remainingTime);
- // if the build failed then return
- if (retVal) {
- if (outstring) {
- *outstring = out.str();
- }
- return 1;
- }
- }
- if (outstring) {
- *outstring = out.str();
- }
-
- // if no test was specified then we are done
- if (this->TestCommand.empty()) {
- return 0;
- }
-
- // now run the compiled test if we can find it
- // store the final location in fullPath
- std::string fullPath;
- std::string resultingConfig;
- std::vector<std::string> extraPaths;
- // if this->ExecutableDirectory is set try that as well
- if (!this->ExecutableDirectory.empty()) {
- std::string tempPath =
- cmStrCat(this->ExecutableDirectory, '/', this->TestCommand);
- extraPaths.push_back(tempPath);
- }
- std::vector<std::string> failed;
- fullPath = cmCTestTestHandler::FindExecutable(
- this->CTest, this->TestCommand, resultingConfig, extraPaths, failed);
-
- if (!cmSystemTools::FileExists(fullPath)) {
- out << "Could not find path to executable, perhaps it was not built: "
- << this->TestCommand << "\n";
- out << "tried to find it in these places:\n";
- out << fullPath << "\n";
- for (std::string const& fail : failed) {
- out << fail << "\n";
- }
- if (outstring) {
- *outstring = out.str();
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE, out.str());
- }
- return 1;
- }
-
- std::vector<std::string> testCommand;
- testCommand.push_back(fullPath);
- for (std::string const& testCommandArg : this->TestCommandArgs) {
- testCommand.push_back(testCommandArg);
- }
- std::string outs;
- int retval = 0;
- // run the test from the this->BuildRunDir if set
- if (!this->BuildRunDir.empty()) {
- out << "Run test in directory: " << this->BuildRunDir << "\n";
- if (!workdir.SetDirectory(this->BuildRunDir)) {
- out << "Failed to change working directory : "
- << std::strerror(workdir.GetLastResult()) << "\n";
- if (outstring) {
- *outstring = out.str();
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE, out.str());
- }
- return 1;
- }
- }
- out << "Running test command: \"" << fullPath << "\"";
- for (std::string const& testCommandArg : this->TestCommandArgs) {
- out << " \"" << testCommandArg << "\"";
- }
- out << "\n";
-
- // how much time is remaining
- cmDuration remainingTime = std::chrono::seconds(0);
- if (this->Timeout > cmDuration::zero()) {
- remainingTime =
- this->Timeout - (std::chrono::steady_clock::now() - clock_start);
- if (remainingTime <= std::chrono::seconds(0)) {
- if (outstring) {
- *outstring = "--build-and-test timeout exceeded. ";
- }
- return 1;
- }
- }
-
- bool runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, nullptr,
- remainingTime, nullptr);
-
- if (!runTestRes || retval != 0) {
- out << "Test command failed: " << testCommand[0] << "\n";
- retval = 1;
- }
-
- out << outs << "\n";
- if (outstring) {
- *outstring = out.str();
- } else {
- cmCTestLog(this->CTest, OUTPUT, out.str() << std::endl);
- }
- return retval;
-}
-
-int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
- const std::string& currentArg, size_t& idx,
- 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) {
- if (idx + 2 < allArgs.size()) {
- idx++;
- this->SourceDir = allArgs[idx];
- idx++;
- this->BinaryDir = allArgs[idx];
- // dir must exist before CollapseFullPath is called
- cmSystemTools::MakeDirectory(this->BinaryDir);
- this->BinaryDir = cmSystemTools::CollapseFullPath(this->BinaryDir);
- this->SourceDir = cmSystemTools::CollapseFullPath(this->SourceDir);
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "--build-and-test must have source and binary dir"
- << std::endl);
- return 0;
- }
- } else if (cmHasLiteralPrefix(currentArg, "--build-target") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->BuildTargets.push_back(allArgs[idx]);
- } else if (cmHasLiteralPrefix(currentArg, "--build-nocmake")) {
- this->BuildNoCMake = true;
- } else if (cmHasLiteralPrefix(currentArg, "--build-run-dir") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->BuildRunDir = allArgs[idx];
- } else if (cmHasLiteralPrefix(currentArg, "--build-two-config")) {
- this->BuildTwoConfig = true;
- } else if (cmHasLiteralPrefix(currentArg, "--build-exe-dir") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->ExecutableDirectory = allArgs[idx];
- } else if (cmHasLiteralPrefix(currentArg, "--test-timeout") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->Timeout = cmDuration(atof(allArgs[idx].c_str()));
- } else if (currentArg == "--build-generator" && idx < allArgs.size() - 1) {
- idx++;
- this->BuildGenerator = allArgs[idx];
- } else if (currentArg == "--build-generator-platform" &&
- idx < allArgs.size() - 1) {
- idx++;
- this->BuildGeneratorPlatform = allArgs[idx];
- } else if (currentArg == "--build-generator-toolset" &&
- idx < allArgs.size() - 1) {
- idx++;
- this->BuildGeneratorToolset = allArgs[idx];
- } else if (cmHasLiteralPrefix(currentArg, "--build-project") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->BuildProject = allArgs[idx];
- } else if (cmHasLiteralPrefix(currentArg, "--build-makeprogram") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->BuildMakeProgram = allArgs[idx];
- } else if (cmHasLiteralPrefix(currentArg, "--build-config-sample") &&
- idx < allArgs.size() - 1) {
- idx++;
- this->ConfigSample = allArgs[idx];
- } else if (cmHasLiteralPrefix(currentArg, "--build-noclean")) {
- this->BuildNoClean = true;
- } 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]);
- }
- } 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
deleted file mode 100644
index 60b3a11..0000000
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* 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 <cstddef>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "cmCTestGenericHandler.h"
-#include "cmDuration.h"
-
-class cmake;
-
-/** \class cmCTestBuildAndTestHandler
- * \brief A class that handles ctest -S invocations
- *
- */
-class cmCTestBuildAndTestHandler : public cmCTestGenericHandler
-{
-public:
- using Superclass = cmCTestGenericHandler;
-
- /*
- * The main entry point for this class
- */
- 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,
- bool& validArg) override;
-
- /*
- * Get the output variable
- */
- const char* GetOutput();
-
- cmCTestBuildAndTestHandler();
-
- void Initialize() override;
-
-protected:
- //! Run CMake and build a test and then run it as a single test.
- int RunCMakeAndTest(std::string* output);
- int RunCMake(std::string* outstring, std::ostringstream& out,
- std::string& cmakeOutString, cmake* cm);
-
- std::string Output;
-
- std::string BuildGenerator;
- std::string BuildGeneratorPlatform;
- std::string BuildGeneratorToolset;
- std::vector<std::string> BuildOptions;
- bool BuildTwoConfig;
- std::string BuildMakeProgram;
- std::string ConfigSample;
- std::string SourceDir;
- std::string BinaryDir;
- std::string BuildProject;
- std::string TestCommand;
- bool BuildNoClean;
- std::string BuildRunDir;
- std::string ExecutableDirectory;
- std::vector<std::string> TestCommandArgs;
- std::vector<std::string> BuildTargets;
- bool BuildNoCMake;
- cmDuration Timeout;
-};
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index d8ef195..d74ab55 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -1,15 +1,18 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestBuildCommand.h"
#include <sstream>
#include <utility>
+#include <cm/memory>
#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmCTest.h"
#include "cmCTestBuildHandler.h"
-#include "cmCommand.h"
+#include "cmCTestGenericHandler.h"
+#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -18,45 +21,37 @@
#include "cmValue.h"
#include "cmake.h"
-class cmExecutionStatus;
-
-std::unique_ptr<cmCommand> cmCTestBuildCommand::Clone()
-{
- auto ni = cm::make_unique<cmCTestBuildCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
-}
-
-void cmCTestBuildCommand::BindArguments()
+bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
{
- this->cmCTestHandlerCommand::BindArguments();
- this->Bind("NUMBER_ERRORS"_s, this->NumberErrors);
- this->Bind("NUMBER_WARNINGS"_s, this->NumberWarnings);
- this->Bind("TARGET"_s, this->Target);
- this->Bind("CONFIGURATION"_s, this->Configuration);
- this->Bind("FLAGS"_s, this->Flags);
- this->Bind("PROJECT_NAME"_s, this->ProjectName);
- this->Bind("PARALLEL_LEVEL"_s, this->ParallelLevel);
+ static auto const parser =
+ cmArgumentParser<BuildArguments>{ MakeHandlerParser<BuildArguments>() }
+ .Bind("NUMBER_ERRORS"_s, &BuildArguments::NumberErrors)
+ .Bind("NUMBER_WARNINGS"_s, &BuildArguments::NumberWarnings)
+ .Bind("TARGET"_s, &BuildArguments::Target)
+ .Bind("CONFIGURATION"_s, &BuildArguments::Configuration)
+ .Bind("FLAGS"_s, &BuildArguments::Flags)
+ .Bind("PROJECT_NAME"_s, &BuildArguments::ProjectName)
+ .Bind("PARALLEL_LEVEL"_s, &BuildArguments::ParallelLevel);
+
+ return this->Invoke(parser, args, status, [&](BuildArguments& a) {
+ return this->ExecuteHandlerCommand(a, status);
+ });
}
-cmCTestBuildCommand::~cmCTestBuildCommand() = default;
-
-cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
+std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const
{
- cmCTestBuildHandler* handler = this->CTest->GetBuildHandler();
- handler->Initialize();
-
- this->Handler = handler;
+ cmMakefile& mf = status.GetMakefile();
+ auto const& args = static_cast<BuildArguments&>(arguments);
+ auto handler = cm::make_unique<cmCTestBuildHandler>(this->CTest);
- cmValue ctestBuildCommand =
- this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
+ cmValue ctestBuildCommand = mf.GetDefinition("CTEST_BUILD_COMMAND");
if (cmNonempty(ctestBuildCommand)) {
this->CTest->SetCTestConfiguration("MakeCommand", *ctestBuildCommand,
- this->Quiet);
+ args.Quiet);
} else {
- cmValue cmakeGeneratorName =
- this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
+ cmValue cmakeGeneratorName = mf.GetDefinition("CTEST_CMAKE_GENERATOR");
// Build configuration is determined by: CONFIGURATION argument,
// or CTEST_BUILD_CONFIGURATION script variable, or
@@ -64,54 +59,46 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
// line argument... in that order.
//
cmValue ctestBuildConfiguration =
- this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
- std::string cmakeBuildConfiguration = cmNonempty(this->Configuration)
- ? this->Configuration
+ mf.GetDefinition("CTEST_BUILD_CONFIGURATION");
+ std::string cmakeBuildConfiguration = cmNonempty(args.Configuration)
+ ? args.Configuration
: cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration
: this->CTest->GetConfigType();
- const std::string& cmakeBuildAdditionalFlags = cmNonempty(this->Flags)
- ? this->Flags
- : this->Makefile->GetSafeDefinition("CTEST_BUILD_FLAGS");
- const std::string& cmakeBuildTarget = cmNonempty(this->Target)
- ? this->Target
- : this->Makefile->GetSafeDefinition("CTEST_BUILD_TARGET");
+ std::string const& cmakeBuildAdditionalFlags = cmNonempty(args.Flags)
+ ? args.Flags
+ : mf.GetSafeDefinition("CTEST_BUILD_FLAGS");
+ std::string const& cmakeBuildTarget = cmNonempty(args.Target)
+ ? args.Target
+ : mf.GetSafeDefinition("CTEST_BUILD_TARGET");
if (cmNonempty(cmakeGeneratorName)) {
if (cmakeBuildConfiguration.empty()) {
cmakeBuildConfiguration = "Release";
}
- if (this->GlobalGenerator) {
- if (this->GlobalGenerator->GetName() != *cmakeGeneratorName) {
- this->GlobalGenerator.reset();
- }
- }
- if (!this->GlobalGenerator) {
- this->GlobalGenerator =
- this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
- *cmakeGeneratorName);
- if (!this->GlobalGenerator) {
- std::string e = cmStrCat("could not create generator named \"",
- *cmakeGeneratorName, '"');
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
- cmSystemTools::SetFatalErrorOccurred();
- return nullptr;
- }
+
+ auto globalGenerator =
+ mf.GetCMakeInstance()->CreateGlobalGenerator(*cmakeGeneratorName);
+ if (!globalGenerator) {
+ std::string e = cmStrCat("could not create generator named \"",
+ *cmakeGeneratorName, '"');
+ mf.IssueMessage(MessageType::FATAL_ERROR, e);
+ cmSystemTools::SetFatalErrorOccurred();
+ return nullptr;
}
if (cmakeBuildConfiguration.empty()) {
cmakeBuildConfiguration = "Debug";
}
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
- std::string buildCommand =
- this->GlobalGenerator->GenerateCMakeBuildCommand(
- cmakeBuildTarget, cmakeBuildConfiguration, this->ParallelLevel,
- cmakeBuildAdditionalFlags, this->Makefile->IgnoreErrorsCMP0061());
+ std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
+ cmakeBuildTarget, cmakeBuildConfiguration, args.ParallelLevel,
+ cmakeBuildAdditionalFlags, false);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" << buildCommand << "\n",
- this->Quiet);
+ args.Quiet);
this->CTest->SetCTestConfiguration("MakeCommand", buildCommand,
- this->Quiet);
+ args.Quiet);
} else {
std::ostringstream ostr;
/* clang-format off */
@@ -120,38 +107,39 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
"is set. Otherwise, set CTEST_BUILD_COMMAND to build the project "
"with a custom command line.";
/* clang-format on */
- this->SetError(ostr.str());
+ status.SetError(ostr.str());
return nullptr;
}
}
- if (cmValue useLaunchers =
- this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) {
+ if (cmValue useLaunchers = mf.GetDefinition("CTEST_USE_LAUNCHERS")) {
this->CTest->SetCTestConfiguration("UseLaunchers", *useLaunchers,
- this->Quiet);
+ args.Quiet);
}
if (cmValue labelsForSubprojects =
- this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ mf.GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
- *labelsForSubprojects, this->Quiet);
+ *labelsForSubprojects, args.Quiet);
}
- handler->SetQuiet(this->Quiet);
- return handler;
+ handler->SetQuiet(args.Quiet);
+ return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
}
-bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status)
+void cmCTestBuildCommand::ProcessAdditionalValues(
+ cmCTestGenericHandler* generic, HandlerArguments const& arguments,
+ cmExecutionStatus& status) const
{
- bool ret = this->cmCTestHandlerCommand::InitialPass(args, status);
- if (!this->NumberErrors.empty()) {
- this->Makefile->AddDefinition(
- this->NumberErrors, std::to_string(this->Handler->GetTotalErrors()));
+ cmMakefile& mf = status.GetMakefile();
+ auto const& args = static_cast<BuildArguments const&>(arguments);
+ auto const* handler = static_cast<cmCTestBuildHandler*>(generic);
+ if (!args.NumberErrors.empty()) {
+ mf.AddDefinition(args.NumberErrors,
+ std::to_string(handler->GetTotalErrors()));
}
- if (!this->NumberWarnings.empty()) {
- this->Makefile->AddDefinition(
- this->NumberWarnings, std::to_string(this->Handler->GetTotalWarnings()));
+ if (!args.NumberWarnings.empty()) {
+ mf.AddDefinition(args.NumberWarnings,
+ std::to_string(handler->GetTotalWarnings()));
}
- return ret;
}
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index 3b7f4f9..805da0f 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -1,57 +1,45 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
-#include <cm/memory>
-
#include "cmCTestHandlerCommand.h"
-class cmCommand;
-class cmCTestBuildHandler;
-class cmCTestGenericHandler;
class cmExecutionStatus;
-class cmGlobalGenerator;
+class cmCTestGenericHandler;
-/** \class cmCTestBuild
- * \brief Run a ctest script
- *
- * cmCTestBuildCommand defineds the command to build the project.
- */
class cmCTestBuildCommand : public cmCTestHandlerCommand
{
public:
- ~cmCTestBuildCommand() override;
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override;
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+protected:
+ struct BuildArguments : HandlerArguments
+ {
+ std::string NumberErrors;
+ std::string NumberWarnings;
+ std::string Target;
+ std::string Configuration;
+ std::string Flags;
+ std::string ProjectName;
+ std::string ParallelLevel;
+ };
+
+private:
std::string GetName() const override { return "ctest_build"; }
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
+ std::unique_ptr<cmCTestGenericHandler> InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const override;
- std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
+ void ProcessAdditionalValues(cmCTestGenericHandler* handler,
+ HandlerArguments const& arguments,
+ cmExecutionStatus& status) const override;
-protected:
- cmCTestBuildHandler* Handler;
- void BindArguments() override;
- cmCTestGenericHandler* InitializeHandler() override;
-
- std::string NumberErrors;
- std::string NumberWarnings;
- std::string Target;
- std::string Configuration;
- std::string Flags;
- std::string ProjectName;
- std::string ParallelLevel;
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index e962cc7..520fa68 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestBuildHandler.h"
#include <cstdlib>
@@ -11,6 +11,7 @@
#include <cm/string_view>
#include <cmext/algorithm>
+#include <cm3p/json/value.h>
#include <cm3p/uv.h>
#include "cmsys/Directory.hxx"
@@ -21,6 +22,9 @@
#include "cmDuration.h"
#include "cmFileTimeCache.h"
#include "cmGeneratedFileStream.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
+#include "cmJSONState.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
@@ -33,8 +37,8 @@
#include "cmValue.h"
#include "cmXMLWriter.h"
-static const char* cmCTestErrorMatches[] = {
- "^[Bb]us [Ee]rror",
+static char const* cmCTestErrorMatches[] = {
+ "^[Bb]us [Ee]rror", // noqa: spellcheck disable-line
"^[Ss]egmentation [Vv]iolation",
"^[Ss]egmentation [Ff]ault",
":.*[Pp]ermission [Dd]enied",
@@ -93,7 +97,7 @@ static const char* cmCTestErrorMatches[] = {
nullptr
};
-static const char* cmCTestErrorExceptions[] = {
+static char const* cmCTestErrorExceptions[] = {
"instantiated from ",
"candidates are:",
": warning",
@@ -109,7 +113,7 @@ static const char* cmCTestErrorExceptions[] = {
nullptr
};
-static const char* cmCTestWarningMatches[] = {
+static char const* cmCTestWarningMatches[] = {
"([^ :]+):([0-9]+): warning:",
"([^ :]+):([0-9]+): note:",
"^cc[^C]*CC: WARNING File = ([^,]+), Line = ([0-9]+)",
@@ -135,7 +139,7 @@ static const char* cmCTestWarningMatches[] = {
nullptr
};
-static const char* cmCTestWarningExceptions[] = {
+static char const* cmCTestWarningExceptions[] = {
R"(/usr/.*/X11/Xlib\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)",
R"(/usr/.*/X11/Xutil\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)",
R"(/usr/.*/X11/XResource\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)",
@@ -157,7 +161,7 @@ static const char* cmCTestWarningExceptions[] = {
struct cmCTestBuildCompileErrorWarningRex
{
- const char* RegularExpressionString;
+ char const* RegularExpressionString;
int FileIndex;
int LineIndex;
};
@@ -176,62 +180,10 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = {
{ nullptr, 0, 0 }
};
-cmCTestBuildHandler::cmCTestBuildHandler()
+cmCTestBuildHandler::cmCTestBuildHandler(cmCTest* ctest)
+ : Superclass(ctest)
+ , LastErrorOrWarning(this->ErrorsAndWarnings.end())
{
- this->MaxPreContext = 10;
- this->MaxPostContext = 10;
-
- this->MaxErrors = 50;
- this->MaxWarnings = 50;
-
- this->LastErrorOrWarning = this->ErrorsAndWarnings.end();
-
- this->UseCTestLaunch = false;
-}
-
-void cmCTestBuildHandler::Initialize()
-{
- this->Superclass::Initialize();
- this->StartBuild.clear();
- this->EndBuild.clear();
- this->CustomErrorMatches.clear();
- this->CustomErrorExceptions.clear();
- this->CustomWarningMatches.clear();
- this->CustomWarningExceptions.clear();
- this->ReallyCustomWarningMatches.clear();
- this->ReallyCustomWarningExceptions.clear();
- this->ErrorWarningFileLineRegex.clear();
-
- this->ErrorMatchRegex.clear();
- this->ErrorExceptionRegex.clear();
- this->WarningMatchRegex.clear();
- this->WarningExceptionRegex.clear();
- this->BuildProcessingQueue.clear();
- this->BuildProcessingErrorQueue.clear();
- this->BuildOutputLogSize = 0;
- this->CurrentProcessingLine.clear();
-
- this->SimplifySourceDir.clear();
- this->SimplifyBuildDir.clear();
- this->OutputLineCounter = 0;
- this->ErrorsAndWarnings.clear();
- this->LastErrorOrWarning = this->ErrorsAndWarnings.end();
- this->PostContextCount = 0;
- this->MaxPreContext = 10;
- this->MaxPostContext = 10;
- this->PreContext.clear();
-
- this->TotalErrors = 0;
- this->TotalWarnings = 0;
- this->LastTickChar = 0;
-
- this->ErrorQuotaReached = false;
- this->WarningQuotaReached = false;
-
- this->MaxErrors = 50;
- this->MaxWarnings = 50;
-
- this->UseCTestLaunch = false;
}
void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile* mf)
@@ -333,7 +285,7 @@ int cmCTestBuildHandler::ProcessHandler()
return -1;
}
- const std::string& buildDirectory =
+ std::string const& buildDirectory =
this->CTest->GetCTestConfiguration("BuildDirectory");
if (buildDirectory.empty()) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -354,6 +306,8 @@ int cmCTestBuildHandler::ProcessHandler()
"Cannot create build log file" << std::endl);
}
+ this->LogFileName = ofs.GetTempName();
+
// Create lists of regular expression strings for errors, error exceptions,
// warnings and warning exceptions.
std::vector<std::string>::size_type cc;
@@ -479,6 +433,11 @@ int cmCTestBuildHandler::ProcessHandler()
} else {
this->GenerateXMLLogScraped(xml);
}
+
+ this->CTest->GetInstrumentation().CollectTimingData(
+ cmInstrumentationQuery::Hook::PrepareForCDash);
+ this->GenerateInstrumentationXML(xml);
+
this->GenerateXMLFooter(xml, elapsed_build_time);
if (!res || retVal || this->TotalErrors > 0) {
@@ -502,7 +461,7 @@ int cmCTestBuildHandler::ProcessHandler()
void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
{
- this->CTest->StartXML(xml, this->AppendXML);
+ this->CTest->StartXML(xml, this->CMake, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("Build");
xml.Element("StartDateTime", this->StartBuild);
@@ -553,7 +512,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
launchDir.Load(this->CTestLaunchDir);
unsigned long n = launchDir.GetNumberOfFiles();
for (unsigned long i = 0; i < n; ++i) {
- const char* fname = launchDir.GetFile(i);
+ char const* fname = launchDir.GetFile(i);
if (this->IsLaunchedErrorFile(fname) && numErrorsAllowed) {
numErrorsAllowed--;
fragments.insert(this->CTestLaunchDir + '/' + fname);
@@ -580,9 +539,6 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
int numErrorsAllowed = this->MaxErrors;
int numWarningsAllowed = this->MaxWarnings;
std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory");
- // make sure the source dir is in the correct case on windows
- // via a call to collapse full path.
- srcdir = cmStrCat(cmSystemTools::CollapseFullPath(srcdir), '/');
for (it = ew.begin();
it != ew.end() && (numErrorsAllowed || numWarningsAllowed); it++) {
cmCTestBuildErrorWarning* cm = &(*it);
@@ -613,8 +569,9 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
}
} else {
// make sure it is a full path with the correct case
- cm->SourceFile = cmSystemTools::CollapseFullPath(cm->SourceFile);
- cmSystemTools::ReplaceString(cm->SourceFile, srcdir.c_str(), "");
+ cm->SourceFile =
+ cmSystemTools::ToNormalizedPathOnDisk(cm->SourceFile);
+ cmSystemTools::ReplaceString(cm->SourceFile, srcdir, "");
}
cm->LineNumber = atoi(re->match(rit.LineIndex).c_str());
break;
@@ -647,6 +604,88 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
}
}
+void cmCTestBuildHandler::GenerateInstrumentationXML(cmXMLWriter& xml)
+{
+ // Record instrumentation data on a per-target basis.
+ cmsys::Directory targets_dir;
+ std::string targets_snippet_dir = cmStrCat(
+ this->CTest->GetInstrumentation().GetCDashDir(), "/build/targets");
+ if (targets_dir.Load(targets_snippet_dir) &&
+ targets_dir.GetNumberOfFiles() > 0) {
+ xml.StartElement("Targets");
+ for (unsigned int i = 0; i < targets_dir.GetNumberOfFiles(); i++) {
+ if (!targets_dir.FileIsDirectory(i)) {
+ continue;
+ }
+ std::string target_name = targets_dir.GetFile(i);
+ if (target_name == "." || target_name == "..") {
+ continue;
+ }
+ std::string target_type = "UNKNOWN";
+
+ xml.StartElement("Target");
+ xml.Attribute("name", target_name);
+
+ // Check if we have a link snippet for this target.
+ cmsys::Directory target_dir;
+ if (!target_dir.Load(targets_dir.GetFilePath(i))) {
+ cmSystemTools::Error(
+ cmStrCat("Error loading directory ", targets_dir.GetFilePath(i)));
+ }
+ Json::Value link_item;
+ for (unsigned int j = 0; j < target_dir.GetNumberOfFiles(); j++) {
+ std::string fname = target_dir.GetFile(j);
+ if (fname.rfind("link-", 0) == 0) {
+ std::string fpath = target_dir.GetFilePath(j);
+ cmJSONState parseState = cmJSONState(fpath, &link_item);
+ if (!parseState.errors.empty()) {
+ cmSystemTools::Error(parseState.GetErrorMessage(true));
+ break;
+ }
+
+ if (!link_item.isObject()) {
+ std::string error_msg =
+ cmStrCat("Expected snippet ", fpath, " to contain an object");
+ cmSystemTools::Error(error_msg);
+ break;
+ }
+ break;
+ }
+ }
+
+ // If so, parse targetType and targetLabels (optional) from it.
+ if (link_item.isMember("targetType")) {
+ target_type = link_item["targetType"].asString();
+ }
+
+ xml.Attribute("type", target_type);
+
+ if (link_item.isMember("targetLabels") &&
+ !link_item["targetLabels"].empty()) {
+ xml.StartElement("Labels");
+ for (auto const& json_label_item : link_item["targetLabels"]) {
+ xml.Element("Label", json_label_item.asString());
+ }
+ xml.EndElement(); // Labels
+ }
+
+ // Write instrumendation data for this target.
+ std::string target_subdir = cmStrCat("build/targets/", target_name);
+ this->CTest->ConvertInstrumentationSnippetsToXML(xml, target_subdir);
+ std::string target_dir_fullpath = cmStrCat(
+ this->CTest->GetInstrumentation().GetCDashDir(), '/', target_subdir);
+ if (cmSystemTools::FileIsDirectory(target_dir_fullpath)) {
+ cmSystemTools::RemoveADirectory(target_dir_fullpath);
+ }
+ xml.EndElement(); // Target
+ }
+ xml.EndElement(); // Targets
+ }
+
+ // Also record instrumentation data for custom commands (no target).
+ this->CTest->ConvertInstrumentationSnippetsToXML(xml, "build/commands");
+}
+
void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml,
cmDuration elapsed_build_time)
{
@@ -665,14 +704,14 @@ void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml,
this->CTest->EndXML(xml);
}
-bool cmCTestBuildHandler::IsLaunchedErrorFile(const char* fname)
+bool cmCTestBuildHandler::IsLaunchedErrorFile(char const* fname)
{
// error-{hash}.xml
return (cmHasLiteralPrefix(fname, "error-") &&
cmHasLiteralSuffix(fname, ".xml"));
}
-bool cmCTestBuildHandler::IsLaunchedWarningFile(const char* fname)
+bool cmCTestBuildHandler::IsLaunchedWarningFile(char const* fname)
{
// warning-{hash}.xml
return (cmHasLiteralPrefix(fname, "warning-") &&
@@ -689,15 +728,15 @@ class cmCTestBuildHandler::LaunchHelper
public:
LaunchHelper(cmCTestBuildHandler* handler);
~LaunchHelper();
- LaunchHelper(const LaunchHelper&) = delete;
- LaunchHelper& operator=(const LaunchHelper&) = delete;
+ LaunchHelper(LaunchHelper const&) = delete;
+ LaunchHelper& operator=(LaunchHelper const&) = delete;
private:
cmCTestBuildHandler* Handler;
cmCTest* CTest;
void WriteLauncherConfig();
- void WriteScrapeMatchers(const char* purpose,
+ void WriteScrapeMatchers(char const* purpose,
std::vector<std::string> const& matchers);
};
@@ -757,7 +796,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig()
}
void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
- const char* purpose, std::vector<std::string> const& matchers)
+ char const* purpose, std::vector<std::string> const& matchers)
{
if (matchers.empty()) {
return;
@@ -770,8 +809,8 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
}
}
-bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
- int* retVal, const char* dir,
+bool cmCTestBuildHandler::RunMakeCommand(std::string const& command,
+ int* retVal, char const* dir,
int timeout, std::ostream& ofs,
Encoding encoding)
{
@@ -923,7 +962,7 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
launchDir.Load(this->CTestLaunchDir);
unsigned long n = launchDir.GetNumberOfFiles();
for (unsigned long i = 0; i < n; ++i) {
- const char* fname = launchDir.GetFile(i);
+ char const* fname = launchDir.GetFile(i);
if (cmHasLiteralSuffix(fname, ".xml")) {
launcherXMLFound = true;
break;
@@ -938,8 +977,7 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
// Use temporary BuildLog file to populate this error for
// CDash.
ofs.flush();
- reporter.LogOut = this->LogFileNames["Build"];
- reporter.LogOut += ".tmp";
+ reporter.LogOut = this->LogFileName;
reporter.WriteXML();
}
} else {
@@ -994,13 +1032,13 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
// ######################################################################
// ######################################################################
-void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
+void cmCTestBuildHandler::ProcessBuffer(char const* data, size_t length,
size_t& tick, size_t tick_len,
std::ostream& ofs,
t_BuildProcessingQueueType* queue)
{
- const std::string::size_type tick_line_len = 50;
- const char* ptr;
+ std::string::size_type const tick_line_len = 50;
+ char const* ptr;
for (ptr = data; ptr < data + length; ptr++) {
queue->push_back(*ptr);
}
@@ -1031,7 +1069,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
this->CurrentProcessingLine.clear();
cm::append(this->CurrentProcessingLine, queue->begin(), it);
this->CurrentProcessingLine.push_back(0);
- const char* line = this->CurrentProcessingLine.data();
+ char const* line = this->CurrentProcessingLine.data();
// Process the line
int lineType = this->ProcessSingleLine(line);
@@ -1128,7 +1166,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
ofs << cm::string_view(data, length);
}
-int cmCTestBuildHandler::ProcessSingleLine(const char* data)
+int cmCTestBuildHandler::ProcessSingleLine(char const* data)
{
if (this->UseCTestLaunch) {
// No log scraping when using launchers.
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 90945b1..8baec69 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,6 +20,7 @@
class cmMakefile;
class cmStringReplaceHelper;
class cmXMLWriter;
+class cmCTest;
/** \class cmCTestBuildHandler
* \brief A class that handles ctest -S invocations
@@ -36,24 +37,19 @@ public:
*/
int ProcessHandler() override;
- cmCTestBuildHandler();
+ cmCTestBuildHandler(cmCTest* ctest);
void PopulateCustomVectors(cmMakefile* mf) override;
- /**
- * Initialize handler
- */
- void Initialize() override;
-
- int GetTotalErrors() { return this->TotalErrors; }
- int GetTotalWarnings() { return this->TotalWarnings; }
+ int GetTotalErrors() const { return this->TotalErrors; }
+ int GetTotalWarnings() const { return this->TotalWarnings; }
private:
std::string GetMakeCommand();
//! Run command specialized for make and configure. Returns process status
// and retVal is return value or exception.
- bool RunMakeCommand(const std::string& command, int* retVal, const char* dir,
+ bool RunMakeCommand(std::string const& command, int* retVal, char const* dir,
int timeout, std::ostream& ofs,
Encoding encoding = cmProcessOutput::Auto);
@@ -89,9 +85,10 @@ private:
void GenerateXMLHeader(cmXMLWriter& xml);
void GenerateXMLLaunched(cmXMLWriter& xml);
void GenerateXMLLogScraped(cmXMLWriter& xml);
+ void GenerateInstrumentationXML(cmXMLWriter& xml);
void GenerateXMLFooter(cmXMLWriter& xml, cmDuration elapsed_build_time);
- bool IsLaunchedErrorFile(const char* fname);
- bool IsLaunchedWarningFile(const char* fname);
+ bool IsLaunchedErrorFile(char const* fname);
+ bool IsLaunchedWarningFile(char const* fname);
std::string StartBuild;
std::string EndBuild;
@@ -113,42 +110,43 @@ private:
using t_BuildProcessingQueueType = std::deque<char>;
- void ProcessBuffer(const char* data, size_t length, size_t& tick,
+ void ProcessBuffer(char const* data, size_t length, size_t& tick,
size_t tick_len, std::ostream& ofs,
t_BuildProcessingQueueType* queue);
- int ProcessSingleLine(const char* data);
+ int ProcessSingleLine(char const* data);
t_BuildProcessingQueueType BuildProcessingQueue;
t_BuildProcessingQueueType BuildProcessingErrorQueue;
- size_t BuildOutputLogSize;
+ size_t BuildOutputLogSize = 0;
std::vector<char> CurrentProcessingLine;
std::string SimplifySourceDir;
std::string SimplifyBuildDir;
- size_t OutputLineCounter;
+ size_t OutputLineCounter = 0;
using t_ErrorsAndWarningsVector = std::vector<cmCTestBuildErrorWarning>;
t_ErrorsAndWarningsVector ErrorsAndWarnings;
t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
- size_t PostContextCount;
- size_t MaxPreContext;
- size_t MaxPostContext;
+ size_t PostContextCount = 0;
+ size_t MaxPreContext = 10;
+ size_t MaxPostContext = 10;
std::deque<std::string> PreContext;
- int TotalErrors;
- int TotalWarnings;
- char LastTickChar;
+ int TotalErrors = 0;
+ int TotalWarnings = 0;
+ char LastTickChar = '\0';
- bool ErrorQuotaReached;
- bool WarningQuotaReached;
+ bool ErrorQuotaReached = false;
+ bool WarningQuotaReached = false;
- int MaxErrors;
- int MaxWarnings;
+ int MaxErrors = 50;
+ int MaxWarnings = 50;
// Used to remove ANSI color codes before checking for errors and warnings.
cmStringReplaceHelper* ColorRemover;
- bool UseCTestLaunch;
+ bool UseCTestLaunch = false;
std::string CTestLaunchDir;
+ std::string LogFileName;
class LaunchHelper;
friend class LaunchHelper;
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index badd43e..dadf802 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestCVS.h"
#include <utility>
@@ -11,12 +11,13 @@
#include "cmsys/RegularExpression.hxx"
#include "cmCTest.h"
+#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log)
- : cmCTestVC(ct, log)
+cmCTestCVS::cmCTestCVS(cmCTest* ct, cmMakefile* mf, std::ostream& log)
+ : cmCTestVC(ct, mf, log)
{
}
@@ -25,7 +26,7 @@ cmCTestCVS::~cmCTestCVS() = default;
class cmCTestCVS::UpdateParser : public cmCTestVC::LineParser
{
public:
- UpdateParser(cmCTestCVS* cvs, const char* prefix)
+ UpdateParser(cmCTestCVS* cvs, char const* prefix)
: CVS(cvs)
{
this->SetLog(&cvs->Log, prefix);
@@ -75,9 +76,9 @@ private:
bool cmCTestCVS::UpdateImpl()
{
// Get user-specified update options.
- std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_UPDATE_OPTIONS");
if (opts.empty()) {
- opts = this->CTest->GetCTestConfiguration("CVSUpdateOptions");
+ opts = this->Makefile->GetSafeDefinition("CTEST_CVS_UPDATE_OPTIONS");
if (opts.empty()) {
opts = "-dP";
}
@@ -105,7 +106,7 @@ class cmCTestCVS::LogParser : public cmCTestVC::LineParser
{
public:
using Revision = cmCTestCVS::Revision;
- LogParser(cmCTestCVS* cvs, const char* prefix, std::vector<Revision>& revs)
+ LogParser(cmCTestCVS* cvs, char const* prefix, std::vector<Revision>& revs)
: CVS(cvs)
, Revisions(revs)
{
@@ -213,7 +214,7 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir)
return "-b";
}
-void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
+void cmCTestCVS::LoadRevisions(std::string const& file, char const* branchFlag,
std::vector<Revision>& revisions)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
@@ -230,7 +231,7 @@ void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
Directory const& dir)
{
- const char* slash = path.empty() ? "" : "/";
+ char const* slash = path.empty() ? "" : "/";
xml.StartElement("Directory");
xml.Element("Name", path);
diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h
index d20239b..d1dc08b 100644
--- a/Source/CTest/cmCTestCVS.h
+++ b/Source/CTest/cmCTestCVS.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,6 +12,7 @@
#include "cmCTestVC.h"
class cmCTest;
+class cmMakefile;
class cmXMLWriter;
/** \class cmCTestCVS
@@ -22,7 +23,7 @@ class cmCTestCVS : public cmCTestVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestCVS(cmCTest* ctest, std::ostream& log);
+ cmCTestCVS(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestCVS() override;
@@ -38,7 +39,7 @@ private:
std::map<std::string, Directory> Dirs;
std::string ComputeBranchFlag(std::string const& dir);
- void LoadRevisions(std::string const& file, const char* branchFlag,
+ void LoadRevisions(std::string const& file, char const* branchFlag,
std::vector<Revision>& revisions);
void WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
Directory const& dir);
diff --git a/Source/CTest/cmCTestCommand.cxx b/Source/CTest/cmCTestCommand.cxx
new file mode 100644
index 0000000..e894de7
--- /dev/null
+++ b/Source/CTest/cmCTestCommand.cxx
@@ -0,0 +1,19 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#include "cmCTestCommand.h"
+
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+
+bool cmCTestCommand::operator()(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status) const
+{
+ cmMakefile& mf = status.GetMakefile();
+ std::vector<std::string> expandedArguments;
+ if (!mf.ExpandArguments(args, expandedArguments)) {
+ // There was an error expanding arguments. It was already
+ // reported, so we can skip this command without error.
+ return true;
+ }
+ return this->InitialPass(expandedArguments, status);
+}
diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h
index 007378d..a206c58 100644
--- a/Source/CTest/cmCTestCommand.h
+++ b/Source/CTest/cmCTestCommand.h
@@ -1,11 +1,15 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
-#include "cmCommand.h"
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
class cmCTest;
-class cmCTestScriptHandler;
+class cmExecutionStatus;
+struct cmListFileArgument;
/** \class cmCTestCommand
* \brief A superclass for all commands added to the CTestScriptHandler
@@ -14,15 +18,25 @@ class cmCTestScriptHandler;
* the ctest script handlers parser.
*
*/
-class cmCTestCommand : public cmCommand
+class cmCTestCommand
{
public:
- cmCTestCommand()
+ cmCTestCommand(cmCTest* ctest)
+ : CTest(ctest)
{
- this->CTest = nullptr;
- this->CTestScriptHandler = nullptr;
}
- cmCTest* CTest;
- cmCTestScriptHandler* CTestScriptHandler;
+ virtual ~cmCTestCommand() = default;
+ cmCTestCommand(cmCTestCommand const&) = default;
+ cmCTestCommand& operator=(cmCTestCommand const&) = default;
+
+ bool operator()(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status) const;
+
+private:
+ virtual bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus&) const = 0;
+
+protected:
+ cmCTest* CTest = nullptr;
};
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index e0326a9..6bece77 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -1,156 +1,230 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestConfigureCommand.h"
-#include <cstring>
+#include <chrono>
+#include <cstdlib>
#include <sstream>
+#include <string>
#include <vector>
+#include <cm/memory>
#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmCTest.h"
-#include "cmCTestConfigureHandler.h"
+#include "cmDuration.h"
+#include "cmExecutionStatus.h"
+#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
+#include "cmXMLWriter.h"
#include "cmake.h"
-void cmCTestConfigureCommand::BindArguments()
+bool cmCTestConfigureCommand::ExecuteConfigure(ConfigureArguments const& args,
+ cmExecutionStatus& status) const
{
- this->cmCTestHandlerCommand::BindArguments();
- this->Bind("OPTIONS"_s, this->Options);
-}
+ cmMakefile& mf = status.GetMakefile();
+
+ std::string const buildDirectory = !args.Build.empty()
+ ? args.Build
+ : mf.GetDefinition("CTEST_BINARY_DIRECTORY");
+ if (buildDirectory.empty()) {
+ status.SetError("called with no build directory specified. "
+ "Either use the BUILD argument or set the "
+ "CTEST_BINARY_DIRECTORY variable.");
+ return false;
+ }
-cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
-{
- cmList options;
+ std::string configureCommand = mf.GetDefinition("CTEST_CONFIGURE_COMMAND");
+ if (configureCommand.empty()) {
+ cmValue cmakeGenerator = mf.GetDefinition("CTEST_CMAKE_GENERATOR");
+ if (!cmNonempty(cmakeGenerator)) {
+ status.SetError(
+ "called with no configure command specified. "
+ "If this is a \"built with CMake\" project, set "
+ "CTEST_CMAKE_GENERATOR. If not, set CTEST_CONFIGURE_COMMAND.");
+ return false;
+ }
- if (!this->Options.empty()) {
- options.assign(this->Options);
- }
+ std::string const sourceDirectory = !args.Source.empty()
+ ? args.Source
+ : mf.GetDefinition("CTEST_SOURCE_DIRECTORY");
+ if (sourceDirectory.empty() ||
+ !cmSystemTools::FileExists(sourceDirectory + "/CMakeLists.txt")) {
+ status.SetError("called with invalid source directory. "
+ "CTEST_SOURCE_DIRECTORY must be set to a directory "
+ "that contains CMakeLists.txt.");
+ return false;
+ }
+
+ bool const multiConfig = [&]() -> bool {
+ cmake* cm = mf.GetCMakeInstance();
+ auto gg = cm->CreateGlobalGenerator(cmakeGenerator);
+ return gg && gg->IsMultiConfig();
+ }();
+
+ bool const buildTypeInOptions =
+ args.Options.find("CMAKE_BUILD_TYPE=") != std::string::npos ||
+ args.Options.find("CMAKE_BUILD_TYPE:STRING=") != std::string::npos;
+
+ configureCommand = cmStrCat('"', cmSystemTools::GetCMakeCommand(), '"');
+
+ auto const options = cmList(args.Options);
+ for (std::string const& option : options) {
+ configureCommand += " \"";
+ configureCommand += option;
+ configureCommand += "\"";
+ }
+
+ cmValue cmakeBuildType = mf.GetDefinition("CTEST_CONFIGURATION_TYPE");
+ if (!multiConfig && !buildTypeInOptions && cmNonempty(cmakeBuildType)) {
+ configureCommand += " \"-DCMAKE_BUILD_TYPE:STRING=";
+ configureCommand += cmakeBuildType;
+ configureCommand += "\"";
+ }
+
+ if (mf.IsOn("CTEST_USE_LAUNCHERS")) {
+ configureCommand += " \"-DCTEST_USE_LAUNCHERS:BOOL=TRUE\"";
+ }
+
+ configureCommand += " \"-G";
+ configureCommand += cmakeGenerator;
+ configureCommand += "\"";
+
+ cmValue cmakeGeneratorPlatform =
+ mf.GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM");
+ if (cmNonempty(cmakeGeneratorPlatform)) {
+ configureCommand += " \"-A";
+ configureCommand += *cmakeGeneratorPlatform;
+ configureCommand += "\"";
+ }
+
+ cmValue cmakeGeneratorToolset =
+ mf.GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET");
+ if (cmNonempty(cmakeGeneratorToolset)) {
+ configureCommand += " \"-T";
+ configureCommand += *cmakeGeneratorToolset;
+ configureCommand += "\"";
+ }
+
+ configureCommand += " \"-S";
+ configureCommand += cmSystemTools::CollapseFullPath(sourceDirectory);
+ configureCommand += "\"";
- if (this->CTest->GetCTestConfiguration("BuildDirectory").empty()) {
- this->SetError(
- "Build directory not specified. Either use BUILD "
- "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
- "variable");
- return nullptr;
+ configureCommand += " \"-B";
+ configureCommand += cmSystemTools::CollapseFullPath(buildDirectory);
+ configureCommand += "\"";
}
- cmValue ctestConfigureCommand =
- this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
-
- if (cmNonempty(ctestConfigureCommand)) {
- this->CTest->SetCTestConfiguration("ConfigureCommand",
- *ctestConfigureCommand, this->Quiet);
- } else {
- cmValue cmakeGeneratorName =
- this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
- if (cmNonempty(cmakeGeneratorName)) {
- const std::string& source_dir =
- this->CTest->GetCTestConfiguration("SourceDirectory");
- if (source_dir.empty()) {
- this->SetError(
- "Source directory not specified. Either use SOURCE "
- "argument to CTEST_CONFIGURE command or set CTEST_SOURCE_DIRECTORY "
- "variable");
- return nullptr;
- }
-
- const std::string cmakelists_file = source_dir + "/CMakeLists.txt";
- if (!cmSystemTools::FileExists(cmakelists_file)) {
- std::ostringstream e;
- e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]";
- this->SetError(e.str());
- return nullptr;
- }
-
- bool multiConfig = false;
- bool cmakeBuildTypeInOptions = false;
-
- auto gg = this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
- *cmakeGeneratorName);
- if (gg) {
- multiConfig = gg->IsMultiConfig();
- gg.reset();
- }
-
- std::string cmakeConfigureCommand =
- cmStrCat('"', cmSystemTools::GetCMakeCommand(), '"');
-
- for (std::string const& option : options) {
- cmakeConfigureCommand += " \"";
- cmakeConfigureCommand += option;
- cmakeConfigureCommand += "\"";
-
- if ((nullptr != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) ||
- (nullptr != strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING="))) {
- cmakeBuildTypeInOptions = true;
- }
- }
-
- if (!multiConfig && !cmakeBuildTypeInOptions &&
- !this->CTest->GetConfigType().empty()) {
- cmakeConfigureCommand += " \"-DCMAKE_BUILD_TYPE:STRING=";
- cmakeConfigureCommand += this->CTest->GetConfigType();
- cmakeConfigureCommand += "\"";
- }
-
- if (this->Makefile->IsOn("CTEST_USE_LAUNCHERS")) {
- cmakeConfigureCommand += " \"-DCTEST_USE_LAUNCHERS:BOOL=TRUE\"";
- }
-
- cmakeConfigureCommand += " \"-G";
- cmakeConfigureCommand += *cmakeGeneratorName;
- cmakeConfigureCommand += "\"";
-
- cmValue cmakeGeneratorPlatform =
- this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM");
- if (cmNonempty(cmakeGeneratorPlatform)) {
- cmakeConfigureCommand += " \"-A";
- cmakeConfigureCommand += *cmakeGeneratorPlatform;
- cmakeConfigureCommand += "\"";
- }
-
- cmValue cmakeGeneratorToolset =
- this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET");
- if (cmNonempty(cmakeGeneratorToolset)) {
- cmakeConfigureCommand += " \"-T";
- cmakeConfigureCommand += *cmakeGeneratorToolset;
- cmakeConfigureCommand += "\"";
- }
-
- cmakeConfigureCommand += " \"-S";
- cmakeConfigureCommand += source_dir;
- cmakeConfigureCommand += "\"";
-
- cmakeConfigureCommand += " \"-B";
- cmakeConfigureCommand +=
- this->CTest->GetCTestConfiguration("BuildDirectory");
- cmakeConfigureCommand += "\"";
-
- this->CTest->SetCTestConfiguration("ConfigureCommand",
- cmakeConfigureCommand, this->Quiet);
- } else {
- this->SetError(
- "Configure command is not specified. If this is a "
- "\"built with CMake\" project, set CTEST_CMAKE_GENERATOR. If not, "
- "set CTEST_CONFIGURE_COMMAND.");
- return nullptr;
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Configure project\n",
+ args.Quiet);
+
+ if (this->CTest->GetShowOnly()) {
+ cmCTestOptionalLog(this->CTest, DEBUG,
+ "Configure with command: " << configureCommand << '\n',
+ args.Quiet);
+ if (!args.ReturnValue.empty()) {
+ mf.AddDefinition(args.ReturnValue, "0");
}
+ return true;
}
- if (cmValue labelsForSubprojects =
- this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
- this->CTest->SetCTestConfiguration("LabelsForSubprojects",
- *labelsForSubprojects, this->Quiet);
+ if (!cmSystemTools::MakeDirectory(buildDirectory)) {
+ status.SetError(cmStrCat("cannot create directory ", buildDirectory));
+ return false;
}
- cmCTestConfigureHandler* handler = this->CTest->GetConfigureHandler();
- handler->Initialize();
- handler->SetQuiet(this->Quiet);
- return handler;
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Configure with command: " << configureCommand << '\n',
+ args.Quiet);
+
+ int const submitIndex =
+ args.SubmitIndex.empty() ? 0 : std::atoi(args.SubmitIndex.c_str());
+
+ cmGeneratedFileStream logFile;
+ this->CTest->StartLogFile("Configure", submitIndex, logFile);
+
+ auto const startTime = std::chrono::system_clock::now();
+ auto const startDateTime = this->CTest->CurrentTime();
+
+ std::string output;
+ int retVal = 0;
+ bool const res = this->CTest->RunMakeCommand(configureCommand, output,
+ &retVal, buildDirectory.c_str(),
+ cmDuration::zero(), logFile);
+
+ auto const endTime = std::chrono::system_clock::now();
+ auto const endDateTime = this->CTest->CurrentTime();
+ auto const elapsedMinutes =
+ std::chrono::duration_cast<std::chrono::minutes>(endTime - startTime);
+
+ cmCTestOptionalLog(this->CTest, DEBUG, "End\n", args.Quiet);
+
+ if (!res || retVal) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error(s) when configuring the project\n");
+ }
+
+ if (!args.ReturnValue.empty()) {
+ mf.AddDefinition(args.ReturnValue, std::to_string(retVal));
+ }
+
+ if (cmValue value = mf.GetDefinition("CTEST_CHANGE_ID")) {
+ this->CTest->SetCTestConfiguration("ChangeId", *value, args.Quiet);
+ }
+
+ if (cmValue value = mf.GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ this->CTest->SetCTestConfiguration("LabelsForSubprojects", *value,
+ args.Quiet);
+ }
+
+ cmGeneratedFileStream xmlFile;
+ if (!this->CTest->StartResultingXML(cmCTest::PartConfigure, "Configure",
+ submitIndex, xmlFile)) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Cannot open configure file" << std::endl);
+ return false;
+ }
+
+ cmXMLWriter xml(xmlFile);
+ this->CTest->StartXML(xml, mf.GetCMakeInstance(), args.Append);
+ this->CTest->GenerateSubprojectsOutput(xml);
+ xml.StartElement("Configure");
+ xml.Element("StartDateTime", startDateTime);
+ xml.Element("StartConfigureTime", startTime);
+ xml.Element("ConfigureCommand", configureCommand);
+ xml.Element("Log", output);
+ xml.Element("ConfigureStatus", retVal);
+ xml.Element("EndDateTime", endDateTime);
+ xml.Element("EndConfigureTime", endTime);
+ xml.Element("ElapsedMinutes", elapsedMinutes.count());
+
+ this->CTest->GetInstrumentation().CollectTimingData(
+ cmInstrumentationQuery::Hook::PrepareForCDash);
+ this->CTest->ConvertInstrumentationSnippetsToXML(xml, "configure");
+
+ xml.EndElement(); // Configure
+ this->CTest->EndXML(xml);
+
+ return res;
+}
+
+bool cmCTestConfigureCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
+{
+ using Args = ConfigureArguments;
+ static auto const parser =
+ cmArgumentParser<Args>{ MakeHandlerParser<Args>() } //
+ .Bind("OPTIONS"_s, &ConfigureArguments::Options);
+
+ return this->Invoke(parser, args, status, [&](ConfigureArguments& a) {
+ return this->ExecuteConfigure(a, status);
+ });
}
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index f338637..5e3001e 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -1,46 +1,33 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
-
-#include <cm/memory>
+#include <vector>
#include "cmCTestHandlerCommand.h"
-#include "cmCommand.h"
-class cmCTestGenericHandler;
+class cmExecutionStatus;
-/** \class cmCTestConfigure
- * \brief Run a ctest script
- *
- * cmCTestConfigureCommand defineds the command to configures the project.
- */
class cmCTestConfigureCommand : public cmCTestHandlerCommand
{
public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
+
+protected:
+ struct ConfigureArguments : HandlerArguments
{
- auto ni = cm::make_unique<cmCTestConfigureCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+ std::string Options;
+ };
+
+private:
std::string GetName() const override { return "ctest_configure"; }
-protected:
- void BindArguments() override;
- cmCTestGenericHandler* InitializeHandler() override;
+ bool ExecuteConfigure(ConfigureArguments const& args,
+ cmExecutionStatus& status) const;
- std::string Options;
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
deleted file mode 100644
index dd8952f..0000000
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCTestConfigureHandler.h"
-
-#include <chrono>
-#include <ostream>
-#include <string>
-
-#include "cmCTest.h"
-#include "cmDuration.h"
-#include "cmGeneratedFileStream.h"
-#include "cmXMLWriter.h"
-
-cmCTestConfigureHandler::cmCTestConfigureHandler() = default;
-
-void cmCTestConfigureHandler::Initialize()
-{
- this->Superclass::Initialize();
-}
-
-// clearly it would be nice if this were broken up into a few smaller
-// functions and commented...
-int cmCTestConfigureHandler::ProcessHandler()
-{
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- "Configure project" << std::endl, this->Quiet);
- std::string cCommand =
- this->CTest->GetCTestConfiguration("ConfigureCommand");
- if (cCommand.empty()) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot find ConfigureCommand key in the DartConfiguration.tcl"
- << std::endl);
- return -1;
- }
-
- std::string buildDirectory =
- this->CTest->GetCTestConfiguration("BuildDirectory");
- if (buildDirectory.empty()) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot find BuildDirectory key in the DartConfiguration.tcl"
- << std::endl);
- return -1;
- }
-
- auto elapsed_time_start = std::chrono::steady_clock::now();
- std::string output;
- int retVal = 0;
- bool res = false;
- if (!this->CTest->GetShowOnly()) {
- cmGeneratedFileStream os;
- if (!this->StartResultingXML(cmCTest::PartConfigure, "Configure", os)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot open configure file" << std::endl);
- return 1;
- }
- std::string start_time = this->CTest->CurrentTime();
- auto start_time_time = std::chrono::system_clock::now();
-
- cmGeneratedFileStream ofs;
- this->StartLogFile("Configure", ofs);
- cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Configure with command: " << cCommand << std::endl,
- this->Quiet);
- res = this->CTest->RunMakeCommand(cCommand, output, &retVal,
- buildDirectory.c_str(),
- cmDuration::zero(), ofs);
-
- if (ofs) {
- ofs.close();
- }
-
- if (os) {
- cmXMLWriter xml(os);
- this->CTest->StartXML(xml, this->AppendXML);
- this->CTest->GenerateSubprojectsOutput(xml);
- xml.StartElement("Configure");
- xml.Element("StartDateTime", start_time);
- xml.Element("StartConfigureTime", start_time_time);
- xml.Element("ConfigureCommand", cCommand);
- cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet);
- xml.Element("Log", output);
- xml.Element("ConfigureStatus", retVal);
- xml.Element("EndDateTime", this->CTest->CurrentTime());
- xml.Element("EndConfigureTime", std::chrono::system_clock::now());
- xml.Element("ElapsedMinutes",
- std::chrono::duration_cast<std::chrono::minutes>(
- std::chrono::steady_clock::now() - elapsed_time_start)
- .count());
- xml.EndElement(); // Configure
- this->CTest->EndXML(xml);
- }
- } else {
- cmCTestOptionalLog(this->CTest, DEBUG,
- "Configure with command: " << cCommand << std::endl,
- this->Quiet);
- }
- if (!res || retVal) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Error(s) when configuring the project" << std::endl);
- return -1;
- }
- return 0;
-}
diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h
deleted file mode 100644
index 2aad98c..0000000
--- a/Source/CTest/cmCTestConfigureHandler.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 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 "cmCTestGenericHandler.h"
-
-/** \class cmCTestConfigureHandler
- * \brief A class that handles ctest -S invocations
- *
- */
-class cmCTestConfigureHandler : public cmCTestGenericHandler
-{
-public:
- using Superclass = cmCTestGenericHandler;
-
- /*
- * The main entry point for this class
- */
- int ProcessHandler() override;
-
- cmCTestConfigureHandler();
-
- void Initialize() override;
-};
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx
index 97b0a89..66afaa3 100644
--- a/Source/CTest/cmCTestCoverageCommand.cxx
+++ b/Source/CTest/cmCTestCoverageCommand.cxx
@@ -1,38 +1,52 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestCoverageCommand.h"
#include <set>
+#include <utility>
+#include <cm/memory>
#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmCTest.h"
#include "cmCTestCoverageHandler.h"
+#include "cmCTestGenericHandler.h"
+#include "cmExecutionStatus.h"
-class cmCTestGenericHandler;
+class cmMakefile;
-void cmCTestCoverageCommand::BindArguments()
-{
- this->cmCTestHandlerCommand::BindArguments();
- this->Bind("LABELS"_s, this->Labels);
-}
-
-cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
+std::unique_ptr<cmCTestGenericHandler>
+cmCTestCoverageCommand::InitializeHandler(HandlerArguments& arguments,
+ cmExecutionStatus& status) const
{
+ cmMakefile& mf = status.GetMakefile();
+ auto& args = static_cast<CoverageArguments&>(arguments);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
+ &mf, "CoverageCommand", "CTEST_COVERAGE_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
- this->Quiet);
- cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler();
- handler->Initialize();
+ &mf, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS", args.Quiet);
+ auto handler = cm::make_unique<cmCTestCoverageHandler>(this->CTest);
// If a LABELS option was given, select only files with the labels.
- if (this->Labels) {
+ if (args.Labels) {
handler->SetLabelFilter(
- std::set<std::string>(this->Labels->begin(), this->Labels->end()));
+ std::set<std::string>(args.Labels->begin(), args.Labels->end()));
}
- handler->SetQuiet(this->Quiet);
- return handler;
+ handler->SetQuiet(args.Quiet);
+ return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
+}
+
+bool cmCTestCoverageCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
+{
+ using Args = CoverageArguments;
+ static auto const parser =
+ cmArgumentParser<Args>{ MakeHandlerParser<Args>() } //
+ .Bind("LABELS"_s, &CoverageArguments::Labels);
+
+ return this->Invoke(parser, args, status, [&](CoverageArguments& a) {
+ return this->ExecuteHandlerCommand(a, status);
+ });
}
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index 55c68b2..5df1c0e 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -1,49 +1,38 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
#include <cm/optional>
#include "cmArgumentParserTypes.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
-#include "cmCommand.h"
+class cmExecutionStatus;
class cmCTestGenericHandler;
-/** \class cmCTestCoverage
- * \brief Run a ctest script
- *
- * cmCTestCoverageCommand defineds the command to test the project.
- */
class cmCTestCoverageCommand : public cmCTestHandlerCommand
{
public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
+
+protected:
+ struct CoverageArguments : HandlerArguments
{
- auto ni = cm::make_unique<cmCTestCoverageCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+ cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Labels;
+ };
+
+private:
std::string GetName() const override { return "ctest_coverage"; }
-protected:
- void BindArguments() override;
- cmCTestGenericHandler* InitializeHandler() override;
+ std::unique_ptr<cmCTestGenericHandler> InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const override;
- cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Labels;
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index cec4a7e..1a0451d 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1,12 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestCoverageHandler.h"
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <cstdlib>
-#include <cstring>
#include <iomanip>
#include <iterator>
#include <memory>
@@ -41,17 +40,9 @@ class cmMakefile;
#define SAFEDIV(x, y) (((y) != 0) ? ((x) / (y)) : (0))
-cmCTestCoverageHandler::cmCTestCoverageHandler() = default;
-
-void cmCTestCoverageHandler::Initialize()
+cmCTestCoverageHandler::cmCTestCoverageHandler(cmCTest* ctest)
+ : Superclass(ctest)
{
- this->Superclass::Initialize();
- this->CustomCoverageExclude.clear();
- this->SourceLabels.clear();
- this->TargetDirs.clear();
- this->LabelIdMap.clear();
- this->Labels.clear();
- this->LabelFilter.clear();
}
void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log)
@@ -100,7 +91,7 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
void cmCTestCoverageHandler::StartCoverageLogXML(cmXMLWriter& xml)
{
- this->CTest->StartXML(xml, this->AppendXML);
+ this->CTest->StartXML(xml, this->CMake, this->AppendXML);
xml.StartElement("CoverageLog");
xml.Element("StartDateTime", this->CTest->CurrentTime());
xml.Element("StartTime", std::chrono::system_clock::now());
@@ -331,7 +322,7 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumFile.setf(std::ios::fixed, std::ios::floatfield);
covSumFile.precision(2);
- this->CTest->StartXML(covSumXML, this->AppendXML);
+ this->CTest->StartXML(covSumXML, this->CMake, this->AppendXML);
// Produce output xml files
covSumXML.StartElement("Coverage");
@@ -370,7 +361,7 @@ int cmCTestCoverageHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
}
- const std::string fullFileName = file.first;
+ std::string const fullFileName = file.first;
bool shouldIDoCoverage =
this->ShouldIDoCoverage(fullFileName, sourceDir, binaryDir);
if (!shouldIDoCoverage) {
@@ -401,10 +392,10 @@ int cmCTestCoverageHandler::ProcessHandler()
this->StartCoverageLogXML(covLogXML);
}
- const std::string fileName = cmSystemTools::GetFilenameName(fullFileName);
- const std::string shortFileName =
+ std::string const fileName = cmSystemTools::GetFilenameName(fullFileName);
+ std::string const shortFileName =
this->CTest->GetShortPathToFile(fullFileName);
- const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov =
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector const& fcov =
file.second;
covLogXML.StartElement("File");
covLogXML.Attribute("Name", fileName);
@@ -618,7 +609,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf)
# define fnc_prefix(s, t) cmHasPrefix(s, t)
#endif
-static bool IsFileInDir(const std::string& infile, const std::string& indir)
+static bool IsFileInDir(std::string const& infile, std::string const& indir)
{
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);
@@ -725,9 +716,9 @@ struct cmCTestCoverageHandlerLocale
cmSystemTools::UnsetEnv("LC_ALL");
}
}
- cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete;
+ cmCTestCoverageHandlerLocale(cmCTestCoverageHandlerLocale const&) = delete;
cmCTestCoverageHandlerLocale& operator=(
- const cmCTestCoverageHandlerLocale&) = delete;
+ cmCTestCoverageHandlerLocale const&) = delete;
std::string lc_all;
};
@@ -798,7 +789,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage(
return static_cast<int>(cont->TotalCoverage.size());
}
-static std::string joinCommandLine(const std::vector<std::string>& args)
+static std::string joinCommandLine(std::vector<std::string> const& args)
{
std::string ret;
@@ -955,7 +946,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
std::vector<std::string> covargs = basecovargs;
covargs.push_back(fileDir);
covargs.push_back(f);
- const std::string command = joinCommandLine(covargs);
+ std::string const command = joinCommandLine(covargs);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
command << std::endl, this->Quiet);
@@ -1315,7 +1306,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
std::vector<std::string> covargs =
cmSystemTools::ParseArguments(lcovExtraFlags);
covargs.insert(covargs.begin(), lcovCommand);
- const std::string command = joinCommandLine(covargs);
+ std::string const command = joinCommandLine(covargs);
// In intel compiler we have to call codecov only once in each executable
// directory. It collects all *.dyn files to generate .dpi file.
@@ -1325,10 +1316,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
std::string fileDir = cmSystemTools::GetFilenamePath(f);
cmWorkingDirectory workdir(fileDir);
if (workdir.Failed()) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Unable to change working directory to "
- << fileDir << " : "
- << std::strerror(workdir.GetLastResult()) << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, workdir.GetError() << std::endl);
cont->Error++;
continue;
}
@@ -1550,9 +1538,7 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
std::string buildDir = this->CTest->GetCTestConfiguration("BuildDirectory");
cmWorkingDirectory workdir(buildDir);
if (workdir.Failed()) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Unable to change working directory to " << buildDir
- << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, workdir.GetError() << std::endl);
return false;
}
@@ -1705,7 +1691,7 @@ std::string cmCTestCoverageHandler::FindFile(
// This is a header put on each marked up source file
namespace {
-const char* bullseyeHelp[] = {
+char const* bullseyeHelp[] = {
" Coverage produced by bullseye covbr tool: ",
" www.bullseye.com/help/ref_covbr.html",
" * An arrow --> indicates incomplete coverage.",
@@ -1747,9 +1733,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
"run covbr: " << std::endl, this->Quiet);
if (!this->RunBullseyeCommand(cont, "covbr", nullptr, outputFile)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "error running covbr for."
- << "\n");
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n");
return -1;
}
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
@@ -1854,7 +1838,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
}
int cmCTestCoverageHandler::RunBullseyeCommand(
- cmCTestCoverageHandlerContainer* cont, const char* cmd, const char* arg,
+ cmCTestCoverageHandlerContainer* cont, char const* cmd, char const* arg,
std::string& outputFile)
{
std::string program = cmSystemTools::FindProgram(cmd);
@@ -1915,7 +1899,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
"Cannot open coverage summary file." << std::endl);
return 0;
}
- this->CTest->StartXML(xml, this->AppendXML);
+ this->CTest->StartXML(xml, this->CMake, this->AppendXML);
auto elapsed_time_start = std::chrono::steady_clock::now();
std::string coverage_start_time = this->CTest->CurrentTime();
xml.StartElement("Coverage");
@@ -2158,7 +2142,7 @@ void cmCTestCoverageHandler::LoadLabels()
}
}
-void cmCTestCoverageHandler::LoadLabels(const char* dir)
+void cmCTestCoverageHandler::LoadLabels(char const* dir)
{
LabelSet& dirLabels = this->TargetDirs[dir];
std::string fname = cmStrCat(dir, "/Labels.txt");
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 8732723..e8232f8 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,6 +17,7 @@
class cmGeneratedFileStream;
class cmMakefile;
class cmXMLWriter;
+class cmCTest;
class cmCTestCoverageHandlerContainer
{
@@ -44,9 +45,7 @@ public:
*/
int ProcessHandler() override;
- cmCTestCoverageHandler();
-
- void Initialize() override;
+ cmCTestCoverageHandler(cmCTest* ctest);
/**
* This method is called when reading CTest custom file
@@ -101,7 +100,7 @@ private:
std::vector<std::string>& filesFullPath);
int RunBullseyeCommand(cmCTestCoverageHandlerContainer* cont,
- const char* cmd, const char* arg,
+ char const* cmd, char const* arg,
std::string& outputFile);
bool ParseBullsEyeCovsrcLine(std::string const& inputLine,
std::string& sourceFile, int& functionsCalled,
@@ -140,7 +139,7 @@ private:
// Label reading and writing methods.
void LoadLabels();
- void LoadLabels(const char* dir);
+ void LoadLabels(char const* dir);
void WriteXMLLabels(cmXMLWriter& xml, std::string const& source);
// Label-based filtering.
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 19599c1..30f63b9 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestCurl.h"
#include <cstdio>
@@ -15,8 +15,8 @@
#include "cmValue.h"
namespace {
-const bool TLS_VERIFY_DEFAULT = true;
-const int TLS_VERSION_DEFAULT = CURL_SSLVERSION_TLSv1_2;
+bool const TLS_VERIFY_DEFAULT = true;
+int const TLS_VERSION_DEFAULT = CURL_SSLVERSION_TLSv1_2;
}
cmCTestCurl::cmCTestCurl(cmCTest* ctest)
@@ -48,7 +48,7 @@ size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
void* data)
{
int realsize = static_cast<int>(size * nmemb);
- const char* chPtr = static_cast<char*>(ptr);
+ char const* chPtr = static_cast<char*>(ptr);
cm::append(*static_cast<std::vector<char>*>(data), chPtr, chPtr + realsize);
return realsize;
}
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index 9113890..729f161 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,8 +26,8 @@ class cmCTestCurl
public:
cmCTestCurl(cmCTest*);
~cmCTestCurl();
- cmCTestCurl(const cmCTestCurl&) = delete;
- cmCTestCurl& operator=(const cmCTestCurl&) = delete;
+ cmCTestCurl(cmCTestCurl const&) = delete;
+ cmCTestCurl& operator=(cmCTestCurl const&) = delete;
bool UploadFile(std::string const& local_file, std::string const& url,
std::string const& fields, std::string& response);
bool HttpRequest(std::string const& url, std::string const& fields,
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
index 2c92d77..0fc89e8 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
@@ -1,23 +1,99 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestEmptyBinaryDirectoryCommand.h"
-#include "cmCTestScriptHandler.h"
+#include "cmsys/Directory.hxx"
+
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+
+namespace {
+
+// Try to remove the binary directory once
+cmsys::Status TryToRemoveBinaryDirectoryOnce(std::string const& directoryPath)
+{
+ cmsys::Directory directory;
+ directory.Load(directoryPath);
+
+ // Make sure that CMakeCache.txt is deleted last.
+ for (unsigned long i = 0; i < directory.GetNumberOfFiles(); ++i) {
+ std::string path = directory.GetFile(i);
+
+ if (path == "." || path == ".." || path == "CMakeCache.txt") {
+ continue;
+ }
+
+ std::string fullPath = cmStrCat(directoryPath, "/", path);
+
+ bool isDirectory = cmSystemTools::FileIsDirectory(fullPath) &&
+ !cmSystemTools::FileIsSymlink(fullPath);
+
+ cmsys::Status status;
+ if (isDirectory) {
+ status = cmSystemTools::RemoveADirectory(fullPath);
+ } else {
+ status = cmSystemTools::RemoveFile(fullPath);
+ }
+ if (!status) {
+ return status;
+ }
+ }
+
+ return cmSystemTools::RemoveADirectory(directoryPath);
+}
+
+/*
+ * Empty Binary Directory
+ */
+bool EmptyBinaryDirectory(std::string const& sname, std::string& err)
+{
+ // try to avoid deleting root
+ if (sname.size() < 2) {
+ err = "path too short";
+ return false;
+ }
+
+ // consider non existing target directory a success
+ if (!cmSystemTools::FileExists(sname)) {
+ return true;
+ }
+
+ // try to avoid deleting directories that we shouldn't
+ std::string check = cmStrCat(sname, "/CMakeCache.txt");
+
+ if (!cmSystemTools::FileExists(check)) {
+ err = "path does not contain an existing CMakeCache.txt file";
+ return false;
+ }
+
+ cmsys::Status status;
+ for (int i = 0; i < 5; ++i) {
+ status = TryToRemoveBinaryDirectoryOnce(sname);
+ if (status) {
+ return true;
+ }
+ cmSystemTools::Delay(100);
+ }
+
+ err = status.GetString();
+ return false;
+}
+
+} // namespace
-bool cmCTestEmptyBinaryDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus& status)
+bool cmCTestEmptyBinaryDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() != 1) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
std::string err;
- if (!cmCTestScriptHandler::EmptyBinaryDirectory(args[0], err)) {
+ if (!EmptyBinaryDirectory(args[0], err)) {
status.GetMakefile().IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("Did not remove the binary directory:\n ", args[0],
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index ba2b0eb..11b12a8 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -1,46 +1,13 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
-
-#include "cmCTestCommand.h"
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmCTestEmptyBinaryDirectory
- * \brief Run a ctest script
- *
- * cmLibrarysCommand defines a list of executable (i.e., test)
- * programs to create.
- */
-class cmCTestEmptyBinaryDirectoryCommand : public cmCTestCommand
-{
-public:
- cmCTestEmptyBinaryDirectoryCommand() {}
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto ni = cm::make_unique<cmCTestEmptyBinaryDirectoryCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmCTestEmptyBinaryDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 99c5a2b..52adedd 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestGIT.h"
#include <cstdio>
@@ -15,11 +15,11 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmList.h"
+#include "cmMakefile.h"
#include "cmProcessOutput.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUVProcessChain.h"
-#include "cmValue.h"
static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
unsigned int minor, unsigned int fix)
@@ -28,8 +28,8 @@ static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
return epic * 10000000 + major * 100000 + minor * 1000 + fix;
}
-cmCTestGIT::cmCTestGIT(cmCTest* ct, std::ostream& log)
- : cmCTestGlobalVC(ct, log)
+cmCTestGIT::cmCTestGIT(cmCTest* ct, cmMakefile* mf, std::ostream& log)
+ : cmCTestGlobalVC(ct, mf, log)
{
this->PriorRev = this->Unknown;
this->CurrentGitVersion = 0;
@@ -40,7 +40,7 @@ cmCTestGIT::~cmCTestGIT() = default;
class cmCTestGIT::OneLineParser : public cmCTestVC::LineParser
{
public:
- OneLineParser(cmCTestGIT* git, const char* prefix, std::string& l)
+ OneLineParser(cmCTestGIT* git, char const* prefix, std::string& l)
: Line1(l)
{
this->SetLog(&git->Log, prefix);
@@ -146,7 +146,7 @@ std::string cmCTestGIT::FindTopDir()
!cdup.empty()) {
top_dir += "/";
top_dir += cdup;
- top_dir = cmSystemTools::CollapseFullPath(top_dir);
+ top_dir = cmSystemTools::ToNormalizedPathOnDisk(top_dir);
}
return top_dir;
}
@@ -161,9 +161,9 @@ bool cmCTestGIT::UpdateByFetchAndReset()
git_fetch.emplace_back("fetch");
// Add user-specified update options.
- std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_UPDATE_OPTIONS");
if (opts.empty()) {
- opts = this->CTest->GetCTestConfiguration("GITUpdateOptions");
+ opts = this->Makefile->GetSafeDefinition("CTEST_GIT_UPDATE_OPTIONS");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
cm::append(git_fetch, args);
@@ -222,7 +222,8 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom)
bool cmCTestGIT::UpdateInternal()
{
- std::string custom = this->CTest->GetCTestConfiguration("GITUpdateCustom");
+ std::string custom =
+ this->Makefile->GetSafeDefinition("CTEST_GIT_UPDATE_CUSTOM");
if (!custom.empty()) {
return this->UpdateByCustom(custom);
}
@@ -265,9 +266,7 @@ bool cmCTestGIT::UpdateImpl()
bool ret;
- std::string init_submodules =
- this->CTest->GetCTestConfiguration("GITInitSubmodules");
- if (cmIsOn(init_submodules)) {
+ if (this->Makefile->IsOn("CTEST_GIT_INIT_SUBMODULES")) {
std::vector<std::string> git_submodule_init = { git, "submodule", "init" };
ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err,
top_dir);
@@ -327,7 +326,7 @@ unsigned int cmCTestGIT::GetGitVersion()
class cmCTestGIT::DiffParser : public cmCTestVC::LineParser
{
public:
- DiffParser(cmCTestGIT* git, const char* prefix)
+ DiffParser(cmCTestGIT* git, char const* prefix)
: LineParser('\0', false)
, GIT(git)
{
@@ -367,16 +366,16 @@ protected:
this->DiffField = DiffFieldNone;
return true;
}
- const char* src_mode_first = this->Line.c_str() + 1;
- const char* src_mode_last = this->ConsumeField(src_mode_first);
- const char* dst_mode_first = this->ConsumeSpace(src_mode_last);
- const char* dst_mode_last = this->ConsumeField(dst_mode_first);
- const char* src_sha1_first = this->ConsumeSpace(dst_mode_last);
- const char* src_sha1_last = this->ConsumeField(src_sha1_first);
- const char* dst_sha1_first = this->ConsumeSpace(src_sha1_last);
- const char* dst_sha1_last = this->ConsumeField(dst_sha1_first);
- const char* status_first = this->ConsumeSpace(dst_sha1_last);
- const char* status_last = this->ConsumeField(status_first);
+ char const* src_mode_first = this->Line.c_str() + 1;
+ char const* src_mode_last = this->ConsumeField(src_mode_first);
+ char const* dst_mode_first = this->ConsumeSpace(src_mode_last);
+ char const* dst_mode_last = this->ConsumeField(dst_mode_first);
+ char const* src_sha1_first = this->ConsumeSpace(dst_mode_last);
+ char const* src_sha1_last = this->ConsumeField(src_sha1_first);
+ char const* dst_sha1_first = this->ConsumeSpace(src_sha1_last);
+ char const* dst_sha1_last = this->ConsumeField(dst_sha1_first);
+ char const* status_first = this->ConsumeSpace(dst_sha1_last);
+ char const* status_last = this->ConsumeField(status_first);
if (status_first != status_last) {
this->CurChange.Action = *status_first;
this->DiffField = DiffFieldSrc;
@@ -411,14 +410,14 @@ protected:
return true;
}
- const char* ConsumeSpace(const char* c)
+ char const* ConsumeSpace(char const* c)
{
while (*c && cmIsSpace(*c)) {
++c;
}
return c;
}
- const char* ConsumeField(const char* c)
+ char const* ConsumeField(char const* c)
{
while (*c && !cmIsSpace(*c)) {
++c;
@@ -449,7 +448,7 @@ protected:
class cmCTestGIT::CommitParser : public cmCTestGIT::DiffParser
{
public:
- CommitParser(cmCTestGIT* git, const char* prefix)
+ CommitParser(cmCTestGIT* git, char const* prefix)
: DiffParser(git, prefix)
{
this->Separator = SectionSep[this->Section];
@@ -476,29 +475,29 @@ private:
long TimeZone = 0;
};
- void ParsePerson(const char* str, Person& person)
+ void ParsePerson(char const* str, Person& person)
{
// Person Name <person@domain.com> 1234567890 +0000
- const char* c = str;
+ char const* c = str;
while (*c && cmIsSpace(*c)) {
++c;
}
- const char* name_first = c;
+ char const* name_first = c;
while (*c && *c != '<') {
++c;
}
- const char* name_last = c;
+ char const* name_last = c;
while (name_last != name_first && cmIsSpace(*(name_last - 1))) {
--name_last;
}
person.Name.assign(name_first, name_last - name_first);
- const char* email_first = *c ? ++c : c;
+ char const* email_first = *c ? ++c : c;
while (*c && *c != '>') {
++c;
}
- const char* email_last = *c ? c++ : c;
+ char const* email_last = *c ? c++ : c;
person.EMail.assign(email_first, email_last - email_first);
person.Time = strtoul(c, const_cast<char**>(&c), 10);
diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h
index a15aef5..8566b81 100644
--- a/Source/CTest/cmCTestGIT.h
+++ b/Source/CTest/cmCTestGIT.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,6 +10,7 @@
#include "cmCTestGlobalVC.h"
class cmCTest;
+class cmMakefile;
/** \class cmCTestGIT
* \brief Interaction with git command-line tool
@@ -19,7 +20,7 @@ class cmCTestGIT : public cmCTestGlobalVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestGIT(cmCTest* ctest, std::ostream& log);
+ cmCTestGIT(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestGIT() override;
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index dd69968..63f298e 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -1,176 +1,26 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestGenericHandler.h"
-#include <sstream>
-#include <utility>
-
#include "cmCTest.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-cmCTestGenericHandler::cmCTestGenericHandler()
+cmCTestGenericHandler::cmCTestGenericHandler(cmCTest* ctest)
+ : CTest(ctest)
{
- this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
- this->CTest = nullptr;
- this->SubmitIndex = 0;
- this->AppendXML = false;
- this->Quiet = false;
- this->TestLoad = 0;
+ this->SetVerbose(ctest->GetExtraVerbose());
}
cmCTestGenericHandler::~cmCTestGenericHandler() = default;
-namespace {
-/* Modify the given `map`, setting key `op` to `value` if `value`
- * is non-null, otherwise removing key `op` (if it exists).
- */
-void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
- const std::string& op, const std::string& value)
-{
- map[op] = value;
-}
-void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
- const std::string& op, cmValue value)
-{
- if (!value) {
- map.erase(op);
- return;
- }
-
- map[op] = *value;
-}
-}
-
-void cmCTestGenericHandler::SetOption(const std::string& op,
- const std::string& value)
-{
- SetMapValue(this->Options, op, value);
-}
-void cmCTestGenericHandler::SetOption(const std::string& op, cmValue value)
-{
- SetMapValue(this->Options, op, value);
-}
-
-void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
- const std::string& value)
-{
- this->SetOption(op, value);
- SetMapValue(this->PersistentOptions, op, value);
-}
-void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
- cmValue value)
-{
- this->SetOption(op, value);
- SetMapValue(this->PersistentOptions, op, value);
-}
-
-void cmCTestGenericHandler::AddMultiOption(const std::string& op,
- const std::string& value)
-{
- if (!value.empty()) {
- this->MultiOptions[op].emplace_back(value);
- }
-}
-
-void cmCTestGenericHandler::AddPersistentMultiOption(const std::string& op,
- const std::string& value)
-{
- if (!value.empty()) {
- this->MultiOptions[op].emplace_back(value);
- this->PersistentMultiOptions[op].emplace_back(value);
- }
-}
-
-void cmCTestGenericHandler::Initialize()
-{
- this->AppendXML = false;
- this->TestLoad = 0;
- this->Options = this->PersistentOptions;
- this->MultiOptions = this->PersistentMultiOptions;
-}
-
-cmValue cmCTestGenericHandler::GetOption(const std::string& op)
-{
- auto remit = this->Options.find(op);
- if (remit == this->Options.end()) {
- return nullptr;
- }
- return cmValue(remit->second);
-}
-
-std::vector<std::string> cmCTestGenericHandler::GetMultiOption(
- const std::string& optionName) const
-{
- // Avoid inserting a key, which MultiOptions[op] would do.
- auto remit = this->MultiOptions.find(optionName);
- if (remit == this->MultiOptions.end()) {
- return {};
- }
- return remit->second;
-}
-
bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
- const char* name,
+ char const* name,
cmGeneratedFileStream& xofs)
{
- if (!name) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot create resulting XML file without providing the name"
- << std::endl);
- return false;
- }
- std::ostringstream ostr;
- ostr << name;
- if (this->SubmitIndex > 0) {
- ostr << "_" << this->SubmitIndex;
- }
- ostr << ".xml";
- if (this->CTest->GetCurrentTag().empty()) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Current Tag empty, this may mean NightlyStartTime / "
- "CTEST_NIGHTLY_START_TIME was not set correctly. Or "
- "maybe you forgot to call ctest_start() before calling "
- "ctest_configure()."
- << std::endl);
- cmSystemTools::SetFatalErrorOccurred();
- return false;
- }
- if (!this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), ostr.str(),
- xofs, true)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot create resulting XML file: " << ostr.str()
- << std::endl);
- return false;
- }
- this->CTest->AddSubmitFile(part, ostr.str());
- return true;
+ return this->CTest->StartResultingXML(part, name, this->SubmitIndex, xofs);
}
-bool cmCTestGenericHandler::StartLogFile(const char* name,
+bool cmCTestGenericHandler::StartLogFile(char const* name,
cmGeneratedFileStream& xofs)
{
- if (!name) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot create log file without providing the name"
- << std::endl);
- return false;
- }
- std::ostringstream ostr;
- ostr << "Last" << name;
- if (this->SubmitIndex > 0) {
- ostr << "_" << this->SubmitIndex;
- }
- if (!this->CTest->GetCurrentTag().empty()) {
- ostr << "_" << this->CTest->GetCurrentTag();
- }
- ostr << ".log";
- this->LogFileNames[name] =
- cmStrCat(this->CTest->GetBinaryDir(), "/Testing/Temporary/", ostr.str());
- if (!this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot create log file: " << ostr.str() << std::endl);
- return false;
- }
- return true;
+ return this->CTest->StartLogFile(name, this->SubmitIndex, xofs);
}
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index a189d60..275b526 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -1,20 +1,15 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
-#include <cstddef>
-#include <map>
-#include <string>
-#include <vector>
-
#include "cmCTest.h"
#include "cmSystemTools.h"
-#include "cmValue.h"
class cmGeneratedFileStream;
class cmMakefile;
+class cmake;
/** \class cmCTestGenericHandler
* \brief A superclass of all CTest Handlers
@@ -44,70 +39,16 @@ public:
virtual int ProcessHandler() = 0;
/**
- * Process command line arguments that are applicable for the handler
- */
- virtual int ProcessCommandLineArguments(
- const std::string& /*currentArg*/, size_t& /*idx*/,
- const std::vector<std::string>& /*allArgs*/, bool& /*valid*/)
- {
- return 1;
- }
-
- /**
- * Initialize handler
- */
- virtual void Initialize();
-
- /**
- * Set the CTest instance
+ * Get the CTest instance
*/
- void SetCTestInstance(cmCTest* ctest) { this->CTest = ctest; }
cmCTest* GetCTestInstance() { return this->CTest; }
/**
* Construct handler
*/
- cmCTestGenericHandler();
+ cmCTestGenericHandler(cmCTest* ctest);
virtual ~cmCTestGenericHandler();
- using t_StringToString = std::map<std::string, std::string>;
- using t_StringToMultiString =
- std::map<std::string, std::vector<std::string>>;
-
- /**
- * Options collect a single value from flags; passing the
- * flag multiple times on the command-line *overwrites* values,
- * and only the last one specified counts. Set an option to
- * nullptr to "unset" it.
- *
- * The value is stored as a string. The values set for single
- * and multi-options (see below) live in different spaces,
- * so calling a single-getter for a key that has only been set
- * as a multi-value will return nullptr.
- */
- void SetPersistentOption(const std::string& op, const std::string& value);
- void SetPersistentOption(const std::string& op, cmValue value);
- void SetOption(const std::string& op, const std::string& value);
- void SetOption(const std::string& op, cmValue value);
- cmValue GetOption(const std::string& op);
-
- /**
- * Multi-Options collect one or more values from flags; passing
- * the flag multiple times on the command-line *adds* values,
- * rather than overwriting the previous values.
- *
- * Adding an empty value does nothing.
- *
- * The value is stored as a vector of strings. The values set for single
- * (see above) and multi-options live in different spaces,
- * so calling a multi-getter for a key that has only been set
- * as a single-value will return an empty vector.
- */
- void AddPersistentMultiOption(const std::string& optionName,
- const std::string& value);
- void AddMultiOption(const std::string& optionName, const std::string& value);
- std::vector<std::string> GetMultiOption(const std::string& op) const;
-
void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
int GetSubmitIndex() { return this->SubmitIndex; }
@@ -117,21 +58,19 @@ public:
void SetTestLoad(unsigned long load) { this->TestLoad = load; }
unsigned long GetTestLoad() const { return this->TestLoad; }
+ void SetCMakeInstance(cmake* cm) { this->CMake = cm; }
+
protected:
- bool StartResultingXML(cmCTest::Part part, const char* name,
+ bool StartResultingXML(cmCTest::Part part, char const* name,
cmGeneratedFileStream& xofs);
- bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
+ bool StartLogFile(char const* name, cmGeneratedFileStream& xofs);
- bool AppendXML;
- bool Quiet;
- unsigned long TestLoad;
- cmSystemTools::OutputOption HandlerVerbose;
+ bool AppendXML = false;
+ bool Quiet = false;
+ unsigned long TestLoad = 0;
+ cmSystemTools::OutputOption HandlerVerbose = cmSystemTools::OUTPUT_NONE;
cmCTest* CTest;
- t_StringToString Options;
- t_StringToString PersistentOptions;
- t_StringToMultiString MultiOptions;
- t_StringToMultiString PersistentMultiOptions;
- t_StringToString LogFileNames;
+ cmake* CMake = nullptr;
- int SubmitIndex;
+ int SubmitIndex = 0;
};
diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx
index 5f05efb..0d36b71 100644
--- a/Source/CTest/cmCTestGlobalVC.cxx
+++ b/Source/CTest/cmCTestGlobalVC.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestGlobalVC.h"
#include <ostream>
@@ -9,15 +9,16 @@
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-cmCTestGlobalVC::cmCTestGlobalVC(cmCTest* ct, std::ostream& log)
- : cmCTestVC(ct, log)
+cmCTestGlobalVC::cmCTestGlobalVC(cmCTest* ct, cmMakefile* mf,
+ std::ostream& log)
+ : cmCTestVC(ct, mf, log)
{
this->PriorRev = this->Unknown;
}
cmCTestGlobalVC::~cmCTestGlobalVC() = default;
-const char* cmCTestGlobalVC::LocalPath(std::string const& path)
+char const* cmCTestGlobalVC::LocalPath(std::string const& path)
{
return path.c_str();
}
@@ -47,7 +48,7 @@ void cmCTestGlobalVC::DoRevision(Revision const& revision,
// Update information about revisions of the changed files.
for (Change const& c : changes) {
- if (const char* local = this->LocalPath(c.Path)) {
+ if (char const* local = this->LocalPath(c.Path)) {
std::string dir = cmSystemTools::GetFilenamePath(local);
std::string name = cmSystemTools::GetFilenameName(local);
File& file = this->Dirs[dir][name];
@@ -77,7 +78,7 @@ void cmCTestGlobalVC::WriteXMLDirectory(cmXMLWriter& xml,
std::string const& path,
Directory const& dir)
{
- const char* slash = path.empty() ? "" : "/";
+ char const* slash = path.empty() ? "" : "/";
xml.StartElement("Directory");
xml.Element("Name", path);
for (auto const& f : dir) {
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index 679b0e1..e724b07 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,6 +13,7 @@
#include "cmCTestVC.h"
class cmCTest;
+class cmMakefile;
class cmXMLWriter;
/** \class cmCTestGlobalVC
@@ -23,7 +24,7 @@ class cmCTestGlobalVC : public cmCTestVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestGlobalVC(cmCTest* ctest, std::ostream& log);
+ cmCTestGlobalVC(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestGlobalVC() override;
@@ -60,7 +61,7 @@ protected:
// Information about revisions from a svn log.
std::list<Revision> Revisions;
- virtual const char* LocalPath(std::string const& path);
+ virtual char const* LocalPath(std::string const& path);
virtual void DoRevision(Revision const& revision,
std::vector<Change> const& changes);
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index 3d56be0..738cac2 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestHG.h"
#include <ostream>
@@ -11,11 +11,12 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
+#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
-cmCTestHG::cmCTestHG(cmCTest* ct, std::ostream& log)
- : cmCTestGlobalVC(ct, log)
+cmCTestHG::cmCTestHG(cmCTest* ct, cmMakefile* mf, std::ostream& log)
+ : cmCTestGlobalVC(ct, mf, log)
{
this->PriorRev = this->Unknown;
}
@@ -25,7 +26,7 @@ cmCTestHG::~cmCTestHG() = default;
class cmCTestHG::IdentifyParser : public cmCTestVC::LineParser
{
public:
- IdentifyParser(cmCTestHG* hg, const char* prefix, std::string& rev)
+ IdentifyParser(cmCTestHG* hg, char const* prefix, std::string& rev)
: Rev(rev)
{
this->SetLog(&hg->Log, prefix);
@@ -49,7 +50,7 @@ private:
class cmCTestHG::StatusParser : public cmCTestVC::LineParser
{
public:
- StatusParser(cmCTestHG* hg, const char* prefix)
+ StatusParser(cmCTestHG* hg, char const* prefix)
: HG(hg)
{
this->SetLog(&hg->Log, prefix);
@@ -142,9 +143,9 @@ bool cmCTestHG::UpdateImpl()
hg_update.emplace_back("-v");
// Add user-specified update options.
- std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_UPDATE_OPTIONS");
if (opts.empty()) {
- opts = this->CTest->GetCTestConfiguration("HGUpdateOptions");
+ opts = this->Makefile->GetSafeDefinition("CTEST_HG_UPDATE_OPTIONS");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
cm::append(hg_update, args);
@@ -159,7 +160,7 @@ class cmCTestHG::LogParser
, private cmXMLParser
{
public:
- LogParser(cmCTestHG* hg, const char* prefix)
+ LogParser(cmCTestHG* hg, char const* prefix)
: OutputLogger(hg->Log, prefix)
, HG(hg)
{
@@ -177,19 +178,19 @@ private:
Change CurChange;
std::vector<char> CData;
- bool ProcessChunk(const char* data, int length) override
+ bool ProcessChunk(char const* data, int length) override
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
- void StartElement(const std::string& name, const char** atts) override
+ void StartElement(std::string const& name, char const** atts) override
{
this->CData.clear();
if (name == "logentry") {
this->Rev = Revision();
- if (const char* rev =
+ if (char const* rev =
cmCTestHG::LogParser::FindAttribute(atts, "revision")) {
this->Rev.Rev = rev;
}
@@ -197,12 +198,12 @@ private:
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
cm::append(this->CData, data, data + length);
}
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "logentry") {
this->HG->DoRevision(this->Rev, this->Changes);
@@ -257,7 +258,7 @@ private:
return output;
}
- void ReportError(int /*line*/, int /*column*/, const char* msg) override
+ void ReportError(int /*line*/, int /*column*/, char const* msg) override
{
this->HG->Log << "Error parsing hg log xml: " << msg << "\n";
}
diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h
index b81f042..bd69dd3 100644
--- a/Source/CTest/cmCTestHG.h
+++ b/Source/CTest/cmCTestHG.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,6 +10,7 @@
#include "cmCTestGlobalVC.h"
class cmCTest;
+class cmMakefile;
/** \class cmCTestHG
* \brief Interaction with Mercurial command-line tool
@@ -19,7 +20,7 @@ class cmCTestHG : public cmCTestGlobalVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestHG(cmCTest* ctest, std::ostream& log);
+ cmCTestHG(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestHG() override;
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index c377d68..b8e6a03 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -1,20 +1,17 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestHandlerCommand.h"
#include <algorithm>
#include <cstdlib>
-#include <cstring>
#include <sstream>
#include <cm/string_view>
-#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -63,8 +60,8 @@ public:
}
}
}
- SaveRestoreErrorState(const SaveRestoreErrorState&) = delete;
- SaveRestoreErrorState& operator=(const SaveRestoreErrorState&) = delete;
+ SaveRestoreErrorState(SaveRestoreErrorState const&) = delete;
+ SaveRestoreErrorState& operator=(SaveRestoreErrorState const&) = delete;
private:
bool InitialErrorState;
@@ -72,176 +69,150 @@ private:
};
}
-bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status)
+bool cmCTestHandlerCommand::InvokeImpl(
+ BasicArguments& args, std::vector<std::string> const& unparsed,
+ cmExecutionStatus& status, std::function<bool()> handler) const
{
// save error state and restore it if needed
SaveRestoreErrorState errorState;
- // Allocate space for argument values.
- this->BindArguments();
-
- // Process input arguments.
- std::vector<std::string> unparsedArguments;
- this->Parse(args, &unparsedArguments);
- this->CheckArguments();
-
- std::sort(this->ParsedKeywords.begin(), this->ParsedKeywords.end());
- auto it = std::adjacent_find(this->ParsedKeywords.begin(),
- this->ParsedKeywords.end());
- if (it != this->ParsedKeywords.end()) {
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("Called with more than one value for ", *it));
- }
-
- bool const foundBadArgument = !unparsedArguments.empty();
- if (foundBadArgument) {
- this->SetError(cmStrCat("called with unknown argument \"",
- unparsedArguments.front(), "\"."));
- }
- bool const captureCMakeError = !this->CaptureCMakeError.empty();
- // now that arguments are parsed check to see if there is a
- // CAPTURE_CMAKE_ERROR specified let the errorState object know.
- if (captureCMakeError) {
+ if (!args.CaptureCMakeError.empty()) {
errorState.CaptureCMakeError();
}
- // if we found a bad argument then exit before running command
- if (foundBadArgument) {
- // store the cmake error
- if (captureCMakeError) {
- this->Makefile->AddDefinition(this->CaptureCMakeError, "-1");
- std::string const err = this->GetName() + " " + status.GetError();
- if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) {
- cmCTestLog(this->CTest, ERROR_MESSAGE, err << " error from command\n");
- }
- // return success because failure is recorded in CAPTURE_CMAKE_ERROR
+
+ bool success = [&]() -> bool {
+ if (args.MaybeReportError(status.GetMakefile())) {
return true;
}
- // return failure because of bad argument
- return false;
+
+ std::sort(args.ParsedKeywords.begin(), args.ParsedKeywords.end());
+ auto const it = std::adjacent_find(args.ParsedKeywords.begin(),
+ args.ParsedKeywords.end());
+ if (it != args.ParsedKeywords.end()) {
+ status.SetError(cmStrCat("called with more than one value for ", *it));
+ return false;
+ }
+
+ if (!unparsed.empty()) {
+ status.SetError(
+ cmStrCat("called with unknown argument \"", unparsed.front(), "\"."));
+ return false;
+ }
+
+ return handler();
+ }();
+
+ if (args.CaptureCMakeError.empty()) {
+ return success;
}
+ if (!success) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ this->GetName() << ' ' << status.GetError() << '\n');
+ }
+
+ cmMakefile& mf = status.GetMakefile();
+ success = success && !cmSystemTools::GetErrorOccurredFlag();
+ mf.AddDefinition(args.CaptureCMakeError, success ? "0" : "-1");
+ return true;
+}
+
+bool cmCTestHandlerCommand::ExecuteHandlerCommand(
+ HandlerArguments& args, cmExecutionStatus& status) const
+{
+ cmMakefile& mf = status.GetMakefile();
+
+ // Process input arguments.
+ this->CheckArguments(args, status);
+
// Set the config type of this ctest to the current value of the
// CTEST_CONFIGURATION_TYPE script variable if it is defined.
// The current script value trumps the -C argument on the command
// line.
- cmValue ctestConfigType =
- this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE");
+ cmValue ctestConfigType = mf.GetDefinition("CTEST_CONFIGURATION_TYPE");
if (ctestConfigType) {
this->CTest->SetConfigType(*ctestConfigType);
}
- if (!this->Build.empty()) {
+ if (!args.Build.empty()) {
this->CTest->SetCTestConfiguration(
- "BuildDirectory", cmSystemTools::CollapseFullPath(this->Build),
- this->Quiet);
+ "BuildDirectory", cmSystemTools::CollapseFullPath(args.Build),
+ args.Quiet);
} else {
- std::string const& bdir =
- this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
+ std::string const& bdir = mf.GetSafeDefinition("CTEST_BINARY_DIRECTORY");
if (!bdir.empty()) {
this->CTest->SetCTestConfiguration(
- "BuildDirectory", cmSystemTools::CollapseFullPath(bdir), this->Quiet);
+ "BuildDirectory", cmSystemTools::CollapseFullPath(bdir), args.Quiet);
} else {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"CTEST_BINARY_DIRECTORY not set" << std::endl);
}
}
- if (!this->Source.empty()) {
+ if (!args.Source.empty()) {
cmCTestLog(this->CTest, DEBUG,
- "Set source directory to: " << this->Source << std::endl);
+ "Set source directory to: " << args.Source << std::endl);
this->CTest->SetCTestConfiguration(
- "SourceDirectory", cmSystemTools::CollapseFullPath(this->Source),
- this->Quiet);
+ "SourceDirectory", cmSystemTools::CollapseFullPath(args.Source),
+ args.Quiet);
} else {
this->CTest->SetCTestConfiguration(
"SourceDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
- this->Quiet);
+ mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
+ args.Quiet);
}
- if (cmValue changeId = this->Makefile->GetDefinition("CTEST_CHANGE_ID")) {
- this->CTest->SetCTestConfiguration("ChangeId", *changeId, this->Quiet);
+ if (cmValue changeId = mf.GetDefinition("CTEST_CHANGE_ID")) {
+ this->CTest->SetCTestConfiguration("ChangeId", *changeId, args.Quiet);
}
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl);
- cmCTestGenericHandler* handler = this->InitializeHandler();
+ auto handler = this->InitializeHandler(args, status);
if (!handler) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot instantiate test handler " << this->GetName()
<< std::endl);
- if (captureCMakeError) {
- this->Makefile->AddDefinition(this->CaptureCMakeError, "-1");
- std::string const& err = status.GetError();
- if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) {
- cmCTestLog(this->CTest, ERROR_MESSAGE, err << " error from command\n");
- }
- return true;
- }
return false;
}
- handler->SetAppendXML(this->Append);
+ handler->SetAppendXML(args.Append);
- handler->PopulateCustomVectors(this->Makefile);
- if (!this->SubmitIndex.empty()) {
- handler->SetSubmitIndex(atoi(this->SubmitIndex.c_str()));
+ handler->PopulateCustomVectors(&mf);
+ if (!args.SubmitIndex.empty()) {
+ handler->SetSubmitIndex(atoi(args.SubmitIndex.c_str()));
}
cmWorkingDirectory workdir(
this->CTest->GetCTestConfiguration("BuildDirectory"));
if (workdir.Failed()) {
- this->SetError("failed to change directory to " +
- this->CTest->GetCTestConfiguration("BuildDirectory") +
- " : " + std::strerror(workdir.GetLastResult()));
- if (captureCMakeError) {
- this->Makefile->AddDefinition(this->CaptureCMakeError, "-1");
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- this->GetName() << " " << status.GetError() << "\n");
- // return success because failure is recorded in CAPTURE_CMAKE_ERROR
- return true;
- }
+ status.SetError(workdir.GetError());
return false;
}
+ // reread time limit, as the variable may have been modified.
+ this->CTest->SetTimeLimit(mf.GetDefinition("CTEST_TIME_LIMIT"));
+ handler->SetCMakeInstance(mf.GetCMakeInstance());
+
int res = handler->ProcessHandler();
- if (!this->ReturnValue.empty()) {
- this->Makefile->AddDefinition(this->ReturnValue, std::to_string(res));
- }
- this->ProcessAdditionalValues(handler);
- // log the error message if there was an error
- if (captureCMakeError) {
- const char* returnString = "0";
- if (cmSystemTools::GetErrorOccurredFlag()) {
- returnString = "-1";
- std::string const& err = status.GetError();
- // print out the error if it is not "unknown error" which means
- // there was no message
- if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) {
- cmCTestLog(this->CTest, ERROR_MESSAGE, err);
- }
- }
- // store the captured cmake error state 0 or -1
- this->Makefile->AddDefinition(this->CaptureCMakeError, returnString);
+ if (!args.ReturnValue.empty()) {
+ mf.AddDefinition(args.ReturnValue, std::to_string(res));
}
+ this->ProcessAdditionalValues(handler.get(), args, status);
return true;
}
-void cmCTestHandlerCommand::ProcessAdditionalValues(cmCTestGenericHandler*)
+void cmCTestHandlerCommand::CheckArguments(HandlerArguments&,
+ cmExecutionStatus&) const
{
}
-void cmCTestHandlerCommand::BindArguments()
+std::unique_ptr<cmCTestGenericHandler>
+cmCTestHandlerCommand::InitializeHandler(HandlerArguments&,
+ cmExecutionStatus&) const
{
- this->BindParsedKeywords(this->ParsedKeywords);
- this->Bind("APPEND"_s, this->Append);
- this->Bind("QUIET"_s, this->Quiet);
- this->Bind("RETURN_VALUE"_s, this->ReturnValue);
- this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError);
- this->Bind("SOURCE"_s, this->Source);
- this->Bind("BUILD"_s, this->Build);
- this->Bind("SUBMIT_INDEX"_s, this->SubmitIndex);
-}
+ return nullptr;
+};
-void cmCTestHandlerCommand::CheckArguments()
+void cmCTestHandlerCommand::ProcessAdditionalValues(cmCTestGenericHandler*,
+ HandlerArguments const&,
+ cmExecutionStatus&) const
{
}
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index ed6d9af..ef7bc5d 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -1,62 +1,98 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <functional>
+#include <memory>
#include <string>
+#include <type_traits>
#include <vector>
#include <cm/string_view>
+#include <cmext/string_view>
#include "cmArgumentParser.h"
#include "cmCTestCommand.h"
-class cmCTestGenericHandler;
class cmExecutionStatus;
+class cmCTestGenericHandler;
-/** \class cmCTestHandler
- * \brief Run a ctest script
- *
- * cmCTestHandlerCommand defineds the command to test the project.
- */
-class cmCTestHandlerCommand
- : public cmCTestCommand
- , public cmArgumentParser<void>
+class cmCTestHandlerCommand : public cmCTestCommand
{
public:
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- virtual std::string GetName() const = 0;
+ using cmCTestCommand::cmCTestCommand;
+
+protected:
+ struct BasicArguments : ArgumentParser::ParseResult
+ {
+ std::string CaptureCMakeError;
+ std::vector<cm::string_view> ParsedKeywords;
+ };
+
+ template <typename Args>
+ static auto MakeBasicParser() -> cmArgumentParser<Args>
+ {
+ static_assert(std::is_base_of<BasicArguments, Args>::value, "");
+ return cmArgumentParser<Args>{}
+ .Bind("CAPTURE_CMAKE_ERROR"_s, &BasicArguments::CaptureCMakeError)
+ .BindParsedKeywords(&BasicArguments::ParsedKeywords);
+ }
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
+ struct HandlerArguments : BasicArguments
+ {
+ bool Append = false;
+ bool Quiet = false;
+ std::string ReturnValue;
+ std::string Build;
+ std::string Source;
+ std::string SubmitIndex;
+ };
+
+ template <typename Args>
+ static auto MakeHandlerParser() -> cmArgumentParser<Args>
+ {
+ static_assert(std::is_base_of<HandlerArguments, Args>::value, "");
+ return cmArgumentParser<Args>{ MakeBasicParser<Args>() }
+ .Bind("APPEND"_s, &HandlerArguments::Append)
+ .Bind("QUIET"_s, &HandlerArguments::Quiet)
+ .Bind("RETURN_VALUE"_s, &HandlerArguments::ReturnValue)
+ .Bind("SOURCE"_s, &HandlerArguments::Source)
+ .Bind("BUILD"_s, &HandlerArguments::Build)
+ .Bind("SUBMIT_INDEX"_s, &HandlerArguments::SubmitIndex);
+ }
protected:
- virtual cmCTestGenericHandler* InitializeHandler() = 0;
-
- virtual void ProcessAdditionalValues(cmCTestGenericHandler* handler);
-
- // Command argument handling.
- virtual void BindArguments();
- virtual void CheckArguments();
-
- std::vector<cm::string_view> ParsedKeywords;
- bool Append = false;
- bool Quiet = false;
- std::string CaptureCMakeError;
- std::string ReturnValue;
- std::string Build;
- std::string Source;
- std::string SubmitIndex;
-};
+ template <typename Args, typename Handler>
+ bool Invoke(cmArgumentParser<Args> const& parser,
+ std::vector<std::string> const& arguments,
+ cmExecutionStatus& status, Handler handler) const
+ {
+ std::vector<std::string> unparsed;
+ Args args = parser.Parse(arguments, &unparsed);
+ return this->InvokeImpl(args, unparsed, status,
+ [&]() -> bool { return handler(args); });
+ };
-#define CTEST_COMMAND_APPEND_OPTION_DOCS \
- "The APPEND option marks results for append to those previously " \
- "submitted to a dashboard server since the last ctest_start. " \
- "Append semantics are defined by the dashboard server in use."
+ bool ExecuteHandlerCommand(HandlerArguments& args,
+ cmExecutionStatus& status) const;
+
+private:
+ bool InvokeImpl(BasicArguments& args,
+ std::vector<std::string> const& unparsed,
+ cmExecutionStatus& status,
+ std::function<bool()> handler) const;
+
+ virtual std::string GetName() const = 0;
+
+ virtual void CheckArguments(HandlerArguments& arguments,
+ cmExecutionStatus& status) const;
+
+ virtual std::unique_ptr<cmCTestGenericHandler> InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const;
+
+ virtual void ProcessAdditionalValues(cmCTestGenericHandler*,
+ HandlerArguments const& arguments,
+ cmExecutionStatus& status) const;
+};
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 9669d76..a929b39 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -1,10 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestLaunch.h"
#include <cstdio>
#include <cstring>
#include <iostream>
+#include <map>
#include <memory>
#include <utility>
@@ -15,6 +16,7 @@
#include "cmCTestLaunchReporter.h"
#include "cmGlobalGenerator.h"
+#include "cmInstrumentation.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
#include "cmState.h"
@@ -33,7 +35,7 @@
# include <io.h> // for _setmode
#endif
-cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
+cmCTestLaunch::cmCTestLaunch(int argc, char const* const* argv, Op operation)
{
if (!this->ParseArguments(argc, argv)) {
return;
@@ -45,11 +47,12 @@ cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
this->ScrapeRulesLoaded = false;
this->HaveOut = false;
this->HaveErr = false;
+ this->Operation = operation;
}
cmCTestLaunch::~cmCTestLaunch() = default;
-bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
+bool cmCTestLaunch::ParseArguments(int argc, char const* const* argv)
{
// Launcher options occur first and are separated from the real
// command line by a '--' option.
@@ -59,32 +62,47 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
DoingOutput,
DoingSource,
DoingLanguage,
+ DoingTargetLabels,
DoingTargetName,
DoingTargetType,
+ DoingCommandType,
+ DoingRole,
DoingBuildDir,
+ DoingCurrentBuildDir,
DoingCount,
- DoingFilterPrefix
+ DoingFilterPrefix,
+ DoingConfig
};
Doing doing = DoingNone;
int arg0 = 0;
for (int i = 1; !arg0 && i < argc; ++i) {
- const char* arg = argv[i];
+ char const* arg = argv[i];
if (strcmp(arg, "--") == 0) {
arg0 = i + 1;
+ } else if (strcmp(arg, "--command-type") == 0) {
+ doing = DoingCommandType;
} else if (strcmp(arg, "--output") == 0) {
doing = DoingOutput;
} else if (strcmp(arg, "--source") == 0) {
doing = DoingSource;
} else if (strcmp(arg, "--language") == 0) {
doing = DoingLanguage;
+ } else if (strcmp(arg, "--target-labels") == 0) {
+ doing = DoingTargetLabels;
} else if (strcmp(arg, "--target-name") == 0) {
doing = DoingTargetName;
} else if (strcmp(arg, "--target-type") == 0) {
doing = DoingTargetType;
+ } else if (strcmp(arg, "--role") == 0) {
+ doing = DoingRole;
} else if (strcmp(arg, "--build-dir") == 0) {
doing = DoingBuildDir;
+ } else if (strcmp(arg, "--current-build-dir") == 0) {
+ doing = DoingCurrentBuildDir;
} else if (strcmp(arg, "--filter-prefix") == 0) {
doing = DoingFilterPrefix;
+ } else if (strcmp(arg, "--config") == 0) {
+ doing = DoingConfig;
} else if (doing == DoingOutput) {
this->Reporter.OptionOutput = arg;
doing = DoingNone;
@@ -97,6 +115,9 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
this->Reporter.OptionLanguage = "C++";
}
doing = DoingNone;
+ } else if (doing == DoingTargetLabels) {
+ this->Reporter.OptionTargetLabels = arg;
+ doing = DoingNone;
} else if (doing == DoingTargetName) {
this->Reporter.OptionTargetName = arg;
doing = DoingNone;
@@ -106,9 +127,21 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
} else if (doing == DoingBuildDir) {
this->Reporter.OptionBuildDir = arg;
doing = DoingNone;
+ } else if (doing == DoingCurrentBuildDir) {
+ this->Reporter.OptionCurrentBuildDir = arg;
+ doing = DoingNone;
} else if (doing == DoingFilterPrefix) {
this->Reporter.OptionFilterPrefix = arg;
doing = DoingNone;
+ } else if (doing == DoingCommandType) {
+ this->Reporter.OptionCommandType = arg;
+ doing = DoingNone;
+ } else if (doing == DoingRole) {
+ this->Reporter.OptionRole = arg;
+ doing = DoingNone;
+ } else if (doing == DoingConfig) {
+ this->Reporter.OptionConfig = arg;
+ doing = DoingNone;
}
}
@@ -124,7 +157,7 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
return false;
}
-void cmCTestLaunch::HandleRealArg(const char* arg)
+void cmCTestLaunch::HandleRealArg(char const* arg)
{
#ifdef _WIN32
// Expand response file arguments.
@@ -233,14 +266,36 @@ void cmCTestLaunch::RunChild()
int cmCTestLaunch::Run()
{
- this->RunChild();
-
- if (this->CheckResults()) {
- return this->Reporter.ExitCode;
+ auto instrumentation = cmInstrumentation(this->Reporter.OptionBuildDir);
+ std::map<std::string, std::string> options;
+ if (this->Reporter.OptionTargetName != "TARGET_NAME") {
+ options["target"] = this->Reporter.OptionTargetName;
}
+ options["source"] = this->Reporter.OptionSource;
+ options["language"] = this->Reporter.OptionLanguage;
+ options["targetType"] = this->Reporter.OptionTargetType;
+ options["role"] = this->Reporter.OptionRole;
+ options["config"] = this->Reporter.OptionConfig;
+ std::map<std::string, std::string> arrayOptions;
+ arrayOptions["outputs"] = this->Reporter.OptionOutput;
+ arrayOptions["targetLabels"] = this->Reporter.OptionTargetLabels;
+ instrumentation.InstrumentCommand(
+ this->Reporter.OptionCommandType, this->RealArgV,
+ [this]() -> int {
+ this->RunChild();
+ return 0;
+ },
+ options, arrayOptions);
+
+ if (this->Operation == Op::Normal) {
+
+ if (this->CheckResults()) {
+ return this->Reporter.ExitCode;
+ }
- this->LoadConfig();
- this->Reporter.WriteXML();
+ this->LoadConfig();
+ this->Reporter.WriteXML();
+ }
return this->Reporter.ExitCode;
}
@@ -279,7 +334,7 @@ void cmCTestLaunch::LoadScrapeRules()
}
void cmCTestLaunch::LoadScrapeRules(
- const char* purpose, std::vector<cmsys::RegularExpression>& regexps) const
+ char const* purpose, std::vector<cmsys::RegularExpression>& regexps) const
{
std::string fname =
cmStrCat(this->Reporter.LogDir, "Custom", purpose, ".txt");
@@ -314,14 +369,14 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname)
return false;
}
-int cmCTestLaunch::Main(int argc, const char* const argv[])
+int cmCTestLaunch::Main(int argc, char const* const argv[], Op operation)
{
if (argc == 2) {
std::cerr << "ctest --launch: this mode is for internal CTest use only"
<< std::endl;
return 1;
}
- cmCTestLaunch self(argc, argv);
+ cmCTestLaunch self(argc, argv, operation);
return self.Run();
}
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index ef21a26..0aeb211 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,16 +20,23 @@ class RegularExpression;
*/
class cmCTestLaunch
{
+
public:
+ enum class Op
+ {
+ Normal,
+ Instrument,
+ };
+
/** Entry point from ctest executable main(). */
- static int Main(int argc, const char* const argv[]);
+ static int Main(int argc, char const* const argv[], Op operation);
- cmCTestLaunch(const cmCTestLaunch&) = delete;
- cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
+ cmCTestLaunch(cmCTestLaunch const&) = delete;
+ cmCTestLaunch& operator=(cmCTestLaunch const&) = delete;
private:
// Initialize the launcher from its command line.
- cmCTestLaunch(int argc, const char* const* argv);
+ cmCTestLaunch(int argc, char const* const* argv, Op operation);
~cmCTestLaunch();
// Run the real command.
@@ -40,14 +47,14 @@ private:
bool CheckResults();
// Parse out launcher-specific options specified before the real command.
- bool ParseArguments(int argc, const char* const* argv);
+ bool ParseArguments(int argc, char const* const* argv);
// The real command line appearing after launcher arguments.
std::vector<std::string> RealArgV;
// The real command line after response file expansion.
std::vector<std::string> RealArgs;
- void HandleRealArg(const char* arg);
+ void HandleRealArg(char const* arg);
// Whether or not any data have been written to stdout or stderr.
bool HaveOut;
@@ -56,7 +63,7 @@ private:
// Load custom rules to match warnings and their exceptions.
bool ScrapeRulesLoaded;
void LoadScrapeRules();
- void LoadScrapeRules(const char* purpose,
+ void LoadScrapeRules(char const* purpose,
std::vector<cmsys::RegularExpression>& regexps) const;
bool ScrapeLog(std::string const& fname);
@@ -65,4 +72,7 @@ private:
// Configuration
void LoadConfig();
+
+ // Mode
+ Op Operation;
};
diff --git a/Source/CTest/cmCTestLaunchReporter.cxx b/Source/CTest/cmCTestLaunchReporter.cxx
index 4b4e5c5..2e1d2bb 100644
--- a/Source/CTest/cmCTestLaunchReporter.cxx
+++ b/Source/CTest/cmCTestLaunchReporter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestLaunchReporter.h"
#include <utility>
@@ -25,7 +25,7 @@ cmCTestLaunchReporter::cmCTestLaunchReporter()
this->Passthru = true;
this->Status.Finished = true;
this->ExitCode = 1;
- this->CWD = cmSystemTools::GetCurrentWorkingDirectory();
+ this->CWD = cmSystemTools::GetLogicalWorkingDirectory();
this->ComputeFileNames();
@@ -78,12 +78,12 @@ void cmCTestLaunchReporter::ComputeFileNames()
void cmCTestLaunchReporter::LoadLabels()
{
- if (this->OptionBuildDir.empty() || this->OptionTargetName.empty()) {
+ if (this->OptionCurrentBuildDir.empty() || this->OptionTargetName.empty()) {
return;
}
// Labels are listed in per-target files.
- std::string fname = cmStrCat(this->OptionBuildDir, "/CMakeFiles/",
+ std::string fname = cmStrCat(this->OptionCurrentBuildDir, "/CMakeFiles/",
this->OptionTargetName, ".dir/Labels.txt");
// We are interested in per-target labels for this source file.
@@ -189,7 +189,7 @@ void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) const
}
// OutputType
- const char* outputType = nullptr;
+ char const* outputType = nullptr;
if (!this->OptionTargetType.empty()) {
if (this->OptionTargetType == "EXECUTABLE") {
outputType = "executable";
@@ -265,13 +265,13 @@ void cmCTestLaunchReporter::WriteXMLLabels(cmXMLElement& e2)
}
}
-void cmCTestLaunchReporter::DumpFileToXML(cmXMLElement& e3, const char* tag,
+void cmCTestLaunchReporter::DumpFileToXML(cmXMLElement& e3, char const* tag,
std::string const& fname)
{
cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
- const char* sep = "";
+ char const* sep = "";
cmXMLElement e4(e3, tag);
while (cmSystemTools::GetLineFromStream(fin, line)) {
diff --git a/Source/CTest/cmCTestLaunchReporter.h b/Source/CTest/cmCTestLaunchReporter.h
index 2bb78f8..cc32ced 100644
--- a/Source/CTest/cmCTestLaunchReporter.h
+++ b/Source/CTest/cmCTestLaunchReporter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,8 +24,8 @@ public:
cmCTestLaunchReporter();
~cmCTestLaunchReporter();
- cmCTestLaunchReporter(const cmCTestLaunchReporter&) = delete;
- cmCTestLaunchReporter& operator=(const cmCTestLaunchReporter&) = delete;
+ cmCTestLaunchReporter(cmCTestLaunchReporter const&) = delete;
+ cmCTestLaunchReporter& operator=(cmCTestLaunchReporter const&) = delete;
// Methods to check the result of the real command.
bool IsError() const;
@@ -34,10 +34,15 @@ public:
std::string OptionOutput;
std::string OptionSource;
std::string OptionLanguage;
+ std::string OptionTargetLabels;
std::string OptionTargetName;
std::string OptionTargetType;
+ std::string OptionCurrentBuildDir;
std::string OptionBuildDir;
std::string OptionFilterPrefix;
+ std::string OptionCommandType;
+ std::string OptionRole;
+ std::string OptionConfig;
// The real command line appearing after launcher arguments.
std::string CWD;
@@ -76,7 +81,7 @@ public:
void WriteXMLCommand(cmXMLElement&);
void WriteXMLResult(cmXMLElement&);
void WriteXMLLabels(cmXMLElement&);
- void DumpFileToXML(cmXMLElement&, const char* tag, std::string const& fname);
+ void DumpFileToXML(cmXMLElement&, char const* tag, std::string const& fname);
// Configuration
std::string SourceDir;
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index 37b3628..8b681e2 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -1,50 +1,66 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestMemCheckCommand.h"
+#include <utility>
+
+#include <cm/memory>
#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmCTest.h"
#include "cmCTestMemCheckHandler.h"
+#include "cmCTestTestHandler.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-void cmCTestMemCheckCommand::BindArguments()
-{
- this->cmCTestTestCommand::BindArguments();
- this->Bind("DEFECT_COUNT"_s, this->DefectCount);
-}
-
-cmCTestTestHandler* cmCTestMemCheckCommand::InitializeActualHandler()
+std::unique_ptr<cmCTestTestHandler>
+cmCTestMemCheckCommand::InitializeActualHandler(
+ HandlerArguments& args, cmExecutionStatus& status) const
{
- cmCTestMemCheckHandler* handler = this->CTest->GetMemCheckHandler();
- handler->Initialize();
+ cmMakefile& mf = status.GetMakefile();
+ auto handler = cm::make_unique<cmCTestMemCheckHandler>(this->CTest);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet);
+ &mf, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "MemoryCheckSanitizerOptions",
- "CTEST_MEMORYCHECK_SANITIZER_OPTIONS", this->Quiet);
+ &mf, "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS",
+ args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND",
- this->Quiet);
+ &mf, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "MemoryCheckCommandOptions",
- "CTEST_MEMORYCHECK_COMMAND_OPTIONS", this->Quiet);
+ &mf, "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS",
+ args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "MemoryCheckSuppressionFile",
- "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", this->Quiet);
+ &mf, "MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE",
+ args.Quiet);
- handler->SetQuiet(this->Quiet);
- return handler;
+ handler->SetQuiet(args.Quiet);
+ return std::unique_ptr<cmCTestTestHandler>(std::move(handler));
}
void cmCTestMemCheckCommand::ProcessAdditionalValues(
- cmCTestGenericHandler* handler)
+ cmCTestGenericHandler* handler, HandlerArguments const& arguments,
+ cmExecutionStatus& status) const
{
- if (!this->DefectCount.empty()) {
- this->Makefile->AddDefinition(
- this->DefectCount,
+ cmMakefile& mf = status.GetMakefile();
+ auto const& args = static_cast<MemCheckArguments const&>(arguments);
+ if (!args.DefectCount.empty()) {
+ mf.AddDefinition(
+ args.DefectCount,
std::to_string(
static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount()));
}
}
+
+bool cmCTestMemCheckCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
+{
+ static auto const parser =
+ cmArgumentParser<MemCheckArguments>{ MakeTestParser<MemCheckArguments>() }
+ .Bind("DEFECT_COUNT"_s, &MemCheckArguments::DefectCount);
+
+ return this->Invoke(parser, args, status, [&](MemCheckArguments& a) {
+ return this->ExecuteHandlerCommand(a, status);
+ });
+}
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index ee39e49..b0ea52f 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -1,45 +1,40 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <string>
-#include <utility>
-
-#include <cm/memory>
+#include <vector>
#include "cmCTestTestCommand.h"
-#include "cmCommand.h"
+class cmExecutionStatus;
class cmCTestGenericHandler;
class cmCTestTestHandler;
-/** \class cmCTestMemCheck
- * \brief Run a ctest script
- *
- * cmCTestMemCheckCommand defineds the command to test the project.
- */
class cmCTestMemCheckCommand : public cmCTestTestCommand
{
public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto ni = cm::make_unique<cmCTestMemCheckCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
+ using cmCTestTestCommand::cmCTestTestCommand;
protected:
- void BindArguments() override;
+ struct MemCheckArguments : TestArguments
+ {
+ std::string DefectCount;
+ };
+
+private:
+ std::string GetName() const override { return "ctest_memcheck"; }
- cmCTestTestHandler* InitializeActualHandler() override;
+ std::unique_ptr<cmCTestTestHandler> InitializeActualHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const override;
- void ProcessAdditionalValues(cmCTestGenericHandler* handler) override;
+ void ProcessAdditionalValues(cmCTestGenericHandler* handler,
+ HandlerArguments const& arguments,
+ cmExecutionStatus& status) const override;
- std::string DefectCount;
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 8596ffa..c95cc3f 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestMemCheckHandler.h"
#include <algorithm>
@@ -25,7 +25,7 @@
struct CatToErrorType
{
- const char* ErrorCategory;
+ char const* ErrorCategory;
int ErrorCode;
};
@@ -40,7 +40,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = {
{ nullptr, 0 }
};
-static void xmlReportError(int line, const char* msg, void* data)
+static void xmlReportError(int line, char const* msg, void* data)
{
cmCTest* ctest = static_cast<cmCTest*>(data);
cmCTestLog(ctest, ERROR_MESSAGE,
@@ -57,7 +57,7 @@ public:
this->CTest = c;
this->SetErrorCallback(xmlReportError, c);
}
- void StartElement(const std::string& name, const char** atts) override
+ void StartElement(std::string const& name, char const** atts) override
{
if (name == "MemoryLeak" || name == "ResourceLeak") {
this->Errors.push_back(cmCTestMemCheckHandler::MLK);
@@ -74,9 +74,9 @@ public:
ostr << "\n";
this->Log += ostr.str();
}
- void EndElement(const std::string& /*name*/) override {}
+ void EndElement(std::string const& /*name*/) override {}
- const char* GetAttribute(const char* name, const char** atts)
+ char const* GetAttribute(char const* name, char const** atts)
{
int i = 0;
for (; atts[i]; ++i) {
@@ -86,10 +86,10 @@ public:
}
return nullptr;
}
- void ParseError(const char** atts)
+ void ParseError(char const** atts)
{
CatToErrorType* ptr = cmCTestMemCheckBoundsChecker;
- const char* cat = this->GetAttribute("ErrorCategory", atts);
+ char const* cat = this->GetAttribute("ErrorCategory", atts);
if (!cat) {
this->Errors.push_back(cmCTestMemCheckHandler::ABW); // do not know
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -118,26 +118,12 @@ public:
#define BOUNDS_CHECKER_MARKER \
"******######*****Begin BOUNDS CHECKER XML******######******"
-cmCTestMemCheckHandler::cmCTestMemCheckHandler()
+cmCTestMemCheckHandler::cmCTestMemCheckHandler(cmCTest* ctest)
+ : Superclass(ctest)
{
this->MemCheck = true;
- this->CustomMaximumPassedTestOutputSize = 0;
- this->CustomMaximumFailedTestOutputSize = 0;
- this->LogWithPID = false;
-}
-
-void cmCTestMemCheckHandler::Initialize()
-{
- this->Superclass::Initialize();
- this->LogWithPID = false;
- this->CustomMaximumPassedTestOutputSize = 0;
- this->CustomMaximumFailedTestOutputSize = 0;
- this->MemoryTester.clear();
- this->MemoryTesterDynamicOptions.clear();
- this->MemoryTesterOptions.clear();
- this->MemoryTesterStyle = UNKNOWN;
- this->MemoryTesterOutputFile.clear();
- this->DefectCount = 0;
+ this->TestOptions.OutputSizePassed = 0;
+ this->TestOptions.OutputSizeFailed = 0;
}
int cmCTestMemCheckHandler::PreProcessHandler()
@@ -251,12 +237,12 @@ void cmCTestMemCheckHandler::InitializeResultsVectors()
// define the standard set of errors
//----------------------------------------------------------------------
- static const char* cmCTestMemCheckResultStrings[] = {
+ static char const* cmCTestMemCheckResultStrings[] = {
"ABR", "ABW", "ABWL", "COR", "EXU", "FFM", "FIM", "FMM",
"FMR", "FMW", "FUM", "IPR", "IPW", "MAF", "MLK", "MPK",
"NPR", "ODS", "PAR", "PLK", "UMC", "UMR", nullptr
};
- static const char* cmCTestMemCheckResultLongStrings[] = {
+ static char const* cmCTestMemCheckResultLongStrings[] = {
"Threading Problem",
"ABW",
"ABWL",
@@ -311,7 +297,7 @@ void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml)
if (!this->CTest->GetProduceXML()) {
return;
}
- this->CTest->StartXML(xml, this->AppendXML);
+ this->CTest->StartXML(xml, this->CMake, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("DynamicAnalysis");
switch (this->MemoryTesterStyle) {
@@ -371,9 +357,8 @@ void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml)
continue;
}
this->CleanTestOutput(
- memcheckstr,
- static_cast<size_t>(this->CustomMaximumFailedTestOutputSize),
- this->TestOutputTruncation);
+ memcheckstr, static_cast<size_t>(this->TestOptions.OutputSizeFailed),
+ this->TestOptions.OutputTruncation);
this->WriteTestResultHeader(xml, result);
xml.StartElement("Results");
int memoryErrors = 0;
@@ -390,7 +375,7 @@ void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml)
}
xml.EndElement(); // Results
if (memoryErrors > 0) {
- const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
+ int const maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
std::string outname = result.Name + " ";
outname.resize(maxTestNameWidth + 4, '.');
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
@@ -783,7 +768,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
return true;
}
-bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
+bool cmCTestMemCheckHandler::ProcessMemCheckOutput(std::string const& str,
std::string& log,
std::vector<int>& results)
{
@@ -813,7 +798,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
}
std::vector<int>::size_type cmCTestMemCheckHandler::FindOrAddWarning(
- const std::string& warning)
+ std::string const& warning)
{
for (std::vector<std::string>::size_type i = 0;
i < this->ResultStrings.size(); ++i) {
@@ -827,7 +812,7 @@ std::vector<int>::size_type cmCTestMemCheckHandler::FindOrAddWarning(
return this->ResultStrings.size() - 1;
}
bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
- const std::string& str, std::string& log, std::vector<int>& result)
+ std::string const& str, std::string& log, std::vector<int>& result)
{
std::string regex;
switch (this->MemoryTesterStyle) {
@@ -880,7 +865,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
- const std::string& str, std::string& log, std::vector<int>& results)
+ std::string const& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
cmsys::SystemTools::Split(str, lines);
@@ -923,13 +908,13 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
- const std::string& str, std::string& log, std::vector<int>& results)
+ std::string const& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
cmsys::SystemTools::Split(str, lines);
bool unlimitedOutput = false;
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
- this->CustomMaximumFailedTestOutputSize == 0) {
+ this->TestOptions.OutputSizeFailed == 0) {
unlimitedOutput = true;
}
@@ -1029,7 +1014,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
ostr << lines[i] << std::endl;
if (!unlimitedOutput &&
totalOutputSize >
- static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) {
+ static_cast<size_t>(this->TestOptions.OutputSizeFailed)) {
ostr << "....\n";
ostr << "Test Output for this test has been truncated see testing"
" machine logs for full output,\n";
@@ -1050,7 +1035,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
}
bool cmCTestMemCheckHandler::ProcessMemCheckDrMemoryOutput(
- const std::string& str, std::string& log, std::vector<int>& results)
+ std::string const& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
cmsys::SystemTools::Split(str, lines);
@@ -1066,7 +1051,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckDrMemoryOutput(
int defects = 0;
std::ostringstream ostr;
- for (const auto& l : lines) {
+ for (auto const& l : lines) {
ostr << l << std::endl;
if (drMemoryError.find(l)) {
defects++;
@@ -1087,7 +1072,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckDrMemoryOutput(
}
bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
- const std::string& str, std::string& log, std::vector<int>& results)
+ std::string const& str, std::string& log, std::vector<int>& results)
{
log.clear();
auto sttime = std::chrono::steady_clock::now();
@@ -1137,13 +1122,13 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
}
bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
- const std::string& str, std::string& log, std::vector<int>& results)
+ std::string const& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
cmsys::SystemTools::Split(str, lines);
bool unlimitedOutput = false;
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
- this->CustomMaximumFailedTestOutputSize == 0) {
+ this->TestOptions.OutputSizeFailed == 0) {
unlimitedOutput = true;
}
@@ -1243,7 +1228,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
ostr << lines[i] << std::endl;
if (!unlimitedOutput &&
totalOutputSize >
- static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) {
+ static_cast<size_t>(this->TestOptions.OutputSizeFailed)) {
ostr << "....\n";
ostr << "Test Output for this test has been truncated see testing"
" machine logs for full output,\n";
@@ -1342,9 +1327,9 @@ void cmCTestMemCheckHandler::PostProcessDrMemoryTest(
cmsys::Glob g;
g.FindFiles(drMemoryLogDir + "/resfile.*");
- const std::vector<std::string>& files = g.GetFiles();
+ std::vector<std::string> const& files = g.GetFiles();
- for (const std::string& f : files) {
+ for (std::string const& f : files) {
cmsys::ifstream ifs(f.c_str());
if (!ifs) {
std::string log = "Cannot read memory tester output file: " + f;
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index a63a24d..5f381c2 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -11,6 +11,7 @@
class cmMakefile;
class cmXMLWriter;
+class cmCTest;
/** \class cmCTestMemCheckHandler
* \brief A class that handles ctest -S invocations
@@ -25,9 +26,7 @@ public:
void PopulateCustomVectors(cmMakefile* mf) override;
- cmCTestMemCheckHandler();
-
- void Initialize() override;
+ cmCTestMemCheckHandler(cmCTest* ctest);
int GetDefectCount() const;
@@ -100,17 +99,17 @@ private:
std::string MemoryTester;
std::vector<std::string> MemoryTesterDynamicOptions;
std::vector<std::string> MemoryTesterOptions;
- int MemoryTesterStyle;
+ int MemoryTesterStyle = UNKNOWN;
std::string MemoryTesterOutputFile;
std::string MemoryTesterEnvironmentVariable;
// these are used to store the types of errors that can show up
std::vector<std::string> ResultStrings;
std::vector<std::string> ResultStringsLong;
std::vector<int> GlobalResults;
- bool LogWithPID; // does log file add pid
- int DefectCount;
+ bool LogWithPID = false; // does log file add pid
+ int DefectCount = 0;
- std::vector<int>::size_type FindOrAddWarning(const std::string& warning);
+ std::vector<int>::size_type FindOrAddWarning(std::string const& warning);
// initialize the ResultStrings and ResultStringsLong for
// this type of checker
void InitializeResultsVectors();
@@ -129,19 +128,19 @@ private:
//! Parse Valgrind/Purify/Bounds Checker result out of the output
// string. After running, log holds the output and results hold the
// different memory errors.
- bool ProcessMemCheckOutput(const std::string& str, std::string& log,
+ bool ProcessMemCheckOutput(std::string const& str, std::string& log,
std::vector<int>& results);
- bool ProcessMemCheckValgrindOutput(const std::string& str, std::string& log,
+ bool ProcessMemCheckValgrindOutput(std::string const& str, std::string& log,
std::vector<int>& results);
- bool ProcessMemCheckDrMemoryOutput(const std::string& str, std::string& log,
+ bool ProcessMemCheckDrMemoryOutput(std::string const& str, std::string& log,
std::vector<int>& results);
- bool ProcessMemCheckPurifyOutput(const std::string& str, std::string& log,
+ bool ProcessMemCheckPurifyOutput(std::string const& str, std::string& log,
std::vector<int>& results);
- bool ProcessMemCheckCudaOutput(const std::string& str, std::string& log,
+ bool ProcessMemCheckCudaOutput(std::string const& str, std::string& log,
std::vector<int>& results);
- bool ProcessMemCheckSanitizerOutput(const std::string& str, std::string& log,
+ bool ProcessMemCheckSanitizerOutput(std::string const& str, std::string& log,
std::vector<int>& results);
- bool ProcessMemCheckBoundsCheckerOutput(const std::string& str,
+ bool ProcessMemCheckBoundsCheckerOutput(std::string const& str,
std::string& log,
std::vector<int>& results);
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 84ea32b..0df9657 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestMultiProcessHandler.h"
#include <algorithm>
@@ -8,7 +8,6 @@
#include <cmath>
#include <cstddef> // IWYU pragma: keep
#include <cstdlib>
-#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
@@ -20,6 +19,7 @@
#include <cm/memory>
#include <cm/optional>
+#include <cm/string_view>
#include <cmext/algorithm>
#include <cm3p/json/value.h>
@@ -52,6 +52,48 @@ constexpr unsigned long kParallelLevelMinimum = 2u;
// Under a job server, parallelism is effectively limited
// only by available job server tokens.
constexpr unsigned long kParallelLevelUnbounded = 0x10000u;
+
+struct CostEntry
+{
+ cm::string_view name;
+ int prevRuns;
+ float cost;
+};
+
+cm::optional<CostEntry> splitCostLine(cm::string_view line)
+{
+ std::string part;
+ cm::string_view::size_type pos1 = line.size();
+ cm::string_view::size_type pos2 = line.find_last_of(' ', pos1);
+ auto findNext = [line, &part, &pos1, &pos2]() -> bool {
+ if (pos2 != cm::string_view::npos) {
+ cm::string_view sub = line.substr(pos2 + 1, pos1 - pos2 - 1);
+ part.assign(sub.begin(), sub.end());
+ pos1 = pos2;
+ if (pos1 > 0) {
+ pos2 = line.find_last_of(' ', pos1 - 1);
+ }
+ return true;
+ }
+ return false;
+ };
+
+ // parse the cost
+ if (!findNext()) {
+ return cm::nullopt;
+ }
+ float cost = static_cast<float>(atof(part.c_str()));
+
+ // parse the previous runs
+ if (!findNext()) {
+ return cm::nullopt;
+ }
+ int prev = atoi(part.c_str());
+
+ // from start to the last found space is the name
+ return CostEntry{ line.substr(0, pos1), prev, cost };
+}
+
}
namespace cmsys {
@@ -279,9 +321,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
cmWorkingDirectory workdir(this->Properties[test]->Directory);
if (workdir.Failed()) {
cmCTestRunTest::StartFailure(std::move(testRun), this->Total,
- "Failed to change working directory to " +
- this->Properties[test]->Directory + " : " +
- std::strerror(workdir.GetLastResult()),
+ workdir.GetError(),
"Failed to change working directory");
return;
}
@@ -501,7 +541,7 @@ void cmCTestMultiProcessHandler::UnlockResources(int index)
inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test)
{
- size_t processors = static_cast<int>(this->Properties[test]->Processors);
+ size_t processors = this->Properties[test]->Processors;
size_t const parallelLevel = this->GetParallelLevel();
// If processors setting is set higher than the -j
// setting, we default to using all of the process slots.
@@ -726,7 +766,7 @@ void cmCTestMultiProcessHandler::StartNextTestsOnTimer()
// Wait between 1 and 5 seconds before trying again.
unsigned int const milliseconds = this->FakeLoadForTesting
? 10
- : (cmSystemTools::RandomSeed() % 5 + 1) * 1000;
+ : (cmSystemTools::RandomNumber() % 5 + 1) * 1000;
this->StartNextTestsOnTimer_.start(
[](uv_timer_t* timer) {
uv_timer_stop(timer);
@@ -797,24 +837,21 @@ void cmCTestMultiProcessHandler::UpdateCostData()
if (line == "---") {
break;
}
- std::vector<std::string> parts = cmSystemTools::SplitString(line, ' ');
// Format: <name> <previous_runs> <avg_cost>
- if (parts.size() < 3) {
+ cm::optional<CostEntry> entry = splitCostLine(line);
+ if (!entry) {
break;
}
- std::string name = parts[0];
- int prev = atoi(parts[1].c_str());
- float cost = static_cast<float>(atof(parts[2].c_str()));
-
- int index = this->SearchByName(name);
+ int index = this->SearchByName(entry->name);
if (index == -1) {
// This test is not in memory. We just rewrite the entry
- fout << name << " " << prev << " " << cost << "\n";
+ fout << entry->name << " " << entry->prevRuns << " " << entry->cost
+ << "\n";
} else {
// Update with our new average cost
- fout << name << " " << this->Properties[index]->PreviousRuns << " "
- << this->Properties[index]->Cost << "\n";
+ fout << entry->name << " " << this->Properties[index]->PreviousRuns
+ << " " << this->Properties[index]->Cost << "\n";
temp.erase(index);
}
}
@@ -850,28 +887,25 @@ void cmCTestMultiProcessHandler::ReadCostData()
break;
}
- std::vector<std::string> parts = cmSystemTools::SplitString(line, ' ');
+ // Format: <name> <previous_runs> <avg_cost>
+ cm::optional<CostEntry> entry = splitCostLine(line);
// Probably an older version of the file, will be fixed next run
- if (parts.size() < 3) {
+ if (!entry) {
fin.close();
return;
}
- std::string name = parts[0];
- int prev = atoi(parts[1].c_str());
- float cost = static_cast<float>(atof(parts[2].c_str()));
-
- int index = this->SearchByName(name);
+ int index = this->SearchByName(entry->name);
if (index == -1) {
continue;
}
- this->Properties[index]->PreviousRuns = prev;
+ this->Properties[index]->PreviousRuns = entry->prevRuns;
// When not running in parallel mode, don't use cost data
if (this->GetParallelLevel() > 1 && this->Properties[index] &&
this->Properties[index]->Cost == 0) {
- this->Properties[index]->Cost = cost;
+ this->Properties[index]->Cost = entry->cost;
}
}
// Next part of the file is the failed tests
@@ -884,7 +918,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
}
}
-int cmCTestMultiProcessHandler::SearchByName(std::string const& name)
+int cmCTestMultiProcessHandler::SearchByName(cm::string_view name)
{
int index = -1;
@@ -1023,39 +1057,39 @@ void cmCTestMultiProcessHandler::MarkFinished()
cmSystemTools::RemoveFile(fname);
}
-static Json::Value DumpToJsonArray(const std::set<std::string>& values)
+static Json::Value DumpToJsonArray(std::set<std::string> const& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (const auto& it : values) {
+ for (auto const& it : values) {
jsonArray.append(it);
}
return jsonArray;
}
-static Json::Value DumpToJsonArray(const std::vector<std::string>& values)
+static Json::Value DumpToJsonArray(std::vector<std::string> const& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (const auto& it : values) {
+ for (auto const& it : values) {
jsonArray.append(it);
}
return jsonArray;
}
static Json::Value DumpRegExToJsonArray(
- const std::vector<std::pair<cmsys::RegularExpression, std::string>>& values)
+ std::vector<std::pair<cmsys::RegularExpression, std::string>> const& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (const auto& it : values) {
+ for (auto const& it : values) {
jsonArray.append(it.second);
}
return jsonArray;
}
static Json::Value DumpMeasurementToJsonArray(
- const std::map<std::string, std::string>& values)
+ std::map<std::string, std::string> const& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (const auto& it : values) {
+ for (auto const& it : values) {
Json::Value measurement = Json::objectValue;
measurement["measurement"] = it.first;
measurement["value"] = it.second;
@@ -1075,8 +1109,8 @@ static Json::Value DumpTimeoutAfterMatch(
}
static Json::Value DumpResourceGroupsToJsonArray(
- const std::vector<
- std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>&
+ std::vector<
+ std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>> const&
resourceGroups)
{
Json::Value jsonResourceGroups = Json::arrayValue;
@@ -1159,6 +1193,11 @@ static Json::Value DumpCTestProperties(
properties.append(DumpCTestProperty(
"FIXTURES_SETUP", DumpToJsonArray(testProperties.FixturesSetup)));
}
+ if (!testProperties.GeneratedResourceSpecFile.empty()) {
+ properties.append(
+ DumpCTestProperty("GENERATED_RESOURCE_SPEC_FILE",
+ testProperties.GeneratedResourceSpecFile));
+ }
if (!testProperties.Labels.empty()) {
properties.append(
DumpCTestProperty("LABELS", DumpToJsonArray(testProperties.Labels)));
@@ -1205,6 +1244,15 @@ static Json::Value DumpCTestProperties(
properties.append(
DumpCTestProperty("TIMEOUT", testProperties.Timeout->count()));
}
+ if (testProperties.TimeoutSignal) {
+ properties.append(DumpCTestProperty("TIMEOUT_SIGNAL_NAME",
+ testProperties.TimeoutSignal->Name));
+ }
+ if (testProperties.TimeoutGracePeriod) {
+ properties.append(
+ DumpCTestProperty("TIMEOUT_SIGNAL_GRACE_PERIOD",
+ testProperties.TimeoutGracePeriod->count()));
+ }
if (!testProperties.TimeoutRegularExpressions.empty()) {
properties.append(DumpCTestProperty(
"TIMEOUT_AFTER_MATCH", DumpTimeoutAfterMatch(testProperties)));
@@ -1323,7 +1371,7 @@ static Json::Value DumpCTestInfo(
if (!command.empty()) {
std::vector<std::string> commandAndArgs;
commandAndArgs.push_back(command);
- const std::vector<std::string>& args = testRun.GetArguments();
+ std::vector<std::string> const& args = testRun.GetArguments();
if (!args.empty()) {
commandAndArgs.reserve(args.size() + 1);
cm::append(commandAndArgs, args);
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index fd6c17f..b85284b 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,6 +13,7 @@
#include <vector>
#include <cm/optional>
+#include <cm/string_view>
#include "cmCTest.h"
#include "cmCTestResourceAllocator.h"
@@ -89,7 +90,7 @@ public:
this->RepeatCount = count;
}
- void SetResourceSpecFile(const std::string& resourceSpecFile)
+ void SetResourceSpecFile(std::string const& resourceSpecFile)
{
this->ResourceSpecFile = resourceSpecFile;
}
@@ -110,7 +111,7 @@ protected:
void UpdateCostData();
void ReadCostData();
// Return index of a test based on its name
- int SearchByName(std::string const& name);
+ int SearchByName(cm::string_view name);
void CreateTestCostList();
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 20bd0ec..97d280a 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestP4.h"
#include <algorithm>
@@ -14,11 +14,12 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmList.h"
+#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSystemTools.h"
-cmCTestP4::cmCTestP4(cmCTest* ct, std::ostream& log)
- : cmCTestGlobalVC(ct, log)
+cmCTestP4::cmCTestP4(cmCTest* ct, cmMakefile* mf, std::ostream& log)
+ : cmCTestGlobalVC(ct, mf, log)
{
this->PriorRev = this->Unknown;
}
@@ -28,7 +29,7 @@ cmCTestP4::~cmCTestP4() = default;
class cmCTestP4::IdentifyParser : public cmCTestVC::LineParser
{
public:
- IdentifyParser(cmCTestP4* p4, const char* prefix, std::string& rev)
+ IdentifyParser(cmCTestP4* p4, char const* prefix, std::string& rev)
: Rev(rev)
{
this->SetLog(&p4->Log, prefix);
@@ -52,7 +53,7 @@ private:
class cmCTestP4::ChangesParser : public cmCTestVC::LineParser
{
public:
- ChangesParser(cmCTestP4* p4, const char* prefix)
+ ChangesParser(cmCTestP4* p4, char const* prefix)
: P4(p4)
{
this->SetLog(&this->P4->Log, prefix);
@@ -75,7 +76,7 @@ private:
class cmCTestP4::UserParser : public cmCTestVC::LineParser
{
public:
- UserParser(cmCTestP4* p4, const char* prefix)
+ UserParser(cmCTestP4* p4, char const* prefix)
: P4(p4)
{
this->SetLog(&this->P4->Log, prefix);
@@ -115,7 +116,7 @@ private:
class cmCTestP4::DiffParser : public cmCTestVC::LineParser
{
public:
- DiffParser(cmCTestP4* p4, const char* prefix)
+ DiffParser(cmCTestP4* p4, char const* prefix)
: P4(p4)
{
this->SetLog(&this->P4->Log, prefix);
@@ -144,7 +145,7 @@ private:
}
};
-cmCTestP4::User cmCTestP4::GetUserData(const std::string& username)
+cmCTestP4::User cmCTestP4::GetUserData(std::string const& username)
{
auto it = this->Users.find(username);
@@ -187,7 +188,7 @@ Affected files ...
class cmCTestP4::DescribeParser : public cmCTestVC::LineParser
{
public:
- DescribeParser(cmCTestP4* p4, const char* prefix)
+ DescribeParser(cmCTestP4* p4, char const* prefix)
: LineParser('\n', false)
, P4(p4)
{
@@ -310,7 +311,7 @@ void cmCTestP4::SetP4Options(std::vector<std::string>& CommandOptions)
// The CTEST_P4_CLIENT variable sets the P4 client used when issuing
// Perforce commands, if it's different from the default one.
- std::string client = this->CTest->GetCTestConfiguration("P4Client");
+ std::string client = this->Makefile->GetSafeDefinition("CTEST_P4_CLIENT");
if (!client.empty()) {
this->P4Options.emplace_back("-c");
this->P4Options.push_back(client);
@@ -323,7 +324,7 @@ void cmCTestP4::SetP4Options(std::vector<std::string>& CommandOptions)
// The CTEST_P4_OPTIONS variable adds additional Perforce command line
// options before the main command
- std::string opts = this->CTest->GetCTestConfiguration("P4Options");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_P4_OPTIONS");
cm::append(this->P4Options, cmSystemTools::ParseArguments(opts));
}
@@ -449,7 +450,7 @@ bool cmCTestP4::LoadModifications()
return true;
}
-bool cmCTestP4::UpdateCustom(const std::string& custom)
+bool cmCTestP4::UpdateCustom(std::string const& custom)
{
cmList p4_custom_command{ custom, cmList::EmptyElements::Yes };
@@ -465,7 +466,8 @@ bool cmCTestP4::UpdateCustom(const std::string& custom)
bool cmCTestP4::UpdateImpl()
{
- std::string custom = this->CTest->GetCTestConfiguration("P4UpdateCustom");
+ std::string custom =
+ this->Makefile->GetSafeDefinition("CTEST_P4_UPDATE_CUSTOM");
if (!custom.empty()) {
return this->UpdateCustom(custom);
}
@@ -483,9 +485,9 @@ bool cmCTestP4::UpdateImpl()
p4_sync.emplace_back("sync");
// Get user-specified update options.
- std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_UPDATE_OPTIONS");
if (opts.empty()) {
- opts = this->CTest->GetCTestConfiguration("P4UpdateOptions");
+ opts = this->Makefile->GetSafeDefinition("CTEST_P4_UPDATE_OPTIONS");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
cm::append(p4_sync, args);
diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h
index 827caa1..76965ac 100644
--- a/Source/CTest/cmCTestP4.h
+++ b/Source/CTest/cmCTestP4.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,6 +12,7 @@
#include "cmCTestGlobalVC.h"
class cmCTest;
+class cmMakefile;
/** \class cmCTestP4
* \brief Interaction with the Perforce command-line tool
@@ -21,7 +22,7 @@ class cmCTestP4 : public cmCTestGlobalVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestP4(cmCTest* ctest, std::ostream& log);
+ cmCTestP4(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestP4() override;
@@ -38,14 +39,14 @@ private:
std::map<std::string, User> Users;
std::vector<std::string> P4Options;
- User GetUserData(const std::string& username);
+ User GetUserData(std::string const& username);
void SetP4Options(std::vector<std::string>& options);
std::string GetWorkingRevision();
bool NoteOldRevision() override;
bool NoteNewRevision() override;
bool UpdateImpl() override;
- bool UpdateCustom(const std::string& custom);
+ bool UpdateCustom(std::string const& custom);
bool LoadRevisions() override;
bool LoadModifications() override;
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx
index a25cca4..343a74e 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx
@@ -1,21 +1,23 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestReadCustomFilesCommand.h"
#include "cmCTest.h"
+#include "cmExecutionStatus.h"
-class cmExecutionStatus;
+class cmMakefile;
bool cmCTestReadCustomFilesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus& /*unused*/)
+ std::vector<std::string> const& args, cmExecutionStatus& status) const
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& arg : args) {
- this->CTest->ReadCustomConfigurationFileTree(arg, this->Makefile);
+ this->CTest->ReadCustomConfigurationFileTree(arg, &mf);
}
return true;
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index 03714f6..8b1b357 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -1,45 +1,25 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
-
#include "cmCTestCommand.h"
-#include "cmCommand.h"
class cmExecutionStatus;
-/** \class cmCTestReadCustomFiles
- * \brief Run a ctest script
- *
- * cmLibrarysCommand defines a list of executable (i.e., test)
- * programs to create.
- */
class cmCTestReadCustomFilesCommand : public cmCTestCommand
{
public:
- cmCTestReadCustomFilesCommand() {}
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto ni = cm::make_unique<cmCTestReadCustomFilesCommand>();
- ni->CTest = this->CTest;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
+ using cmCTestCommand::cmCTestCommand;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestResourceAllocator.cxx b/Source/CTest/cmCTestResourceAllocator.cxx
index 9d468a7..a7ae7bc 100644
--- a/Source/CTest/cmCTestResourceAllocator.cxx
+++ b/Source/CTest/cmCTestResourceAllocator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestResourceAllocator.h"
@@ -9,7 +9,7 @@
#include "cmCTestResourceSpec.h"
void cmCTestResourceAllocator::InitializeFromResourceSpec(
- const cmCTestResourceSpec& spec)
+ cmCTestResourceSpec const& spec)
{
this->Resources.clear();
@@ -22,15 +22,15 @@ void cmCTestResourceAllocator::InitializeFromResourceSpec(
}
}
-const std::map<std::string,
- std::map<std::string, cmCTestResourceAllocator::Resource>>&
+std::map<std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const&
cmCTestResourceAllocator::GetResources() const
{
return this->Resources;
}
-bool cmCTestResourceAllocator::AllocateResource(const std::string& name,
- const std::string& id,
+bool cmCTestResourceAllocator::AllocateResource(std::string const& name,
+ std::string const& id,
unsigned int slots)
{
auto it = this->Resources.find(name);
@@ -51,8 +51,8 @@ bool cmCTestResourceAllocator::AllocateResource(const std::string& name,
return true;
}
-bool cmCTestResourceAllocator::DeallocateResource(const std::string& name,
- const std::string& id,
+bool cmCTestResourceAllocator::DeallocateResource(std::string const& name,
+ std::string const& id,
unsigned int slots)
{
auto it = this->Resources.find(name);
@@ -74,13 +74,13 @@ bool cmCTestResourceAllocator::DeallocateResource(const std::string& name,
}
bool cmCTestResourceAllocator::Resource::operator==(
- const Resource& other) const
+ Resource const& other) const
{
return this->Total == other.Total && this->Locked == other.Locked;
}
bool cmCTestResourceAllocator::Resource::operator!=(
- const Resource& other) const
+ Resource const& other) const
{
return !(*this == other);
}
diff --git a/Source/CTest/cmCTestResourceAllocator.h b/Source/CTest/cmCTestResourceAllocator.h
index 129e64e..fcb5ef6 100644
--- a/Source/CTest/cmCTestResourceAllocator.h
+++ b/Source/CTest/cmCTestResourceAllocator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
@@ -17,18 +17,18 @@ public:
unsigned int Free() const { return this->Total - this->Locked; }
- bool operator==(const Resource& other) const;
- bool operator!=(const Resource& other) const;
+ bool operator==(Resource const& other) const;
+ bool operator!=(Resource const& other) const;
};
- void InitializeFromResourceSpec(const cmCTestResourceSpec& spec);
+ void InitializeFromResourceSpec(cmCTestResourceSpec const& spec);
- const std::map<std::string, std::map<std::string, Resource>>& GetResources()
+ std::map<std::string, std::map<std::string, Resource>> const& GetResources()
const;
- bool AllocateResource(const std::string& name, const std::string& id,
+ bool AllocateResource(std::string const& name, std::string const& id,
unsigned int slots);
- bool DeallocateResource(const std::string& name, const std::string& id,
+ bool DeallocateResource(std::string const& name, std::string const& id,
unsigned int slots);
private:
diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx
index 4c26b3f..776c063 100644
--- a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx
+++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestResourceGroupsLexerHelper.h"
#include "cmCTestResourceGroupsLexer.h"
@@ -12,7 +12,7 @@ cmCTestResourceGroupsLexerHelper::cmCTestResourceGroupsLexerHelper(
{
}
-bool cmCTestResourceGroupsLexerHelper::ParseString(const std::string& value)
+bool cmCTestResourceGroupsLexerHelper::ParseString(std::string const& value)
{
yyscan_t lexer;
cmCTestResourceGroups_yylex_init_extra(this, &lexer);
@@ -30,7 +30,7 @@ void cmCTestResourceGroupsLexerHelper::SetProcessCount(unsigned int count)
this->ProcessCount = count;
}
-void cmCTestResourceGroupsLexerHelper::SetResourceType(const std::string& type)
+void cmCTestResourceGroupsLexerHelper::SetResourceType(std::string const& type)
{
this->ResourceType = type;
}
diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.h b/Source/CTest/cmCTestResourceGroupsLexerHelper.h
index ae4fa99..c957a51 100644
--- a/Source/CTest/cmCTestResourceGroupsLexerHelper.h
+++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -20,10 +20,10 @@ public:
output);
~cmCTestResourceGroupsLexerHelper() = default;
- bool ParseString(const std::string& value);
+ bool ParseString(std::string const& value);
void SetProcessCount(unsigned int count);
- void SetResourceType(const std::string& type);
+ void SetResourceType(std::string const& type);
void SetNeededSlots(int count);
void WriteRequirement();
void WriteProcess();
diff --git a/Source/CTest/cmCTestResourceSpec.cxx b/Source/CTest/cmCTestResourceSpec.cxx
index 0e81fa9..b6e4b40 100644
--- a/Source/CTest/cmCTestResourceSpec.cxx
+++ b/Source/CTest/cmCTestResourceSpec.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestResourceSpec.h"
#include <functional>
@@ -18,8 +18,8 @@
namespace {
using JSONHelperBuilder = cmJSONHelperBuilder;
-const cmsys::RegularExpression IdentifierRegex{ "^[a-z_][a-z0-9_]*$" };
-const cmsys::RegularExpression IdRegex{ "^[a-z0-9_]+$" };
+cmsys::RegularExpression const IdentifierRegex{ "^[a-z_][a-z0-9_]*$" };
+cmsys::RegularExpression const IdRegex{ "^[a-z0-9_]+$" };
struct Version
{
@@ -44,7 +44,7 @@ auto const VersionHelper = JSONHelperBuilder::Required<Version>(
auto const RootVersionHelper = JSONHelperBuilder::Object<TopVersion>().Bind(
"version"_s, &TopVersion::Version, VersionHelper, false);
-bool ResourceIdHelper(std::string& out, const Json::Value* value,
+bool ResourceIdHelper(std::string& out, Json::Value const* value,
cmJSONState* state)
{
if (!JSONHelperBuilder::String(cmCTestResourceSpecErrors::INVALID_RESOURCE)(
@@ -74,7 +74,7 @@ auto const ResourceListHelper =
auto const ResourceMapHelper =
JSONHelperBuilder::MapFilter<std::vector<cmCTestResourceSpec::Resource>>(
cmCTestResourceSpecErrors::INVALID_SOCKET_SPEC, ResourceListHelper,
- [](const std::string& key) -> bool {
+ [](std::string const& key) -> bool {
cmsys::RegularExpressionMatch match;
return IdentifierRegex.find(key.c_str(), match);
});
@@ -83,7 +83,7 @@ auto const SocketSetHelper = JSONHelperBuilder::Vector<
std::map<std::string, std::vector<cmCTestResourceSpec::Resource>>>(
cmCTestResourceSpecErrors::INVALID_SOCKET_SPEC, ResourceMapHelper);
-bool SocketHelper(cmCTestResourceSpec::Socket& out, const Json::Value* value,
+bool SocketHelper(cmCTestResourceSpec::Socket& out, Json::Value const* value,
cmJSONState* state)
{
std::vector<
@@ -112,7 +112,7 @@ auto const RootHelper = JSONHelperBuilder::Object<cmCTestResourceSpec>().Bind(
"local", &cmCTestResourceSpec::LocalSocket, LocalRequiredHelper, false);
}
-bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename)
+bool cmCTestResourceSpec::ReadFromJSONFile(std::string const& filename)
{
Json::Value root;
@@ -133,36 +133,36 @@ bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename)
return RootHelper(*this, &root, &parseState);
}
-bool cmCTestResourceSpec::operator==(const cmCTestResourceSpec& other) const
+bool cmCTestResourceSpec::operator==(cmCTestResourceSpec const& other) const
{
return this->LocalSocket == other.LocalSocket;
}
-bool cmCTestResourceSpec::operator!=(const cmCTestResourceSpec& other) const
+bool cmCTestResourceSpec::operator!=(cmCTestResourceSpec const& other) const
{
return !(*this == other);
}
bool cmCTestResourceSpec::Socket::operator==(
- const cmCTestResourceSpec::Socket& other) const
+ cmCTestResourceSpec::Socket const& other) const
{
return this->Resources == other.Resources;
}
bool cmCTestResourceSpec::Socket::operator!=(
- const cmCTestResourceSpec::Socket& other) const
+ cmCTestResourceSpec::Socket const& other) const
{
return !(*this == other);
}
bool cmCTestResourceSpec::Resource::operator==(
- const cmCTestResourceSpec::Resource& other) const
+ cmCTestResourceSpec::Resource const& other) const
{
return this->Id == other.Id && this->Capacity == other.Capacity;
}
bool cmCTestResourceSpec::Resource::operator!=(
- const cmCTestResourceSpec::Resource& other) const
+ cmCTestResourceSpec::Resource const& other) const
{
return !(*this == other);
}
diff --git a/Source/CTest/cmCTestResourceSpec.h b/Source/CTest/cmCTestResourceSpec.h
index 37ccd72..fb68021 100644
--- a/Source/CTest/cmCTestResourceSpec.h
+++ b/Source/CTest/cmCTestResourceSpec.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,8 +23,8 @@ public:
std::string Id;
unsigned int Capacity;
- bool operator==(const Resource& other) const;
- bool operator!=(const Resource& other) const;
+ bool operator==(Resource const& other) const;
+ bool operator!=(Resource const& other) const;
};
class Socket
@@ -32,49 +32,49 @@ public:
public:
std::map<std::string, std::vector<Resource>> Resources;
- bool operator==(const Socket& other) const;
- bool operator!=(const Socket& other) const;
+ bool operator==(Socket const& other) const;
+ bool operator!=(Socket const& other) const;
};
Socket LocalSocket;
cmJSONState parseState;
- bool ReadFromJSONFile(const std::string& filename);
+ bool ReadFromJSONFile(std::string const& filename);
- bool operator==(const cmCTestResourceSpec& other) const;
- bool operator!=(const cmCTestResourceSpec& other) const;
+ bool operator==(cmCTestResourceSpec const& other) const;
+ bool operator!=(cmCTestResourceSpec const& other) const;
};
namespace cmCTestResourceSpecErrors {
-const auto FILE_NOT_FOUND = [](const Json::Value*, cmJSONState* state) {
+auto const FILE_NOT_FOUND = [](Json::Value const*, cmJSONState* state) {
state->AddError("File not found");
};
-const auto JSON_PARSE_ERROR = [](const Json::Value* value,
+auto const JSON_PARSE_ERROR = [](Json::Value const* value,
cmJSONState* state) {
state->AddErrorAtValue("JSON parse error", value);
};
-const auto INVALID_ROOT = [](const Json::Value* value, cmJSONState* state) {
+auto const INVALID_ROOT = [](Json::Value const* value, cmJSONState* state) {
state->AddErrorAtValue("Invalid root object", value);
};
-const auto NO_VERSION = [](const Json::Value* value, cmJSONState* state) {
+auto const NO_VERSION = [](Json::Value const* value, cmJSONState* state) {
state->AddErrorAtValue("No version specified", value);
};
-const auto INVALID_VERSION = [](const Json::Value* value, cmJSONState* state) {
+auto const INVALID_VERSION = [](Json::Value const* value, cmJSONState* state) {
state->AddErrorAtValue("Invalid version object", value);
};
-const auto UNSUPPORTED_VERSION = [](const Json::Value* value,
+auto const UNSUPPORTED_VERSION = [](Json::Value const* value,
cmJSONState* state) {
state->AddErrorAtValue("Unsupported version", value);
};
-const auto INVALID_SOCKET_SPEC = [](const Json::Value* value,
+auto const INVALID_SOCKET_SPEC = [](Json::Value const* value,
cmJSONState* state) {
state->AddErrorAtValue("Invalid socket object", value);
};
-const auto INVALID_RESOURCE_TYPE = [](const Json::Value* value,
+auto const INVALID_RESOURCE_TYPE = [](Json::Value const* value,
cmJSONState* state) {
state->AddErrorAtValue("Invalid resource type object", value);
};
-const auto INVALID_RESOURCE = [](const Json::Value* value,
+auto const INVALID_RESOURCE = [](Json::Value const* value,
cmJSONState* state) {
state->AddErrorAtValue("Invalid resource object", value);
};
diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx
index 7661d4d..e415310 100644
--- a/Source/CTest/cmCTestRunScriptCommand.cxx
+++ b/Source/CTest/cmCTestRunScriptCommand.cxx
@@ -1,20 +1,21 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestRunScriptCommand.h"
#include "cmCTestScriptHandler.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-
-class cmExecutionStatus;
+#include "cmSystemTools.h"
bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& /*unused*/)
+ cmExecutionStatus& status) const
{
if (args.empty()) {
- this->CTestScriptHandler->RunCurrentScript();
- return true;
+ status.SetError("called with incorrect number of arguments");
+ return false;
}
+ cmMakefile& mf = status.GetMakefile();
bool np = false;
unsigned int i = 0;
if (args[i] == "NEW_PROCESS") {
@@ -37,9 +38,9 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
++i;
} else {
int ret;
- cmCTestScriptHandler::RunScript(this->CTest, this->Makefile, args[i],
- !np, &ret);
- this->Makefile->AddDefinition(returnVariable, std::to_string(ret));
+ cmCTestScriptHandler::RunScript(
+ this->CTest, &mf, cmSystemTools::CollapseFullPath(args[i]), !np, &ret);
+ mf.AddDefinition(returnVariable, std::to_string(ret));
}
}
return true;
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index 510b748..5b189e5 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -1,46 +1,28 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
-
#include "cmCTestCommand.h"
-#include "cmCommand.h"
class cmExecutionStatus;
/** \class cmCTestRunScript
* \brief Run a ctest script
- *
- * cmLibrarysCommand defines a list of executable (i.e., test)
- * programs to create.
*/
class cmCTestRunScriptCommand : public cmCTestCommand
{
public:
- cmCTestRunScriptCommand() {}
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto ni = cm::make_unique<cmCTestRunScriptCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
+ using cmCTestCommand::cmCTestCommand;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 483b3b4..21eaa19 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestRunTest.h"
#include <algorithm>
@@ -7,7 +7,6 @@
#include <cstddef> // IWYU pragma: keep
#include <cstdint>
#include <cstdio>
-#include <cstring>
#include <iomanip>
#include <ratio>
#include <sstream>
@@ -22,6 +21,7 @@
#include "cmCTestMemCheckHandler.h"
#include "cmCTestMultiProcessHandler.h"
#include "cmDuration.h"
+#include "cmInstrumentation.h"
#include "cmProcess.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -252,7 +252,7 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
// If the test did not pass, reprint test name and error
std::string output = this->GetTestPrefix(completed, total);
std::string testName = this->TestProperties->Name;
- const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
+ int const maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
testName.resize(maxTestNameWidth + 4, '.');
output += testName;
@@ -297,16 +297,16 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
if (!this->TestHandler->MemCheck && started) {
this->TestHandler->CleanTestOutput(
this->ProcessOutput,
- static_cast<size_t>(
- this->TestResult.Status == cmCTestTestHandler::COMPLETED
- ? this->TestHandler->CustomMaximumPassedTestOutputSize
- : this->TestHandler->CustomMaximumFailedTestOutputSize),
- this->TestHandler->TestOutputTruncation);
+ static_cast<size_t>(this->TestResult.Status ==
+ cmCTestTestHandler::COMPLETED
+ ? this->TestHandler->TestOptions.OutputSizePassed
+ : this->TestHandler->TestOptions.OutputSizeFailed),
+ this->TestHandler->TestOptions.OutputTruncation);
}
this->TestResult.Reason = reason;
if (this->TestHandler->LogFile) {
bool pass = true;
- const char* reasonType = "Test Pass Reason";
+ char const* reasonType = "Test Pass Reason";
if (this->TestResult.Status != cmCTestTestHandler::COMPLETED &&
this->TestResult.Status != cmCTestTestHandler::NOT_RUN) {
reasonType = "Test Fail Reason";
@@ -398,10 +398,7 @@ bool cmCTestRunTest::StartAgain(std::unique_ptr<cmCTestRunTest> runner,
// change to tests directory
cmWorkingDirectory workdir(testRun->TestProperties->Directory);
if (workdir.Failed()) {
- testRun->StartFailure(testRun->TotalNumberOfTests,
- "Failed to change working directory to " +
- testRun->TestProperties->Directory + " : " +
- std::strerror(workdir.GetLastResult()),
+ testRun->StartFailure(testRun->TotalNumberOfTests, workdir.GetError(),
"Failed to change working directory");
return true;
}
@@ -667,6 +664,9 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
return false;
}
this->StartTime = this->CTest->CurrentTime();
+ if (this->CTest->GetInstrumentation().HasQuery()) {
+ this->CTest->GetInstrumentation().GetPreTestStats();
+ }
return this->ForkProcess();
}
@@ -894,18 +894,17 @@ bool cmCTestRunTest::ForkProcess()
void cmCTestRunTest::SetupResourcesEnvironment(std::vector<std::string>* log)
{
- std::string processCount = "CTEST_RESOURCE_GROUP_COUNT=";
- processCount += std::to_string(this->AllocatedResources.size());
+ std::string processCount =
+ cmStrCat("CTEST_RESOURCE_GROUP_COUNT=", this->AllocatedResources.size());
cmSystemTools::PutEnv(processCount);
if (log) {
- log->push_back(processCount);
+ log->emplace_back(std::move(processCount));
}
std::size_t i = 0;
for (auto const& process : this->AllocatedResources) {
- std::string prefix = "CTEST_RESOURCE_GROUP_";
- prefix += std::to_string(i);
- std::string resourceList = prefix + '=';
+ std::string prefix = cmStrCat("CTEST_RESOURCE_GROUP_", i);
+ std::string resourceList = cmStrCat(prefix, '=');
prefix += '_';
bool firstType = true;
for (auto const& it : process) {
@@ -915,14 +914,15 @@ void cmCTestRunTest::SetupResourcesEnvironment(std::vector<std::string>* log)
firstType = false;
auto resourceType = it.first;
resourceList += resourceType;
- std::string var = prefix + cmSystemTools::UpperCase(resourceType) + '=';
+ std::string var =
+ cmStrCat(prefix, cmSystemTools::UpperCase(resourceType), '=');
bool firstName = true;
for (auto const& it2 : it.second) {
if (!firstName) {
var += ';';
}
firstName = false;
- var += "id:" + it2.Id + ",slots:" + std::to_string(it2.Slots);
+ var += cmStrCat("id:", it2.Id, ",slots:", it2.Slots);
}
cmSystemTools::PutEnv(var);
if (log) {
@@ -975,7 +975,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
<< indexStr.str();
outputStream << " ";
- const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
+ int const maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
std::string outname = this->TestProperties->Name + " ";
outname.resize(maxTestNameWidth + 4, '.');
outputStream << outname;
@@ -1016,6 +1016,14 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
void cmCTestRunTest::FinalizeTest(bool started)
{
+ if (this->CTest->GetInstrumentation().HasQuery()) {
+ std::string data_file = this->CTest->GetInstrumentation().InstrumentTest(
+ this->TestProperties->Name, this->ActualCommand, this->Arguments,
+ this->TestProcess->GetExitValue(), this->TestProcess->GetStartTime(),
+ this->TestProcess->GetSystemStartTime(),
+ this->GetCTest()->GetConfigType());
+ this->TestResult.InstrumentationFile = data_file;
+ }
this->MultiTestHandler.FinishTestProcess(this->TestProcess->GetRunner(),
started);
}
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 71d0865..3905dab 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,7 +41,7 @@ public:
int GetIndex() { return this->Index; }
- void AddFailedDependency(const std::string& failedTest)
+ void AddFailedDependency(std::string const& failedTest)
{
this->FailedDependencies.insert(failedTest);
}
@@ -87,7 +87,7 @@ public:
std::string& GetActualCommand() { return this->ActualCommand; }
- const std::vector<std::string>& GetArguments() { return this->Arguments; }
+ std::vector<std::string> const& GetArguments() { return this->Arguments; }
void FinalizeTest(bool started = true);
@@ -96,9 +96,9 @@ public:
this->UseAllocatedResources = use;
}
void SetAllocatedResources(
- const std::vector<
- std::map<std::string,
- std::vector<cmCTestMultiProcessHandler::ResourceAllocation>>>&
+ std::vector<std::map<
+ std::string,
+ std::vector<cmCTestMultiProcessHandler::ResourceAllocation>>> const&
resources)
{
this->AllocatedResources = resources;
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index fc7051c..3589c6b 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestSVN.h"
#include <cstdlib>
@@ -13,6 +13,7 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
+#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
@@ -23,8 +24,8 @@ struct cmCTestSVN::Revision : public cmCTestVC::Revision
cmCTestSVN::SVNInfo* SVNInfo;
};
-cmCTestSVN::cmCTestSVN(cmCTest* ct, std::ostream& log)
- : cmCTestGlobalVC(ct, log)
+cmCTestSVN::cmCTestSVN(cmCTest* ct, cmMakefile* mf, std::ostream& log)
+ : cmCTestGlobalVC(ct, mf, log)
{
this->PriorRev = this->Unknown;
}
@@ -43,7 +44,7 @@ void cmCTestSVN::CleanupImpl()
class cmCTestSVN::InfoParser : public cmCTestVC::LineParser
{
public:
- InfoParser(cmCTestSVN* svn, const char* prefix, std::string& rev,
+ InfoParser(cmCTestSVN* svn, char const* prefix, std::string& rev,
SVNInfo& svninfo)
: Rev(rev)
, SVNRepo(svninfo)
@@ -190,7 +191,7 @@ void cmCTestSVN::GuessBase(SVNInfo& svninfo,
class cmCTestSVN::UpdateParser : public cmCTestVC::LineParser
{
public:
- UpdateParser(cmCTestSVN* svn, const char* prefix)
+ UpdateParser(cmCTestSVN* svn, char const* prefix)
: SVN(svn)
{
this->SetLog(&svn->Log, prefix);
@@ -240,9 +241,9 @@ private:
bool cmCTestSVN::UpdateImpl()
{
// Get user-specified update options.
- std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
+ std::string opts = this->Makefile->GetSafeDefinition("CTEST_UPDATE_OPTIONS");
if (opts.empty()) {
- opts = this->CTest->GetCTestConfiguration("SVNUpdateOptions");
+ opts = this->Makefile->GetSafeDefinition("CTEST_SVN_UPDATE_OPTIONS");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
@@ -272,7 +273,8 @@ bool cmCTestSVN::RunSVNCommand(std::vector<std::string> const& parameters,
cm::append(args, parameters);
args.emplace_back("--non-interactive");
- std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions");
+ std::string userOptions =
+ this->Makefile->GetSafeDefinition("CTEST_SVN_OPTIONS");
std::vector<std::string> parsedUserOptions =
cmSystemTools::ParseArguments(userOptions);
@@ -289,7 +291,7 @@ class cmCTestSVN::LogParser
, private cmXMLParser
{
public:
- LogParser(cmCTestSVN* svn, const char* prefix, SVNInfo& svninfo)
+ LogParser(cmCTestSVN* svn, char const* prefix, SVNInfo& svninfo)
: OutputLogger(svn->Log, prefix)
, SVN(svn)
, SVNRepo(svninfo)
@@ -309,39 +311,39 @@ private:
Change CurChange;
std::vector<char> CData;
- bool ProcessChunk(const char* data, int length) override
+ bool ProcessChunk(char const* data, int length) override
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
- void StartElement(const std::string& name, const char** atts) override
+ void StartElement(std::string const& name, char const** atts) override
{
this->CData.clear();
if (name == "logentry") {
this->Rev = Revision();
this->Rev.SVNInfo = &this->SVNRepo;
- if (const char* rev =
+ if (char const* rev =
cmCTestSVN::LogParser::FindAttribute(atts, "revision")) {
this->Rev.Rev = rev;
}
this->Changes.clear();
} else if (name == "path") {
this->CurChange = Change();
- if (const char* action =
+ if (char const* action =
cmCTestSVN::LogParser::FindAttribute(atts, "action")) {
this->CurChange.Action = action[0];
}
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
cm::append(this->CData, data, data + length);
}
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "logentry") {
this->SVN->DoRevisionSVN(this->Rev, this->Changes);
@@ -360,7 +362,7 @@ private:
this->CData.clear();
}
- void ReportError(int /*line*/, int /*column*/, const char* msg) override
+ void ReportError(int /*line*/, int /*column*/, char const* msg) override
{
this->SVN->Log << "Error parsing svn log xml: " << msg << "\n";
}
@@ -418,7 +420,7 @@ void cmCTestSVN::DoRevisionSVN(Revision const& revision,
class cmCTestSVN::StatusParser : public cmCTestVC::LineParser
{
public:
- StatusParser(cmCTestSVN* svn, const char* prefix)
+ StatusParser(cmCTestSVN* svn, char const* prefix)
: SVN(svn)
{
this->SetLog(&svn->Log, prefix);
@@ -484,7 +486,7 @@ void cmCTestSVN::WriteXMLGlobal(cmXMLWriter& xml)
class cmCTestSVN::ExternalParser : public cmCTestVC::LineParser
{
public:
- ExternalParser(cmCTestSVN* svn, const char* prefix)
+ ExternalParser(cmCTestSVN* svn, char const* prefix)
: SVN(svn)
{
this->SetLog(&svn->Log, prefix);
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index 1485dc0..9b4ea6a 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,6 +12,7 @@
#include "cmCTestGlobalVC.h"
class cmCTest;
+class cmMakefile;
class cmXMLWriter;
/** \class cmCTestSVN
@@ -22,7 +23,7 @@ class cmCTestSVN : public cmCTestGlobalVC
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestSVN(cmCTest* ctest, std::ostream& log);
+ cmCTestSVN(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
~cmCTestSVN() override;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index ed567d4..48f0935 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -1,8 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestScriptHandler.h"
-#include <cstdio>
+#include <chrono>
#include <cstdlib>
#include <map>
#include <ratio>
@@ -13,11 +13,8 @@
#include <cm3p/uv.h>
-#include "cmsys/Directory.hxx"
-
#include "cmCTest.h"
#include "cmCTestBuildCommand.h"
-#include "cmCTestCommand.h"
#include "cmCTestConfigureCommand.h"
#include "cmCTestCoverageCommand.h"
#include "cmCTestEmptyBinaryDirectoryCommand.h"
@@ -30,69 +27,26 @@
#include "cmCTestTestCommand.h"
#include "cmCTestUpdateCommand.h"
#include "cmCTestUploadCommand.h"
-#include "cmCommand.h"
#include "cmDuration.h"
-#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
-#include "cmList.h"
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
-#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUVHandlePtr.h"
#include "cmUVProcessChain.h"
-#include "cmValue.h"
#include "cmake.h"
-#ifdef _WIN32
-# include <windows.h>
-#else
-# include <unistd.h>
-#endif
-
-cmCTestScriptHandler::cmCTestScriptHandler() = default;
-
-void cmCTestScriptHandler::Initialize()
+cmCTestScriptHandler::cmCTestScriptHandler(cmCTest* ctest)
+ : CTest(ctest)
{
- this->Superclass::Initialize();
- this->Backup = false;
- this->EmptyBinDir = false;
- this->EmptyBinDirOnce = false;
-
- this->SourceDir.clear();
- this->BinaryDir.clear();
- this->BackupSourceDir.clear();
- this->BackupBinaryDir.clear();
- this->CTestRoot.clear();
- this->CVSCheckOut.clear();
- this->CTestCmd.clear();
- this->UpdateCmd.clear();
- this->CTestEnv.clear();
- this->InitialCache.clear();
- this->CMakeCmd.clear();
- this->CMOutFile.clear();
- this->ExtraUpdates.clear();
-
- this->MinimumInterval = 20 * 60;
- this->ContinuousDuration = -1;
-
- // what time in seconds did this script start running
- this->ScriptStartTime = std::chrono::steady_clock::time_point();
-
- this->Makefile.reset();
- this->ParentMakefile = nullptr;
-
- this->GlobalGenerator.reset();
-
- this->CMake.reset();
}
cmCTestScriptHandler::~cmCTestScriptHandler() = default;
// just adds an argument to the vector
-void cmCTestScriptHandler::AddConfigurationScript(const std::string& script,
+void cmCTestScriptHandler::AddConfigurationScript(std::string const& script,
bool pscope)
{
this->ConfigurationScripts.emplace_back(script);
@@ -106,9 +60,8 @@ int cmCTestScriptHandler::ProcessHandler()
int res = 0;
for (size_t i = 0; i < this->ConfigurationScripts.size(); ++i) {
// for each script run it
- res |= this->RunConfigurationScript(
- cmSystemTools::CollapseFullPath(this->ConfigurationScripts[i]),
- this->ScriptProcessScope[i]);
+ res |= this->RunConfigurationScript(this->ConfigurationScripts[i],
+ this->ScriptProcessScope[i]);
}
if (res) {
return -1;
@@ -120,22 +73,13 @@ void cmCTestScriptHandler::UpdateElapsedTime()
{
if (this->Makefile) {
// set the current elapsed time
- auto itime = cmDurationTo<unsigned int>(std::chrono::steady_clock::now() -
- this->ScriptStartTime);
+ auto itime = cmDurationTo<unsigned int>(this->CTest->GetElapsedTime());
auto timeString = std::to_string(itime);
this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString);
}
}
-void cmCTestScriptHandler::AddCTestCommand(
- std::string const& name, std::unique_ptr<cmCTestCommand> command)
-{
- command->CTest = this->CTest;
- command->CTestScriptHandler = this;
- this->CMake->GetState()->AddBuiltinCommand(name, std::move(command));
-}
-
-int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
+int cmCTestScriptHandler::ExecuteScript(std::string const& total_script_arg)
{
// execute the script passing in the arguments to the script as well as the
// arguments from this invocation of cmake
@@ -153,7 +97,12 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
this->CTest->GetInitialCommandLineArguments();
//*** need to make sure this does not have the current script ***
for (size_t i = 1; i < initArgs.size(); ++i) {
- argv.push_back(initArgs[i]);
+ // in a nested subprocess, skip the parent's `-SR <path>` arguments.
+ if (initArgs[i] == "-SR") {
+ i++; // <path>
+ } else {
+ argv.push_back(initArgs[i]);
+ }
}
// Now create process object
@@ -235,7 +184,7 @@ void cmCTestScriptHandler::CreateCMake()
cm::make_unique<cmGlobalGenerator>(this->CMake.get());
cmStateSnapshot snapshot = this->CMake->GetCurrentSnapshot();
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmSystemTools::GetLogicalWorkingDirectory();
snapshot.GetDirectory().SetCurrentSource(cwd);
snapshot.GetDirectory().SetCurrentBinary(cwd);
this->Makefile =
@@ -246,39 +195,37 @@ void cmCTestScriptHandler::CreateCMake()
}
this->CMake->SetProgressCallback(
- [this](const std::string& m, float /*unused*/) {
+ [this](std::string const& m, float /*unused*/) {
if (!m.empty()) {
cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl);
}
});
- this->AddCTestCommand("ctest_build", cm::make_unique<cmCTestBuildCommand>());
- this->AddCTestCommand("ctest_configure",
- cm::make_unique<cmCTestConfigureCommand>());
- this->AddCTestCommand("ctest_coverage",
- cm::make_unique<cmCTestCoverageCommand>());
- this->AddCTestCommand("ctest_empty_binary_directory",
- cm::make_unique<cmCTestEmptyBinaryDirectoryCommand>());
- this->AddCTestCommand("ctest_memcheck",
- cm::make_unique<cmCTestMemCheckCommand>());
- this->AddCTestCommand("ctest_read_custom_files",
- cm::make_unique<cmCTestReadCustomFilesCommand>());
- this->AddCTestCommand("ctest_run_script",
- cm::make_unique<cmCTestRunScriptCommand>());
- this->AddCTestCommand("ctest_sleep", cm::make_unique<cmCTestSleepCommand>());
- this->AddCTestCommand("ctest_start", cm::make_unique<cmCTestStartCommand>());
- this->AddCTestCommand("ctest_submit",
- cm::make_unique<cmCTestSubmitCommand>());
- this->AddCTestCommand("ctest_test", cm::make_unique<cmCTestTestCommand>());
- this->AddCTestCommand("ctest_update",
- cm::make_unique<cmCTestUpdateCommand>());
- this->AddCTestCommand("ctest_upload",
- cm::make_unique<cmCTestUploadCommand>());
+ cmState* state = this->CMake->GetState();
+ state->AddBuiltinCommand("ctest_build", cmCTestBuildCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_configure",
+ cmCTestConfigureCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_coverage",
+ cmCTestCoverageCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_empty_binary_directory",
+ cmCTestEmptyBinaryDirectoryCommand);
+ state->AddBuiltinCommand("ctest_memcheck",
+ cmCTestMemCheckCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_read_custom_files",
+ cmCTestReadCustomFilesCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_run_script",
+ cmCTestRunScriptCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_sleep", cmCTestSleepCommand);
+ state->AddBuiltinCommand("ctest_start", cmCTestStartCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_submit", cmCTestSubmitCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_test", cmCTestTestCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_update", cmCTestUpdateCommand(this->CTest));
+ state->AddBuiltinCommand("ctest_upload", cmCTestUploadCommand(this->CTest));
}
// this sets up some variables for the script to use, creates the required
// cmake instance and generators, and then reads in the script
-int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
+int cmCTestScriptHandler::ReadInScript(std::string const& total_script_arg)
{
// Reset the error flag so that the script is read in no matter what
cmSystemTools::ResetErrorOccurredFlag();
@@ -288,7 +235,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
// passed into the scripts as S_ARG
std::string script;
std::string script_arg;
- const std::string::size_type comma_pos = total_script_arg.find(',');
+ std::string::size_type const comma_pos = total_script_arg.find(',');
if (comma_pos != std::string::npos) {
script = total_script_arg.substr(0, comma_pos);
script_arg = total_script_arg.substr(comma_pos + 1);
@@ -314,8 +261,6 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
cmSystemTools::GetCTestCommand());
this->Makefile->AddDefinition("CMAKE_EXECUTABLE_NAME",
cmSystemTools::GetCMakeCommand());
- this->Makefile->AddDefinitionBool("CTEST_RUN_CURRENT_SCRIPT", true);
- this->SetRunCurrentScript(true);
this->UpdateElapsedTime();
// set the CTEST_CONFIGURATION_TYPE variable to the current value of the
@@ -348,7 +293,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
}
// Add definitions of variables passed in on the command line:
- const std::map<std::string, std::string>& defs =
+ std::map<std::string, std::string> const& defs =
this->CTest->GetDefinitions();
for (auto const& d : defs) {
this->Makefile->AddDefinition(d.first, d.second);
@@ -366,116 +311,9 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
return 0;
}
-// extract variables from the script to set ivars
-int cmCTestScriptHandler::ExtractVariables()
-{
- // Temporary variables
- cmValue minInterval;
- cmValue contDuration;
-
- this->SourceDir =
- this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
- this->BinaryDir =
- this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
-
- // add in translations for src and bin
- cmSystemTools::AddKeepPath(this->SourceDir);
- cmSystemTools::AddKeepPath(this->BinaryDir);
-
- this->CTestCmd = this->Makefile->GetSafeDefinition("CTEST_COMMAND");
- this->CVSCheckOut = this->Makefile->GetSafeDefinition("CTEST_CVS_CHECKOUT");
- this->CTestRoot = this->Makefile->GetSafeDefinition("CTEST_DASHBOARD_ROOT");
- this->UpdateCmd = this->Makefile->GetSafeDefinition("CTEST_UPDATE_COMMAND");
- if (this->UpdateCmd.empty()) {
- this->UpdateCmd = this->Makefile->GetSafeDefinition("CTEST_CVS_COMMAND");
- }
- this->CTestEnv = this->Makefile->GetSafeDefinition("CTEST_ENVIRONMENT");
- this->InitialCache =
- this->Makefile->GetSafeDefinition("CTEST_INITIAL_CACHE");
- this->CMakeCmd = this->Makefile->GetSafeDefinition("CTEST_CMAKE_COMMAND");
- this->CMOutFile =
- this->Makefile->GetSafeDefinition("CTEST_CMAKE_OUTPUT_FILE_NAME");
-
- this->Backup = this->Makefile->IsOn("CTEST_BACKUP_AND_RESTORE");
- this->EmptyBinDir =
- this->Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY");
- this->EmptyBinDirOnce =
- this->Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE");
-
- minInterval =
- this->Makefile->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL");
- contDuration = this->Makefile->GetDefinition("CTEST_CONTINUOUS_DURATION");
-
- char updateVar[40];
- int i;
- for (i = 1; i < 10; ++i) {
- snprintf(updateVar, sizeof(updateVar), "CTEST_EXTRA_UPDATES_%i", i);
- cmValue updateVal = this->Makefile->GetDefinition(updateVar);
- if (updateVal) {
- if (this->UpdateCmd.empty()) {
- cmSystemTools::Error(
- std::string(updateVar) +
- " specified without specifying CTEST_CVS_COMMAND.");
- return 12;
- }
- this->ExtraUpdates.emplace_back(*updateVal);
- }
- }
-
- // in order to backup and restore we also must have the cvs root
- if (this->Backup && this->CVSCheckOut.empty()) {
- cmSystemTools::Error(
- "Backup was requested without specifying CTEST_CVS_CHECKOUT.");
- return 3;
- }
-
- // make sure the required info is here
- if (this->SourceDir.empty() || this->BinaryDir.empty() ||
- this->CTestCmd.empty()) {
- std::string msg =
- cmStrCat("CTEST_SOURCE_DIRECTORY = ",
- (!this->SourceDir.empty()) ? this->SourceDir.c_str() : "(Null)",
- "\nCTEST_BINARY_DIRECTORY = ",
- (!this->BinaryDir.empty()) ? this->BinaryDir.c_str() : "(Null)",
- "\nCTEST_COMMAND = ",
- (!this->CTestCmd.empty()) ? this->CTestCmd.c_str() : "(Null)");
- cmSystemTools::Error(
- "Some required settings in the configuration file were missing:\n" +
- msg);
- return 4;
- }
-
- // if the dashboard root isn't specified then we can compute it from the
- // this->SourceDir
- if (this->CTestRoot.empty()) {
- this->CTestRoot = cmSystemTools::GetFilenamePath(this->SourceDir);
- }
-
- // the script may override the minimum continuous interval
- if (minInterval) {
- this->MinimumInterval = 60 * atof(minInterval->c_str());
- }
- if (contDuration) {
- this->ContinuousDuration = 60.0 * atof(contDuration->c_str());
- }
-
- this->UpdateElapsedTime();
-
- return 0;
-}
-
-void cmCTestScriptHandler::SleepInSeconds(unsigned int secondsToWait)
-{
-#if defined(_WIN32)
- Sleep(1000 * secondsToWait);
-#else
- sleep(secondsToWait);
-#endif
-}
-
// run a specific script
int cmCTestScriptHandler::RunConfigurationScript(
- const std::string& total_script_arg, bool pscope)
+ std::string const& total_script_arg, bool pscope)
{
#ifndef CMAKE_BOOTSTRAP
cmSystemTools::SaveRestoreEnvironment sre;
@@ -483,8 +321,6 @@ int cmCTestScriptHandler::RunConfigurationScript(
int result;
- this->ScriptStartTime = std::chrono::steady_clock::now();
-
// read in the script
if (pscope) {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
@@ -495,361 +331,15 @@ int cmCTestScriptHandler::RunConfigurationScript(
"Executing Script: " << total_script_arg << std::endl);
result = this->ExecuteScript(total_script_arg);
}
- if (result) {
- return result;
- }
- // only run the current script if we should
- if (this->Makefile && this->Makefile->IsOn("CTEST_RUN_CURRENT_SCRIPT") &&
- this->ShouldRunCurrentScript) {
- return this->RunCurrentScript();
- }
return result;
}
-int cmCTestScriptHandler::RunCurrentScript()
-{
- int result;
-
- // do not run twice
- this->SetRunCurrentScript(false);
-
- // no popup widows
- cmSystemTools::SetRunCommandHideConsole(true);
-
- // extract the vars from the cache and store in ivars
- result = this->ExtractVariables();
- if (result) {
- return result;
- }
-
- // set any environment variables
- if (!this->CTestEnv.empty()) {
- cmList envArgs{ this->CTestEnv };
- cmSystemTools::AppendEnv(envArgs);
- }
-
- // now that we have done most of the error checking finally run the
- // dashboard, we may be asked to repeatedly run this dashboard, such as
- // for a continuous, do we need to run it more than once?
- if (this->ContinuousDuration >= 0) {
- this->UpdateElapsedTime();
- auto ending_time =
- std::chrono::steady_clock::now() + cmDuration(this->ContinuousDuration);
- if (this->EmptyBinDirOnce) {
- this->EmptyBinDir = true;
- }
- do {
- auto startOfInterval = std::chrono::steady_clock::now();
- result = this->RunConfigurationDashboard();
- auto interval = std::chrono::steady_clock::now() - startOfInterval;
- auto minimumInterval = cmDuration(this->MinimumInterval);
- if (interval < minimumInterval) {
- auto sleepTime =
- cmDurationTo<unsigned int>(minimumInterval - interval);
- this->SleepInSeconds(sleepTime);
- }
- if (this->EmptyBinDirOnce) {
- this->EmptyBinDir = false;
- }
- } while (std::chrono::steady_clock::now() < ending_time);
- }
- // otherwise just run it once
- else {
- result = this->RunConfigurationDashboard();
- }
-
- return result;
-}
-
-int cmCTestScriptHandler::CheckOutSourceDir()
-{
- std::string output;
- int retVal;
-
- if (!cmSystemTools::FileExists(this->SourceDir) &&
- !this->CVSCheckOut.empty()) {
- // we must now checkout the src dir
- output.clear();
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Run cvs: " << this->CVSCheckOut << std::endl);
- bool res = cmSystemTools::RunSingleCommand(
- this->CVSCheckOut, &output, &output, &retVal, this->CTestRoot.c_str(),
- this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
- if (!res || retVal != 0) {
- cmSystemTools::Error("Unable to perform cvs checkout:\n" + output);
- return 6;
- }
- }
- return 0;
-}
-
-int cmCTestScriptHandler::BackupDirectories()
-{
- // compute the backup names
- this->BackupSourceDir = cmStrCat(this->SourceDir, "_CMakeBackup");
- this->BackupBinaryDir = cmStrCat(this->BinaryDir, "_CMakeBackup");
-
- // backup the binary and src directories if requested
- if (this->Backup) {
- // if for some reason those directories exist then first delete them
- if (cmSystemTools::FileExists(this->BackupSourceDir)) {
- cmSystemTools::RemoveADirectory(this->BackupSourceDir);
- }
- if (cmSystemTools::FileExists(this->BackupBinaryDir)) {
- cmSystemTools::RemoveADirectory(this->BackupBinaryDir);
- }
-
- // first rename the src and binary directories
- rename(this->SourceDir.c_str(), this->BackupSourceDir.c_str());
- rename(this->BinaryDir.c_str(), this->BackupBinaryDir.c_str());
-
- // we must now checkout the src dir
- int retVal = this->CheckOutSourceDir();
- if (retVal) {
- this->RestoreBackupDirectories();
- return retVal;
- }
- }
-
- return 0;
-}
-
-int cmCTestScriptHandler::PerformExtraUpdates()
-{
- std::string command;
- std::string output;
- int retVal;
- bool res;
-
- // do an initial cvs update as required
- command = this->UpdateCmd;
- for (std::string const& eu : this->ExtraUpdates) {
- cmList cvsArgs{ eu };
- if (cvsArgs.size() == 2) {
- std::string fullCommand = cmStrCat(command, " update ", cvsArgs[1]);
- output.clear();
- retVal = 0;
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Run Update: " << fullCommand << std::endl);
- res = cmSystemTools::RunSingleCommand(
- fullCommand, &output, &output, &retVal, cvsArgs[0].c_str(),
- this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
- if (!res || retVal != 0) {
- cmSystemTools::Error(cmStrCat("Unable to perform extra updates:\n", eu,
- "\nWith output:\n", output));
- return 0;
- }
- }
- }
- return 0;
-}
-
-// run a single dashboard entry
-int cmCTestScriptHandler::RunConfigurationDashboard()
-{
- // local variables
- std::string command;
- std::string output;
- int retVal;
- bool res;
-
- // make sure the src directory is there, if it isn't then we might be able
- // to check it out from cvs
- retVal = this->CheckOutSourceDir();
- if (retVal) {
- return retVal;
- }
-
- // backup the dirs if requested
- retVal = this->BackupDirectories();
- if (retVal) {
- return retVal;
- }
-
- // clear the binary directory?
- if (this->EmptyBinDir) {
- std::string err;
- if (!cmCTestScriptHandler::EmptyBinaryDirectory(this->BinaryDir, err)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Problem removing the binary directory ("
- << err << "): " << this->BinaryDir << std::endl);
- }
- }
-
- // make sure the binary directory exists if it isn't the srcdir
- if (!cmSystemTools::FileExists(this->BinaryDir) &&
- this->SourceDir != this->BinaryDir) {
- if (!cmSystemTools::MakeDirectory(this->BinaryDir)) {
- cmSystemTools::Error("Unable to create the binary directory:\n" +
- this->BinaryDir);
- this->RestoreBackupDirectories();
- return 7;
- }
- }
-
- // if the binary directory and the source directory are the same,
- // and we are starting with an empty binary directory, then that means
- // we must check out the source tree
- if (this->EmptyBinDir && this->SourceDir == this->BinaryDir) {
- // make sure we have the required info
- if (this->CVSCheckOut.empty()) {
- cmSystemTools::Error(
- "You have specified the source and binary "
- "directories to be the same (an in source build). You have also "
- "specified that the binary directory is to be erased. This means "
- "that the source will have to be checked out from CVS. But you have "
- "not specified CTEST_CVS_CHECKOUT");
- return 8;
- }
-
- // we must now checkout the src dir
- retVal = this->CheckOutSourceDir();
- if (retVal) {
- this->RestoreBackupDirectories();
- return retVal;
- }
- }
-
- // backup the dirs if requested
- retVal = this->PerformExtraUpdates();
- if (retVal) {
- return retVal;
- }
-
- // put the initial cache into the bin dir
- if (!this->InitialCache.empty()) {
- if (!cmCTestScriptHandler::WriteInitialCache(this->BinaryDir,
- this->InitialCache)) {
- this->RestoreBackupDirectories();
- return 9;
- }
- }
-
- // do an initial cmake to setup the DartConfig file
- int cmakeFailed = 0;
- std::string cmakeFailedOuput;
- if (!this->CMakeCmd.empty()) {
- command = cmStrCat(this->CMakeCmd, " \"", this->SourceDir);
- output.clear();
- command += "\"";
- retVal = 0;
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Run cmake command: " << command << std::endl);
- res = cmSystemTools::RunSingleCommand(
- command, &output, &output, &retVal, this->BinaryDir.c_str(),
- this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
-
- if (!this->CMOutFile.empty()) {
- std::string cmakeOutputFile = this->CMOutFile;
- if (!cmSystemTools::FileIsFullPath(cmakeOutputFile)) {
- cmakeOutputFile = this->BinaryDir + "/" + cmakeOutputFile;
- }
-
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Write CMake output to file: " << cmakeOutputFile
- << std::endl);
- cmGeneratedFileStream fout(cmakeOutputFile);
- if (fout) {
- fout << output.c_str();
- } else {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot open CMake output file: "
- << cmakeOutputFile << " for writing" << std::endl);
- }
- }
- if (!res || retVal != 0) {
- // even if this fails continue to the next step
- cmakeFailed = 1;
- cmakeFailedOuput = output;
- }
- }
-
- // run ctest, it may be more than one command in here
- cmList ctestCommands{ this->CTestCmd };
- // for each variable/argument do a putenv
- for (std::string const& ctestCommand : ctestCommands) {
- command = ctestCommand;
- output.clear();
- retVal = 0;
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Run ctest command: " << command << std::endl);
- res = cmSystemTools::RunSingleCommand(
- command, &output, &output, &retVal, this->BinaryDir.c_str(),
- this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
-
- // did something critical fail in ctest
- if (!res || cmakeFailed || retVal & cmCTest::BUILD_ERRORS) {
- this->RestoreBackupDirectories();
- if (cmakeFailed) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Unable to run cmake:" << std::endl
- << cmakeFailedOuput << std::endl);
- return 10;
- }
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Unable to run ctest:" << std::endl
- << "command: " << command << std::endl
- << "output: " << output << std::endl);
- if (!res) {
- return 11;
- }
- return retVal * 100;
- }
- }
-
- // if all was successful, delete the backup dirs to free up disk space
- if (this->Backup) {
- cmSystemTools::RemoveADirectory(this->BackupSourceDir);
- cmSystemTools::RemoveADirectory(this->BackupBinaryDir);
- }
-
- return 0;
-}
-
-bool cmCTestScriptHandler::WriteInitialCache(const std::string& directory,
- const std::string& text)
-{
- std::string cacheFile = cmStrCat(directory, "/CMakeCache.txt");
- cmGeneratedFileStream fout(cacheFile);
- if (!fout) {
- return false;
- }
-
- fout.write(text.data(), text.size());
-
- // Make sure the operating system has finished writing the file
- // before closing it. This will ensure the file is finished before
- // the check below.
- fout.flush();
- fout.close();
- return true;
-}
-
-void cmCTestScriptHandler::RestoreBackupDirectories()
-{
- // if we backed up the dirs and the build failed, then restore
- // the backed up dirs
- if (this->Backup) {
- // if for some reason those directories exist then first delete them
- if (cmSystemTools::FileExists(this->SourceDir)) {
- cmSystemTools::RemoveADirectory(this->SourceDir);
- }
- if (cmSystemTools::FileExists(this->BinaryDir)) {
- cmSystemTools::RemoveADirectory(this->BinaryDir);
- }
- // rename the src and binary directories
- rename(this->BackupSourceDir.c_str(), this->SourceDir.c_str());
- rename(this->BackupBinaryDir.c_str(), this->BinaryDir.c_str());
- }
-}
-
bool cmCTestScriptHandler::RunScript(cmCTest* ctest, cmMakefile* mf,
- const std::string& sname, bool InProcess,
+ std::string const& sname, bool InProcess,
int* returnValue)
{
- auto sh = cm::make_unique<cmCTestScriptHandler>();
- sh->SetCTestInstance(ctest);
+ auto sh = cm::make_unique<cmCTestScriptHandler>(ctest);
sh->ParentMakefile = mf;
sh->AddConfigurationScript(sname, InProcess);
int res = sh->ProcessHandler();
@@ -858,94 +348,3 @@ bool cmCTestScriptHandler::RunScript(cmCTest* ctest, cmMakefile* mf,
}
return true;
}
-
-bool cmCTestScriptHandler::EmptyBinaryDirectory(const std::string& sname,
- std::string& err)
-{
- // try to avoid deleting root
- if (sname.size() < 2) {
- err = "path too short";
- return false;
- }
-
- // consider non existing target directory a success
- if (!cmSystemTools::FileExists(sname)) {
- return true;
- }
-
- // try to avoid deleting directories that we shouldn't
- std::string check = cmStrCat(sname, "/CMakeCache.txt");
-
- if (!cmSystemTools::FileExists(check)) {
- err = "path does not contain an existing CMakeCache.txt file";
- return false;
- }
-
- cmsys::Status status;
- for (int i = 0; i < 5; ++i) {
- status = TryToRemoveBinaryDirectoryOnce(sname);
- if (status) {
- return true;
- }
- cmSystemTools::Delay(100);
- }
-
- err = status.GetString();
- return false;
-}
-
-cmsys::Status cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
- const std::string& directoryPath)
-{
- cmsys::Directory directory;
- directory.Load(directoryPath);
-
- for (unsigned long i = 0; i < directory.GetNumberOfFiles(); ++i) {
- std::string path = directory.GetFile(i);
-
- if (path == "." || path == ".." || path == "CMakeCache.txt") {
- continue;
- }
-
- std::string fullPath = cmStrCat(directoryPath, "/", path);
-
- bool isDirectory = cmSystemTools::FileIsDirectory(fullPath) &&
- !cmSystemTools::FileIsSymlink(fullPath);
-
- cmsys::Status status;
- if (isDirectory) {
- status = cmSystemTools::RemoveADirectory(fullPath);
- } else {
- status = cmSystemTools::RemoveFile(fullPath);
- }
- if (!status) {
- return status;
- }
- }
-
- return cmSystemTools::RemoveADirectory(directoryPath);
-}
-
-cmDuration cmCTestScriptHandler::GetRemainingTimeAllowed()
-{
- if (!this->Makefile) {
- return cmCTest::MaxDuration();
- }
-
- cmValue timelimitS = this->Makefile->GetDefinition("CTEST_TIME_LIMIT");
-
- if (!timelimitS) {
- return cmCTest::MaxDuration();
- }
-
- auto timelimit = cmDuration(atof(timelimitS->c_str()));
-
- auto duration = std::chrono::duration_cast<cmDuration>(
- std::chrono::steady_clock::now() - this->ScriptStartTime);
- return (timelimit - duration);
-}
-
-void cmCTestScriptHandler::SetRunCurrentScript(bool value)
-{
- this->ShouldRunCurrentScript = value;
-}
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 7747750..4004e68 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -1,180 +1,66 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
-#include <chrono>
#include <memory>
#include <string>
#include <vector>
-#include "cmsys/Status.hxx"
-
-#include "cmCTestGenericHandler.h"
-#include "cmDuration.h"
-
class cmCTest;
-class cmCTestCommand;
class cmGlobalGenerator;
class cmMakefile;
class cmake;
/** \class cmCTestScriptHandler
* \brief A class that handles ctest -S invocations
- *
- * CTest script is controlled using several variables that script has to
- * specify and some optional ones. Required ones are:
- * CTEST_SOURCE_DIRECTORY - Source directory of the project
- * CTEST_BINARY_DIRECTORY - Binary directory of the project
- * CTEST_COMMAND - Testing commands
- *
- * Optional variables are:
- * CTEST_BACKUP_AND_RESTORE
- * CTEST_CMAKE_COMMAND
- * CTEST_CMAKE_OUTPUT_FILE_NAME
- * CTEST_CONTINUOUS_DURATION
- * CTEST_CONTINUOUS_MINIMUM_INTERVAL
- * CTEST_CVS_CHECKOUT
- * CTEST_CVS_COMMAND
- * CTEST_UPDATE_COMMAND
- * CTEST_DASHBOARD_ROOT
- * CTEST_ENVIRONMENT
- * CTEST_INITIAL_CACHE
- * CTEST_START_WITH_EMPTY_BINARY_DIRECTORY
- * CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE
- *
- * In addition the following variables can be used. The number can be 1-10.
- * CTEST_EXTRA_UPDATES_1
- * CTEST_EXTRA_UPDATES_2
- * ...
- * CTEST_EXTRA_UPDATES_10
- *
- * CTest script can use the following arguments CTest provides:
- * CTEST_SCRIPT_ARG
- * CTEST_SCRIPT_DIRECTORY
- * CTEST_SCRIPT_NAME
- *
*/
-class cmCTestScriptHandler : public cmCTestGenericHandler
+class cmCTestScriptHandler
{
public:
- using Superclass = cmCTestGenericHandler;
-
/**
* Add a script to run, and if is should run in the current process
*/
- void AddConfigurationScript(const std::string&, bool pscope);
+ void AddConfigurationScript(std::string const&, bool pscope);
/**
* Run a dashboard using a specified configuration script
*/
- int ProcessHandler() override;
+ int ProcessHandler();
/*
* Run a script
*/
static bool RunScript(cmCTest* ctest, cmMakefile* mf,
- const std::string& script, bool InProcess,
+ std::string const& script, bool InProcess,
int* returnValue);
- int RunCurrentScript();
-
- /*
- * Empty Binary Directory
- */
- static bool EmptyBinaryDirectory(const std::string& dir, std::string& err);
-
- /*
- * Write an initial CMakeCache.txt from the given contents.
- */
- static bool WriteInitialCache(const std::string& directory,
- const std::string& text);
/*
* Some elapsed time handling functions
*/
- static void SleepInSeconds(unsigned int secondsToWait);
void UpdateElapsedTime();
- /**
- * Return the time remaianing that the script is allowed to run in
- * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has
- * not been set it returns a very large value.
- */
- cmDuration GetRemainingTimeAllowed();
-
- cmCTestScriptHandler();
- cmCTestScriptHandler(const cmCTestScriptHandler&) = delete;
- const cmCTestScriptHandler& operator=(const cmCTestScriptHandler&) = delete;
- ~cmCTestScriptHandler() override;
-
- void Initialize() override;
+ cmCTestScriptHandler(cmCTest* ctest);
+ cmCTestScriptHandler(cmCTestScriptHandler const&) = delete;
+ cmCTestScriptHandler const& operator=(cmCTestScriptHandler const&) = delete;
+ ~cmCTestScriptHandler();
void CreateCMake();
cmake* GetCMake() { return this->CMake.get(); }
-
- void SetRunCurrentScript(bool value);
+ cmMakefile* GetMakefile() { return this->Makefile.get(); }
private:
// reads in a script
- int ReadInScript(const std::string& total_script_arg);
- int ExecuteScript(const std::string& total_script_arg);
-
- // extract vars from the script to set ivars
- int ExtractVariables();
-
- // perform a CVS checkout of the source dir
- int CheckOutSourceDir();
-
- // perform any extra cvs updates that were requested
- int PerformExtraUpdates();
-
- // backup and restore dirs
- int BackupDirectories();
- void RestoreBackupDirectories();
-
- int RunConfigurationScript(const std::string& script, bool pscope);
- int RunConfigurationDashboard();
+ int ReadInScript(std::string const& total_script_arg);
+ int ExecuteScript(std::string const& total_script_arg);
- // Add ctest command
- void AddCTestCommand(std::string const& name,
- std::unique_ptr<cmCTestCommand> command);
-
- // Try to remove the binary directory once
- static cmsys::Status TryToRemoveBinaryDirectoryOnce(
- const std::string& directoryPath);
+ int RunConfigurationScript(std::string const& script, bool pscope);
+ cmCTest* CTest = nullptr;
std::vector<std::string> ConfigurationScripts;
std::vector<bool> ScriptProcessScope;
- bool ShouldRunCurrentScript;
-
- bool Backup = false;
- bool EmptyBinDir = false;
- bool EmptyBinDirOnce = false;
-
- std::string SourceDir;
- std::string BinaryDir;
- std::string BackupSourceDir;
- std::string BackupBinaryDir;
- std::string CTestRoot;
- std::string CVSCheckOut;
- std::string CTestCmd;
- std::string UpdateCmd;
- std::string CTestEnv;
- std::string InitialCache;
- std::string CMakeCmd;
- std::string CMOutFile;
- std::vector<std::string> ExtraUpdates;
-
- // the *60 is because the settings are in minutes but GetTime is seconds
- double MinimumInterval = 30 * 60;
- double ContinuousDuration = -1;
-
- // what time in seconds did this script start running
- std::chrono::steady_clock::time_point ScriptStartTime =
- std::chrono::steady_clock::time_point();
-
std::unique_ptr<cmMakefile> Makefile;
cmMakefile* ParentMakefile = nullptr;
std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx
index 623d3b6..3ee9aeb 100644
--- a/Source/CTest/cmCTestSleepCommand.cxx
+++ b/Source/CTest/cmCTestSleepCommand.cxx
@@ -1,43 +1,35 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestSleepCommand.h"
+#include <chrono>
#include <cstdlib>
+#include <thread>
-#include "cmCTestScriptHandler.h"
+#include "cmExecutionStatus.h"
-class cmExecutionStatus;
-
-bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& /*unused*/)
+bool cmCTestSleepCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
- return false;
- }
-
// sleep for specified seconds
- unsigned int time1 = atoi(args[0].c_str());
if (args.size() == 1) {
- cmCTestScriptHandler::SleepInSeconds(time1);
- // update the elapsed time since it could have slept for a while
- this->CTestScriptHandler->UpdateElapsedTime();
+ unsigned int duration = atoi(args[0].c_str());
+ std::this_thread::sleep_for(std::chrono::seconds(duration));
return true;
}
// sleep up to a duration
if (args.size() == 3) {
+ unsigned int time1 = atoi(args[0].c_str());
unsigned int duration = atoi(args[1].c_str());
unsigned int time2 = atoi(args[2].c_str());
if (time1 + duration > time2) {
duration = (time1 + duration - time2);
- cmCTestScriptHandler::SleepInSeconds(duration);
- // update the elapsed time since it could have slept for a while
- this->CTestScriptHandler->UpdateElapsedTime();
+ std::this_thread::sleep_for(std::chrono::seconds(duration));
}
return true;
}
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index 9425576..0eed451 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -1,46 +1,13 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
-
-#include "cmCTestCommand.h"
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmCTestSleep
- * \brief Run a ctest script
- *
- * cmLibrarysCommand defines a list of executable (i.e., test)
- * programs to create.
- */
-class cmCTestSleepCommand : public cmCTestCommand
-{
-public:
- cmCTestSleepCommand() {}
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto ni = cm::make_unique<cmCTestSleepCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmCTestSleepCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index 84d12d7..f939512 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestStartCommand.h"
#include <cstddef>
@@ -7,29 +7,25 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
-class cmExecutionStatus;
-
-cmCTestStartCommand::cmCTestStartCommand()
-{
- this->CreateNewTag = true;
- this->Quiet = false;
-}
-
bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& /*unused*/)
+ cmExecutionStatus& status) const
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
size_t cnt = 0;
- const char* smodel = nullptr;
+ bool append = false;
+ bool quiet = false;
+ char const* smodel = nullptr;
cmValue src_dir;
cmValue bld_dir;
@@ -40,17 +36,17 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
args[cnt] == "QUIET") {
std::ostringstream e;
e << args[cnt - 1] << " argument missing group name";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
this->CTest->SetSpecificGroup(args[cnt].c_str());
cnt++;
} else if (args[cnt] == "APPEND") {
cnt++;
- this->CreateNewTag = false;
+ append = true;
} else if (args[cnt] == "QUIET") {
cnt++;
- this->Quiet = true;
+ quiet = true;
} else if (!smodel) {
smodel = args[cnt].c_str();
cnt++;
@@ -61,43 +57,42 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
bld_dir = cmValue(args[cnt]);
cnt++;
} else {
- this->SetError("Too many arguments");
+ status.SetError("Too many arguments");
return false;
}
}
+ cmMakefile& mf = status.GetMakefile();
+
if (!src_dir) {
- src_dir = this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY");
+ src_dir = mf.GetDefinition("CTEST_SOURCE_DIRECTORY");
}
if (!bld_dir) {
- bld_dir = this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY");
+ bld_dir = mf.GetDefinition("CTEST_BINARY_DIRECTORY");
}
if (!src_dir) {
- this->SetError("source directory not specified. Specify source directory "
- "as an argument or set CTEST_SOURCE_DIRECTORY");
+ status.SetError("source directory not specified. Specify source directory "
+ "as an argument or set CTEST_SOURCE_DIRECTORY");
return false;
}
if (!bld_dir) {
- this->SetError("binary directory not specified. Specify binary directory "
- "as an argument or set CTEST_BINARY_DIRECTORY");
+ status.SetError("binary directory not specified. Specify binary directory "
+ "as an argument or set CTEST_BINARY_DIRECTORY");
return false;
}
- if (!smodel && this->CreateNewTag) {
- this->SetError("no test model specified and APPEND not specified. Specify "
- "either a test model or the APPEND argument");
+ if (!smodel && !append) {
+ status.SetError(
+ "no test model specified and APPEND not specified. Specify "
+ "either a test model or the APPEND argument");
return false;
}
- cmSystemTools::AddKeepPath(*src_dir);
- cmSystemTools::AddKeepPath(*bld_dir);
-
this->CTest->EmptyCTestConfiguration();
std::string sourceDir = cmSystemTools::CollapseFullPath(*src_dir);
std::string binaryDir = cmSystemTools::CollapseFullPath(*bld_dir);
- this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir,
- this->Quiet);
- this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir, this->Quiet);
+ this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir, quiet);
+ this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir, quiet);
if (smodel) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
@@ -105,7 +100,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
<< smodel << std::endl
<< " Source directory: " << *src_dir << std::endl
<< " Build directory: " << *bld_dir << std::endl,
- this->Quiet);
+ quiet);
} else {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
"Run dashboard with "
@@ -113,12 +108,12 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
<< std::endl
<< " Source directory: " << *src_dir << std::endl
<< " Build directory: " << *bld_dir << std::endl,
- this->Quiet);
+ quiet);
}
- const char* group = this->CTest->GetSpecificGroup();
+ char const* group = this->CTest->GetSpecificGroup();
if (group) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Group: " << group << std::endl, this->Quiet);
+ " Group: " << group << std::endl, quiet);
}
// Log startup actions.
@@ -131,7 +126,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
}
// Make sure the source directory exists.
- if (!this->InitialCheckout(ofs, sourceDir)) {
+ if (!this->InitialCheckout(ofs, sourceDir, status)) {
return false;
}
if (!cmSystemTools::FileIsDirectory(sourceDir)) {
@@ -140,12 +135,10 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
<< " " << sourceDir << "\n"
<< "which is not an existing directory. "
<< "Set CTEST_CHECKOUT_COMMAND to a command line to create it.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->CTest->SetRunCurrentScript(false);
- this->CTest->SetSuppressUpdatingCTestConfiguration(true);
int model;
if (smodel) {
model = cmCTest::GetTestModelFromString(smodel);
@@ -155,22 +148,93 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
this->CTest->SetTestModel(model);
this->CTest->SetProduceXML(true);
- return this->CTest->InitializeFromCommand(this);
+ std::string fname;
+
+ std::string src_dir_fname = cmStrCat(sourceDir, "/CTestConfig.cmake");
+ cmSystemTools::ConvertToUnixSlashes(src_dir_fname);
+
+ std::string bld_dir_fname = cmStrCat(binaryDir, "/CTestConfig.cmake");
+ cmSystemTools::ConvertToUnixSlashes(bld_dir_fname);
+
+ if (cmSystemTools::FileExists(bld_dir_fname)) {
+ fname = bld_dir_fname;
+ } else if (cmSystemTools::FileExists(src_dir_fname)) {
+ fname = src_dir_fname;
+ }
+
+ if (!fname.empty()) {
+ cmCTestOptionalLog(
+ this->CTest, OUTPUT,
+ " Reading ctest configuration file: " << fname << std::endl, quiet);
+ bool readit = mf.ReadDependentFile(fname);
+ if (!readit) {
+ std::string m = cmStrCat("Could not find include file: ", fname);
+ status.SetError(m);
+ return false;
+ }
+ }
+
+ this->CTest->SetCTestConfigurationFromCMakeVariable(
+ &mf, "NightlyStartTime", "CTEST_NIGHTLY_START_TIME", quiet);
+ this->CTest->SetCTestConfigurationFromCMakeVariable(&mf, "Site",
+ "CTEST_SITE", quiet);
+ this->CTest->SetCTestConfigurationFromCMakeVariable(
+ &mf, "BuildName", "CTEST_BUILD_NAME", quiet);
+
+ this->CTest->Initialize(binaryDir);
+
+ cmCTestOptionalLog(
+ this->CTest, OUTPUT,
+ " Site: " << this->CTest->GetCTestConfiguration("Site") << std::endl
+ << " Build name: "
+ << cmCTest::SafeBuildIdField(
+ this->CTest->GetCTestConfiguration("BuildName"))
+ << std::endl,
+ quiet);
+
+ if (this->CTest->GetTestModel() == cmCTest::NIGHTLY &&
+ this->CTest->GetCTestConfiguration("NightlyStartTime").empty()) {
+ cmCTestOptionalLog(
+ this->CTest, WARNING,
+ "WARNING: No nightly start time found please set in CTestConfig.cmake"
+ " or DartConfig.cmake"
+ << std::endl,
+ quiet);
+ return false;
+ }
+
+ this->CTest->ReadCustomConfigurationFileTree(bld_dir, &mf);
+
+ if (append) {
+ if (!this->CTest->ReadExistingTag(quiet)) {
+ return false;
+ }
+ } else {
+ if (!this->CTest->CreateNewTag(quiet)) {
+ return false;
+ }
+ }
+
+ cmCTestOptionalLog(this->CTest, OUTPUT,
+ " Use " << this->CTest->GetTestGroupString() << " tag: "
+ << this->CTest->GetCurrentTag() << std::endl,
+ quiet);
+ return true;
}
bool cmCTestStartCommand::InitialCheckout(std::ostream& ofs,
- std::string const& sourceDir)
+ std::string const& sourceDir,
+ cmExecutionStatus& status) const
{
+ cmMakefile& mf = status.GetMakefile();
// Use the user-provided command to create the source tree.
- cmValue initialCheckoutCommand =
- this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
+ cmValue initialCheckoutCommand = mf.GetDefinition("CTEST_CHECKOUT_COMMAND");
if (!initialCheckoutCommand) {
- initialCheckoutCommand =
- this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT");
+ initialCheckoutCommand = mf.GetDefinition("CTEST_CVS_CHECKOUT");
}
if (initialCheckoutCommand) {
// Use a generic VC object to run and log the command.
- cmCTestVC vc(this->CTest, ofs);
+ cmCTestVC vc(this->CTest, &mf, ofs);
vc.SetSourceDirectory(sourceDir);
if (!vc.InitialCheckout(*initialCheckoutCommand)) {
return false;
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index b3d06a7..0b5a337 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -1,18 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
-
#include "cmCTestCommand.h"
-#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,40 +20,16 @@ class cmExecutionStatus;
class cmCTestStartCommand : public cmCTestCommand
{
public:
- cmCTestStartCommand();
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto ni = cm::make_unique<cmCTestStartCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- ni->CreateNewTag = this->CreateNewTag;
- ni->Quiet = this->Quiet;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
+ using cmCTestCommand::cmCTestCommand;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
- /**
- * Will this invocation of ctest_start create a new TAG file?
- */
- bool ShouldCreateNewTag() { return this->CreateNewTag; }
-
- /**
- * Should this invocation of ctest_start output non-error messages?
- */
- bool ShouldBeQuiet() { return this->Quiet; }
+ cmExecutionStatus& status) const override;
private:
- bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir);
- bool CreateNewTag;
- bool Quiet;
+ bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir,
+ cmExecutionStatus& status) const;
};
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 029f81f..4b34cf6 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestSubmitCommand.h"
#include <set>
@@ -10,9 +10,11 @@
#include <cm/vector>
#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmCTest.h"
+#include "cmCTestGenericHandler.h"
#include "cmCTestSubmitHandler.h"
-#include "cmCommand.h"
+#include "cmExecutionStatus.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -20,117 +22,101 @@
#include "cmSystemTools.h"
#include "cmValue.h"
-class cmExecutionStatus;
-
-/**
- * This is a virtual constructor for the command.
- */
-std::unique_ptr<cmCommand> cmCTestSubmitCommand::Clone()
+std::unique_ptr<cmCTestGenericHandler> cmCTestSubmitCommand::InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const
{
- auto ni = cm::make_unique<cmCTestSubmitCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
-}
-
-cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
-{
- cmValue submitURL = !this->SubmitURL.empty()
- ? cmValue(this->SubmitURL)
- : this->Makefile->GetDefinition("CTEST_SUBMIT_URL");
+ cmMakefile& mf = status.GetMakefile();
+ auto const& args = static_cast<SubmitArguments&>(arguments);
+ cmValue submitURL = !args.SubmitURL.empty()
+ ? cmValue(args.SubmitURL)
+ : mf.GetDefinition("CTEST_SUBMIT_URL");
if (submitURL) {
- this->CTest->SetCTestConfiguration("SubmitURL", *submitURL, this->Quiet);
+ this->CTest->SetCTestConfiguration("SubmitURL", *submitURL, args.Quiet);
} else {
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "DropMethod", "CTEST_DROP_METHOD", this->Quiet);
+ &mf, "DropMethod", "CTEST_DROP_METHOD", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER", this->Quiet);
+ &mf, "DropSiteUser", "CTEST_DROP_SITE_USER", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD",
- this->Quiet);
+ &mf, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "DropSite", "CTEST_DROP_SITE", this->Quiet);
+ &mf, "DropSite", "CTEST_DROP_SITE", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "DropLocation", "CTEST_DROP_LOCATION", this->Quiet);
+ &mf, "DropLocation", "CTEST_DROP_LOCATION", args.Quiet);
}
if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "TLSVersion", "CTEST_TLS_VERSION", this->Quiet)) {
- if (cmValue tlsVersionVar =
- this->Makefile->GetDefinition("CMAKE_TLS_VERSION")) {
+ &mf, "TLSVersion", "CTEST_TLS_VERSION", args.Quiet)) {
+ if (cmValue tlsVersionVar = mf.GetDefinition("CMAKE_TLS_VERSION")) {
cmCTestOptionalLog(
this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetCTestConfiguration from CMAKE_TLS_VERSION:TLSVersion:"
<< *tlsVersionVar << std::endl,
- this->Quiet);
+ args.Quiet);
this->CTest->SetCTestConfiguration("TLSVersion", *tlsVersionVar,
- this->Quiet);
+ args.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);
+ args.Quiet);
this->CTest->SetCTestConfiguration("TLSVersion", *tlsVersionEnv,
- this->Quiet);
+ args.Quiet);
}
}
if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "TLSVerify", "CTEST_TLS_VERIFY", this->Quiet)) {
- if (cmValue tlsVerifyVar =
- this->Makefile->GetDefinition("CMAKE_TLS_VERIFY")) {
+ &mf, "TLSVerify", "CTEST_TLS_VERIFY", args.Quiet)) {
+ if (cmValue tlsVerifyVar = mf.GetDefinition("CMAKE_TLS_VERIFY")) {
cmCTestOptionalLog(
this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:"
<< *tlsVerifyVar << std::endl,
- this->Quiet);
+ args.Quiet);
this->CTest->SetCTestConfiguration("TLSVerify", *tlsVerifyVar,
- this->Quiet);
+ args.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);
+ args.Quiet);
this->CTest->SetCTestConfiguration("TLSVerify", *tlsVerifyEnv,
- this->Quiet);
+ args.Quiet);
}
}
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
+ &mf, "CurlOptions", "CTEST_CURL_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "SubmitInactivityTimeout",
- "CTEST_SUBMIT_INACTIVITY_TIMEOUT", this->Quiet);
+ &mf, "SubmitInactivityTimeout", "CTEST_SUBMIT_INACTIVITY_TIMEOUT",
+ args.Quiet);
- cmValue notesFilesVariable =
- this->Makefile->GetDefinition("CTEST_NOTES_FILES");
+ cmValue notesFilesVariable = mf.GetDefinition("CTEST_NOTES_FILES");
if (notesFilesVariable) {
cmList notesFiles{ *notesFilesVariable };
- this->CTest->GenerateNotesFile(notesFiles);
+ this->CTest->GenerateNotesFile(mf.GetCMakeInstance(), notesFiles);
}
- cmValue extraFilesVariable =
- this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
+ cmValue extraFilesVariable = mf.GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
if (extraFilesVariable) {
cmList extraFiles{ *extraFilesVariable };
if (!this->CTest->SubmitExtraFiles(extraFiles)) {
- this->SetError("problem submitting extra files.");
+ status.SetError("problem submitting extra files.");
return nullptr;
}
}
- cmCTestSubmitHandler* handler = this->CTest->GetSubmitHandler();
- handler->Initialize();
+ auto handler = cm::make_unique<cmCTestSubmitHandler>(this->CTest);
// If no FILES or PARTS given, *all* PARTS are submitted by default.
//
// If FILES are given, but not PARTS, only the FILES are submitted
// and *no* PARTS are submitted.
// (This is why we select the empty "noParts" set in the
- // if(this->Files) block below...)
+ // if(args.Files) block below...)
//
// If PARTS are given, only the selected PARTS are submitted.
//
@@ -139,7 +125,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
// If given explicit FILES to submit, pass them to the handler.
//
- if (this->Files) {
+ if (args.Files) {
// Intentionally select *no* PARTS. (Pass an empty set.) If PARTS
// were also explicitly mentioned, they will be selected below...
// But FILES with no PARTS mentioned should just submit the FILES
@@ -147,99 +133,111 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
//
handler->SelectParts(std::set<cmCTest::Part>());
handler->SelectFiles(
- std::set<std::string>(this->Files->begin(), this->Files->end()));
+ std::set<std::string>(args.Files->begin(), args.Files->end()));
}
// If a PARTS option was given, select only the named parts for submission.
//
- if (this->Parts) {
+ if (args.Parts) {
auto parts =
- cmMakeRange(*(this->Parts)).transform([this](std::string const& arg) {
+ cmMakeRange(*(args.Parts)).transform([this](std::string const& arg) {
return this->CTest->GetPartFromName(arg);
});
handler->SelectParts(std::set<cmCTest::Part>(parts.begin(), parts.end()));
}
// Pass along any HTTPHEADER to the handler if this option was given.
- if (!this->HttpHeaders.empty()) {
- handler->SetHttpHeaders(this->HttpHeaders);
+ if (!args.HttpHeaders.empty()) {
+ handler->SetHttpHeaders(args.HttpHeaders);
}
- handler->SetOption("RetryDelay", this->RetryDelay);
- handler->SetOption("RetryCount", this->RetryCount);
- handler->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF");
+ handler->RetryDelay = args.RetryDelay;
+ handler->RetryCount = args.RetryCount;
+ handler->InternalTest = args.InternalTest;
- handler->SetQuiet(this->Quiet);
+ handler->SetQuiet(args.Quiet);
- if (this->CDashUpload) {
- handler->SetOption("CDashUploadFile", this->CDashUploadFile);
- handler->SetOption("CDashUploadType", this->CDashUploadType);
+ if (args.CDashUpload) {
+ handler->CDashUpload = true;
+ handler->CDashUploadFile = args.CDashUploadFile;
+ handler->CDashUploadType = args.CDashUploadType;
}
- return handler;
+ return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
}
bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status)
+ cmExecutionStatus& status) const
{
- this->CDashUpload = !args.empty() && args[0] == "CDASH_UPLOAD";
-
- bool ret = this->cmCTestHandlerCommand::InitialPass(args, status);
-
- if (!this->BuildID.empty()) {
- this->Makefile->AddDefinition(this->BuildID, this->CTest->GetBuildID());
- }
-
- return ret;
-}
-
-void cmCTestSubmitCommand::BindArguments()
-{
- if (this->CDashUpload) {
- // Arguments specific to the CDASH_UPLOAD signature.
- this->Bind("CDASH_UPLOAD", this->CDashUploadFile);
- this->Bind("CDASH_UPLOAD_TYPE", this->CDashUploadType);
- } else {
- // Arguments that cannot be used with CDASH_UPLOAD.
- this->Bind("PARTS"_s, this->Parts);
- this->Bind("FILES"_s, this->Files);
- }
// Arguments used by both modes.
- this->Bind("BUILD_ID"_s, this->BuildID);
- this->Bind("HTTPHEADER"_s, this->HttpHeaders);
- this->Bind("RETRY_COUNT"_s, this->RetryCount);
- this->Bind("RETRY_DELAY"_s, this->RetryDelay);
- this->Bind("SUBMIT_URL"_s, this->SubmitURL);
- this->Bind("INTERNAL_TEST_CHECKSUM", this->InternalTest);
-
- // Look for other arguments.
- this->cmCTestHandlerCommand::BindArguments();
+ static auto const parserBase =
+ cmArgumentParser<SubmitArguments>{ MakeHandlerParser<SubmitArguments>() }
+ .Bind("BUILD_ID"_s, &SubmitArguments::BuildID)
+ .Bind("HTTPHEADER"_s, &SubmitArguments::HttpHeaders)
+ .Bind("RETRY_COUNT"_s, &SubmitArguments::RetryCount)
+ .Bind("RETRY_DELAY"_s, &SubmitArguments::RetryDelay)
+ .Bind("SUBMIT_URL"_s, &SubmitArguments::SubmitURL)
+ .Bind("INTERNAL_TEST_CHECKSUM"_s, &SubmitArguments::InternalTest);
+
+ // Arguments specific to the CDASH_UPLOAD signature.
+ static auto const uploadParser =
+ cmArgumentParser<SubmitArguments>{ parserBase }
+ .Bind("CDASH_UPLOAD"_s, &SubmitArguments::CDashUploadFile)
+ .Bind("CDASH_UPLOAD_TYPE"_s, &SubmitArguments::CDashUploadType);
+
+ // Arguments that cannot be used with CDASH_UPLOAD.
+ static auto const partsParser =
+ cmArgumentParser<SubmitArguments>{ parserBase }
+ .Bind("PARTS"_s, &SubmitArguments::Parts)
+ .Bind("FILES"_s, &SubmitArguments::Files);
+
+ bool const cdashUpload = !args.empty() && args[0] == "CDASH_UPLOAD";
+ auto const& parser = cdashUpload ? uploadParser : partsParser;
+
+ return this->Invoke(parser, args, status, [&](SubmitArguments& a) -> bool {
+ a.CDashUpload = cdashUpload;
+ return this->ExecuteHandlerCommand(a, status);
+ });
}
-void cmCTestSubmitCommand::CheckArguments()
+void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments,
+ cmExecutionStatus& status) const
{
- if (this->Parts) {
- cm::erase_if(*(this->Parts), [this](std::string const& arg) -> bool {
+ cmMakefile& mf = status.GetMakefile();
+ auto& args = static_cast<SubmitArguments&>(arguments);
+ if (args.Parts) {
+ cm::erase_if(*(args.Parts), [this, &mf](std::string const& arg) -> bool {
cmCTest::Part p = this->CTest->GetPartFromName(arg);
if (p == cmCTest::PartCount) {
std::ostringstream e;
e << "Part name \"" << arg << "\" is invalid.";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
return true;
}
return false;
});
}
- if (this->Files) {
- cm::erase_if(*(this->Files), [this](std::string const& arg) -> bool {
+ if (args.Files) {
+ cm::erase_if(*(args.Files), [&mf](std::string const& arg) -> bool {
if (!cmSystemTools::FileExists(arg)) {
std::ostringstream e;
e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
return true;
}
return false;
});
}
}
+
+void cmCTestSubmitCommand::ProcessAdditionalValues(
+ cmCTestGenericHandler*, HandlerArguments const& arguments,
+ cmExecutionStatus& status) const
+{
+ cmMakefile& mf = status.GetMakefile();
+ auto const& args = static_cast<SubmitArguments const&>(arguments);
+ if (!args.BuildID.empty()) {
+ mf.AddDefinition(args.BuildID, this->CTest->GetBuildID());
+ }
+}
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index b67f182..f688976 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,45 +13,45 @@
#include "cmArgumentParserTypes.h"
#include "cmCTestHandlerCommand.h"
-class cmCommand;
-class cmCTestGenericHandler;
class cmExecutionStatus;
+class cmCTestGenericHandler;
-/** \class cmCTestSubmit
- * \brief Run a ctest script
- *
- * cmCTestSubmitCommand defineds the command to submit the test results for
- * the project.
- */
class cmCTestSubmitCommand : public cmCTestHandlerCommand
{
public:
- std::unique_ptr<cmCommand> Clone() override;
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+protected:
+ struct SubmitArguments : HandlerArguments
+ {
+ bool CDashUpload = false;
+ bool InternalTest = false;
+
+ std::string BuildID;
+ std::string CDashUploadFile;
+ std::string CDashUploadType;
+ std::string RetryCount;
+ std::string RetryDelay;
+ std::string SubmitURL;
+
+ cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Files;
+ ArgumentParser::MaybeEmpty<std::vector<std::string>> HttpHeaders;
+ cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Parts;
+ };
+
+private:
std::string GetName() const override { return "ctest_submit"; }
-protected:
- void BindArguments() override;
- void CheckArguments() override;
- cmCTestGenericHandler* InitializeHandler() override;
-
- bool CDashUpload = false;
- bool InternalTest = false;
-
- std::string BuildID;
- std::string CDashUploadFile;
- std::string CDashUploadType;
- std::string RetryCount;
- std::string RetryDelay;
- std::string SubmitURL;
-
- cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Files;
- ArgumentParser::MaybeEmpty<std::vector<std::string>> HttpHeaders;
- cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Parts;
+ void CheckArguments(HandlerArguments& arguments,
+ cmExecutionStatus& status) const override;
+
+ std::unique_ptr<cmCTestGenericHandler> InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const override;
+
+ void ProcessAdditionalValues(cmCTestGenericHandler* handler,
+ HandlerArguments const& arguments,
+ cmExecutionStatus& status) const override;
+
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 1f3fbd0..b2cb454 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestSubmitHandler.h"
#include <chrono>
@@ -19,7 +19,6 @@
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestCurl.h"
-#include "cmCTestScriptHandler.h"
#include "cmCryptoHash.h"
#include "cmCurl.h"
#include "cmDuration.h"
@@ -63,18 +62,18 @@ private:
return val;
}
- void StartElement(const std::string& /*name*/,
- const char** /*atts*/) override
+ void StartElement(std::string const& /*name*/,
+ char const** /*atts*/) override
{
this->CurrentValue.clear();
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
cm::append(this->CurrentValue, data, data + length);
}
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "status") {
std::string status = cmSystemTools::UpperCase(this->GetCurrentValue());
@@ -101,7 +100,7 @@ static size_t cmCTestSubmitHandlerWriteMemoryCallback(void* ptr, size_t size,
size_t nmemb, void* data)
{
int realsize = static_cast<int>(size * nmemb);
- const char* chPtr = static_cast<char*>(ptr);
+ char const* chPtr = static_cast<char*>(ptr);
cm::append(*static_cast<cmCTestSubmitHandlerVectorOfChar*>(data), chPtr,
chPtr + realsize);
return realsize;
@@ -117,45 +116,20 @@ static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL* /*unused*/,
return 0;
}
-cmCTestSubmitHandler::cmCTestSubmitHandler()
-{
- this->Initialize();
-}
-
-void cmCTestSubmitHandler::Initialize()
+cmCTestSubmitHandler::cmCTestSubmitHandler(cmCTest* ctest)
+ : Superclass(ctest)
+ , HttpHeaders(ctest->GetCommandLineHttpHeaders())
{
// We submit all available parts by default.
for (cmCTest::Part p = cmCTest::PartStart; p != cmCTest::PartCount;
p = static_cast<cmCTest::Part>(p + 1)) {
this->SubmitPart[p] = true;
}
- this->HasWarnings = false;
- this->HasErrors = false;
- this->Superclass::Initialize();
- this->HTTPProxy.clear();
- this->HTTPProxyType = 0;
- this->HTTPProxyAuth.clear();
- this->LogFile = nullptr;
- this->Files.clear();
-}
-
-int cmCTestSubmitHandler::ProcessCommandLineArguments(
- const std::string& currentArg, size_t& idx,
- 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;
}
bool cmCTestSubmitHandler::SubmitUsingHTTP(
- const std::string& localprefix, const std::vector<std::string>& files,
- const std::string& remoteprefix, const std::string& url)
+ std::string const& localprefix, std::vector<std::string> const& files,
+ std::string const& remoteprefix, std::string const& url)
{
CURL* curl;
FILE* ftpfile;
@@ -274,10 +248,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&stamp=";
upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
upload_as += "-";
- upload_as += ctest_curl.Escape(this->CTest->GetTestModelString());
- cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
- cmake* cm = ch->GetCMake();
- if (cm) {
+ upload_as += ctest_curl.Escape(this->CTest->GetTestGroupString());
+ if (cmake* cm = this->CMake) {
cmValue subproject = cm->GetState()->GetGlobalProperty("SubProject");
if (subproject) {
upload_as += "&subproject=";
@@ -299,7 +271,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&MD5=";
- if (this->GetOption("InternalTest").IsOn()) {
+ if (this->InternalTest) {
upload_as += "ffffffffffffffffffffffffffffffff";
} else {
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
@@ -381,8 +353,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
bool successful_submission = response_code == 200;
if (!successful_submission || this->HasErrors) {
- std::string retryDelay = *this->GetOption("RetryDelay");
- std::string retryCount = *this->GetOption("RetryCount");
+ std::string retryDelay = this->RetryDelay;
+ std::string retryCount = this->RetryCount;
auto delay = cmDuration(
retryDelay.empty()
@@ -511,10 +483,6 @@ void cmCTestSubmitHandler::ParseResponse(
int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
std::string const& typeString)
{
- if (file.empty()) {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Upload file not specified\n");
- return -1;
- }
if (!cmSystemTools::FileExists(file)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Upload file not found: '" << file << "'\n");
@@ -541,11 +509,11 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
fields = url.substr(pos + 1);
url.erase(pos);
}
- bool internalTest = this->GetOption("InternalTest").IsOn();
+ bool internalTest = this->InternalTest;
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
- std::string retryDelayString = *this->GetOption("RetryDelay");
- std::string retryCountString = *this->GetOption("RetryCount");
+ std::string retryDelayString = this->RetryDelay;
+ std::string retryCountString = this->RetryCount;
auto retryDelay = std::chrono::seconds(0);
if (!retryDelayString.empty()) {
unsigned long retryDelayValue = 0;
@@ -572,9 +540,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
// has already been uploaded
// TODO I added support for subproject. You would need to add
// a "&subproject=subprojectname" to the first POST.
- cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
- cmake* cm = ch->GetCMake();
- cmValue subproject = cm->GetState()->GetGlobalProperty("SubProject");
+ cmValue subproject =
+ this->CMake->GetState()->GetGlobalProperty("SubProject");
// TODO: Encode values for a URL instead of trusting caller.
std::ostringstream str;
if (subproject) {
@@ -583,18 +550,18 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
auto timeNow =
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
str << "stamp=" << curl.Escape(this->CTest->GetCurrentTag()) << "-"
- << curl.Escape(this->CTest->GetTestModelString()) << "&"
- << "model=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
+ << curl.Escape(this->CTest->GetTestGroupString()) << "&"
+ << "model=" << curl.Escape(this->CTest->GetTestGroupString()) << "&"
<< "build="
<< curl.Escape(this->CTest->GetCTestConfiguration("BuildName")) << "&"
<< "site=" << curl.Escape(this->CTest->GetCTestConfiguration("Site"))
<< "&"
- << "group=" << curl.Escape(this->CTest->GetTestModelString())
+ << "group=" << curl.Escape(this->CTest->GetTestGroupString())
<< "&"
// For now, we send both "track" and "group" to CDash in case we're
// submitting to an older instance that still expects the prior
// terminology.
- << "track=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
+ << "track=" << curl.Escape(this->CTest->GetTestGroupString()) << "&"
<< "starttime=" << timeNow << "&"
<< "endtime=" << timeNow << "&"
<< "datafilesmd5[0]=" << md5sum << "&"
@@ -734,13 +701,12 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
int cmCTestSubmitHandler::ProcessHandler()
{
- cmValue cdashUploadFile = this->GetOption("CDashUploadFile");
- cmValue cdashUploadType = this->GetOption("CDashUploadType");
- if (cdashUploadFile && cdashUploadType) {
- return this->HandleCDashUploadFile(*cdashUploadFile, *cdashUploadType);
+ if (this->CDashUpload) {
+ return this->HandleCDashUploadFile(this->CDashUploadFile,
+ this->CDashUploadType);
}
- const std::string& buildDirectory =
+ std::string const& buildDirectory =
this->CTest->GetCTestConfiguration("BuildDirectory");
if (buildDirectory.empty()) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -863,7 +829,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files\n",
this->Quiet);
- const char* specificGroup = this->CTest->GetSpecificGroup();
+ char const* specificGroup = this->CTest->GetSpecificGroup();
if (specificGroup) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Send to group: " << specificGroup << std::endl,
@@ -905,7 +871,7 @@ std::string cmCTestSubmitHandler::GetSubmitResultsPrefix()
cmCTest::SafeBuildIdField(this->CTest->GetCTestConfiguration("BuildName"));
std::string name = this->CTest->GetCTestConfiguration("Site") + "___" +
buildname + "___" + this->CTest->GetCurrentTag() + "-" +
- this->CTest->GetTestModelString() + "___XML___";
+ this->CTest->GetTestGroupString() + "___XML___";
return name;
}
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index d152b71..221c958 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -1,10 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
-#include <cstddef>
#include <iosfwd>
#include <set>
#include <string>
@@ -24,7 +23,7 @@ class cmCTestSubmitHandler : public cmCTestGenericHandler
public:
using Superclass = cmCTestGenericHandler;
- cmCTestSubmitHandler();
+ cmCTestSubmitHandler(cmCTest* ctest);
~cmCTestSubmitHandler() override { this->LogFile = nullptr; }
/*
@@ -32,13 +31,6 @@ public:
*/
int ProcessHandler() override;
- void Initialize() override;
-
- //! Set all the submit arguments
- 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);
@@ -50,12 +42,7 @@ public:
void SetHttpHeaders(std::vector<std::string> const& v)
{
- if (this->CommandLineHttpHeaders.empty()) {
- this->HttpHeaders = v;
- } else {
- this->HttpHeaders = this->CommandLineHttpHeaders;
- this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
- }
+ this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
}
private:
@@ -64,10 +51,10 @@ private:
/**
* Submit file using various ways
*/
- bool SubmitUsingHTTP(const std::string& localprefix,
- const std::vector<std::string>& files,
- const std::string& remoteprefix,
- const std::string& url);
+ bool SubmitUsingHTTP(std::string const& localprefix,
+ std::vector<std::string> const& files,
+ std::string const& remoteprefix,
+ std::string const& url);
using cmCTestSubmitHandlerVectorOfChar = std::vector<char>;
@@ -79,13 +66,22 @@ private:
class ResponseParser;
std::string HTTPProxy;
- int HTTPProxyType;
+ int HTTPProxyType = 0;
std::string HTTPProxyAuth;
- std::ostream* LogFile;
+ std::ostream* LogFile = nullptr;
bool SubmitPart[cmCTest::PartCount];
- bool HasWarnings;
- bool HasErrors;
+ bool HasWarnings = false;
+ bool HasErrors = false;
std::set<std::string> Files;
- std::vector<std::string> CommandLineHttpHeaders;
std::vector<std::string> HttpHeaders;
+
+ bool CDashUpload = false;
+ bool InternalTest = false;
+
+ std::string CDashUploadFile;
+ std::string CDashUploadType;
+ std::string RetryCount;
+ std::string RetryDelay;
+
+ friend class cmCTestSubmitCommand;
};
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 98ce862..2d923a4 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -1,49 +1,31 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestTestCommand.h"
#include <chrono>
#include <cstdlib>
#include <ratio>
#include <sstream>
+#include <utility>
+#include <vector>
-#include <cmext/string_view>
+#include <cm/memory>
#include "cmCTest.h"
+#include "cmCTestGenericHandler.h"
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmValue.h"
-void cmCTestTestCommand::BindArguments()
+std::unique_ptr<cmCTestGenericHandler> cmCTestTestCommand::InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const
{
- this->cmCTestHandlerCommand::BindArguments();
- this->Bind("START"_s, this->Start);
- this->Bind("END"_s, this->End);
- this->Bind("STRIDE"_s, this->Stride);
- this->Bind("EXCLUDE"_s, this->Exclude);
- this->Bind("INCLUDE"_s, this->Include);
- this->Bind("EXCLUDE_LABEL"_s, this->ExcludeLabel);
- this->Bind("INCLUDE_LABEL"_s, this->IncludeLabel);
- this->Bind("EXCLUDE_FROM_FILE"_s, this->ExcludeTestsFromFile);
- this->Bind("INCLUDE_FROM_FILE"_s, this->IncludeTestsFromFile);
- this->Bind("EXCLUDE_FIXTURE"_s, this->ExcludeFixture);
- this->Bind("EXCLUDE_FIXTURE_SETUP"_s, this->ExcludeFixtureSetup);
- this->Bind("EXCLUDE_FIXTURE_CLEANUP"_s, this->ExcludeFixtureCleanup);
- this->Bind("PARALLEL_LEVEL"_s, this->ParallelLevel);
- this->Bind("REPEAT"_s, this->Repeat);
- this->Bind("SCHEDULE_RANDOM"_s, this->ScheduleRandom);
- this->Bind("STOP_TIME"_s, this->StopTime);
- this->Bind("TEST_LOAD"_s, this->TestLoad);
- this->Bind("RESOURCE_SPEC_FILE"_s, this->ResourceSpecFile);
- this->Bind("STOP_ON_FAILURE"_s, this->StopOnFailure);
- this->Bind("OUTPUT_JUNIT"_s, this->OutputJUnit);
-}
-
-cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
-{
- cmValue ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
+ cmMakefile& mf = status.GetMakefile();
+ auto& args = static_cast<TestArguments&>(arguments);
+ cmValue ctestTimeout = mf.GetDefinition("CTEST_TEST_TIMEOUT");
cmDuration timeout;
if (ctestTimeout) {
@@ -57,80 +39,77 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
}
this->CTest->SetTimeOut(timeout);
- cmValue resourceSpecFile =
- this->Makefile->GetDefinition("CTEST_RESOURCE_SPEC_FILE");
- if (this->ResourceSpecFile.empty() && resourceSpecFile) {
- this->ResourceSpecFile = *resourceSpecFile;
+ cmValue resourceSpecFile = mf.GetDefinition("CTEST_RESOURCE_SPEC_FILE");
+ if (args.ResourceSpecFile.empty() && resourceSpecFile) {
+ args.ResourceSpecFile = *resourceSpecFile;
}
- cmCTestTestHandler* handler = this->InitializeActualHandler();
- if (!this->Start.empty() || !this->End.empty() || !this->Stride.empty()) {
- handler->SetOption(
- "TestsToRunInformation",
- cmStrCat(this->Start, ',', this->End, ',', this->Stride));
+ auto handler = this->InitializeActualHandler(args, status);
+ if (!args.Start.empty() || !args.End.empty() || !args.Stride.empty()) {
+ handler->TestOptions.TestsToRunInformation =
+ cmStrCat(args.Start, ',', args.End, ',', args.Stride);
}
- if (!this->Exclude.empty()) {
- handler->SetOption("ExcludeRegularExpression", this->Exclude);
+ if (!args.Exclude.empty()) {
+ handler->TestOptions.ExcludeRegularExpression = args.Exclude;
}
- if (!this->Include.empty()) {
- handler->SetOption("IncludeRegularExpression", this->Include);
+ if (!args.Include.empty()) {
+ handler->TestOptions.IncludeRegularExpression = args.Include;
}
- if (!this->ExcludeLabel.empty()) {
- handler->AddMultiOption("ExcludeLabelRegularExpression",
- this->ExcludeLabel);
+ if (!args.ExcludeLabel.empty()) {
+ handler->TestOptions.ExcludeLabelRegularExpression.push_back(
+ args.ExcludeLabel);
}
- if (!this->IncludeLabel.empty()) {
- handler->AddMultiOption("LabelRegularExpression", this->IncludeLabel);
+ if (!args.IncludeLabel.empty()) {
+ handler->TestOptions.LabelRegularExpression.push_back(args.IncludeLabel);
}
- if (!this->ExcludeTestsFromFile.empty()) {
- handler->SetOption("ExcludeTestListFile", this->ExcludeTestsFromFile);
+ if (!args.ExcludeTestsFromFile.empty()) {
+ handler->TestOptions.ExcludeTestListFile = args.ExcludeTestsFromFile;
}
- if (!this->IncludeTestsFromFile.empty()) {
- handler->SetOption("TestListFile", this->IncludeTestsFromFile);
+ if (!args.IncludeTestsFromFile.empty()) {
+ handler->TestOptions.TestListFile = args.IncludeTestsFromFile;
}
- if (!this->ExcludeFixture.empty()) {
- handler->SetOption("ExcludeFixtureRegularExpression",
- this->ExcludeFixture);
+ if (!args.ExcludeFixture.empty()) {
+ handler->TestOptions.ExcludeFixtureRegularExpression = args.ExcludeFixture;
}
- if (!this->ExcludeFixtureSetup.empty()) {
- handler->SetOption("ExcludeFixtureSetupRegularExpression",
- this->ExcludeFixtureSetup);
+ if (!args.ExcludeFixtureSetup.empty()) {
+ handler->TestOptions.ExcludeFixtureSetupRegularExpression =
+ args.ExcludeFixtureSetup;
}
- if (!this->ExcludeFixtureCleanup.empty()) {
- handler->SetOption("ExcludeFixtureCleanupRegularExpression",
- this->ExcludeFixtureCleanup);
+ if (!args.ExcludeFixtureCleanup.empty()) {
+ handler->TestOptions.ExcludeFixtureCleanupRegularExpression =
+ args.ExcludeFixtureCleanup;
}
- if (this->StopOnFailure) {
- handler->SetOption("StopOnFailure", "ON");
+ if (args.StopOnFailure) {
+ handler->TestOptions.StopOnFailure = true;
}
- if (this->ParallelLevel) {
- handler->SetOption("ParallelLevel", *this->ParallelLevel);
+ if (args.ParallelLevel) {
+ handler->ParallelLevel = *args.ParallelLevel;
}
- if (!this->Repeat.empty()) {
- handler->SetOption("Repeat", this->Repeat);
+ if (!args.Repeat.empty()) {
+ handler->Repeat = args.Repeat;
}
- if (!this->ScheduleRandom.empty()) {
- handler->SetOption("ScheduleRandom", this->ScheduleRandom);
+ if (!args.ScheduleRandom.empty()) {
+ handler->TestOptions.ScheduleRandom = cmValue(args.ScheduleRandom).IsOn();
}
- if (!this->ResourceSpecFile.empty()) {
- handler->SetOption("ResourceSpecFile", this->ResourceSpecFile);
+ if (!args.ResourceSpecFile.empty()) {
+ handler->TestOptions.ResourceSpecFile = args.ResourceSpecFile;
}
- if (!this->StopTime.empty()) {
- this->CTest->SetStopTime(this->StopTime);
+ if (!args.StopTime.empty()) {
+ this->CTest->SetStopTime(args.StopTime);
}
// Test load is determined by: TEST_LOAD argument,
// or CTEST_TEST_LOAD script variable, or ctest --test-load
// command line argument... in that order.
unsigned long testLoad;
- cmValue ctestTestLoad = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
- if (!this->TestLoad.empty()) {
- if (!cmStrToULong(this->TestLoad, &testLoad)) {
+ cmValue ctestTestLoad = mf.GetDefinition("CTEST_TEST_LOAD");
+ if (!args.TestLoad.empty()) {
+ if (!cmStrToULong(args.TestLoad, &testLoad)) {
testLoad = 0;
cmCTestLog(this->CTest, WARNING,
- "Invalid value for 'TEST_LOAD' : " << this->TestLoad
+ "Invalid value for 'TEST_LOAD' : " << args.TestLoad
<< std::endl);
}
} else if (cmNonempty(ctestTestLoad)) {
@@ -146,22 +125,32 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
handler->SetTestLoad(testLoad);
if (cmValue labelsForSubprojects =
- this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ mf.GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
- *labelsForSubprojects, this->Quiet);
+ *labelsForSubprojects, args.Quiet);
}
- if (!this->OutputJUnit.empty()) {
- handler->SetJUnitXMLFileName(this->OutputJUnit);
+ if (!args.OutputJUnit.empty()) {
+ handler->SetJUnitXMLFileName(args.OutputJUnit);
}
- handler->SetQuiet(this->Quiet);
- return handler;
+ handler->SetQuiet(args.Quiet);
+ return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
}
-cmCTestTestHandler* cmCTestTestCommand::InitializeActualHandler()
+std::unique_ptr<cmCTestTestHandler>
+cmCTestTestCommand::InitializeActualHandler(HandlerArguments&,
+ cmExecutionStatus&) const
{
- cmCTestTestHandler* handler = this->CTest->GetTestHandler();
- handler->Initialize();
- return handler;
+ return cm::make_unique<cmCTestTestHandler>(this->CTest);
+}
+
+bool cmCTestTestCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
+{
+ static auto const parser = MakeTestParser<TestArguments>();
+
+ return this->Invoke(parser, args, status, [&](TestArguments& a) {
+ return this->ExecuteHandlerCommand(a, status);
+ });
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 23661c5..5c90c64 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -1,69 +1,91 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <string>
-#include <utility>
+#include <type_traits>
+#include <vector>
-#include <cm/memory>
#include <cm/optional>
+#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmArgumentParserTypes.h"
#include "cmCTestHandlerCommand.h"
-#include "cmCommand.h"
+class cmExecutionStatus;
class cmCTestGenericHandler;
class cmCTestTestHandler;
-/** \class cmCTestTest
- * \brief Run a ctest script
- *
- * cmCTestTestCommand defineds the command to test the project.
- */
class cmCTestTestCommand : public cmCTestHandlerCommand
{
public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
+
+protected:
+ struct TestArguments : HandlerArguments
+ {
+ std::string Start;
+ std::string End;
+ std::string Stride;
+ std::string Exclude;
+ std::string Include;
+ std::string ExcludeLabel;
+ std::string IncludeLabel;
+ std::string IncludeTestsFromFile;
+ std::string ExcludeTestsFromFile;
+ std::string ExcludeFixture;
+ std::string ExcludeFixtureSetup;
+ std::string ExcludeFixtureCleanup;
+ cm::optional<ArgumentParser::Maybe<std::string>> ParallelLevel;
+ std::string Repeat;
+ std::string ScheduleRandom;
+ std::string StopTime;
+ std::string TestLoad;
+ std::string ResourceSpecFile;
+ std::string OutputJUnit;
+ bool StopOnFailure = false;
+ };
+
+ template <typename Args>
+ static auto MakeTestParser() -> cmArgumentParser<Args>
{
- auto ni = cm::make_unique<cmCTestTestCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
+ static_assert(std::is_base_of<TestArguments, Args>::value, "");
+ return cmArgumentParser<Args>{ MakeHandlerParser<Args>() }
+ .Bind("START"_s, &TestArguments::Start)
+ .Bind("END"_s, &TestArguments::End)
+ .Bind("STRIDE"_s, &TestArguments::Stride)
+ .Bind("EXCLUDE"_s, &TestArguments::Exclude)
+ .Bind("INCLUDE"_s, &TestArguments::Include)
+ .Bind("EXCLUDE_LABEL"_s, &TestArguments::ExcludeLabel)
+ .Bind("INCLUDE_LABEL"_s, &TestArguments::IncludeLabel)
+ .Bind("EXCLUDE_FROM_FILE"_s, &TestArguments::ExcludeTestsFromFile)
+ .Bind("INCLUDE_FROM_FILE"_s, &TestArguments::IncludeTestsFromFile)
+ .Bind("EXCLUDE_FIXTURE"_s, &TestArguments::ExcludeFixture)
+ .Bind("EXCLUDE_FIXTURE_SETUP"_s, &TestArguments::ExcludeFixtureSetup)
+ .Bind("EXCLUDE_FIXTURE_CLEANUP"_s, &TestArguments::ExcludeFixtureCleanup)
+ .Bind("PARALLEL_LEVEL"_s, &TestArguments::ParallelLevel)
+ .Bind("REPEAT"_s, &TestArguments::Repeat)
+ .Bind("SCHEDULE_RANDOM"_s, &TestArguments::ScheduleRandom)
+ .Bind("STOP_TIME"_s, &TestArguments::StopTime)
+ .Bind("TEST_LOAD"_s, &TestArguments::TestLoad)
+ .Bind("RESOURCE_SPEC_FILE"_s, &TestArguments::ResourceSpecFile)
+ .Bind("STOP_ON_FAILURE"_s, &TestArguments::StopOnFailure)
+ .Bind("OUTPUT_JUNIT"_s, &TestArguments::OutputJUnit);
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+private:
std::string GetName() const override { return "ctest_test"; }
-protected:
- void BindArguments() override;
- virtual cmCTestTestHandler* InitializeActualHandler();
- cmCTestGenericHandler* InitializeHandler() override;
+ virtual std::unique_ptr<cmCTestTestHandler> InitializeActualHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const;
+
+ std::unique_ptr<cmCTestGenericHandler> InitializeHandler(
+ HandlerArguments& arguments, cmExecutionStatus& status) const override;
- std::string Start;
- std::string End;
- std::string Stride;
- std::string Exclude;
- std::string Include;
- std::string ExcludeLabel;
- std::string IncludeLabel;
- std::string IncludeTestsFromFile;
- std::string ExcludeTestsFromFile;
- std::string ExcludeFixture;
- std::string ExcludeFixtureSetup;
- std::string ExcludeFixtureCleanup;
- cm::optional<ArgumentParser::Maybe<std::string>> ParallelLevel;
- std::string Repeat;
- std::string ScheduleRandom;
- std::string StopTime;
- std::string TestLoad;
- std::string ResourceSpecFile;
- std::string OutputJUnit;
- bool StopOnFailure = false;
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c7875cd..ef2359f 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestTestHandler.h"
#include <algorithm>
@@ -8,7 +8,6 @@
#include <cstddef> // IWYU pragma: keep
#include <cstdio>
#include <cstdlib>
-#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
@@ -42,6 +41,8 @@
#include "cmExecutionStatus.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmState.h"
@@ -65,8 +66,8 @@ public:
}
virtual ~cmCTestCommand() = default;
- cmCTestCommand(const cmCTestCommand&) = default;
- cmCTestCommand& operator=(const cmCTestCommand&) = default;
+ cmCTestCommand(cmCTestCommand const&) = default;
+ cmCTestCommand& operator=(cmCTestCommand const&) = default;
bool operator()(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status)
@@ -97,11 +98,10 @@ bool ReadSubdirectory(std::string fname, cmExecutionStatus& status)
{
cmWorkingDirectory workdir(fname);
if (workdir.Failed()) {
- status.SetError("Failed to change directory to " + fname + " : " +
- std::strerror(workdir.GetLastResult()));
+ status.SetError(workdir.GetError());
return false;
}
- const char* testFilename;
+ char const* testFilename;
if (cmSystemTools::FileExists("CTestTestfile.cmake")) {
// does the CTestTestfile.cmake exist ?
testFilename = "CTestTestfile.cmake";
@@ -130,7 +130,7 @@ bool cmCTestSubdirCommand(std::vector<std::string> const& args,
status.SetError("called with incorrect number of arguments");
return false;
}
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmSystemTools::GetLogicalWorkingDirectory();
for (std::string const& arg : args) {
std::string fname;
@@ -156,7 +156,7 @@ bool cmCTestAddSubdirectoryCommand(std::vector<std::string> const& args,
}
std::string fname =
- cmStrCat(cmSystemTools::GetCurrentWorkingDirectory(), '/', args[0]);
+ cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(), '/', args[0]);
return ReadSubdirectory(std::move(fname), status);
}
@@ -276,25 +276,10 @@ inline int GetNextRealNumber(std::string const& in, double& val,
} // namespace
-cmCTestTestHandler::cmCTestTestHandler()
+cmCTestTestHandler::cmCTestTestHandler(cmCTest* ctest)
+ : Superclass(ctest)
+ , TestOptions(ctest->GetTestOptions())
{
- this->UseUnion = false;
-
- this->UseIncludeRegExpFlag = false;
- this->UseExcludeRegExpFlag = false;
- this->UseExcludeRegExpFirst = false;
-
- this->CustomMaximumPassedTestOutputSize = 1 * 1024;
- this->CustomMaximumFailedTestOutputSize = 300 * 1024;
- this->TestOutputTruncation = cmCTestTypes::TruncationMode::Tail;
-
- this->MemCheck = false;
-
- this->LogFile = nullptr;
-
- // Support for JUnit XML output.
- this->JUnitXMLFileName = "";
-
// Regular expressions to scan test output for custom measurements.
// Capture the whole section of test output from the first opening
@@ -315,46 +300,6 @@ cmCTestTestHandler::cmCTestTestHandler()
this->CustomLabelRegex.compile("<CTestLabel>(.*)</CTestLabel>");
}
-void cmCTestTestHandler::Initialize()
-{
- this->Superclass::Initialize();
-
- this->ElapsedTestingTime = cmDuration();
-
- this->TestResults.clear();
-
- this->CustomTestsIgnore.clear();
- this->StartTest.clear();
- this->EndTest.clear();
-
- this->CustomPreTest.clear();
- this->CustomPostTest.clear();
- this->CustomMaximumPassedTestOutputSize = 1 * 1024;
- this->CustomMaximumFailedTestOutputSize = 300 * 1024;
- this->TestOutputTruncation = cmCTestTypes::TruncationMode::Tail;
-
- this->TestsToRun.clear();
-
- this->UseIncludeRegExpFlag = false;
- this->UseExcludeRegExpFlag = false;
- this->UseExcludeRegExpFirst = false;
- this->IncludeLabelRegularExpressions.clear();
- this->ExcludeLabelRegularExpressions.clear();
- this->IncludeRegExp.clear();
- this->ExcludeRegExp.clear();
- this->ExcludeFixtureRegExp.clear();
- this->ExcludeFixtureSetupRegExp.clear();
- this->ExcludeFixtureCleanupRegExp.clear();
- this->TestListFile.clear();
- this->ExcludeTestListFile.clear();
- this->TestsToRunByName.reset();
- this->TestsToExcludeByName.reset();
-
- this->TestsToRunString.clear();
- this->UseUnion = false;
- this->TestList.clear();
-}
-
void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
{
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_TEST",
@@ -365,14 +310,14 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
this->CustomTestsIgnore);
this->CTest->PopulateCustomInteger(
mf, "CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE",
- this->CustomMaximumPassedTestOutputSize);
+ this->TestOptions.OutputSizePassed);
this->CTest->PopulateCustomInteger(
mf, "CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE",
- this->CustomMaximumFailedTestOutputSize);
+ this->TestOptions.OutputSizeFailed);
cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION");
if (dval) {
- if (!this->SetTestOutputTruncation(*dval)) {
+ if (!SetTruncationMode(this->TestOptions.OutputTruncation, *dval)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: "
<< *dval << std::endl);
@@ -411,7 +356,7 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
(this->MemCheck ? "Memory check" : "Test")
<< " project "
- << cmSystemTools::GetCurrentWorkingDirectory()
+ << cmSystemTools::GetLogicalWorkingDirectory()
<< std::endl,
this->Quiet);
if (!this->PreProcessHandler()) {
@@ -506,11 +451,11 @@ int cmCTestTestHandler::ProcessHandler()
* regular expressions in `expressions`. Skip empty values.
* Returns true if there were any expressions.
*/
-static bool BuildLabelRE(const std::vector<std::string>& parts,
+static bool BuildLabelRE(std::vector<std::string> const& parts,
std::vector<cmsys::RegularExpression>& expressions)
{
expressions.clear();
- for (const auto& p : parts) {
+ for (auto const& p : parts) {
if (!p.empty()) {
expressions.emplace_back(p);
}
@@ -521,12 +466,11 @@ static bool BuildLabelRE(const std::vector<std::string>& parts,
bool cmCTestTestHandler::ProcessOptions()
{
// Update internal data structure from generic one
- this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
- this->SetUseUnion(this->GetOption("UseUnion").IsOn());
- if (this->GetOption("ScheduleRandom").IsOn()) {
+ this->SetTestsToRunInformation(this->TestOptions.TestsToRunInformation);
+ if (this->TestOptions.ScheduleRandom) {
this->CTest->SetScheduleType("Random");
}
- if (cmValue repeat = this->GetOption("Repeat")) {
+ if (auto repeat = this->Repeat) {
cmsys::RegularExpression repeatRegex(
"^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$");
if (repeatRegex.find(*repeat)) {
@@ -550,8 +494,8 @@ bool cmCTestTestHandler::ProcessOptions()
return false;
}
}
- if (cmValue parallelLevel = this->GetOption("ParallelLevel")) {
- if (parallelLevel.IsEmpty()) {
+ if (auto parallelLevel = this->ParallelLevel) {
+ if (parallelLevel->empty()) {
// An empty value tells ctest to choose a default.
this->CTest->SetParallelLevel(cm::nullopt);
} else {
@@ -567,56 +511,26 @@ bool cmCTestTestHandler::ProcessOptions()
}
}
- if (this->GetOption("StopOnFailure")) {
+ if (this->TestOptions.StopOnFailure) {
this->CTest->SetStopOnFailure(true);
}
- BuildLabelRE(this->GetMultiOption("LabelRegularExpression"),
+ BuildLabelRE(this->TestOptions.LabelRegularExpression,
this->IncludeLabelRegularExpressions);
- BuildLabelRE(this->GetMultiOption("ExcludeLabelRegularExpression"),
+ BuildLabelRE(this->TestOptions.ExcludeLabelRegularExpression,
this->ExcludeLabelRegularExpressions);
- cmValue val = this->GetOption("IncludeRegularExpression");
- if (val) {
+ if (!this->TestOptions.IncludeRegularExpression.empty()) {
this->UseIncludeRegExp();
- this->SetIncludeRegExp(*val);
}
- val = this->GetOption("ExcludeRegularExpression");
- if (val) {
+ if (!this->TestOptions.ExcludeRegularExpression.empty()) {
this->UseExcludeRegExp();
- this->SetExcludeRegExp(*val);
- }
- val = this->GetOption("ExcludeFixtureRegularExpression");
- if (val) {
- this->ExcludeFixtureRegExp = *val;
- }
- val = this->GetOption("ExcludeFixtureSetupRegularExpression");
- if (val) {
- this->ExcludeFixtureSetupRegExp = *val;
}
- val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
- if (val) {
- this->ExcludeFixtureCleanupRegExp = *val;
- }
- val = this->GetOption("ResourceSpecFile");
- if (val) {
- this->ResourceSpecFile = *val;
- }
- val = this->GetOption("TestListFile");
- if (val) {
- this->TestListFile = val;
- }
- val = this->GetOption("ExcludeTestListFile");
- if (val) {
- this->ExcludeTestListFile = val;
- }
- this->SetRerunFailed(this->GetOption("RerunFailed").IsOn());
-
return true;
}
-void cmCTestTestHandler::LogTestSummary(const std::vector<std::string>& passed,
- const std::vector<std::string>& failed,
- const cmDuration& durationInSecs)
+void cmCTestTestHandler::LogTestSummary(std::vector<std::string> const& passed,
+ std::vector<std::string> const& failed,
+ cmDuration const& durationInSecs)
{
std::size_t total = passed.size() + failed.size();
@@ -655,7 +569,7 @@ void cmCTestTestHandler::LogTestSummary(const std::vector<std::string>& passed,
}
void cmCTestTestHandler::LogDisabledTests(
- const std::vector<cmCTestTestResult>& disabledTests)
+ std::vector<cmCTestTestResult> const& disabledTests)
{
if (!disabledTests.empty()) {
cmGeneratedFileStream ofs;
@@ -664,7 +578,7 @@ void cmCTestTestHandler::LogDisabledTests(
<< "The following tests did not run:" << std::endl);
this->StartLogFile("TestsDisabled", ofs);
- const char* disabled_reason;
+ char const* disabled_reason;
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetColorCode(cmCTest::Color::BLUE));
for (cmCTestTestResult const& dt : disabledTests) {
@@ -683,8 +597,8 @@ void cmCTestTestHandler::LogDisabledTests(
}
}
-void cmCTestTestHandler::LogFailedTests(const std::vector<std::string>& failed,
- const SetOfTests& resultsSet)
+void cmCTestTestHandler::LogFailedTests(std::vector<std::string> const& failed,
+ SetOfTests const& resultsSet)
{
if (!failed.empty()) {
cmGeneratedFileStream ofs;
@@ -705,7 +619,7 @@ void cmCTestTestHandler::LogFailedTests(const std::vector<std::string>& failed,
std::string ft_name_and_status =
cmStrCat(ft.Name, " (", this->GetTestStatus(ft), ")");
std::string labels;
- const cmCTestTestProperties& p = *ft.Properties;
+ cmCTestTestProperties const& p = *ft.Properties;
if (!p.Labels.empty()) {
static size_t const maxLen = 50;
size_t const ns = ft_name_and_status.size() >= maxLen
@@ -850,10 +764,10 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject)
* in order for the filter to apply to the test).
*/
static bool MatchLabelsAgainstFilterRE(
- const std::vector<std::string>& labels,
- const std::vector<cmsys::RegularExpression>& expressions)
+ std::vector<std::string> const& labels,
+ std::vector<cmsys::RegularExpression> const& expressions)
{
- for (const auto& re : expressions) {
+ for (auto const& re : expressions) {
// check to see if the label regular expression matches
bool found = false; // assume it does not match
cmsys::RegularExpressionMatch match;
@@ -922,7 +836,7 @@ bool cmCTestTestHandler::ComputeTestList()
return false;
}
- if (this->RerunFailed) {
+ if (this->TestOptions.RerunFailed) {
return this->ComputeTestListForRerunFailed();
}
@@ -936,7 +850,7 @@ bool cmCTestTestHandler::ComputeTestList()
}
}
// expand the test list based on the union flag
- if (this->UseUnion) {
+ if (this->TestOptions.UseUnion) {
this->ExpandTestsToRunInformation(static_cast<int>(tmsize));
} else {
this->ExpandTestsToRunInformation(inREcnt);
@@ -951,7 +865,7 @@ bool cmCTestTestHandler::ComputeTestList()
inREcnt++;
}
- if (this->UseUnion) {
+ if (this->TestOptions.UseUnion) {
// if it is not in the list and not in the regexp then skip
if ((!this->TestsToRun.empty() &&
!cm::contains(this->TestsToRun, cnt)) &&
@@ -1034,22 +948,24 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
this->Quiet);
// Prepare regular expression evaluators
- std::string setupRegExp(this->ExcludeFixtureRegExp);
- std::string cleanupRegExp(this->ExcludeFixtureRegExp);
- if (!this->ExcludeFixtureSetupRegExp.empty()) {
+ std::string setupRegExp(this->TestOptions.ExcludeFixtureRegularExpression);
+ std::string cleanupRegExp(this->TestOptions.ExcludeFixtureRegularExpression);
+ if (!this->TestOptions.ExcludeFixtureSetupRegularExpression.empty()) {
if (setupRegExp.empty()) {
- setupRegExp = this->ExcludeFixtureSetupRegExp;
+ setupRegExp = this->TestOptions.ExcludeFixtureSetupRegularExpression;
} else {
- setupRegExp.append("(" + setupRegExp + ")|(" +
- this->ExcludeFixtureSetupRegExp + ")");
+ setupRegExp.append(
+ "(" + setupRegExp + ")|(" +
+ this->TestOptions.ExcludeFixtureSetupRegularExpression + ")");
}
}
- if (!this->ExcludeFixtureCleanupRegExp.empty()) {
+ if (!this->TestOptions.ExcludeFixtureCleanupRegularExpression.empty()) {
if (cleanupRegExp.empty()) {
- cleanupRegExp = this->ExcludeFixtureCleanupRegExp;
+ cleanupRegExp = this->TestOptions.ExcludeFixtureCleanupRegularExpression;
} else {
- cleanupRegExp.append("(" + cleanupRegExp + ")|(" +
- this->ExcludeFixtureCleanupRegExp + ")");
+ cleanupRegExp.append(
+ "(" + cleanupRegExp + ")|(" +
+ this->TestOptions.ExcludeFixtureCleanupRegularExpression + ")");
}
}
cmsys::RegularExpression excludeSetupRegex(setupRegExp);
@@ -1064,7 +980,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
FixtureDependencies fixtureCleanups;
for (auto it = this->TestList.begin(); it != this->TestList.end(); ++it) {
- const cmCTestTestProperties& p = *it;
+ cmCTestTestProperties const& p = *it;
for (std::string const& deps : p.FixturesSetup) {
fixtureSetups.insert(std::make_pair(deps, it));
@@ -1125,7 +1041,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
std::pair<FixtureDepsIterator, FixtureDepsIterator> setupRange =
fixtureSetups.equal_range(requiredFixtureName);
for (auto sIt = setupRange.first; sIt != setupRange.second; ++sIt) {
- const std::string& setupTestName = sIt->second->Name;
+ std::string const& setupTestName = sIt->second->Name;
tests[i].RequireSuccessDepends.insert(setupTestName);
if (!cm::contains(tests[i].Depends, setupTestName)) {
tests[i].Depends.push_back(setupTestName);
@@ -1149,7 +1065,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
fixtureSetups.equal_range(requiredFixtureName);
for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) {
ListOfTests::const_iterator lotIt = it->second;
- const cmCTestTestProperties& p = *lotIt;
+ cmCTestTestProperties const& p = *lotIt;
if (!addedTests.insert(p.Name).second) {
// Already have p in our test list
@@ -1180,7 +1096,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
fixtureCleanups.equal_range(requiredFixtureName);
for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) {
ListOfTests::const_iterator lotIt = it->second;
- const cmCTestTestProperties& p = *lotIt;
+ cmCTestTestProperties const& p = *lotIt;
if (!addedTests.insert(p.Name).second) {
// Already have p in our test list
@@ -1221,16 +1137,16 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
// pathological case where setup and cleanup tests are in the test set
// but no other test has that fixture as a requirement.
for (cmCTestTestProperties& p : tests) {
- const std::set<std::string>& cleanups = p.FixturesCleanup;
+ std::set<std::string> const& cleanups = p.FixturesCleanup;
for (std::string const& fixture : cleanups) {
// This cleanup test could be part of the original test list that was
// passed in. It is then possible that no other test requires the
// fIt fixture, so we have to check for this.
auto cIt = fixtureRequirements.find(fixture);
if (cIt != fixtureRequirements.end()) {
- const std::vector<size_t>& indices = cIt->second;
+ std::vector<size_t> const& indices = cIt->second;
for (size_t index : indices) {
- const std::string& reqTestName = tests[index].Name;
+ std::string const& reqTestName = tests[index].Name;
if (!cm::contains(p.Depends, reqTestName)) {
p.Depends.push_back(reqTestName);
}
@@ -1241,9 +1157,9 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
// if no other test cases require the fixture
cIt = setupFixturesAdded.find(fixture);
if (cIt != setupFixturesAdded.end()) {
- const std::vector<size_t>& indices = cIt->second;
+ std::vector<size_t> const& indices = cIt->second;
for (size_t index : indices) {
- const std::string& setupTestName = tests[index].Name;
+ std::string const& setupTestName = tests[index].Name;
if (!cm::contains(p.Depends, setupTestName)) {
p.Depends.push_back(setupTestName);
}
@@ -1273,7 +1189,7 @@ void cmCTestTestHandler::UpdateMaxTestNameWidth()
}
}
-bool cmCTestTestHandler::GetValue(const char* tag, int& value,
+bool cmCTestTestHandler::GetValue(char const* tag, int& value,
std::istream& fin)
{
std::string line;
@@ -1291,7 +1207,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, int& value,
return ret;
}
-bool cmCTestTestHandler::GetValue(const char* tag, double& value,
+bool cmCTestTestHandler::GetValue(char const* tag, double& value,
std::istream& fin)
{
std::string line;
@@ -1309,7 +1225,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, double& value,
return ret;
}
-bool cmCTestTestHandler::GetValue(const char* tag, bool& value,
+bool cmCTestTestHandler::GetValue(char const* tag, bool& value,
std::istream& fin)
{
std::string line;
@@ -1336,7 +1252,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, bool& value,
return ret;
}
-bool cmCTestTestHandler::GetValue(const char* tag, size_t& value,
+bool cmCTestTestHandler::GetValue(char const* tag, size_t& value,
std::istream& fin)
{
std::string line;
@@ -1354,7 +1270,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, size_t& value,
return ret;
}
-bool cmCTestTestHandler::GetValue(const char* tag, std::string& value,
+bool cmCTestTestHandler::GetValue(char const* tag, std::string& value,
std::istream& fin)
{
std::string line;
@@ -1431,7 +1347,7 @@ bool cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
tests[p.Index].Depends = depends;
properties[p.Index] = &p;
}
- parallel->SetResourceSpecFile(this->ResourceSpecFile);
+ parallel->SetResourceSpecFile(this->TestOptions.ResourceSpecFile);
if (!parallel->SetTests(std::move(tests), std::move(properties))) {
return false;
}
@@ -1467,7 +1383,10 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
return;
}
- this->CTest->StartXML(xml, this->AppendXML);
+ this->CTest->GetInstrumentation().CollectTimingData(
+ cmInstrumentationQuery::Hook::PrepareForCDash);
+
+ this->CTest->StartXML(xml, this->CMake, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("Testing");
xml.Element("StartDateTime", this->StartTest);
@@ -1481,7 +1400,6 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
for (cmCTestTestResult& result : this->TestResults) {
this->WriteTestResultHeader(xml, result);
xml.StartElement("Results");
-
if (result.Status != cmCTestTestHandler::NOT_RUN) {
if (result.Status != cmCTestTestHandler::COMPLETED ||
result.ReturnValue) {
@@ -1504,7 +1422,7 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
xml.Element("Value", result.ExecutionTime.count());
xml.EndElement(); // NamedMeasurement
if (!result.Reason.empty()) {
- const char* reasonType = "Pass Reason";
+ char const* reasonType = "Pass Reason";
if (result.Status != cmCTestTestHandler::COMPLETED) {
reasonType = "Fail Reason";
}
@@ -1559,6 +1477,15 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
xml.Content(result.Output);
xml.EndElement(); // Value
xml.EndElement(); // Measurement
+
+ if (!result.InstrumentationFile.empty()) {
+ std::string instrument_file_path =
+ cmStrCat(this->CTest->GetInstrumentation().GetCDashDir(), "/test/",
+ result.InstrumentationFile);
+ this->CTest->ConvertInstrumentationJSONFileToXML(instrument_file_path,
+ xml);
+ }
+
xml.EndElement(); // Results
this->AttachFiles(xml, result);
@@ -1626,7 +1553,7 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml,
void cmCTestTestHandler::AttachFile(cmXMLWriter& xml, std::string const& file,
std::string const& name)
{
- const std::string& base64 = this->CTest->Base64GzipEncodeFile(file);
+ std::string const& base64 = this->CTest->Base64GzipEncodeFile(file);
std::string const fname = cmSystemTools::GetFilenameName(file);
xml.StartElement("NamedMeasurement");
std::string measurement_name = name;
@@ -1661,7 +1588,7 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
}
// Find the appropriate executable to run for a test
-std::string cmCTestTestHandler::FindTheExecutable(const std::string& exe)
+std::string cmCTestTestHandler::FindTheExecutable(std::string const& exe)
{
std::string resConfig;
std::vector<std::string> extraPaths;
@@ -1722,7 +1649,7 @@ void cmCTestTestHandler::AddConfigurations(
// Find the appropriate executable to run for a test
std::string cmCTestTestHandler::FindExecutable(
- cmCTest* ctest, const std::string& testCommand, std::string& resultingConfig,
+ cmCTest* ctest, std::string const& testCommand, std::string& resultingConfig,
std::vector<std::string>& extraPaths, std::vector<std::string>& failed)
{
// now run the compiled test if we can find it
@@ -1761,7 +1688,7 @@ std::string cmCTestTestHandler::FindExecutable(
for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) {
// first check without exe extension
if (cmSystemTools::FileExists(attempted[ai], true)) {
- fullPath = cmSystemTools::CollapseFullPath(attempted[ai]);
+ fullPath = cmSystemTools::ToNormalizedPathOnDisk(attempted[ai]);
resultingConfig = attemptedConfigs[ai];
}
// then try with the exe extension
@@ -1770,7 +1697,7 @@ std::string cmCTestTestHandler::FindExecutable(
tempPath =
cmStrCat(attempted[ai], cmSystemTools::GetExecutableExtension());
if (cmSystemTools::FileExists(tempPath, true)) {
- fullPath = cmSystemTools::CollapseFullPath(tempPath);
+ fullPath = cmSystemTools::ToNormalizedPathOnDisk(tempPath);
resultingConfig = attemptedConfigs[ai];
} else {
failed.push_back(tempPath);
@@ -1781,7 +1708,7 @@ std::string cmCTestTestHandler::FindExecutable(
// if everything else failed, check the users path, but only if a full path
// wasn't specified
if (fullPath.empty() && filepath.empty()) {
- std::string path = cmSystemTools::FindProgram(filename.c_str());
+ std::string path = cmSystemTools::FindProgram(filename);
if (!path.empty()) {
resultingConfig.clear();
return path;
@@ -1801,7 +1728,7 @@ std::string cmCTestTestHandler::FindExecutable(
}
bool cmCTestTestHandler::ParseResourceGroupsProperty(
- const std::string& val,
+ std::string const& val,
std::vector<std::vector<cmCTestTestResourceRequirement>>& resourceGroups)
{
cmCTestResourceGroupsLexerHelper lexer(resourceGroups);
@@ -1810,11 +1737,13 @@ bool cmCTestTestHandler::ParseResourceGroupsProperty(
bool cmCTestTestHandler::GetListOfTests()
{
- if (!this->IncludeRegExp.empty()) {
- this->IncludeTestsRegularExpression.compile(this->IncludeRegExp);
+ if (!this->TestOptions.IncludeRegularExpression.empty()) {
+ this->IncludeTestsRegularExpression.compile(
+ this->TestOptions.IncludeRegularExpression);
}
- if (!this->ExcludeRegExp.empty()) {
- this->ExcludeTestsRegularExpression.compile(this->ExcludeRegExp);
+ if (!this->TestOptions.ExcludeRegularExpression.empty()) {
+ this->ExcludeTestsRegularExpression.compile(
+ this->TestOptions.ExcludeRegularExpression);
}
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Constructing a list of tests" << std::endl, this->Quiet);
@@ -1845,7 +1774,7 @@ bool cmCTestTestHandler::GetListOfTests()
cm.GetState()->AddBuiltinCommand("set_directory_properties",
cmCTestSetDirectoryPropertiesCommand(this));
- const char* testFilename;
+ char const* testFilename;
if (cmSystemTools::FileExists("CTestTestfile.cmake")) {
// does the CTestTestfile.cmake exist ?
testFilename = "CTestTestfile.cmake";
@@ -1864,19 +1793,20 @@ bool cmCTestTestHandler::GetListOfTests()
return false;
}
cmValue specFile = mf.GetDefinition("CTEST_RESOURCE_SPEC_FILE");
- if (this->ResourceSpecFile.empty() && specFile) {
- this->ResourceSpecFile = *specFile;
+ if (this->TestOptions.ResourceSpecFile.empty() && specFile) {
+ this->TestOptions.ResourceSpecFile = *specFile;
}
- if (!this->TestListFile.empty()) {
- this->TestsToRunByName = this->ReadTestListFile(this->TestListFile);
+ if (!this->TestOptions.TestListFile.empty()) {
+ this->TestsToRunByName =
+ this->ReadTestListFile(this->TestOptions.TestListFile);
if (!this->TestsToRunByName) {
return false;
}
}
- if (!this->ExcludeTestListFile.empty()) {
+ if (!this->TestOptions.ExcludeTestListFile.empty()) {
this->TestsToExcludeByName =
- this->ReadTestListFile(this->ExcludeTestListFile);
+ this->ReadTestListFile(this->TestOptions.ExcludeTestListFile);
if (!this->TestsToExcludeByName) {
return false;
}
@@ -1901,7 +1831,7 @@ void cmCTestTestHandler::UseExcludeRegExp()
std::string cmCTestTestHandler::GetTestStatus(cmCTestTestResult const& result)
{
- static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT",
+ static char const* statuses[] = { "Not Run", "Timeout", "SEGFAULT",
"ILLEGAL", "INTERRUPT", "NUMERICAL",
"OTHER_FAULT", "Failed", "BAD_COMMAND",
"Completed" };
@@ -2091,7 +2021,7 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
xml.EndElement();
} else if (parser.ElementName == "CTestMeasurementFile" ||
parser.ElementName == "DartMeasurementFile") {
- const std::string& filename = cmCTest::CleanString(parser.CharacterData);
+ std::string const& filename = cmCTest::CleanString(parser.CharacterData);
if (!cmSystemTools::FileExists(filename)) {
xml.StartElement("NamedMeasurement");
xml.Attribute("name", parser.MeasurementName);
@@ -2153,41 +2083,14 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
}
}
-void cmCTestTestHandler::SetIncludeRegExp(const std::string& arg)
-{
- this->IncludeRegExp = arg;
-}
-
-void cmCTestTestHandler::SetExcludeRegExp(const std::string& arg)
-{
- this->ExcludeRegExp = arg;
-}
-
-bool cmCTestTestHandler::SetTestOutputTruncation(const std::string& mode)
-{
- if (mode == "tail") {
- this->TestOutputTruncation = cmCTestTypes::TruncationMode::Tail;
- } else if (mode == "middle") {
- this->TestOutputTruncation = cmCTestTypes::TruncationMode::Middle;
- } else if (mode == "head") {
- this->TestOutputTruncation = cmCTestTypes::TruncationMode::Head;
- } else {
- return false;
- }
- return true;
-}
-
-void cmCTestTestHandler::SetTestsToRunInformation(cmValue in)
+void cmCTestTestHandler::SetTestsToRunInformation(std::string const& in)
{
- if (!in) {
- return;
- }
- this->TestsToRunString = *in;
+ this->TestsToRunString = in;
// if the argument is a file, then read it and use the contents as the
// string
- if (cmSystemTools::FileExists(*in)) {
- cmsys::ifstream fin(in->c_str());
- unsigned long filelen = cmSystemTools::FileLength(*in);
+ if (cmSystemTools::FileExists(in)) {
+ cmsys::ifstream fin(in.c_str());
+ unsigned long filelen = cmSystemTools::FileLength(in);
auto buff = cm::make_unique<char[]>(filelen + 1);
fin.getline(buff.get(), filelen);
buff[fin.gcount()] = 0;
@@ -2206,12 +2109,12 @@ void cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length,
// Advance n bytes in string delimited by begin/end but do not break in the
// middle of a multi-byte UTF-8 encoding.
auto utf8_advance = [](char const* const begin, char const* const end,
- size_t n) -> const char* {
+ size_t n) -> char const* {
char const* const stop = begin + n;
char const* current = begin;
while (current < stop) {
unsigned int ch;
- if (const char* next = cm_utf8_decode_character(current, end, &ch)) {
+ if (char const* next = cm_utf8_decode_character(current, end, &ch)) {
if (next > stop) {
break;
}
@@ -2225,10 +2128,10 @@ void cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length,
};
// Truncation message.
- const std::string msg =
- "\n[This part of the test output was removed since it "
- "exceeds the threshold of " +
- std::to_string(length) + " bytes.]\n";
+ std::string const msg =
+ cmStrCat("\n[This part of the test output was removed since it exceeds "
+ "the threshold of ",
+ length, " bytes.]\n");
char const* const begin = output.c_str();
char const* const end = begin + output.size();
@@ -2260,7 +2163,7 @@ void cmCTestTestHandler::cmCTestTestProperties::AppendError(
}
bool cmCTestTestHandler::SetTestsProperties(
- const std::vector<std::string>& args)
+ std::vector<std::string> const& args)
{
std::vector<std::string>::const_iterator it;
std::vector<std::string> tests;
@@ -2470,7 +2373,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
bool cmCTestTestHandler::SetDirectoryProperties(
- const std::vector<std::string>& args)
+ std::vector<std::string> const& args)
{
std::vector<std::string>::const_iterator it;
std::vector<std::string> tests;
@@ -2495,7 +2398,7 @@ bool cmCTestTestHandler::SetDirectoryProperties(
}
std::string const& val = *it;
for (cmCTestTestProperties& rt : this->TestList) {
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmSystemTools::GetLogicalWorkingDirectory();
if (cwd == rt.Directory) {
if (key == "LABELS"_s) {
cmList DirectoryLabels{ val };
@@ -2514,9 +2417,9 @@ bool cmCTestTestHandler::SetDirectoryProperties(
return true;
}
-bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
+bool cmCTestTestHandler::AddTest(std::vector<std::string> const& args)
{
- const std::string& testname = args[0];
+ std::string const& testname = args[0];
cmCTestOptionalLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl,
this->Quiet);
@@ -2559,7 +2462,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
cmCTestTestProperties test;
test.Name = testname;
test.Args = args;
- test.Directory = cmSystemTools::GetCurrentWorkingDirectory();
+ test.Directory = cmSystemTools::GetLogicalWorkingDirectory();
cmCTestOptionalLog(this->CTest, DEBUG,
"Set test directory: " << test.Directory << std::endl,
this->Quiet);
@@ -2575,7 +2478,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator==(
- const cmCTestTestResourceRequirement& other) const
+ cmCTestTestResourceRequirement const& other) const
{
return this->ResourceType == other.ResourceType &&
this->SlotsNeeded == other.SlotsNeeded &&
@@ -2583,29 +2486,29 @@ bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator==(
}
bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator!=(
- const cmCTestTestResourceRequirement& other) const
+ cmCTestTestResourceRequirement const& other) const
{
return !(*this == other);
}
-void cmCTestTestHandler::SetJUnitXMLFileName(const std::string& filename)
+void cmCTestTestHandler::SetJUnitXMLFileName(std::string const& filename)
{
- this->JUnitXMLFileName = filename;
+ this->TestOptions.JUnitXMLFileName = filename;
}
bool cmCTestTestHandler::WriteJUnitXML()
{
- if (this->JUnitXMLFileName.empty()) {
+ if (this->TestOptions.JUnitXMLFileName.empty()) {
return true;
}
// Open new XML file for writing.
cmGeneratedFileStream xmlfile;
xmlfile.SetTempExt("tmp");
- xmlfile.Open(this->JUnitXMLFileName);
+ xmlfile.Open(this->TestOptions.JUnitXMLFileName);
if (!xmlfile) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Problem opening file: " << this->JUnitXMLFileName
+ "Problem opening file: " << this->TestOptions.JUnitXMLFileName
<< std::endl);
return false;
}
@@ -2657,7 +2560,7 @@ bool cmCTestTestHandler::WriteJUnitXML()
"time",
std::chrono::duration_cast<std::chrono::seconds>(this->ElapsedTestingTime)
.count());
- const std::time_t start_test_time_t =
+ std::time_t const start_test_time_t =
std::chrono::system_clock::to_time_t(this->StartTestTime);
cmTimestamp cmts;
xml.Attribute("timestamp",
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index c35af3f..6ad2e60 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,11 +24,39 @@
#include "cmCTestTypes.h" // IWYU pragma: keep
#include "cmDuration.h"
#include "cmListFileCache.h"
-#include "cmValue.h"
class cmMakefile;
class cmXMLWriter;
+struct cmCTestTestOptions
+{
+ bool RerunFailed = false;
+ bool ScheduleRandom = false;
+ bool StopOnFailure = false;
+ bool UseUnion = false;
+
+ int OutputSizePassed = 1 * 1024;
+ int OutputSizeFailed = 300 * 1024;
+ cmCTestTypes::TruncationMode OutputTruncation =
+ cmCTestTypes::TruncationMode::Tail;
+
+ std::string TestsToRunInformation;
+ std::string IncludeRegularExpression;
+ std::string ExcludeRegularExpression;
+
+ std::vector<std::string> LabelRegularExpression;
+ std::vector<std::string> ExcludeLabelRegularExpression;
+
+ std::string ExcludeFixtureRegularExpression;
+ std::string ExcludeFixtureSetupRegularExpression;
+ std::string ExcludeFixtureCleanupRegularExpression;
+
+ std::string TestListFile;
+ std::string ExcludeTestListFile;
+ std::string ResourceSpecFile;
+ std::string JUnitXMLFileName;
+};
+
/** \class cmCTestTestHandler
* \brief A class that handles ctest -S invocations
*
@@ -48,19 +76,6 @@ public:
int ProcessHandler() override;
/**
- * When both -R and -I are used should the resulting test list be the
- * intersection or the union of the lists. By default it is the
- * intersection.
- */
- void SetUseUnion(bool val) { this->UseUnion = val; }
-
- /**
- * Set whether or not CTest should only execute the tests that failed
- * on the previous run. By default this is false.
- */
- void SetRerunFailed(bool val) { this->RerunFailed = val; }
-
- /**
* This method is called when reading CTest custom file
*/
void PopulateCustomVectors(cmMakefile* mf) override;
@@ -69,45 +84,29 @@ public:
/// them on
void UseIncludeRegExp();
void UseExcludeRegExp();
- void SetIncludeRegExp(const std::string&);
- void SetExcludeRegExp(const std::string&);
void SetMaxIndex(int n) { this->MaxIndex = n; }
int GetMaxIndex() { return this->MaxIndex; }
- void SetTestOutputSizePassed(int n)
- {
- this->CustomMaximumPassedTestOutputSize = n;
- }
- void SetTestOutputSizeFailed(int n)
- {
- this->CustomMaximumFailedTestOutputSize = n;
- }
-
- //! Set test output truncation mode. Return false if unknown mode.
- bool SetTestOutputTruncation(const std::string& mode);
-
//! pass the -I argument down
- void SetTestsToRunInformation(cmValue);
+ void SetTestsToRunInformation(std::string const& in);
- cmCTestTestHandler();
+ cmCTestTestHandler(cmCTest* ctest);
/*
* Add the test to the list of tests to be executed
*/
- bool AddTest(const std::vector<std::string>& args);
+ bool AddTest(std::vector<std::string> const& args);
/*
* Set tests properties
*/
- bool SetTestsProperties(const std::vector<std::string>& args);
+ bool SetTestsProperties(std::vector<std::string> const& args);
/**
* Set directory properties
*/
- bool SetDirectoryProperties(const std::vector<std::string>& args);
-
- void Initialize() override;
+ bool SetDirectoryProperties(std::vector<std::string> const& args);
struct cmCTestTestResourceRequirement
{
@@ -115,8 +114,8 @@ public:
int SlotsNeeded;
int UnitsNeeded;
- bool operator==(const cmCTestTestResourceRequirement& other) const;
- bool operator!=(const cmCTestTestResourceRequirement& other) const;
+ bool operator==(cmCTestTestResourceRequirement const& other) const;
+ bool operator!=(cmCTestTestResourceRequirement const& other) const;
};
struct Signal
@@ -193,14 +192,15 @@ public:
std::string CustomCompletionStatus;
std::string Output;
std::string TestMeasurementsOutput;
+ std::string InstrumentationFile;
int TestCount = 0;
cmCTestTestProperties* Properties = nullptr;
};
struct cmCTestTestResultLess
{
- bool operator()(const cmCTestTestResult& lhs,
- const cmCTestTestResult& rhs) const
+ bool operator()(cmCTestTestResult const& lhs,
+ cmCTestTestResult const& rhs) const
{
return lhs.TestCount < rhs.TestCount;
}
@@ -214,19 +214,19 @@ public:
// full signature static method to find an executable
static std::string FindExecutable(cmCTest* ctest,
- const std::string& testCommand,
+ std::string const& testCommand,
std::string& resultingConfig,
std::vector<std::string>& extraPaths,
std::vector<std::string>& failed);
static bool ParseResourceGroupsProperty(
- const std::string& val,
+ std::string const& val,
std::vector<std::vector<cmCTestTestResourceRequirement>>& resourceGroups);
using ListOfTests = std::vector<cmCTestTestProperties>;
// Support for writing test results in JUnit XML format.
- void SetJUnitXMLFileName(const std::string& id);
+ void SetJUnitXMLFileName(std::string const& id);
protected:
using SetOfTests =
@@ -239,18 +239,19 @@ protected:
int ExecuteCommands(std::vector<std::string>& vec);
bool ProcessOptions();
- void LogTestSummary(const std::vector<std::string>& passed,
- const std::vector<std::string>& failed,
- const cmDuration& durationInSecs);
- void LogDisabledTests(const std::vector<cmCTestTestResult>& disabledTests);
- void LogFailedTests(const std::vector<std::string>& failed,
- const SetOfTests& resultsSet);
+ void LogTestSummary(std::vector<std::string> const& passed,
+ std::vector<std::string> const& failed,
+ cmDuration const& durationInSecs);
+ void LogDisabledTests(std::vector<cmCTestTestResult> const& disabledTests);
+ void LogFailedTests(std::vector<std::string> const& failed,
+ SetOfTests const& resultsSet);
bool GenerateXML();
void WriteTestResultHeader(cmXMLWriter& xml,
cmCTestTestResult const& result);
void WriteTestResultFooter(cmXMLWriter& xml,
cmCTestTestResult const& result);
+
// Write attached test files into the xml
void AttachFiles(cmXMLWriter& xml, cmCTestTestResult& result);
void AttachFile(cmXMLWriter& xml, std::string const& file,
@@ -260,6 +261,8 @@ protected:
void CleanTestOutput(std::string& output, size_t length,
cmCTestTypes::TruncationMode truncate);
+ cmCTestTestOptions TestOptions;
+
cmDuration ElapsedTestingTime;
using TestResultsVector = std::vector<cmCTestTestResult>;
@@ -270,10 +273,7 @@ protected:
std::string EndTest;
std::chrono::system_clock::time_point StartTestTime;
std::chrono::system_clock::time_point EndTestTime;
- bool MemCheck;
- int CustomMaximumPassedTestOutputSize;
- int CustomMaximumFailedTestOutputSize;
- cmCTestTypes::TruncationMode TestOutputTruncation;
+ bool MemCheck = false;
int MaxIndex;
public:
@@ -329,15 +329,15 @@ private:
void UpdateMaxTestNameWidth();
- bool GetValue(const char* tag, std::string& value, std::istream& fin);
- bool GetValue(const char* tag, int& value, std::istream& fin);
- bool GetValue(const char* tag, size_t& value, std::istream& fin);
- bool GetValue(const char* tag, bool& value, std::istream& fin);
- bool GetValue(const char* tag, double& value, std::istream& fin);
+ bool GetValue(char const* tag, std::string& value, std::istream& fin);
+ bool GetValue(char const* tag, int& value, std::istream& fin);
+ bool GetValue(char const* tag, size_t& value, std::istream& fin);
+ bool GetValue(char const* tag, bool& value, std::istream& fin);
+ bool GetValue(char const* tag, double& value, std::istream& fin);
/**
* Find the executable for a test
*/
- std::string FindTheExecutable(const std::string& exe);
+ std::string FindTheExecutable(std::string const& exe);
std::string GetTestStatus(cmCTestTestResult const&);
void ExpandTestsToRunInformation(size_t numPossibleTests);
@@ -350,24 +350,17 @@ private:
std::vector<int> TestsToRun;
- bool UseIncludeRegExpFlag;
- bool UseExcludeRegExpFlag;
- bool UseExcludeRegExpFirst;
- std::string IncludeRegExp;
- std::string ExcludeRegExp;
- std::string ExcludeFixtureRegExp;
- std::string ExcludeFixtureSetupRegExp;
- std::string ExcludeFixtureCleanupRegExp;
+ bool UseIncludeRegExpFlag = false;
+ bool UseExcludeRegExpFlag = false;
+ bool UseExcludeRegExpFirst = false;
std::vector<cmsys::RegularExpression> IncludeLabelRegularExpressions;
std::vector<cmsys::RegularExpression> ExcludeLabelRegularExpressions;
cmsys::RegularExpression IncludeTestsRegularExpression;
cmsys::RegularExpression ExcludeTestsRegularExpression;
- std::string TestListFile;
- std::string ExcludeTestListFile;
cm::optional<std::set<std::string>> TestsToRunByName;
cm::optional<std::set<std::string>> TestsToExcludeByName;
-
- std::string ResourceSpecFile;
+ cm::optional<std::string> ParallelLevel;
+ cm::optional<std::string> Repeat;
void RecordCustomTestMeasurements(cmXMLWriter& xml, std::string content);
void CheckLabelFilter(cmCTestTestProperties& it);
@@ -375,7 +368,6 @@ private:
void CheckLabelFilterInclude(cmCTestTestProperties& it);
std::string TestsToRunString;
- bool UseUnion;
ListOfTests TestList;
size_t TotalNumberOfTests;
cmsys::RegularExpression AllTestMeasurementsRegex;
@@ -383,11 +375,10 @@ private:
cmsys::RegularExpression CustomCompletionStatusRegex;
cmsys::RegularExpression CustomLabelRegex;
- std::ostream* LogFile;
+ std::ostream* LogFile = nullptr;
cmCTest::Repeat RepeatMode = cmCTest::Repeat::Never;
int RepeatCount = 1;
- bool RerunFailed;
- std::string JUnitXMLFileName;
+ friend class cmCTestTestCommand;
};
diff --git a/Source/CTest/cmCTestTestMeasurementXMLParser.cxx b/Source/CTest/cmCTestTestMeasurementXMLParser.cxx
index 636be24..6183aef 100644
--- a/Source/CTest/cmCTestTestMeasurementXMLParser.cxx
+++ b/Source/CTest/cmCTestTestMeasurementXMLParser.cxx
@@ -1,16 +1,16 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestTestMeasurementXMLParser.h"
#include <cstring>
-void cmCTestTestMeasurementXMLParser::StartElement(const std::string& name,
- const char** attributes)
+void cmCTestTestMeasurementXMLParser::StartElement(std::string const& name,
+ char const** attributes)
{
this->CharacterData.clear();
this->ElementName = name;
- for (const char** attr = attributes; *attr; attr += 2) {
+ for (char const** attr = attributes; *attr; attr += 2) {
if (strcmp(attr[0], "name") == 0) {
this->MeasurementName = attr[1];
} else if (strcmp(attr[0], "type") == 0) {
@@ -19,7 +19,7 @@ void cmCTestTestMeasurementXMLParser::StartElement(const std::string& name,
}
}
-void cmCTestTestMeasurementXMLParser::CharacterDataHandler(const char* data,
+void cmCTestTestMeasurementXMLParser::CharacterDataHandler(char const* data,
int length)
{
this->CharacterData.append(data, length);
diff --git a/Source/CTest/cmCTestTestMeasurementXMLParser.h b/Source/CTest/cmCTestTestMeasurementXMLParser.h
index b2c3eb3..593107e 100644
--- a/Source/CTest/cmCTestTestMeasurementXMLParser.h
+++ b/Source/CTest/cmCTestTestMeasurementXMLParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <string>
@@ -15,7 +15,7 @@ public:
std::string MeasurementType;
protected:
- void StartElement(const std::string& name, const char** atts) override;
- void EndElement(const std::string& /*name*/) override {}
- void CharacterDataHandler(const char* data, int length) override;
+ void StartElement(std::string const& name, char const** atts) override;
+ void EndElement(std::string const& /*name*/) override {}
+ void CharacterDataHandler(char const* data, int length) override;
};
diff --git a/Source/CTest/cmCTestTypes.cxx b/Source/CTest/cmCTestTypes.cxx
new file mode 100644
index 0000000..917a2f4
--- /dev/null
+++ b/Source/CTest/cmCTestTypes.cxx
@@ -0,0 +1,24 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+
+#include "cmCTestTypes.h"
+
+#include <string>
+
+namespace cmCTestTypes {
+
+bool SetTruncationMode(TruncationMode& mode, cm::string_view str)
+{
+ if (str == "tail") {
+ mode = cmCTestTypes::TruncationMode::Tail;
+ } else if (str == "middle") {
+ mode = cmCTestTypes::TruncationMode::Middle;
+ } else if (str == "head") {
+ mode = cmCTestTypes::TruncationMode::Head;
+ } else {
+ return false;
+ }
+ return true;
+}
+
+} // namespace cmCTestTypes
diff --git a/Source/CTest/cmCTestTypes.h b/Source/CTest/cmCTestTypes.h
index 843d27a..7360f3c 100644
--- a/Source/CTest/cmCTestTypes.h
+++ b/Source/CTest/cmCTestTypes.h
@@ -1,16 +1,22 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cm/string_view>
+
namespace cmCTestTypes {
+// Test output truncation mode
enum class TruncationMode
-{ // Test output truncation mode
+{
Tail,
Middle,
Head
};
-}
+
+bool SetTruncationMode(TruncationMode& mode, cm::string_view str);
+
+} // namespace cmCTestTypes
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index 6655bf7..71d92c4 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -1,85 +1,330 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestUpdateCommand.h"
+#include <chrono>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include <cm/memory>
+#include <cmext/string_view>
+
+#include "cmArgumentParser.h"
+#include "cmCLocaleEnvironmentScope.h"
#include "cmCTest.h"
-#include "cmCTestUpdateHandler.h"
+#include "cmCTestBZR.h"
+#include "cmCTestCVS.h"
+#include "cmCTestGIT.h"
+#include "cmCTestHG.h"
+#include "cmCTestP4.h"
+#include "cmCTestSVN.h"
+#include "cmCTestVC.h"
+#include "cmExecutionStatus.h"
+#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+#include "cmVersion.h"
+#include "cmXMLWriter.h"
+
+namespace {
+
+enum
+{
+ e_UNKNOWN = 0,
+ e_CVS,
+ e_SVN,
+ e_BZR,
+ e_GIT,
+ e_HG,
+ e_P4,
+ e_LAST
+};
+
+char const* TypeToString(int type)
+{
+ // clang-format off
+ switch (type) {
+ case e_CVS: return "CVS";
+ case e_SVN: return "SVN";
+ case e_BZR: return "BZR";
+ case e_GIT: return "GIT";
+ case e_HG: return "HG";
+ case e_P4: return "P4";
+ default: return "Unknown";
+ }
+ // clang-format on
+}
+
+char const* TypeToCommandKey(int type)
+{
+ // clang-format off
+ switch (type) {
+ case e_CVS: return "CTEST_CVS_COMMAND";
+ case e_SVN: return "CTEST_SVN_COMMAND";
+ case e_BZR: return "CTEST_BZR_COMMAND";
+ case e_GIT: return "CTEST_GIT_COMMAND";
+ case e_HG: return "CTEST_HG_COMMAND";
+ case e_P4: return "CTEST_P4_COMMAND";
+ default: return nullptr;
+ }
+ // clang-format on
+}
+
+int DetermineType(std::string const& cmd)
+{
+ std::string stype = cmSystemTools::LowerCase(cmd);
+ if (stype.find("cvs") != std::string::npos) {
+ return e_CVS;
+ }
+ if (stype.find("svn") != std::string::npos) {
+ return e_SVN;
+ }
+ if (stype.find("bzr") != std::string::npos) {
+ return e_BZR;
+ }
+ if (stype.find("git") != std::string::npos) {
+ return e_GIT;
+ }
+ if (stype.find("hg") != std::string::npos) {
+ return e_HG;
+ }
+ if (stype.find("p4") != std::string::npos) {
+ return e_P4;
+ }
+ return e_UNKNOWN;
+}
+
+int DetectVCS(std::string const& dir)
+{
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/CVS"))) {
+ return e_CVS;
+ }
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/.svn"))) {
+ return e_SVN;
+ }
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/.bzr"))) {
+ return e_BZR;
+ }
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/.git"))) {
+ return e_GIT;
+ }
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/.hg"))) {
+ return e_HG;
+ }
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/.p4"))) {
+ return e_P4;
+ }
+ if (cmSystemTools::FileExists(cmStrCat(dir, "/.p4config"))) {
+ return e_P4;
+ }
+ return e_UNKNOWN;
+}
+
+std::unique_ptr<cmCTestVC> MakeVC(int type, cmCTest* ctest, cmMakefile* mf,
+ std::ostream& os)
+{
+ // clang-format off
+ switch (type) {
+ case e_CVS: return cm::make_unique<cmCTestCVS>(ctest, mf, os);
+ case e_SVN: return cm::make_unique<cmCTestSVN>(ctest, mf, os);
+ case e_BZR: return cm::make_unique<cmCTestBZR>(ctest, mf, os);
+ case e_GIT: return cm::make_unique<cmCTestGIT>(ctest, mf, os);
+ case e_HG: return cm::make_unique<cmCTestHG> (ctest, mf, os);
+ case e_P4: return cm::make_unique<cmCTestP4> (ctest, mf, os);
+ default: return cm::make_unique<cmCTestVC> (ctest, mf, os);
+ }
+ // clang-format on
+}
+
+} // namespace
-cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
+bool cmCTestUpdateCommand::ExecuteUpdate(UpdateArguments& args,
+ cmExecutionStatus& status) const
{
- if (!this->Source.empty()) {
- this->CTest->SetCTestConfiguration(
- "SourceDirectory", cmSystemTools::CollapseFullPath(this->Source),
- this->Quiet);
- } else {
- this->CTest->SetCTestConfiguration(
- "SourceDirectory",
- cmSystemTools::CollapseFullPath(
- this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
- this->Quiet);
- }
- std::string source_dir =
- this->CTest->GetCTestConfiguration("SourceDirectory");
-
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "UpdateCommand", "CTEST_UPDATE_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "UpdateOptions", "CTEST_UPDATE_OPTIONS", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "CVSCommand", "CTEST_CVS_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "SVNCommand", "CTEST_SVN_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "SVNOptions", "CTEST_SVN_OPTIONS", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "BZRCommand", "CTEST_BZR_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "GITCommand", "CTEST_GIT_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "GITInitSubmodules", "CTEST_GIT_INIT_SUBMODULES",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "UpdateVersionOverride", "CTEST_UPDATE_VERSION_OVERRIDE",
- this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "HGCommand", "CTEST_HG_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "P4Command", "CTEST_P4_COMMAND", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "P4Client", "CTEST_P4_CLIENT", this->Quiet);
- this->CTest->SetCTestConfigurationFromCMakeVariable(
- this->Makefile, "P4Options", "CTEST_P4_OPTIONS", this->Quiet);
-
- cmCTestUpdateHandler* handler = this->CTest->GetUpdateHandler();
- handler->Initialize();
+ cmMakefile& mf = status.GetMakefile();
+
+ std::string const& source_dir = !args.Source.empty()
+ ? args.Source
+ : mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
if (source_dir.empty()) {
- this->SetError("source directory not specified. Please use SOURCE tag");
- return nullptr;
+ status.SetError("called with no source directory specified. "
+ "Use SOURCE argument or set CTEST_SOURCE_DIRECTORY.");
+ return false;
+ }
+
+ std::string const currentTag = this->CTest->GetCurrentTag();
+ if (currentTag.empty()) {
+ status.SetError("called with no current tag.");
+ return false;
}
- handler->SetOption("SourceDirectory", source_dir);
- handler->SetQuiet(this->Quiet);
- return handler;
+
+ // Detect the VCS managing the source tree.
+ int updateType = DetectVCS(source_dir);
+
+ // Get update command
+ std::string updateCommand = mf.GetSafeDefinition("CTEST_UPDATE_COMMAND");
+
+ if (updateType == e_UNKNOWN && !updateCommand.empty()) {
+ updateType = DetermineType(updateCommand);
+ }
+ if (updateType == e_UNKNOWN) {
+ updateType = DetermineType(mf.GetSafeDefinition("CTEST_UPDATE_TYPE"));
+ }
+
+ // If no update command was specified, lookup one for this VCS tool.
+ if (updateCommand.empty()) {
+ char const* key = TypeToCommandKey(updateType);
+ if (key) {
+ updateCommand = mf.GetSafeDefinition(key);
+ }
+
+ if (updateCommand.empty()) {
+ std::ostringstream e;
+ e << "called with no update command specified. "
+ "Please set CTEST_UPDATE_COMMAND";
+ if (key) {
+ e << " or " << key;
+ }
+ e << '.';
+ status.SetError(e.str());
+ return false;
+ }
+ }
+
+ cmGeneratedFileStream ofs;
+ if (!this->CTest->GetShowOnly()) {
+ std::string logFile = cmStrCat("LastUpdate_", currentTag, ".log");
+ if (!this->CTest->OpenOutputFile("Temporary", logFile, ofs)) {
+ status.SetError(cmStrCat("cannot create log file: ", logFile));
+ return false;
+ }
+ }
+
+ cmGeneratedFileStream os;
+ if (!this->CTest->OpenOutputFile(currentTag, "Update.xml", os, true)) {
+ status.SetError("cannot create resulting XML file: Update.xml");
+ return false;
+ }
+
+ this->CTest->AddSubmitFile(cmCTest::PartUpdate, "Update.xml");
+
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " Updating " << TypeToString(updateType)
+ << " repository: " << source_dir << '\n',
+ args.Quiet);
+
+ // Make sure VCS tool messages are in English so we can parse them.
+ cmCLocaleEnvironmentScope fixLocale;
+ static_cast<void>(fixLocale);
+
+ // Create an object to interact with the VCS tool.
+ std::unique_ptr<cmCTestVC> vc = MakeVC(updateType, this->CTest, &mf, ofs);
+
+ vc->SetCommandLineTool(updateCommand);
+ vc->SetSourceDirectory(source_dir);
+
+ // Cleanup the working tree.
+ vc->Cleanup();
+
+ std::string start_time = this->CTest->CurrentTime();
+ auto start_time_time = std::chrono::system_clock::now();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
+
+ bool updated = vc->Update();
+ std::string buildname =
+ cmCTest::SafeBuildIdField(mf.GetSafeDefinition("CTEST_BUILD_NAME"));
+
+ cmXMLWriter xml(os);
+ xml.StartDocument();
+ xml.StartElement("Update");
+ xml.Attribute("mode", "Client");
+ xml.Attribute("Generator",
+ std::string("ctest-") + cmVersion::GetCMakeVersion());
+ xml.Element("Site", mf.GetSafeDefinition("CTEST_SITE"));
+ xml.Element("BuildName", buildname);
+ xml.Element("BuildStamp",
+ this->CTest->GetCurrentTag() + "-" +
+ this->CTest->GetTestGroupString());
+ xml.Element("StartDateTime", start_time);
+ xml.Element("StartTime", start_time_time);
+ xml.Element("UpdateCommand", vc->GetUpdateCommandLine());
+ xml.Element("UpdateType", TypeToString(updateType));
+
+ std::string changeId = mf.GetSafeDefinition("CTEST_CHANGE_ID");
+ if (!changeId.empty()) {
+ xml.Element("ChangeId", changeId);
+ }
+
+ bool loadedMods = vc->WriteXML(xml);
+
+ int localModifications = 0;
+ int numUpdated = vc->GetPathCount(cmCTestVC::PathUpdated);
+ if (numUpdated) {
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " Found " << numUpdated << " updated files\n",
+ args.Quiet);
+ }
+ if (int numModified = vc->GetPathCount(cmCTestVC::PathModified)) {
+ cmCTestOptionalLog(
+ this->CTest, HANDLER_OUTPUT,
+ " Found " << numModified << " locally modified files\n", args.Quiet);
+ localModifications += numModified;
+ }
+ if (int numConflicting = vc->GetPathCount(cmCTestVC::PathConflicting)) {
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " Found " << numConflicting << " conflicting files\n",
+ args.Quiet);
+ localModifications += numConflicting;
+ }
+
+ cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, args.Quiet);
+ std::string end_time = this->CTest->CurrentTime();
+ xml.Element("EndDateTime", end_time);
+ xml.Element("EndTime", std::chrono::system_clock::now());
+ xml.Element("ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(
+ std::chrono::steady_clock::now() - elapsed_time_start)
+ .count());
+
+ xml.StartElement("UpdateReturnStatus");
+ if (localModifications) {
+ xml.Content("Update error: "
+ "There are modified or conflicting files in the repository");
+ cmCTestLog(this->CTest, WARNING,
+ " There are modified or conflicting files in the repository"
+ << std::endl);
+ }
+ if (!updated) {
+ xml.Content("Update command failed:\n");
+ xml.Content(vc->GetUpdateCommandLine());
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ " Update command failed: " << vc->GetUpdateCommandLine()
+ << "\n");
+ }
+ xml.EndElement(); // UpdateReturnStatus
+ xml.EndElement(); // Update
+ xml.EndDocument();
+
+ if (!args.ReturnValue.empty()) {
+ mf.AddDefinition(args.ReturnValue,
+ std::to_string(updated && loadedMods ? numUpdated : -1));
+ }
+
+ return true;
+}
+
+bool cmCTestUpdateCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
+{
+ static auto const parser =
+ cmArgumentParser<UpdateArguments>{ MakeBasicParser<UpdateArguments>() }
+ .Bind("SOURCE"_s, &UpdateArguments::Source)
+ .Bind("RETURN_VALUE"_s, &UpdateArguments::ReturnValue)
+ .Bind("QUIET"_s, &UpdateArguments::Quiet);
+
+ return this->Invoke(parser, args, status, [&](UpdateArguments& a) {
+ return this->ExecuteUpdate(a, status);
+ });
}
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index e4c3453..93316de 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -1,43 +1,34 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
-
-#include <cm/memory>
+#include <vector>
#include "cmCTestHandlerCommand.h"
-#include "cmCommand.h"
-class cmCTestGenericHandler;
+class cmExecutionStatus;
-/** \class cmCTestUpdate
- * \brief Run a ctest script
- *
- * cmCTestUpdateCommand defineds the command to updates the repository.
- */
class cmCTestUpdateCommand : public cmCTestHandlerCommand
{
public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
+
+protected:
+ struct UpdateArguments : BasicArguments
{
- auto ni = cm::make_unique<cmCTestUpdateCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+ std::string Source;
+ std::string ReturnValue;
+ bool Quiet = false;
+ };
+
+private:
std::string GetName() const override { return "ctest_update"; }
-protected:
- cmCTestGenericHandler* InitializeHandler() override;
+ bool ExecuteUpdate(UpdateArguments& args, cmExecutionStatus& status) const;
+
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
deleted file mode 100644
index 045eb84..0000000
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ /dev/null
@@ -1,354 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCTestUpdateHandler.h"
-
-#include <chrono>
-#include <sstream>
-
-#include <cm/memory>
-
-#include "cmCLocaleEnvironmentScope.h"
-#include "cmCTest.h"
-#include "cmCTestBZR.h"
-#include "cmCTestCVS.h"
-#include "cmCTestGIT.h"
-#include "cmCTestHG.h"
-#include "cmCTestP4.h"
-#include "cmCTestSVN.h"
-#include "cmCTestVC.h"
-#include "cmGeneratedFileStream.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-#include "cmVersion.h"
-#include "cmXMLWriter.h"
-
-static const char* cmCTestUpdateHandlerUpdateStrings[] = {
- "Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4"
-};
-
-static const char* cmCTestUpdateHandlerUpdateToString(int type)
-{
- if (type < cmCTestUpdateHandler::e_UNKNOWN ||
- type >= cmCTestUpdateHandler::e_LAST) {
- return cmCTestUpdateHandlerUpdateStrings[cmCTestUpdateHandler::e_UNKNOWN];
- }
- return cmCTestUpdateHandlerUpdateStrings[type];
-}
-
-cmCTestUpdateHandler::cmCTestUpdateHandler() = default;
-
-void cmCTestUpdateHandler::Initialize()
-{
- this->Superclass::Initialize();
- this->UpdateCommand.clear();
- this->UpdateType = e_CVS;
-}
-
-int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
-{
- cmCTestOptionalLog(this->CTest, DEBUG,
- "Determine update type from command: "
- << cmd << " and type: " << type << std::endl,
- this->Quiet);
- if (type && *type) {
- cmCTestOptionalLog(this->CTest, DEBUG,
- "Type specified: " << type << std::endl, this->Quiet);
- std::string stype = cmSystemTools::LowerCase(type);
- if (stype.find("cvs") != std::string::npos) {
- return cmCTestUpdateHandler::e_CVS;
- }
- if (stype.find("svn") != std::string::npos) {
- return cmCTestUpdateHandler::e_SVN;
- }
- if (stype.find("bzr") != std::string::npos) {
- return cmCTestUpdateHandler::e_BZR;
- }
- if (stype.find("git") != std::string::npos) {
- return cmCTestUpdateHandler::e_GIT;
- }
- if (stype.find("hg") != std::string::npos) {
- return cmCTestUpdateHandler::e_HG;
- }
- if (stype.find("p4") != std::string::npos) {
- return cmCTestUpdateHandler::e_P4;
- }
- } else {
- cmCTestOptionalLog(
- this->CTest, DEBUG,
- "Type not specified, check command: " << cmd << std::endl, this->Quiet);
- std::string stype = cmSystemTools::LowerCase(cmd);
- if (stype.find("cvs") != std::string::npos) {
- return cmCTestUpdateHandler::e_CVS;
- }
- if (stype.find("svn") != std::string::npos) {
- return cmCTestUpdateHandler::e_SVN;
- }
- if (stype.find("bzr") != std::string::npos) {
- return cmCTestUpdateHandler::e_BZR;
- }
- if (stype.find("git") != std::string::npos) {
- return cmCTestUpdateHandler::e_GIT;
- }
- if (stype.find("hg") != std::string::npos) {
- return cmCTestUpdateHandler::e_HG;
- }
- if (stype.find("p4") != std::string::npos) {
- return cmCTestUpdateHandler::e_P4;
- }
- }
- return cmCTestUpdateHandler::e_UNKNOWN;
-}
-
-// clearly it would be nice if this were broken up into a few smaller
-// functions and commented...
-int cmCTestUpdateHandler::ProcessHandler()
-{
- // Make sure VCS tool messages are in English so we can parse them.
- cmCLocaleEnvironmentScope fixLocale;
- static_cast<void>(fixLocale);
-
- // Get source dir
- cmValue sourceDirectory = this->GetOption("SourceDirectory");
- if (!sourceDirectory) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot find SourceDirectory key in the DartConfiguration.tcl"
- << std::endl);
- return -1;
- }
-
- cmGeneratedFileStream ofs;
- if (!this->CTest->GetShowOnly()) {
- this->StartLogFile("Update", ofs);
- }
-
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Updating the repository: " << *sourceDirectory
- << std::endl,
- this->Quiet);
-
- if (!this->SelectVCS()) {
- return -1;
- }
-
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Use "
- << cmCTestUpdateHandlerUpdateToString(this->UpdateType)
- << " repository type" << std::endl;
- , this->Quiet);
-
- // Create an object to interact with the VCS tool.
- std::unique_ptr<cmCTestVC> vc;
- switch (this->UpdateType) {
- case e_CVS:
- vc = cm::make_unique<cmCTestCVS>(this->CTest, ofs);
- break;
- case e_SVN:
- vc = cm::make_unique<cmCTestSVN>(this->CTest, ofs);
- break;
- case e_BZR:
- vc = cm::make_unique<cmCTestBZR>(this->CTest, ofs);
- break;
- case e_GIT:
- vc = cm::make_unique<cmCTestGIT>(this->CTest, ofs);
- break;
- case e_HG:
- vc = cm::make_unique<cmCTestHG>(this->CTest, ofs);
- break;
- case e_P4:
- vc = cm::make_unique<cmCTestP4>(this->CTest, ofs);
- break;
- default:
- vc = cm::make_unique<cmCTestVC>(this->CTest, ofs);
- break;
- }
- vc->SetCommandLineTool(this->UpdateCommand);
- vc->SetSourceDirectory(*sourceDirectory);
-
- // Cleanup the working tree.
- vc->Cleanup();
-
- //
- // Now update repository and remember what files were updated
- //
- cmGeneratedFileStream os;
- if (!this->StartResultingXML(cmCTest::PartUpdate, "Update", os)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot open log file" << std::endl);
- return -1;
- }
- std::string start_time = this->CTest->CurrentTime();
- auto start_time_time = std::chrono::system_clock::now();
- auto elapsed_time_start = std::chrono::steady_clock::now();
-
- bool updated = vc->Update();
- std::string buildname =
- cmCTest::SafeBuildIdField(this->CTest->GetCTestConfiguration("BuildName"));
-
- cmXMLWriter xml(os);
- xml.StartDocument();
- xml.StartElement("Update");
- xml.Attribute("mode", "Client");
- xml.Attribute("Generator",
- std::string("ctest-") + cmVersion::GetCMakeVersion());
- xml.Element("Site", this->CTest->GetCTestConfiguration("Site"));
- xml.Element("BuildName", buildname);
- xml.Element("BuildStamp",
- this->CTest->GetCurrentTag() + "-" +
- this->CTest->GetTestModelString());
- xml.Element("StartDateTime", start_time);
- xml.Element("StartTime", start_time_time);
- xml.Element("UpdateCommand", vc->GetUpdateCommandLine());
- xml.Element("UpdateType",
- cmCTestUpdateHandlerUpdateToString(this->UpdateType));
- std::string changeId = this->CTest->GetCTestConfiguration("ChangeId");
- if (!changeId.empty()) {
- xml.Element("ChangeId", changeId);
- }
-
- bool loadedMods = vc->WriteXML(xml);
-
- int localModifications = 0;
- int numUpdated = vc->GetPathCount(cmCTestVC::PathUpdated);
- if (numUpdated) {
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Found " << numUpdated << " updated files\n",
- this->Quiet);
- }
- if (int numModified = vc->GetPathCount(cmCTestVC::PathModified)) {
- cmCTestOptionalLog(
- this->CTest, HANDLER_OUTPUT,
- " Found " << numModified << " locally modified files\n", this->Quiet);
- localModifications += numModified;
- }
- if (int numConflicting = vc->GetPathCount(cmCTestVC::PathConflicting)) {
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Found " << numConflicting << " conflicting files\n",
- this->Quiet);
- localModifications += numConflicting;
- }
-
- cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet);
- std::string end_time = this->CTest->CurrentTime();
- xml.Element("EndDateTime", end_time);
- xml.Element("EndTime", std::chrono::system_clock::now());
- xml.Element("ElapsedMinutes",
- std::chrono::duration_cast<std::chrono::minutes>(
- std::chrono::steady_clock::now() - elapsed_time_start)
- .count());
-
- xml.StartElement("UpdateReturnStatus");
- if (localModifications) {
- xml.Content("Update error: "
- "There are modified or conflicting files in the repository");
- cmCTestLog(this->CTest, WARNING,
- " There are modified or conflicting files in the repository"
- << std::endl);
- }
- if (!updated) {
- xml.Content("Update command failed:\n");
- xml.Content(vc->GetUpdateCommandLine());
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- " Update command failed: " << vc->GetUpdateCommandLine()
- << "\n");
- }
- xml.EndElement(); // UpdateReturnStatus
- xml.EndElement(); // Update
- xml.EndDocument();
- return updated && loadedMods ? numUpdated : -1;
-}
-
-int cmCTestUpdateHandler::DetectVCS(const std::string& dir)
-{
- std::string sourceDirectory = dir;
- cmCTestOptionalLog(this->CTest, DEBUG,
- "Check directory: " << sourceDirectory << std::endl,
- this->Quiet);
- sourceDirectory += "/.svn";
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_SVN;
- }
- sourceDirectory = cmStrCat(dir, "/CVS");
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_CVS;
- }
- sourceDirectory = cmStrCat(dir, "/.bzr");
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_BZR;
- }
- sourceDirectory = cmStrCat(dir, "/.git");
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_GIT;
- }
- sourceDirectory = cmStrCat(dir, "/.hg");
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_HG;
- }
- sourceDirectory = cmStrCat(dir, "/.p4");
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_P4;
- }
- sourceDirectory = cmStrCat(dir, "/.p4config");
- if (cmSystemTools::FileExists(sourceDirectory)) {
- return cmCTestUpdateHandler::e_P4;
- }
- return cmCTestUpdateHandler::e_UNKNOWN;
-}
-
-bool cmCTestUpdateHandler::SelectVCS()
-{
- // Get update command
- this->UpdateCommand = this->CTest->GetCTestConfiguration("UpdateCommand");
-
- // Detect the VCS managing the source tree.
- this->UpdateType = this->DetectVCS(this->GetOption("SourceDirectory"));
- if (this->UpdateType == e_UNKNOWN) {
- // The source tree does not have a recognized VCS. Check the
- // configuration value or command name.
- this->UpdateType = this->DetermineType(
- this->UpdateCommand.c_str(),
- this->CTest->GetCTestConfiguration("UpdateType").c_str());
- }
-
- // If no update command was specified, lookup one for this VCS tool.
- if (this->UpdateCommand.empty()) {
- const char* key = nullptr;
- switch (this->UpdateType) {
- case e_CVS:
- key = "CVSCommand";
- break;
- case e_SVN:
- key = "SVNCommand";
- break;
- case e_BZR:
- key = "BZRCommand";
- break;
- case e_GIT:
- key = "GITCommand";
- break;
- case e_HG:
- key = "HGCommand";
- break;
- case e_P4:
- key = "P4Command";
- break;
- default:
- break;
- }
- if (key) {
- this->UpdateCommand = this->CTest->GetCTestConfiguration(key);
- }
- if (this->UpdateCommand.empty()) {
- std::ostringstream e;
- e << "Cannot find UpdateCommand ";
- if (key) {
- e << "or " << key;
- }
- e << " configuration key.";
- cmCTestLog(this->CTest, ERROR_MESSAGE, e.str() << std::endl);
- return false;
- }
- }
-
- return true;
-}
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h
deleted file mode 100644
index 70269ea..0000000
--- a/Source/CTest/cmCTestUpdateHandler.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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 <utility>
-#include <vector>
-
-#include "cmCTestGenericHandler.h"
-
-/** \class cmCTestUpdateHandler
- * \brief A class that handles ctest -S invocations
- *
- */
-class cmCTestUpdateHandler : public cmCTestGenericHandler
-{
-public:
- using Superclass = cmCTestGenericHandler;
-
- /*
- * The main entry point for this class
- */
- int ProcessHandler() override;
-
- cmCTestUpdateHandler();
-
- enum
- {
- e_UNKNOWN = 0,
- e_CVS,
- e_SVN,
- e_BZR,
- e_GIT,
- e_HG,
- e_P4,
- e_LAST
- };
-
- /**
- * Initialize handler
- */
- void Initialize() override;
-
-private:
- // Some structures needed for update
- struct StringPair : public std::pair<std::string, std::string>
- {
- };
- struct UpdateFiles : public std::vector<StringPair>
- {
- };
-
- // Determine the type of version control
- int DetermineType(const char* cmd, const char* type);
-
- // The VCS command to update the working tree.
- std::string UpdateCommand;
- int UpdateType;
-
- int DetectVCS(const std::string& dir);
- bool SelectVCS();
-};
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index 2ed671c..e93c536 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -1,46 +1,99 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestUploadCommand.h"
-#include <set>
+#include <algorithm>
+#include <chrono>
#include <sstream>
+#include <string>
#include <cm/vector>
#include <cmext/string_view>
+#include "cmArgumentParser.h"
#include "cmCTest.h"
-#include "cmCTestUploadHandler.h"
+#include "cmExecutionStatus.h"
+#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmSystemTools.h"
+#include "cmVersion.h"
+#include "cmXMLWriter.h"
-void cmCTestUploadCommand::BindArguments()
+bool cmCTestUploadCommand::ExecuteUpload(UploadArguments& args,
+ cmExecutionStatus& status) const
{
- this->Bind("FILES"_s, this->Files);
- this->Bind("QUIET"_s, this->Quiet);
- this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError);
-}
+ cmMakefile& mf = status.GetMakefile();
-void cmCTestUploadCommand::CheckArguments()
-{
- cm::erase_if(this->Files, [this](std::string const& arg) -> bool {
+ std::sort(args.Files.begin(), args.Files.end());
+ args.Files.erase(std::unique(args.Files.begin(), args.Files.end()),
+ args.Files.end());
+
+ cm::erase_if(args.Files, [&mf](std::string const& arg) -> bool {
if (!cmSystemTools::FileExists(arg)) {
std::ostringstream e;
e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
return true;
}
return false;
});
+
+ cmGeneratedFileStream ofs;
+ if (!this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), "Upload.xml",
+ ofs)) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Cannot open Upload.xml file" << std::endl);
+ return false;
+ }
+ std::string buildname =
+ cmCTest::SafeBuildIdField(mf.GetSafeDefinition("CTEST_BUILD_NAME"));
+
+ cmXMLWriter xml(ofs);
+ xml.StartDocument();
+ xml.ProcessingInstruction("xml-stylesheet",
+ "type=\"text/xsl\" "
+ "href=\"Dart/Source/Server/XSL/Build.xsl "
+ "<file:///Dart/Source/Server/XSL/Build.xsl> \"");
+ xml.StartElement("Site");
+ xml.Attribute("BuildName", buildname);
+ xml.Attribute("BuildStamp",
+ this->CTest->GetCurrentTag() + "-" +
+ this->CTest->GetTestGroupString());
+ xml.Attribute("Name", mf.GetSafeDefinition("CTEST_SITE"));
+ xml.Attribute("Generator",
+ std::string("ctest-") + cmVersion::GetCMakeVersion());
+ this->CTest->AddSiteProperties(xml, mf.GetCMakeInstance());
+ xml.StartElement("Upload");
+ xml.Element("Time", std::chrono::system_clock::now());
+
+ for (std::string const& file : args.Files) {
+ cmCTestOptionalLog(this->CTest, OUTPUT,
+ "\tUpload file: " << file << std::endl, args.Quiet);
+ xml.StartElement("File");
+ xml.Attribute("filename", file);
+ xml.StartElement("Content");
+ xml.Attribute("encoding", "base64");
+ xml.Content(this->CTest->Base64EncodeFile(file));
+ xml.EndElement(); // Content
+ xml.EndElement(); // File
+ }
+ xml.EndElement(); // Upload
+ xml.EndElement(); // Site
+ xml.EndDocument();
+ return true;
}
-cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
+bool cmCTestUploadCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const
{
- cmCTestUploadHandler* handler = this->CTest->GetUploadHandler();
- handler->Initialize();
- handler->SetFiles(
- std::set<std::string>(this->Files.begin(), this->Files.end()));
- handler->SetQuiet(this->Quiet);
- return handler;
+ static auto const parser =
+ cmArgumentParser<UploadArguments>{ MakeBasicParser<UploadArguments>() }
+ .Bind("FILES"_s, &UploadArguments::Files)
+ .Bind("QUIET"_s, &UploadArguments::Quiet);
+
+ return this->Invoke(parser, args, status, [&](UploadArguments& a) {
+ return this->ExecuteUpload(a, status);
+ });
}
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index a9d1dd2..aafe823 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -1,50 +1,34 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
-#include <utility>
#include <vector>
-#include <cm/memory>
-
#include "cmArgumentParserTypes.h"
#include "cmCTestHandlerCommand.h"
-#include "cmCommand.h"
-class cmCTestGenericHandler;
+class cmExecutionStatus;
-/** \class cmCTestUpload
- * \brief Run a ctest script
- *
- * cmCTestUploadCommand defines the command to upload result files for
- * the project.
- */
class cmCTestUploadCommand : public cmCTestHandlerCommand
{
public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
+ using cmCTestHandlerCommand::cmCTestHandlerCommand;
+
+protected:
+ struct UploadArguments : BasicArguments
{
- auto ni = cm::make_unique<cmCTestUploadCommand>();
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return std::unique_ptr<cmCommand>(std::move(ni));
- }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
+ ArgumentParser::MaybeEmpty<std::vector<std::string>> Files;
+ bool Quiet = false;
+ };
+
+private:
std::string GetName() const override { return "ctest_upload"; }
-protected:
- void BindArguments() override;
- void CheckArguments() override;
- cmCTestGenericHandler* InitializeHandler() override;
+ bool ExecuteUpload(UploadArguments& args, cmExecutionStatus& status) const;
- ArgumentParser::MaybeEmpty<std::vector<std::string>> Files;
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) const override;
};
diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx
deleted file mode 100644
index 59e2b88..0000000
--- a/Source/CTest/cmCTestUploadHandler.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCTestUploadHandler.h"
-
-#include <chrono>
-#include <ostream>
-#include <string>
-
-#include "cmCTest.h"
-#include "cmGeneratedFileStream.h"
-#include "cmVersion.h"
-#include "cmXMLWriter.h"
-
-cmCTestUploadHandler::cmCTestUploadHandler()
-{
- this->Initialize();
-}
-
-void cmCTestUploadHandler::Initialize()
-{
- this->Superclass::Initialize();
- this->Files.clear();
-}
-
-void cmCTestUploadHandler::SetFiles(std::set<std::string> const& files)
-{
- this->Files = files;
-}
-
-int cmCTestUploadHandler::ProcessHandler()
-{
- cmGeneratedFileStream ofs;
- if (!this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), "Upload.xml",
- ofs)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot open Upload.xml file" << std::endl);
- return -1;
- }
- std::string buildname =
- cmCTest::SafeBuildIdField(this->CTest->GetCTestConfiguration("BuildName"));
-
- cmXMLWriter xml(ofs);
- xml.StartDocument();
- xml.ProcessingInstruction("xml-stylesheet",
- "type=\"text/xsl\" "
- "href=\"Dart/Source/Server/XSL/Build.xsl "
- "<file:///Dart/Source/Server/XSL/Build.xsl> \"");
- xml.StartElement("Site");
- xml.Attribute("BuildName", buildname);
- xml.Attribute("BuildStamp",
- this->CTest->GetCurrentTag() + "-" +
- this->CTest->GetTestModelString());
- xml.Attribute("Name", this->CTest->GetCTestConfiguration("Site"));
- xml.Attribute("Generator",
- 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,
- "\tUpload file: " << file << std::endl, this->Quiet);
- xml.StartElement("File");
- xml.Attribute("filename", file);
- xml.StartElement("Content");
- xml.Attribute("encoding", "base64");
- xml.Content(this->CTest->Base64EncodeFile(file));
- xml.EndElement(); // Content
- xml.EndElement(); // File
- }
- xml.EndElement(); // Upload
- xml.EndElement(); // Site
- xml.EndDocument();
- return 0;
-}
diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h
deleted file mode 100644
index 55d21c1..0000000
--- a/Source/CTest/cmCTestUploadHandler.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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 <set>
-#include <string>
-
-#include "cmCTestGenericHandler.h"
-
-/** \class cmCTestUploadHandler
- * \brief Helper class for CTest
- *
- * Submit arbitrary files
- *
- */
-class cmCTestUploadHandler : public cmCTestGenericHandler
-{
-public:
- using Superclass = cmCTestGenericHandler;
-
- cmCTestUploadHandler();
-
- /*
- * The main entry point for this class
- */
- int ProcessHandler() override;
-
- void Initialize() override;
-
- /** Specify a set of files to submit. */
- void SetFiles(std::set<std::string> const& files);
-
-private:
- std::set<std::string> Files;
-};
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index cbbb5a5..ea38c26 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTestVC.h"
#include <cstdio>
@@ -8,13 +8,14 @@
#include <vector>
#include "cmCTest.h"
+#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmUVProcessChain.h"
-#include "cmValue.h"
#include "cmXMLWriter.h"
-cmCTestVC::cmCTestVC(cmCTest* ct, std::ostream& log)
+cmCTestVC::cmCTestVC(cmCTest* ct, cmMakefile* mf, std::ostream& log)
: CTest(ct)
+ , Makefile(mf)
, Log(log)
{
this->PathCount[PathUpdated] = 0;
@@ -37,7 +38,7 @@ void cmCTestVC::SetSourceDirectory(std::string const& dir)
this->SourceDirectory = dir;
}
-bool cmCTestVC::InitialCheckout(const std::string& command)
+bool cmCTestVC::InitialCheckout(std::string const& command)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" First perform the initial checkout: " << command << "\n");
@@ -68,7 +69,7 @@ bool cmCTestVC::InitialCheckout(const std::string& command)
return result;
}
-bool cmCTestVC::RunChild(const std::vector<std::string>& cmd,
+bool cmCTestVC::RunChild(std::vector<std::string> const& cmd,
OutputParser* out, OutputParser* err,
std::string workDir, Encoding encoding)
{
@@ -83,10 +84,10 @@ bool cmCTestVC::RunChild(const std::vector<std::string>& cmd,
return status.front().SpawnResult == 0 && status.front().ExitStatus == 0;
}
-std::string cmCTestVC::ComputeCommandLine(const std::vector<std::string>& cmd)
+std::string cmCTestVC::ComputeCommandLine(std::vector<std::string> const& cmd)
{
std::ostringstream line;
- const char* sep = "";
+ char const* sep = "";
for (auto const& arg : cmd) {
line << sep << "\"" << arg << "\"";
sep = " ";
@@ -94,7 +95,7 @@ std::string cmCTestVC::ComputeCommandLine(const std::vector<std::string>& cmd)
return line.str();
}
-bool cmCTestVC::RunUpdateCommand(const std::vector<std::string>& cmd,
+bool cmCTestVC::RunUpdateCommand(std::vector<std::string> const& cmd,
OutputParser* out, OutputParser* err,
Encoding encoding)
{
@@ -113,7 +114,7 @@ std::string cmCTestVC::GetNightlyTime()
{
// Get the nightly start time corresponding to the current dau.
struct tm* t = this->CTest->GetNightlyTime(
- this->CTest->GetCTestConfiguration("NightlyStartTime"),
+ this->Makefile->GetSafeDefinition("CTEST_NIGHTLY_START_TIME"),
this->CTest->GetTomorrowTag());
char current_time[1024];
snprintf(current_time, sizeof(current_time), "%04d-%02d-%02d %02d:%02d:%02d",
@@ -140,7 +141,7 @@ bool cmCTestVC::Update()
// Use the explicitly specified version.
std::string versionOverride =
- this->CTest->GetCTestConfiguration("UpdateVersionOverride");
+ this->Makefile->GetSafeDefinition("CTEST_UPDATE_VERSION_OVERRIDE");
if (!versionOverride.empty()) {
this->SetNewRevision(versionOverride);
return true;
@@ -148,7 +149,7 @@ bool cmCTestVC::Update()
// if update version only is on then do not actually update,
// just note the current version and finish
- if (!cmIsOn(this->CTest->GetCTestConfiguration("UpdateVersionOnly"))) {
+ if (!this->Makefile->IsOn("CTEST_UPDATE_VERSION_ONLY")) {
result = this->NoteOldRevision() && result;
this->Log << "--- Begin Update ---\n";
result = this->UpdateImpl() && result;
@@ -201,7 +202,7 @@ void cmCTestVC::WriteXMLEntry(cmXMLWriter& xml, std::string const& path,
std::string const& name, std::string const& full,
File const& f)
{
- static const char* desc[3] = { "Updated", "Modified", "Conflicting" };
+ static char const* desc[3] = { "Updated", "Modified", "Conflicting" };
Revision const& rev = f.Rev ? *f.Rev : this->Unknown;
std::string prior = f.PriorRev ? f.PriorRev->Rev : std::string("Unknown");
xml.StartElement(desc[f.Status]);
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index dd5456d..5ca5d75 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,6 +13,7 @@
class cmCTest;
class cmXMLWriter;
+class cmMakefile;
/** \class cmCTestVC
* \brief Base class for version control system handlers
@@ -22,7 +23,7 @@ class cmCTestVC : public cmProcessTools
{
public:
/** Construct with a CTest instance and update log stream. */
- cmCTestVC(cmCTest* ctest, std::ostream& log);
+ cmCTestVC(cmCTest* ctest, cmMakefile* mf, std::ostream& log);
virtual ~cmCTestVC();
@@ -36,7 +37,7 @@ public:
std::string GetNightlyTime();
/** Prepare the work tree. */
- bool InitialCheckout(const std::string& command);
+ bool InitialCheckout(std::string const& command);
/** Perform cleanup operations on the work tree. */
void Cleanup();
@@ -109,15 +110,15 @@ protected:
};
/** Convert a list of arguments to a human-readable command line. */
- static std::string ComputeCommandLine(const std::vector<std::string>& cmd);
+ static std::string ComputeCommandLine(std::vector<std::string> const& cmd);
/** Run a command line and send output to given parsers. */
- bool RunChild(const std::vector<std::string>& cmd, OutputParser* out,
+ bool RunChild(std::vector<std::string> const& cmd, OutputParser* out,
OutputParser* err, std::string workDir = {},
Encoding encoding = cmProcessOutput::Auto);
/** Run VC update command line and send output to given parsers. */
- bool RunUpdateCommand(const std::vector<std::string>& cmd, OutputParser* out,
+ bool RunUpdateCommand(std::vector<std::string> const& cmd, OutputParser* out,
OutputParser* err = nullptr,
Encoding encoding = cmProcessOutput::Auto);
@@ -128,6 +129,7 @@ protected:
// Instance of cmCTest running the script.
cmCTest* CTest;
+ cmMakefile* Makefile;
// A stream to which we write log information.
std::ostream& Log;
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index 3a6651f..5810b7d 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmParseBlanketJSCoverage.h"
#include <cstdio>
diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h
index e107454..404ccd6 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.h
+++ b/Source/CTest/cmParseBlanketJSCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
index 84d7de0..07fa478 100644
--- a/Source/CTest/cmParseCacheCoverage.cxx
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -70,7 +70,7 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles()
}
}
-bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
+bool cmParseCacheCoverage::ReadCMCovFile(char const* file)
{
cmsys::ifstream in(file);
if (!in) {
diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h
index 523f83b..44b51b7 100644
--- a/Source/CTest/cmParseCacheCoverage.h
+++ b/Source/CTest/cmParseCacheCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,5 +28,5 @@ protected:
// remove files with no coverage
void RemoveUnCoveredFiles();
// Read a single mcov file
- bool ReadCMCovFile(const char* f);
+ bool ReadCMCovFile(char const* f);
};
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 9311769..5178721 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -22,7 +22,7 @@ public:
}
protected:
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "source") {
this->InSource = false;
@@ -33,7 +33,7 @@ protected:
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
std::string tmp;
tmp.insert(0, data, length);
@@ -45,7 +45,7 @@ protected:
}
}
- void StartElement(const std::string& name, const char** atts) override
+ void StartElement(std::string const& name, char const** atts) override
{
std::string FoundSource;
std::string finalpath;
@@ -157,7 +157,7 @@ cmParseCoberturaCoverage::cmParseCoberturaCoverage(
{
}
-bool cmParseCoberturaCoverage::ReadCoverageXML(const char* xmlFile)
+bool cmParseCoberturaCoverage::ReadCoverageXML(char const* xmlFile)
{
cmParseCoberturaCoverage::XMLParser parser(this->CTest, this->Coverage);
parser.ParseFile(xmlFile);
diff --git a/Source/CTest/cmParseCoberturaCoverage.h b/Source/CTest/cmParseCoberturaCoverage.h
index 0340433..865dd1e 100644
--- a/Source/CTest/cmParseCoberturaCoverage.h
+++ b/Source/CTest/cmParseCoberturaCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,6 +10,7 @@
class cmCTest;
class cmCTestCoverageHandlerContainer;
+// noqa: spellcheck off
/** \class cmParsePythonCoverage
* \brief Parse coverage.py Python coverage information
*
@@ -19,6 +20,7 @@ class cmCTestCoverageHandlerContainer;
* Java-based Cobertura coverage application. This helper class parses
* that XML file to fill the coverage-handler container.
*/
+// noqa: spellcheck on
class cmParseCoberturaCoverage
{
public:
@@ -31,7 +33,7 @@ public:
bool inSource;
std::vector<std::string> filepaths;
//! Read the XML produced by running `coverage xml`
- bool ReadCoverageXML(const char* xmlFile);
+ bool ReadCoverageXML(char const* xmlFile);
private:
class XMLParser;
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 640873e..a781673 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -81,7 +81,7 @@ public:
}
return true;
}
- bool ParseFile(const char* file)
+ bool ParseFile(char const* file)
{
std::string line = file;
std::string lineresult;
@@ -224,7 +224,7 @@ bool cmParseDelphiCoverage::LoadCoverageData(
return true;
}
-bool cmParseDelphiCoverage::ReadDelphiHTML(const char* file)
+bool cmParseDelphiCoverage::ReadDelphiHTML(char const* file)
{
cmParseDelphiCoverage::HTMLParser parser(this->CTest, this->Coverage);
parser.ParseFile(file);
diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h
index 2a014a1..d114d54 100644
--- a/Source/CTest/cmParseDelphiCoverage.h
+++ b/Source/CTest/cmParseDelphiCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,9 +24,9 @@ class cmParseDelphiCoverage
public:
cmParseDelphiCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest);
bool LoadCoverageData(std::vector<std::string> const& files);
- bool ReadDelphiHTML(const char* file);
+ bool ReadDelphiHTML(char const* file);
// Read a single HTML file from output
- bool ReadHTMLFile(const char* f);
+ bool ReadHTMLFile(char const* f);
protected:
class HTMLParser;
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index c63b496..c7b2092 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -42,7 +42,7 @@ bool cmParseGTMCoverage::LoadCoverageData(std::string const& d)
return true;
}
-bool cmParseGTMCoverage::ReadMCovFile(const char* file)
+bool cmParseGTMCoverage::ReadMCovFile(char const* file)
{
cmsys::ifstream in(file);
if (!in) {
diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h
index c35bf6e..4e606d8 100644
--- a/Source/CTest/cmParseGTMCoverage.h
+++ b/Source/CTest/cmParseGTMCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,7 +26,7 @@ protected:
// implement virtual from parent
bool LoadCoverageData(std::string const& dir) override;
// Read a single mcov file
- bool ReadMCovFile(const char* f);
+ bool ReadMCovFile(char const* f);
// find out what line in a mumps file (filepath) the given entry point
// or function is. lineoffset is set by this method.
bool FindFunctionInMumpsFile(std::string const& filepath,
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index 9cf30df..11eb26f 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -23,9 +23,9 @@ public:
}
protected:
- void EndElement(const std::string& /*name*/) override {}
+ void EndElement(std::string const& /*name*/) override {}
- void StartElement(const std::string& name, const char** atts) override
+ void StartElement(std::string const& name, char const** atts) override
{
if (name == "package") {
this->PackageName = atts[1];
@@ -170,7 +170,7 @@ bool cmParseJacocoCoverage::LoadCoverageData(
return true;
}
-bool cmParseJacocoCoverage::ReadJacocoXML(const char* file)
+bool cmParseJacocoCoverage::ReadJacocoXML(char const* file)
{
cmParseJacocoCoverage::XMLParser parser(this->CTest, this->Coverage);
parser.ParseFile(file);
diff --git a/Source/CTest/cmParseJacocoCoverage.h b/Source/CTest/cmParseJacocoCoverage.h
index 3442dd0..93bfe09 100644
--- a/Source/CTest/cmParseJacocoCoverage.h
+++ b/Source/CTest/cmParseJacocoCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,7 +35,7 @@ private:
// remove files with no coverage
void RemoveUnCoveredFiles();
// Read a single mcov file
- bool ReadJacocoXML(const char* f);
+ bool ReadJacocoXML(char const* f);
// split a string based on ,
bool SplitString(std::vector<std::string>& args, std::string const& line);
bool FindJavaFile(std::string const& routine, std::string& filepath);
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index dc3064d..6829d85 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -22,7 +22,7 @@ cmParseMumpsCoverage::cmParseMumpsCoverage(
cmParseMumpsCoverage::~cmParseMumpsCoverage() = default;
-bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
+bool cmParseMumpsCoverage::ReadCoverageFile(char const* file)
{
// Read the gtm_coverage.mcov file, that has two lines of data:
// packages:/full/path/to/Vista/Packages
@@ -131,7 +131,7 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
return true;
}
// try some alternate names
- const char* tryname[] = { "GUX", "GTM", "ONT", nullptr };
+ char const* tryname[] = { "GUX", "GTM", "ONT", nullptr };
for (int k = 0; tryname[k] != nullptr; k++) {
std::string routine2 = routine + tryname[k];
i = this->RoutineToDirectory.find(routine2);
diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h
index 00a8431..9d266c4 100644
--- a/Source/CTest/cmParseMumpsCoverage.h
+++ b/Source/CTest/cmParseMumpsCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,7 +23,7 @@ public:
virtual ~cmParseMumpsCoverage();
// This is the toplevel coverage file locating the coverage files
// and the mumps source code package tree.
- bool ReadCoverageFile(const char* file);
+ bool ReadCoverageFile(char const* file);
protected:
// sub classes will use this to
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index 044f518..14c9fe8 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -171,7 +171,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::istream& in)
return false;
}
-bool cmParsePHPCoverage::ReadPHPData(const char* file)
+bool cmParsePHPCoverage::ReadPHPData(char const* file)
{
cmsys::ifstream in(file);
if (!in) {
@@ -200,7 +200,7 @@ bool cmParsePHPCoverage::ReadPHPData(const char* file)
return true;
}
-bool cmParsePHPCoverage::ReadPHPCoverageDirectory(const char* d)
+bool cmParsePHPCoverage::ReadPHPCoverageDirectory(char const* d)
{
cmsys::Directory dir;
if (!dir.Load(d)) {
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index 763a6bb..c2856e4 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,11 +21,11 @@ class cmParsePHPCoverage
{
public:
cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest);
- bool ReadPHPCoverageDirectory(const char* dir);
+ bool ReadPHPCoverageDirectory(char const* dir);
void PrintCoverage();
private:
- bool ReadPHPData(const char* file);
+ bool ReadPHPData(char const* file);
bool ReadArraySize(std::istream& in, int& size);
bool ReadFileInformation(std::istream& in);
bool ReadInt(std::istream& in, int& v);
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 2c809b6..eefbbcf 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmProcess.h"
#include <csignal>
@@ -57,6 +57,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
return false;
}
this->StartTime = std::chrono::steady_clock::now();
+ this->SystemStartTime = std::chrono::system_clock::now();
this->ProcessArgs.clear();
// put the command as arg0
this->ProcessArgs.push_back(this->Command.c_str());
@@ -106,6 +107,11 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
options.stdio_count = 3; // in, out and err
options.exit_cb = &cmProcess::OnExitCB;
options.stdio = stdio;
+#if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
+ if (!this->Runner->GetCTest()->GetInteractiveDebugMode()) {
+ options.flags = UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
+ }
+#endif
#if !defined(CMAKE_USE_SYSTEM_LIBUV)
std::vector<char> cpumask;
if (affinity && !affinity->empty()) {
@@ -166,7 +172,7 @@ bool cmProcess::Buffer::GetLine(std::string& line)
for (size_type sz = this->size(); this->Last != sz; ++this->Last) {
if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') {
// Extract the range first..last as a line.
- const char* text = this->data() + this->First;
+ char const* text = this->data() + this->First;
size_type length = this->Last - this->First;
while (length && text[length - 1] == '\r') {
length--;
@@ -205,13 +211,13 @@ bool cmProcess::Buffer::GetLast(std::string& line)
}
void cmProcess::OnReadCB(uv_stream_t* stream, ssize_t nread,
- const uv_buf_t* buf)
+ uv_buf_t const* buf)
{
auto* self = static_cast<cmProcess*>(stream->data);
self->OnRead(nread, buf);
}
-void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf)
+void cmProcess::OnRead(ssize_t nread, uv_buf_t const* buf)
{
std::string line;
if (nread > 0) {
@@ -290,7 +296,7 @@ void cmProcess::OnTimeout()
if (p->TimeoutGracePeriod) {
this->Timeout = *p->TimeoutGracePeriod;
} else {
- static const cmDuration defaultGracePeriod{ 1.0 };
+ static cmDuration const defaultGracePeriod{ 1.0 };
this->Timeout = defaultGracePeriod;
}
this->StartTimer();
@@ -530,7 +536,7 @@ std::string cmProcess::GetExitExceptionString() const
case STATUS_NO_MEMORY:
default:
char buf[1024];
- const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
+ char const* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
snprintf(buf, sizeof(buf), fmt, this->ExitValue);
exception_str.assign(buf);
}
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index dc755eb..33b781c 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -66,6 +66,14 @@ public:
void SetId(int id) { this->Id = id; }
int64_t GetExitValue() const { return this->ExitValue; }
cmDuration GetTotalTime() { return this->TotalTime; }
+ std::chrono::steady_clock::time_point GetStartTime()
+ {
+ return this->StartTime;
+ }
+ std::chrono::system_clock::time_point GetSystemStartTime()
+ {
+ return this->SystemStartTime;
+ }
enum class Exception
{
@@ -97,6 +105,7 @@ private:
cm::optional<cmDuration> Timeout;
TimeoutReason TimeoutReason_ = TimeoutReason::Normal;
std::chrono::steady_clock::time_point StartTime;
+ std::chrono::system_clock::time_point SystemStartTime;
cmDuration TotalTime;
bool ReadHandleClosed = false;
bool ProcessHandleClosed = false;
@@ -115,13 +124,13 @@ private:
int term_signal);
static void OnTimeoutCB(uv_timer_t* timer);
static void OnReadCB(uv_stream_t* stream, ssize_t nread,
- const uv_buf_t* buf);
+ uv_buf_t const* buf);
static void OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
uv_buf_t* buf);
void OnExit(int64_t exit_status, int term_signal);
void OnTimeout();
- void OnRead(ssize_t nread, const uv_buf_t* buf);
+ void OnRead(ssize_t nread, uv_buf_t const* buf);
void OnAllocate(size_t suggested_size, uv_buf_t* buf);
void StartTimer();
@@ -142,7 +151,7 @@ private:
std::string Command;
std::string WorkingDirectory;
std::vector<std::string> Arguments;
- std::vector<const char*> ProcessArgs;
+ std::vector<char const*> ProcessArgs;
int Id;
int64_t ExitValue;
Termination TerminationStyle = Termination::Normal;
diff --git a/Source/CTest/cmUVJobServerClient.cxx b/Source/CTest/cmUVJobServerClient.cxx
index 055b29b..6ea5452 100644
--- a/Source/CTest/cmUVJobServerClient.cxx
+++ b/Source/CTest/cmUVJobServerClient.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmUVJobServerClient.h"
#include <cassert>
@@ -169,7 +169,7 @@ public:
void Connect();
void ConnectFDs(int rfd, int wfd);
- void ConnectFIFO(const char* path);
+ void ConnectFIFO(char const* path);
void Disconnect(int status);
cm::uv_pipe_ptr OpenFD(int fd);
@@ -180,10 +180,10 @@ public:
static void OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
uv_buf_t* buf);
static void OnReadCB(uv_stream_t* stream, ssize_t nread,
- const uv_buf_t* buf);
+ uv_buf_t const* buf);
void OnAllocate(size_t suggested_size, uv_buf_t* buf);
- void OnRead(ssize_t nread, const uv_buf_t* buf);
+ void OnRead(ssize_t nread, uv_buf_t const* buf);
char ReadBuf = '.';
@@ -220,7 +220,7 @@ void ImplPosix::Connect()
// --jobserver-auth= for gnu make versions >= 4.2
// --jobserver-fds= for gnu make versions < 4.2
// -J for bsd make
- static const std::vector<cm::string_view> prefixes = {
+ static std::vector<cm::string_view> const prefixes = {
"--jobserver-auth=", "--jobserver-fds=", "-J"
};
@@ -300,7 +300,7 @@ void ImplPosix::ConnectFDs(int rfd, int wfd)
this->Conn = Connection::FDs;
}
-void ImplPosix::ConnectFIFO(const char* path)
+void ImplPosix::ConnectFIFO(char const* path)
{
int fd = open(path, O_RDWR);
if (fd < 0) {
@@ -385,7 +385,7 @@ void ImplPosix::OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
}
void ImplPosix::OnReadCB(uv_stream_t* stream, ssize_t nread,
- const uv_buf_t* buf)
+ uv_buf_t const* buf)
{
auto* self = static_cast<ImplPosix*>(stream->data);
self->OnRead(nread, buf);
@@ -396,7 +396,7 @@ void ImplPosix::OnAllocate(size_t /*suggested_size*/, uv_buf_t* buf)
*buf = uv_buf_init(&this->ReadBuf, 1);
}
-void ImplPosix::OnRead(ssize_t nread, const uv_buf_t* /*buf*/)
+void ImplPosix::OnRead(ssize_t nread, uv_buf_t const* /*buf*/)
{
if (nread == 0) {
return;
diff --git a/Source/CTest/cmUVJobServerClient.h b/Source/CTest/cmUVJobServerClient.h
index bbb5f08..c52407e 100644
--- a/Source/CTest/cmUVJobServerClient.h
+++ b/Source/CTest/cmUVJobServerClient.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt
index bd7c415..1f04bd2 100644
--- a/Source/Checks/Curses/CMakeLists.txt
+++ b/Source/Checks/Curses/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13...3.29 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.30 FATAL_ERROR)
project(CheckCurses C)
set(CURSES_NEED_NCURSES TRUE)
diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx
index 456ec46..ccbb339 100644
--- a/Source/Checks/cm_cxx_filesystem.cxx
+++ b/Source/Checks/cm_cxx_filesystem.cxx
@@ -50,7 +50,7 @@ int main()
class my_string_view : public std::string_view
{
public:
- my_string_view(const char* p)
+ my_string_view(char const* p)
: std::string_view(p)
{
}
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index c24ee76..bd2aee3 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
add_executable(ccmake
ccmake.cxx
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index bc21cd0..8385b13 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <csignal>
#include <cstdio>
@@ -24,12 +24,12 @@
#include "cmake.h"
namespace {
-const cmDocumentationEntry cmDocumentationName = {
+cmDocumentationEntry const cmDocumentationName = {
{},
" ccmake - Curses Interface for CMake."
};
-const cmDocumentationEntry cmDocumentationUsage[2] = {
+cmDocumentationEntry const cmDocumentationUsage[2] = {
{ {},
" ccmake <path-to-source>\n"
" ccmake <path-to-existing-build>" },
@@ -39,7 +39,7 @@ const cmDocumentationEntry cmDocumentationUsage[2] = {
"directory to re-generate its build system." },
};
-const cmDocumentationEntry cmDocumentationUsageNote = {
+cmDocumentationEntry const cmDocumentationUsageNote = {
{},
"Run 'ccmake --help' for more information."
};
@@ -101,7 +101,7 @@ int main(int argc, char const* const* argv)
}
}
- std::string cacheDir = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cacheDir = cmSystemTools::GetLogicalWorkingDirectory();
for (i = 1; i < args.size(); ++i) {
std::string const& arg = args[i];
if (cmHasPrefix(arg, "-B")) {
@@ -157,7 +157,7 @@ int main(int argc, char const* const* argv)
* joined by '\n' before display.
* Removing any trailing '\n' avoid extra empty lines in the final results
*/
- auto cleanMessage = [](const std::string& message) -> std::string {
+ auto cleanMessage = [](std::string const& message) -> std::string {
auto msg = message;
if (!msg.empty() && msg.back() == '\n') {
msg.pop_back();
@@ -165,13 +165,13 @@ int main(int argc, char const* const* argv)
return msg;
};
cmSystemTools::SetMessageCallback(
- [&](const std::string& message, const cmMessageMetadata& md) {
+ [&](std::string const& message, cmMessageMetadata const& md) {
myform->AddError(cleanMessage(message), md.title);
});
- cmSystemTools::SetStderrCallback([&](const std::string& message) {
+ cmSystemTools::SetStderrCallback([&](std::string const& message) {
myform->AddError(cleanMessage(message), "");
});
- cmSystemTools::SetStdoutCallback([&](const std::string& message) {
+ cmSystemTools::SetStdoutCallback([&](std::string const& message) {
myform->UpdateProgress(cleanMessage(message), -1);
});
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx
index c4dbed8..ca308c8 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.cxx
+++ b/Source/CursesDialog/cmCursesBoolWidget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesBoolWidget.h"
#include <string>
diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h
index 746825b..d9fa96f 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.h
+++ b/Source/CursesDialog/cmCursesBoolWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 3a47485..557d32c 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesCacheEntryComposite.h"
#include <cassert>
@@ -22,7 +22,7 @@
#include "cmValue.h"
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
- const std::string& key, int labelwidth, int entrywidth)
+ std::string const& key, int labelwidth, int entrywidth)
: Key(key)
, LabelWidth(labelwidth)
, EntryWidth(entrywidth)
@@ -35,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
- const std::string& key, cmState* state, bool isNew, int labelwidth,
+ std::string const& key, cmState* state, bool isNew, int labelwidth,
int entrywidth)
: Key(key)
, LabelWidth(labelwidth)
@@ -100,7 +100,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
cmCursesCacheEntryComposite::~cmCursesCacheEntryComposite() = default;
-const char* cmCursesCacheEntryComposite::GetValue()
+char const* cmCursesCacheEntryComposite::GetValue()
{
if (this->Label) {
return this->Label->GetValue();
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index d414918..964b988 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -14,9 +14,9 @@ class cmState;
class cmCursesCacheEntryComposite
{
public:
- cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
+ cmCursesCacheEntryComposite(std::string const& key, int labelwidth,
int entrywidth);
- cmCursesCacheEntryComposite(const std::string& key, cmState* state,
+ cmCursesCacheEntryComposite(std::string const& key, cmState* state,
bool isNew, int labelwidth, int entrywidth);
~cmCursesCacheEntryComposite();
@@ -28,7 +28,7 @@ public:
cmCursesCacheEntryComposite& operator=(cmCursesCacheEntryComposite&&) =
default;
- const char* GetValue();
+ char const* GetValue();
friend class cmCursesMainForm;
diff --git a/Source/CursesDialog/cmCursesColor.cxx b/Source/CursesDialog/cmCursesColor.cxx
index c0b468b..1b29076 100644
--- a/Source/CursesDialog/cmCursesColor.cxx
+++ b/Source/CursesDialog/cmCursesColor.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesColor.h"
#include <cctype>
diff --git a/Source/CursesDialog/cmCursesColor.h b/Source/CursesDialog/cmCursesColor.h
index 4e8a1e4..3aed125 100644
--- a/Source/CursesDialog/cmCursesColor.h
+++ b/Source/CursesDialog/cmCursesColor.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
class cmCursesColor
diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx
index da0478a..5045bbd 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.cxx
+++ b/Source/CursesDialog/cmCursesDummyWidget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesDummyWidget.h"
#include "cmCursesWidget.h"
diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h
index 4347746..b3c6f8f 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.h
+++ b/Source/CursesDialog/cmCursesDummyWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx
index 518da4f..4471058 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.cxx
+++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesFilePathWidget.h"
#include "cmCursesPathWidget.h"
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h
index 2ae5d14..74bdb0a 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.h
+++ b/Source/CursesDialog/cmCursesFilePathWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index 900fbca..93d4b0f 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesForm.h"
#include <cstdlib>
@@ -40,7 +40,7 @@ void cmCursesForm::DebugEnd()
cmCursesForm::DebugFile.close();
}
-void cmCursesForm::LogMessage(const char* msg)
+void cmCursesForm::LogMessage(char const* msg)
{
if (!cmCursesForm::Debug) {
return;
@@ -53,7 +53,7 @@ void cmCursesForm::HandleResize()
{
endwin();
if (!initscr()) {
- static const char errmsg[] = "Error: ncurses initialization failed\n";
+ static char const errmsg[] = "Error: ncurses initialization failed\n";
#ifdef _WIN32
fprintf(stderr, "%s", errmsg);
#else
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index 3a1eb25..7bae401 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,7 +35,7 @@ public:
// Description:
// During a CMake run, an error handle should add errors
// to be displayed afterwards.
- virtual void AddError(const std::string&, const char*) {}
+ virtual void AddError(std::string const&, char const*) {}
// Description:
// Turn debugging on. This will create ccmakelog.txt.
@@ -47,7 +47,7 @@ public:
// Description:
// Write a debugging message.
- static void LogMessage(const char* msg);
+ static void LogMessage(char const* msg);
// Description:
// Return the FORM. Should be only used by low-level methods.
diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx
index 83aea5a..44d94c4 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.cxx
+++ b/Source/CursesDialog/cmCursesLabelWidget.cxx
@@ -1,11 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesLabelWidget.h"
#include "cmCursesWidget.h"
cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, int left,
- int top, const std::string& name)
+ int top, std::string const& name)
: cmCursesWidget(width, height, left, top)
{
field_opts_off(this->Field, O_EDIT);
diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h
index c10aa37..0a957c9 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.h
+++ b/Source/CursesDialog/cmCursesLabelWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -15,7 +15,7 @@ class cmCursesLabelWidget : public cmCursesWidget
{
public:
cmCursesLabelWidget(int width, int height, int left, int top,
- const std::string& name);
+ std::string const& name);
~cmCursesLabelWidget() override;
cmCursesLabelWidget(cmCursesLabelWidget const&) = delete;
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 6e6f0d6..8608c37 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesLongMessageForm.h"
#include <cstdio>
@@ -17,7 +17,7 @@ inline int ctrl(int z)
}
cmCursesLongMessageForm::cmCursesLongMessageForm(
- std::vector<std::string> const& messages, const char* title,
+ std::vector<std::string> const& messages, char const* title,
ScrollBehavior scrollBehavior)
: Scrolling(scrollBehavior)
{
@@ -148,7 +148,7 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
refresh();
}
-void cmCursesLongMessageForm::DrawMessage(const char* msg) const
+void cmCursesLongMessageForm::DrawMessage(char const* msg) const
{
int i = 0;
while (msg[i] != '\0' && i < MAX_CONTENT_SIZE) {
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index 4f69cb1..f2e29ed 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,7 +20,7 @@ public:
};
cmCursesLongMessageForm(std::vector<std::string> const& messages,
- const char* title, ScrollBehavior scrollBehavior);
+ char const* title, ScrollBehavior scrollBehavior);
~cmCursesLongMessageForm() override;
cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
@@ -50,7 +50,7 @@ public:
protected:
static constexpr int MAX_CONTENT_SIZE = 60000;
- void DrawMessage(const char* msg) const;
+ void DrawMessage(char const* msg) const;
std::string Messages;
std::string Title;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 81bf0b3..cd42fb2 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesMainForm.h"
#include <algorithm>
@@ -61,7 +61,7 @@ cmCursesMainForm::~cmCursesMainForm()
}
// See if a cache entry is in the list of entries in the ui.
-bool cmCursesMainForm::LookForCacheEntry(const std::string& key)
+bool cmCursesMainForm::LookForCacheEntry(std::string const& key)
{
return std::any_of(this->Entries.begin(), this->Entries.end(),
[&key](cmCursesCacheEntryComposite const& entry) {
@@ -326,7 +326,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
" ");
}
{
- const char* toggleKeyInstruction =
+ char const* toggleKeyInstruction =
" [t] Toggle advanced mode (currently %s)";
snprintf(thirdLine, sizeof(thirdLine), toggleKeyInstruction,
this->AdvancedMode ? "on" : "off");
@@ -439,7 +439,7 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional<std::string> message)
pos_form_cursor(this->Form);
}
-void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog)
+void cmCursesMainForm::UpdateProgress(std::string const& msg, float prog)
{
if (prog >= 0) {
constexpr int progressBarWidth = 40;
@@ -473,7 +473,7 @@ int cmCursesMainForm::Configure(int noconfigure)
if (noconfigure == 0) {
this->UpdateProgress("Configuring", 0);
this->CMakeInstance->SetProgressCallback(
- [this](const std::string& msg, float prog) {
+ [this](std::string const& msg, float prog) {
this->UpdateProgress(msg, prog);
});
}
@@ -505,7 +505,7 @@ int cmCursesMainForm::Configure(int noconfigure)
int xx;
int yy;
getmaxyx(stdscr, yy, xx);
- const char* title = "Configure produced the following output";
+ char const* title = "Configure produced the following output";
if (cmSystemTools::GetErrorOccurredFlag()) {
title = "Configure failed with the following output";
}
@@ -540,7 +540,7 @@ int cmCursesMainForm::Generate()
this->UpdateProgress("Generating", 0);
this->CMakeInstance->SetProgressCallback(
- [this](const std::string& msg, float prog) {
+ [this](std::string const& msg, float prog) {
this->UpdateProgress(msg, prog);
});
@@ -560,7 +560,7 @@ int cmCursesMainForm::Generate()
int xx;
int yy;
getmaxyx(stdscr, yy, xx);
- const char* title = "Generate produced the following output";
+ char const* title = "Generate produced the following output";
if (cmSystemTools::GetErrorOccurredFlag()) {
title = "Generate failed with the following output";
}
@@ -587,15 +587,15 @@ int cmCursesMainForm::Generate()
return 0;
}
-void cmCursesMainForm::AddError(const std::string& message,
- const char* /*unused*/)
+void cmCursesMainForm::AddError(std::string const& message,
+ char const* /*unused*/)
{
this->Outputs.emplace_back(message);
this->HasNonStatusOutputs = true;
this->DisplayOutputs(message);
}
-void cmCursesMainForm::RemoveEntry(const char* value)
+void cmCursesMainForm::RemoveEntry(char const* value)
{
if (!value) {
return;
@@ -604,7 +604,7 @@ void cmCursesMainForm::RemoveEntry(const char* value)
auto removeIt =
std::find_if(this->Entries.begin(), this->Entries.end(),
[value](cmCursesCacheEntryComposite& entry) -> bool {
- const char* val = entry.GetValue();
+ char const* val = entry.GetValue();
return val && !strcmp(value, val);
});
@@ -618,7 +618,7 @@ void cmCursesMainForm::RemoveEntry(const char* value)
void cmCursesMainForm::FillCacheManagerFromUI()
{
for (cmCursesCacheEntryComposite& entry : this->Entries) {
- const std::string& cacheKey = entry.Key;
+ std::string const& cacheKey = entry.Key;
cmValue existingValue =
this->CMakeInstance->GetState()->GetCacheEntryValue(cacheKey);
if (existingValue) {
@@ -643,7 +643,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
}
void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type,
- const std::string& in, std::string& out) const
+ std::string const& in, std::string& out) const
{
out = in.substr(0, in.find_last_not_of(' ') + 1);
if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
@@ -826,7 +826,7 @@ void cmCursesMainForm::HandleInput()
int findex = field_index(cur);
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(
field_userptr(this->Fields[findex - 2]));
- const char* curField = lbl->GetValue();
+ char const* curField = lbl->GetValue();
cmValue helpString = nullptr;
cmValue existingValue =
@@ -955,7 +955,7 @@ void cmCursesMainForm::HandleInput()
}
}
-int cmCursesMainForm::LoadCache(const char* /*unused*/)
+int cmCursesMainForm::LoadCache(char const* /*unused*/)
{
int r = this->CMakeInstance->LoadCache();
@@ -972,12 +972,12 @@ int cmCursesMainForm::LoadCache(const char* /*unused*/)
return r;
}
-void cmCursesMainForm::JumpToCacheEntry(const char* astr)
+void cmCursesMainForm::JumpToCacheEntry(char const* astr)
{
this->JumpToCacheEntry(astr, false);
}
-void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse)
+void cmCursesMainForm::JumpToCacheEntry(char const* astr, bool reverse)
{
std::string str;
if (astr) {
@@ -998,7 +998,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse)
field_userptr(this->Fields[findex - 2]));
}
if (lbl) {
- const char* curField = lbl->GetValue();
+ char const* curField = lbl->GetValue();
if (curField) {
std::string cfld = cmSystemTools::LowerCase(curField);
if (cfld.find(str) != std::string::npos && findex != start_index) {
@@ -1057,7 +1057,7 @@ void cmCursesMainForm::DisplayOutputs(std::string const& newOutput)
}
}
-const char* cmCursesMainForm::s_ConstHelpMessage =
+char const* cmCursesMainForm::s_ConstHelpMessage =
"CMake is used to configure and generate build files for software projects. "
"The basic steps for configuring a project with ccmake are as follows:\n\n"
"1. Run ccmake in the directory where you want the object and executable "
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 1ce75e7..d92b6c2 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -53,7 +53,7 @@ public:
* Returns true if an entry with the given key is in the
* list of current composites.
*/
- bool LookForCacheEntry(const std::string& key);
+ bool LookForCacheEntry(std::string const& key);
enum
{
@@ -84,7 +84,7 @@ public:
* During a CMake run, an error handle should add errors
* to be displayed afterwards.
*/
- void AddError(const std::string& message, const char* title) override;
+ void AddError(std::string const& message, char const* title) override;
/**
* Write files to cache file without reconfiguring.
@@ -105,30 +105,30 @@ public:
/**
* Used by main program
*/
- int LoadCache(const char* dir);
+ int LoadCache(char const* dir);
/**
* Progress callback
*/
- void UpdateProgress(const std::string& msg, float prog);
+ void UpdateProgress(std::string const& msg, float prog);
protected:
// Copy the cache values from the user interface to the actual
// cache.
void FillCacheManagerFromUI();
// Fix formatting of values to a consistent form.
- void FixValue(cmStateEnums::CacheEntryType type, const std::string& in,
+ void FixValue(cmStateEnums::CacheEntryType type, std::string const& in,
std::string& out) const;
// Re-post the existing fields. Used to toggle between
// normal and advanced modes. Render() should be called
// afterwards.
void RePost();
// Remove an entry from the interface and the cache.
- void RemoveEntry(const char* value);
+ void RemoveEntry(char const* value);
// Jump to the cache entry whose name matches the string.
- void JumpToCacheEntry(const char* str);
- void JumpToCacheEntry(const char* str, bool reverse);
+ void JumpToCacheEntry(char const* str);
+ void JumpToCacheEntry(char const* str, bool reverse);
// Clear and reset the output log and state
void ResetOutputs();
@@ -156,7 +156,7 @@ protected:
std::vector<std::string> HelpMessage;
// Common help
- static const char* s_ConstHelpMessage;
+ static char const* s_ConstHelpMessage;
// Fields displayed. Includes labels, new entry markers, entries
std::vector<FIELD*> Fields;
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index 8df32e2..c19ccde 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -1,12 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesOptionsWidget.h"
#include "cmCursesColor.h"
#include "cmCursesWidget.h"
#include "cmStateTypes.h"
-#define ctrl(z) ((z)&037)
+#define ctrl(z) ((z) & 037)
cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
int top)
@@ -79,7 +79,7 @@ void cmCursesOptionsWidget::PreviousOption()
this->SetValue(this->Options[this->CurrentOption]);
}
-void cmCursesOptionsWidget::SetOption(const std::string& value)
+void cmCursesOptionsWidget::SetOption(std::string const& value)
{
this->CurrentOption = 0; // default to 0 index
this->SetValue(value);
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index cb06e4d..80ba37f 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,7 +25,7 @@ public:
// when this widget has focus. Returns true if the input was
// handled.
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override;
- void SetOption(const std::string&);
+ void SetOption(std::string const&);
void AddOption(std::string const&);
void NextOption();
void PreviousOption();
diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx
index 8ed42de..4bdd5fb 100644
--- a/Source/CursesDialog/cmCursesPathWidget.cxx
+++ b/Source/CursesDialog/cmCursesPathWidget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesPathWidget.h"
#include <vector>
diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h
index 79e342e..7aa4545 100644
--- a/Source/CursesDialog/cmCursesPathWidget.h
+++ b/Source/CursesDialog/cmCursesPathWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h
index 9745b97..9797306 100644
--- a/Source/CursesDialog/cmCursesStandardIncludes.h
+++ b/Source/CursesDialog/cmCursesStandardIncludes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index c0d06ce..d472236 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesStringWidget.h"
#include <cstdio>
@@ -165,17 +165,17 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
return true;
}
-void cmCursesStringWidget::SetString(const std::string& value)
+void cmCursesStringWidget::SetString(std::string const& value)
{
this->SetValue(value);
}
-const char* cmCursesStringWidget::GetString()
+char const* cmCursesStringWidget::GetString()
{
return this->GetValue();
}
-const char* cmCursesStringWidget::GetValue()
+char const* cmCursesStringWidget::GetValue()
{
return field_buffer(this->Field, 0);
}
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index faa2ade..6d94369 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -32,9 +32,9 @@ public:
/**
* Set/Get the string.
*/
- void SetString(const std::string& value);
- const char* GetString();
- const char* GetValue() override;
+ void SetString(std::string const& value);
+ char const* GetString();
+ char const* GetValue() override;
/**
* Set/Get InEdit flag. Can be used to tell the widget to leave
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index cc07411..321db8e 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCursesWidget.h"
cmCursesWidget::cmCursesWidget(int width, int height, int left, int top)
@@ -32,13 +32,13 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage)
}
}
-void cmCursesWidget::SetValue(const std::string& value)
+void cmCursesWidget::SetValue(std::string const& value)
{
this->Value = value;
set_field_buffer(this->Field, 0, const_cast<char*>(value.c_str()));
}
-const char* cmCursesWidget::GetValue()
+char const* cmCursesWidget::GetValue()
{
return this->Value.c_str();
}
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index 29ec28b..a65f935 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -37,8 +37,8 @@ public:
* Set/Get the value (setting the value also changes the contents
* of the field buffer).
*/
- virtual void SetValue(const std::string& value);
- virtual const char* GetValue();
+ virtual void SetValue(std::string const& value);
+ virtual char const* GetValue();
/**
* Get the type of the widget (STRING, PATH etc...)
diff --git a/Source/CursesDialog/form/CMakeLists.txt b/Source/CursesDialog/form/CMakeLists.txt
index 63214e3..dbf4af0 100644
--- a/Source/CursesDialog/form/CMakeLists.txt
+++ b/Source/CursesDialog/form/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
project(CMAKE_FORM)
diff --git a/Source/CursesDialog/form/cmFormConfigure.h.in b/Source/CursesDialog/form/cmFormConfigure.h.in
index 511c525..faf35e7 100644
--- a/Source/CursesDialog/form/cmFormConfigure.h.in
+++ b/Source/CursesDialog/form/cmFormConfigure.h.in
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef CMFORMCONFIGURE_H
#define CMFORMCONFIGURE_H
diff --git a/Source/LexerParser/cmCTestResourceGroupsLexer.cxx b/Source/LexerParser/cmCTestResourceGroupsLexer.cxx
index f1d351a..2509bdb 100644
--- a/Source/LexerParser/cmCTestResourceGroupsLexer.cxx
+++ b/Source/LexerParser/cmCTestResourceGroupsLexer.cxx
@@ -641,7 +641,7 @@ static const flex_int16_t yy_chk[44] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C++ and modified to build everywhere.
diff --git a/Source/LexerParser/cmCTestResourceGroupsLexer.in.l b/Source/LexerParser/cmCTestResourceGroupsLexer.in.l
index ac9cbaf..ec2a186 100644
--- a/Source/LexerParser/cmCTestResourceGroupsLexer.in.l
+++ b/Source/LexerParser/cmCTestResourceGroupsLexer.in.l
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C++ and modified to build everywhere.
diff --git a/Source/LexerParser/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx
deleted file mode 100644
index 4b7eb79..0000000
--- a/Source/LexerParser/cmCommandArgumentLexer.cxx
+++ /dev/null
@@ -1,2246 +0,0 @@
-#include "cmStandardLexer.h"
-
-#define FLEXINT_H 1
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 4
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-#ifdef yy_create_buffer
-#define cmCommandArgument_yy_create_buffer_ALREADY_DEFINED
-#else
-#define yy_create_buffer cmCommandArgument_yy_create_buffer
-#endif
-
-#ifdef yy_delete_buffer
-#define cmCommandArgument_yy_delete_buffer_ALREADY_DEFINED
-#else
-#define yy_delete_buffer cmCommandArgument_yy_delete_buffer
-#endif
-
-#ifdef yy_scan_buffer
-#define cmCommandArgument_yy_scan_buffer_ALREADY_DEFINED
-#else
-#define yy_scan_buffer cmCommandArgument_yy_scan_buffer
-#endif
-
-#ifdef yy_scan_string
-#define cmCommandArgument_yy_scan_string_ALREADY_DEFINED
-#else
-#define yy_scan_string cmCommandArgument_yy_scan_string
-#endif
-
-#ifdef yy_scan_bytes
-#define cmCommandArgument_yy_scan_bytes_ALREADY_DEFINED
-#else
-#define yy_scan_bytes cmCommandArgument_yy_scan_bytes
-#endif
-
-#ifdef yy_init_buffer
-#define cmCommandArgument_yy_init_buffer_ALREADY_DEFINED
-#else
-#define yy_init_buffer cmCommandArgument_yy_init_buffer
-#endif
-
-#ifdef yy_flush_buffer
-#define cmCommandArgument_yy_flush_buffer_ALREADY_DEFINED
-#else
-#define yy_flush_buffer cmCommandArgument_yy_flush_buffer
-#endif
-
-#ifdef yy_load_buffer_state
-#define cmCommandArgument_yy_load_buffer_state_ALREADY_DEFINED
-#else
-#define yy_load_buffer_state cmCommandArgument_yy_load_buffer_state
-#endif
-
-#ifdef yy_switch_to_buffer
-#define cmCommandArgument_yy_switch_to_buffer_ALREADY_DEFINED
-#else
-#define yy_switch_to_buffer cmCommandArgument_yy_switch_to_buffer
-#endif
-
-#ifdef yypush_buffer_state
-#define cmCommandArgument_yypush_buffer_state_ALREADY_DEFINED
-#else
-#define yypush_buffer_state cmCommandArgument_yypush_buffer_state
-#endif
-
-#ifdef yypop_buffer_state
-#define cmCommandArgument_yypop_buffer_state_ALREADY_DEFINED
-#else
-#define yypop_buffer_state cmCommandArgument_yypop_buffer_state
-#endif
-
-#ifdef yyensure_buffer_stack
-#define cmCommandArgument_yyensure_buffer_stack_ALREADY_DEFINED
-#else
-#define yyensure_buffer_stack cmCommandArgument_yyensure_buffer_stack
-#endif
-
-#ifdef yylex
-#define cmCommandArgument_yylex_ALREADY_DEFINED
-#else
-#define yylex cmCommandArgument_yylex
-#endif
-
-#ifdef yyrestart
-#define cmCommandArgument_yyrestart_ALREADY_DEFINED
-#else
-#define yyrestart cmCommandArgument_yyrestart
-#endif
-
-#ifdef yylex_init
-#define cmCommandArgument_yylex_init_ALREADY_DEFINED
-#else
-#define yylex_init cmCommandArgument_yylex_init
-#endif
-
-#ifdef yylex_init_extra
-#define cmCommandArgument_yylex_init_extra_ALREADY_DEFINED
-#else
-#define yylex_init_extra cmCommandArgument_yylex_init_extra
-#endif
-
-#ifdef yylex_destroy
-#define cmCommandArgument_yylex_destroy_ALREADY_DEFINED
-#else
-#define yylex_destroy cmCommandArgument_yylex_destroy
-#endif
-
-#ifdef yyget_debug
-#define cmCommandArgument_yyget_debug_ALREADY_DEFINED
-#else
-#define yyget_debug cmCommandArgument_yyget_debug
-#endif
-
-#ifdef yyset_debug
-#define cmCommandArgument_yyset_debug_ALREADY_DEFINED
-#else
-#define yyset_debug cmCommandArgument_yyset_debug
-#endif
-
-#ifdef yyget_extra
-#define cmCommandArgument_yyget_extra_ALREADY_DEFINED
-#else
-#define yyget_extra cmCommandArgument_yyget_extra
-#endif
-
-#ifdef yyset_extra
-#define cmCommandArgument_yyset_extra_ALREADY_DEFINED
-#else
-#define yyset_extra cmCommandArgument_yyset_extra
-#endif
-
-#ifdef yyget_in
-#define cmCommandArgument_yyget_in_ALREADY_DEFINED
-#else
-#define yyget_in cmCommandArgument_yyget_in
-#endif
-
-#ifdef yyset_in
-#define cmCommandArgument_yyset_in_ALREADY_DEFINED
-#else
-#define yyset_in cmCommandArgument_yyset_in
-#endif
-
-#ifdef yyget_out
-#define cmCommandArgument_yyget_out_ALREADY_DEFINED
-#else
-#define yyget_out cmCommandArgument_yyget_out
-#endif
-
-#ifdef yyset_out
-#define cmCommandArgument_yyset_out_ALREADY_DEFINED
-#else
-#define yyset_out cmCommandArgument_yyset_out
-#endif
-
-#ifdef yyget_leng
-#define cmCommandArgument_yyget_leng_ALREADY_DEFINED
-#else
-#define yyget_leng cmCommandArgument_yyget_leng
-#endif
-
-#ifdef yyget_text
-#define cmCommandArgument_yyget_text_ALREADY_DEFINED
-#else
-#define yyget_text cmCommandArgument_yyget_text
-#endif
-
-#ifdef yyget_lineno
-#define cmCommandArgument_yyget_lineno_ALREADY_DEFINED
-#else
-#define yyget_lineno cmCommandArgument_yyget_lineno
-#endif
-
-#ifdef yyset_lineno
-#define cmCommandArgument_yyset_lineno_ALREADY_DEFINED
-#else
-#define yyset_lineno cmCommandArgument_yyset_lineno
-#endif
-
-#ifdef yyget_column
-#define cmCommandArgument_yyget_column_ALREADY_DEFINED
-#else
-#define yyget_column cmCommandArgument_yyget_column
-#endif
-
-#ifdef yyset_column
-#define cmCommandArgument_yyset_column_ALREADY_DEFINED
-#else
-#define yyset_column cmCommandArgument_yyset_column
-#endif
-
-#ifdef yywrap
-#define cmCommandArgument_yywrap_ALREADY_DEFINED
-#else
-#define yywrap cmCommandArgument_yywrap
-#endif
-
-#ifdef yyalloc
-#define cmCommandArgument_yyalloc_ALREADY_DEFINED
-#else
-#define yyalloc cmCommandArgument_yyalloc
-#endif
-
-#ifdef yyrealloc
-#define cmCommandArgument_yyrealloc_ALREADY_DEFINED
-#else
-#define yyrealloc cmCommandArgument_yyrealloc
-#endif
-
-#ifdef yyfree
-#define cmCommandArgument_yyfree_ALREADY_DEFINED
-#else
-#define yyfree cmCommandArgument_yyfree
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#ifndef SIZE_MAX
-#define SIZE_MAX (~(size_t)0)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-/* begin standard C++ headers. */
-
-/* TODO: this is always defined, so inline it */
-#define yyconst const
-
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define yynoreturn __attribute__((__noreturn__))
-#else
-#define yynoreturn
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an
- * integer in range [0..255] for use as an array index.
- */
-#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin , yyscanner )
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- #define YY_LESS_LINENO(n)
- #define YY_LINENO_REWIND_TO(ptr)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- int yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-void yyrestart ( FILE *input_file , yyscan_t yyscanner );
-void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
-void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-void yypop_buffer_state ( yyscan_t yyscanner );
-
-static void yyensure_buffer_stack ( yyscan_t yyscanner );
-static void yy_load_buffer_state ( yyscan_t yyscanner );
-static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
-#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
-
-YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
-
-void *yyalloc ( yy_size_t , yyscan_t yyscanner );
-void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
-void yyfree ( void * , yyscan_t yyscanner );
-
-#define yy_new_buffer yy_create_buffer
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define cmCommandArgument_yywrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-typedef flex_uint8_t YY_CHAR;
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
-static int yy_get_next_buffer ( yyscan_t yyscanner );
-static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 14
-#define YY_END_OF_BUFFER 15
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static const flex_int16_t yy_accept[30] =
- { 0,
- 0, 0, 0, 0, 0, 0, 15, 9, 10, 7,
- 6, 14, 11, 5, 12, 13, 9, 0, 0, 4,
- 7, 0, 8, 2, 0, 3, 0, 1, 0
- } ;
-
-static const YY_CHAR yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 1, 1, 1, 1,
- 1, 1, 4, 1, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
- 1, 1, 1, 5, 4, 4, 4, 4, 6, 4,
- 4, 4, 4, 4, 4, 4, 4, 7, 4, 4,
- 4, 4, 4, 4, 4, 8, 4, 4, 4, 4,
- 1, 9, 1, 1, 4, 1, 4, 4, 4, 4,
-
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 10, 1, 11, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static const YY_CHAR yy_meta[12] =
- { 0,
- 1, 2, 3, 4, 3, 4, 4, 4, 3, 5,
- 3
- } ;
-
-static const flex_int16_t yy_base[35] =
- { 0,
- 0, 0, 31, 30, 29, 28, 36, 0, 6, 16,
- 0, 41, 41, 41, 0, 41, 0, 22, 22, 41,
- 18, 18, 41, 41, 7, 41, 4, 41, 41, 20,
- 21, 26, 9, 30
- } ;
-
-static const flex_int16_t yy_def[35] =
- { 0,
- 29, 1, 1, 1, 1, 1, 29, 30, 31, 32,
- 33, 29, 29, 29, 34, 29, 30, 31, 18, 29,
- 32, 33, 29, 29, 18, 29, 18, 29, 0, 29,
- 29, 29, 29, 29
- } ;
-
-static const flex_int16_t yy_nxt[53] =
- { 0,
- 8, 8, 9, 10, 11, 10, 10, 10, 12, 13,
- 14, 19, 22, 28, 27, 20, 17, 17, 17, 17,
- 17, 17, 26, 17, 18, 18, 21, 21, 25, 21,
- 23, 24, 23, 23, 23, 29, 16, 16, 15, 15,
- 7, 29, 29, 29, 29, 29, 29, 29, 29, 29,
- 29, 29
- } ;
-
-static const flex_int16_t yy_chk[53] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 9, 33, 27, 25, 9, 10, 10, 21, 21,
- 30, 30, 22, 30, 31, 31, 32, 32, 19, 32,
- 34, 18, 34, 34, 34, 7, 6, 5, 4, 3,
- 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
- 29, 29
- } ;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-/*
-
-This file must be translated to C++ and modified to build everywhere.
-
-Run flex >= 2.6 like this:
-
- flex --nounistd --never-interactive --batch -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
-
-Modify cmCommandArgumentLexer.cxx:
- - remove trailing whitespace: sed -i 's/\s*$//' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
- - remove blank lines at end of file: sed -i '${/^$/d;}' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
- - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmCommandArgumentLexer.cxx
-
-*/
-
-/* IWYU pragma: no_forward_declare yyguts_t */
-
-#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
-
-#include "cmCommandArgumentParserHelper.h"
-
-#define YY_USER_ACTION yyextra->UpdateInputPosition(yyleng);
-
-/* Include the set of tokens from the parser. */
-#include "cmCommandArgumentParserTokens.h"
-
-static const char *DCURLYVariable = "${";
-static const char *RCURLYVariable = "}";
-static const char *ATVariable = "@";
-static const char *DOLLARVariable = "$";
-static const char *LCURLYVariable = "{";
-static const char *BSLASHVariable = "\\";
-
-/*--------------------------------------------------------------------------*/
-
-#define INITIAL 0
-#define ESCAPES 1
-#define NOESCAPES 2
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
- {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- int yy_n_chars;
- int yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
- }; /* end struct yyguts_t */
-
-static int yy_init_globals ( yyscan_t yyscanner );
-
-int yylex_init (yyscan_t* scanner);
-
-int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int yylex_destroy ( yyscan_t yyscanner );
-
-int yyget_debug ( yyscan_t yyscanner );
-
-void yyset_debug ( int debug_flag , yyscan_t yyscanner );
-
-YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
-
-void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
-
-FILE *yyget_in ( yyscan_t yyscanner );
-
-void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
-
-FILE *yyget_out ( yyscan_t yyscanner );
-
-void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
-
- int yyget_leng ( yyscan_t yyscanner );
-
-char *yyget_text ( yyscan_t yyscanner );
-
-int yyget_lineno ( yyscan_t yyscanner );
-
-void yyset_lineno ( int _line_number , yyscan_t yyscanner );
-
-int yyget_column ( yyscan_t yyscanner );
-
-void yyset_column ( int _column_no , yyscan_t yyscanner );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap ( yyscan_t yyscanner );
-#else
-extern int yywrap ( yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput ( yyscan_t yyscanner );
-#else
-static int input ( yyscan_t yyscanner );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- int n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int yylex (yyscan_t yyscanner);
-
-#define YY_DECL int yylex (yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
-#endif
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
- yy_state_type yy_current_state;
- char *yy_cp, *yy_bp;
- int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
- }
-
- yy_load_buffer_state( yyscanner );
- }
-
- {
-
- while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yyg->yy_start;
-yy_match:
- do
- {
- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- 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 >= 30 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 29 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
-do_action: /* This label is used only to access EOF actions. */
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_ENVCURLY;
-}
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_NCURLY;
-}
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_ATNAME;
-}
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = DCURLYVariable;
- return cal_DCURLY;
-}
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = RCURLYVariable;
- return cal_RCURLY;
-}
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = ATVariable;
- return cal_AT;
-}
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return cal_NAME;
-}
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-{
- if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
- {
- return cal_ERROR;
- }
- return cal_SYMBOL;
-}
- YY_BREAK
-case 9:
-/* rule 9 can match eol */
-YY_RULE_SETUP
-{
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return cal_SYMBOL;
-}
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = DOLLARVariable;
- return cal_DOLLAR;
-}
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = LCURLYVariable;
- return cal_LCURLY;
-}
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = BSLASHVariable;
- return cal_BSLASH;
-}
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = BSLASHVariable;
- return cal_SYMBOL;
-}
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-ECHO;
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(ESCAPES):
-case YY_STATE_EOF(NOESCAPES):
- yyterminate();
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap( yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of user's declarations */
-} /* end of yylex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- char *source = yyg->yytext_ptr;
- int number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yyrealloc( (void *) b->yy_ch_buf,
- (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = NULL;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin , yyscanner);
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
- (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- /* "- 2" to take care of EOB's */
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
- }
-
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
- static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
- yy_state_type yy_current_state;
- char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_current_state = yyg->yy_start;
-
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- 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 >= 30 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- }
-
- return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
- int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- char *yy_cp = yyg->yy_c_buf_p;
-
- YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- 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 >= 30 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 29);
-
- (void)yyg;
- return yy_is_jam ? 0 : yy_current_state;
-}
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
- static int yyinput (yyscan_t yyscanner)
-#else
- static int input (yyscan_t yyscanner)
-#endif
-
-{
- int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin , yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap( yyscanner ) )
- return 0;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(yyscanner);
-#else
- return input(yyscanner);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
- return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void yyrestart (FILE * input_file , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
- }
-
- yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
- yy_load_buffer_state( yyscanner );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
- void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* TODO. We should be able to replace this entire function body
- * with
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
- */
- yyensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-static void yy_load_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file , yyscanner);
-
- return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- * @param yyscanner The scanner object.
- */
- void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yyfree( (void *) b->yy_ch_buf , yyscanner );
-
- yyfree( (void *) b , yyscanner );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
- static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_flush_buffer( b , yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then yy_init_buffer was _probably_
- * called from yyrestart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- b->yy_is_interactive = 0;
-
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
- void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( yyscanner );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- * @param yyscanner The scanner object.
- */
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- yyensure_buffer_stack(yyscanner);
-
- /* This block is copied from yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- * @param yyscanner The scanner object.
- */
-void yypop_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
-
- if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
-}
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void yyensure_buffer_stack (yyscan_t yyscanner)
-{
- yy_size_t num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (!yyg->yy_buffer_stack) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
-
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- yy_size_t grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return NULL;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = NULL;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b , yyscanner );
-
- return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
-{
-
- return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = (yy_size_t) (_yybytes_len + 2);
- buf = (char *) yyalloc( n , yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n , yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-/* Accessor methods (get/set functions) to struct members. */
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
-}
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int yyget_lineno (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
-}
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int yyget_column (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
-}
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_in (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_out (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
-}
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-int yyget_leng (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *yyget_text (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
-}
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
-}
-
-/** Set the current line number.
- * @param _line_number line number
- * @param yyscanner The scanner object.
- */
-void yyset_lineno (int _line_number , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
-
- yylineno = _line_number;
-}
-
-/** Set the current column.
- * @param _column_no column number
- * @param yyscanner The scanner object.
- */
-void yyset_column (int _column_no , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "yyset_column called with no buffer" );
-
- yycolumn = _column_no;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param _in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE * _in_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = _in_str ;
-}
-
-void yyset_out (FILE * _out_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = _out_str ;
-}
-
-int yyget_debug (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-void yyset_debug (int _bdebug , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = _bdebug ;
-}
-
-/* Accessor methods for yylval and yylloc */
-
-/* User-visible API */
-
-/* yylex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-int yylex_init(yyscan_t* ptr_yy_globals)
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* yylex_init_extra has the same functionality as yylex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to yyalloc in
- * the yyextra field.
- */
-int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
-{
- struct yyguts_t dummy_yyguts;
-
- yyset_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- yyset_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-static int yy_init_globals (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from yylex_destroy(), so don't allocate here.
- */
-
- yyg->yy_buffer_stack = NULL;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = NULL;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
-#else
- yyin = NULL;
- yyout = NULL;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * yylex_init()
- */
- return 0;
-}
-
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- yyfree(yyg->yy_buffer_stack , yyscanner);
- yyg->yy_buffer_stack = NULL;
-
- /* Destroy the start condition stack. */
- yyfree( yyg->yy_start_stack , yyscanner );
- yyg->yy_start_stack = NULL;
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * yylex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* Destroy the main struct (reentrant only). */
- yyfree ( yyscanner , yyscanner );
- yyscanner = NULL;
- return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
-{
- int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-void *yyalloc (yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- return malloc(size);
-}
-
-void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return realloc(ptr, size);
-}
-
-void yyfree (void * ptr , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-/*--------------------------------------------------------------------------*/
-void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
-{
- /* Hack into the internal flex-generated scanner to set the state. */
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if(noEscapes) {
- BEGIN(NOESCAPES);
- } else {
- BEGIN(ESCAPES);
- }
-}
-
-#endif /* __clang_analyzer__ */
diff --git a/Source/LexerParser/cmCommandArgumentLexer.h b/Source/LexerParser/cmCommandArgumentLexer.h
deleted file mode 100644
index 5677513..0000000
--- a/Source/LexerParser/cmCommandArgumentLexer.h
+++ /dev/null
@@ -1,689 +0,0 @@
-#ifndef cmCommandArgument_yyHEADER_H
-#define cmCommandArgument_yyHEADER_H 1
-#define cmCommandArgument_yyIN_HEADER 1
-
-#define FLEXINT_H 1
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 4
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-#ifdef yy_create_buffer
-#define cmCommandArgument_yy_create_buffer_ALREADY_DEFINED
-#else
-#define yy_create_buffer cmCommandArgument_yy_create_buffer
-#endif
-
-#ifdef yy_delete_buffer
-#define cmCommandArgument_yy_delete_buffer_ALREADY_DEFINED
-#else
-#define yy_delete_buffer cmCommandArgument_yy_delete_buffer
-#endif
-
-#ifdef yy_scan_buffer
-#define cmCommandArgument_yy_scan_buffer_ALREADY_DEFINED
-#else
-#define yy_scan_buffer cmCommandArgument_yy_scan_buffer
-#endif
-
-#ifdef yy_scan_string
-#define cmCommandArgument_yy_scan_string_ALREADY_DEFINED
-#else
-#define yy_scan_string cmCommandArgument_yy_scan_string
-#endif
-
-#ifdef yy_scan_bytes
-#define cmCommandArgument_yy_scan_bytes_ALREADY_DEFINED
-#else
-#define yy_scan_bytes cmCommandArgument_yy_scan_bytes
-#endif
-
-#ifdef yy_init_buffer
-#define cmCommandArgument_yy_init_buffer_ALREADY_DEFINED
-#else
-#define yy_init_buffer cmCommandArgument_yy_init_buffer
-#endif
-
-#ifdef yy_flush_buffer
-#define cmCommandArgument_yy_flush_buffer_ALREADY_DEFINED
-#else
-#define yy_flush_buffer cmCommandArgument_yy_flush_buffer
-#endif
-
-#ifdef yy_load_buffer_state
-#define cmCommandArgument_yy_load_buffer_state_ALREADY_DEFINED
-#else
-#define yy_load_buffer_state cmCommandArgument_yy_load_buffer_state
-#endif
-
-#ifdef yy_switch_to_buffer
-#define cmCommandArgument_yy_switch_to_buffer_ALREADY_DEFINED
-#else
-#define yy_switch_to_buffer cmCommandArgument_yy_switch_to_buffer
-#endif
-
-#ifdef yypush_buffer_state
-#define cmCommandArgument_yypush_buffer_state_ALREADY_DEFINED
-#else
-#define yypush_buffer_state cmCommandArgument_yypush_buffer_state
-#endif
-
-#ifdef yypop_buffer_state
-#define cmCommandArgument_yypop_buffer_state_ALREADY_DEFINED
-#else
-#define yypop_buffer_state cmCommandArgument_yypop_buffer_state
-#endif
-
-#ifdef yyensure_buffer_stack
-#define cmCommandArgument_yyensure_buffer_stack_ALREADY_DEFINED
-#else
-#define yyensure_buffer_stack cmCommandArgument_yyensure_buffer_stack
-#endif
-
-#ifdef yylex
-#define cmCommandArgument_yylex_ALREADY_DEFINED
-#else
-#define yylex cmCommandArgument_yylex
-#endif
-
-#ifdef yyrestart
-#define cmCommandArgument_yyrestart_ALREADY_DEFINED
-#else
-#define yyrestart cmCommandArgument_yyrestart
-#endif
-
-#ifdef yylex_init
-#define cmCommandArgument_yylex_init_ALREADY_DEFINED
-#else
-#define yylex_init cmCommandArgument_yylex_init
-#endif
-
-#ifdef yylex_init_extra
-#define cmCommandArgument_yylex_init_extra_ALREADY_DEFINED
-#else
-#define yylex_init_extra cmCommandArgument_yylex_init_extra
-#endif
-
-#ifdef yylex_destroy
-#define cmCommandArgument_yylex_destroy_ALREADY_DEFINED
-#else
-#define yylex_destroy cmCommandArgument_yylex_destroy
-#endif
-
-#ifdef yyget_debug
-#define cmCommandArgument_yyget_debug_ALREADY_DEFINED
-#else
-#define yyget_debug cmCommandArgument_yyget_debug
-#endif
-
-#ifdef yyset_debug
-#define cmCommandArgument_yyset_debug_ALREADY_DEFINED
-#else
-#define yyset_debug cmCommandArgument_yyset_debug
-#endif
-
-#ifdef yyget_extra
-#define cmCommandArgument_yyget_extra_ALREADY_DEFINED
-#else
-#define yyget_extra cmCommandArgument_yyget_extra
-#endif
-
-#ifdef yyset_extra
-#define cmCommandArgument_yyset_extra_ALREADY_DEFINED
-#else
-#define yyset_extra cmCommandArgument_yyset_extra
-#endif
-
-#ifdef yyget_in
-#define cmCommandArgument_yyget_in_ALREADY_DEFINED
-#else
-#define yyget_in cmCommandArgument_yyget_in
-#endif
-
-#ifdef yyset_in
-#define cmCommandArgument_yyset_in_ALREADY_DEFINED
-#else
-#define yyset_in cmCommandArgument_yyset_in
-#endif
-
-#ifdef yyget_out
-#define cmCommandArgument_yyget_out_ALREADY_DEFINED
-#else
-#define yyget_out cmCommandArgument_yyget_out
-#endif
-
-#ifdef yyset_out
-#define cmCommandArgument_yyset_out_ALREADY_DEFINED
-#else
-#define yyset_out cmCommandArgument_yyset_out
-#endif
-
-#ifdef yyget_leng
-#define cmCommandArgument_yyget_leng_ALREADY_DEFINED
-#else
-#define yyget_leng cmCommandArgument_yyget_leng
-#endif
-
-#ifdef yyget_text
-#define cmCommandArgument_yyget_text_ALREADY_DEFINED
-#else
-#define yyget_text cmCommandArgument_yyget_text
-#endif
-
-#ifdef yyget_lineno
-#define cmCommandArgument_yyget_lineno_ALREADY_DEFINED
-#else
-#define yyget_lineno cmCommandArgument_yyget_lineno
-#endif
-
-#ifdef yyset_lineno
-#define cmCommandArgument_yyset_lineno_ALREADY_DEFINED
-#else
-#define yyset_lineno cmCommandArgument_yyset_lineno
-#endif
-
-#ifdef yyget_column
-#define cmCommandArgument_yyget_column_ALREADY_DEFINED
-#else
-#define yyget_column cmCommandArgument_yyget_column
-#endif
-
-#ifdef yyset_column
-#define cmCommandArgument_yyset_column_ALREADY_DEFINED
-#else
-#define yyset_column cmCommandArgument_yyset_column
-#endif
-
-#ifdef yywrap
-#define cmCommandArgument_yywrap_ALREADY_DEFINED
-#else
-#define yywrap cmCommandArgument_yywrap
-#endif
-
-#ifdef yyalloc
-#define cmCommandArgument_yyalloc_ALREADY_DEFINED
-#else
-#define yyalloc cmCommandArgument_yyalloc
-#endif
-
-#ifdef yyrealloc
-#define cmCommandArgument_yyrealloc_ALREADY_DEFINED
-#else
-#define yyrealloc cmCommandArgument_yyrealloc
-#endif
-
-#ifdef yyfree
-#define cmCommandArgument_yyfree_ALREADY_DEFINED
-#else
-#define yyfree cmCommandArgument_yyfree
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#ifndef SIZE_MAX
-#define SIZE_MAX (~(size_t)0)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-/* begin standard C++ headers. */
-
-/* TODO: this is always defined, so inline it */
-#define yyconst const
-
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define yynoreturn __attribute__((__noreturn__))
-#else
-#define yynoreturn
-#endif
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- int yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-void yyrestart ( FILE *input_file , yyscan_t yyscanner );
-void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
-void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-void yypop_buffer_state ( yyscan_t yyscanner );
-
-YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
-
-void *yyalloc ( yy_size_t , yyscan_t yyscanner );
-void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
-void yyfree ( void * , yyscan_t yyscanner );
-
-/* Begin user sect3 */
-
-#define cmCommandArgument_yywrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-
-#define yytext_ptr yytext_r
-
-#ifdef YY_HEADER_EXPORT_START_CONDITIONS
-#define INITIAL 0
-#define ESCAPES 1
-#define NOESCAPES 2
-
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-int yylex_init (yyscan_t* scanner);
-
-int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int yylex_destroy ( yyscan_t yyscanner );
-
-int yyget_debug ( yyscan_t yyscanner );
-
-void yyset_debug ( int debug_flag , yyscan_t yyscanner );
-
-YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
-
-void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
-
-FILE *yyget_in ( yyscan_t yyscanner );
-
-void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
-
-FILE *yyget_out ( yyscan_t yyscanner );
-
-void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
-
- int yyget_leng ( yyscan_t yyscanner );
-
-char *yyget_text ( yyscan_t yyscanner );
-
-int yyget_lineno ( yyscan_t yyscanner );
-
-void yyset_lineno ( int _line_number , yyscan_t yyscanner );
-
-int yyget_column ( yyscan_t yyscanner );
-
-void yyset_column ( int _column_no , yyscan_t yyscanner );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap ( yyscan_t yyscanner );
-#else
-extern int yywrap ( yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int yylex (yyscan_t yyscanner);
-
-#define YY_DECL int yylex (yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-#undef YY_NEW_FILE
-#undef YY_FLUSH_BUFFER
-#undef yy_set_bol
-#undef yy_new_buffer
-#undef yy_set_interactive
-#undef YY_DO_BEFORE_ACTION
-
-#ifdef YY_DECL_IS_OURS
-#undef YY_DECL_IS_OURS
-#undef YY_DECL
-#endif
-
-#ifndef cmCommandArgument_yy_create_buffer_ALREADY_DEFINED
-#undef yy_create_buffer
-#endif
-#ifndef cmCommandArgument_yy_delete_buffer_ALREADY_DEFINED
-#undef yy_delete_buffer
-#endif
-#ifndef cmCommandArgument_yy_scan_buffer_ALREADY_DEFINED
-#undef yy_scan_buffer
-#endif
-#ifndef cmCommandArgument_yy_scan_string_ALREADY_DEFINED
-#undef yy_scan_string
-#endif
-#ifndef cmCommandArgument_yy_scan_bytes_ALREADY_DEFINED
-#undef yy_scan_bytes
-#endif
-#ifndef cmCommandArgument_yy_init_buffer_ALREADY_DEFINED
-#undef yy_init_buffer
-#endif
-#ifndef cmCommandArgument_yy_flush_buffer_ALREADY_DEFINED
-#undef yy_flush_buffer
-#endif
-#ifndef cmCommandArgument_yy_load_buffer_state_ALREADY_DEFINED
-#undef yy_load_buffer_state
-#endif
-#ifndef cmCommandArgument_yy_switch_to_buffer_ALREADY_DEFINED
-#undef yy_switch_to_buffer
-#endif
-#ifndef cmCommandArgument_yypush_buffer_state_ALREADY_DEFINED
-#undef yypush_buffer_state
-#endif
-#ifndef cmCommandArgument_yypop_buffer_state_ALREADY_DEFINED
-#undef yypop_buffer_state
-#endif
-#ifndef cmCommandArgument_yyensure_buffer_stack_ALREADY_DEFINED
-#undef yyensure_buffer_stack
-#endif
-#ifndef cmCommandArgument_yylex_ALREADY_DEFINED
-#undef yylex
-#endif
-#ifndef cmCommandArgument_yyrestart_ALREADY_DEFINED
-#undef yyrestart
-#endif
-#ifndef cmCommandArgument_yylex_init_ALREADY_DEFINED
-#undef yylex_init
-#endif
-#ifndef cmCommandArgument_yylex_init_extra_ALREADY_DEFINED
-#undef yylex_init_extra
-#endif
-#ifndef cmCommandArgument_yylex_destroy_ALREADY_DEFINED
-#undef yylex_destroy
-#endif
-#ifndef cmCommandArgument_yyget_debug_ALREADY_DEFINED
-#undef yyget_debug
-#endif
-#ifndef cmCommandArgument_yyset_debug_ALREADY_DEFINED
-#undef yyset_debug
-#endif
-#ifndef cmCommandArgument_yyget_extra_ALREADY_DEFINED
-#undef yyget_extra
-#endif
-#ifndef cmCommandArgument_yyset_extra_ALREADY_DEFINED
-#undef yyset_extra
-#endif
-#ifndef cmCommandArgument_yyget_in_ALREADY_DEFINED
-#undef yyget_in
-#endif
-#ifndef cmCommandArgument_yyset_in_ALREADY_DEFINED
-#undef yyset_in
-#endif
-#ifndef cmCommandArgument_yyget_out_ALREADY_DEFINED
-#undef yyget_out
-#endif
-#ifndef cmCommandArgument_yyset_out_ALREADY_DEFINED
-#undef yyset_out
-#endif
-#ifndef cmCommandArgument_yyget_leng_ALREADY_DEFINED
-#undef yyget_leng
-#endif
-#ifndef cmCommandArgument_yyget_text_ALREADY_DEFINED
-#undef yyget_text
-#endif
-#ifndef cmCommandArgument_yyget_lineno_ALREADY_DEFINED
-#undef yyget_lineno
-#endif
-#ifndef cmCommandArgument_yyset_lineno_ALREADY_DEFINED
-#undef yyset_lineno
-#endif
-#ifndef cmCommandArgument_yyget_column_ALREADY_DEFINED
-#undef yyget_column
-#endif
-#ifndef cmCommandArgument_yyset_column_ALREADY_DEFINED
-#undef yyset_column
-#endif
-#ifndef cmCommandArgument_yywrap_ALREADY_DEFINED
-#undef yywrap
-#endif
-#ifndef cmCommandArgument_yyget_lval_ALREADY_DEFINED
-#undef yyget_lval
-#endif
-#ifndef cmCommandArgument_yyset_lval_ALREADY_DEFINED
-#undef yyset_lval
-#endif
-#ifndef cmCommandArgument_yyget_lloc_ALREADY_DEFINED
-#undef yyget_lloc
-#endif
-#ifndef cmCommandArgument_yyset_lloc_ALREADY_DEFINED
-#undef yyset_lloc
-#endif
-#ifndef cmCommandArgument_yyalloc_ALREADY_DEFINED
-#undef yyalloc
-#endif
-#ifndef cmCommandArgument_yyrealloc_ALREADY_DEFINED
-#undef yyrealloc
-#endif
-#ifndef cmCommandArgument_yyfree_ALREADY_DEFINED
-#undef yyfree
-#endif
-#ifndef cmCommandArgument_yytext_ALREADY_DEFINED
-#undef yytext
-#endif
-#ifndef cmCommandArgument_yyleng_ALREADY_DEFINED
-#undef yyleng
-#endif
-#ifndef cmCommandArgument_yyin_ALREADY_DEFINED
-#undef yyin
-#endif
-#ifndef cmCommandArgument_yyout_ALREADY_DEFINED
-#undef yyout
-#endif
-#ifndef cmCommandArgument_yy_flex_debug_ALREADY_DEFINED
-#undef yy_flex_debug
-#endif
-#ifndef cmCommandArgument_yylineno_ALREADY_DEFINED
-#undef yylineno
-#endif
-#ifndef cmCommandArgument_yytables_fload_ALREADY_DEFINED
-#undef yytables_fload
-#endif
-#ifndef cmCommandArgument_yytables_destroy_ALREADY_DEFINED
-#undef yytables_destroy
-#endif
-#ifndef cmCommandArgument_yyTABLES_NAME_ALREADY_DEFINED
-#undef yyTABLES_NAME
-#endif
-
-#undef cmCommandArgument_yyIN_HEADER
-#endif /* cmCommandArgument_yyHEADER_H */
diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l
deleted file mode 100644
index 6b4f9a9..0000000
--- a/Source/LexerParser/cmCommandArgumentLexer.in.l
+++ /dev/null
@@ -1,148 +0,0 @@
-%{
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-/*
-
-This file must be translated to C++ and modified to build everywhere.
-
-Run flex >= 2.6 like this:
-
- flex --nounistd --never-interactive --batch -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
-
-Modify cmCommandArgumentLexer.cxx:
- - remove trailing whitespace: sed -i 's/\s*$//' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
- - remove blank lines at end of file: sed -i '${/^$/d;}' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
- - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmCommandArgumentLexer.cxx
-
-*/
-
-/* IWYU pragma: no_forward_declare yyguts_t */
-
-#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
-
-#include "cmCommandArgumentParserHelper.h"
-
-#define YY_USER_ACTION yyextra->UpdateInputPosition(yyleng);
-
-/* Include the set of tokens from the parser. */
-#include "cmCommandArgumentParserTokens.h"
-
-static const char *DCURLYVariable = "${";
-static const char *RCURLYVariable = "}";
-static const char *ATVariable = "@";
-static const char *DOLLARVariable = "$";
-static const char *LCURLYVariable = "{";
-static const char *BSLASHVariable = "\\";
-
-/*--------------------------------------------------------------------------*/
-%}
-
-%option prefix="cmCommandArgument_yy"
-
-%option reentrant
-%option noyywrap
-%option nounput
-%pointer
-%s ESCAPES
-%s NOESCAPES
-
-%%
-
-\$ENV\{ {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_ENVCURLY;
-}
-
-\$[A-Za-z0-9/_.+-]+\{ {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_NCURLY;
-}
-
-@[A-Za-z0-9/_.+-]+@ {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_ATNAME;
-}
-
-"${" {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = DCURLYVariable;
- return cal_DCURLY;
-}
-
-"}" {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = RCURLYVariable;
- return cal_RCURLY;
-}
-
-"@" {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = ATVariable;
- return cal_AT;
-}
-
-[A-Za-z0-9/_.+-]+ {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return cal_NAME;
-}
-
-<ESCAPES>\\. {
- if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
- {
- return cal_ERROR;
- }
- return cal_SYMBOL;
-}
-
-[^\${}\\@]+ {
- //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return cal_SYMBOL;
-}
-
-"$" {
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = DOLLARVariable;
- return cal_DOLLAR;
-}
-
-"{" {
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = LCURLYVariable;
- return cal_LCURLY;
-}
-
-<ESCAPES>"\\" {
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = BSLASHVariable;
- return cal_BSLASH;
-}
-
-<NOESCAPES>"\\" {
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = BSLASHVariable;
- return cal_SYMBOL;
-}
-
-%%
-
-/*--------------------------------------------------------------------------*/
-void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
-{
- /* Hack into the internal flex-generated scanner to set the state. */
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if(noEscapes) {
- BEGIN(NOESCAPES);
- } else {
- BEGIN(ESCAPES);
- }
-}
-
-#endif /* __clang_analyzer__ */
diff --git a/Source/LexerParser/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx
deleted file mode 100644
index 7ea0b15..0000000
--- a/Source/LexerParser/cmCommandArgumentParser.cxx
+++ /dev/null
@@ -1,1856 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.8.2. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
- Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
- especially those whose name start with YY_ or yy_. They are
- private implementation details that can be changed or removed. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output, and Bison version. */
-#define YYBISON 30802
-
-/* Bison version string. */
-#define YYBISON_VERSION "3.8.2"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-
-/* Substitute the variable and function names. */
-#define yyparse cmCommandArgument_yyparse
-#define yylex cmCommandArgument_yylex
-#define yyerror cmCommandArgument_yyerror
-#define yydebug cmCommandArgument_yydebug
-#define yynerrs cmCommandArgument_yynerrs
-
-/* First part of user prologue. */
-#line 1 "cmCommandArgumentParser.y"
-
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-/*
-
-This file must be translated to C and modified to build everywhere.
-
-Run bison like this:
-
- bison --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
-
-*/
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <string.h>
-
-#define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
-
-/* Make sure malloc and free are available on QNX. */
-#ifdef __QNX__
-# include <malloc.h>
-#endif
-
-/* Make sure the parser uses standard memory allocation. The default
- generated parser malloc/free declarations do not work on all
- platforms. */
-#include <stdlib.h>
-#define YYMALLOC malloc
-#define YYFREE free
-
-/*-------------------------------------------------------------------------*/
-#include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
-#include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
-
-/* Forward declare the lexer entry point. */
-YY_DECL;
-
-/* Helper function to forward error callback from parser. */
-static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
-
-/* Configure the parser to support large input. */
-#define YYMAXDEPTH 100000
-#define YYINITDEPTH 10000
-
-/* Disable some warnings in the generated code. */
-#ifdef _MSC_VER
-# pragma warning (disable: 4102) /* Unused goto label. */
-# pragma warning (disable: 4065) /* Switch statement contains default but no
- case. */
-# pragma warning (disable: 4244) /* loss of precision */
-# pragma warning (disable: 4702) /* unreachable code */
-#endif
-#if defined(__GNUC__) && __GNUC__ >= 8
-# pragma GCC diagnostic ignored "-Wconversion"
-# pragma GCC diagnostic ignored "-Wfree-nonheap-object"
-#endif
-#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wunused-but-set-variable")
-# pragma clang diagnostic ignored "-Wunused-but-set-variable"
-# endif
-#endif
-
-#line 140 "cmCommandArgumentParser.cxx"
-
-# ifndef YY_CAST
-# ifdef __cplusplus
-# define YY_CAST(Type, Val) static_cast<Type> (Val)
-# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
-# else
-# define YY_CAST(Type, Val) ((Type) (Val))
-# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
-# endif
-# endif
-# ifndef YY_NULLPTR
-# if defined __cplusplus
-# if 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# else
-# define YY_NULLPTR ((void*)0)
-# endif
-# endif
-
-#include "cmCommandArgumentParserTokens.h"
-/* Symbol kind. */
-enum yysymbol_kind_t
-{
- YYSYMBOL_YYEMPTY = -2,
- YYSYMBOL_YYEOF = 0, /* "end of file" */
- YYSYMBOL_YYerror = 1, /* error */
- YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
- YYSYMBOL_cal_ENVCURLY = 3, /* cal_ENVCURLY */
- YYSYMBOL_cal_NCURLY = 4, /* cal_NCURLY */
- YYSYMBOL_cal_DCURLY = 5, /* cal_DCURLY */
- YYSYMBOL_cal_DOLLAR = 6, /* "$" */
- YYSYMBOL_cal_LCURLY = 7, /* "{" */
- YYSYMBOL_cal_RCURLY = 8, /* "}" */
- YYSYMBOL_cal_NAME = 9, /* cal_NAME */
- YYSYMBOL_cal_BSLASH = 10, /* "\\" */
- YYSYMBOL_cal_SYMBOL = 11, /* cal_SYMBOL */
- YYSYMBOL_cal_AT = 12, /* "@" */
- YYSYMBOL_cal_ERROR = 13, /* cal_ERROR */
- YYSYMBOL_cal_ATNAME = 14, /* cal_ATNAME */
- YYSYMBOL_YYACCEPT = 15, /* $accept */
- YYSYMBOL_Start = 16, /* Start */
- YYSYMBOL_GoalWithOptionalBackSlash = 17, /* GoalWithOptionalBackSlash */
- YYSYMBOL_Goal = 18, /* Goal */
- YYSYMBOL_String = 19, /* String */
- YYSYMBOL_OuterText = 20, /* OuterText */
- YYSYMBOL_Variable = 21, /* Variable */
- YYSYMBOL_EnvVarName = 22, /* EnvVarName */
- YYSYMBOL_MultipleIds = 23, /* MultipleIds */
- YYSYMBOL_ID = 24 /* ID */
-};
-typedef enum yysymbol_kind_t yysymbol_kind_t;
-
-
-
-
-#ifdef short
-# undef short
-#endif
-
-/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
- <limits.h> and (if available) <stdint.h> are included
- so that the code can choose integer types of a good width. */
-
-#ifndef __PTRDIFF_MAX__
-# include <limits.h> /* INFRINGES ON USER NAME SPACE */
-# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
-# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_STDINT_H
-# endif
-#endif
-
-/* Narrow types that promote to a signed type and that can represent a
- signed or unsigned integer of at least N bits. In tables they can
- save space and decrease cache pressure. Promoting to a signed type
- helps avoid bugs in integer arithmetic. */
-
-#ifdef __INT_LEAST8_MAX__
-typedef __INT_LEAST8_TYPE__ yytype_int8;
-#elif defined YY_STDINT_H
-typedef int_least8_t yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef __INT_LEAST16_MAX__
-typedef __INT_LEAST16_TYPE__ yytype_int16;
-#elif defined YY_STDINT_H
-typedef int_least16_t yytype_int16;
-#else
-typedef short yytype_int16;
-#endif
-
-/* Work around bug in HP-UX 11.23, which defines these macros
- incorrectly for preprocessor constants. This workaround can likely
- be removed in 2023, as HPE has promised support for HP-UX 11.23
- (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
- <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
-#ifdef __hpux
-# undef UINT_LEAST8_MAX
-# undef UINT_LEAST16_MAX
-# define UINT_LEAST8_MAX 255
-# define UINT_LEAST16_MAX 65535
-#endif
-
-#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
-typedef __UINT_LEAST8_TYPE__ yytype_uint8;
-#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
- && UINT_LEAST8_MAX <= INT_MAX)
-typedef uint_least8_t yytype_uint8;
-#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
-typedef unsigned char yytype_uint8;
-#else
-typedef short yytype_uint8;
-#endif
-
-#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
-typedef __UINT_LEAST16_TYPE__ yytype_uint16;
-#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
- && UINT_LEAST16_MAX <= INT_MAX)
-typedef uint_least16_t yytype_uint16;
-#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
-typedef unsigned short yytype_uint16;
-#else
-typedef int yytype_uint16;
-#endif
-
-#ifndef YYPTRDIFF_T
-# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
-# define YYPTRDIFF_T __PTRDIFF_TYPE__
-# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
-# elif defined PTRDIFF_MAX
-# ifndef ptrdiff_t
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# endif
-# define YYPTRDIFF_T ptrdiff_t
-# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
-# else
-# define YYPTRDIFF_T long
-# define YYPTRDIFF_MAXIMUM LONG_MAX
-# endif
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM \
- YY_CAST (YYPTRDIFF_T, \
- (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
- ? YYPTRDIFF_MAXIMUM \
- : YY_CAST (YYSIZE_T, -1)))
-
-#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
-
-
-/* Stored state numbers (used for stacks). */
-typedef yytype_int8 yy_state_t;
-
-/* State numbers in computations. */
-typedef int yy_state_fast_t;
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
-#endif
-
-
-#ifndef YY_ATTRIBUTE_PURE
-# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
-# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
-# else
-# define YY_ATTRIBUTE_PURE
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
-# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-# else
-# define YY_ATTRIBUTE_UNUSED
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YY_USE(E) ((void) (E))
-#else
-# define YY_USE(E) /* empty */
-#endif
-
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
-# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
-# else
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# endif
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
-# define YY_IGNORE_USELESS_CAST_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
-# define YY_IGNORE_USELESS_CAST_END \
- _Pragma ("GCC diagnostic pop")
-#endif
-#ifndef YY_IGNORE_USELESS_CAST_BEGIN
-# define YY_IGNORE_USELESS_CAST_BEGIN
-# define YY_IGNORE_USELESS_CAST_END
-#endif
-
-
-#define YY_ASSERT(E) ((void) (0 && (E)))
-
-#if 1
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* 1 */
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yy_state_t yyss_alloc;
- YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYPTRDIFF_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / YYSIZEOF (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYPTRDIFF_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 25
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 40
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 15
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 10
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 24
-/* YYNSTATES -- Number of states. */
-#define YYNSTATES 33
-
-/* YYMAXUTOK -- Last valid token kind. */
-#define YYMAXUTOK 269
-
-
-/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, with out-of-bounds checking. */
-#define YYTRANSLATE(YYX) \
- (0 <= (YYX) && (YYX) <= YYMAXUTOK \
- ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
- : YYSYMBOL_YYUNDEF)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex. */
-static const yytype_int8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
-};
-
-#if YYDEBUG
-/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint8 yyrline[] =
-{
- 0, 101, 101, 107, 110, 115, 118, 123, 126, 131,
- 134, 137, 140, 143, 146, 151, 154, 157, 160, 165,
- 168, 173, 176, 181, 184
-};
-#endif
-
-/** Accessing symbol of state STATE. */
-#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
-
-#if 1
-/* The user-facing name of the symbol whose (internal) number is
- YYSYMBOL. No bounds checking. */
-static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
-
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "\"end of file\"", "error", "\"invalid token\"", "cal_ENVCURLY",
- "cal_NCURLY", "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME",
- "\"\\\\\"", "cal_SYMBOL", "\"@\"", "cal_ERROR", "cal_ATNAME", "$accept",
- "Start", "GoalWithOptionalBackSlash", "Goal", "String", "OuterText",
- "Variable", "EnvVarName", "MultipleIds", "ID", YY_NULLPTR
-};
-
-static const char *
-yysymbol_name (yysymbol_kind_t yysymbol)
-{
- return yytname[yysymbol];
-}
-#endif
-
-#define YYPACT_NINF (-3)
-
-#define yypact_value_is_default(Yyn) \
- ((Yyn) == YYPACT_NINF)
-
-#define YYTABLE_NINF (-1)
-
-#define yytable_value_is_error(Yyn) \
- 0
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int8 yypact[] =
-{
- 0, 14, 26, 26, -3, -3, -3, -3, -3, -3,
- -3, 10, -3, 3, 0, -3, -3, -3, 14, -3,
- 7, -3, 26, 13, 16, -3, -3, -3, -3, -3,
- -3, -3, -3
-};
-
-/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
-static const yytype_int8 yydefact[] =
-{
- 5, 21, 21, 21, 11, 12, 13, 9, 14, 10,
- 18, 0, 2, 3, 5, 7, 8, 23, 21, 24,
- 0, 19, 21, 0, 0, 1, 4, 6, 20, 15,
- 22, 16, 17
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -3, -3, -3, 8, -3, -3, 2, 9, -2, -3
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- 0, 11, 12, 13, 14, 15, 19, 20, 21, 22
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
-static const yytype_int8 yytable[] =
-{
- 23, 24, 16, 1, 2, 3, 4, 5, 6, 7,
- 25, 8, 9, 26, 10, 29, 16, 1, 2, 3,
- 30, 31, 27, 17, 32, 18, 0, 28, 10, 1,
- 2, 3, 0, 0, 0, 17, 0, 0, 0, 0,
- 10
-};
-
-static const yytype_int8 yycheck[] =
-{
- 2, 3, 0, 3, 4, 5, 6, 7, 8, 9,
- 0, 11, 12, 10, 14, 8, 14, 3, 4, 5,
- 22, 8, 14, 9, 8, 11, -1, 18, 14, 3,
- 4, 5, -1, -1, -1, 9, -1, -1, -1, -1,
- 14
-};
-
-/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
- state STATE-NUM. */
-static const yytype_int8 yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 8, 9, 11, 12,
- 14, 16, 17, 18, 19, 20, 21, 9, 11, 21,
- 22, 23, 24, 23, 23, 0, 10, 18, 22, 8,
- 23, 8, 8
-};
-
-/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
-static const yytype_int8 yyr1[] =
-{
- 0, 15, 16, 17, 17, 18, 18, 19, 19, 20,
- 20, 20, 20, 20, 20, 21, 21, 21, 21, 22,
- 22, 23, 23, 24, 24
-};
-
-/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
-static const yytype_int8 yyr2[] =
-{
- 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 3, 3, 1, 1,
- 2, 0, 2, 1, 1
-};
-
-
-enum { YYENOMEM = -2 };
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-#define YYNOMEM goto yyexhaustedlab
-
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
- do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (yyscanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
- while (0)
-
-/* Backward compatibility with an undocumented macro.
- Use YYerror or YYUNDEF. */
-#define YYERRCODE YYUNDEF
-
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-
-
-
-# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Kind, Value, yyscanner); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-
-/*-----------------------------------.
-| Print this symbol's value on YYO. |
-`-----------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyo,
- yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
-{
- FILE *yyoutput = yyo;
- YY_USE (yyoutput);
- YY_USE (yyscanner);
- if (!yyvaluep)
- return;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YY_USE (yykind);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-/*---------------------------.
-| Print this symbol on YYO. |
-`---------------------------*/
-
-static void
-yy_symbol_print (FILE *yyo,
- yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
-{
- YYFPRINTF (yyo, "%s %s (",
- yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
-
- yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner);
- YYFPRINTF (yyo, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
- int yyrule, yyscan_t yyscanner)
-{
- int yylno = yyrline[yyrule];
- int yynrhs = yyr2[yyrule];
- int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
- &yyvsp[(yyi + 1) - (yynrhs)], yyscanner);
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args) ((void) 0)
-# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-/* Context of a parse error. */
-typedef struct
-{
- yy_state_t *yyssp;
- yysymbol_kind_t yytoken;
-} yypcontext_t;
-
-/* Put in YYARG at most YYARGN of the expected tokens given the
- current YYCTX, and return the number of tokens stored in YYARG. If
- YYARG is null, return the number of expected tokens (guaranteed to
- be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
- Return 0 if there are more than YYARGN expected tokens, yet fill
- YYARG up to YYARGN. */
-static int
-yypcontext_expected_tokens (const yypcontext_t *yyctx,
- yysymbol_kind_t yyarg[], int yyargn)
-{
- /* Actual size of YYARG. */
- int yycount = 0;
- int yyn = yypact[+*yyctx->yyssp];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (!yyarg)
- ++yycount;
- else if (yycount == yyargn)
- return 0;
- else
- yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
- }
- }
- if (yyarg && yycount == 0 && 0 < yyargn)
- yyarg[0] = YYSYMBOL_YYEMPTY;
- return yycount;
-}
-
-
-
-
-#ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
-# else
-/* Return the length of YYSTR. */
-static YYPTRDIFF_T
-yystrlen (const char *yystr)
-{
- YYPTRDIFF_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-#endif
-
-#ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-#endif
-
-#ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYPTRDIFF_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYPTRDIFF_T yyn = 0;
- char const *yyp = yystr;
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- else
- goto append;
-
- append:
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (yyres)
- return yystpcpy (yyres, yystr) - yyres;
- else
- return yystrlen (yystr);
-}
-#endif
-
-
-static int
-yy_syntax_error_arguments (const yypcontext_t *yyctx,
- yysymbol_kind_t yyarg[], int yyargn)
-{
- /* Actual size of YYARG. */
- int yycount = 0;
- /* There are many possibilities here to consider:
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
- {
- int yyn;
- if (yyarg)
- yyarg[yycount] = yyctx->yytoken;
- ++yycount;
- yyn = yypcontext_expected_tokens (yyctx,
- yyarg ? yyarg + 1 : yyarg, yyargn - 1);
- if (yyn == YYENOMEM)
- return YYENOMEM;
- else
- yycount += yyn;
- }
- return yycount;
-}
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
- const yypcontext_t *yyctx)
-{
- enum { YYARGS_MAX = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat: reported tokens (one for the "unexpected",
- one per "expected"). */
- yysymbol_kind_t yyarg[YYARGS_MAX];
- /* Cumulated lengths of YYARG. */
- YYPTRDIFF_T yysize = 0;
-
- /* Actual size of YYARG. */
- int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
- if (yycount == YYENOMEM)
- return YYENOMEM;
-
- switch (yycount)
- {
-#define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- default: /* Avoid compiler warnings. */
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-#undef YYCASE_
- }
-
- /* Compute error message size. Don't count the "%s"s, but reserve
- room for the terminator. */
- yysize = yystrlen (yyformat) - 2 * yycount + 1;
- {
- int yyi;
- for (yyi = 0; yyi < yycount; ++yyi)
- {
- YYPTRDIFF_T yysize1
- = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
- if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
- yysize = yysize1;
- else
- return YYENOMEM;
- }
- }
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return -1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
- yyformat += 2;
- }
- else
- {
- ++yyp;
- ++yyformat;
- }
- }
- return 0;
-}
-
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg,
- yysymbol_kind_t yykind, YYSTYPE *yyvaluep, yyscan_t yyscanner)
-{
- YY_USE (yyvaluep);
- YY_USE (yyscanner);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YY_USE (yykind);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-int
-yyparse (yyscan_t yyscanner)
-{
-/* Lookahead token kind. */
-int yychar;
-
-
-/* The semantic value of the lookahead symbol. */
-/* Default value used for initialization, for pacifying older GCCs
- or non-GCC compilers. */
-YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
-YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
-
- /* Number of syntax errors so far. */
- int yynerrs = 0;
-
- yy_state_fast_t yystate = 0;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus = 0;
-
- /* Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* Their size. */
- YYPTRDIFF_T yystacksize = YYINITDEPTH;
-
- /* The state stack: array, bottom, top. */
- yy_state_t yyssa[YYINITDEPTH];
- yy_state_t *yyss = yyssa;
- yy_state_t *yyssp = yyss;
-
- /* The semantic value stack: array, bottom, top. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp = yyvs;
-
- int yyn;
- /* The return value of yyparse. */
- int yyresult;
- /* Lookahead symbol kind. */
- yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- goto yysetstate;
-
-
-/*------------------------------------------------------------.
-| yynewstate -- push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
-yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
-
-/*--------------------------------------------------------------------.
-| yysetstate -- set current state (the top of the stack) to yystate. |
-`--------------------------------------------------------------------*/
-yysetstate:
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
- YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
- YY_IGNORE_USELESS_CAST_BEGIN
- *yyssp = YY_CAST (yy_state_t, yystate);
- YY_IGNORE_USELESS_CAST_END
- YY_STACK_PRINT (yyss, yyssp);
-
- if (yyss + yystacksize - 1 <= yyssp)
-#if !defined yyoverflow && !defined YYSTACK_RELOCATE
- YYNOMEM;
-#else
- {
- /* Get the current used size of the three stacks, in elements. */
- YYPTRDIFF_T yysize = yyssp - yyss + 1;
-
-# if defined yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- yy_state_t *yyss1 = yyss;
- YYSTYPE *yyvs1 = yyvs;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * YYSIZEOF (*yyssp),
- &yyvs1, yysize * YYSIZEOF (*yyvsp),
- &yystacksize);
- yyss = yyss1;
- yyvs = yyvs1;
- }
-# else /* defined YYSTACK_RELOCATE */
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- YYNOMEM;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yy_state_t *yyss1 = yyss;
- union yyalloc *yyptr =
- YY_CAST (union yyalloc *,
- YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
- if (! yyptr)
- YYNOMEM;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
- YY_IGNORE_USELESS_CAST_BEGIN
- YYDPRINTF ((stderr, "Stack size increased to %ld\n",
- YY_CAST (long, yystacksize)));
- YY_IGNORE_USELESS_CAST_END
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
-
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token\n"));
- yychar = yylex (&yylval, yyscanner);
- }
-
- if (yychar <= YYEOF)
- {
- yychar = YYEOF;
- yytoken = YYSYMBOL_YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else if (yychar == YYerror)
- {
- /* The scanner already issued an error message, process directly
- to error recovery. But do not keep the error token as
- lookahead, it is too special and may lead us to an endless
- loop in error recovery. */
- yychar = YYUNDEF;
- yytoken = YYSYMBOL_YYerror;
- goto yyerrlab1;
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2: /* Start: GoalWithOptionalBackSlash */
-#line 101 "cmCommandArgumentParser.y"
- {
- (yyval.str) = 0;
- yyGetParser->SetResult((yyvsp[0].str));
- }
-#line 1445 "cmCommandArgumentParser.cxx"
- break;
-
- case 3: /* GoalWithOptionalBackSlash: Goal */
-#line 107 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1453 "cmCommandArgumentParser.cxx"
- break;
-
- case 4: /* GoalWithOptionalBackSlash: Goal "\\" */
-#line 110 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
- }
-#line 1461 "cmCommandArgumentParser.cxx"
- break;
-
- case 5: /* Goal: %empty */
-#line 115 "cmCommandArgumentParser.y"
- {
- (yyval.str) = 0;
- }
-#line 1469 "cmCommandArgumentParser.cxx"
- break;
-
- case 6: /* Goal: String Goal */
-#line 118 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
- }
-#line 1477 "cmCommandArgumentParser.cxx"
- break;
-
- case 7: /* String: OuterText */
-#line 123 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1485 "cmCommandArgumentParser.cxx"
- break;
-
- case 8: /* String: Variable */
-#line 126 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1493 "cmCommandArgumentParser.cxx"
- break;
-
- case 9: /* OuterText: cal_NAME */
-#line 131 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1501 "cmCommandArgumentParser.cxx"
- break;
-
- case 10: /* OuterText: "@" */
-#line 134 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1509 "cmCommandArgumentParser.cxx"
- break;
-
- case 11: /* OuterText: "$" */
-#line 137 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1517 "cmCommandArgumentParser.cxx"
- break;
-
- case 12: /* OuterText: "{" */
-#line 140 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1525 "cmCommandArgumentParser.cxx"
- break;
-
- case 13: /* OuterText: "}" */
-#line 143 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1533 "cmCommandArgumentParser.cxx"
- break;
-
- case 14: /* OuterText: cal_SYMBOL */
-#line 146 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1541 "cmCommandArgumentParser.cxx"
- break;
-
- case 15: /* Variable: cal_ENVCURLY EnvVarName "}" */
-#line 151 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
- }
-#line 1549 "cmCommandArgumentParser.cxx"
- break;
-
- case 16: /* Variable: cal_NCURLY MultipleIds "}" */
-#line 154 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
- }
-#line 1557 "cmCommandArgumentParser.cxx"
- break;
-
- case 17: /* Variable: cal_DCURLY MultipleIds "}" */
-#line 157 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str));
- }
-#line 1565 "cmCommandArgumentParser.cxx"
- break;
-
- case 18: /* Variable: cal_ATNAME */
-#line 160 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
- }
-#line 1573 "cmCommandArgumentParser.cxx"
- break;
-
- case 19: /* EnvVarName: MultipleIds */
-#line 165 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1581 "cmCommandArgumentParser.cxx"
- break;
-
- case 20: /* EnvVarName: cal_SYMBOL EnvVarName */
-#line 168 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[-1].str);
- }
-#line 1589 "cmCommandArgumentParser.cxx"
- break;
-
- case 21: /* MultipleIds: %empty */
-#line 173 "cmCommandArgumentParser.y"
- {
- (yyval.str) = 0;
- }
-#line 1597 "cmCommandArgumentParser.cxx"
- break;
-
- case 22: /* MultipleIds: ID MultipleIds */
-#line 176 "cmCommandArgumentParser.y"
- {
- (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
- }
-#line 1605 "cmCommandArgumentParser.cxx"
- break;
-
- case 23: /* ID: cal_NAME */
-#line 181 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1613 "cmCommandArgumentParser.cxx"
- break;
-
- case 24: /* ID: Variable */
-#line 184 "cmCommandArgumentParser.y"
- {
- (yyval.str) = (yyvsp[0].str);
- }
-#line 1621 "cmCommandArgumentParser.cxx"
- break;
-
-
-#line 1625 "cmCommandArgumentParser.cxx"
-
- default: break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
-
- *++yyvsp = yyval;
-
- /* Now 'shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
- {
- const int yylhs = yyr1[yyn] - YYNTOKENS;
- const int yyi = yypgoto[yylhs] + *yyssp;
- yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
- ? yytable[yyi]
- : yydefgoto[yylhs]);
- }
-
- goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
-yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
- {
- yypcontext_t yyctx
- = {yyssp, yytoken};
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == -1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = YY_CAST (char *,
- YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
- if (yymsg)
- {
- yysyntax_error_status
- = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
- yymsgp = yymsg;
- }
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = YYENOMEM;
- }
- }
- yyerror (yyscanner, yymsgp);
- if (yysyntax_error_status == YYENOMEM)
- YYNOMEM;
- }
- }
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, yyscanner);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
- /* Pacify compilers when the user code never invokes YYERROR and the
- label yyerrorlab therefore never appears in user code. */
- if (0)
- YYERROR;
- ++yynerrs;
-
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- /* Pop stack until we find a state that shifts the error token. */
- for (;;)
- {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYSYMBOL_YYerror;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping",
- YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturnlab;
-
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturnlab;
-
-
-/*-----------------------------------------------------------.
-| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
-`-----------------------------------------------------------*/
-yyexhaustedlab:
- yyerror (yyscanner, YY_("memory exhausted"));
- yyresult = 2;
- goto yyreturnlab;
-
-
-/*----------------------------------------------------------.
-| yyreturnlab -- parsing is finished, clean up and return. |
-`----------------------------------------------------------*/
-yyreturnlab:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, yyscanner);
- }
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- return yyresult;
-}
-
-#line 189 "cmCommandArgumentParser.y"
-
-/* End of grammar */
-
-/*--------------------------------------------------------------------------*/
-void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
-{
- yyGetParser->Error(message);
-}
diff --git a/Source/LexerParser/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y
deleted file mode 100644
index 59f4b32..0000000
--- a/Source/LexerParser/cmCommandArgumentParser.y
+++ /dev/null
@@ -1,196 +0,0 @@
-%{
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-/*
-
-This file must be translated to C and modified to build everywhere.
-
-Run bison like this:
-
- bison --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
-
-*/
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <string.h>
-
-#define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
-
-/* Make sure malloc and free are available on QNX. */
-#ifdef __QNX__
-# include <malloc.h>
-#endif
-
-/* Make sure the parser uses standard memory allocation. The default
- generated parser malloc/free declarations do not work on all
- platforms. */
-#include <stdlib.h>
-#define YYMALLOC malloc
-#define YYFREE free
-
-/*-------------------------------------------------------------------------*/
-#include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
-#include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
-
-/* Forward declare the lexer entry point. */
-YY_DECL;
-
-/* Helper function to forward error callback from parser. */
-static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
-
-/* Configure the parser to support large input. */
-#define YYMAXDEPTH 100000
-#define YYINITDEPTH 10000
-
-/* Disable some warnings in the generated code. */
-#ifdef _MSC_VER
-# pragma warning (disable: 4102) /* Unused goto label. */
-# pragma warning (disable: 4065) /* Switch statement contains default but no
- case. */
-# pragma warning (disable: 4244) /* loss of precision */
-# pragma warning (disable: 4702) /* unreachable code */
-#endif
-#if defined(__GNUC__) && __GNUC__ >= 8
-# pragma GCC diagnostic ignored "-Wconversion"
-# pragma GCC diagnostic ignored "-Wfree-nonheap-object"
-#endif
-#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wunused-but-set-variable")
-# pragma clang diagnostic ignored "-Wunused-but-set-variable"
-# endif
-#endif
-%}
-
-/* Generate a reentrant parser object. */
-%define api.pure
-
-/* Configure the parser to use a lexer object. */
-%lex-param {yyscan_t yyscanner}
-%parse-param {yyscan_t yyscanner}
-
-%define parse.error verbose
-
-/*
-%union {
- char* string;
-}
-*/
-
-/*-------------------------------------------------------------------------*/
-/* Tokens */
-%token cal_ENVCURLY
-%token cal_NCURLY
-%token cal_DCURLY
-%token cal_DOLLAR "$"
-%token cal_LCURLY "{"
-%token cal_RCURLY "}"
-%token cal_NAME
-%token cal_BSLASH "\\"
-%token cal_SYMBOL
-%token cal_AT "@"
-%token cal_ERROR
-%token cal_ATNAME
-
-/*-------------------------------------------------------------------------*/
-/* grammar */
-%%
-
-
-Start:
- GoalWithOptionalBackSlash {
- $<str>$ = 0;
- yyGetParser->SetResult($<str>1);
- }
-
-GoalWithOptionalBackSlash:
- Goal {
- $<str>$ = $<str>1;
- }
-| Goal cal_BSLASH {
- $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
- }
-
-Goal:
- {
- $<str>$ = 0;
- }
-| String Goal {
- $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
- }
-
-String:
- OuterText {
- $<str>$ = $<str>1;
- }
-| Variable {
- $<str>$ = $<str>1;
- }
-
-OuterText:
- cal_NAME {
- $<str>$ = $<str>1;
- }
-| cal_AT {
- $<str>$ = $<str>1;
- }
-| cal_DOLLAR {
- $<str>$ = $<str>1;
- }
-| cal_LCURLY {
- $<str>$ = $<str>1;
- }
-| cal_RCURLY {
- $<str>$ = $<str>1;
- }
-| cal_SYMBOL {
- $<str>$ = $<str>1;
- }
-
-Variable:
- cal_ENVCURLY EnvVarName cal_RCURLY {
- $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1, $<str>2);
- }
-| cal_NCURLY MultipleIds cal_RCURLY {
- $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1, $<str>2);
- }
-| cal_DCURLY MultipleIds cal_RCURLY {
- $<str>$ = yyGetParser->ExpandVariable($<str>2);
- }
-| cal_ATNAME {
- $<str>$ = yyGetParser->ExpandVariableForAt($<str>1);
- }
-
-EnvVarName:
- MultipleIds {
- $<str>$ = $<str>1;
- }
-| cal_SYMBOL EnvVarName {
- $<str>$ = $<str>1;
- }
-
-MultipleIds:
- {
- $<str>$ = 0;
- }
-| ID MultipleIds {
- $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
- }
-
-ID:
- cal_NAME {
- $<str>$ = $<str>1;
- }
-| Variable {
- $<str>$ = $<str>1;
- }
-;
-
-%%
-/* End of grammar */
-
-/*--------------------------------------------------------------------------*/
-void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
-{
- yyGetParser->Error(message);
-}
diff --git a/Source/LexerParser/cmCommandArgumentParserTokens.h b/Source/LexerParser/cmCommandArgumentParserTokens.h
deleted file mode 100644
index 6365d5b..0000000
--- a/Source/LexerParser/cmCommandArgumentParserTokens.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.8.2. */
-
-/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
- Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
- especially those whose name start with YY_ or yy_. They are
- private implementation details that can be changed or removed. */
-
-#ifndef YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED
-# define YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int cmCommandArgument_yydebug;
-#endif
-
-/* Token kinds. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- YYEMPTY = -2,
- YYEOF = 0, /* "end of file" */
- YYerror = 256, /* error */
- YYUNDEF = 257, /* "invalid token" */
- cal_ENVCURLY = 258, /* cal_ENVCURLY */
- cal_NCURLY = 259, /* cal_NCURLY */
- cal_DCURLY = 260, /* cal_DCURLY */
- cal_DOLLAR = 261, /* "$" */
- cal_LCURLY = 262, /* "{" */
- cal_RCURLY = 263, /* "}" */
- cal_NAME = 264, /* cal_NAME */
- cal_BSLASH = 265, /* "\\" */
- cal_SYMBOL = 266, /* cal_SYMBOL */
- cal_AT = 267, /* "@" */
- cal_ERROR = 268, /* cal_ERROR */
- cal_ATNAME = 269 /* cal_ATNAME */
- };
- typedef enum yytokentype yytoken_kind_t;
-#endif
-
-/* Value type. */
-
-
-
-
-int cmCommandArgument_yyparse (yyscan_t yyscanner);
-
-
-#endif /* !YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED */
diff --git a/Source/LexerParser/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx
index bfe7e64..bcb2311 100644
--- a/Source/LexerParser/cmDependsJavaLexer.cxx
+++ b/Source/LexerParser/cmDependsJavaLexer.cxx
@@ -842,7 +842,7 @@ static const flex_int16_t yy_chk[479] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C++ and modified to build everywhere.
diff --git a/Source/LexerParser/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l
index 942e007..846b9c5 100644
--- a/Source/LexerParser/cmDependsJavaLexer.in.l
+++ b/Source/LexerParser/cmDependsJavaLexer.in.l
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C++ and modified to build everywhere.
diff --git a/Source/LexerParser/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx
index 6755c70..e85bf98 100644
--- a/Source/LexerParser/cmDependsJavaParser.cxx
+++ b/Source/LexerParser/cmDependsJavaParser.cxx
@@ -75,7 +75,7 @@
#line 1 "cmDependsJavaParser.y"
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C and modified to build everywhere.
diff --git a/Source/LexerParser/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y
index d64043a..01d0017 100644
--- a/Source/LexerParser/cmDependsJavaParser.y
+++ b/Source/LexerParser/cmDependsJavaParser.y
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C and modified to build everywhere.
diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx
index 5a76590..d05dfd8 100644
--- a/Source/LexerParser/cmExprLexer.cxx
+++ b/Source/LexerParser/cmExprLexer.cxx
@@ -646,7 +646,7 @@ static const flex_int16_t yy_chk[56] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C++ and modified to build everywhere.
diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l
index 90c1cc3..9a5f42f 100644
--- a/Source/LexerParser/cmExprLexer.in.l
+++ b/Source/LexerParser/cmExprLexer.in.l
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C++ and modified to build everywhere.
diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx
index 80c0abd..042e484 100644
--- a/Source/LexerParser/cmExprParser.cxx
+++ b/Source/LexerParser/cmExprParser.cxx
@@ -75,7 +75,7 @@
#line 1 "cmExprParser.y"
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C and modified to build everywhere.
diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y
index 51df56e..68f7882 100644
--- a/Source/LexerParser/cmExprParser.y
+++ b/Source/LexerParser/cmExprParser.y
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C and modified to build everywhere.
diff --git a/Source/LexerParser/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx
index df65472..3e0a4bd 100644
--- a/Source/LexerParser/cmFortranLexer.cxx
+++ b/Source/LexerParser/cmFortranLexer.cxx
@@ -820,7 +820,7 @@ static const flex_int16_t yy_chk[542] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*-------------------------------------------------------------------------
Portions of this source have been derived from makedepf90 version 2.8.8,
diff --git a/Source/LexerParser/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l
index 7d97699..ed324db 100644
--- a/Source/LexerParser/cmFortranLexer.in.l
+++ b/Source/LexerParser/cmFortranLexer.in.l
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*-------------------------------------------------------------------------
Portions of this source have been derived from makedepf90 version 2.8.8,
diff --git a/Source/LexerParser/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx
index f25856a..a43f4fc 100644
--- a/Source/LexerParser/cmFortranParser.cxx
+++ b/Source/LexerParser/cmFortranParser.cxx
@@ -75,7 +75,7 @@
#line 1 "cmFortranParser.y"
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*-------------------------------------------------------------------------
Portions of this source have been derived from makedepf90 version 2.8.8,
diff --git a/Source/LexerParser/cmFortranParser.y b/Source/LexerParser/cmFortranParser.y
index 0b27060..431d6ab 100644
--- a/Source/LexerParser/cmFortranParser.y
+++ b/Source/LexerParser/cmFortranParser.y
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*-------------------------------------------------------------------------
Portions of this source have been derived from makedepf90 version 2.8.8,
diff --git a/Source/LexerParser/cmGccDepfileLexer.cxx b/Source/LexerParser/cmGccDepfileLexer.cxx
index d926c8b..f1045a7 100644
--- a/Source/LexerParser/cmGccDepfileLexer.cxx
+++ b/Source/LexerParser/cmGccDepfileLexer.cxx
@@ -646,7 +646,7 @@ static const flex_int16_t yy_chk[57] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* IWYU pragma: no_forward_declare yyguts_t */
diff --git a/Source/LexerParser/cmGccDepfileLexer.in.l b/Source/LexerParser/cmGccDepfileLexer.in.l
index a0a0f22..0133742 100644
--- a/Source/LexerParser/cmGccDepfileLexer.in.l
+++ b/Source/LexerParser/cmGccDepfileLexer.in.l
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* IWYU pragma: no_forward_declare yyguts_t */
diff --git a/Source/LexerParser/cmListFileLexer.c b/Source/LexerParser/cmListFileLexer.c
index ec7424c..08fd0a9 100644
--- a/Source/LexerParser/cmListFileLexer.c
+++ b/Source/LexerParser/cmListFileLexer.c
@@ -748,7 +748,7 @@ static const flex_int32_t yy_rule_can_match_eol[25] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C and modified to build everywhere.
diff --git a/Source/LexerParser/cmListFileLexer.in.l b/Source/LexerParser/cmListFileLexer.in.l
index 94cf8a5..623a36b 100644
--- a/Source/LexerParser/cmListFileLexer.in.l
+++ b/Source/LexerParser/cmListFileLexer.in.l
@@ -1,6 +1,6 @@
%{
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*
This file must be translated to C and modified to build everywhere.
diff --git a/Source/Modules/CMakeBuildUtilities.cmake b/Source/Modules/CMakeBuildUtilities.cmake
index 09d8250..dba9d50 100644
--- a/Source/Modules/CMakeBuildUtilities.cmake
+++ b/Source/Modules/CMakeBuildUtilities.cmake
@@ -159,6 +159,7 @@ else()
set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
+ find_package(OpenSSL)
endif()
if(NOT CMAKE_USE_SYSTEM_NGHTTP2)
# Tell curl's FindNGHTTP2 module to use our library.
diff --git a/Source/Modules/CheckCXXLinkerFlag.cmake b/Source/Modules/CheckCXXLinkerFlag.cmake
index 6cb1ba3..3df67d0 100644
--- a/Source/Modules/CheckCXXLinkerFlag.cmake
+++ b/Source/Modules/CheckCXXLinkerFlag.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard(GLOBAL)
include(CheckCXXSourceCompiles)
diff --git a/Source/Modules/FindJsonCpp.cmake b/Source/Modules/FindJsonCpp.cmake
index 1951b61..beafeb3 100644
--- a/Source/Modules/FindJsonCpp.cmake
+++ b/Source/Modules/FindJsonCpp.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJsonCpp
@@ -84,12 +84,10 @@ unset(_JsonCpp_H)
#-----------------------------------------------------------------------------
include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(JsonCpp
- FOUND_VAR JsonCpp_FOUND
+find_package_handle_standard_args(JsonCpp
REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR
VERSION_VAR JsonCpp_VERSION_STRING
)
-set(JSONCPP_FOUND ${JsonCpp_FOUND})
#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
diff --git a/Source/Modules/FindLibRHash.cmake b/Source/Modules/FindLibRHash.cmake
index 86c6189..7cd2006 100644
--- a/Source/Modules/FindLibRHash.cmake
+++ b/Source/Modules/FindLibRHash.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibRHash
@@ -52,11 +52,9 @@ mark_as_advanced(LibRHash_INCLUDE_DIR)
#-----------------------------------------------------------------------------
include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRHash
- FOUND_VAR LibRHash_FOUND
+find_package_handle_standard_args(LibRHash
REQUIRED_VARS LibRHash_LIBRARY LibRHash_INCLUDE_DIR
)
-set(LIBRHASH_FOUND ${LibRHash_FOUND})
#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
diff --git a/Source/Modules/FindLibUUID.cmake b/Source/Modules/FindLibUUID.cmake
index ca5b61d..cc8168a 100644
--- a/Source/Modules/FindLibUUID.cmake
+++ b/Source/Modules/FindLibUUID.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibUUID
@@ -71,11 +71,9 @@ mark_as_advanced(LibUUID_INCLUDE_DIR)
#-----------------------------------------------------------------------------
include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUUID
- FOUND_VAR LibUUID_FOUND
+find_package_handle_standard_args(LibUUID
REQUIRED_VARS LibUUID_LIBRARY LibUUID_INCLUDE_DIR
)
-set(LIBUUID_FOUND ${LibUUID_FOUND})
#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake
index 0554d62..049d31b 100644
--- a/Source/Modules/FindLibUV.cmake
+++ b/Source/Modules/FindLibUV.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibUV
@@ -101,12 +101,10 @@ unset(_LibUV_H)
#-----------------------------------------------------------------------------
include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUV
- FOUND_VAR LibUV_FOUND
+find_package_handle_standard_args(LibUV
REQUIRED_VARS LibUV_LIBRARY LibUV_INCLUDE_DIR
VERSION_VAR LibUV_VERSION
)
-set(LIBUV_FOUND ${LibUV_FOUND})
#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index 7c34c60..3c3be35 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -1,22 +1,22 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "AddCacheEntry.h"
#include "QCMakeSizeType.h"
#include <QCompleter>
#include <QMetaProperty>
-static const int NumTypes = 4;
-static const int DefaultTypeIndex = 0;
-static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH",
+static int const NumTypes = 4;
+static int const DefaultTypeIndex = 0;
+static QByteArray const TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH",
"STRING" };
-static const QCMakeProperty::PropertyType Types[NumTypes] = {
+static QCMakeProperty::PropertyType const Types[NumTypes] = {
QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH,
QCMakeProperty::STRING
};
-AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
- const QStringList& varTypes)
+AddCacheEntry::AddCacheEntry(QWidget* p, QStringList const& varNames,
+ QStringList const& varTypes)
: QWidget(p)
, VarNames(varNames)
, VarTypes(varTypes)
@@ -43,7 +43,7 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
this->Name->setCompleter(completer);
connect(
completer,
- static_cast<void (QCompleter::*)(const QString&)>(&QCompleter::activated),
+ static_cast<void (QCompleter::*)(QString const&)>(&QCompleter::activated),
this, &AddCacheEntry::onCompletionActivated);
}
@@ -87,7 +87,7 @@ QString AddCacheEntry::typeString() const
return TypeStrings[DefaultTypeIndex];
}
-void AddCacheEntry::onCompletionActivated(const QString& text)
+void AddCacheEntry::onCompletionActivated(QString const& text)
{
cm_qsizetype idx = this->VarNames.indexOf(text);
if (idx != -1) {
diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h
index 35522c5..c289c6b 100644
--- a/Source/QtDialog/AddCacheEntry.h
+++ b/Source/QtDialog/AddCacheEntry.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMake.h"
@@ -15,8 +15,8 @@ class AddCacheEntry
{
Q_OBJECT
public:
- AddCacheEntry(QWidget* p, const QStringList& varNames,
- const QStringList& varTypes);
+ AddCacheEntry(QWidget* p, QStringList const& varNames,
+ QStringList const& varTypes);
QString name() const;
QVariant value() const;
@@ -25,9 +25,9 @@ public:
QString typeString() const;
private slots:
- void onCompletionActivated(const QString& text);
+ void onCompletionActivated(QString const& text);
private:
- const QStringList& VarNames;
- const QStringList& VarTypes;
+ QStringList const& VarNames;
+ QStringList const& VarTypes;
};
diff --git a/Source/QtDialog/CMakeGUIExec.cxx b/Source/QtDialog/CMakeGUIExec.cxx
index 1572112..2b35466 100644
--- a/Source/QtDialog/CMakeGUIExec.cxx
+++ b/Source/QtDialog/CMakeGUIExec.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <QApplication>
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index e4b53fd..318849e 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
project(QtDialog)
CMake_OPTIONAL_COMPONENT(cmake-gui)
@@ -306,15 +306,12 @@ Checks: '-*,llvm-twine-local'
")
if(APPLE)
- file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line
- LIMIT_COUNT 1 REGEX "^Copyright 2000-20[0-9][0-9] Kitware")
-
set_target_properties(cmake-gui PROPERTIES
OUTPUT_NAME CMake
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${CMAKE_BUNDLE_VERSION}"
# TBD: MACOSX_BUNDLE_BUNDLE_VERSION "${CMAKE_BUNDLE_VERSION}"
- MACOSX_BUNDLE_COPYRIGHT "${copyright_line}"
+ MACOSX_BUNDLE_COPYRIGHT "${CMake_COPYRIGHT_LINE}"
MACOSX_BUNDLE_GUI_IDENTIFIER "org.cmake.cmake"
)
@@ -364,7 +361,7 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/CMake")
endif()
install(CODE "
- include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\")
+ include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${Qt_BIN_DIR};${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
" ${COMPONENT})
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 21ed8c8..234b587 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <iostream>
#include "QCMake.h" // include to disable MS warnings
@@ -23,12 +23,12 @@
#include "cmake.h"
namespace {
-const cmDocumentationEntry cmDocumentationName = {
+cmDocumentationEntry const cmDocumentationName = {
{},
" cmake-gui - CMake GUI."
};
-const cmDocumentationEntry cmDocumentationUsage = {
+cmDocumentationEntry const cmDocumentationUsage = {
{},
" cmake-gui [options]\n"
" cmake-gui [options] <path-to-source>\n"
@@ -37,7 +37,7 @@ const cmDocumentationEntry cmDocumentationUsage = {
" cmake-gui [options] --browse-manual [<filename>]"
};
-const cmDocumentationEntry cmDocumentationOptions[3] = {
+cmDocumentationEntry const cmDocumentationOptions[3] = {
{ "-S <path-to-source>", "Explicitly specify a source directory." },
{ "-B <path-to-build>", "Explicitly specify a build directory." },
{ "--preset=<preset>", "Specify a configure preset." }
@@ -62,7 +62,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin);
int CMakeGUIExec(CMakeSetupDialog* window);
void SetupDefaultQSettings();
-void OpenReferenceManual(const QString& filename);
+void OpenReferenceManual(QString const& filename);
int main(int argc, char** argv)
{
@@ -156,7 +156,7 @@ int main(int argc, char** argv)
std::string sourceDirectory;
std::string presetName;
for (int i = 1; i < args.size(); ++i) {
- const QString& arg = args[i];
+ QString const& arg = args[i];
if (arg.startsWith("-S")) {
QString path = arg.mid(2);
if (path.isEmpty()) {
@@ -172,8 +172,8 @@ int main(int argc, char** argv)
}
}
- sourceDirectory = cmSystemTools::CollapseFullPath(path.toStdString());
- cmSystemTools::ConvertToUnixSlashes(sourceDirectory);
+ sourceDirectory =
+ cmSystemTools::ToNormalizedPathOnDisk(path.toStdString());
} else if (arg.startsWith("-B")) {
QString path = arg.mid(2);
if (path.isEmpty()) {
@@ -189,8 +189,8 @@ int main(int argc, char** argv)
}
}
- binaryDirectory = cmSystemTools::CollapseFullPath(path.toStdString());
- cmSystemTools::ConvertToUnixSlashes(binaryDirectory);
+ binaryDirectory =
+ cmSystemTools::ToNormalizedPathOnDisk(path.toStdString());
} else if (arg.startsWith("--preset=")) {
QString preset = arg.mid(cmStrLen("--preset="));
if (preset.isEmpty()) {
@@ -223,7 +223,7 @@ int main(int argc, char** argv)
} else {
if (args.count() == 2) {
std::string filePath =
- cmSystemTools::CollapseFullPath(args[1].toStdString());
+ cmSystemTools::ToNormalizedPathOnDisk(args[1].toStdString());
// check if argument is a directory containing CMakeCache.txt
std::string buildFilePath = cmStrCat(filePath, "/CMakeCache.txt");
@@ -243,7 +243,7 @@ int main(int argc, char** argv)
} else if (cmSystemTools::FileExists(srcFilePath.c_str())) {
dialog.setSourceDirectory(QString::fromStdString(filePath));
dialog.setBinaryDirectory(
- QString::fromStdString(cmSystemTools::CollapseFullPath(".")));
+ QString::fromStdString(cmSystemTools::GetLogicalWorkingDirectory()));
}
}
}
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index af6cf74..c3aaba0 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "CMakeSetupDialog.h"
#include <cm/memory>
@@ -43,7 +43,7 @@
#include "RegexExplorer.h"
#include "WarningMessagesDialog.h"
-void OpenReferenceManual(const QString& filename)
+void OpenReferenceManual(QString const& filename)
{
QString urlFormat("https://cmake.org/cmake/help/v%1.%2/");
QUrl url(urlFormat.arg(QString::number(cmVersion::GetMajorVersion()),
@@ -59,7 +59,7 @@ void OpenReferenceManual(const QString& filename)
}
namespace {
-const QString PRESETS_DISABLED_TOOLTIP =
+QString const PRESETS_DISABLED_TOOLTIP =
"This option is disabled because there are no available presets in "
"CMakePresets.json or CMakeUserPresets.json.";
}
@@ -709,7 +709,7 @@ void CMakeSetupDialog::doSourceBrowse()
}
}
-void CMakeSetupDialog::updateSourceDirectory(const QString& dir)
+void CMakeSetupDialog::updateSourceDirectory(QString const& dir)
{
if (this->SourceDirectory->text() != dir) {
this->SourceDirectory->blockSignals(true);
@@ -718,7 +718,7 @@ void CMakeSetupDialog::updateSourceDirectory(const QString& dir)
}
}
-void CMakeSetupDialog::updateBinaryDirectory(const QString& dir)
+void CMakeSetupDialog::updateBinaryDirectory(QString const& dir)
{
if (this->BinaryDirectory->currentText() != dir) {
this->BinaryDirectory->blockSignals(true);
@@ -727,7 +727,7 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir)
}
}
-void CMakeSetupDialog::updatePresets(const QVector<QCMakePreset>& presets)
+void CMakeSetupDialog::updatePresets(QVector<QCMakePreset> const& presets)
{
if (this->Preset->presets() != presets) {
this->Preset->blockSignals(true);
@@ -744,7 +744,7 @@ void CMakeSetupDialog::updatePresets(const QVector<QCMakePreset>& presets)
}
}
-void CMakeSetupDialog::updatePreset(const QString& name)
+void CMakeSetupDialog::updatePreset(QString const& name)
{
if (this->Preset->presetName() != name) {
this->Preset->blockSignals(true);
@@ -753,8 +753,8 @@ void CMakeSetupDialog::updatePreset(const QString& name)
}
}
-void CMakeSetupDialog::showPresetLoadError(const QString& dir,
- const QString& message)
+void CMakeSetupDialog::showPresetLoadError(QString const& dir,
+ QString const& message)
{
QMessageBox::warning(
this, "Error Reading CMake Presets",
@@ -778,7 +778,7 @@ void CMakeSetupDialog::doBinaryBrowse()
}
}
-void CMakeSetupDialog::setBinaryDirectory(const QString& dir)
+void CMakeSetupDialog::setBinaryDirectory(QString const& dir)
{
this->BinaryDirectory->setEditText(dir);
}
@@ -788,7 +788,7 @@ void CMakeSetupDialog::setStartupBinaryDirectory(bool startup)
this->StartupBinaryDirectory = startup;
}
-void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir)
+void CMakeSetupDialog::onSourceDirectoryChanged(QString const& dir)
{
this->Output->clear();
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
@@ -796,7 +796,7 @@ void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir)
Q_ARG(QString, dir));
}
-void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
+void CMakeSetupDialog::onBinaryDirectoryChanged(QString const& dir)
{
QString title = QString(tr("CMake %1 - %2"));
title = title.arg(cmVersion::GetCMakeVersion());
@@ -813,7 +813,7 @@ void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
Q_ARG(QString, dir));
}
-void CMakeSetupDialog::onBuildPresetChanged(const QString& name)
+void CMakeSetupDialog::onBuildPresetChanged(QString const& name)
{
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), "setPreset",
Qt::QueuedConnection, Q_ARG(QString, name),
@@ -821,17 +821,17 @@ void CMakeSetupDialog::onBuildPresetChanged(const QString& name)
this->StartupBinaryDirectory = false;
}
-void CMakeSetupDialog::setSourceDirectory(const QString& dir)
+void CMakeSetupDialog::setSourceDirectory(QString const& dir)
{
this->SourceDirectory->setText(dir);
}
-void CMakeSetupDialog::setDeferredPreset(const QString& preset)
+void CMakeSetupDialog::setDeferredPreset(QString const& preset)
{
this->DeferredPreset = preset;
}
-void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent)
+void CMakeSetupDialog::showProgress(QString const& /*msg*/, float percent)
{
percent = (percent * ProgressFactor) + ProgressOffset;
this->ProgressBar->setValue(qRound(percent * 100));
@@ -843,7 +843,7 @@ void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent)
#endif
}
-void CMakeSetupDialog::error(const QString& msg)
+void CMakeSetupDialog::error(QString const& msg)
{
this->Output->setCurrentCharFormat(this->ErrorFormat);
// QTextEdit will terminate the msg with a ParagraphSeparator, but it also
@@ -856,7 +856,7 @@ void CMakeSetupDialog::error(const QString& msg)
this->Output->append(paragraph);
}
-void CMakeSetupDialog::message(const QString& msg)
+void CMakeSetupDialog::message(QString const& msg)
{
this->Output->setCurrentCharFormat(this->MessageFormat);
this->Output->append(msg);
@@ -986,7 +986,7 @@ bool CMakeSetupDialog::setupFirstConfigure()
return false;
}
-void CMakeSetupDialog::updateGeneratorLabel(const QString& gen)
+void CMakeSetupDialog::updateGeneratorLabel(QString const& gen)
{
QString str = tr("Current Generator: ");
if (gen.isEmpty()) {
@@ -1024,8 +1024,7 @@ void CMakeSetupDialog::doAbout()
"CMake suite maintained and supported by Kitware (kitware.com/cmake).\n"
"Distributed under terms of the BSD 3-Clause License.\n"
"\n"
- "CMake GUI maintained by csimsoft,\n"
- "built using Qt %2 (qt-project.org).\n"
+ "CMake GUI built using Qt %2 (qt-project.org).\n"
#ifdef USE_LGPL
"\n"
"The Qt Toolkit is Copyright (C) The Qt Company Ltd.\n"
@@ -1061,7 +1060,7 @@ void CMakeSetupDialog::setExitAfterGenerate(bool b)
this->ExitAfterGenerate = b;
}
-void CMakeSetupDialog::addBinaryPath(const QString& path)
+void CMakeSetupDialog::addBinaryPath(QString const& path)
{
QString cleanpath = QDir::cleanPath(path);
@@ -1090,7 +1089,7 @@ void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e)
return;
}
- const QMimeData* dat = e->mimeData();
+ QMimeData const* dat = e->mimeData();
QList<QUrl> urls = dat->urls();
QString file = urls.count() ? urls[0].toLocalFile() : QString();
if (!file.isEmpty() &&
@@ -1109,7 +1108,7 @@ void CMakeSetupDialog::dropEvent(QDropEvent* e)
return;
}
- const QMimeData* dat = e->mimeData();
+ QMimeData const* dat = e->mimeData();
QList<QUrl> urls = dat->urls();
QString file = urls.count() ? urls[0].toLocalFile() : QString();
if (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive)) {
@@ -1143,7 +1142,7 @@ QStringList CMakeSetupDialog::loadBuildPaths()
return buildPaths;
}
-void CMakeSetupDialog::saveBuildPaths(const QStringList& paths)
+void CMakeSetupDialog::saveBuildPaths(QStringList const& paths)
{
QSettings settings;
settings.beginGroup("Settings/StartPath");
@@ -1370,10 +1369,10 @@ void CMakeSetupDialog::showUserChanges()
dialog.exec();
}
-void CMakeSetupDialog::setSearchFilter(const QString& str)
+void CMakeSetupDialog::setSearchFilter(QString const& str)
{
this->CacheValues->selectionModel()->clear();
- const bool valid = this->CacheValues->setSearchFilter(str);
+ bool const valid = this->CacheValues->setSearchFilter(str);
QtCMake::setSearchFilterColor(this->Search, valid);
}
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index d4c72cb..e5cd753 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
@@ -34,9 +34,9 @@ public:
~CMakeSetupDialog();
public slots:
- void setBinaryDirectory(const QString& dir);
- void setSourceDirectory(const QString& dir);
- void setDeferredPreset(const QString& preset);
+ void setBinaryDirectory(QString const& dir);
+ void setSourceDirectory(QString const& dir);
+ void setDeferredPreset(QString const& preset);
void setStartupBinaryDirectory(bool startup);
protected slots:
@@ -48,29 +48,29 @@ protected slots:
void doHelp();
void doAbout();
void doInterrupt();
- void error(const QString& message);
- void message(const QString& message);
+ void error(QString const& message);
+ void message(QString const& message);
void doSourceBrowse();
void doBinaryBrowse();
void doReloadCache();
void doDeleteCache();
- void updateSourceDirectory(const QString& dir);
- void updateBinaryDirectory(const QString& dir);
- void updatePresets(const QVector<QCMakePreset>& presets);
- void updatePreset(const QString& name);
- void showPresetLoadError(const QString& dir, const QString& message);
- void showProgress(const QString& msg, float percent);
+ void updateSourceDirectory(QString const& dir);
+ void updateBinaryDirectory(QString const& dir);
+ void updatePresets(QVector<QCMakePreset> const& presets);
+ void updatePreset(QString const& name);
+ void showPresetLoadError(QString const& dir, QString const& message);
+ void showProgress(QString const& msg, float percent);
void setEnabledState(bool);
bool setupFirstConfigure();
- void updateGeneratorLabel(const QString& gen);
+ void updateGeneratorLabel(QString const& gen);
void setExitAfterGenerate(bool);
- void addBinaryPath(const QString&);
+ void addBinaryPath(QString const&);
QStringList loadBuildPaths();
- void saveBuildPaths(const QStringList&);
- void onBinaryDirectoryChanged(const QString& dir);
- void onSourceDirectoryChanged(const QString& dir);
- void onBuildPresetChanged(const QString& name);
+ void saveBuildPaths(QStringList const&);
+ void onBinaryDirectoryChanged(QString const& dir);
+ void onSourceDirectoryChanged(QString const& dir);
+ void onBuildPresetChanged(QString const& name);
void setCacheModified();
void removeSelectedCacheEntries();
void selectionChanged();
@@ -81,7 +81,7 @@ protected slots:
void setAdvancedView(bool);
void setGroupedView(bool);
void showUserChanges();
- void setSearchFilter(const QString& str);
+ void setSearchFilter(QString const& str);
bool prepareConfigure();
bool doConfigureInternal();
bool doGenerateInternal();
diff --git a/Source/QtDialog/EnvironmentDialog.cxx b/Source/QtDialog/EnvironmentDialog.cxx
index 2752c0f..8ffb7f1 100644
--- a/Source/QtDialog/EnvironmentDialog.cxx
+++ b/Source/QtDialog/EnvironmentDialog.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "EnvironmentDialog.h"
#include "QCMakeWidgets.h"
@@ -12,7 +12,7 @@
#include <QStandardItem>
EnvironmentItemModel::EnvironmentItemModel(
- const QProcessEnvironment& environment, QObject* parent)
+ QProcessEnvironment const& environment, QObject* parent)
: QStandardItemModel(parent)
{
this->clear();
@@ -42,7 +42,7 @@ void EnvironmentItemModel::clear()
this->setHorizontalHeaderLabels(labels);
}
-QModelIndex EnvironmentItemModel::buddy(const QModelIndex& index) const
+QModelIndex EnvironmentItemModel::buddy(QModelIndex const& index) const
{
if (index.column() == 0) {
return this->index(index.row(), index.column() + 1, index.parent());
@@ -50,14 +50,14 @@ QModelIndex EnvironmentItemModel::buddy(const QModelIndex& index) const
return index;
}
-void EnvironmentItemModel::appendVariable(const QString& key,
- const QString& value)
+void EnvironmentItemModel::appendVariable(QString const& key,
+ QString const& value)
{
this->insertVariable(this->rowCount(), key, value);
}
-void EnvironmentItemModel::insertVariable(int row, const QString& key,
- const QString& value)
+void EnvironmentItemModel::insertVariable(int row, QString const& key,
+ QString const& value)
{
for (int i = 0; i < this->rowCount(); ++i) {
if (this->data(this->index(i, 0), Qt::DisplayRole) == key) {
@@ -77,7 +77,7 @@ EnvironmentSearchFilter::EnvironmentSearchFilter(QObject* parent)
}
bool EnvironmentSearchFilter::filterAcceptsRow(int row,
- const QModelIndex& parent) const
+ QModelIndex const& parent) const
{
auto* model = this->sourceModel();
auto key =
@@ -89,7 +89,7 @@ bool EnvironmentSearchFilter::filterAcceptsRow(int row,
#endif
}
-EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment,
+EnvironmentDialog::EnvironmentDialog(QProcessEnvironment const& environment,
QWidget* parent)
: QDialog(parent)
{
@@ -112,8 +112,8 @@ EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment,
QObject::connect(this->RemoveEntry, &QAbstractButton::clicked, this,
&EnvironmentDialog::removeSelectedEntries);
QObject::connect(
- this->Search, &QLineEdit::textChanged, [this](const QString& text) {
- const bool valid = QtCMake::setSearchFilter(this->m_filter, text);
+ this->Search, &QLineEdit::textChanged, [this](QString const& text) {
+ bool const valid = QtCMake::setSearchFilter(this->m_filter, text);
QtCMake::setSearchFilterColor(this->Search, valid);
});
QObject::connect(this->Environment->selectionModel(),
diff --git a/Source/QtDialog/EnvironmentDialog.h b/Source/QtDialog/EnvironmentDialog.h
index 6aae798..8665c71 100644
--- a/Source/QtDialog/EnvironmentDialog.h
+++ b/Source/QtDialog/EnvironmentDialog.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <QDialog>
@@ -14,17 +14,17 @@ class EnvironmentItemModel : public QStandardItemModel
{
Q_OBJECT
public:
- EnvironmentItemModel(const QProcessEnvironment& environment,
+ EnvironmentItemModel(QProcessEnvironment const& environment,
QObject* parent = nullptr);
QProcessEnvironment environment() const;
void clear();
- QModelIndex buddy(const QModelIndex& index) const override;
+ QModelIndex buddy(QModelIndex const& index) const override;
public slots:
- void appendVariable(const QString& key, const QString& value);
- void insertVariable(int row, const QString& key, const QString& value);
+ void appendVariable(QString const& key, QString const& value);
+ void insertVariable(int row, QString const& key, QString const& value);
};
class EnvironmentSearchFilter : public QSortFilterProxyModel
@@ -34,7 +34,7 @@ public:
EnvironmentSearchFilter(QObject* parent = nullptr);
protected:
- bool filterAcceptsRow(int row, const QModelIndex& parent) const override;
+ bool filterAcceptsRow(int row, QModelIndex const& parent) const override;
};
class EnvironmentDialog
@@ -43,7 +43,7 @@ class EnvironmentDialog
{
Q_OBJECT
public:
- EnvironmentDialog(const QProcessEnvironment& environment,
+ EnvironmentDialog(QProcessEnvironment const& environment,
QWidget* parent = nullptr);
QProcessEnvironment environment() const;
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index 2986e1f..fec62c6 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -137,7 +137,7 @@ void StartCompilerSetup::setGenerators(
this->GeneratorOptions->addItems(generator_list);
}
-void StartCompilerSetup::setCurrentGenerator(const QString& gen)
+void StartCompilerSetup::setCurrentGenerator(QString const& gen)
{
int idx = this->GeneratorOptions->findText(gen);
if (idx != -1) {
@@ -145,12 +145,12 @@ void StartCompilerSetup::setCurrentGenerator(const QString& gen)
}
}
-void StartCompilerSetup::setPlatform(const QString& platform)
+void StartCompilerSetup::setPlatform(QString const& platform)
{
this->PlatformOptions->setCurrentText(platform);
}
-void StartCompilerSetup::setToolset(const QString& toolset)
+void StartCompilerSetup::setToolset(QString const& toolset)
{
this->Toolset->setText(toolset);
}
@@ -297,7 +297,7 @@ QString NativeCompilerSetup::getCCompiler() const
return this->CCompiler->text();
}
-void NativeCompilerSetup::setCCompiler(const QString& s)
+void NativeCompilerSetup::setCCompiler(QString const& s)
{
this->CCompiler->setText(s);
}
@@ -307,7 +307,7 @@ QString NativeCompilerSetup::getCXXCompiler() const
return this->CXXCompiler->text();
}
-void NativeCompilerSetup::setCXXCompiler(const QString& s)
+void NativeCompilerSetup::setCXXCompiler(QString const& s)
{
this->CXXCompiler->setText(s);
}
@@ -317,7 +317,7 @@ QString NativeCompilerSetup::getFortranCompiler() const
return this->FortranCompiler->text();
}
-void NativeCompilerSetup::setFortranCompiler(const QString& s)
+void NativeCompilerSetup::setFortranCompiler(QString const& s)
{
this->FortranCompiler->setText(s);
}
@@ -359,7 +359,7 @@ QString CrossCompilerSetup::getCCompiler() const
return this->CrossCompilers->CCompiler->text();
}
-void CrossCompilerSetup::setCCompiler(const QString& s)
+void CrossCompilerSetup::setCCompiler(QString const& s)
{
this->CrossCompilers->CCompiler->setText(s);
}
@@ -369,7 +369,7 @@ QString CrossCompilerSetup::getCXXCompiler() const
return this->CrossCompilers->CXXCompiler->text();
}
-void CrossCompilerSetup::setCXXCompiler(const QString& s)
+void CrossCompilerSetup::setCXXCompiler(QString const& s)
{
this->CrossCompilers->CXXCompiler->setText(s);
}
@@ -379,7 +379,7 @@ QString CrossCompilerSetup::getFortranCompiler() const
return this->CrossCompilers->FortranCompiler->text();
}
-void CrossCompilerSetup::setFortranCompiler(const QString& s)
+void CrossCompilerSetup::setFortranCompiler(QString const& s)
{
this->CrossCompilers->FortranCompiler->setText(s);
}
@@ -389,7 +389,7 @@ QString CrossCompilerSetup::getSystem() const
return this->systemName->text();
}
-void CrossCompilerSetup::setSystem(const QString& t)
+void CrossCompilerSetup::setSystem(QString const& t)
{
this->systemName->setText(t);
}
@@ -399,7 +399,7 @@ QString CrossCompilerSetup::getVersion() const
return this->systemVersion->text();
}
-void CrossCompilerSetup::setVersion(const QString& t)
+void CrossCompilerSetup::setVersion(QString const& t)
{
this->systemVersion->setText(t);
}
@@ -409,7 +409,7 @@ QString CrossCompilerSetup::getProcessor() const
return this->systemProcessor->text();
}
-void CrossCompilerSetup::setProcessor(const QString& t)
+void CrossCompilerSetup::setProcessor(QString const& t)
{
this->systemProcessor->setText(t);
}
@@ -419,7 +419,7 @@ QString CrossCompilerSetup::getFindRoot() const
return this->crossFindRoot->text();
}
-void CrossCompilerSetup::setFindRoot(const QString& t)
+void CrossCompilerSetup::setFindRoot(QString const& t)
{
this->crossFindRoot->setText(t);
}
@@ -470,16 +470,16 @@ QString ToolchainCompilerSetup::toolchainFile() const
return this->ToolchainFile->text();
}
-void ToolchainCompilerSetup::setToolchainFile(const QString& t)
+void ToolchainCompilerSetup::setToolchainFile(QString const& t)
{
this->ToolchainFile->setText(t);
}
FirstConfigure::FirstConfigure()
{
- const char* env_generator = std::getenv("CMAKE_GENERATOR");
- const char* env_generator_platform = nullptr;
- const char* env_generator_toolset = nullptr;
+ char const* env_generator = std::getenv("CMAKE_GENERATOR");
+ char const* env_generator_platform = nullptr;
+ char const* env_generator_toolset = nullptr;
if (env_generator && std::strlen(env_generator)) {
mDefaultGenerator = env_generator;
env_generator_platform = std::getenv("CMAKE_GENERATOR_PLATFORM");
@@ -519,17 +519,17 @@ void FirstConfigure::setGenerators(
this->mStartCompilerSetupPage->setGenerators(gens);
}
-void FirstConfigure::setCurrentGenerator(const QString& gen)
+void FirstConfigure::setCurrentGenerator(QString const& gen)
{
this->mStartCompilerSetupPage->setCurrentGenerator(gen);
}
-void FirstConfigure::setPlatform(const QString& platform)
+void FirstConfigure::setPlatform(QString const& platform)
{
this->mStartCompilerSetupPage->setPlatform(platform);
}
-void FirstConfigure::setToolset(const QString& toolset)
+void FirstConfigure::setToolset(QString const& toolset)
{
this->mStartCompilerSetupPage->setToolset(toolset);
}
@@ -733,7 +733,7 @@ QString FirstConfigure::getCrossRoot() const
return this->mCrossCompilerSetupPage->getFindRoot();
}
-const QString CrossModes[] = { "BOTH", "ONLY", "NEVER" };
+QString const CrossModes[] = { "BOTH", "ONLY", "NEVER" };
QString FirstConfigure::getCrossProgramMode() const
{
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index ea6fae6..bf76bbf 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -41,9 +41,9 @@ public:
QString defaultGeneratorToolset, QWidget* p);
~StartCompilerSetup();
void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
- void setCurrentGenerator(const QString& gen);
- void setToolset(const QString& toolset);
- void setPlatform(const QString& platform);
+ void setCurrentGenerator(QString const& gen);
+ void setToolset(QString const& toolset);
+ void setPlatform(QString const& platform);
void setCompilerOption(CompilerOption option);
QString getGenerator() const;
QString getToolset() const;
@@ -94,13 +94,13 @@ public:
~NativeCompilerSetup();
QString getCCompiler() const;
- void setCCompiler(const QString&);
+ void setCCompiler(QString const&);
QString getCXXCompiler() const;
- void setCXXCompiler(const QString&);
+ void setCXXCompiler(QString const&);
QString getFortranCompiler() const;
- void setFortranCompiler(const QString&);
+ void setFortranCompiler(QString const&);
int nextId() const { return -1; }
};
@@ -116,25 +116,25 @@ public:
~CrossCompilerSetup();
QString getSystem() const;
- void setSystem(const QString&);
+ void setSystem(QString const&);
QString getVersion() const;
- void setVersion(const QString&);
+ void setVersion(QString const&);
QString getProcessor() const;
- void setProcessor(const QString&);
+ void setProcessor(QString const&);
QString getCCompiler() const;
- void setCCompiler(const QString&);
+ void setCCompiler(QString const&);
QString getCXXCompiler() const;
- void setCXXCompiler(const QString&);
+ void setCXXCompiler(QString const&);
QString getFortranCompiler() const;
- void setFortranCompiler(const QString&);
+ void setFortranCompiler(QString const&);
QString getFindRoot() const;
- void setFindRoot(const QString&);
+ void setFindRoot(QString const&);
enum CrossMode
{
@@ -162,7 +162,7 @@ public:
~ToolchainCompilerSetup();
QString toolchainFile() const;
- void setToolchainFile(const QString&);
+ void setToolchainFile(QString const&);
int nextId() const { return -1; }
@@ -179,9 +179,9 @@ public:
~FirstConfigure();
void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
- void setCurrentGenerator(const QString& gen);
- void setToolset(const QString& toolset);
- void setPlatform(const QString& platform);
+ void setCurrentGenerator(QString const& gen);
+ void setToolset(QString const& toolset);
+ void setPlatform(QString const& platform);
void setCompilerOption(CompilerOption option);
QString getGenerator() const;
QString getPlatform() const;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index dec0c99..790c008 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMake.h"
#include <algorithm>
@@ -38,7 +38,7 @@ QCMake::QCMake(QObject* p)
cmSystemTools::SetRunCommandHideConsole(true);
cmSystemTools::SetMessageCallback(
- [this](std::string const& msg, const cmMessageMetadata& md) {
+ [this](std::string const& msg, cmMessageMetadata const& md) {
this->messageCallback(msg, md.title);
});
cmSystemTools::SetStdoutCallback(
@@ -51,7 +51,7 @@ QCMake::QCMake(QObject* p)
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeGUICommand());
this->CMakeInstance->SetProgressCallback(
- [this](const std::string& msg, float percent) {
+ [this](std::string const& msg, float percent) {
this->progressCallback(msg, percent);
});
@@ -59,8 +59,7 @@ QCMake::QCMake(QObject* p)
[this] { return this->interruptCallback(); });
std::vector<cmake::GeneratorInfo> generators;
- this->CMakeInstance->GetRegisteredGenerators(
- generators, /*includeNamesWithPlatform=*/false);
+ this->CMakeInstance->GetRegisteredGenerators(generators);
for (cmake::GeneratorInfo const& gen : generators) {
this->AvailableGenerators.push_back(gen);
@@ -80,12 +79,12 @@ QCMake::QCMake(QObject* p)
QCMake::~QCMake() = default;
-void QCMake::loadCache(const QString& dir)
+void QCMake::loadCache(QString const& dir)
{
this->setBinaryDirectory(dir);
}
-void QCMake::setSourceDirectory(const QString& _dir)
+void QCMake::setSourceDirectory(QString const& _dir)
{
QString dir = QString::fromStdString(
cmSystemTools::GetActualCaseForPath(_dir.toStdString()));
@@ -102,7 +101,7 @@ void QCMake::setSourceDirectory(const QString& _dir)
}
}
-void QCMake::setBinaryDirectory(const QString& _dir)
+void QCMake::setBinaryDirectory(QString const& _dir)
{
QString dir = QString::fromStdString(
cmSystemTools::GetActualCaseForPath(_dir.toStdString()));
@@ -168,7 +167,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
}
}
-void QCMake::setPreset(const QString& name, bool setBinary)
+void QCMake::setPreset(QString const& name, bool setBinary)
{
if (this->PresetName != name) {
this->PresetName = name;
@@ -218,7 +217,7 @@ void QCMake::setPreset(const QString& name, bool setBinary)
}
}
-void QCMake::setGenerator(const QString& gen)
+void QCMake::setGenerator(QString const& gen)
{
if (this->Generator != gen) {
this->Generator = gen;
@@ -226,7 +225,7 @@ void QCMake::setGenerator(const QString& gen)
}
}
-void QCMake::setPlatform(const QString& platform)
+void QCMake::setPlatform(QString const& platform)
{
if (this->Platform != platform) {
this->Platform = platform;
@@ -234,7 +233,7 @@ void QCMake::setPlatform(const QString& platform)
}
}
-void QCMake::setToolset(const QString& toolset)
+void QCMake::setToolset(QString const& toolset)
{
if (this->Toolset != toolset) {
this->Toolset = toolset;
@@ -242,7 +241,7 @@ void QCMake::setToolset(const QString& toolset)
}
}
-void QCMake::setEnvironment(const QProcessEnvironment& environment)
+void QCMake::setEnvironment(QProcessEnvironment const& environment)
{
this->Environment = environment;
}
@@ -259,9 +258,7 @@ void QCMake::configure()
#endif
// Apply the same transformations that the command-line invocation does
auto sanitizePath = [](QString const& value) -> std::string {
- std::string path = cmSystemTools::CollapseFullPath(value.toStdString());
- cmSystemTools::ConvertToUnixSlashes(path);
- return path;
+ return cmSystemTools::ToNormalizedPathOnDisk(value.toStdString());
};
this->CMakeInstance->SetHomeDirectory(sanitizePath(this->SourceDirectory));
@@ -334,7 +331,7 @@ void QCMake::open()
emit this->openDone(successful);
}
-void QCMake::setProperties(const QCMakePropertyList& newProps)
+void QCMake::setProperties(QCMakePropertyList const& newProps)
{
QCMakePropertyList props = newProps;
@@ -357,9 +354,9 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
} else {
prop = props[idx];
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- const bool isBool = prop.Value.type() == QVariant::Bool;
+ bool const isBool = prop.Value.type() == QVariant::Bool;
#else
- const bool isBool = prop.Value.metaType() == QMetaType::fromType<bool>();
+ bool const isBool = prop.Value.metaType() == QMetaType::fromType<bool>();
#endif
if (isBool) {
state->SetCacheEntryValue(key, prop.Value.toBool() ? "ON" : "OFF");
@@ -405,7 +402,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
namespace {
template <typename T>
-QCMakeProperty cache_to_property(const T& v)
+QCMakeProperty cache_to_property(T const& v)
{
QCMakeProperty prop;
prop.Key = QString::fromStdString(v.first);
@@ -532,7 +529,7 @@ bool QCMake::interruptCallback()
#endif
}
-void QCMake::progressCallback(const std::string& msg, float percent)
+void QCMake::progressCallback(std::string const& msg, float percent)
{
if (percent >= 0) {
emit this->progressChanged(QString::fromStdString(msg), percent);
@@ -542,7 +539,7 @@ void QCMake::progressCallback(const std::string& msg, float percent)
QCoreApplication::processEvents();
}
-void QCMake::messageCallback(std::string const& msg, const char* /*title*/)
+void QCMake::messageCallback(std::string const& msg, char const* /*title*/)
{
emit this->errorMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
@@ -606,7 +603,7 @@ void QCMake::loadPresets()
preset.enabled = it.Expanded && it.Expanded->ConditionResult &&
std::find_if(this->AvailableGenerators.begin(),
this->AvailableGenerators.end(),
- [&p](const cmake::GeneratorInfo& g) {
+ [&p](cmake::GeneratorInfo const& g) {
return g.name == p.Generator;
}) != this->AvailableGenerators.end();
presets.push_back(preset);
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index d42dac4..7eb8bc7 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,11 +43,11 @@ struct QCMakeProperty
QString Help;
PropertyType Type;
bool Advanced;
- bool operator==(const QCMakeProperty& other) const
+ bool operator==(QCMakeProperty const& other) const
{
return this->Key == other.Key;
}
- bool operator<(const QCMakeProperty& other) const
+ bool operator<(QCMakeProperty const& other) const
{
return this->Key < other.Key;
}
@@ -72,21 +72,21 @@ public:
~QCMake();
public slots:
/// load the cache file in a directory
- void loadCache(const QString& dir);
+ void loadCache(QString const& dir);
/// set the source directory containing the source
- void setSourceDirectory(const QString& dir);
+ void setSourceDirectory(QString const& dir);
/// set the binary directory to build in
- void setBinaryDirectory(const QString& dir);
+ void setBinaryDirectory(QString const& dir);
/// set the preset name to use
- void setPreset(const QString& name, bool setBinary = true);
+ void setPreset(QString const& name, bool setBinary = true);
/// set the desired generator to use
- void setGenerator(const QString& generator);
+ void setGenerator(QString const& generator);
/// set the desired generator to use
- void setPlatform(const QString& platform);
+ void setPlatform(QString const& platform);
/// set the desired generator to use
- void setToolset(const QString& toolset);
+ void setToolset(QString const& toolset);
/// set the configure and generate environment
- void setEnvironment(const QProcessEnvironment& environment);
+ void setEnvironment(QProcessEnvironment const& environment);
/// do the configure step
void configure();
/// generate the files
@@ -94,7 +94,7 @@ public slots:
/// open the project
void open();
/// set the property values
- void setProperties(const QCMakePropertyList&);
+ void setProperties(QCMakePropertyList const&);
/// interrupt the configure or generate process (if connecting, make a direct
/// connection)
void interrupt();
@@ -146,38 +146,38 @@ public:
signals:
/// signal when properties change (during read from disk or configure
/// process)
- void propertiesChanged(const QCMakePropertyList& vars);
+ void propertiesChanged(QCMakePropertyList const& vars);
/// signal when the generator changes
- void generatorChanged(const QString& gen);
+ void generatorChanged(QString const& gen);
/// signal when the source directory changes (binary directory already
/// containing a CMakeCache.txt file)
- void sourceDirChanged(const QString& dir);
+ void sourceDirChanged(QString const& dir);
/// signal when the binary directory changes
- void binaryDirChanged(const QString& dir);
+ void binaryDirChanged(QString const& dir);
/// signal when the preset list changes
- void presetsChanged(const QVector<QCMakePreset>& presets);
+ void presetsChanged(QVector<QCMakePreset> const& presets);
/// signal when the selected preset changes
- void presetChanged(const QString& name);
+ void presetChanged(QString const& name);
/// signal when there's an error reading the presets files
- void presetLoadError(const QString& dir, const QString& error);
+ void presetLoadError(QString const& dir, QString const& error);
/// signal when uninitialized warning changes
void warnUninitializedModeChanged(bool value);
/// signal for progress events
- void progressChanged(const QString& msg, float percent);
+ void progressChanged(QString const& msg, float percent);
/// signal when configure is done
void configureDone(int error);
/// signal when generate is done
void generateDone(int error);
/// signal when there is an output message
- void outputMessage(const QString& msg);
+ void outputMessage(QString const& msg);
/// signal when there is an error message
- void errorMessage(const QString& msg);
+ void errorMessage(QString const& msg);
/// signal when debug output changes
void debugOutputChanged(bool);
/// signal when the toolset changes
- void toolsetChanged(const QString& toolset);
+ void toolsetChanged(QString const& toolset);
/// signal when the platform changes
- void platformChanged(const QString& platform);
+ void platformChanged(QString const& platform);
/// signal when open is done
void openDone(bool successful);
/// signal when open is done
@@ -188,7 +188,7 @@ protected:
bool interruptCallback();
void progressCallback(std::string const& msg, float percent);
- void messageCallback(std::string const& msg, const char* title);
+ void messageCallback(std::string const& msg, char const* title);
void stdoutCallback(std::string const& msg);
void stderrCallback(std::string const& msg);
void setUpEnvironment() const;
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index e67e0c2..c9fbc26 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakeCacheView.h"
#include "QCMakeSizeType.h"
@@ -23,10 +23,10 @@ public:
}
protected:
- bool filterAcceptsRow(int row, const QModelIndex& p) const override
+ bool filterAcceptsRow(int row, QModelIndex const& p) const override
{
QStringList strs;
- const QAbstractItemModel* m = this->sourceModel();
+ QAbstractItemModel const* m = this->sourceModel();
QModelIndex idx = m->index(row, 0, p);
// if there are no children, get strings for column 0 and 1
@@ -80,9 +80,9 @@ public:
protected:
bool ShowAdvanced = false;
- bool filterAcceptsRow(int row, const QModelIndex& p) const override
+ bool filterAcceptsRow(int row, QModelIndex const& p) const override
{
- const QAbstractItemModel* m = this->sourceModel();
+ QAbstractItemModel const* m = this->sourceModel();
QModelIndex idx = m->index(row, 0, p);
// if there are no children
@@ -168,7 +168,7 @@ bool QCMakeCacheView::showAdvanced() const
return this->AdvancedFilter->showAdvanced();
}
-bool QCMakeCacheView::setSearchFilter(const QString& s)
+bool QCMakeCacheView::setSearchFilter(QString const& s)
{
return QtCMake::setSearchFilter(this->SearchFilter, s);
}
@@ -187,9 +187,9 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p)
QCMakeCacheModel::~QCMakeCacheModel() = default;
-static uint qHash(const QCMakeProperty& p)
+static uint qHash(QCMakeProperty const& p)
{
- return static_cast<uint>(qHash(p.Key));
+ return qHash(p.Key);
}
void QCMakeCacheModel::setShowNewProperties(bool f)
@@ -207,7 +207,7 @@ void QCMakeCacheModel::clear()
this->setHorizontalHeaderLabels(labels);
}
-void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
+void QCMakeCacheModel::setProperties(QCMakePropertyList const& props)
{
this->beginResetModel();
@@ -242,7 +242,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
bool b = this->blockSignals(true);
this->clear();
- this->NewPropertyCount = static_cast<int>(newProps.size());
+ this->NewPropertyCount = newProps.size();
if (View == FlatView) {
QCMakePropertyList newP = newProps.values();
@@ -363,8 +363,8 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
this->endResetModel();
}
-void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
- const QCMakeProperty& prop, bool isNew)
+void QCMakeCacheModel::setPropertyData(QModelIndex const& idx1,
+ QCMakeProperty const& prop, bool isNew)
{
QModelIndex idx2 = idx1.sibling(idx1.row(), 1);
@@ -398,7 +398,7 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
}
}
-void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1,
+void QCMakeCacheModel::getPropertyData(QModelIndex const& idx1,
QCMakeProperty& prop) const
{
QModelIndex idx2 = idx1.sibling(idx1.row(), 1);
@@ -418,7 +418,7 @@ void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1,
}
}
-QString QCMakeCacheModel::prefix(const QString& s)
+QString QCMakeCacheModel::prefix(QString const& s)
{
QString prefix = s.section('_', 0, 0);
if (prefix == s) {
@@ -428,7 +428,7 @@ QString QCMakeCacheModel::prefix(const QString& s)
}
void QCMakeCacheModel::breakProperties(
- const QSet<QCMakeProperty>& props, QMap<QString, QCMakePropertyList>& result)
+ QSet<QCMakeProperty> const& props, QMap<QString, QCMakePropertyList>& result)
{
QMap<QString, QCMakePropertyList> tmp;
// return a map of properties grouped by prefixes, and sorted
@@ -502,9 +502,9 @@ QCMakePropertyList QCMakeCacheModel::properties() const
}
bool QCMakeCacheModel::insertProperty(QCMakeProperty::PropertyType t,
- const QString& name,
- const QString& description,
- const QVariant& value, bool advanced)
+ QString const& name,
+ QString const& description,
+ QVariant const& value, bool advanced)
{
QCMakeProperty prop;
prop.Key = name;
@@ -535,7 +535,7 @@ int QCMakeCacheModel::newPropertyCount() const
return this->NewPropertyCount;
}
-Qt::ItemFlags QCMakeCacheModel::flags(const QModelIndex& idx) const
+Qt::ItemFlags QCMakeCacheModel::flags(QModelIndex const& idx) const
{
Qt::ItemFlags f = QStandardItemModel::flags(idx);
if (!this->EditEnabled) {
@@ -548,7 +548,7 @@ Qt::ItemFlags QCMakeCacheModel::flags(const QModelIndex& idx) const
return f;
}
-QModelIndex QCMakeCacheModel::buddy(const QModelIndex& idx) const
+QModelIndex QCMakeCacheModel::buddy(QModelIndex const& idx) const
{
if (!this->hasChildren(idx) &&
this->data(idx, TypeRole).toInt() != QCMakeProperty::BOOL) {
@@ -569,8 +569,8 @@ void QCMakeCacheModelDelegate::setFileDialogFlag(bool f)
}
QWidget* QCMakeCacheModelDelegate::createEditor(
- QWidget* p, const QStyleOptionViewItem& /*option*/,
- const QModelIndex& idx) const
+ QWidget* p, QStyleOptionViewItem const& /*option*/,
+ QModelIndex const& idx) const
{
QModelIndex var = idx.sibling(idx.row(), 0);
int type = var.data(QCMakeCacheModel::TypeRole).toInt();
@@ -606,8 +606,8 @@ QWidget* QCMakeCacheModelDelegate::createEditor(
bool QCMakeCacheModelDelegate::editorEvent(QEvent* e,
QAbstractItemModel* model,
- const QStyleOptionViewItem& option,
- const QModelIndex& index)
+ QStyleOptionViewItem const& option,
+ QModelIndex const& index)
{
Qt::ItemFlags flags = model->flags(index);
if (!(flags & Qt::ItemIsUserCheckable) ||
@@ -661,14 +661,14 @@ bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt)
void QCMakeCacheModelDelegate::setModelData(QWidget* editor,
QAbstractItemModel* model,
- const QModelIndex& index) const
+ QModelIndex const& index) const
{
QItemDelegate::setModelData(editor, model, index);
const_cast<QCMakeCacheModelDelegate*>(this)->recordChange(model, index);
}
-QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option,
- const QModelIndex& index) const
+QSize QCMakeCacheModelDelegate::sizeHint(QStyleOptionViewItem const& option,
+ QModelIndex const& index) const
{
QSize sz = QItemDelegate::sizeHint(option, index);
QStyle* style = QApplication::style();
@@ -700,7 +700,7 @@ void QCMakeCacheModelDelegate::clearChanges()
}
void QCMakeCacheModelDelegate::recordChange(QAbstractItemModel* model,
- const QModelIndex& index)
+ QModelIndex const& index)
{
QModelIndex idx = index;
QAbstractItemModel* mymodel = model;
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index 549cca2..6e28670 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMake.h"
@@ -30,7 +30,7 @@ public:
// set the search filter string. any property key or value not matching will
// be filtered out
- bool setSearchFilter(const QString&);
+ bool setSearchFilter(QString const&);
public slots:
// set whether to show advanced entries
@@ -74,7 +74,7 @@ public slots:
// to prefix. Any property that existed already and which is found in this
// list of properties to set will become an old property. All others will
// become new properties and be marked red.
- void setProperties(const QCMakePropertyList& props);
+ void setProperties(QCMakePropertyList const& props);
// set whether to show new properties in red
void setShowNewProperties(bool);
@@ -87,8 +87,8 @@ public slots:
// insert a new property at a row specifying all the information about the
// property
- bool insertProperty(QCMakeProperty::PropertyType t, const QString& name,
- const QString& description, const QVariant& value,
+ bool insertProperty(QCMakeProperty::PropertyType t, QString const& name,
+ QString const& description, QVariant const& value,
bool advanced);
public:
@@ -102,11 +102,11 @@ public:
int newPropertyCount() const;
// return flags (overloaded to modify flag based on EditEnabled flag)
- Qt::ItemFlags flags(const QModelIndex& index) const;
- QModelIndex buddy(const QModelIndex& idx) const;
+ Qt::ItemFlags flags(QModelIndex const& index) const;
+ QModelIndex buddy(QModelIndex const& idx) const;
// get the data in the model for this property
- void getPropertyData(const QModelIndex& idx1, QCMakeProperty& prop) const;
+ void getPropertyData(QModelIndex const& idx1, QCMakeProperty& prop) const;
// set the view type
void setViewType(ViewType t);
@@ -119,16 +119,16 @@ protected:
ViewType View;
// set the data in the model for this property
- void setPropertyData(const QModelIndex& idx1, const QCMakeProperty& p,
+ void setPropertyData(QModelIndex const& idx1, QCMakeProperty const& p,
bool isNew);
// breaks up he property list into groups
// where each group has the same prefix up to the first underscore
- static void breakProperties(const QSet<QCMakeProperty>& props,
+ static void breakProperties(QSet<QCMakeProperty> const& props,
QMap<QString, QCMakePropertyList>& result);
// gets the prefix of a string up to the first _
- static QString prefix(const QString& s);
+ static QString prefix(QString const& s);
};
/// Qt delegate class for interaction (or other customization)
@@ -139,16 +139,16 @@ class QCMakeCacheModelDelegate : public QItemDelegate
public:
QCMakeCacheModelDelegate(QObject* p);
/// create our own editors for cache properties
- QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
- const QModelIndex& index) const;
+ QWidget* createEditor(QWidget* parent, QStyleOptionViewItem const& option,
+ QModelIndex const& index) const;
bool editorEvent(QEvent* event, QAbstractItemModel* model,
- const QStyleOptionViewItem& option,
- const QModelIndex& index);
+ QStyleOptionViewItem const& option,
+ QModelIndex const& index);
bool eventFilter(QObject* object, QEvent* event);
void setModelData(QWidget* editor, QAbstractItemModel* model,
- const QModelIndex& index) const;
- QSize sizeHint(const QStyleOptionViewItem& option,
- const QModelIndex& index) const;
+ QModelIndex const& index) const;
+ QSize sizeHint(QStyleOptionViewItem const& option,
+ QModelIndex const& index) const;
QSet<QCMakeProperty> changes() const;
void clearChanges();
@@ -160,7 +160,7 @@ protected:
bool FileDialogFlag;
// record a change to an item in the model.
// this simply saves the item in the set of changes
- void recordChange(QAbstractItemModel* model, const QModelIndex& index);
+ void recordChange(QAbstractItemModel* model, QModelIndex const& index);
// properties changed by user via this delegate
QSet<QCMakeProperty> mChanges;
diff --git a/Source/QtDialog/QCMakePreset.cxx b/Source/QtDialog/QCMakePreset.cxx
index 176f532..5feb90b 100644
--- a/Source/QtDialog/QCMakePreset.cxx
+++ b/Source/QtDialog/QCMakePreset.cxx
@@ -1,8 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakePreset.h"
-bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs)
+bool operator==(QCMakePreset const& lhs, QCMakePreset const& rhs)
{
return lhs.name == rhs.name && lhs.displayName == rhs.displayName &&
lhs.description == rhs.description && lhs.generator == rhs.generator &&
@@ -11,12 +11,12 @@ bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs)
lhs.setToolset == rhs.setToolset && lhs.enabled == rhs.enabled;
}
-bool operator!=(const QCMakePreset& lhs, const QCMakePreset& rhs)
+bool operator!=(QCMakePreset const& lhs, QCMakePreset const& rhs)
{
return !(lhs == rhs);
}
-bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs)
+bool operator<(QCMakePreset const& lhs, QCMakePreset const& rhs)
{
return lhs.name < rhs.name ||
(lhs.name == rhs.name &&
@@ -37,17 +37,17 @@ bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs)
(lhs.enabled < rhs.enabled))))))))))))))));
}
-bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs)
+bool operator<=(QCMakePreset const& lhs, QCMakePreset const& rhs)
{
return rhs >= lhs;
}
-bool operator>(const QCMakePreset& lhs, const QCMakePreset& rhs)
+bool operator>(QCMakePreset const& lhs, QCMakePreset const& rhs)
{
return rhs < lhs;
}
-bool operator>=(const QCMakePreset& lhs, const QCMakePreset& rhs)
+bool operator>=(QCMakePreset const& lhs, QCMakePreset const& rhs)
{
return !(lhs < rhs);
}
diff --git a/Source/QtDialog/QCMakePreset.h b/Source/QtDialog/QCMakePreset.h
index 7387655..777aa4a 100644
--- a/Source/QtDialog/QCMakePreset.h
+++ b/Source/QtDialog/QCMakePreset.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <QString>
@@ -21,11 +21,11 @@ public:
bool enabled;
};
-bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs);
-bool operator!=(const QCMakePreset& lhs, const QCMakePreset& rhs);
-bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs);
-bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs);
-bool operator>(const QCMakePreset& lhs, const QCMakePreset& rhs);
-bool operator>=(const QCMakePreset& lhs, const QCMakePreset& rhs);
+bool operator==(QCMakePreset const& lhs, QCMakePreset const& rhs);
+bool operator!=(QCMakePreset const& lhs, QCMakePreset const& rhs);
+bool operator<(QCMakePreset const& lhs, QCMakePreset const& rhs);
+bool operator<=(QCMakePreset const& lhs, QCMakePreset const& rhs);
+bool operator>(QCMakePreset const& lhs, QCMakePreset const& rhs);
+bool operator>=(QCMakePreset const& lhs, QCMakePreset const& rhs);
Q_DECLARE_METATYPE(QCMakePreset)
diff --git a/Source/QtDialog/QCMakePresetComboBox.cxx b/Source/QtDialog/QCMakePresetComboBox.cxx
index efadb73..49d9e8e 100644
--- a/Source/QtDialog/QCMakePresetComboBox.cxx
+++ b/Source/QtDialog/QCMakePresetComboBox.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakePresetComboBox.h"
#include "QCMakePresetItemModel.h"
@@ -28,7 +28,7 @@ QCMakePresetComboBox::QCMakePresetComboBox(QWidget* parent)
});
}
-const QVector<QCMakePreset>& QCMakePresetComboBox::presets() const
+QVector<QCMakePreset> const& QCMakePresetComboBox::presets() const
{
return this->m_model->presets();
}
@@ -42,12 +42,12 @@ QString QCMakePresetComboBox::presetName() const
return QString{};
}
-void QCMakePresetComboBox::setPresets(const QVector<QCMakePreset>& presets)
+void QCMakePresetComboBox::setPresets(QVector<QCMakePreset> const& presets)
{
this->m_model->setPresets(presets);
}
-void QCMakePresetComboBox::setPresetName(const QString& name)
+void QCMakePresetComboBox::setPresetName(QString const& name)
{
this->setCurrentIndex(this->m_model->presetNameToRow(name));
if (this->signalsBlocked()) {
diff --git a/Source/QtDialog/QCMakePresetComboBox.h b/Source/QtDialog/QCMakePresetComboBox.h
index d1eeffe..47d8b8e 100644
--- a/Source/QtDialog/QCMakePresetComboBox.h
+++ b/Source/QtDialog/QCMakePresetComboBox.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMakePreset.h"
@@ -16,15 +16,15 @@ class QCMakePresetComboBox : public QComboBox
public:
QCMakePresetComboBox(QWidget* parent = nullptr);
- const QVector<QCMakePreset>& presets() const;
+ QVector<QCMakePreset> const& presets() const;
QString presetName() const;
public slots:
- void setPresets(const QVector<QCMakePreset>& presets);
- void setPresetName(const QString& name);
+ void setPresets(QVector<QCMakePreset> const& presets);
+ void setPresetName(QString const& name);
signals:
- void presetChanged(const QString& name);
+ void presetChanged(QString const& name);
private:
QCMakePresetItemModel* m_model;
diff --git a/Source/QtDialog/QCMakePresetItemModel.cxx b/Source/QtDialog/QCMakePresetItemModel.cxx
index 31a6000..dbc2ee8 100644
--- a/Source/QtDialog/QCMakePresetItemModel.cxx
+++ b/Source/QtDialog/QCMakePresetItemModel.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakePresetItemModel.h"
#include "QCMakeSizeType.h"
@@ -10,7 +10,7 @@ QCMakePresetItemModel::QCMakePresetItemModel(QObject* parent)
{
}
-QVariant QCMakePresetItemModel::data(const QModelIndex& index, int role) const
+QVariant QCMakePresetItemModel::data(QModelIndex const& index, int role) const
{
switch (role) {
case Qt::AccessibleDescriptionRole:
@@ -62,7 +62,7 @@ QVariant QCMakePresetItemModel::data(const QModelIndex& index, int role) const
}
}
-Qt::ItemFlags QCMakePresetItemModel::flags(const QModelIndex& index) const
+Qt::ItemFlags QCMakePresetItemModel::flags(QModelIndex const& index) const
{
Qt::ItemFlags flags =
Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
@@ -75,7 +75,7 @@ Qt::ItemFlags QCMakePresetItemModel::flags(const QModelIndex& index) const
return flags;
}
-int QCMakePresetItemModel::rowCount(const QModelIndex& parent) const
+int QCMakePresetItemModel::rowCount(QModelIndex const& parent) const
{
if (parent.isValid()) {
return 0;
@@ -83,10 +83,10 @@ int QCMakePresetItemModel::rowCount(const QModelIndex& parent) const
if (this->m_presets.empty()) {
return 1;
}
- return static_cast<int>(this->m_presets.size() + 2);
+ return this->m_presets.size() + 2;
}
-int QCMakePresetItemModel::columnCount(const QModelIndex& parent) const
+int QCMakePresetItemModel::columnCount(QModelIndex const& parent) const
{
if (parent.isValid()) {
return 0;
@@ -95,7 +95,7 @@ int QCMakePresetItemModel::columnCount(const QModelIndex& parent) const
}
QModelIndex QCMakePresetItemModel::index(int row, int column,
- const QModelIndex& parent) const
+ QModelIndex const& parent) const
{
if (parent.isValid() || column != 0 || row < 0 ||
row >= this->rowCount(QModelIndex{})) {
@@ -113,7 +113,7 @@ QModelIndex QCMakePresetItemModel::index(int row, int column,
return this->createIndex(row, column, static_cast<quintptr>(row));
}
-QModelIndex QCMakePresetItemModel::parent(const QModelIndex& /*index*/) const
+QModelIndex QCMakePresetItemModel::parent(QModelIndex const& /*index*/) const
{
return QModelIndex{};
}
@@ -130,7 +130,7 @@ void QCMakePresetItemModel::setPresets(QVector<QCMakePreset> const& presets)
this->endResetModel();
}
-int QCMakePresetItemModel::presetNameToRow(const QString& name) const
+int QCMakePresetItemModel::presetNameToRow(QString const& name) const
{
if (this->m_presets.empty()) {
return 0;
@@ -144,5 +144,5 @@ int QCMakePresetItemModel::presetNameToRow(const QString& name) const
index++;
}
- return static_cast<int>(this->m_presets.size() + 1);
+ return this->m_presets.size() + 1;
}
diff --git a/Source/QtDialog/QCMakePresetItemModel.h b/Source/QtDialog/QCMakePresetItemModel.h
index 79fba29..b565cbd 100644
--- a/Source/QtDialog/QCMakePresetItemModel.h
+++ b/Source/QtDialog/QCMakePresetItemModel.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cm/optional>
@@ -20,19 +20,19 @@ class QCMakePresetItemModel : public QAbstractItemModel
public:
QCMakePresetItemModel(QObject* parent = nullptr);
- QVariant data(const QModelIndex& index, int role) const override;
- Qt::ItemFlags flags(const QModelIndex& index) const override;
+ QVariant data(QModelIndex const& index, int role) const override;
+ Qt::ItemFlags flags(QModelIndex const& index) const override;
- int rowCount(const QModelIndex& parent = QModelIndex{}) const override;
- int columnCount(const QModelIndex& parent = QModelIndex{}) const override;
+ int rowCount(QModelIndex const& parent = QModelIndex{}) const override;
+ int columnCount(QModelIndex const& parent = QModelIndex{}) const override;
QModelIndex index(int row, int column,
- const QModelIndex& parent = QModelIndex{}) const override;
- QModelIndex parent(const QModelIndex& index) const override;
+ QModelIndex const& parent = QModelIndex{}) const override;
+ QModelIndex parent(QModelIndex const& index) const override;
QVector<QCMakePreset> const& presets() const;
- int presetNameToRow(const QString& name) const;
+ int presetNameToRow(QString const& name) const;
public slots:
void setPresets(QVector<QCMakePreset> const& presets);
diff --git a/Source/QtDialog/QCMakeSizeType.h b/Source/QtDialog/QCMakeSizeType.h
index b5cac17..cc59862 100644
--- a/Source/QtDialog/QCMakeSizeType.h
+++ b/Source/QtDialog/QCMakeSizeType.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <QtGlobal>
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index f1bb2f1..ef9a43d 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#define QT_DEPRECATED_WARNINGS_SINCE QT_VERSION_CHECK(5, 14, 0)
@@ -34,13 +34,13 @@ QCMakeFileEditor::QCMakeFileEditor(QWidget* p, QString var)
&QCMakeFileEditor::chooseFile);
}
-QCMakeFilePathEditor::QCMakeFilePathEditor(QWidget* p, const QString& var)
+QCMakeFilePathEditor::QCMakeFilePathEditor(QWidget* p, QString const& var)
: QCMakeFileEditor(p, var)
{
this->setCompleter(new QCMakeFileCompleter(this, false));
}
-QCMakePathEditor::QCMakePathEditor(QWidget* p, const QString& var)
+QCMakePathEditor::QCMakePathEditor(QWidget* p, QString const& var)
: QCMakeFileEditor(p, var)
{
this->setCompleter(new QCMakeFileCompleter(this, true));
@@ -156,13 +156,13 @@ QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs)
#endif
}
-QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const
+QString QCMakeFileCompleter::pathFromIndex(QModelIndex const& idx) const
{
return QDir::fromNativeSeparators(QCompleter::pathFromIndex(idx));
}
namespace QtCMake {
-bool setSearchFilter(QSortFilterProxyModel* model, const QString& searchString)
+bool setSearchFilter(QSortFilterProxyModel* model, QString const& searchString)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QRegularExpression const regex(searchString,
diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h
index 858a913..543a1c5 100644
--- a/Source/QtDialog/QCMakeWidgets.h
+++ b/Source/QtDialog/QCMakeWidgets.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,7 +35,7 @@ class QCMakePathEditor : public QCMakeFileEditor
{
Q_OBJECT
public:
- QCMakePathEditor(QWidget* p = nullptr, const QString& var = QString());
+ QCMakePathEditor(QWidget* p = nullptr, QString const& var = QString());
void chooseFile();
};
@@ -44,7 +44,7 @@ class QCMakeFilePathEditor : public QCMakeFileEditor
{
Q_OBJECT
public:
- QCMakeFilePathEditor(QWidget* p = nullptr, const QString& var = QString());
+ QCMakeFilePathEditor(QWidget* p = nullptr, QString const& var = QString());
void chooseFile();
};
@@ -54,7 +54,7 @@ class QCMakeFileCompleter : public QCompleter
Q_OBJECT
public:
QCMakeFileCompleter(QObject* o, bool dirs);
- virtual QString pathFromIndex(const QModelIndex& idx) const;
+ virtual QString pathFromIndex(QModelIndex const& idx) const;
};
// editor for strings
@@ -69,7 +69,7 @@ public:
{
this->addItems(strings);
}
- void setValue(const QString& v)
+ void setValue(QString const& v)
{
int i = this->findText(v);
if (i != -1) {
@@ -80,7 +80,7 @@ public:
namespace QtCMake {
bool setSearchFilter(QSortFilterProxyModel* model,
- const QString& searchString);
+ QString const& searchString);
void setSearchFilterColor(QLineEdit* edit, bool valid);
}
diff --git a/Source/QtDialog/QtDialogCPack.cmake.in b/Source/QtDialog/QtDialogCPack.cmake.in
index 7ae8605..a94ebe0 100644
--- a/Source/QtDialog/QtDialogCPack.cmake.in
+++ b/Source/QtDialog/QtDialogCPack.cmake.in
@@ -11,5 +11,3 @@ if(CMAKE_PACKAGE_QTGUI)
set(CPACK_SET_DESTDIR TRUE)
endif()
endif()
-
-
diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx
index 6194940..9065f66 100644
--- a/Source/QtDialog/RegexExplorer.cxx
+++ b/Source/QtDialog/RegexExplorer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "RegexExplorer.h"
RegexExplorer::RegexExplorer(QWidget* p)
@@ -24,7 +24,7 @@ void RegexExplorer::setStatusColor(QWidget* widget, bool successful)
widget->setPalette(palette);
}
-void RegexExplorer::on_regularExpression_textChanged(const QString& text)
+void RegexExplorer::on_regularExpression_textChanged(QString const& text)
{
#ifdef QT_NO_STL
m_regex = text.toAscii().constData();
@@ -67,7 +67,7 @@ void RegexExplorer::on_inputText_textChanged()
std::string matchingText;
if (matchAll->isChecked()) {
- const char* p = m_text.c_str();
+ char const* p = m_text.c_str();
while (m_regexParser.find(p)) {
std::string::size_type l = m_regexParser.start();
std::string::size_type r = m_regexParser.end();
@@ -133,7 +133,7 @@ void RegexExplorer::clearMatch()
bool RegexExplorer::stripEscapes(std::string& source)
{
- const char* in = source.c_str();
+ char const* in = source.c_str();
std::string result;
result.reserve(source.size());
diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h
index 9a42320..dc17d31 100644
--- a/Source/QtDialog/RegexExplorer.h
+++ b/Source/QtDialog/RegexExplorer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -22,7 +22,7 @@ public:
RegexExplorer(QWidget* p);
private slots:
- void on_regularExpression_textChanged(const QString& text);
+ void on_regularExpression_textChanged(QString const& text);
void on_inputText_textChanged();
void on_matchNumber_currentIndexChanged(int index);
void on_matchAll_toggled(bool checked);
diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx
index 1fcf2b1..8cf4077 100644
--- a/Source/QtDialog/WarningMessagesDialog.cxx
+++ b/Source/QtDialog/WarningMessagesDialog.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "WarningMessagesDialog.h"
WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance)
diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h
index bb01704..0cde8ff 100644
--- a/Source/QtDialog/WarningMessagesDialog.h
+++ b/Source/QtDialog/WarningMessagesDialog.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMake.h"
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index abf3b0b..587e2c7 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/*-------------------------------------------------------------------------
Portions of this source have been derived from the 'bindexplib' tool
provided by the CERN ROOT Data Analysis Framework project (root.cern.ch).
@@ -164,10 +164,10 @@ PIMAGE_SECTION_HEADER GetSectionHeaderOffset(
/*
+ * Utility func, strstr with size
+ */
-const char* StrNStr(const char* start, const char* find, size_t& size)
+char const* StrNStr(char const* start, char const* find, size_t& size)
{
size_t len;
- const char* hint;
+ char const* hint;
if (!start || !find || !size) {
size = 0;
@@ -175,7 +175,7 @@ const char* StrNStr(const char* start, const char* find, size_t& size)
}
len = strlen(find);
- while ((hint = (const char*)memchr(start, find[0], size - len + 1))) {
+ while ((hint = (char const*)memchr(start, find[0], size - len + 1))) {
size -= (hint - start);
if (!strncmp(hint, find, len))
return hint;
@@ -254,7 +254,7 @@ public:
*/
if (pSymbolTable->N.Name.Short != 0) {
symbol.clear();
- symbol.insert(0, (const char*)pSymbolTable->N.ShortName, 8);
+ symbol.insert(0, (char const*)pSymbolTable->N.ShortName, 8);
} else {
symbol = stringTable + pSymbolTable->N.Name.Long;
}
@@ -279,9 +279,9 @@ public:
// deleting destructor"
// if scalarPrefix and vectorPrefix are not found then print
// the symbol
- const char* scalarPrefix = "??_G";
- const char* vectorPrefix = "??_E";
- const char* vftablePrefix = "??_7";
+ char const* scalarPrefix = "??_G";
+ char const* vectorPrefix = "??_E";
+ char const* vftablePrefix = "??_7";
// The original code had a check for
// symbol.find("real@") == std::string::npos)
// but this disallows member functions with the name "real".
@@ -346,7 +346,7 @@ private:
};
#endif
-static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
+static bool DumpFileWithLlvmNm(std::string const& nmPath, char const* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
{
@@ -386,7 +386,7 @@ static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
line.c_str());
return false;
}
- const char sym_type = line[sym_end + 1];
+ char const sym_type = line[sym_end + 1];
line.resize(sym_end);
switch (sym_type) {
case 'D':
@@ -401,7 +401,7 @@ static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
return true;
}
-static bool DumpFile(std::string const& nmPath, const char* filename,
+static bool DumpFile(std::string const& nmPath, char const* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
{
@@ -501,12 +501,12 @@ static bool DumpFile(std::string const& nmPath, const char* filename,
#endif
}
-bool bindexplib::AddObjectFile(const char* filename)
+bool bindexplib::AddObjectFile(char const* filename)
{
return DumpFile(this->NmPath, filename, this->Symbols, this->DataSymbols);
}
-bool bindexplib::AddDefinitionFile(const char* filename)
+bool bindexplib::AddDefinitionFile(char const* filename)
{
cmsys::ifstream infile(filename);
if (!infile) {
diff --git a/Source/bindexplib.h b/Source/bindexplib.h
index c5d81c7..f98ba01 100644
--- a/Source/bindexplib.h
+++ b/Source/bindexplib.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,8 +12,8 @@ class bindexplib
{
public:
bindexplib() { NmPath = "nm"; }
- bool AddDefinitionFile(const char* filename);
- bool AddObjectFile(const char* filename);
+ bool AddDefinitionFile(char const* filename);
+ bool AddObjectFile(char const* filename);
void WriteFile(FILE* file);
void SetNmPath(std::string const& nm);
diff --git a/Source/cmAddCompileDefinitionsCommand.cxx b/Source/cmAddCompileDefinitionsCommand.cxx
index b00a4a7..cc0c28a 100644
--- a/Source/cmAddCompileDefinitionsCommand.cxx
+++ b/Source/cmAddCompileDefinitionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddCompileDefinitionsCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmAddCompileDefinitionsCommand.h b/Source/cmAddCompileDefinitionsCommand.h
index 29282d6..def0b2e 100644
--- a/Source/cmAddCompileDefinitionsCommand.h
+++ b/Source/cmAddCompileDefinitionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
index 8ccb512..9c7be38 100644
--- a/Source/cmAddCompileOptionsCommand.cxx
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddCompileOptionsCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 076a427..9380432 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 7311de8..60ed118 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -1,11 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddCustomCommandCommand.h"
#include <algorithm>
#include <iterator>
#include <set>
-#include <sstream>
#include <unordered_set>
#include <utility>
@@ -46,7 +45,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
std::string job_pool;
std::string job_server_aware;
std::string comment_buffer;
- const char* comment = nullptr;
+ char const* comment = nullptr;
std::vector<std::string> depends;
std::vector<std::string> outputs;
std::vector<std::string> output;
@@ -590,46 +589,10 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
cc->SetImplicitDepends(implicit_depends);
mf.AddCustomCommandToOutput(std::move(cc));
} else {
- if (!byproducts.empty()) {
- status.SetError(
- "BYPRODUCTS may not be specified with SOURCE signatures");
- return false;
- }
-
- if (uses_terminal) {
- status.SetError("USES_TERMINAL may not be used with SOURCE signatures");
- return false;
- }
-
- bool issueMessage = true;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (mf.GetPolicyStatus(cmPolicies::CMP0050)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n";
- break;
- case cmPolicies::OLD:
- issueMessage = false;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- messageType = MessageType::FATAL_ERROR;
- break;
- }
-
- if (issueMessage) {
- e << "The SOURCE signatures of add_custom_command are no longer "
- "supported.";
- mf.IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
-
- // Use the old-style mode for backward compatibility.
- mf.AddCustomCommandOldStyle(target, outputs, depends, source, commandLines,
- comment);
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The SOURCE signatures of add_custom_command are no longer supported.");
+ return false;
}
return true;
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 383d116..54b62d0 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 711eaa5..92bc25e 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddCustomTargetCommand.h"
#include <utility>
@@ -13,7 +13,6 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -52,7 +51,7 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
bool uses_terminal = false;
bool command_expand_lists = false;
std::string comment_buffer;
- const char* comment = nullptr;
+ char const* comment = nullptr;
std::vector<std::string> sources;
std::string job_pool;
std::string job_server_aware;
@@ -163,23 +162,11 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
}
}
- std::string::size_type pos = targetName.find_first_of("#<>");
- if (pos != std::string::npos) {
- status.SetError(cmStrCat("called with target name containing a \"",
- targetName[pos],
- "\". This character is not allowed."));
- return false;
- }
-
- // Some requirements on custom target names already exist
- // and have been checked at this point.
- // The following restrictions overlap but depend on policy CMP0037.
bool nameOk = cmGeneratorExpression::IsValidTargetName(targetName) &&
- !cmGlobalGenerator::IsReservedTarget(targetName);
- if (nameOk) {
- nameOk = targetName.find(':') == std::string::npos;
- }
- if (!nameOk && !mf.CheckCMP0037(targetName, cmStateEnums::UTILITY)) {
+ !cmGlobalGenerator::IsReservedTarget(targetName) &&
+ targetName.find(':') == std::string::npos;
+ if (!nameOk) {
+ mf.IssueInvalidTargetNameError(targetName);
return false;
}
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index 3b784cb..88e4a40 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx
index 0b10aee..4ab82aa 100644
--- a/Source/cmAddDefinitionsCommand.cxx
+++ b/Source/cmAddDefinitionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddDefinitionsCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 45b4554..4d28e03 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index aa04018..cf938f7 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddDependenciesCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index a767550..b4e4933 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 16a8965..13df1e3 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddExecutableCommand.h"
#include "cmExecutionStatus.h"
@@ -64,7 +64,8 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
if (nameOk && !importTarget && !isAlias) {
nameOk = exename.find(':') == std::string::npos;
}
- if (!nameOk && !mf.CheckCMP0037(exename, cmStateEnums::EXECUTABLE)) {
+ if (!nameOk) {
+ mf.IssueInvalidTargetNameError(exename);
return false;
}
@@ -107,7 +108,8 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
"\" is itself an ALIAS."));
return false;
}
- cmTarget* aliasedTarget = mf.FindTargetToUse(aliasedName, true);
+ cmTarget* aliasedTarget =
+ mf.FindTargetToUse(aliasedName, { cmStateEnums::TargetDomain::NATIVE });
if (!aliasedTarget) {
status.SetError(cmStrCat("cannot create ALIAS target \"", exename,
"\" because target \"", aliasedName,
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 032c14d..c4eae6a 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 9113dfd..67ec3b9 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddLibraryCommand.h"
#include "cmExecutionStatus.h"
@@ -150,7 +150,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
if (nameOk && !importTarget && !isAlias) {
nameOk = libName.find(':') == std::string::npos;
}
- if (!nameOk && !mf.CheckCMP0037(libName, type)) {
+ if (!nameOk) {
+ mf.IssueInvalidTargetNameError(libName);
return false;
}
@@ -189,7 +190,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
"\" is itself an ALIAS."));
return false;
}
- cmTarget* aliasedTarget = mf.FindTargetToUse(aliasedName, true);
+ cmTarget* aliasedTarget =
+ mf.FindTargetToUse(aliasedName, { cmStateEnums::TargetDomain::NATIVE });
if (!aliasedTarget) {
status.SetError(cmStrCat("cannot create ALIAS target \"", libName,
"\" because target \"", aliasedName,
@@ -242,8 +244,6 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
type = cmStateEnums::STATIC_LIBRARY;
break;
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
mf.IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat(
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index a4a0ea0..326c879 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddLinkOptionsCommand.cxx b/Source/cmAddLinkOptionsCommand.cxx
index 7ed31bd..33ad9ed 100644
--- a/Source/cmAddLinkOptionsCommand.cxx
+++ b/Source/cmAddLinkOptionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddLinkOptionsCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h
index 5c9d5e4..5ed877a 100644
--- a/Source/cmAddLinkOptionsCommand.h
+++ b/Source/cmAddLinkOptionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 6a2ab0b..0691182 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddSubDirectoryCommand.h"
#include <cstring>
@@ -88,8 +88,8 @@ bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
// Remove the CurrentDirectory from the srcPath and replace it
// with the CurrentOutputDirectory.
- const std::string& src = mf.GetCurrentSourceDirectory();
- const std::string& bin = mf.GetCurrentBinaryDirectory();
+ std::string const& src = mf.GetCurrentSourceDirectory();
+ std::string const& bin = mf.GetCurrentBinaryDirectory();
size_t srcLen = src.length();
size_t binLen = bin.length();
if (srcLen > 0 && src.back() == '/') {
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index ece3b27..4af3e04 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index ff17e87..28b4b53 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAddTestCommand.h"
#include <algorithm>
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 8cba2b1..10c305e 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx
index 591199b..5be4758 100644
--- a/Source/cmAffinity.cxx
+++ b/Source/cmAffinity.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAffinity.h"
#include <cm3p/uv.h>
@@ -8,7 +8,7 @@
# ifdef _WIN32
# define CM_HAVE_CPU_AFFINITY
# include <windows.h>
-# elif defined(__linux__) || defined(__FreeBSD__)
+# elif (defined(__linux__) && !defined(__ANDROID__)) || defined(__FreeBSD__)
# define CM_HAVE_CPU_AFFINITY
# include <pthread.h>
# include <sched.h>
diff --git a/Source/cmAffinity.h b/Source/cmAffinity.h
index 3775bae..e496d1e 100644
--- a/Source/cmAffinity.h
+++ b/Source/cmAffinity.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 2c3ee9b..c76788e 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,7 +19,7 @@
template <typename FwdIt>
FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last)
{
- const typename std::iterator_traits<FwdIt>::difference_type dist =
+ typename std::iterator_traits<FwdIt>::difference_type const dist =
std::distance(middle, last);
std::rotate(first, middle, last);
std::advance(first, dist);
@@ -75,7 +75,7 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
{
typename InputRange::const_iterator remIt = rem.begin();
typename InputRange::const_iterator remEnd = rem.end();
- const auto rangeEnd = r.end();
+ auto const rangeEnd = r.end();
if (remIt == remEnd) {
return rangeEnd;
}
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index e992b4b..0828dcb 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmArchiveWrite.h"
#include <cstdlib>
@@ -32,12 +32,12 @@
static std::string cm_archive_error_string(struct archive* a)
{
- const char* e = archive_error_string(a);
+ char const* e = archive_error_string(a);
return e ? e : "unknown error";
}
static void cm_archive_entry_copy_pathname(struct archive_entry* e,
- const std::string& dest)
+ std::string const& dest)
{
#if cmsys_STL_HAS_WSTRING
archive_entry_copy_pathname_w(e, cmsys::Encoding::ToWide(dest).c_str());
@@ -47,7 +47,7 @@ static void cm_archive_entry_copy_pathname(struct archive_entry* e,
}
static void cm_archive_entry_copy_sourcepath(struct archive_entry* e,
- const std::string& file)
+ std::string const& file)
{
#if cmsys_STL_HAS_WSTRING
archive_entry_copy_sourcepath_w(e, cmsys::Encoding::ToWide(file).c_str());
@@ -66,8 +66,8 @@ public:
{
}
~Entry() { archive_entry_free(this->Object); }
- Entry(const Entry&) = delete;
- Entry& operator=(const Entry&) = delete;
+ Entry(Entry const&) = delete;
+ Entry& operator=(Entry const&) = delete;
operator struct archive_entry *() { return this->Object; }
};
@@ -75,10 +75,10 @@ struct cmArchiveWrite::Callback
{
// archive_write_callback
static __LA_SSIZE_T Write(struct archive* /*unused*/, void* cd,
- const void* b, size_t n)
+ void const* b, size_t n)
{
cmArchiveWrite* self = static_cast<cmArchiveWrite*>(cd);
- if (self->Stream.write(static_cast<const char*>(b),
+ if (self->Stream.write(static_cast<char const*>(b),
static_cast<std::streamsize>(n))) {
return static_cast<__LA_SSIZE_T>(n);
}
@@ -278,7 +278,7 @@ cmArchiveWrite::~cmArchiveWrite()
archive_write_free(this->Archive);
}
-bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix,
+bool cmArchiveWrite::Add(std::string path, size_t skip, char const* prefix,
bool recursive)
{
if (!path.empty() && path.back() == '/') {
@@ -288,7 +288,7 @@ bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix,
return this->Okay();
}
-bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix,
+bool cmArchiveWrite::AddPath(char const* path, size_t skip, char const* prefix,
bool recursive)
{
if (strcmp(path, ".") != 0 ||
@@ -310,7 +310,7 @@ bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix,
std::string::size_type end = next.size();
unsigned long n = d.GetNumberOfFiles();
for (unsigned long i = 0; i < n; ++i) {
- const char* file = d.GetFile(i);
+ char const* file = d.GetFile(i);
if (strcmp(file, ".") != 0 && strcmp(file, "..") != 0) {
next.erase(end);
next += file;
@@ -323,7 +323,7 @@ bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix,
return true;
}
-bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
+bool cmArchiveWrite::AddFile(char const* file, size_t skip, char const* prefix)
{
this->Error = "";
// Skip the file if we have no name for it. This may happen on a
@@ -331,7 +331,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
if (skip >= strlen(file)) {
return true;
}
- const char* out = file + skip;
+ char const* out = file + skip;
cmLocaleRAII localeRAII;
static_cast<void>(localeRAII);
@@ -425,7 +425,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
return true;
}
-bool cmArchiveWrite::AddData(const char* file, size_t size)
+bool cmArchiveWrite::AddData(char const* file, size_t size)
{
cmsys::ifstream fin(file, std::ios::in | std::ios::binary);
if (!fin) {
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index b9fa3d7..3937e49 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -59,8 +59,8 @@ public:
~cmArchiveWrite();
- cmArchiveWrite(const cmArchiveWrite&) = delete;
- cmArchiveWrite& operator=(const cmArchiveWrite&) = delete;
+ cmArchiveWrite(cmArchiveWrite const&) = delete;
+ cmArchiveWrite& operator=(cmArchiveWrite const&) = delete;
bool Open();
@@ -72,7 +72,7 @@ public:
* skip. The remaining part of the input path is appended to the
* "prefix" value to construct the final name in the archive.
*/
- bool Add(std::string path, size_t skip = 0, const char* prefix = nullptr,
+ bool Add(std::string path, size_t skip = 0, char const* prefix = nullptr,
bool recursive = true);
/** Returns true if there has been no error. */
@@ -127,7 +127,7 @@ public:
}
//! Sets UNAME and GNAME to be used in the tar file
- void SetUNAMEAndGNAME(const std::string& uname_, const std::string& gname_)
+ void SetUNAMEAndGNAME(std::string const& uname_, std::string const& gname_)
{
this->Uname = uname_;
this->Gname = gname_;
@@ -143,10 +143,10 @@ public:
private:
bool Okay() const { return this->Error.empty(); }
- bool AddPath(const char* path, size_t skip, const char* prefix,
+ bool AddPath(char const* path, size_t skip, char const* prefix,
bool recursive = true);
- bool AddFile(const char* file, size_t skip, const char* prefix);
- bool AddData(const char* file, size_t size);
+ bool AddFile(char const* file, size_t skip, char const* prefix);
+ bool AddData(char const* file, size_t size);
struct Callback;
friend struct Callback;
diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx
index 22dd308..5c4fc0d 100644
--- a/Source/cmArgumentParser.cxx
+++ b/Source/cmArgumentParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmArgumentParser.h"
#include <algorithm>
diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h
index c479b27..e8cd78e 100644
--- a/Source/cmArgumentParser.h
+++ b/Source/cmArgumentParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmArgumentParserTypes.h b/Source/cmArgumentParserTypes.h
index 3e0fae4..b12cfc0 100644
--- a/Source/cmArgumentParserTypes.h
+++ b/Source/cmArgumentParserTypes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,6 +21,13 @@ struct Maybe<std::string> : public std::string
template <typename T>
struct MaybeEmpty;
+# if defined(__LCC__) && (__EDG_VERSION__ >= 603)
+template <>
+struct MaybeEmpty<std::vector<std::string>> : public std::vector<std::string>
+{
+ using std::vector<std::string>::vector;
+};
+# endif
template <typename T>
struct MaybeEmpty<std::vector<T>> : public std::vector<T>
{
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index b2e3cad..d571a1a 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmAuxSourceDirectoryCommand.h"
#include <algorithm>
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index 29ee429..ed9af68 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx
index e8e46aa..e7b5fb8 100644
--- a/Source/cmBase32.cxx
+++ b/Source/cmBase32.cxx
@@ -1,10 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBase32.h"
// -- Static functions
-static const unsigned char Base32EncodeTable[33] =
+static unsigned char const Base32EncodeTable[33] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
inline unsigned char Base32EncodeChar(int schar)
@@ -12,7 +12,7 @@ inline unsigned char Base32EncodeChar(int schar)
return Base32EncodeTable[schar];
}
-static void Base32Encode5(const unsigned char src[5], char dst[8])
+static void Base32Encode5(unsigned char const src[5], char dst[8])
{
// [0]:5 bits
dst[0] = Base32EncodeChar((src[0] >> 3) & 0x1F);
@@ -36,16 +36,16 @@ static void Base32Encode5(const unsigned char src[5], char dst[8])
cmBase32Encoder::cmBase32Encoder() = default;
-std::string cmBase32Encoder::encodeString(const unsigned char* input,
+std::string cmBase32Encoder::encodeString(unsigned char const* input,
size_t len, bool padding)
{
std::string res;
- static const size_t blockSize = 5;
- static const size_t bufferSize = 8;
+ static size_t const blockSize = 5;
+ static size_t const bufferSize = 8;
char buffer[bufferSize];
- const unsigned char* end = input + len;
+ unsigned char const* end = input + len;
while ((input + blockSize) <= end) {
Base32Encode5(input, buffer);
res.append(buffer, bufferSize);
@@ -55,15 +55,15 @@ std::string cmBase32Encoder::encodeString(const unsigned char* input,
size_t remain = static_cast<size_t>(end - input);
if (remain != 0) {
// Temporary source buffer filled up with 0s
- unsigned char extended[blockSize];
+ unsigned char padded[blockSize];
for (size_t ii = 0; ii != remain; ++ii) {
- extended[ii] = input[ii];
+ padded[ii] = input[ii];
}
for (size_t ii = remain; ii != blockSize; ++ii) {
- extended[ii] = 0;
+ padded[ii] = 0;
}
- Base32Encode5(extended, buffer);
+ Base32Encode5(padded, buffer);
size_t numPad(0);
switch (remain) {
case 1:
diff --git a/Source/cmBase32.h b/Source/cmBase32.h
index d70a062..4964fe2 100644
--- a/Source/cmBase32.h
+++ b/Source/cmBase32.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -15,7 +15,7 @@
class cmBase32Encoder
{
public:
- static const char paddingChar = '=';
+ static char const paddingChar = '=';
cmBase32Encoder();
~cmBase32Encoder() = default;
@@ -24,6 +24,6 @@ public:
// @arg input Input data pointer
// @arg len Input data size
// @arg padding Flag to append "=" on demand
- std::string encodeString(const unsigned char* input, size_t len,
+ std::string encodeString(unsigned char const* input, size_t len,
bool padding = true);
};
diff --git a/Source/cmBinUtilsLinker.cxx b/Source/cmBinUtilsLinker.cxx
index a9f4d91..4cce608 100644
--- a/Source/cmBinUtilsLinker.cxx
+++ b/Source/cmBinUtilsLinker.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsLinker.h"
@@ -10,7 +10,7 @@ cmBinUtilsLinker::cmBinUtilsLinker(cmRuntimeDependencyArchive* archive)
{
}
-void cmBinUtilsLinker::SetError(const std::string& e)
+void cmBinUtilsLinker::SetError(std::string const& e)
{
this->Archive->SetError(e);
}
diff --git a/Source/cmBinUtilsLinker.h b/Source/cmBinUtilsLinker.h
index 5330070..5b41309 100644
--- a/Source/cmBinUtilsLinker.h
+++ b/Source/cmBinUtilsLinker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -23,5 +23,5 @@ public:
protected:
cmRuntimeDependencyArchive* Archive;
- void SetError(const std::string& e);
+ void SetError(std::string const& e);
};
diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
index abd1209..0b924df 100644
--- a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h"
@@ -13,7 +13,7 @@ cmBinUtilsLinuxELFGetRuntimeDependenciesTool::
}
void cmBinUtilsLinuxELFGetRuntimeDependenciesTool::SetError(
- const std::string& error)
+ std::string const& error)
{
this->Archive->SetError(error);
}
diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
index 15216a4..fa7bf2c 100644
--- a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -23,5 +23,5 @@ public:
protected:
cmRuntimeDependencyArchive* Archive;
- void SetError(const std::string& e);
+ void SetError(std::string const& e);
};
diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx
index ca40726..cf338a9 100644
--- a/Source/cmBinUtilsLinuxELFLinker.cxx
+++ b/Source/cmBinUtilsLinuxELFLinker.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsLinuxELFLinker.h"
@@ -22,12 +22,12 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-static std::string ReplaceOrigin(const std::string& rpath,
- const std::string& origin)
+static std::string ReplaceOrigin(std::string const& rpath,
+ std::string const& origin)
{
- static const cmsys::RegularExpression originRegex(
+ static cmsys::RegularExpression const originRegex(
"(\\$ORIGIN)([^a-zA-Z0-9_]|$)");
- static const cmsys::RegularExpression originCurlyRegex("\\${ORIGIN}");
+ static cmsys::RegularExpression const originCurlyRegex("\\${ORIGIN}");
cmsys::RegularExpressionMatch match;
if (originRegex.find(rpath.c_str(), match)) {
@@ -186,7 +186,7 @@ bool cmBinUtilsLinuxELFLinker::ScanDependencies(std::string const& mainFile)
}
namespace {
-bool FileHasArchitecture(const char* filename, std::uint16_t machine)
+bool FileHasArchitecture(char const* filename, std::uint16_t machine)
{
cmELF elf(filename);
if (!elf) {
diff --git a/Source/cmBinUtilsLinuxELFLinker.h b/Source/cmBinUtilsLinuxELFLinker.h
index 0b0d8b5..1829c0b 100644
--- a/Source/cmBinUtilsLinuxELFLinker.h
+++ b/Source/cmBinUtilsLinuxELFLinker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
index 8043f82..8c3dd49 100644
--- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h"
@@ -44,9 +44,9 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo(
}
std::string line;
- static const cmsys::RegularExpression neededRegex("^ *NEEDED *([^\n]*)$");
- static const cmsys::RegularExpression rpathRegex("^ *RPATH *([^\n]*)$");
- static const cmsys::RegularExpression runpathRegex("^ *RUNPATH *([^\n]*)$");
+ static cmsys::RegularExpression const neededRegex("^ *NEEDED *([^\n]*)$");
+ static cmsys::RegularExpression const rpathRegex("^ *RPATH *([^\n]*)$");
+ static cmsys::RegularExpression const runpathRegex("^ *RUNPATH *([^\n]*)$");
cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
while (std::getline(output, line)) {
cmsys::RegularExpressionMatch match;
diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
index def1dd0..6719708 100644
--- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
index a296a47..4b9780e 100644
--- a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h"
@@ -13,7 +13,7 @@ cmBinUtilsMacOSMachOGetRuntimeDependenciesTool::
}
void cmBinUtilsMacOSMachOGetRuntimeDependenciesTool::SetError(
- const std::string& error)
+ std::string const& error)
{
this->Archive->SetError(error);
}
diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
index 60d34aa..b36ab52 100644
--- a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -22,5 +22,5 @@ public:
protected:
cmRuntimeDependencyArchive* Archive;
- void SetError(const std::string& error);
+ void SetError(std::string const& error);
};
diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx
index 082f348..9867318 100644
--- a/Source/cmBinUtilsMacOSMachOLinker.cxx
+++ b/Source/cmBinUtilsMacOSMachOLinker.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsMacOSMachOLinker.h"
@@ -54,7 +54,7 @@ bool cmBinUtilsMacOSMachOLinker::Prepare()
}
auto cmBinUtilsMacOSMachOLinker::GetFileInfo(std::string const& file)
- -> const FileInfo*
+ -> FileInfo const*
{
// Memoize processed rpaths and library dependencies to reduce the number
// of calls to otool, especially in the case of heavily recursive libraries
@@ -86,7 +86,7 @@ bool cmBinUtilsMacOSMachOLinker::ScanDependencies(
if (!executableFile.empty()) {
executablePath = cmSystemTools::GetFilenamePath(executableFile);
}
- const FileInfo* file_info = this->GetFileInfo(file);
+ FileInfo const* file_info = this->GetFileInfo(file);
if (!file_info) {
return false;
}
@@ -119,7 +119,7 @@ bool cmBinUtilsMacOSMachOLinker::GetFileDependencies(
!IsMissingSystemDylib(path)) {
auto filename = cmSystemTools::GetFilenameName(path);
bool unique;
- const FileInfo* dep_file_info = this->GetFileInfo(path);
+ FileInfo const* dep_file_info = this->GetFileInfo(path);
if (!dep_file_info) {
return false;
}
diff --git a/Source/cmBinUtilsMacOSMachOLinker.h b/Source/cmBinUtilsMacOSMachOLinker.h
index ac1177b..c350dfe 100644
--- a/Source/cmBinUtilsMacOSMachOLinker.h
+++ b/Source/cmBinUtilsMacOSMachOLinker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -34,7 +34,7 @@ private:
std::unique_ptr<cmBinUtilsMacOSMachOGetRuntimeDependenciesTool> Tool;
std::unordered_map<std::string, FileInfo> ScannedFileInfo;
- const FileInfo* GetFileInfo(std::string const& file);
+ FileInfo const* GetFileInfo(std::string const& file);
bool ScanDependencies(std::string const& file,
std::vector<std::string> const& libs,
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
index 4c35841..d2afe15 100644
--- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h"
@@ -43,12 +43,12 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
}
std::string line;
- static const cmsys::RegularExpression rpathRegex("^ *cmd LC_RPATH$");
- static const cmsys::RegularExpression loadDylibRegex(
+ static cmsys::RegularExpression const rpathRegex("^ *cmd LC_RPATH$");
+ static cmsys::RegularExpression const loadDylibRegex(
"^ *cmd LC_LOAD(_WEAK)?_DYLIB$");
- static const cmsys::RegularExpression pathRegex(
+ static cmsys::RegularExpression const pathRegex(
"^ *path (.*) \\(offset [0-9]+\\)$");
- static const cmsys::RegularExpression nameRegex(
+ static cmsys::RegularExpression const nameRegex(
"^ *name (.*) \\(offset [0-9]+\\)$");
cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
while (std::getline(output, line)) {
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
index 9d17450..faab98e 100644
--- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
index cd21140..8e4a9aa 100644
--- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h"
@@ -19,7 +19,7 @@ cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::
}
bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo(
- const std::string& file, std::vector<std::string>& needed)
+ std::string const& file, std::vector<std::string>& needed)
{
cmUVProcessChainBuilder builder;
builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT);
@@ -42,7 +42,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo(
}
std::string line;
- static const cmsys::RegularExpression regex(
+ static cmsys::RegularExpression const regex(
"^ ([^\n]*\\.[Dd][Ll][Ll])\r$");
cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
while (std::getline(output, line)) {
diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
index 8609479..552db10 100644
--- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -17,6 +17,6 @@ public:
cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool(
cmRuntimeDependencyArchive* archive);
- bool GetFileInfo(const std::string& file,
+ bool GetFileInfo(std::string const& file,
std::vector<std::string>& needed) override;
};
diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
index 468a40c..aa9c066 100644
--- a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
@@ -13,7 +13,7 @@ cmBinUtilsWindowsPEGetRuntimeDependenciesTool::
}
void cmBinUtilsWindowsPEGetRuntimeDependenciesTool::SetError(
- const std::string& error)
+ std::string const& error)
{
this->Archive->SetError(error);
}
diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
index da71aaa..3b37f53 100644
--- a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -15,11 +15,11 @@ public:
cmRuntimeDependencyArchive* archive);
virtual ~cmBinUtilsWindowsPEGetRuntimeDependenciesTool() = default;
- virtual bool GetFileInfo(const std::string& file,
+ virtual bool GetFileInfo(std::string const& file,
std::vector<std::string>& needed) = 0;
protected:
cmRuntimeDependencyArchive* Archive;
- void SetError(const std::string& error);
+ void SetError(std::string const& error);
};
diff --git a/Source/cmBinUtilsWindowsPELinker.cxx b/Source/cmBinUtilsWindowsPELinker.cxx
index 918f563..70ddaf2 100644
--- a/Source/cmBinUtilsWindowsPELinker.cxx
+++ b/Source/cmBinUtilsWindowsPELinker.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsWindowsPELinker.h"
diff --git a/Source/cmBinUtilsWindowsPELinker.h b/Source/cmBinUtilsWindowsPELinker.h
index 6bb7875..6db0f2e 100644
--- a/Source/cmBinUtilsWindowsPELinker.h
+++ b/Source/cmBinUtilsWindowsPELinker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
index d54aa7d..258e015 100644
--- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h"
@@ -20,7 +20,7 @@ cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::
}
bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo(
- const std::string& file, std::vector<std::string>& needed)
+ std::string const& file, std::vector<std::string>& needed)
{
cmUVProcessChainBuilder builder;
builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT);
@@ -43,7 +43,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo(
}
std::string line;
- static const cmsys::RegularExpression regex(
+ static cmsys::RegularExpression const regex(
"^[\t ]*DLL Name: ([^\n]*\\.[Dd][Ll][Ll])$");
cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
while (cmSystemTools::GetLineFromStream(output, line)) {
diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
index fe89a2d..994235d 100644
--- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -17,6 +17,6 @@ public:
cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool(
cmRuntimeDependencyArchive* archive);
- bool GetFileInfo(const std::string& file,
+ bool GetFileInfo(std::string const& file,
std::vector<std::string>& needed) override;
};
diff --git a/Source/cmBlockCommand.cxx b/Source/cmBlockCommand.cxx
index 5bf7bed..98d97a3 100644
--- a/Source/cmBlockCommand.cxx
+++ b/Source/cmBlockCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBlockCommand.h"
@@ -33,18 +33,18 @@ using ScopeSet = cm::enum_set<ScopeType>;
class BlockScopePushPop
{
public:
- BlockScopePushPop(cmMakefile* m, const ScopeSet& scopes);
+ BlockScopePushPop(cmMakefile* m, ScopeSet const& scopes);
~BlockScopePushPop() = default;
- BlockScopePushPop(const BlockScopePushPop&) = delete;
- BlockScopePushPop& operator=(const BlockScopePushPop&) = delete;
+ BlockScopePushPop(BlockScopePushPop const&) = delete;
+ BlockScopePushPop& operator=(BlockScopePushPop const&) = delete;
private:
std::unique_ptr<cmMakefile::PolicyPushPop> PolicyScope;
std::unique_ptr<cmMakefile::VariablePushPop> VariableScope;
};
-BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, const ScopeSet& scopes)
+BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, ScopeSet const& scopes)
{
if (scopes.contains(ScopeType::POLICIES)) {
this->PolicyScope = cm::make_unique<cmMakefile::PolicyPushPop>(mf);
@@ -57,7 +57,7 @@ BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, const ScopeSet& scopes)
class cmBlockFunctionBlocker : public cmFunctionBlocker
{
public:
- cmBlockFunctionBlocker(cmMakefile* mf, const ScopeSet& scopes,
+ cmBlockFunctionBlocker(cmMakefile* mf, ScopeSet const& scopes,
std::vector<std::string> variableNames);
~cmBlockFunctionBlocker() override;
@@ -80,7 +80,7 @@ private:
};
cmBlockFunctionBlocker::cmBlockFunctionBlocker(
- cmMakefile* const mf, const ScopeSet& scopes,
+ cmMakefile* const mf, ScopeSet const& scopes,
std::vector<std::string> variableNames)
: Makefile{ mf }
, Scopes{ scopes }
diff --git a/Source/cmBlockCommand.h b/Source/cmBlockCommand.h
index 5fd8f42..fd1b9cb 100644
--- a/Source/cmBlockCommand.h
+++ b/Source/cmBlockCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx
index 95db689..234ef0f 100644
--- a/Source/cmBreakCommand.cxx
+++ b/Source/cmBreakCommand.cxx
@@ -1,73 +1,30 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBreakCommand.h"
-#include <sstream>
-
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
// cmBreakCommand
bool cmBreakCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
if (!status.GetMakefile().IsLoopBlock()) {
- bool issueMessage = true;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0055)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n";
- break;
- case cmPolicies::OLD:
- issueMessage = false;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- messageType = MessageType::FATAL_ERROR;
- break;
- }
-
- if (issueMessage) {
- e << "A BREAK command was found outside of a proper "
- "FOREACH or WHILE loop scope.";
- status.GetMakefile().IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
+ status.GetMakefile().IssueMessage(
+ MessageType::FATAL_ERROR,
+ "A BREAK command was found outside of a proper "
+ "FOREACH or WHILE loop scope.");
+ return false;
}
status.SetBreakInvoked();
if (!args.empty()) {
- bool issueMessage = true;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0055)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n";
- break;
- case cmPolicies::OLD:
- issueMessage = false;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- messageType = MessageType::FATAL_ERROR;
- break;
- }
-
- if (issueMessage) {
- e << "The BREAK command does not accept any arguments.";
- status.GetMakefile().IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
+ status.GetMakefile().IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The BREAK command does not accept any arguments.");
+ return false;
}
return true;
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 6241867..dc443ba 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 415a124..dca0538 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBuildCommand.h"
#include "cmExecutionStatus.h"
@@ -84,7 +84,7 @@ bool MainSignature(std::vector<std::string> const& args,
}
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
- target, configuration, parallel, "", mf.IgnoreErrorsCMP0061());
+ target, configuration, parallel, "", false);
mf.AddDefinition(variable, makecommand);
@@ -111,7 +111,7 @@ bool TwoArgsSignature(std::vector<std::string> const& args,
}
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
- "", configType, "", "", mf.IgnoreErrorsCMP0061());
+ "", configType, "", "", false);
if (cacheValue) {
return true;
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index eafe185..b264bc8 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmBuildDatabase.cxx b/Source/cmBuildDatabase.cxx
index dc5f906..c80e7fb 100644
--- a/Source/cmBuildDatabase.cxx
+++ b/Source/cmBuildDatabase.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBuildDatabase.h"
#include <cstdlib>
@@ -498,9 +498,9 @@ int cmcmd_cmake_module_compile_db(
std::vector<std::string>::const_iterator argBeg,
std::vector<std::string>::const_iterator argEnd)
{
- const std::string* command = nullptr;
- const std::string* output = nullptr;
- std::vector<const std::string*> inputs;
+ std::string const* command = nullptr;
+ std::string const* output = nullptr;
+ std::vector<std::string const*> inputs;
bool next_is_output = false;
for (auto i = argBeg; i != argEnd; ++i) {
diff --git a/Source/cmBuildDatabase.h b/Source/cmBuildDatabase.h
index a2733cb..d63fb0c 100644
--- a/Source/cmBuildDatabase.h
+++ b/Source/cmBuildDatabase.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
deleted file mode 100644
index 20d6089..0000000
--- a/Source/cmBuildNameCommand.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmBuildNameCommand.h"
-
-#include <algorithm>
-
-#include "cmsys/RegularExpression.hxx"
-
-#include "cmExecutionStatus.h"
-#include "cmMakefile.h"
-#include "cmStateTypes.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-
-bool cmBuildNameCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.empty()) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
- cmMakefile& mf = status.GetMakefile();
- cmValue cacheValue = mf.GetDefinition(args[0]);
- if (cacheValue) {
- // do we need to correct the value?
- cmsys::RegularExpression reg("[()/]");
- std::string cv = *cacheValue;
- if (reg.find(cv)) {
- std::replace(cv.begin(), cv.end(), '/', '_');
- std::replace(cv.begin(), cv.end(), '(', '_');
- std::replace(cv.begin(), cv.end(), ')', '_');
- mf.AddCacheDefinition(args[0], cv, "Name of build.",
- cmStateEnums::STRING);
- }
- return true;
- }
-
- std::string buildname = "WinNT";
- if (mf.GetDefinition("UNIX")) {
- buildname.clear();
- cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname);
- if (!buildname.empty()) {
- std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
- cmsys::RegularExpression reg(RegExp);
- if (reg.find(buildname)) {
- buildname = reg.match(1) + "-" + reg.match(2);
- }
- }
- }
- std::string compiler = "${CMAKE_CXX_COMPILER}";
- mf.ExpandVariablesInString(compiler);
- buildname += "-";
- buildname += cmSystemTools::GetFilenameName(compiler);
- std::replace(buildname.begin(), buildname.end(), '/', '_');
- std::replace(buildname.begin(), buildname.end(), '(', '_');
- std::replace(buildname.begin(), buildname.end(), ')', '_');
-
- mf.AddCacheDefinition(args[0], buildname, "Name of build.",
- cmStateEnums::STRING);
- return true;
-}
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
deleted file mode 100644
index 650dc74..0000000
--- a/Source/cmBuildNameCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmBuildNameCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmBuildOptions.h b/Source/cmBuildOptions.h
index aa3184e..f84b576 100644
--- a/Source/cmBuildOptions.h
+++ b/Source/cmBuildOptions.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,8 +35,8 @@ public:
, ResolveMode(resolveMode)
{
}
- explicit cmBuildOptions(const cmBuildOptions&) noexcept = default;
- cmBuildOptions& operator=(const cmBuildOptions&) noexcept = default;
+ explicit cmBuildOptions(cmBuildOptions const&) noexcept = default;
+ cmBuildOptions& operator=(cmBuildOptions const&) noexcept = default;
bool Clean = false;
bool Fast = false;
diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx
index c6c38f8..cabf5c7 100644
--- a/Source/cmCLocaleEnvironmentScope.cxx
+++ b/Source/cmCLocaleEnvironmentScope.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCLocaleEnvironmentScope.h"
#include <sstream>
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index 0919acc..c4d74f5 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index e4160a1..00b59c6 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakeHostSystemInformationCommand.h"
#include <algorithm>
@@ -46,7 +46,7 @@ std::string ValueToString(std::size_t const value)
return std::to_string(value);
}
-std::string ValueToString(const char* const value)
+std::string ValueToString(char const* const value)
{
return value ? value : std::string{};
}
@@ -266,13 +266,13 @@ std::map<std::string, std::string> GetOSReleaseVariables(
cmExecutionStatus& status)
{
auto& makefile = status.GetMakefile();
- const auto& sysroot = makefile.GetSafeDefinition("CMAKE_SYSROOT");
+ auto const& sysroot = makefile.GetSafeDefinition("CMAKE_SYSROOT");
std::map<std::string, std::string> data;
// Based on
// https://www.freedesktop.org/software/systemd/man/latest/os-release.html
for (auto name : { "/etc/os-release"_s, "/usr/lib/os-release"_s }) {
- const auto& filename = cmStrCat(sysroot, name);
+ auto const& filename = cmStrCat(sysroot, name);
if (cmSystemTools::FileExists(filename)) {
cmsys::ifstream fin(filename.c_str());
for (std::string line; !std::getline(fin, line).fail();) {
@@ -381,21 +381,21 @@ cm::optional<std::string> GetDistribValue(cmExecutionStatus& status,
std::string const& key,
std::string const& variable)
{
- const auto prefix = "DISTRIB_"_s;
+ auto const prefix = "DISTRIB_"_s;
if (!cmHasPrefix(key, prefix)) {
return {};
}
- static const std::map<std::string, std::string> s_os_release =
+ static std::map<std::string, std::string> const s_os_release =
GetOSReleaseVariables(status);
auto& makefile = status.GetMakefile();
- const std::string subkey =
+ std::string const subkey =
key.substr(prefix.size(), key.size() - prefix.size());
if (subkey == "INFO"_s) {
std::string vars;
- for (const auto& kv : s_os_release) {
+ for (auto const& kv : s_os_release) {
auto cmake_var_name = cmStrCat(variable, '_', kv.first);
vars += DELIM[!vars.empty()] + cmake_var_name;
makefile.AddDefinition(cmake_var_name, kv.second);
@@ -404,7 +404,7 @@ cm::optional<std::string> GetDistribValue(cmExecutionStatus& status,
}
// Query individual variable
- const auto it = s_os_release.find(subkey);
+ auto const it = s_os_release.find(subkey);
if (it != s_os_release.cend()) {
return it->second;
}
@@ -604,14 +604,14 @@ bool QueryWindowsRegistry(Range args, cmExecutionStatus& status,
(arguments.ValueNames || arguments.SubKeys)) ||
(arguments.ValueName.empty() && arguments.ValueNames &&
arguments.SubKeys)) {
- status.SetError("given mutually exclusive sub-options \"VALUE\", "
- "\"VALUE_NAMES\" or \"SUBKEYS\".");
+ status.SetError("given mutually exclusive sub-options VALUE, "
+ "VALUE_NAMES or SUBKEYS.");
return false;
}
if (!arguments.View.empty() && !cmWindowsRegistry::ToView(arguments.View)) {
status.SetError(
- cmStrCat("given invalid value for \"VIEW\": ", arguments.View, '.'));
+ cmStrCat("given invalid value for VIEW: ", arguments.View, '.'));
return false;
}
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index 8a64f6a..f6e63c3 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
index fe9257e..d1ec9cf 100644
--- a/Source/cmCMakeLanguageCommand.cxx
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakeLanguageCommand.h"
#include <algorithm>
@@ -217,7 +217,7 @@ bool cmCMakeLanguageCommandEVAL(std::vector<cmListFileArgument> const& args,
"called with unsupported arguments between EVAL and CODE arguments");
}
- const std::string code =
+ std::string const code =
cmJoin(cmMakeRange(expandedArgs.begin() + 2, expandedArgs.end()), " ");
return makefile.ReadListFileAsString(
code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL"));
@@ -324,7 +324,7 @@ bool cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL(
Message::LogLevel logLevel = makefile.GetCurrentLogLevel();
std::string outputValue = cmake::LogLevelToString(logLevel);
- const std::string& outputVariable = expandedArgs[1];
+ std::string const& outputVariable = expandedArgs[1];
makefile.AddDefinition(outputVariable, outputValue);
return true;
}
diff --git a/Source/cmCMakeLanguageCommand.h b/Source/cmCMakeLanguageCommand.h
index d45003a..ad12915 100644
--- a/Source/cmCMakeLanguageCommand.h
+++ b/Source/cmCMakeLanguageCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index c6a0c9a..1a68f03 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakeMinimumRequired.h"
#include <cstdio>
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 712d6d6..375731b 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCMakePath.cxx b/Source/cmCMakePath.cxx
index be5c74a..5f6db32 100644
--- a/Source/cmCMakePath.cxx
+++ b/Source/cmCMakePath.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,7 +68,7 @@ cmCMakePath cmCMakePath::GetNarrowStem() const
return stem;
}
-cmCMakePath cmCMakePath::Absolute(const cm::filesystem::path& base) const
+cmCMakePath cmCMakePath::Absolute(cm::filesystem::path const& base) const
{
if (this->Path.is_relative()) {
auto path = base;
@@ -80,7 +80,7 @@ cmCMakePath cmCMakePath::Absolute(const cm::filesystem::path& base) const
return *this;
}
-bool cmCMakePath::IsPrefix(const cmCMakePath& path) const
+bool cmCMakePath::IsPrefix(cmCMakePath const& path) const
{
auto prefix_it = this->Path.begin();
auto prefix_end = this->Path.end();
diff --git a/Source/cmCMakePath.h b/Source/cmCMakePath.h
index fd71c1f..da92424 100644
--- a/Source/cmCMakePath.h
+++ b/Source/cmCMakePath.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -111,7 +111,7 @@ public:
cmCMakePath() noexcept = default;
- cmCMakePath(const cmCMakePath&) = default;
+ cmCMakePath(cmCMakePath const&) = default;
cmCMakePath(cmCMakePath&& path) noexcept
: Path(std::forward<cm::filesystem::path>(path.Path))
@@ -126,7 +126,7 @@ public:
: Path(FormatPath(source, fmt))
{
}
- cmCMakePath(const char* source, format fmt = generic_format) noexcept
+ cmCMakePath(char const* source, format fmt = generic_format) noexcept
: Path(FormatPath(cm::string_view{ source }, fmt))
{
}
@@ -134,7 +134,7 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath(const std::string& source, format fmt = generic_format)
+ cmCMakePath(std::string const& source, format fmt = generic_format)
: Path(FormatPath(source, fmt))
{
}
@@ -157,13 +157,13 @@ public:
return *this;
}
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& Assign(const Source& source)
+ cmCMakePath& Assign(Source const& source)
{
this->Path = source;
return *this;
}
- cmCMakePath& operator=(const cmCMakePath& path)
+ cmCMakePath& operator=(cmCMakePath const& path)
{
if (this != &path) {
this->Path = path.Path;
@@ -191,22 +191,22 @@ public:
this->Assign(std::forward<std::string>(source));
return *this;
}
- cmCMakePath& operator=(const cm::filesystem::path& source)
+ cmCMakePath& operator=(cm::filesystem::path const& source)
{
this->Assign(source);
return *this;
}
- cmCMakePath& operator=(const std::string& source)
+ cmCMakePath& operator=(std::string const& source)
{
this->Assign(source);
return *this;
}
- cmCMakePath& operator=(const cm::string_view source)
+ cmCMakePath& operator=(cm::string_view const source)
{
this->Assign(source);
return *this;
}
- cmCMakePath& operator=(const char* source)
+ cmCMakePath& operator=(char const* source)
{
this->Assign(cm::string_view{ source });
return *this;
@@ -219,7 +219,7 @@ public:
return *this;
}
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& operator=(const Source& source)
+ cmCMakePath& operator=(Source const& source)
{
this->Assign(source);
return *this;
@@ -227,11 +227,11 @@ public:
#endif
// Concatenation
- cmCMakePath& Append(const cmCMakePath& path)
+ cmCMakePath& Append(cmCMakePath const& path)
{
return this->Append(path.Path);
}
- cmCMakePath& Append(const cm::filesystem::path& path)
+ cmCMakePath& Append(cm::filesystem::path const& path)
{
this->Path /= path;
// filesystem::path::append use preferred_separator ('\' on Windows)
@@ -243,7 +243,7 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath& Append(const std::string& source)
+ cmCMakePath& Append(std::string const& source)
{
return this->Append(cm::filesystem::path(source));
}
@@ -251,29 +251,29 @@ public:
{
return this->Append(cm::filesystem::path(source));
}
- cmCMakePath& Append(const char* source)
+ cmCMakePath& Append(char const* source)
{
return this->Append(cm::filesystem::path(cm::string_view{ source }));
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& Append(const Source& source)
+ cmCMakePath& Append(Source const& source)
{
return this->Append(cm::filesystem::path(source));
}
#endif
- cmCMakePath& operator/=(const cmCMakePath& path)
+ cmCMakePath& operator/=(cmCMakePath const& path)
{
return this->Append(path);
}
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& operator/=(const Source& source)
+ cmCMakePath& operator/=(Source const& source)
{
return this->Append(source);
}
- cmCMakePath& Concat(const cmCMakePath& path)
+ cmCMakePath& Concat(cmCMakePath const& path)
{
this->Path += path.Path;
return *this;
@@ -287,36 +287,36 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath& Concat(const cm::filesystem::path& source)
+ cmCMakePath& Concat(cm::filesystem::path const& source)
{
this->Path.operator+=(source);
return *this;
}
- cmCMakePath& Concat(const std::string& source)
+ cmCMakePath& Concat(std::string const& source)
{
this->Path.operator+=(source);
return *this;
}
- cmCMakePath& Concat(const char* source)
+ cmCMakePath& Concat(char const* source)
{
this->Path.operator+=(source);
return *this;
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& Concat(const Source& source)
+ cmCMakePath& Concat(Source const& source)
{
this->Path.operator+=(source);
return *this;
}
#endif
- cmCMakePath& operator+=(const cmCMakePath& path)
+ cmCMakePath& operator+=(cmCMakePath const& path)
{
return this->Concat(path);
}
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& operator+=(const Source& source)
+ cmCMakePath& operator+=(Source const& source)
{
return this->Concat(source);
}
@@ -330,7 +330,7 @@ public:
return *this;
}
- cmCMakePath& ReplaceFileName(const cmCMakePath& filename)
+ cmCMakePath& ReplaceFileName(cmCMakePath const& filename)
{
if (this->Path.has_filename()) {
this->Path.replace_filename(filename.Path);
@@ -341,14 +341,14 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath& ReplaceFileName(const cm::filesystem::path& filename)
+ cmCMakePath& ReplaceFileName(cm::filesystem::path const& filename)
{
if (this->Path.has_filename()) {
this->Path.replace_filename(filename);
}
return *this;
}
- cmCMakePath& ReplaceFileName(const std::string& filename)
+ cmCMakePath& ReplaceFileName(std::string const& filename)
{
if (this->Path.has_filename()) {
this->Path.replace_filename(filename);
@@ -364,7 +364,7 @@ public:
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& ReplaceFileName(const Source& filename)
+ cmCMakePath& ReplaceFileName(Source const& filename)
{
if (this->Path.has_filename()) {
this->Path.replace_filename(filename);
@@ -373,7 +373,7 @@ public:
}
#endif
- cmCMakePath& ReplaceExtension(const cmCMakePath& extension = cmCMakePath())
+ cmCMakePath& ReplaceExtension(cmCMakePath const& extension = cmCMakePath())
{
this->Path.replace_extension(extension.Path);
return *this;
@@ -382,24 +382,24 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath& ReplaceExtension(const cm::filesystem::path& extension)
+ cmCMakePath& ReplaceExtension(cm::filesystem::path const& extension)
{
this->Path.replace_extension(extension);
return *this;
}
- cmCMakePath& ReplaceExtension(const std::string& extension)
+ cmCMakePath& ReplaceExtension(std::string const& extension)
{
this->Path.replace_extension(extension);
return *this;
}
- cmCMakePath& ReplaceExtension(const cm::string_view extension)
+ cmCMakePath& ReplaceExtension(cm::string_view const extension)
{
this->Path.replace_extension(extension);
return *this;
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& ReplaceExtension(const Source& extension)
+ cmCMakePath& ReplaceExtension(Source const& extension)
{
this->Path.replace_extension(extension);
return *this;
@@ -407,12 +407,12 @@ public:
#endif
cmCMakePath& ReplaceWideExtension(
- const cmCMakePath& extension = cmCMakePath())
+ cmCMakePath const& extension = cmCMakePath())
{
return this->ReplaceWideExtension(
static_cast<cm::string_view>(extension.Path.string()));
}
- cmCMakePath& ReplaceWideExtension(const cm::filesystem::path& extension)
+ cmCMakePath& ReplaceWideExtension(cm::filesystem::path const& extension)
{
return this->ReplaceWideExtension(
static_cast<cm::string_view>(extension.string()));
@@ -421,13 +421,13 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath& ReplaceWideExtension(const std::string& extension)
+ cmCMakePath& ReplaceWideExtension(std::string const& extension)
{
return this->ReplaceWideExtension(cm::string_view{ extension });
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath& ReplaceWideExtension(const Source& extension)
+ cmCMakePath& ReplaceWideExtension(Source const& extension)
{
return this->ReplaceWideExtension(extension);
}
@@ -502,11 +502,11 @@ public:
return path.generic_string();
}
- cmCMakePath Relative(const cmCMakePath& base) const
+ cmCMakePath Relative(cmCMakePath const& base) const
{
return this->Relative(base.Path);
}
- cmCMakePath Relative(const cm::filesystem::path& base) const
+ cmCMakePath Relative(cm::filesystem::path const& base) const
{
auto path = this->Path.lexically_relative(base);
// filesystem::path:lexically_relative use preferred_separator ('\') on
@@ -517,7 +517,7 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath Relative(const std::string& base) const
+ cmCMakePath Relative(std::string const& base) const
{
return this->Relative(cm::filesystem::path(base));
}
@@ -527,16 +527,16 @@ public:
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath Relative(const Source& base) const
+ cmCMakePath Relative(Source const& base) const
{
return this->Relative(cm::filesystem::path(base));
}
#endif
- cmCMakePath Proximate(const cmCMakePath& base) const
+ cmCMakePath Proximate(cmCMakePath const& base) const
{
return this->Proximate(base.Path);
}
- cmCMakePath Proximate(const cm::filesystem::path& base) const
+ cmCMakePath Proximate(cm::filesystem::path const& base) const
{
auto path = this->Path.lexically_proximate(base);
// filesystem::path::lexically_proximate use preferred_separator ('\') on
@@ -547,7 +547,7 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath Proximate(const std::string& base) const
+ cmCMakePath Proximate(std::string const& base) const
{
return this->Proximate(cm::filesystem::path(base));
}
@@ -557,13 +557,13 @@ public:
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath Proximate(const Source& base) const
+ cmCMakePath Proximate(Source const& base) const
{
return this->Proximate(cm::filesystem::path(base));
}
#endif
- cmCMakePath Absolute(const cmCMakePath& base) const
+ cmCMakePath Absolute(cmCMakePath const& base) const
{
return this->Absolute(base.Path);
}
@@ -571,7 +571,7 @@ public:
// Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
// standard methods and templates use the same name. The template is selected
// rather than the standard one regardless the arguments of the method.
- cmCMakePath Absolute(const std::string& base) const
+ cmCMakePath Absolute(std::string const& base) const
{
return this->Absolute(cm::filesystem::path(base));
}
@@ -581,15 +581,15 @@ public:
}
#else
template <typename Source, typename = enable_if_pathable<Source>>
- cmCMakePath Absolute(const Source& base) const
+ cmCMakePath Absolute(Source const& base) const
{
return this->Absolute(cm::filesystem::path(base));
}
#endif
- cmCMakePath Absolute(const cm::filesystem::path& base) const;
+ cmCMakePath Absolute(cm::filesystem::path const& base) const;
// Comparison
- int Compare(const cmCMakePath& path) const noexcept
+ int Compare(cmCMakePath const& path) const noexcept
{
return this->Path.compare(path.Path);
}
@@ -608,7 +608,7 @@ public:
bool IsAbsolute() const { return this->Path.is_absolute(); }
bool IsRelative() const { return this->Path.is_relative(); }
- bool IsPrefix(const cmCMakePath& path) const;
+ bool IsPrefix(cmCMakePath const& path) const;
// Iterators
// =========
@@ -617,19 +617,18 @@ public:
// Non-members
// ===========
- friend inline bool operator==(const cmCMakePath& lhs,
- const cmCMakePath& rhs) noexcept
+ friend bool operator==(cmCMakePath const& lhs,
+ cmCMakePath const& rhs) noexcept
{
return lhs.Compare(rhs) == 0;
}
- friend inline bool operator!=(const cmCMakePath& lhs,
- const cmCMakePath& rhs) noexcept
+ friend bool operator!=(cmCMakePath const& lhs,
+ cmCMakePath const& rhs) noexcept
{
return lhs.Compare(rhs) != 0;
}
- friend inline cmCMakePath operator/(const cmCMakePath& lhs,
- const cmCMakePath& rhs)
+ friend cmCMakePath operator/(cmCMakePath const& lhs, cmCMakePath const& rhs)
{
cmCMakePath result(lhs);
result /= rhs;
@@ -638,7 +637,7 @@ public:
}
private:
- friend std::size_t hash_value(const cmCMakePath& path) noexcept;
+ friend std::size_t hash_value(cmCMakePath const& path) noexcept;
static std::string FormatPath(std::string path, format fmt = generic_format);
static std::string FormatPath(cm::string_view path,
@@ -660,12 +659,12 @@ public:
using value_type = cmCMakePath;
using difference_type = cm::filesystem::path::iterator::difference_type;
- using pointer = const cmCMakePath*;
- using reference = const cmCMakePath&;
+ using pointer = cmCMakePath const*;
+ using reference = cmCMakePath const&;
iterator() = default;
- iterator(const iterator& other)
+ iterator(iterator const& other)
: Iterator(other.Iterator)
, Path(other.Path)
, PathElement(*this->Iterator)
@@ -674,7 +673,7 @@ public:
~iterator() = default;
- iterator& operator=(const iterator& other)
+ iterator& operator=(iterator const& other)
{
if (this != &other) {
this->Iterator = other.Iterator;
@@ -721,9 +720,9 @@ public:
private:
friend class cmCMakePath;
- friend bool operator==(const iterator&, const iterator&);
+ friend bool operator==(iterator const&, iterator const&);
- iterator(const cmCMakePath* path, const cm::filesystem::path::iterator& it)
+ iterator(cmCMakePath const* path, cm::filesystem::path::iterator const& it)
: Iterator(it)
, Path(path)
, PathElement(*this->Iterator)
@@ -731,7 +730,7 @@ private:
}
cm::filesystem::path::iterator Iterator;
- const cmCMakePath* Path = nullptr;
+ cmCMakePath const* Path = nullptr;
cmCMakePath PathElement;
};
@@ -746,14 +745,14 @@ inline cmCMakePath::iterator cmCMakePath::end() const
// Non-member functions
// ====================
-inline bool operator==(const cmCMakePath::iterator& lhs,
- const cmCMakePath::iterator& rhs)
+inline bool operator==(cmCMakePath::iterator const& lhs,
+ cmCMakePath::iterator const& rhs)
{
return lhs.Path == rhs.Path && lhs.Path && lhs.Iterator == rhs.Iterator;
}
-inline bool operator!=(const cmCMakePath::iterator& lhs,
- const cmCMakePath::iterator& rhs)
+inline bool operator!=(cmCMakePath::iterator const& lhs,
+ cmCMakePath::iterator const& rhs)
{
return !(lhs == rhs);
}
@@ -763,7 +762,7 @@ inline void swap(cmCMakePath& lhs, cmCMakePath& rhs) noexcept
lhs.swap(rhs);
}
-inline std::size_t hash_value(const cmCMakePath& path) noexcept
+inline std::size_t hash_value(cmCMakePath const& path) noexcept
{
return cm::filesystem::hash_value(path.Path);
}
diff --git a/Source/cmCMakePathCommand.cxx b/Source/cmCMakePathCommand.cxx
index 0c8f537..187d7e8 100644
--- a/Source/cmCMakePathCommand.cxx
+++ b/Source/cmCMakePathCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakePathCommand.h"
#include <functional>
@@ -53,7 +53,7 @@ public:
cmMakeRange(args).advance(Advance), &this->Inputs);
}
- const std::vector<std::string>& GetInputs() const { return this->Inputs; }
+ std::vector<std::string> const& GetInputs() const { return this->Inputs; }
protected:
mutable std::vector<std::string> Inputs;
@@ -108,7 +108,7 @@ public:
};
// retrieve value of input path from specified variable
-bool getInputPath(const std::string& arg, cmExecutionStatus& status,
+bool getInputPath(std::string const& arg, cmExecutionStatus& status,
std::string& path)
{
cmValue def = status.GetMakefile().GetDefinition(arg);
@@ -125,43 +125,43 @@ bool HandleGetCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
static std::map<cm::string_view,
- std::function<cmCMakePath(const cmCMakePath&, bool)>> const
+ std::function<cmCMakePath(cmCMakePath const&, bool)>> const
actions{ { "ROOT_NAME"_s,
- [](const cmCMakePath& path, bool) -> cmCMakePath {
+ [](cmCMakePath const& path, bool) -> cmCMakePath {
return path.GetRootName();
} },
{ "ROOT_DIRECTORY"_s,
- [](const cmCMakePath& path, bool) -> cmCMakePath {
+ [](cmCMakePath const& path, bool) -> cmCMakePath {
return path.GetRootDirectory();
} },
{ "ROOT_PATH"_s,
- [](const cmCMakePath& path, bool) -> cmCMakePath {
+ [](cmCMakePath const& path, bool) -> cmCMakePath {
return path.GetRootPath();
} },
{ "FILENAME"_s,
- [](const cmCMakePath& path, bool) -> cmCMakePath {
+ [](cmCMakePath const& path, bool) -> cmCMakePath {
return path.GetFileName();
} },
{ "EXTENSION"_s,
- [](const cmCMakePath& path, bool last_only) -> cmCMakePath {
+ [](cmCMakePath const& path, bool last_only) -> cmCMakePath {
if (last_only) {
return path.GetExtension();
}
return path.GetWideExtension();
} },
{ "STEM"_s,
- [](const cmCMakePath& path, bool last_only) -> cmCMakePath {
+ [](cmCMakePath const& path, bool last_only) -> cmCMakePath {
if (last_only) {
return path.GetStem();
}
return path.GetNarrowStem();
} },
{ "RELATIVE_PART"_s,
- [](const cmCMakePath& path, bool) -> cmCMakePath {
+ [](cmCMakePath const& path, bool) -> cmCMakePath {
return path.GetRelativePath();
} },
{ "PARENT_PATH"_s,
- [](const cmCMakePath& path, bool) -> cmCMakePath {
+ [](cmCMakePath const& path, bool) -> cmCMakePath {
return path.GetParentPath();
} } };
@@ -170,7 +170,7 @@ bool HandleGetCommand(std::vector<std::string> const& args,
return false;
}
- const auto& action = args[2];
+ auto const& action = args[2];
if (actions.find(action) == actions.end()) {
status.SetError(
@@ -227,7 +227,7 @@ bool HandleSetCommand(std::vector<std::string> const& args,
static NormalizeParser const parser;
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (parser.GetInputs().size() != 1) {
status.SetError("SET called with unexpected arguments.");
@@ -256,14 +256,14 @@ bool HandleAppendCommand(std::vector<std::string> const& args,
static OutputVariableParser const parser{};
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
}
cmCMakePath path(status.GetMakefile().GetSafeDefinition(args[1]));
- for (const auto& input : parser.GetInputs()) {
+ for (auto const& input : parser.GetInputs()) {
path /= input;
}
@@ -278,7 +278,7 @@ bool HandleAppendStringCommand(std::vector<std::string> const& args,
{
static OutputVariableParser const parser{};
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
@@ -290,7 +290,7 @@ bool HandleAppendStringCommand(std::vector<std::string> const& args,
}
cmCMakePath path(inputPath);
- for (const auto& input : parser.GetInputs()) {
+ for (auto const& input : parser.GetInputs()) {
path += input;
}
@@ -305,7 +305,7 @@ bool HandleRemoveFilenameCommand(std::vector<std::string> const& args,
{
static OutputVariableParser const parser{};
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
@@ -335,7 +335,7 @@ bool HandleReplaceFilenameCommand(std::vector<std::string> const& args,
{
static OutputVariableParser const parser{};
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
@@ -454,7 +454,7 @@ bool HandleNormalPathCommand(std::vector<std::string> const& args,
{
static OutputVariableParser const parser{};
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
@@ -480,8 +480,8 @@ bool HandleNormalPathCommand(std::vector<std::string> const& args,
bool HandleTransformPathCommand(
std::vector<std::string> const& args, cmExecutionStatus& status,
- const std::function<cmCMakePath(const cmCMakePath&,
- const std::string& base)>& transform,
+ std::function<cmCMakePath(cmCMakePath const&,
+ std::string const& base)> const& transform,
bool normalizeOption = false)
{
struct Arguments : public ArgumentParser::ParseResult
@@ -536,7 +536,7 @@ bool HandleRelativePathCommand(std::vector<std::string> const& args,
{
return HandleTransformPathCommand(
args, status,
- [](const cmCMakePath& path, const std::string& base) -> cmCMakePath {
+ [](cmCMakePath const& path, std::string const& base) -> cmCMakePath {
return path.Relative(base);
});
}
@@ -546,7 +546,7 @@ bool HandleAbsolutePathCommand(std::vector<std::string> const& args,
{
return HandleTransformPathCommand(
args, status,
- [](const cmCMakePath& path, const std::string& base) -> cmCMakePath {
+ [](cmCMakePath const& path, std::string const& base) -> cmCMakePath {
return path.Absolute(base);
},
true);
@@ -562,7 +562,7 @@ bool HandleNativePathCommand(std::vector<std::string> const& args,
static NormalizeParser const parser;
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (parser.GetInputs().size() != 1) {
status.SetError("NATIVE_PATH called with unexpected arguments.");
@@ -593,19 +593,19 @@ bool HandleConvertCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
- const auto pathSep = ";"_s;
+ auto const pathSep = ";"_s;
#else
- const auto pathSep = ":"_s;
+ auto const pathSep = ":"_s;
#endif
- const auto cmakePath = "TO_CMAKE_PATH_LIST"_s;
- const auto nativePath = "TO_NATIVE_PATH_LIST"_s;
+ auto const cmakePath = "TO_CMAKE_PATH_LIST"_s;
+ auto const nativePath = "TO_NATIVE_PATH_LIST"_s;
if (args.size() < 4 || args.size() > 5) {
status.SetError("CONVERT must be called with three or four arguments.");
return false;
}
- const auto& action = args[2];
+ auto const& action = args[2];
if (action != cmakePath && action != nativePath) {
status.SetError(
@@ -620,7 +620,7 @@ bool HandleConvertCommand(std::vector<std::string> const& args,
static NormalizeParser const parser;
- const auto arguments = parser.Parse<4>(args);
+ auto const arguments = parser.Parse<4>(args);
if (!parser.GetInputs().empty()) {
status.SetError("CONVERT called with unexpected arguments.");
@@ -664,19 +664,19 @@ bool HandleCompareCommand(std::vector<std::string> const& args,
}
static std::map<cm::string_view,
- std::function<bool(const cmCMakePath&,
- const cmCMakePath&)>> const operators{
+ std::function<bool(cmCMakePath const&,
+ cmCMakePath const&)>> const operators{
{ "EQUAL"_s,
- [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool {
+ [](cmCMakePath const& path1, cmCMakePath const& path2) -> bool {
return path1 == path2;
} },
{ "NOT_EQUAL"_s,
- [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool {
+ [](cmCMakePath const& path1, cmCMakePath const& path2) -> bool {
return path1 != path2;
} }
};
- const auto op = operators.find(args[2]);
+ auto const op = operators.find(args[2]);
if (op == operators.end()) {
status.SetError(cmStrCat(
"COMPARE called with an unknown comparison operator: ", args[2], "."));
@@ -699,7 +699,7 @@ bool HandleCompareCommand(std::vector<std::string> const& args,
bool HandleHasItemCommand(
std::vector<std::string> const& args, cmExecutionStatus& status,
- const std::function<bool(const cmCMakePath&)>& has_item)
+ std::function<bool(cmCMakePath const&)> const& has_item)
{
if (args.size() != 3) {
status.SetError(
@@ -730,7 +730,7 @@ bool HandleHasRootNameCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasRootName(); });
+ [](cmCMakePath const& path) -> bool { return path.HasRootName(); });
}
bool HandleHasRootDirectoryCommand(std::vector<std::string> const& args,
@@ -738,7 +738,7 @@ bool HandleHasRootDirectoryCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasRootDirectory(); });
+ [](cmCMakePath const& path) -> bool { return path.HasRootDirectory(); });
}
bool HandleHasRootPathCommand(std::vector<std::string> const& args,
@@ -746,7 +746,7 @@ bool HandleHasRootPathCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasRootPath(); });
+ [](cmCMakePath const& path) -> bool { return path.HasRootPath(); });
}
bool HandleHasFilenameCommand(std::vector<std::string> const& args,
@@ -754,7 +754,7 @@ bool HandleHasFilenameCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasFileName(); });
+ [](cmCMakePath const& path) -> bool { return path.HasFileName(); });
}
bool HandleHasExtensionCommand(std::vector<std::string> const& args,
@@ -762,7 +762,7 @@ bool HandleHasExtensionCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasExtension(); });
+ [](cmCMakePath const& path) -> bool { return path.HasExtension(); });
}
bool HandleHasStemCommand(std::vector<std::string> const& args,
@@ -770,7 +770,7 @@ bool HandleHasStemCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasStem(); });
+ [](cmCMakePath const& path) -> bool { return path.HasStem(); });
}
bool HandleHasRelativePartCommand(std::vector<std::string> const& args,
@@ -778,7 +778,7 @@ bool HandleHasRelativePartCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasRelativePath(); });
+ [](cmCMakePath const& path) -> bool { return path.HasRelativePath(); });
}
bool HandleHasParentPathCommand(std::vector<std::string> const& args,
@@ -786,7 +786,7 @@ bool HandleHasParentPathCommand(std::vector<std::string> const& args,
{
return HandleHasItemCommand(
args, status,
- [](const cmCMakePath& path) -> bool { return path.HasParentPath(); });
+ [](cmCMakePath const& path) -> bool { return path.HasParentPath(); });
}
bool HandleIsAbsoluteCommand(std::vector<std::string> const& args,
@@ -849,7 +849,7 @@ bool HandleIsPrefixCommand(std::vector<std::string> const& args,
static NormalizeParser const parser;
- const auto arguments = parser.Parse(args);
+ auto const arguments = parser.Parse(args);
if (parser.GetInputs().size() != 2) {
status.SetError("IS_PREFIX called with unexpected arguments.");
@@ -861,8 +861,8 @@ bool HandleIsPrefixCommand(std::vector<std::string> const& args,
return false;
}
- const auto& input = parser.GetInputs().front();
- const auto& output = parser.GetInputs().back();
+ auto const& input = parser.GetInputs().front();
+ auto const& output = parser.GetInputs().back();
if (output.empty()) {
status.SetError("Invalid name for output variable.");
@@ -895,7 +895,7 @@ bool HandleHashCommand(std::vector<std::string> const& args,
return false;
}
- const auto& output = args[2];
+ auto const& output = args[2];
if (output.empty()) {
status.SetError("Invalid name for output variable.");
diff --git a/Source/cmCMakePathCommand.h b/Source/cmCMakePathCommand.h
index 49e9380..85da11d 100644
--- a/Source/cmCMakePathCommand.h
+++ b/Source/cmCMakePathCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmCMakePkgConfigCommand.cxx b/Source/cmCMakePkgConfigCommand.cxx
index 468d2ab..ae7b1d3 100644
--- a/Source/cmCMakePkgConfigCommand.cxx
+++ b/Source/cmCMakePkgConfigCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakePkgConfigCommand.h"
@@ -71,9 +71,9 @@ cm::optional<std::string> GetPkgConfigBin(cmMakefile& mf)
return result;
}
-std::vector<std::string> GetLocations(cmMakefile& mf, const char* cachevar,
- const char* envvar, const char* desc,
- const char* pcvar, bool need_pkgconf,
+std::vector<std::string> GetLocations(cmMakefile& mf, char const* cachevar,
+ char const* envvar, char const* desc,
+ char const* pcvar, bool need_pkgconf,
std::vector<std::string> default_locs)
{
auto def = mf.GetDefinition(cachevar);
@@ -172,7 +172,7 @@ std::vector<std::string> GetPkgConfSysCflags(cmMakefile& mf)
}
std::string paths;
- auto get_and_append = [&](const char* var) {
+ auto get_and_append = [&](char const* var) {
if (paths.empty()) {
cmSystemTools::GetEnv(var, paths);
} else {
@@ -223,8 +223,8 @@ std::vector<std::string> GetPcPath(cmMakefile& mf)
return {};
}
-cm::optional<std::string> GetPath(cmMakefile& mf, const char* cachevar,
- const char* envvar, const char* desc)
+cm::optional<std::string> GetPath(cmMakefile& mf, char const* cachevar,
+ char const* envvar, char const* desc)
{
cm::optional<std::string> result;
@@ -258,8 +258,8 @@ cm::optional<std::string> GetTopBuildDir(cmMakefile& mf)
"Package file top_build_dir variable default value");
}
-bool GetBool(cmMakefile& mf, const char* cachevar, const char* envvar,
- const char* desc)
+bool GetBool(cmMakefile& mf, char const* cachevar, char const* envvar,
+ char const* desc)
{
auto def = mf.GetDefinition(cachevar);
if (def) {
@@ -451,7 +451,7 @@ cm::optional<cmPkgConfigResult> HandleCommon(CommonArguments& args,
return {};
}
- auto warn_or_error = [&](const std::string& err) {
+ auto warn_or_error = [&](std::string const& err) {
if (args.Required) {
status.SetError(err);
cmSystemTools::SetFatalErrorOccurred();
@@ -610,7 +610,7 @@ struct ExtractArguments : CommonArguments
SystemLibraryDirs;
};
-const auto ExtractParser =
+auto const ExtractParser =
BIND_COMMON(ExtractArguments)
.Bind("ALLOW_SYSTEM_INCLUDES"_s, &ExtractArguments::AllowSystemIncludes)
.Bind("ALLOW_SYSTEM_LIBS"_s, &ExtractArguments::AllowSystemLibs)
@@ -653,12 +653,12 @@ bool HandleExtractCommand(std::vector<std::string> const& args,
mf.AddDefinition("CMAKE_PKG_CONFIG_DESCRIPTION", resolved.Description());
mf.AddDefinition("CMAKE_PKG_CONFIG_VERSION", version);
- auto make_list = [&](const char* def,
- const std::vector<cmPkgConfigDependency>& deps) {
+ auto make_list = [&](char const* def,
+ std::vector<cmPkgConfigDependency> const& deps) {
std::vector<cm::string_view> vec;
vec.reserve(deps.size());
- for (const auto& dep : deps) {
+ for (auto const& dep : deps) {
vec.emplace_back(dep.Name);
}
diff --git a/Source/cmCMakePkgConfigCommand.h b/Source/cmCMakePkgConfigCommand.h
index 5898818..49ae19b 100644
--- a/Source/cmCMakePkgConfigCommand.h
+++ b/Source/cmCMakePkgConfigCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index ebf639b..de50593 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -1,15 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakePolicyCommand.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
#include "cmPolicies.h"
-#include "cmState.h"
-#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
-#include "cmValue.h"
namespace {
bool HandleSetMode(std::vector<std::string> const& args,
@@ -89,20 +85,6 @@ bool HandleSetMode(std::vector<std::string> const& args,
status.SetError("SET failed to set policy.");
return false;
}
- if (args[1] == "CMP0001" &&
- (policyStatus == cmPolicies::WARN || policyStatus == cmPolicies::OLD)) {
- if (!(status.GetMakefile().GetState()->GetInitializedCacheValue(
- "CMAKE_BACKWARDS_COMPATIBILITY"))) {
- // Set it to 2.4 because that is the last version where the
- // variable had meaning.
- status.GetMakefile().AddCacheDefinition(
- "CMAKE_BACKWARDS_COMPATIBILITY", "2.4",
- "For backwards compatibility, what version of CMake "
- "commands and "
- "syntax should this version of CMake try to support.",
- cmStateEnums::STRING);
- }
- }
return true;
}
@@ -147,19 +129,6 @@ bool HandleGetMode(std::vector<std::string> const& args,
// Report that the policy is set to NEW.
status.GetMakefile().AddDefinition(var, "NEW");
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- // The policy is required to be set before anything needs it.
- {
- status.GetMakefile().IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat(
- cmPolicies::GetRequiredPolicyError(pid), "\n",
- "The call to cmake_policy(GET ", id,
- " ...) at which this "
- "error appears requests the policy, and this version of CMake ",
- "requires that the policy be set to NEW before it is checked."));
- }
}
return true;
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index 7346b66..f0e4d53 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCMakePresetsErrors.cxx b/Source/cmCMakePresetsErrors.cxx
index 668476a..7a1450d 100644
--- a/Source/cmCMakePresetsErrors.cxx
+++ b/Source/cmCMakePresetsErrors.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCMakePresetsErrors.h"
@@ -15,7 +15,7 @@
#include "cmStringAlgorithms.h"
namespace cmCMakePresetsErrors {
-const Json::Value* getPreset(cmJSONState* state)
+Json::Value const* getPreset(cmJSONState* state)
{
if (state->parseStack.size() < 2) {
return nullptr;
@@ -30,7 +30,7 @@ const Json::Value* getPreset(cmJSONState* state)
std::string getPresetName(cmJSONState* state)
{
- const Json::Value* preset = getPreset(state);
+ Json::Value const* preset = getPreset(state);
if (preset && preset->isMember("name")) {
return preset->operator[]("name").asString();
}
@@ -45,58 +45,58 @@ std::string getVariableName(cmJSONState* state)
return errMsg;
}
-void FILE_NOT_FOUND(const std::string& filename, cmJSONState* state)
+void FILE_NOT_FOUND(std::string const& filename, cmJSONState* state)
{
state->AddError(cmStrCat("File not found: ", filename));
}
-void INVALID_ROOT(const Json::Value* value, cmJSONState* state)
+void INVALID_ROOT(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("Invalid root object", value);
}
-void NO_VERSION(const Json::Value* value, cmJSONState* state)
+void NO_VERSION(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("No \"version\" field", value);
}
-void INVALID_VERSION(const Json::Value* value, cmJSONState* state)
+void INVALID_VERSION(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("Invalid \"version\" field", value);
}
-void UNRECOGNIZED_VERSION(const Json::Value* value, cmJSONState* state)
+void UNRECOGNIZED_VERSION(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("Unrecognized \"version\" field", value);
}
-void INVALID_PRESETS(const Json::Value* value, cmJSONState* state)
+void INVALID_PRESETS(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("Invalid \"configurePresets\" field", value);
}
-void INVALID_PRESET(const Json::Value* value, cmJSONState* state)
+void INVALID_PRESET(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("Invalid preset", value);
}
-void INVALID_PRESET_NAMED(const std::string& presetName, cmJSONState* state)
+void INVALID_PRESET_NAMED(std::string const& presetName, cmJSONState* state)
{
state->AddError(cmStrCat("Invalid preset: \"", presetName, "\""));
}
-void INVALID_VARIABLE(const Json::Value* value, cmJSONState* state)
+void INVALID_VARIABLE(Json::Value const* value, cmJSONState* state)
{
std::string var = cmCMakePresetsErrors::getVariableName(state);
state->AddErrorAtValue(cmStrCat("Invalid CMake ", var), value);
}
-void DUPLICATE_PRESETS(const std::string& presetName, cmJSONState* state)
+void DUPLICATE_PRESETS(std::string const& presetName, cmJSONState* state)
{
state->AddError(cmStrCat("Duplicate preset: \"", presetName, "\""));
}
-void CYCLIC_PRESET_INHERITANCE(const std::string& presetName,
+void CYCLIC_PRESET_INHERITANCE(std::string const& presetName,
cmJSONState* state)
{
@@ -104,61 +104,61 @@ void CYCLIC_PRESET_INHERITANCE(const std::string& presetName,
cmStrCat("Cyclic preset inheritance for preset \"", presetName, "\""));
}
-void INHERITED_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName,
+void INHERITED_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
cmJSONState* state)
{
state->AddError(cmStrCat("Inherited preset \"", presetName,
"\" is unreachable from preset's file"));
}
-void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName,
+void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
cmJSONState* state)
{
state->AddError(cmStrCat("Configure preset \"", presetName,
"\" is unreachable from preset's file"));
}
-void INVALID_MACRO_EXPANSION(const std::string& presetName, cmJSONState* state)
+void INVALID_MACRO_EXPANSION(std::string const& presetName, cmJSONState* state)
{
state->AddError(cmStrCat("Invalid macro expansion in \"", presetName, "\""));
}
-void BUILD_TEST_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state)
+void BUILD_TEST_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state)
{
state->AddError("File version must be 2 or higher for build and test preset "
"support");
}
-void PACKAGE_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state)
+void PACKAGE_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state)
{
state->AddError(
"File version must be 6 or higher for package preset support");
}
-void WORKFLOW_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state)
+void WORKFLOW_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state)
{
state->AddError(
"File version must be 6 or higher for workflow preset support");
}
-void INCLUDE_UNSUPPORTED(const Json::Value*, cmJSONState* state)
+void INCLUDE_UNSUPPORTED(Json::Value const*, cmJSONState* state)
{
state->AddError("File version must be 4 or higher for include support");
}
-void INVALID_INCLUDE(const Json::Value* value, cmJSONState* state)
+void INVALID_INCLUDE(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue("Invalid \"include\" field", value);
}
-void INVALID_CONFIGURE_PRESET(const std::string& presetName,
+void INVALID_CONFIGURE_PRESET(std::string const& presetName,
cmJSONState* state)
{
state->AddError(
cmStrCat(R"(Invalid "configurePreset": ")", presetName, "\""));
}
-void INSTALL_PREFIX_UNSUPPORTED(const Json::Value* value, cmJSONState* state)
+void INSTALL_PREFIX_UNSUPPORTED(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue(
"File version must be 3 or higher for installDir preset "
@@ -183,7 +183,7 @@ void GRAPHVIZ_FILE_UNSUPPORTED(cmJSONState* state)
"File version must be 10 or higher for graphviz preset support");
}
-void CYCLIC_INCLUDE(const std::string& file, cmJSONState* state)
+void CYCLIC_INCLUDE(std::string const& file, cmJSONState* state)
{
state->AddError(cmStrCat("Cyclic include among preset files: ", file));
}
@@ -194,33 +194,33 @@ void TEST_OUTPUT_TRUNCATION_UNSUPPORTED(cmJSONState* state)
"preset support");
}
-void INVALID_WORKFLOW_STEPS(const std::string& workflowStep,
+void INVALID_WORKFLOW_STEPS(std::string const& workflowStep,
cmJSONState* state)
{
state->AddError(cmStrCat("Invalid workflow step \"", workflowStep, "\""));
}
-void NO_WORKFLOW_STEPS(const std::string& presetName, cmJSONState* state)
+void NO_WORKFLOW_STEPS(std::string const& presetName, cmJSONState* state)
{
state->AddError(
cmStrCat("No workflow steps specified for \"", presetName, "\""));
}
-void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(const std::string& stepName,
+void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(std::string const& stepName,
cmJSONState* state)
{
state->AddError(cmStrCat("First workflow step \"", stepName,
"\" must be a configure step"));
}
-void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(const std::string& stepName,
+void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(std::string const& stepName,
cmJSONState* state)
{
state->AddError(cmStrCat("Configure workflow step \"", stepName,
"\" must be the first step"));
}
-void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(const std::string& workflowStep,
+void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(std::string const& workflowStep,
cmJSONState* state)
{
state->AddError(cmStrCat("Workflow step \"", workflowStep,
@@ -240,7 +240,7 @@ void TRACE_UNSUPPORTED(cmJSONState* state)
JsonErrors::ErrorGenerator UNRECOGNIZED_VERSION_RANGE(int min, int max)
{
- return [min, max](const Json::Value* value, cmJSONState* state) -> void {
+ return [min, max](Json::Value const* value, cmJSONState* state) -> void {
state->AddErrorAtValue(cmStrCat("Unrecognized \"version\" ",
value->asString(), ": must be >=", min,
" and <=", max),
@@ -249,9 +249,9 @@ JsonErrors::ErrorGenerator UNRECOGNIZED_VERSION_RANGE(int min, int max)
}
JsonErrors::ErrorGenerator UNRECOGNIZED_CMAKE_VERSION(
- const std::string& version, int current, int required)
+ std::string const& version, int current, int required)
{
- return [version, current, required](const Json::Value* value,
+ return [version, current, required](Json::Value const* value,
cmJSONState* state) -> void {
state->AddErrorAtValue(cmStrCat("\"cmakeMinimumRequired\" ", version,
" version ", required,
@@ -260,7 +260,7 @@ JsonErrors::ErrorGenerator UNRECOGNIZED_CMAKE_VERSION(
};
}
-void INVALID_PRESET_NAME(const Json::Value* value, cmJSONState* state)
+void INVALID_PRESET_NAME(Json::Value const* value, cmJSONState* state)
{
std::string errMsg = "Invalid Preset Name";
if (value && value->isConvertibleTo(Json::ValueType::stringValue) &&
@@ -270,7 +270,7 @@ void INVALID_PRESET_NAME(const Json::Value* value, cmJSONState* state)
state->AddErrorAtValue(errMsg, value);
}
-void INVALID_CONDITION(const Json::Value* value, cmJSONState* state)
+void INVALID_CONDITION(Json::Value const* value, cmJSONState* state)
{
state->AddErrorAtValue(
cmStrCat("Invalid condition for preset \"", getPresetName(state), "\""),
@@ -278,42 +278,42 @@ void INVALID_CONDITION(const Json::Value* value, cmJSONState* state)
}
JsonErrors::ErrorGenerator INVALID_CONDITION_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields)
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields)
{
return JsonErrors::INVALID_NAMED_OBJECT(
- [](const Json::Value*, cmJSONState* state) -> std::string {
+ [](Json::Value const*, cmJSONState* state) -> std::string {
return cmStrCat(" condition for preset \"", getPresetName(state), "\"");
})(errorType, extraFields);
}
JsonErrors::ErrorGenerator INVALID_VARIABLE_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields)
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields)
{
return JsonErrors::INVALID_NAMED_OBJECT(
- [](const Json::Value*, cmJSONState* state) -> std::string {
+ [](Json::Value const*, cmJSONState* state) -> std::string {
return getVariableName(state);
})(errorType, extraFields);
}
JsonErrors::ErrorGenerator INVALID_PRESET_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields)
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields)
{
return JsonErrors::INVALID_NAMED_OBJECT(
- [](const Json::Value*, cmJSONState*) -> std::string { return "Preset"; })(
+ [](Json::Value const*, cmJSONState*) -> std::string { return "Preset"; })(
errorType, extraFields);
}
JsonErrors::ErrorGenerator INVALID_ROOT_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields)
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields)
{
return JsonErrors::INVALID_NAMED_OBJECT(
- [](const Json::Value*, cmJSONState*) -> std::string {
+ [](Json::Value const*, cmJSONState*) -> std::string {
return "root object";
})(errorType, extraFields);
}
-void PRESET_MISSING_FIELD(const std::string& presetName,
- const std::string& missingField, cmJSONState* state)
+void PRESET_MISSING_FIELD(std::string const& presetName,
+ std::string const& missingField, cmJSONState* state)
{
state->AddError(cmStrCat("Preset \"", presetName, "\" missing field \"",
missingField, "\""));
diff --git a/Source/cmCMakePresetsErrors.h b/Source/cmCMakePresetsErrors.h
index 22830d2..8bb9de9 100644
--- a/Source/cmCMakePresetsErrors.h
+++ b/Source/cmCMakePresetsErrors.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,58 +13,58 @@
class cmJSONState;
namespace cmCMakePresetsErrors {
-const Json::Value* getPreset(cmJSONState* state);
+Json::Value const* getPreset(cmJSONState* state);
std::string getPresetName(cmJSONState* state);
std::string getVariableName(cmJSONState* state);
-void FILE_NOT_FOUND(const std::string& filename, cmJSONState* state);
+void FILE_NOT_FOUND(std::string const& filename, cmJSONState* state);
-void INVALID_ROOT(const Json::Value* value, cmJSONState* state);
+void INVALID_ROOT(Json::Value const* value, cmJSONState* state);
-void NO_VERSION(const Json::Value* value, cmJSONState* state);
+void NO_VERSION(Json::Value const* value, cmJSONState* state);
-void INVALID_VERSION(const Json::Value* value, cmJSONState* state);
+void INVALID_VERSION(Json::Value const* value, cmJSONState* state);
-void UNRECOGNIZED_VERSION(const Json::Value* value, cmJSONState* state);
+void UNRECOGNIZED_VERSION(Json::Value const* value, cmJSONState* state);
-void INVALID_PRESETS(const Json::Value* value, cmJSONState* state);
+void INVALID_PRESETS(Json::Value const* value, cmJSONState* state);
-void INVALID_PRESET(const Json::Value* value, cmJSONState* state);
+void INVALID_PRESET(Json::Value const* value, cmJSONState* state);
-void INVALID_PRESET_NAMED(const std::string& presetName, cmJSONState* state);
+void INVALID_PRESET_NAMED(std::string const& presetName, cmJSONState* state);
-void INVALID_VARIABLE(const Json::Value* value, cmJSONState* state);
+void INVALID_VARIABLE(Json::Value const* value, cmJSONState* state);
-void DUPLICATE_PRESETS(const std::string& presetName, cmJSONState* state);
+void DUPLICATE_PRESETS(std::string const& presetName, cmJSONState* state);
-void CYCLIC_PRESET_INHERITANCE(const std::string& presetName,
+void CYCLIC_PRESET_INHERITANCE(std::string const& presetName,
cmJSONState* state);
-void INHERITED_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName,
+void INHERITED_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
cmJSONState* state);
-void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName,
+void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
cmJSONState* state);
-void INVALID_MACRO_EXPANSION(const std::string& presetName,
+void INVALID_MACRO_EXPANSION(std::string const& presetName,
cmJSONState* state);
-void BUILD_TEST_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state);
+void BUILD_TEST_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state);
-void PACKAGE_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state);
+void PACKAGE_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state);
-void WORKFLOW_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state);
+void WORKFLOW_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state);
-void INCLUDE_UNSUPPORTED(const Json::Value*, cmJSONState* state);
+void INCLUDE_UNSUPPORTED(Json::Value const*, cmJSONState* state);
-void INVALID_INCLUDE(const Json::Value* value, cmJSONState* state);
+void INVALID_INCLUDE(Json::Value const* value, cmJSONState* state);
-void INVALID_CONFIGURE_PRESET(const std::string& presetName,
+void INVALID_CONFIGURE_PRESET(std::string const& presetName,
cmJSONState* state);
-void INSTALL_PREFIX_UNSUPPORTED(const Json::Value* value, cmJSONState* state);
+void INSTALL_PREFIX_UNSUPPORTED(Json::Value const* value, cmJSONState* state);
void CONDITION_UNSUPPORTED(cmJSONState* state);
@@ -72,22 +72,22 @@ void TOOLCHAIN_FILE_UNSUPPORTED(cmJSONState* state);
void GRAPHVIZ_FILE_UNSUPPORTED(cmJSONState* state);
-void CYCLIC_INCLUDE(const std::string& file, cmJSONState* state);
+void CYCLIC_INCLUDE(std::string const& file, cmJSONState* state);
void TEST_OUTPUT_TRUNCATION_UNSUPPORTED(cmJSONState* state);
-void INVALID_WORKFLOW_STEPS(const std::string& workflowStep,
+void INVALID_WORKFLOW_STEPS(std::string const& workflowStep,
cmJSONState* state);
-void NO_WORKFLOW_STEPS(const std::string& presetName, cmJSONState* state);
+void NO_WORKFLOW_STEPS(std::string const& presetName, cmJSONState* state);
-void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(const std::string& stepName,
+void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(std::string const& stepName,
cmJSONState* state);
-void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(const std::string& stepName,
+void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(std::string const& stepName,
cmJSONState* state);
-void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(const std::string& workflowStep,
+void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(std::string const& workflowStep,
cmJSONState* state);
void CTEST_JUNIT_UNSUPPORTED(cmJSONState* state);
@@ -97,26 +97,26 @@ void TRACE_UNSUPPORTED(cmJSONState* state);
JsonErrors::ErrorGenerator UNRECOGNIZED_VERSION_RANGE(int min, int max);
JsonErrors::ErrorGenerator UNRECOGNIZED_CMAKE_VERSION(
- const std::string& version, int current, int required);
+ std::string const& version, int current, int required);
-void INVALID_PRESET_NAME(const Json::Value* value, cmJSONState* state);
+void INVALID_PRESET_NAME(Json::Value const* value, cmJSONState* state);
-void INVALID_CONDITION(const Json::Value* value, cmJSONState* state);
+void INVALID_CONDITION(Json::Value const* value, cmJSONState* state);
JsonErrors::ErrorGenerator INVALID_CONDITION_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields);
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields);
JsonErrors::ErrorGenerator INVALID_VARIABLE_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields);
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields);
JsonErrors::ErrorGenerator INVALID_PRESET_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields);
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields);
JsonErrors::ErrorGenerator INVALID_ROOT_OBJECT(
- JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields);
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields);
-void PRESET_MISSING_FIELD(const std::string& presetName,
- const std::string& missingField, cmJSONState* state);
+void PRESET_MISSING_FIELD(std::string const& presetName,
+ std::string const& missingField, cmJSONState* state);
void SCHEMA_UNSUPPORTED(cmJSONState* state);
}
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx
index b395276..c112622 100644
--- a/Source/cmCMakePresetsGraph.cxx
+++ b/Source/cmCMakePresetsGraph.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCMakePresetsGraph.h"
#include <algorithm>
@@ -57,7 +57,7 @@ using PresetMacroExpander =
cmCMakePresetsGraphInternal::PresetMacroExpander<T>;
using cmCMakePresetsGraphInternal::ExpandMacros;
-void InheritString(std::string& child, const std::string& parent)
+void InheritString(std::string& child, std::string const& parent)
{
if (child.empty()) {
child = parent;
@@ -66,7 +66,7 @@ void InheritString(std::string& child, const std::string& parent)
template <typename T>
void InheritOptionalValue(cm::optional<T>& child,
- const cm::optional<T>& parent)
+ cm::optional<T> const& parent)
{
if (!child) {
child = parent;
@@ -74,7 +74,7 @@ void InheritOptionalValue(cm::optional<T>& child,
}
template <typename T>
-void InheritVector(std::vector<T>& child, const std::vector<T>& parent)
+void InheritVector(std::vector<T>& child, std::vector<T> const& parent)
{
if (child.empty()) {
child = parent;
@@ -187,25 +187,25 @@ bool ComputePresetInheritance(
return true;
}
-constexpr const char* ValidPrefixes[] = {
+constexpr char const* ValidPrefixes[] = {
"",
"env",
"penv",
"vendor",
};
-bool PrefixesValidMacroNamespace(const std::string& str)
+bool PrefixesValidMacroNamespace(std::string const& str)
{
return std::any_of(
std::begin(ValidPrefixes), std::end(ValidPrefixes),
- [&str](const char* prefix) -> bool { return cmHasPrefix(prefix, str); });
+ [&str](char const* prefix) -> bool { return cmHasPrefix(prefix, str); });
}
-bool IsValidMacroNamespace(const std::string& str)
+bool IsValidMacroNamespace(std::string const& str)
{
return std::any_of(
std::begin(ValidPrefixes), std::end(ValidPrefixes),
- [&str](const char* prefix) -> bool { return str == prefix; });
+ [&str](char const* prefix) -> bool { return str == prefix; });
}
ExpandMacroResult VisitEnv(std::string& value, CycleStatus& status,
@@ -227,8 +227,8 @@ public:
, MacroExpanders(macroExpanders)
{
}
- ExpandMacroResult operator()(const std::string& macroNamespace,
- const std::string& macroName,
+ ExpandMacroResult operator()(std::string const& macroNamespace,
+ std::string const& macroName,
std::string& macroOut,
int version) const override
{
@@ -260,8 +260,8 @@ public:
}
};
-bool ExpandMacros(const cmCMakePresetsGraph& graph,
- const ConfigurePreset& preset,
+bool ExpandMacros(cmCMakePresetsGraph const& graph,
+ ConfigurePreset const& preset,
cm::optional<ConfigurePreset>& out,
MacroExpanderVector const& macroExpanders)
{
@@ -309,7 +309,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph,
return true;
}
-bool ExpandMacros(const cmCMakePresetsGraph& graph, const BuildPreset& preset,
+bool ExpandMacros(cmCMakePresetsGraph const& graph, BuildPreset const& preset,
cm::optional<BuildPreset>& out,
MacroExpanderVector const& macroExpanders)
{
@@ -325,7 +325,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const BuildPreset& preset,
return true;
}
-bool ExpandMacros(const cmCMakePresetsGraph& graph, const TestPreset& preset,
+bool ExpandMacros(cmCMakePresetsGraph const& graph, TestPreset const& preset,
cm::optional<TestPreset>& out,
MacroExpanderVector const& macroExpanders)
{
@@ -378,8 +378,8 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const TestPreset& preset,
return true;
}
-bool ExpandMacros(const cmCMakePresetsGraph& graph,
- const PackagePreset& preset,
+bool ExpandMacros(cmCMakePresetsGraph const& graph,
+ PackagePreset const& preset,
cm::optional<PackagePreset>& out,
MacroExpanderVector const& macroExpanders)
{
@@ -400,8 +400,8 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph,
return true;
}
-bool ExpandMacros(const cmCMakePresetsGraph& /*graph*/,
- const WorkflowPreset& /*preset*/,
+bool ExpandMacros(cmCMakePresetsGraph const& /*graph*/,
+ WorkflowPreset const& /*preset*/,
cm::optional<WorkflowPreset>& /*out*/,
MacroExpanderVector const& /*macroExpanders*/)
{
@@ -409,7 +409,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& /*graph*/,
}
template <class T>
-bool ExpandMacros(cmCMakePresetsGraph& graph, const T& preset,
+bool ExpandMacros(cmCMakePresetsGraph& graph, T const& preset,
cm::optional<T>& out)
{
out.emplace(preset);
@@ -562,8 +562,8 @@ ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacros(
}
ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacro(
- std::string& out, const std::string& macroNamespace,
- const std::string& macroName, MacroExpanderVector const& macroExpanders,
+ std::string& out, std::string const& macroNamespace,
+ std::string const& macroName, MacroExpanderVector const& macroExpanders,
int version)
{
for (auto const& macroExpander : macroExpanders) {
@@ -582,8 +582,8 @@ ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacro(
namespace {
template <typename T>
-bool SetupWorkflowConfigurePreset(const T& preset,
- const ConfigurePreset*& configurePreset,
+bool SetupWorkflowConfigurePreset(T const& preset,
+ ConfigurePreset const*& configurePreset,
cmJSONState* state)
{
if (preset.ConfigurePreset != configurePreset->Name) {
@@ -595,7 +595,7 @@ bool SetupWorkflowConfigurePreset(const T& preset,
template <>
bool SetupWorkflowConfigurePreset<ConfigurePreset>(
- const ConfigurePreset& preset, const ConfigurePreset*& configurePreset,
+ ConfigurePreset const& preset, ConfigurePreset const*& configurePreset,
cmJSONState*)
{
configurePreset = &preset;
@@ -604,9 +604,9 @@ bool SetupWorkflowConfigurePreset<ConfigurePreset>(
template <typename T>
bool TryReachPresetFromWorkflow(
- const WorkflowPreset& origin,
- const std::map<std::string, PresetPair<T>>& presets, const std::string& name,
- const ConfigurePreset*& configurePreset, cmJSONState* state)
+ WorkflowPreset const& origin,
+ std::map<std::string, PresetPair<T>> const& presets, std::string const& name,
+ ConfigurePreset const*& configurePreset, cmJSONState* state)
{
auto it = presets.find(name);
if (it == presets.end()) {
@@ -624,7 +624,7 @@ bool TryReachPresetFromWorkflow(
}
ExpandMacroResult BaseMacroExpander::operator()(
- const std::string& macroNamespace, const std::string& macroName,
+ std::string const& macroNamespace, std::string const& macroName,
std::string& macroOut, int version) const
{
if (macroNamespace.empty()) {
@@ -764,11 +764,11 @@ bool cmCMakePresetsGraphInternal::NotCondition::Evaluate(
}
bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetInherit(
- const cmCMakePresetsGraph::Preset& parentPreset)
+ cmCMakePresetsGraph::Preset const& parentPreset)
{
auto& preset = *this;
- const ConfigurePreset& parent =
- static_cast<const ConfigurePreset&>(parentPreset);
+ ConfigurePreset const& parent =
+ static_cast<ConfigurePreset const&>(parentPreset);
InheritString(preset.Generator, parent.Generator);
InheritString(preset.Architecture, parent.Architecture);
InheritString(preset.Toolset, parent.Toolset);
@@ -840,10 +840,10 @@ bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetAfterInherit(
}
bool cmCMakePresetsGraph::BuildPreset::VisitPresetInherit(
- const cmCMakePresetsGraph::Preset& parentPreset)
+ cmCMakePresetsGraph::Preset const& parentPreset)
{
auto& preset = *this;
- const BuildPreset& parent = static_cast<const BuildPreset&>(parentPreset);
+ BuildPreset const& parent = static_cast<BuildPreset const&>(parentPreset);
InheritString(preset.ConfigurePreset, parent.ConfigurePreset);
InheritOptionalValue(preset.InheritConfigureEnvironment,
@@ -872,10 +872,10 @@ bool cmCMakePresetsGraph::BuildPreset::VisitPresetAfterInherit(
}
bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit(
- const cmCMakePresetsGraph::Preset& parentPreset)
+ cmCMakePresetsGraph::Preset const& parentPreset)
{
auto& preset = *this;
- const TestPreset& parent = static_cast<const TestPreset&>(parentPreset);
+ TestPreset const& parent = static_cast<TestPreset const&>(parentPreset);
InheritString(preset.ConfigurePreset, parent.ConfigurePreset);
InheritOptionalValue(preset.InheritConfigureEnvironment,
@@ -887,7 +887,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit(
if (parent.Output) {
if (preset.Output) {
auto& output = preset.Output.value();
- const auto& parentOutput = parent.Output.value();
+ auto const& parentOutput = parent.Output.value();
InheritOptionalValue(output.ShortProgress, parentOutput.ShortProgress);
InheritOptionalValue(output.Verbosity, parentOutput.Verbosity);
InheritOptionalValue(output.Debug, parentOutput.Debug);
@@ -916,7 +916,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit(
if (parent.Filter->Include) {
if (preset.Filter && preset.Filter->Include) {
auto& include = *preset.Filter->Include;
- const auto& parentInclude = *parent.Filter->Include;
+ auto const& parentInclude = *parent.Filter->Include;
InheritString(include.Name, parentInclude.Name);
InheritString(include.Label, parentInclude.Label);
InheritOptionalValue(include.Index, parentInclude.Index);
@@ -931,7 +931,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit(
if (parent.Filter->Exclude) {
if (preset.Filter && preset.Filter->Exclude) {
auto& exclude = *preset.Filter->Exclude;
- const auto& parentExclude = *parent.Filter->Exclude;
+ auto const& parentExclude = *parent.Filter->Exclude;
InheritString(exclude.Name, parentExclude.Name);
InheritString(exclude.Label, parentExclude.Label);
InheritOptionalValue(exclude.Fixtures, parentExclude.Fixtures);
@@ -947,7 +947,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit(
if (parent.Execution) {
if (preset.Execution) {
auto& execution = *preset.Execution;
- const auto& parentExecution = *parent.Execution;
+ auto const& parentExecution = *parent.Execution;
InheritOptionalValue(execution.StopOnFailure,
parentExecution.StopOnFailure);
InheritOptionalValue(execution.EnableFailover,
@@ -984,11 +984,11 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetAfterInherit(
}
bool cmCMakePresetsGraph::PackagePreset::VisitPresetInherit(
- const cmCMakePresetsGraph::Preset& parentPreset)
+ cmCMakePresetsGraph::Preset const& parentPreset)
{
auto& preset = *this;
- const PackagePreset& parent =
- static_cast<const PackagePreset&>(parentPreset);
+ PackagePreset const& parent =
+ static_cast<PackagePreset const&>(parentPreset);
InheritString(preset.ConfigurePreset, parent.ConfigurePreset);
InheritOptionalValue(preset.InheritConfigureEnvironment,
@@ -1021,7 +1021,7 @@ bool cmCMakePresetsGraph::PackagePreset::VisitPresetAfterInherit(
}
bool cmCMakePresetsGraph::WorkflowPreset::VisitPresetInherit(
- const cmCMakePresetsGraph::Preset& /*parentPreset*/)
+ cmCMakePresetsGraph::Preset const& /*parentPreset*/)
{
return true;
}
@@ -1032,17 +1032,17 @@ bool cmCMakePresetsGraph::WorkflowPreset::VisitPresetAfterInherit(
return true;
}
-std::string cmCMakePresetsGraph::GetFilename(const std::string& sourceDir)
+std::string cmCMakePresetsGraph::GetFilename(std::string const& sourceDir)
{
return cmStrCat(sourceDir, "/CMakePresets.json");
}
-std::string cmCMakePresetsGraph::GetUserFilename(const std::string& sourceDir)
+std::string cmCMakePresetsGraph::GetUserFilename(std::string const& sourceDir)
{
return cmStrCat(sourceDir, "/CMakeUserPresets.json");
}
-bool cmCMakePresetsGraph::ReadProjectPresets(const std::string& sourceDir,
+bool cmCMakePresetsGraph::ReadProjectPresets(std::string const& sourceDir,
bool allowNoFiles)
{
this->SourceDir = sourceDir;
@@ -1090,7 +1090,6 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles)
}
bool result = ComputePresetInheritance(this->ConfigurePresets, *this) &&
- ComputePresetInheritance(this->ConfigurePresets, *this) &&
ComputePresetInheritance(this->BuildPresets, *this) &&
ComputePresetInheritance(this->TestPresets, *this) &&
ComputePresetInheritance(this->PackagePresets, *this) &&
@@ -1109,7 +1108,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles)
for (auto& it : this->BuildPresets) {
if (!it.second.Unexpanded.Hidden) {
- const auto configurePreset =
+ auto const configurePreset =
this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset);
if (configurePreset == this->ConfigurePresets.end()) {
cmCMakePresetsErrors::INVALID_CONFIGURE_PRESET(it.first,
@@ -1139,7 +1138,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles)
for (auto& it : this->TestPresets) {
if (!it.second.Unexpanded.Hidden) {
- const auto configurePreset =
+ auto const configurePreset =
this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset);
if (configurePreset == this->ConfigurePresets.end()) {
cmCMakePresetsErrors::INVALID_CONFIGURE_PRESET(it.first,
@@ -1169,7 +1168,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles)
for (auto& it : this->PackagePresets) {
if (!it.second.Unexpanded.Hidden) {
- const auto configurePreset =
+ auto const configurePreset =
this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset);
if (configurePreset == this->ConfigurePresets.end()) {
cmCMakePresetsErrors::INVALID_CONFIGURE_PRESET(it.first,
@@ -1200,7 +1199,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles)
for (auto& it : this->WorkflowPresets) {
using Type = WorkflowPreset::WorkflowStep::Type;
- const ConfigurePreset* configurePreset = nullptr;
+ ConfigurePreset const* configurePreset = nullptr;
for (auto const& step : it.second.Unexpanded.Steps) {
if (!configurePreset && step.PresetType != Type::Configure) {
cmCMakePresetsErrors::FIRST_WORKFLOW_STEP_NOT_CONFIGURE(
@@ -1283,7 +1282,7 @@ void cmCMakePresetsGraph::printPrecedingNewline(PrintPrecedingNewline* newline)
}
void cmCMakePresetsGraph::PrintPresets(
- const std::vector<const cmCMakePresetsGraph::Preset*>& presets)
+ std::vector<cmCMakePresetsGraph::Preset const*> const& presets)
{
if (presets.empty()) {
return;
@@ -1291,15 +1290,15 @@ void cmCMakePresetsGraph::PrintPresets(
auto longestPresetName =
std::max_element(presets.begin(), presets.end(),
- [](const cmCMakePresetsGraph::Preset* a,
- const cmCMakePresetsGraph::Preset* b) {
+ [](cmCMakePresetsGraph::Preset const* a,
+ cmCMakePresetsGraph::Preset const* b) {
return a->Name.length() < b->Name.length();
});
auto longestLength = (*longestPresetName)->Name.length();
- for (const auto* preset : presets) {
+ for (auto const* preset : presets) {
std::cout << " \"" << preset->Name << '"';
- const auto& description = preset->DisplayName;
+ auto const& description = preset->DisplayName;
if (!description.empty()) {
for (std::size_t i = 0; i < longestLength - preset->Name.length(); ++i) {
std::cout << ' ';
@@ -1313,21 +1312,21 @@ void cmCMakePresetsGraph::PrintPresets(
void cmCMakePresetsGraph::PrintConfigurePresetList(
PrintPrecedingNewline* newline) const
{
- PrintConfigurePresetList([](const ConfigurePreset&) { return true; },
+ PrintConfigurePresetList([](ConfigurePreset const&) { return true; },
newline);
}
void cmCMakePresetsGraph::PrintConfigurePresetList(
- const std::function<bool(const ConfigurePreset&)>& filter,
+ std::function<bool(ConfigurePreset const&)> const& filter,
PrintPrecedingNewline* newline) const
{
- std::vector<const cmCMakePresetsGraph::Preset*> presets;
+ std::vector<cmCMakePresetsGraph::Preset const*> presets;
for (auto const& p : this->ConfigurePresetOrder) {
auto const& preset = this->ConfigurePresets.at(p);
if (!preset.Unexpanded.Hidden && preset.Expanded &&
preset.Expanded->ConditionResult && filter(preset.Unexpanded)) {
presets.push_back(
- static_cast<const cmCMakePresetsGraph::Preset*>(&preset.Unexpanded));
+ static_cast<cmCMakePresetsGraph::Preset const*>(&preset.Unexpanded));
}
}
@@ -1341,13 +1340,13 @@ void cmCMakePresetsGraph::PrintConfigurePresetList(
void cmCMakePresetsGraph::PrintBuildPresetList(
PrintPrecedingNewline* newline) const
{
- std::vector<const cmCMakePresetsGraph::Preset*> presets;
+ std::vector<cmCMakePresetsGraph::Preset const*> presets;
for (auto const& p : this->BuildPresetOrder) {
auto const& preset = this->BuildPresets.at(p);
if (!preset.Unexpanded.Hidden && preset.Expanded &&
preset.Expanded->ConditionResult) {
presets.push_back(
- static_cast<const cmCMakePresetsGraph::Preset*>(&preset.Unexpanded));
+ static_cast<cmCMakePresetsGraph::Preset const*>(&preset.Unexpanded));
}
}
@@ -1361,13 +1360,13 @@ void cmCMakePresetsGraph::PrintBuildPresetList(
void cmCMakePresetsGraph::PrintTestPresetList(
PrintPrecedingNewline* newline) const
{
- std::vector<const cmCMakePresetsGraph::Preset*> presets;
+ std::vector<cmCMakePresetsGraph::Preset const*> presets;
for (auto const& p : this->TestPresetOrder) {
auto const& preset = this->TestPresets.at(p);
if (!preset.Unexpanded.Hidden && preset.Expanded &&
preset.Expanded->ConditionResult) {
presets.push_back(
- static_cast<const cmCMakePresetsGraph::Preset*>(&preset.Unexpanded));
+ static_cast<cmCMakePresetsGraph::Preset const*>(&preset.Unexpanded));
}
}
@@ -1381,21 +1380,21 @@ void cmCMakePresetsGraph::PrintTestPresetList(
void cmCMakePresetsGraph::PrintPackagePresetList(
PrintPrecedingNewline* newline) const
{
- this->PrintPackagePresetList([](const PackagePreset&) { return true; },
+ this->PrintPackagePresetList([](PackagePreset const&) { return true; },
newline);
}
void cmCMakePresetsGraph::PrintPackagePresetList(
- const std::function<bool(const PackagePreset&)>& filter,
+ std::function<bool(PackagePreset const&)> const& filter,
PrintPrecedingNewline* newline) const
{
- std::vector<const cmCMakePresetsGraph::Preset*> presets;
+ std::vector<cmCMakePresetsGraph::Preset const*> presets;
for (auto const& p : this->PackagePresetOrder) {
auto const& preset = this->PackagePresets.at(p);
if (!preset.Unexpanded.Hidden && preset.Expanded &&
preset.Expanded->ConditionResult && filter(preset.Unexpanded)) {
presets.push_back(
- static_cast<const cmCMakePresetsGraph::Preset*>(&preset.Unexpanded));
+ static_cast<cmCMakePresetsGraph::Preset const*>(&preset.Unexpanded));
}
}
@@ -1409,13 +1408,13 @@ void cmCMakePresetsGraph::PrintPackagePresetList(
void cmCMakePresetsGraph::PrintWorkflowPresetList(
PrintPrecedingNewline* newline) const
{
- std::vector<const cmCMakePresetsGraph::Preset*> presets;
+ std::vector<cmCMakePresetsGraph::Preset const*> presets;
for (auto const& p : this->WorkflowPresetOrder) {
auto const& preset = this->WorkflowPresets.at(p);
if (!preset.Unexpanded.Hidden && preset.Expanded &&
preset.Expanded->ConditionResult) {
presets.push_back(
- static_cast<const cmCMakePresetsGraph::Preset*>(&preset.Unexpanded));
+ static_cast<cmCMakePresetsGraph::Preset const*>(&preset.Unexpanded));
}
}
diff --git a/Source/cmCMakePresetsGraph.h b/Source/cmCMakePresetsGraph.h
index 6ff6a0e..2ba6fba 100644
--- a/Source/cmCMakePresetsGraph.h
+++ b/Source/cmCMakePresetsGraph.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -63,8 +63,8 @@ public:
public:
Preset() = default;
Preset(Preset&& /*other*/) = default;
- Preset(const Preset& /*other*/) = default;
- Preset& operator=(const Preset& /*other*/) = default;
+ Preset(Preset const& /*other*/) = default;
+ Preset& operator=(Preset const& /*other*/) = default;
virtual ~Preset() = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
Preset& operator=(Preset&& /*other*/) = default;
@@ -87,7 +87,7 @@ public:
std::map<std::string, cm::optional<std::string>> Environment;
- virtual bool VisitPresetInherit(const Preset& parent) = 0;
+ virtual bool VisitPresetInherit(Preset const& parent) = 0;
virtual bool VisitPresetBeforeInherit() { return true; }
virtual bool VisitPresetAfterInherit(int /* version */,
@@ -102,8 +102,8 @@ public:
public:
ConfigurePreset() = default;
ConfigurePreset(ConfigurePreset&& /*other*/) = default;
- ConfigurePreset(const ConfigurePreset& /*other*/) = default;
- ConfigurePreset& operator=(const ConfigurePreset& /*other*/) = default;
+ ConfigurePreset(ConfigurePreset const& /*other*/) = default;
+ ConfigurePreset& operator=(ConfigurePreset const& /*other*/) = default;
~ConfigurePreset() override = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
ConfigurePreset& operator=(ConfigurePreset&& /*other*/) = default;
@@ -143,7 +143,7 @@ public:
std::vector<std::string> TraceSource;
std::string TraceRedirect;
- bool VisitPresetInherit(const Preset& parent) override;
+ bool VisitPresetInherit(Preset const& parent) override;
bool VisitPresetBeforeInherit() override;
bool VisitPresetAfterInherit(int version, cmJSONState* state) override;
};
@@ -153,8 +153,8 @@ public:
public:
BuildPreset() = default;
BuildPreset(BuildPreset&& /*other*/) = default;
- BuildPreset(const BuildPreset& /*other*/) = default;
- BuildPreset& operator=(const BuildPreset& /*other*/) = default;
+ BuildPreset(BuildPreset const& /*other*/) = default;
+ BuildPreset& operator=(BuildPreset const& /*other*/) = default;
~BuildPreset() override = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
BuildPreset& operator=(BuildPreset&& /*other*/) = default;
@@ -175,7 +175,7 @@ public:
std::vector<std::string> NativeToolOptions;
cm::optional<PackageResolveMode> ResolvePackageReferences;
- bool VisitPresetInherit(const Preset& parent) override;
+ bool VisitPresetInherit(Preset const& parent) override;
bool VisitPresetAfterInherit(int /* version */,
cmJSONState* /*state*/) override;
};
@@ -185,8 +185,8 @@ public:
public:
TestPreset() = default;
TestPreset(TestPreset&& /*other*/) = default;
- TestPreset(const TestPreset& /*other*/) = default;
- TestPreset& operator=(const TestPreset& /*other*/) = default;
+ TestPreset(TestPreset const& /*other*/) = default;
+ TestPreset& operator=(TestPreset const& /*other*/) = default;
~TestPreset() override = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
TestPreset& operator=(TestPreset&& /*other*/) = default;
@@ -309,7 +309,7 @@ public:
cm::optional<FilterOptions> Filter;
cm::optional<ExecutionOptions> Execution;
- bool VisitPresetInherit(const Preset& parent) override;
+ bool VisitPresetInherit(Preset const& parent) override;
bool VisitPresetAfterInherit(int /* version */,
cmJSONState* /*state*/) override;
};
@@ -319,8 +319,8 @@ public:
public:
PackagePreset() = default;
PackagePreset(PackagePreset&& /*other*/) = default;
- PackagePreset(const PackagePreset& /*other*/) = default;
- PackagePreset& operator=(const PackagePreset& /*other*/) = default;
+ PackagePreset(PackagePreset const& /*other*/) = default;
+ PackagePreset& operator=(PackagePreset const& /*other*/) = default;
~PackagePreset() override = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
PackagePreset& operator=(PackagePreset&& /*other*/) = default;
@@ -346,7 +346,7 @@ public:
std::string PackageDirectory;
std::string VendorName;
- bool VisitPresetInherit(const Preset& parent) override;
+ bool VisitPresetInherit(Preset const& parent) override;
bool VisitPresetAfterInherit(int /* version */,
cmJSONState* /*state*/) override;
};
@@ -356,8 +356,8 @@ public:
public:
WorkflowPreset() = default;
WorkflowPreset(WorkflowPreset&& /*other*/) = default;
- WorkflowPreset(const WorkflowPreset& /*other*/) = default;
- WorkflowPreset& operator=(const WorkflowPreset& /*other*/) = default;
+ WorkflowPreset(WorkflowPreset const& /*other*/) = default;
+ WorkflowPreset& operator=(WorkflowPreset const& /*other*/) = default;
~WorkflowPreset() override = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
WorkflowPreset& operator=(WorkflowPreset&& /*other*/) = default;
@@ -384,7 +384,7 @@ public:
std::vector<WorkflowStep> Steps;
- bool VisitPresetInherit(const Preset& parent) override;
+ bool VisitPresetInherit(Preset const& parent) override;
bool VisitPresetAfterInherit(int /* version */,
cmJSONState* /* state */) override;
};
@@ -412,17 +412,17 @@ public:
std::string SourceDir;
std::vector<std::unique_ptr<File>> Files;
- int GetVersion(const Preset& preset) const
+ int GetVersion(Preset const& preset) const
{
return preset.OriginFile->Version;
}
- static std::string GetFilename(const std::string& sourceDir);
- static std::string GetUserFilename(const std::string& sourceDir);
- bool ReadProjectPresets(const std::string& sourceDir,
+ static std::string GetFilename(std::string const& sourceDir);
+ static std::string GetUserFilename(std::string const& sourceDir);
+ bool ReadProjectPresets(std::string const& sourceDir,
bool allowNoFiles = false);
- std::string GetGeneratorForPreset(const std::string& presetName) const
+ std::string GetGeneratorForPreset(std::string const& presetName) const
{
auto configurePresetName = presetName;
@@ -457,17 +457,17 @@ public:
static void printPrecedingNewline(PrintPrecedingNewline* p);
static void PrintPresets(
- const std::vector<const cmCMakePresetsGraph::Preset*>& presets);
+ std::vector<cmCMakePresetsGraph::Preset const*> const& presets);
void PrintConfigurePresetList(
PrintPrecedingNewline* newline = nullptr) const;
void PrintConfigurePresetList(
- const std::function<bool(const ConfigurePreset&)>& filter,
+ std::function<bool(ConfigurePreset const&)> const& filter,
PrintPrecedingNewline* newline = nullptr) const;
void PrintBuildPresetList(PrintPrecedingNewline* newline = nullptr) const;
void PrintTestPresetList(PrintPrecedingNewline* newline = nullptr) const;
void PrintPackagePresetList(PrintPrecedingNewline* newline = nullptr) const;
void PrintPackagePresetList(
- const std::function<bool(const PackagePreset&)>& filter,
+ std::function<bool(PackagePreset const&)> const& filter,
PrintPrecedingNewline* newline = nullptr) const;
void PrintWorkflowPresetList(PrintPrecedingNewline* newline = nullptr) const;
void PrintAllPresets() const;
@@ -486,7 +486,7 @@ private:
};
bool ReadProjectPresetsInternal(bool allowNoFiles);
- bool ReadJSONFile(const std::string& filename, RootType rootType,
+ bool ReadJSONFile(std::string const& filename, RootType rootType,
ReadReason readReason, std::vector<File*>& inProgressFiles,
File*& file, std::string& errMsg);
void ClearPresets();
diff --git a/Source/cmCMakePresetsGraphInternal.h b/Source/cmCMakePresetsGraphInternal.h
index a67be21..eaa215a 100644
--- a/Source/cmCMakePresetsGraphInternal.h
+++ b/Source/cmCMakePresetsGraphInternal.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cstddef>
@@ -31,8 +31,8 @@ enum class ExpandMacroResult
class MacroExpander
{
public:
- virtual ExpandMacroResult operator()(const std::string& macroNamespace,
- const std::string& macroName,
+ virtual ExpandMacroResult operator()(std::string const& macroNamespace,
+ std::string const& macroName,
std::string& macroOut,
int version) const = 0;
virtual ~MacroExpander() = default;
@@ -44,8 +44,8 @@ ExpandMacroResult ExpandMacros(std::string& out,
int version);
ExpandMacroResult ExpandMacro(std::string& out,
- const std::string& macroNamespace,
- const std::string& macroName,
+ std::string const& macroNamespace,
+ std::string const& macroName,
MacroExpanderVector const& macroExpanders,
int version);
}
@@ -56,7 +56,7 @@ public:
virtual ~Condition() = default;
virtual bool Evaluate(
- const cmCMakePresetsGraphInternal::MacroExpanderVector& expanders,
+ cmCMakePresetsGraphInternal::MacroExpanderVector const& expanders,
int version, cm::optional<bool>& out) const = 0;
virtual bool IsNull() const { return false; }
};
@@ -68,17 +68,17 @@ class BaseMacroExpander : public MacroExpander
cm::optional<std::string> File;
public:
- BaseMacroExpander(const cmCMakePresetsGraph& graph)
+ BaseMacroExpander(cmCMakePresetsGraph const& graph)
: Graph(graph)
{
}
- BaseMacroExpander(const cmCMakePresetsGraph& graph, const std::string& file)
+ BaseMacroExpander(cmCMakePresetsGraph const& graph, std::string const& file)
: Graph(graph)
, File(file)
{
}
- ExpandMacroResult operator()(const std::string& macroNamespace,
- const std::string& macroName,
+ ExpandMacroResult operator()(std::string const& macroNamespace,
+ std::string const& macroName,
std::string& macroOut,
int version) const override;
};
@@ -90,13 +90,13 @@ class PresetMacroExpander : public MacroExpander
T const& Preset;
public:
- PresetMacroExpander(const cmCMakePresetsGraph& graph, const T& preset)
+ PresetMacroExpander(cmCMakePresetsGraph const& graph, T const& preset)
: Graph(graph)
, Preset(preset)
{
}
- ExpandMacroResult operator()(const std::string& macroNamespace,
- const std::string& macroName,
+ ExpandMacroResult operator()(std::string const& macroNamespace,
+ std::string const& macroName,
std::string& macroOut,
int version) const override
{
@@ -199,58 +199,58 @@ public:
std::unique_ptr<Condition> SubCondition;
};
-bool PresetStringHelper(std::string& out, const Json::Value* value,
+bool PresetStringHelper(std::string& out, Json::Value const* value,
cmJSONState* state);
-bool PresetNameHelper(std::string& out, const Json::Value* value,
+bool PresetNameHelper(std::string& out, Json::Value const* value,
cmJSONState* state);
bool PresetVectorStringHelper(std::vector<std::string>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
-bool PresetBoolHelper(bool& out, const Json::Value* value, cmJSONState* state);
+bool PresetBoolHelper(bool& out, Json::Value const* value, cmJSONState* state);
bool PresetOptionalBoolHelper(cm::optional<bool>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
-bool PresetIntHelper(int& out, const Json::Value* value, cmJSONState* state);
+bool PresetIntHelper(int& out, Json::Value const* value, cmJSONState* state);
-bool PresetOptionalIntHelper(cm::optional<int>& out, const Json::Value* value,
+bool PresetOptionalIntHelper(cm::optional<int>& out, Json::Value const* value,
cmJSONState* state);
-bool PresetVectorIntHelper(std::vector<int>& out, const Json::Value* value,
+bool PresetVectorIntHelper(std::vector<int>& out, Json::Value const* value,
cmJSONState* state);
bool ConfigurePresetsHelper(
std::vector<cmCMakePresetsGraph::ConfigurePreset>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
bool BuildPresetsHelper(std::vector<cmCMakePresetsGraph::BuildPreset>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
bool TestPresetsHelper(std::vector<cmCMakePresetsGraph::TestPreset>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
bool PackagePresetsHelper(std::vector<cmCMakePresetsGraph::PackagePreset>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
bool WorkflowPresetsHelper(
std::vector<cmCMakePresetsGraph::WorkflowPreset>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
-cmJSONHelper<std::nullptr_t> VendorHelper(const ErrorGenerator& error);
+cmJSONHelper<std::nullptr_t> VendorHelper(ErrorGenerator const& error);
bool PresetConditionHelper(
std::shared_ptr<cmCMakePresetsGraph::Condition>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
bool PresetVectorOneOrMoreStringHelper(std::vector<std::string>& out,
- const Json::Value* value,
+ Json::Value const* value,
cmJSONState* state);
bool EnvironmentMapHelper(
std::map<std::string, cm::optional<std::string>>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
cmJSONHelper<std::nullptr_t> SchemaHelper();
}
diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx
index 18ae9af..e76ba1d 100644
--- a/Source/cmCMakePresetsGraphReadJSON.cxx
+++ b/Source/cmCMakePresetsGraphReadJSON.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <algorithm>
#include <fstream>
#include <functional>
@@ -110,7 +110,7 @@ auto const MatchesConditionHelper =
ConditionStringHelper, true);
bool SubConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out,
- const Json::Value* value, cmJSONState* state);
+ Json::Value const* value, cmJSONState* state);
auto const ListConditionVectorHelper =
JSONHelperBuilder::Vector<std::unique_ptr<cmCMakePresetsGraph::Condition>>(
@@ -132,7 +132,7 @@ auto const NotConditionHelper =
SubConditionHelper);
bool ConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out.reset();
@@ -223,7 +223,7 @@ bool ConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out,
}
bool SubConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
std::unique_ptr<cmCMakePresetsGraph::Condition> ptr;
auto result = ConditionHelper(ptr, value, state);
@@ -236,7 +236,7 @@ bool SubConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out,
}
bool EnvironmentHelper(cm::optional<std::string>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value || value->isNull()) {
out = cm::nullopt;
@@ -259,7 +259,7 @@ auto const VersionHelper = JSONHelperBuilder::Required<int>(
auto const VersionRangeHelper = JSONHelperBuilder::Checked<int>(
cmCMakePresetsErrors::UNRECOGNIZED_VERSION_RANGE(MIN_VERSION, MAX_VERSION),
VersionHelper,
- [](const int v) -> bool { return v >= MIN_VERSION && v <= MAX_VERSION; });
+ [](int const v) -> bool { return v >= MIN_VERSION && v <= MAX_VERSION; });
auto const RootVersionHelper =
JSONHelperBuilder::Object<int>(cmCMakePresetsErrors::INVALID_ROOT_OBJECT)
@@ -308,8 +308,8 @@ auto const RootPresetsHelper =
class EnvironmentMacroExpander : public MacroExpander
{
public:
- ExpandMacroResult operator()(const std::string& macroNamespace,
- const std::string& macroName,
+ ExpandMacroResult operator()(std::string const& macroNamespace,
+ std::string const& macroName,
std::string& macroOut,
int /*version*/) const override
{
@@ -330,14 +330,14 @@ public:
}
namespace cmCMakePresetsGraphInternal {
-bool PresetStringHelper(std::string& out, const Json::Value* value,
+bool PresetStringHelper(std::string& out, Json::Value const* value,
cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::String();
return helper(out, value, state);
}
-bool PresetNameHelper(std::string& out, const Json::Value* value,
+bool PresetNameHelper(std::string& out, Json::Value const* value,
cmJSONState* state)
{
if (!value || !value->isString() || value->asString().empty()) {
@@ -349,7 +349,7 @@ bool PresetNameHelper(std::string& out, const Json::Value* value,
}
bool PresetVectorStringHelper(std::vector<std::string>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Vector<std::string>(
cmCMakePresetsErrors::INVALID_PRESET,
@@ -357,34 +357,34 @@ bool PresetVectorStringHelper(std::vector<std::string>& out,
return helper(out, value, state);
}
-bool PresetBoolHelper(bool& out, const Json::Value* value, cmJSONState* state)
+bool PresetBoolHelper(bool& out, Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Bool();
return helper(out, value, state);
}
bool PresetOptionalBoolHelper(cm::optional<bool>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper =
JSONHelperBuilder::Optional<bool>(PresetBoolHelper);
return helper(out, value, state);
}
-bool PresetIntHelper(int& out, const Json::Value* value, cmJSONState* state)
+bool PresetIntHelper(int& out, Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Int();
return helper(out, value, state);
}
-bool PresetOptionalIntHelper(cm::optional<int>& out, const Json::Value* value,
+bool PresetOptionalIntHelper(cm::optional<int>& out, Json::Value const* value,
cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Optional<int>(PresetIntHelper);
return helper(out, value, state);
}
-bool PresetVectorIntHelper(std::vector<int>& out, const Json::Value* value,
+bool PresetVectorIntHelper(std::vector<int>& out, Json::Value const* value,
cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Vector<int>(
@@ -392,9 +392,9 @@ bool PresetVectorIntHelper(std::vector<int>& out, const Json::Value* value,
return helper(out, value, state);
}
-cmJSONHelper<std::nullptr_t> VendorHelper(const ErrorGenerator& error)
+cmJSONHelper<std::nullptr_t> VendorHelper(ErrorGenerator const& error)
{
- return [error](std::nullptr_t& /*out*/, const Json::Value* value,
+ return [error](std::nullptr_t& /*out*/, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
return true;
@@ -411,7 +411,7 @@ cmJSONHelper<std::nullptr_t> VendorHelper(const ErrorGenerator& error)
bool PresetConditionHelper(
std::shared_ptr<cmCMakePresetsGraph::Condition>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
std::unique_ptr<cmCMakePresetsGraph::Condition> ptr;
auto result = ConditionHelper(ptr, value, state);
@@ -420,7 +420,7 @@ bool PresetConditionHelper(
}
bool PresetVectorOneOrMoreStringHelper(std::vector<std::string>& out,
- const Json::Value* value,
+ Json::Value const* value,
cmJSONState* state)
{
out.clear();
@@ -438,7 +438,7 @@ bool PresetVectorOneOrMoreStringHelper(std::vector<std::string>& out,
bool EnvironmentMapHelper(
std::map<std::string, cm::optional<std::string>>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Map<cm::optional<std::string>>(
cmCMakePresetsErrors::INVALID_PRESET, EnvironmentHelper);
@@ -448,13 +448,13 @@ bool EnvironmentMapHelper(
cmJSONHelper<std::nullptr_t> SchemaHelper()
{
- return [](std::nullptr_t&, const Json::Value*, cmJSONState*) -> bool {
+ return [](std::nullptr_t&, Json::Value const*, cmJSONState*) -> bool {
return true;
};
}
}
-bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename,
+bool cmCMakePresetsGraph::ReadJSONFile(std::string const& filename,
RootType rootType,
ReadReason readReason,
std::vector<File*>& inProgressFiles,
@@ -724,7 +724,7 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename,
}
auto const includeFile = [this, &inProgressFiles,
- file](const std::string& include,
+ file](std::string const& include,
RootType rootType2, ReadReason readReason2,
std::string& FailureMessage) -> bool {
bool r;
diff --git a/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx b/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx
index c743ac1..dd95137 100644
--- a/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx
+++ b/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstddef>
#include <functional>
#include <map>
@@ -24,7 +24,7 @@ using BuildPreset = cmCMakePresetsGraph::BuildPreset;
using JSONHelperBuilder = cmJSONHelperBuilder;
bool PackageResolveModeHelper(cm::optional<PackageResolveMode>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out = cm::nullopt;
@@ -50,9 +50,9 @@ bool PackageResolveModeHelper(cm::optional<PackageResolveMode>& out,
return true;
}
-std::function<bool(BuildPreset&, const Json::Value*, cmJSONState*)> const
+std::function<bool(BuildPreset&, Json::Value const*, cmJSONState*)> const
ResolvePackageReferencesHelper = [](BuildPreset& out,
- const Json::Value* value,
+ Json::Value const* value,
cmJSONState* state) -> bool {
return PackageResolveModeHelper(out.ResolvePackageReferences, value, state);
};
@@ -102,7 +102,7 @@ auto const BuildPresetHelper =
namespace cmCMakePresetsGraphInternal {
bool BuildPresetsHelper(std::vector<BuildPreset>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Vector<BuildPreset>(
cmCMakePresetsErrors::INVALID_PRESETS, BuildPresetHelper);
diff --git a/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx b/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx
index 8f49d69..5b62d09 100644
--- a/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx
+++ b/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstddef>
#include <functional>
#include <map>
@@ -29,7 +29,7 @@ using TraceEnableMode = cmCMakePresetsGraph::TraceEnableMode;
using TraceOutputFormat = cmTraceEnums::TraceOutputFormat;
bool ArchToolsetStrategyHelper(cm::optional<ArchToolsetStrategy>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out = cm::nullopt;
@@ -55,7 +55,7 @@ bool ArchToolsetStrategyHelper(cm::optional<ArchToolsetStrategy>& out,
return false;
}
-std::function<bool(ConfigurePreset&, const Json::Value*, cmJSONState*)>
+std::function<bool(ConfigurePreset&, Json::Value const*, cmJSONState*)>
ArchToolsetHelper(
std::string ConfigurePreset::*valueField,
cm::optional<ArchToolsetStrategy> ConfigurePreset::*strategyField)
@@ -67,7 +67,7 @@ ArchToolsetHelper(
cmCMakePresetsGraphInternal::PresetStringHelper, false)
.Bind("strategy", strategyField, ArchToolsetStrategyHelper, false);
return [valueField, strategyField,
- objectHelper](ConfigurePreset& out, const Json::Value* value,
+ objectHelper](ConfigurePreset& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
(out.*valueField).clear();
@@ -96,7 +96,7 @@ auto const ToolsetHelper = ArchToolsetHelper(
&ConfigurePreset::Toolset, &ConfigurePreset::ToolsetStrategy);
bool TraceEnableModeHelper(cm::optional<TraceEnableMode>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out = cm::nullopt;
@@ -123,7 +123,7 @@ bool TraceEnableModeHelper(cm::optional<TraceEnableMode>& out,
}
bool TraceOutputFormatHelper(cm::optional<TraceOutputFormat>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out = cm::nullopt;
@@ -149,7 +149,7 @@ bool TraceOutputFormatHelper(cm::optional<TraceOutputFormat>& out,
auto const VariableStringHelper = JSONHelperBuilder::String();
-bool VariableValueHelper(std::string& out, const Json::Value* value,
+bool VariableValueHelper(std::string& out, Json::Value const* value,
cmJSONState* state)
{
if (!value) {
@@ -171,7 +171,7 @@ auto const VariableObjectHelper =
.Bind("type"_s, &CacheVariable::Type, VariableStringHelper, false)
.Bind("value"_s, &CacheVariable::Value, VariableValueHelper);
-bool VariableHelper(cm::optional<CacheVariable>& out, const Json::Value* value,
+bool VariableHelper(cm::optional<CacheVariable>& out, Json::Value const* value,
cmJSONState* state)
{
if (value->isBool()) {
@@ -294,7 +294,7 @@ auto const ConfigurePresetHelper =
namespace cmCMakePresetsGraphInternal {
bool ConfigurePresetsHelper(std::vector<ConfigurePreset>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Vector<ConfigurePreset>(
cmCMakePresetsErrors::INVALID_PRESETS, ConfigurePresetHelper);
diff --git a/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx b/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx
index ac49c62..e26c0c4 100644
--- a/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx
+++ b/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstddef>
#include <map>
#include <memory>
@@ -81,7 +81,7 @@ auto const PackagePresetHelper =
namespace cmCMakePresetsGraphInternal {
bool PackagePresetsHelper(std::vector<cmCMakePresetsGraph::PackagePreset>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = cmJSONHelperBuilder::Vector<PackagePreset>(
cmCMakePresetsErrors::INVALID_PRESETS, PackagePresetHelper);
diff --git a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx
index f9e0753..22717f2 100644
--- a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx
+++ b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstddef>
#include <map>
#include <memory>
@@ -25,7 +25,7 @@ using TestPreset = cmCMakePresetsGraph::TestPreset;
using JSONHelperBuilder = cmJSONHelperBuilder;
bool TestPresetOutputVerbosityHelper(
- TestPreset::OutputOptions::VerbosityEnum& out, const Json::Value* value,
+ TestPreset::OutputOptions::VerbosityEnum& out, Json::Value const* value,
cmJSONState* state)
{
if (!value) {
@@ -62,7 +62,7 @@ auto const TestPresetOptionalOutputVerbosityHelper =
TestPresetOutputVerbosityHelper);
bool TestPresetOutputTruncationHelper(
- cm::optional<cmCTestTypes::TruncationMode>& out, const Json::Value* value,
+ cm::optional<cmCTestTypes::TruncationMode>& out, Json::Value const* value,
cmJSONState* state)
{
if (!value) {
@@ -144,7 +144,7 @@ auto const TestPresetOptionalFilterIncludeIndexObjectHelper =
bool TestPresetOptionalFilterIncludeIndexHelper(
cm::optional<TestPreset::IncludeOptions::IndexOptions>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out = cm::nullopt;
@@ -197,7 +197,7 @@ auto const TestPresetOptionalFilterExcludeHelper =
TestPresetOptionalFilterExcludeFixturesHelper, false));
bool TestPresetExecutionShowOnlyHelper(
- TestPreset::ExecutionOptions::ShowOnlyEnum& out, const Json::Value* value,
+ TestPreset::ExecutionOptions::ShowOnlyEnum& out, Json::Value const* value,
cmJSONState* state)
{
if (!value || !value->isString()) {
@@ -225,7 +225,7 @@ auto const TestPresetOptionalExecutionShowOnlyHelper =
bool TestPresetExecutionModeHelper(
TestPreset::ExecutionOptions::RepeatOptions::ModeEnum& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
return true;
@@ -265,7 +265,7 @@ auto const TestPresetOptionalExecutionRepeatHelper =
bool TestPresetExecutionNoTestsActionHelper(
TestPreset::ExecutionOptions::NoTestsActionEnum& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
out = TestPreset::ExecutionOptions::NoTestsActionEnum::Default;
@@ -377,7 +377,7 @@ auto const TestPresetHelper =
namespace cmCMakePresetsGraphInternal {
bool TestPresetsHelper(std::vector<cmCMakePresetsGraph::TestPreset>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = JSONHelperBuilder::Vector<TestPreset>(
cmCMakePresetsErrors::INVALID_PRESETS, TestPresetHelper);
diff --git a/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx b/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx
index e152871..e428da4 100644
--- a/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx
+++ b/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstddef>
#include <string>
#include <vector>
@@ -19,7 +19,7 @@ namespace {
using WorkflowPreset = cmCMakePresetsGraph::WorkflowPreset;
bool WorkflowStepTypeHelper(WorkflowPreset::WorkflowStep::Type& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
if (!value) {
cmCMakePresetsErrors::INVALID_PRESET(value, state);
@@ -85,7 +85,7 @@ auto const WorkflowPresetHelper =
namespace cmCMakePresetsGraphInternal {
bool WorkflowPresetsHelper(
std::vector<cmCMakePresetsGraph::WorkflowPreset>& out,
- const Json::Value* value, cmJSONState* state)
+ Json::Value const* value, cmJSONState* state)
{
static auto const helper = cmJSONHelperBuilder::Vector<WorkflowPreset>(
cmCMakePresetsErrors::INVALID_PRESETS, WorkflowPresetHelper);
diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx
index fbf7d73..c1e662d 100644
--- a/Source/cmCPackPropertiesGenerator.cxx
+++ b/Source/cmCPackPropertiesGenerator.cxx
@@ -19,7 +19,7 @@ cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
}
void cmCPackPropertiesGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
std::string const& expandedFileName =
this->InstalledFile.GetNameExpression().Evaluate(this->LG, config);
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
index 63c469a..55feb4e 100644
--- a/Source/cmCPackPropertiesGenerator.h
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,7 +29,7 @@ public:
delete;
protected:
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
cmLocalGenerator* LG;
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
deleted file mode 100644
index 2e6cd40..0000000
--- a/Source/cmCPluginAPI.cxx
+++ /dev/null
@@ -1,874 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-/*
- this file contains the implementation of the C API to CMake. Generally
- these routines just manipulate arguments and then call the associated
- methods on the CMake classes. */
-
-#include "cmCPluginAPI.h"
-
-#include <cstdlib>
-
-#include "cmExecutionStatus.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmSourceFile.h"
-#include "cmState.h"
-#include "cmValue.h"
-#include "cmVersion.h"
-
-#ifdef __QNX__
-# include <malloc.h> /* for malloc/free on QNX */
-#endif
-
-extern "C" {
-
-static void CCONV* cmGetClientData(void* info)
-{
- return ((cmLoadedCommandInfo*)info)->ClientData;
-}
-
-static void CCONV cmSetClientData(void* info, void* cd)
-{
- ((cmLoadedCommandInfo*)info)->ClientData = cd;
-}
-
-static void CCONV cmSetError(void* info, const char* err)
-{
- if (((cmLoadedCommandInfo*)info)->Error) {
- free(((cmLoadedCommandInfo*)info)->Error);
- }
- ((cmLoadedCommandInfo*)info)->Error = strdup(err);
-}
-
-static unsigned int CCONV cmGetCacheMajorVersion(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmState* state = mf->GetState();
- return state->GetCacheMajorVersion();
-}
-static unsigned int CCONV cmGetCacheMinorVersion(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmState* state = mf->GetState();
- return state->GetCacheMinorVersion();
-}
-
-static unsigned int CCONV cmGetMajorVersion(void*)
-{
- return cmVersion::GetMajorVersion();
-}
-
-static unsigned int CCONV cmGetMinorVersion(void*)
-{
- return cmVersion::GetMinorVersion();
-}
-
-static void CCONV cmAddDefinition(void* arg, const char* name,
- const char* value)
-{
- if (value) {
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->AddDefinition(name, value);
- }
-}
-
-/* Add a definition to this makefile and the global cmake cache. */
-static void CCONV cmAddCacheDefinition(void* arg, const char* name,
- const char* value, const char* doc,
- int type)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- std::string valueString;
- std::string docString;
- cmValue v;
- cmValue d;
- if (value != nullptr) {
- valueString = value;
- v = cmValue{ valueString };
- }
- if (doc != nullptr) {
- docString = doc;
- d = cmValue{ docString };
- }
-
- switch (type) {
- case CM_CACHE_BOOL:
- mf->AddCacheDefinition(name, v, d, cmStateEnums::BOOL);
- break;
- case CM_CACHE_PATH:
- mf->AddCacheDefinition(name, v, d, cmStateEnums::PATH);
- break;
- case CM_CACHE_FILEPATH:
- mf->AddCacheDefinition(name, v, d, cmStateEnums::FILEPATH);
- break;
- case CM_CACHE_STRING:
- mf->AddCacheDefinition(name, v, d, cmStateEnums::STRING);
- break;
- case CM_CACHE_INTERNAL:
- mf->AddCacheDefinition(name, v, d, cmStateEnums::INTERNAL);
- break;
- case CM_CACHE_STATIC:
- mf->AddCacheDefinition(name, v, d, cmStateEnums::STATIC);
- break;
- }
-}
-
-static const char* CCONV cmGetProjectName(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- static std::string name;
- name = mf->GetStateSnapshot().GetProjectName();
- return name.c_str();
-}
-
-static const char* CCONV cmGetHomeDirectory(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetHomeDirectory().c_str();
-}
-static const char* CCONV cmGetHomeOutputDirectory(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetHomeOutputDirectory().c_str();
-}
-static const char* CCONV cmGetStartDirectory(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentSourceDirectory().c_str();
-}
-static const char* CCONV cmGetStartOutputDirectory(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentBinaryDirectory().c_str();
-}
-static const char* CCONV cmGetCurrentDirectory(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentSourceDirectory().c_str();
-}
-static const char* CCONV cmGetCurrentOutputDirectory(void* arg)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentBinaryDirectory().c_str();
-}
-static const char* CCONV cmGetDefinition(void* arg, const char* def)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetDefinition(def).GetCStr();
-}
-
-static int CCONV cmIsOn(void* arg, const char* name)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return static_cast<int>(mf->IsOn(name));
-}
-
-/** Check if a command exists. */
-static int CCONV cmCommandExists(void* arg, const char* name)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return static_cast<int>(mf->GetState()->GetCommand(name) ? 1 : 0);
-}
-
-static void CCONV cmAddDefineFlag(void* arg, const char* definition)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->AddDefineFlag(definition);
-}
-
-static void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
- const char* d)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmTarget* t = mf->FindLocalNonAliasTarget(tgt);
- if (!t) {
- cmSystemTools::Error(
- "Attempt to add link directories to non-existent target: " +
- std::string(tgt) + " for directory " + std::string(d));
- return;
- }
- t->InsertLinkDirectory(BT<std::string>(d, mf->GetBacktrace()));
-}
-
-static void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
- const char** srcs, int win32)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- std::vector<std::string> srcs2;
- int i;
- for (i = 0; i < numSrcs; ++i) {
- srcs2.emplace_back(srcs[i]);
- }
- cmTarget* tg = mf->AddExecutable(exename, srcs2);
- if (win32) {
- tg->SetProperty("WIN32_EXECUTABLE", "ON");
- }
-}
-
-static void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
- const char* command,
- const char* arguments, int all,
- int numDepends, const char** depends,
- int, const char**)
-{
- // Get the makefile instance. Perform an extra variable expansion
- // now because the API caller expects it.
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
-
- // Construct the command line for the command.
- cmCustomCommandLine commandLine;
- std::string expand = command;
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- if (arguments && arguments[0]) {
- // TODO: Parse arguments!
- expand = arguments;
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- }
- cmCustomCommandLines commandLines;
- commandLines.push_back(commandLine);
-
- // Accumulate the list of dependencies.
- std::vector<std::string> depends2;
- for (int i = 0; i < numDepends; ++i) {
- expand = depends[i];
- depends2.push_back(mf->ExpandVariablesInString(expand));
- }
-
- // Pass the call to the makefile instance.
- auto cc = cm::make_unique<cmCustomCommand>();
- cc->SetDepends(depends2);
- cc->SetCommandLines(commandLines);
- mf->AddUtilityCommand(utilityName, !all, std::move(cc));
-}
-
-static void CCONV cmAddCustomCommand(void* arg, const char* source,
- const char* command, int numArgs,
- const char** args, int numDepends,
- const char** depends, int numOutputs,
- const char** outputs, const char* target)
-{
- // Get the makefile instance. Perform an extra variable expansion
- // now because the API caller expects it.
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
-
- // Construct the command line for the command.
- cmCustomCommandLine commandLine;
- std::string expand = command;
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- for (int i = 0; i < numArgs; ++i) {
- expand = args[i];
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- }
- cmCustomCommandLines commandLines;
- commandLines.push_back(commandLine);
-
- // Accumulate the list of dependencies.
- std::vector<std::string> depends2;
- for (int i = 0; i < numDepends; ++i) {
- expand = depends[i];
- depends2.push_back(mf->ExpandVariablesInString(expand));
- }
-
- // Accumulate the list of outputs.
- std::vector<std::string> outputs2;
- for (int i = 0; i < numOutputs; ++i) {
- expand = outputs[i];
- outputs2.push_back(mf->ExpandVariablesInString(expand));
- }
-
- // Pass the call to the makefile instance.
- const char* no_comment = nullptr;
- mf->AddCustomCommandOldStyle(target, outputs2, depends2, source,
- commandLines, no_comment);
-}
-
-static void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
- const char* command, int numArgs,
- const char** args,
- const char* main_dependency,
- int numDepends,
- const char** depends)
-{
- // Get the makefile instance. Perform an extra variable expansion
- // now because the API caller expects it.
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
-
- // Construct the command line for the command.
- cmCustomCommandLine commandLine;
- std::string expand = command;
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- for (int i = 0; i < numArgs; ++i) {
- expand = args[i];
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- }
- cmCustomCommandLines commandLines;
- commandLines.push_back(commandLine);
-
- // Accumulate the list of dependencies.
- std::vector<std::string> depends2;
- for (int i = 0; i < numDepends; ++i) {
- expand = depends[i];
- depends2.push_back(mf->ExpandVariablesInString(expand));
- }
-
- // Pass the call to the makefile instance.
- auto cc = cm::make_unique<cmCustomCommand>();
- cc->SetOutputs(output);
- cc->SetMainDependency(main_dependency);
- cc->SetDepends(depends2);
- cc->SetCommandLines(commandLines);
- mf->AddCustomCommandToOutput(std::move(cc));
-}
-
-static void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
- const char* command, int numArgs,
- const char** args,
- int commandType)
-{
- // Get the makefile instance.
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
-
- // Construct the command line for the command. Perform an extra
- // variable expansion now because the API caller expects it.
- cmCustomCommandLine commandLine;
- std::string expand = command;
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- for (int i = 0; i < numArgs; ++i) {
- expand = args[i];
- commandLine.push_back(mf->ExpandVariablesInString(expand));
- }
- cmCustomCommandLines commandLines;
- commandLines.push_back(commandLine);
-
- // Select the command type.
- cmCustomCommandType cctype = cmCustomCommandType::POST_BUILD;
- switch (commandType) {
- case CM_PRE_BUILD:
- cctype = cmCustomCommandType::PRE_BUILD;
- break;
- case CM_PRE_LINK:
- cctype = cmCustomCommandType::PRE_LINK;
- break;
- case CM_POST_BUILD:
- cctype = cmCustomCommandType::POST_BUILD;
- break;
- }
-
- // Pass the call to the makefile instance.
- auto cc = cm::make_unique<cmCustomCommand>();
- cc->SetCommandLines(commandLines);
- mf->AddCustomCommandToTarget(target, cctype, std::move(cc));
-}
-
-static void addLinkLibrary(cmMakefile* mf, std::string const& target,
- std::string const& lib, cmTargetLinkLibraryType llt)
-{
- cmTarget* t = mf->FindLocalNonAliasTarget(target);
- if (!t) {
- std::ostringstream e;
- e << "Attempt to add link library \"" << lib << "\" to target \"" << target
- << "\" which is not built in this directory.";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
- return;
- }
-
- cmTarget* tgt = mf->GetGlobalGenerator()->FindTarget(lib);
- if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
- (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
- (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
- !tgt->IsExecutableWithExports()) {
- std::ostringstream e;
- e << "Target \"" << lib << "\" of type "
- << cmState::GetTargetTypeName(tgt->GetType())
- << " may not be linked into another target. "
- << "One may link only to STATIC or SHARED libraries, or "
- << "to executables with the ENABLE_EXPORTS property set.";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
- }
-
- t->AddLinkLibrary(*mf, lib, llt);
-}
-
-static void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
- const char* value, int libtype)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
-
- switch (libtype) {
- case CM_LIBRARY_GENERAL:
- addLinkLibrary(mf, tgt, value, GENERAL_LibraryType);
- break;
- case CM_LIBRARY_DEBUG:
- addLinkLibrary(mf, tgt, value, DEBUG_LibraryType);
- break;
- case CM_LIBRARY_OPTIMIZED:
- addLinkLibrary(mf, tgt, value, OPTIMIZED_LibraryType);
- break;
- }
-}
-
-static void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
- int numSrcs, const char** srcs)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- std::vector<std::string> srcs2;
- int i;
- for (i = 0; i < numSrcs; ++i) {
- srcs2.emplace_back(srcs[i]);
- }
- mf->AddLibrary(
- libname,
- (shared ? cmStateEnums::SHARED_LIBRARY : cmStateEnums::STATIC_LIBRARY),
- srcs2);
-}
-
-static char CCONV* cmExpandVariablesInString(void* arg, const char* source,
- int escapeQuotes, int atOnly)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- std::string barf = source;
- std::string const& result =
- mf->ExpandVariablesInString(barf, escapeQuotes != 0, atOnly != 0);
- return strdup(result.c_str());
-}
-
-static int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
- const char** args)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
-
- std::vector<cmListFileArgument> lffArgs;
- lffArgs.reserve(numArgs);
- for (int i = 0; i < numArgs; ++i) {
- // Assume all arguments are quoted.
- lffArgs.emplace_back(args[i], cmListFileArgument::Quoted, 0);
- }
-
- cmListFileFunction lff{ name, 0, 0, std::move(lffArgs) };
- cmExecutionStatus status(*mf);
- return mf->ExecuteCommand(lff, status);
-}
-
-static void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
- const char** args, int* resArgc,
- char*** resArgv,
- unsigned int startArgumentIndex)
-{
- (void)arg;
- (void)startArgumentIndex;
- std::vector<std::string> result;
- int i;
- for (i = 0; i < numArgs; ++i) {
- result.emplace_back(args[i]);
- }
- int resargc = static_cast<int>(result.size());
- char** resargv = nullptr;
- if (resargc) {
- resargv = (char**)malloc(resargc * sizeof(char*));
- }
- for (i = 0; i < resargc; ++i) {
- resargv[i] = strdup(result[i].c_str());
- }
- *resArgc = resargc;
- *resArgv = resargv;
-}
-
-static void CCONV cmFreeArguments(int argc, char** argv)
-{
- int i;
- for (i = 0; i < argc; ++i) {
- free(argv[i]);
- }
- free(argv);
-}
-
-static int CCONV cmGetTotalArgumentSize(int argc, char** argv)
-{
- int i;
- int result = 0;
- for (i = 0; i < argc; ++i) {
- if (argv[i]) {
- result = result + static_cast<int>(strlen(argv[i]));
- }
- }
- return result;
-}
-
-// Source file proxy object to support the old cmSourceFile/cmMakefile
-// API for source files.
-struct cmCPluginAPISourceFile
-{
- cmSourceFile* RealSourceFile = nullptr;
- std::string SourceName;
- std::string SourceExtension;
- std::string FullPath;
- std::vector<std::string> Depends;
- cmPropertyMap Properties;
-};
-
-// Keep a map from real cmSourceFile instances stored in a makefile to
-// the CPluginAPI proxy source file.
-using cmCPluginAPISourceFileMap =
- std::map<cmSourceFile*, std::unique_ptr<cmCPluginAPISourceFile>>;
-static cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
-
-static void* CCONV cmCreateSourceFile()
-{
- return new cmCPluginAPISourceFile;
-}
-
-static void* CCONV cmCreateNewSourceFile(void*)
-{
- return new cmCPluginAPISourceFile;
-}
-
-static void CCONV cmDestroySourceFile(void* arg)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- // Only delete if it was created by cmCreateSourceFile or
- // cmCreateNewSourceFile and is therefore not in the map.
- if (!sf->RealSourceFile) {
- delete sf;
- }
-}
-
-static void CCONV* cmGetSource(void* arg, const char* name)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- if (cmSourceFile* rsf = mf->GetSource(name)) {
- // Lookup the proxy source file object for this source.
- auto i = cmCPluginAPISourceFiles.find(rsf);
- if (i == cmCPluginAPISourceFiles.end()) {
- // Create a proxy source file object for this source.
- auto sf = cm::make_unique<cmCPluginAPISourceFile>();
- sf->RealSourceFile = rsf;
- sf->FullPath = rsf->ResolveFullPath();
- sf->SourceName =
- cmSystemTools::GetFilenameWithoutLastExtension(sf->FullPath);
- sf->SourceExtension =
- cmSystemTools::GetFilenameLastExtension(sf->FullPath);
-
- // Store the proxy in the map so it can be reused and deleted later.
- i = cmCPluginAPISourceFiles.emplace(rsf, std::move(sf)).first;
- }
- return i->second.get();
- }
- return nullptr;
-}
-
-static void* CCONV cmAddSource(void* arg, void* arg2)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmCPluginAPISourceFile* osf = static_cast<cmCPluginAPISourceFile*>(arg2);
- if (osf->FullPath.empty()) {
- return nullptr;
- }
-
- // Create the real cmSourceFile instance and copy over saved information.
- cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath);
- rsf->SetProperties(osf->Properties);
- // In case the properties contain the GENERATED property,
- // mark the real cmSourceFile as generated.
- if (rsf->GetIsGenerated()) {
- rsf->MarkAsGenerated();
- }
- for (std::string const& d : osf->Depends) {
- rsf->AddDepend(d);
- }
-
- // Create the proxy for the real source file.
- auto sf = cm::make_unique<cmCPluginAPISourceFile>();
- sf->RealSourceFile = rsf;
- sf->FullPath = osf->FullPath;
- sf->SourceName = osf->SourceName;
- sf->SourceExtension = osf->SourceExtension;
-
- // Store the proxy in the map so it can be reused and deleted later.
- auto* value = sf.get();
- cmCPluginAPISourceFiles[rsf] = std::move(sf);
- return value;
-}
-
-static const char* CCONV cmSourceFileGetSourceName(void* arg)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- return sf->SourceName.c_str();
-}
-
-static const char* CCONV cmSourceFileGetFullPath(void* arg)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- return sf->FullPath.c_str();
-}
-
-static const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- if (cmSourceFile* rsf = sf->RealSourceFile) {
- return rsf->GetProperty(prop).GetCStr();
- }
- if (!strcmp(prop, "LOCATION")) {
- return sf->FullPath.c_str();
- }
- return sf->Properties.GetPropertyValue(prop).GetCStr();
-}
-
-static int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- if (cmSourceFile* rsf = sf->RealSourceFile) {
- return rsf->GetPropertyAsBool(prop) ? 1 : 0;
- }
- return cmIsOn(cmSourceFileGetProperty(arg, prop)) ? 1 : 0;
-}
-
-static void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
- const char* value)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- if (cmSourceFile* rsf = sf->RealSourceFile) {
- if (!value) {
- rsf->RemoveProperty(prop);
- } else {
- rsf->SetProperty(prop, value);
- }
- } else if (prop) {
- if (!value) {
- value = "NOTFOUND";
- }
- sf->Properties.SetProperty(prop, value);
- }
-}
-
-static void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- if (cmSourceFile* rsf = sf->RealSourceFile) {
- rsf->AddDepend(depend);
- } else {
- sf->Depends.emplace_back(depend);
- }
-}
-
-static void CCONV cmSourceFileSetName(void* arg, const char* name,
- const char* dir, int numSourceExtensions,
- const char** sourceExtensions,
- int numHeaderExtensions,
- const char** headerExtensions)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- if (sf->RealSourceFile) {
- // SetName is allowed only on temporary source files created by
- // the command for building and passing to AddSource.
- return;
- }
- std::vector<std::string> sourceExts;
- std::vector<std::string> headerExts;
- int i;
- for (i = 0; i < numSourceExtensions; ++i) {
- sourceExts.emplace_back(sourceExtensions[i]);
- }
- for (i = 0; i < numHeaderExtensions; ++i) {
- headerExts.emplace_back(headerExtensions[i]);
- }
-
- // Save the original name given.
- sf->SourceName = name;
-
- // Convert the name to a full path in case the given name is a
- // relative path.
- std::string pathname = cmSystemTools::CollapseFullPath(name, dir);
-
- // First try and see whether the listed file can be found
- // as is without extensions added on.
- std::string hname = pathname;
- if (cmSystemTools::FileExists(hname)) {
- sf->SourceName = cmSystemTools::GetFilenamePath(name);
- if (!sf->SourceName.empty()) {
- sf->SourceName += "/";
- }
- sf->SourceName += cmSystemTools::GetFilenameWithoutLastExtension(name);
- std::string::size_type pos = hname.rfind('.');
- if (pos != std::string::npos) {
- sf->SourceExtension = hname.substr(pos + 1, hname.size() - pos);
- if (cmSystemTools::FileIsFullPath(name)) {
- std::string::size_type pos2 = hname.rfind('/');
- if (pos2 != std::string::npos) {
- sf->SourceName = hname.substr(pos2 + 1, pos - pos2 - 1);
- }
- }
- }
-
- sf->FullPath = hname;
- return;
- }
-
- // Next, try the various source extensions
- for (std::string const& ext : sourceExts) {
- hname = cmStrCat(pathname, '.', ext);
- if (cmSystemTools::FileExists(hname)) {
- sf->SourceExtension = ext;
- sf->FullPath = hname;
- return;
- }
- }
-
- // Finally, try the various header extensions
- for (std::string const& ext : headerExts) {
- hname = cmStrCat(pathname, '.', ext);
- if (cmSystemTools::FileExists(hname)) {
- sf->SourceExtension = ext;
- sf->FullPath = hname;
- return;
- }
- }
-
- std::ostringstream e;
- e << "Cannot find source file \"" << pathname << "\"";
- e << "\n\nTried extensions";
- for (std::string const& ext : sourceExts) {
- e << " ." << ext;
- }
- for (std::string const& ext : headerExts) {
- e << " ." << ext;
- }
- cmSystemTools::Error(e.str());
-}
-
-static void CCONV cmSourceFileSetName2(void* arg, const char* name,
- const char* dir, const char* ext,
- int headerFileOnly)
-{
- cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
- if (sf->RealSourceFile) {
- // SetName is allowed only on temporary source files created by
- // the command for building and passing to AddSource.
- return;
- }
-
- // Implement the old SetName method code here.
- if (headerFileOnly) {
- sf->Properties.SetProperty("HEADER_FILE_ONLY", "1");
- }
- sf->SourceName = name;
- std::string fname = sf->SourceName;
- if (cmNonempty(ext)) {
- fname += ".";
- fname += ext;
- }
- sf->FullPath = cmSystemTools::CollapseFullPath(fname, dir);
- cmSystemTools::ConvertToUnixSlashes(sf->FullPath);
- sf->SourceExtension = ext;
-}
-
-static char* CCONV cmGetFilenameWithoutExtension(const char* name)
-{
- std::string sres = cmSystemTools::GetFilenameWithoutExtension(name);
- return strdup(sres.c_str());
-}
-
-static char* CCONV cmGetFilenamePath(const char* name)
-{
- std::string sres = cmSystemTools::GetFilenamePath(name);
- return strdup(sres.c_str());
-}
-
-static char* CCONV cmCapitalized(const char* name)
-{
- std::string sres = cmSystemTools::Capitalized(name);
- return strdup(sres.c_str());
-}
-
-static void CCONV cmCopyFileIfDifferent(const char* name1, const char* name2)
-{
- cmSystemTools::CopyFileIfDifferent(name1, name2);
-}
-
-static void CCONV cmRemoveFile(const char* name)
-{
- cmSystemTools::RemoveFile(name);
-}
-
-static void CCONV cmDisplayStatus(void* arg, const char* message)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->DisplayStatus(message, -1);
-}
-
-static void CCONV cmFree(void* data)
-{
- free(data);
-}
-
-static void CCONV DefineSourceFileProperty(void* arg, const char* name,
- const char* briefDocs,
- const char* longDocs, int chained)
-{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->GetState()->DefineProperty(name, cmProperty::SOURCE_FILE,
- briefDocs ? briefDocs : "",
- longDocs ? longDocs : "", chained != 0);
-}
-
-} // close the extern "C" scope
-
-static cmCAPI cmStaticCAPI = {
- cmGetClientData,
- cmGetTotalArgumentSize,
- cmFreeArguments,
- cmSetClientData,
- cmSetError,
- cmAddCacheDefinition,
- cmAddCustomCommand,
- cmAddDefineFlag,
- cmAddDefinition,
- cmAddExecutable,
- cmAddLibrary,
- cmAddLinkDirectoryForTarget,
- cmAddLinkLibraryForTarget,
- cmAddUtilityCommand,
- cmCommandExists,
- cmExecuteCommand,
- cmExpandSourceListArguments,
- cmExpandVariablesInString,
- cmGetCacheMajorVersion,
- cmGetCacheMinorVersion,
- cmGetCurrentDirectory,
- cmGetCurrentOutputDirectory,
- cmGetDefinition,
- cmGetHomeDirectory,
- cmGetHomeOutputDirectory,
- cmGetMajorVersion,
- cmGetMinorVersion,
- cmGetProjectName,
- cmGetStartDirectory,
- cmGetStartOutputDirectory,
- cmIsOn,
-
- cmAddSource,
- cmCreateSourceFile,
- cmDestroySourceFile,
- cmGetSource,
- cmSourceFileAddDepend,
- cmSourceFileGetProperty,
- cmSourceFileGetPropertyAsBool,
- cmSourceFileGetSourceName,
- cmSourceFileGetFullPath,
- cmSourceFileSetName,
- cmSourceFileSetName2,
- cmSourceFileSetProperty,
-
- cmCapitalized,
- cmCopyFileIfDifferent,
- cmGetFilenameWithoutExtension,
- cmGetFilenamePath,
- cmRemoveFile,
- cmFree,
-
- cmAddCustomCommandToOutput,
- cmAddCustomCommandToTarget,
- cmDisplayStatus,
- cmCreateNewSourceFile,
- DefineSourceFileProperty,
-};
diff --git a/Source/cmCPluginAPI.h b/Source/cmCPluginAPI.h
deleted file mode 100644
index 92dff57..0000000
--- a/Source/cmCPluginAPI.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-/* This header file defines the API that loadable commands can use. In many
- of these commands C++ instances of cmMakefile of cmSourceFile are passed
- in as arguments or returned. In these cases they are passed as a void *
- argument. In the function prototypes mf is used to represent a makefile
- and sf is used to represent a source file. The functions are grouped
- loosely into four groups 1) Utility 2) cmMakefile 3) cmSourceFile 4)
- cmSystemTools. Within each grouping functions are listed alphabetically */
-/*=========================================================================*/
-#ifndef cmCPluginAPI_h /* NOLINT(cmake-use-pragma-once) */
-#define cmCPluginAPI_h
-
-#define CMAKE_VERSION_MAJOR 2
-#define CMAKE_VERSION_MINOR 5
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __WATCOMC__
-# define CCONV __cdecl
-#else
-# define CCONV
-#endif
-/*=========================================================================
-this is the structure of function entry points that a plugin may call. This
-structure must be kept in sync with the static decaled at the bottom of
-cmCPLuginAPI.cxx
-=========================================================================*/
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef struct
-{
- /*=========================================================================
- Here we define the set of functions that a plugin may call. The first group
- of functions are utility functions that are specific to the plugin API
- =========================================================================*/
- /* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
- information is passed from the InitialPass to FinalPass for commands
- that need a FinalPass and need information from the InitialPass */
- void*(CCONV* GetClientData)(void* info);
- /* return the summed size in characters of all the arguments */
- int(CCONV* GetTotalArgumentSize)(int argc, char** argv);
- /* free all the memory associated with an argc, argv pair */
- void(CCONV* FreeArguments)(int argc, char** argv);
- /* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
- information is passed from the InitialPass to FinalPass for commands
- that need a FinalPass and need information from the InitialPass */
- void(CCONV* SetClientData)(void* info, void* cd);
- /* when an error occurs, call this function to set the error string */
- void(CCONV* SetError)(void* info, const char* err);
-
- /*=========================================================================
- The following functions all directly map to methods in the cmMakefile
- class. See cmMakefile.h for descriptions of what each method does. All of
- these methods take the void * makefile pointer as their first argument.
- =========================================================================*/
- void(CCONV* AddCacheDefinition)(void* mf, const char* name,
- const char* value, const char* doc,
- int cachetype);
- void(CCONV* AddCustomCommand)(void* mf, const char* source,
- const char* command, int numArgs,
- const char** args, int numDepends,
- const char** depends, int numOutputs,
- const char** outputs, const char* target);
- void(CCONV* AddDefineFlag)(void* mf, const char* definition);
- void(CCONV* AddDefinition)(void* mf, const char* name, const char* value);
- void(CCONV* AddExecutable)(void* mf, const char* exename, int numSrcs,
- const char** srcs, int win32);
- void(CCONV* AddLibrary)(void* mf, const char* libname, int shared,
- int numSrcs, const char** srcs);
- void(CCONV* AddLinkDirectoryForTarget)(void* mf, const char* tgt,
- const char* d);
- void(CCONV* AddLinkLibraryForTarget)(void* mf, const char* tgt,
- const char* libname, int libtype);
- void(CCONV* AddUtilityCommand)(void* mf, const char* utilityName,
- const char* command, const char* arguments,
- int all, int numDepends, const char** depends,
- int numOutputs, const char** outputs);
- int(CCONV* CommandExists)(void* mf, const char* name);
- int(CCONV* ExecuteCommand)(void* mf, const char* name, int numArgs,
- const char** args);
- void(CCONV* ExpandSourceListArguments)(void* mf, int argc, const char** argv,
- int* resArgc, char*** resArgv,
- unsigned int startArgumentIndex);
- char*(CCONV* ExpandVariablesInString)(void* mf, const char* source,
- int escapeQuotes, int atOnly);
- unsigned int(CCONV* GetCacheMajorVersion)(void* mf);
- unsigned int(CCONV* GetCacheMinorVersion)(void* mf);
- const char*(CCONV* GetCurrentDirectory)(void* mf);
- const char*(CCONV* GetCurrentOutputDirectory)(void* mf);
- const char*(CCONV* GetDefinition)(void* mf, const char* def);
- const char*(CCONV* GetHomeDirectory)(void* mf);
- const char*(CCONV* GetHomeOutputDirectory)(void* mf);
- unsigned int(CCONV* GetMajorVersion)(void* mf);
- unsigned int(CCONV* GetMinorVersion)(void* mf);
- const char*(CCONV* GetProjectName)(void* mf);
- const char*(CCONV* GetStartDirectory)(void* mf);
- const char*(CCONV* GetStartOutputDirectory)(void* mf);
- int(CCONV* IsOn)(void* mf, const char* name);
-
- /*=========================================================================
- The following functions are designed to operate or manipulate
- cmSourceFiles. Please see cmSourceFile.h for additional information on many
- of these methods. Some of these methods are in cmMakefile.h.
- =========================================================================*/
- void*(CCONV* AddSource)(void* mf, void* sf);
- void*(CCONV* CreateSourceFile)();
- void(CCONV* DestroySourceFile)(void* sf);
- void*(CCONV* GetSource)(void* mf, const char* sourceName);
- void(CCONV* SourceFileAddDepend)(void* sf, const char* depend);
- const char*(CCONV* SourceFileGetProperty)(void* sf, const char* prop);
- int(CCONV* SourceFileGetPropertyAsBool)(void* sf, const char* prop);
- const char*(CCONV* SourceFileGetSourceName)(void* sf);
- const char*(CCONV* SourceFileGetFullPath)(void* sf);
- void(CCONV* SourceFileSetName)(void* sf, const char* name, const char* dir,
- int numSourceExtensions,
- const char** sourceExtensions,
- int numHeaderExtensions,
- const char** headerExtensions);
- void(CCONV* SourceFileSetName2)(void* sf, const char* name, const char* dir,
- const char* ext, int headerFileOnly);
- void(CCONV* SourceFileSetProperty)(void* sf, const char* prop,
- const char* value);
-
- /*=========================================================================
- The following methods are from cmSystemTools.h see that file for specific
- documentation on each method.
- =========================================================================*/
- char*(CCONV* Capitalized)(const char*);
- void(CCONV* CopyFileIfDifferent)(const char* f1, const char* f2);
- char*(CCONV* GetFilenameWithoutExtension)(const char*);
- char*(CCONV* GetFilenamePath)(const char*);
- void(CCONV* RemoveFile)(const char* f1);
- void(CCONV* Free)(void*);
-
- /*=========================================================================
- The following are new functions added after 1.6
- =========================================================================*/
- void(CCONV* AddCustomCommandToOutput)(void* mf, const char* output,
- const char* command, int numArgs,
- const char** args,
- const char* main_dependency,
- int numDepends, const char** depends);
- void(CCONV* AddCustomCommandToTarget)(void* mf, const char* target,
- const char* command, int numArgs,
- const char** args, int commandType);
-
- /* display status information */
- void(CCONV* DisplaySatus)(void* info, const char* message);
-
- /* new functions added after 2.4 */
- void*(CCONV* CreateNewSourceFile)(void* mf);
- void(CCONV* DefineSourceFileProperty)(void* mf, const char* name,
- const char* briefDocs,
- const char* longDocs, int chained);
-
- /* this is the end of the C function stub API structure */
-} cmCAPI;
-
-/*=========================================================================
-CM_PLUGIN_EXPORT should be used by plugins
-=========================================================================*/
-#ifdef _WIN32
-# define CM_PLUGIN_EXPORT __declspec(dllexport)
-#else
-# define CM_PLUGIN_EXPORT
-#endif
-
-/*=========================================================================
-define the different types of cache entries, see cmCacheManager.h for more
-information
-=========================================================================*/
-#define CM_CACHE_BOOL 0
-#define CM_CACHE_PATH 1
-#define CM_CACHE_FILEPATH 2
-#define CM_CACHE_STRING 3
-#define CM_CACHE_INTERNAL 4
-#define CM_CACHE_STATIC 5
-
-/*=========================================================================
-define the different types of compiles a library may be
-=========================================================================*/
-#define CM_LIBRARY_GENERAL 0
-#define CM_LIBRARY_DEBUG 1
-#define CM_LIBRARY_OPTIMIZED 2
-
-/*=========================================================================
-define the different types of custom commands for a target
-=========================================================================*/
-#define CM_PRE_BUILD 0
-#define CM_PRE_LINK 1
-#define CM_POST_BUILD 2
-
-/*=========================================================================
-Finally we define the key data structures and function prototypes
-=========================================================================*/
-
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef const char*(CCONV* CM_DOC_FUNCTION)();
-
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef int(CCONV* CM_INITIAL_PASS_FUNCTION)(void* info, void* mf, int argc,
- char*[]);
-
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef void(CCONV* CM_FINAL_PASS_FUNCTION)(void* info, void* mf);
-
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef void(CCONV* CM_DESTRUCTOR_FUNCTION)(void* info);
-
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef struct
-{
- unsigned long reserved1; /* Reserved for future use. DO NOT USE. */
- unsigned long reserved2; /* Reserved for future use. DO NOT USE. */
- cmCAPI* CAPI;
- int m_Inherited; /* this ivar is no longer used in CMake 2.2 or later */
- CM_INITIAL_PASS_FUNCTION InitialPass;
- CM_FINAL_PASS_FUNCTION FinalPass;
- CM_DESTRUCTOR_FUNCTION Destructor;
- CM_DOC_FUNCTION GetTerseDocumentation;
- CM_DOC_FUNCTION GetFullDocumentation;
- const char* Name;
- char* Error;
- void* ClientData;
-} cmLoadedCommandInfo;
-
-/* NOLINTNEXTLINE(modernize-use-using) */
-typedef void(CCONV* CM_INIT_FUNCTION)(cmLoadedCommandInfo*);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 829fbf9..1bf8d36 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCTest.h"
#include <algorithm>
@@ -10,6 +10,7 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include <initializer_list>
#include <iostream>
#include <map>
#include <ratio>
@@ -25,13 +26,13 @@
#include <cmext/string_view>
#include <cm3p/curl/curl.h>
+#include <cm3p/json/value.h>
#include <cm3p/uv.h>
#include <cm3p/zlib.h>
#include "cmsys/Base64.h"
#include "cmsys/Directory.hxx"
#include "cmsys/FStream.hxx"
-#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include "cmsys/SystemInformation.hxx"
#if defined(_WIN32)
@@ -41,23 +42,20 @@
#endif
#include "cmCMakePresetsGraph.h"
-#include "cmCTestBuildAndTestHandler.h"
-#include "cmCTestBuildHandler.h"
-#include "cmCTestConfigureHandler.h"
-#include "cmCTestCoverageHandler.h"
-#include "cmCTestGenericHandler.h"
-#include "cmCTestMemCheckHandler.h"
+#include "cmCTestBuildAndTest.h"
#include "cmCTestScriptHandler.h"
-#include "cmCTestStartCommand.h"
-#include "cmCTestSubmitHandler.h"
#include "cmCTestTestHandler.h"
-#include "cmCTestUpdateHandler.h"
-#include "cmCTestUploadHandler.h"
+#include "cmCTestTypes.h"
+#include "cmCommandLineArgument.h"
#include "cmDynamicLoader.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
#include "cmJSONState.h"
#include "cmList.h"
+#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
#include "cmState.h"
@@ -71,6 +69,7 @@
#include "cmValue.h"
#include "cmVersion.h"
#include "cmVersionConfig.h"
+#include "cmWorkingDirectory.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -80,11 +79,16 @@
struct cmCTest::Private
{
+ Private(cmCTest* ctest)
+ : BuildAndTest(ctest)
+ {
+ }
+
/** Representation of one part. */
struct PartInfo
{
- void SetName(const std::string& name) { this->Name = name; }
- const std::string& GetName() const { return this->Name; }
+ void SetName(std::string const& name) { this->Name = name; }
+ std::string const& GetName() const { return this->Name; }
void Enable() { this->Enabled = true; }
explicit operator bool() const { return this->Enabled; }
@@ -111,47 +115,13 @@ struct cmCTest::Private
bool UseHTTP10 = false;
bool PrintLabels = false;
bool Failover = false;
+ bool UseVerboseInstrumentation = false;
+ cmJSONState parseState;
bool FlushTestProgressLine = false;
- bool ForceNewCTestProcess = false;
-
- bool RunConfigurationScript = false;
-
// these are helper classes
- cmCTestBuildHandler BuildHandler;
- cmCTestBuildAndTestHandler BuildAndTestHandler;
- cmCTestCoverageHandler CoverageHandler;
- cmCTestScriptHandler ScriptHandler;
- cmCTestTestHandler TestHandler;
- cmCTestUpdateHandler UpdateHandler;
- cmCTestConfigureHandler ConfigureHandler;
- cmCTestMemCheckHandler MemCheckHandler;
- cmCTestSubmitHandler SubmitHandler;
- cmCTestUploadHandler UploadHandler;
-
- std::vector<cmCTestGenericHandler*> GetTestingHandlers()
- {
- return { &this->BuildHandler, &this->BuildAndTestHandler,
- &this->CoverageHandler, &this->ScriptHandler,
- &this->TestHandler, &this->UpdateHandler,
- &this->ConfigureHandler, &this->MemCheckHandler,
- &this->SubmitHandler, &this->UploadHandler };
- }
-
- std::map<std::string, cmCTestGenericHandler*> GetNamedTestingHandlers()
- {
- return { { "build", &this->BuildHandler },
- { "buildtest", &this->BuildAndTestHandler },
- { "coverage", &this->CoverageHandler },
- { "script", &this->ScriptHandler },
- { "test", &this->TestHandler },
- { "update", &this->UpdateHandler },
- { "configure", &this->ConfigureHandler },
- { "memcheck", &this->MemCheckHandler },
- { "submit", &this->SubmitHandler },
- { "upload", &this->UploadHandler } };
- }
+ cmCTestBuildAndTest BuildAndTest;
bool ShowOnly = false;
bool OutputAsJson = false;
@@ -177,6 +147,10 @@ struct cmCTest::Private
cmDuration GlobalTimeout = cmDuration::zero();
+ std::chrono::steady_clock::time_point StartTime =
+ std::chrono::steady_clock::now();
+ cmDuration TimeLimit = cmCTest::MaxDuration();
+
int MaxTestNameWidth = 30;
cm::optional<size_t> ParallelLevel = 1;
@@ -199,14 +173,7 @@ struct cmCTest::Private
bool CompressXMLFiles = false;
bool CompressTestOutput = true;
- // By default we write output to the process output streams.
- std::ostream* StreamOut = &std::cout;
- std::ostream* StreamErr = &std::cerr;
-
- bool SuppressUpdatingCTestConfiguration = false;
-
bool Debug = false;
- bool ShowLineNumbers = false;
bool Quiet = false;
std::string BuildID;
@@ -216,7 +183,7 @@ struct cmCTest::Private
int SubmitIndex = 0;
std::unique_ptr<cmGeneratedFileStream> OutputLogFile;
- int OutputLogFileLastTag = -1;
+ cm::optional<cmCTest::LogType> OutputLogFileLastTag;
bool OutputTestOutputOnTestFailure = false;
bool OutputColorCode = cmCTest::ColoredOutputSupportedByConsole();
@@ -225,6 +192,11 @@ struct cmCTest::Private
cmCTest::NoTests NoTestsMode = cmCTest::NoTests::Legacy;
bool NoTestsModeSetInCli = false;
+
+ cmCTestTestOptions TestOptions;
+ std::vector<std::string> CommandLineHttpHeaders;
+
+ std::unique_ptr<cmInstrumentation> Instrumentation;
};
struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
@@ -252,7 +224,7 @@ struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
tctime = time(nullptr);
cmCTestLog(this, DEBUG, " Get the current time: " << tctime << std::endl);
- const int dayLength = 24 * 60 * 60;
+ int const dayLength = 24 * 60 * 60;
cmCTestLog(this, DEBUG, "Seconds: " << tctime << std::endl);
while (ntime > tctime) {
// If nightlySeconds is in the past, this is the current
@@ -286,7 +258,7 @@ bool cmCTest::GetTomorrowTag() const
return this->Impl->TomorrowTag;
}
-std::string cmCTest::CleanString(const std::string& str,
+std::string cmCTest::CleanString(std::string const& str,
std::string::size_type spos)
{
spos = str.find_first_not_of(" \n\t\r\f\v", spos);
@@ -324,10 +296,10 @@ std::string cmCTest::GetCostDataFile()
return fname;
}
-std::string cmCTest::DecodeURL(const std::string& in)
+std::string cmCTest::DecodeURL(std::string const& in)
{
std::string out;
- for (const char* c = in.c_str(); *c; ++c) {
+ for (char const* c = in.c_str(); *c; ++c) {
if (*c == '%' && isxdigit(*(c + 1)) && isxdigit(*(c + 2))) {
char buf[3] = { *(c + 1), *(c + 2), 0 };
out.append(1, static_cast<char>(strtoul(buf, nullptr, 16)));
@@ -340,7 +312,7 @@ std::string cmCTest::DecodeURL(const std::string& in)
}
cmCTest::cmCTest()
- : Impl(new Private)
+ : Impl(cm::make_unique<Private>(this))
{
std::string envValue;
if (cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE", envValue)) {
@@ -350,6 +322,11 @@ cmCTest::cmCTest()
if (cmSystemTools::GetEnv("CTEST_PROGRESS_OUTPUT", envValue)) {
this->Impl->TestProgressOutput = !cmIsOff(envValue);
}
+ envValue.clear();
+ if (cmSystemTools::GetEnv("CTEST_USE_VERBOSE_INSTRUMENTATION", envValue)) {
+ this->Impl->UseVerboseInstrumentation = !cmIsOff(envValue);
+ }
+ envValue.clear();
this->Impl->Parts[PartStart].SetName("Start");
this->Impl->Parts[PartUpdate].SetName("Update");
@@ -370,10 +347,6 @@ cmCTest::cmCTest()
->PartMap[cmSystemTools::LowerCase(this->Impl->Parts[p].GetName())] = p;
}
- for (auto& handler : this->Impl->GetTestingHandlers()) {
- handler->SetCTestInstance(this);
- }
-
// Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput();
}
@@ -405,7 +378,7 @@ bool cmCTest::ShouldCompressTestOutput()
return this->Impl->CompressTestOutput;
}
-cmCTest::Part cmCTest::GetPartFromName(const std::string& name)
+cmCTest::Part cmCTest::GetPartFromName(std::string const& name)
{
// Look up by lower-case to make names case-insensitive.
std::string lower_name = cmSystemTools::LowerCase(name);
@@ -418,15 +391,13 @@ cmCTest::Part cmCTest::GetPartFromName(const std::string& name)
return PartCount;
}
-int cmCTest::Initialize(const std::string& binary_dir,
- cmCTestStartCommand* command)
+void cmCTest::Initialize(std::string const& binary_dir)
{
- bool quiet = false;
- if (command && command->ShouldBeQuiet()) {
- quiet = true;
+ this->Impl->BuildID = "";
+ for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
+ this->Impl->Parts[p].SubmitFiles.clear();
}
- cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
if (!this->Impl->InteractiveDebugMode) {
this->BlockTestErrorDiagnostics();
} else {
@@ -435,277 +406,127 @@ int cmCTest::Initialize(const std::string& binary_dir,
this->Impl->BinaryDir = binary_dir;
cmSystemTools::ConvertToUnixSlashes(this->Impl->BinaryDir);
+}
- this->UpdateCTestConfiguration();
+bool cmCTest::CreateNewTag(bool quiet)
+{
+ std::string const testingDir = this->Impl->BinaryDir + "/Testing";
+ std::string const tagfile = testingDir + "/TAG";
- cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
- if (this->Impl->ProduceXML) {
- cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
- cmCTestOptionalLog(this, OUTPUT,
- " Site: "
- << this->GetCTestConfiguration("Site") << std::endl
- << " Build name: "
- << cmCTest::SafeBuildIdField(
- this->GetCTestConfiguration("BuildName"))
- << std::endl,
- quiet);
- cmCTestOptionalLog(this, DEBUG, "Produce XML is on" << std::endl, quiet);
- if (this->Impl->TestModel == cmCTest::NIGHTLY &&
- this->GetCTestConfiguration("NightlyStartTime").empty()) {
- cmCTestOptionalLog(
- this, WARNING,
- "WARNING: No nightly start time found please set in CTestConfig.cmake"
- " or DartConfig.cmake"
- << std::endl,
- quiet);
- cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl,
- quiet);
- return 0;
- }
- }
-
- cmake cm(cmake::RoleScript, cmState::CTest);
- cm.SetHomeDirectory("");
- cm.SetHomeOutputDirectory("");
- cm.GetCurrentSnapshot().SetDefaultDefinitions();
- cmGlobalGenerator gg(&cm);
- cmMakefile mf(&gg, cm.GetCurrentSnapshot());
- if (!this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf)) {
- cmCTestOptionalLog(
- this, DEBUG, "Cannot find custom configuration file tree" << std::endl,
- quiet);
- return 0;
+ auto const result = cmSystemTools::MakeDirectory(testingDir);
+ if (!result.IsSuccess()) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Cannot create directory \""
+ << testingDir << "\": " << result.GetString() << std::endl);
+ return false;
}
- if (this->Impl->ProduceXML) {
- // Verify "Testing" directory exists:
- //
- std::string testingDir = this->Impl->BinaryDir + "/Testing";
- if (cmSystemTools::FileExists(testingDir)) {
- if (!cmSystemTools::FileIsDirectory(testingDir)) {
- cmCTestLog(this, ERROR_MESSAGE,
- "File " << testingDir
- << " is in the place of the testing directory"
- << std::endl);
- return 0;
- }
- } else {
- if (!cmSystemTools::MakeDirectory(testingDir)) {
- cmCTestLog(this, ERROR_MESSAGE,
- "Cannot create directory " << testingDir << std::endl);
- return 0;
- }
- }
+ cmCTestOptionalLog(this, DEBUG,
+ "TestModel: " << this->GetTestGroupString() << std::endl,
+ quiet);
+ cmCTestOptionalLog(
+ this, DEBUG, "TestModel: " << this->Impl->TestModel << std::endl, quiet);
- // Create new "TAG" file or read existing one:
- //
- bool createNewTag = true;
- if (command) {
- createNewTag = command->ShouldCreateNewTag();
+ struct tm* lctime = [this]() -> tm* {
+ if (this->Impl->TestModel == cmCTest::NIGHTLY) {
+ return this->GetNightlyTime(
+ this->GetCTestConfiguration("NightlyStartTime"),
+ this->Impl->TomorrowTag);
}
-
- std::string tagfile = testingDir + "/TAG";
- cmsys::ifstream tfin(tagfile.c_str());
- std::string tag;
-
- if (createNewTag) {
- time_t tctime = time(nullptr);
- if (this->Impl->TomorrowTag) {
- tctime += (24 * 60 * 60);
- }
- struct tm* lctime = gmtime(&tctime);
- if (tfin && cmSystemTools::GetLineFromStream(tfin, tag)) {
- int year = 0;
- int mon = 0;
- int day = 0;
- int hour = 0;
- int min = 0;
- sscanf(tag.c_str(), "%04d%02d%02d-%02d%02d", &year, &mon, &day, &hour,
- &min);
- if (year != lctime->tm_year + 1900 || mon != lctime->tm_mon + 1 ||
- day != lctime->tm_mday) {
- tag.clear();
- }
- std::string group;
- if (cmSystemTools::GetLineFromStream(tfin, group) &&
- !this->Impl->Parts[PartStart] && !command) {
- this->Impl->SpecificGroup = group;
- }
- std::string model;
- if (cmSystemTools::GetLineFromStream(tfin, model) &&
- !this->Impl->Parts[PartStart] && !command) {
- this->Impl->TestModel = GetTestModelFromString(model);
- }
- tfin.close();
- }
- if (tag.empty() || command || this->Impl->Parts[PartStart]) {
- cmCTestOptionalLog(
- this, DEBUG,
- "TestModel: " << this->GetTestModelString() << std::endl, quiet);
- cmCTestOptionalLog(this, DEBUG,
- "TestModel: " << this->Impl->TestModel << std::endl,
- quiet);
- if (this->Impl->TestModel == cmCTest::NIGHTLY) {
- lctime = this->GetNightlyTime(
- this->GetCTestConfiguration("NightlyStartTime"),
- this->Impl->TomorrowTag);
- }
- char datestring[100];
- snprintf(datestring, sizeof(datestring), "%04d%02d%02d-%02d%02d",
- lctime->tm_year + 1900, lctime->tm_mon + 1, lctime->tm_mday,
- lctime->tm_hour, lctime->tm_min);
- tag = datestring;
- cmsys::ofstream ofs(tagfile.c_str());
- if (ofs) {
- ofs << tag << std::endl;
- ofs << this->GetTestModelString() << std::endl;
- switch (this->Impl->TestModel) {
- case cmCTest::EXPERIMENTAL:
- ofs << "Experimental" << std::endl;
- break;
- case cmCTest::NIGHTLY:
- ofs << "Nightly" << std::endl;
- break;
- case cmCTest::CONTINUOUS:
- ofs << "Continuous" << std::endl;
- break;
- }
- }
- ofs.close();
- if (!command) {
- cmCTestOptionalLog(this, OUTPUT,
- "Create new tag: " << tag << " - "
- << this->GetTestModelString()
- << std::endl,
- quiet);
- }
- }
- } else {
- std::string group;
- std::string modelStr;
- int model = cmCTest::UNKNOWN;
-
- if (tfin) {
- cmSystemTools::GetLineFromStream(tfin, tag);
- cmSystemTools::GetLineFromStream(tfin, group);
- if (cmSystemTools::GetLineFromStream(tfin, modelStr)) {
- model = GetTestModelFromString(modelStr);
- }
- tfin.close();
- }
-
- if (tag.empty()) {
- cmCTestLog(this, ERROR_MESSAGE,
- "Cannot read existing TAG file in " << testingDir
- << std::endl);
- return 0;
- }
-
- if (this->Impl->TestModel == cmCTest::UNKNOWN) {
- if (model == cmCTest::UNKNOWN) {
- cmCTestLog(this, ERROR_MESSAGE,
- "TAG file does not contain model and "
- "no model specified in start command"
- << std::endl);
- return 0;
- }
-
- this->SetTestModel(model);
- }
-
- if (model != this->Impl->TestModel && model != cmCTest::UNKNOWN &&
- this->Impl->TestModel != cmCTest::UNKNOWN) {
- cmCTestOptionalLog(this, WARNING,
- "Model given in TAG does not match "
- "model given in ctest_start()"
- << std::endl,
- quiet);
- }
-
- if (!this->Impl->SpecificGroup.empty() &&
- group != this->Impl->SpecificGroup) {
- cmCTestOptionalLog(this, WARNING,
- "Group given in TAG does not match "
- "group given in ctest_start()"
- << std::endl,
- quiet);
- } else {
- this->Impl->SpecificGroup = group;
- }
-
- cmCTestOptionalLog(this, OUTPUT,
- " Use existing tag: " << tag << " - "
- << this->GetTestModelString()
- << std::endl,
- quiet);
+ time_t tctime = time(nullptr);
+ if (this->Impl->TomorrowTag) {
+ tctime += (24 * 60 * 60);
}
+ return gmtime(&tctime);
+ }();
- this->Impl->CurrentTag = tag;
- }
+ char datestring[100];
+ snprintf(datestring, sizeof(datestring), "%04d%02d%02d-%02d%02d",
+ lctime->tm_year + 1900, lctime->tm_mon + 1, lctime->tm_mday,
+ lctime->tm_hour, lctime->tm_min);
+ this->Impl->CurrentTag = datestring;
- return 1;
+ cmsys::ofstream ofs(tagfile.c_str());
+ ofs << this->Impl->CurrentTag << std::endl;
+ ofs << this->GetTestGroupString() << std::endl;
+ ofs << this->GetTestModelString() << std::endl;
+
+ return true;
}
-bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
+bool cmCTest::ReadExistingTag(bool quiet)
{
- std::string src_dir = this->GetCTestConfiguration("SourceDirectory");
- std::string bld_dir = this->GetCTestConfiguration("BuildDirectory");
- this->Impl->BuildID = "";
- for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
- this->Impl->Parts[p].SubmitFiles.clear();
- }
+ std::string const testingDir = this->Impl->BinaryDir + "/Testing";
+ std::string const tagfile = testingDir + "/TAG";
- cmMakefile* mf = command->GetMakefile();
- std::string fname;
+ std::string tag;
+ std::string group;
+ std::string modelStr;
+ int model = cmCTest::UNKNOWN;
- std::string src_dir_fname = cmStrCat(src_dir, "/CTestConfig.cmake");
- cmSystemTools::ConvertToUnixSlashes(src_dir_fname);
-
- std::string bld_dir_fname = cmStrCat(bld_dir, "/CTestConfig.cmake");
- cmSystemTools::ConvertToUnixSlashes(bld_dir_fname);
+ cmsys::ifstream tfin(tagfile.c_str());
+ if (tfin) {
+ cmSystemTools::GetLineFromStream(tfin, tag);
+ cmSystemTools::GetLineFromStream(tfin, group);
+ if (cmSystemTools::GetLineFromStream(tfin, modelStr)) {
+ model = GetTestModelFromString(modelStr);
+ }
+ tfin.close();
+ }
- if (cmSystemTools::FileExists(bld_dir_fname)) {
- fname = bld_dir_fname;
- } else if (cmSystemTools::FileExists(src_dir_fname)) {
- fname = src_dir_fname;
+ if (tag.empty()) {
+ if (!quiet) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Cannot read existing TAG file in " << testingDir
+ << std::endl);
+ }
+ return false;
}
- if (!fname.empty()) {
- cmCTestOptionalLog(this, OUTPUT,
- " Reading ctest configuration file: " << fname
- << std::endl,
- command->ShouldBeQuiet());
- bool readit = mf->ReadDependentFile(fname);
- if (!readit) {
- std::string m = cmStrCat("Could not find include file: ", fname);
- command->SetError(m);
+ if (this->Impl->TestModel == cmCTest::UNKNOWN) {
+ if (model == cmCTest::UNKNOWN) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "TAG file does not contain model and "
+ "no model specified in start command"
+ << std::endl);
return false;
}
+
+ this->SetTestModel(model);
}
- this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime",
- "CTEST_NIGHTLY_START_TIME",
- command->ShouldBeQuiet());
- this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE",
- command->ShouldBeQuiet());
- this->SetCTestConfigurationFromCMakeVariable(
- mf, "BuildName", "CTEST_BUILD_NAME", command->ShouldBeQuiet());
+ if (model != this->Impl->TestModel && model != cmCTest::UNKNOWN &&
+ this->Impl->TestModel != cmCTest::UNKNOWN) {
+ cmCTestOptionalLog(this, WARNING,
+ "Model given in TAG does not match "
+ "model given in ctest_start()"
+ << std::endl,
+ quiet);
+ }
- if (!this->Initialize(bld_dir, command)) {
- return false;
+ if (!this->Impl->SpecificGroup.empty() &&
+ group != this->Impl->SpecificGroup) {
+ cmCTestOptionalLog(this, WARNING,
+ "Group given in TAG does not match "
+ "group given in ctest_start()"
+ << std::endl,
+ quiet);
+ } else {
+ this->Impl->SpecificGroup = group;
}
+
cmCTestOptionalLog(this, OUTPUT,
- " Use " << this->GetTestModelString() << " tag: "
- << this->GetCurrentTag() << std::endl,
- command->ShouldBeQuiet());
+ " Use existing tag: " << tag << " - "
+ << this->GetTestGroupString()
+ << std::endl,
+ quiet);
+
+ this->Impl->CurrentTag = tag;
return true;
}
bool cmCTest::UpdateCTestConfiguration()
{
- if (this->Impl->SuppressUpdatingCTestConfiguration) {
- return true;
- }
std::string fileName = this->Impl->BinaryDir + "/CTestConfiguration.ini";
if (!cmSystemTools::FileExists(fileName)) {
fileName = this->Impl->BinaryDir + "/DartConfiguration.tcl";
@@ -760,7 +581,7 @@ bool cmCTest::UpdateCTestConfiguration()
if (!this->GetCTestConfiguration("BuildDirectory").empty()) {
this->Impl->BinaryDir = this->GetCTestConfiguration("BuildDirectory");
if (this->Impl->TestDir.empty()) {
- cmSystemTools::ChangeDirectory(this->Impl->BinaryDir);
+ cmSystemTools::SetLogicalWorkingDirectory(this->Impl->BinaryDir);
}
}
this->Impl->TimeOut =
@@ -804,7 +625,7 @@ int cmCTest::GetTestModel() const
return this->Impl->TestModel;
}
-bool cmCTest::SetTest(const std::string& ttype, bool report)
+bool cmCTest::SetTest(std::string const& ttype, bool report)
{
if (cmSystemTools::LowerCase(ttype) == "all") {
for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
@@ -825,11 +646,7 @@ bool cmCTest::SetTest(const std::string& ttype, bool report)
return false;
}
-void cmCTest::Finalize()
-{
-}
-
-bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name,
+bool cmCTest::OpenOutputFile(std::string const& path, std::string const& name,
cmGeneratedFileStream& stream, bool compress)
{
std::string testingDir = this->Impl->BinaryDir + "/Testing";
@@ -852,7 +669,6 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name,
}
}
std::string filename = testingDir + "/" + name;
- stream.SetTempExt("tmp");
stream.Open(filename);
if (!stream) {
cmCTestLog(this, ERROR_MESSAGE,
@@ -867,7 +683,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name,
return true;
}
-bool cmCTest::AddIfExists(Part part, const std::string& file)
+bool cmCTest::AddIfExists(Part part, std::string const& file)
{
if (this->CTestFileExists(file)) {
this->AddSubmitFile(part, file);
@@ -882,173 +698,177 @@ bool cmCTest::AddIfExists(Part part, const std::string& file)
return true;
}
-bool cmCTest::CTestFileExists(const std::string& filename)
+bool cmCTest::CTestFileExists(std::string const& filename)
{
std::string testingDir = this->Impl->BinaryDir + "/Testing/" +
this->Impl->CurrentTag + "/" + filename;
return cmSystemTools::FileExists(testingDir);
}
-cmCTestBuildHandler* cmCTest::GetBuildHandler()
-{
- return &this->Impl->BuildHandler;
-}
-
-cmCTestBuildAndTestHandler* cmCTest::GetBuildAndTestHandler()
-{
- return &this->Impl->BuildAndTestHandler;
-}
-
-cmCTestCoverageHandler* cmCTest::GetCoverageHandler()
-{
- return &this->Impl->CoverageHandler;
-}
-
-cmCTestScriptHandler* cmCTest::GetScriptHandler()
-{
- return &this->Impl->ScriptHandler;
-}
-
-cmCTestTestHandler* cmCTest::GetTestHandler()
-{
- return &this->Impl->TestHandler;
-}
-
-cmCTestUpdateHandler* cmCTest::GetUpdateHandler()
-{
- return &this->Impl->UpdateHandler;
-}
-
-cmCTestConfigureHandler* cmCTest::GetConfigureHandler()
+int cmCTest::ProcessSteps()
{
- return &this->Impl->ConfigureHandler;
-}
+ this->Impl->ExtraVerbose = this->Impl->Verbose;
+ this->Impl->Verbose = true;
+ this->Impl->ProduceXML = true;
-cmCTestMemCheckHandler* cmCTest::GetMemCheckHandler()
-{
- return &this->Impl->MemCheckHandler;
-}
+ // Minimal dashboard client script configuration.
+ this->SetCTestConfiguration("BuildDirectory", this->Impl->BinaryDir);
-cmCTestSubmitHandler* cmCTest::GetSubmitHandler()
-{
- return &this->Impl->SubmitHandler;
-}
+ this->UpdateCTestConfiguration();
+ this->BlockTestErrorDiagnostics();
-cmCTestUploadHandler* cmCTest::GetUploadHandler()
-{
- return &this->Impl->UploadHandler;
-}
+ if (this->GetCTestConfiguration("TimeOut").empty()) {
+ this->SetCTestConfiguration(
+ "TimeOut",
+ std::to_string(cmDurationTo<unsigned int>(cmCTest::MaxDuration())),
+ true);
+ }
-int cmCTest::ProcessSteps()
-{
int res = 0;
- bool notest = true;
- int update_count = 0;
+ cmCTestScriptHandler script(this);
+ script.CreateCMake();
+ cmMakefile& mf = *script.GetMakefile();
+ this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
+ this->SetTimeLimit(mf.GetDefinition("CTEST_TIME_LIMIT"));
+ this->SetCMakeVariables(mf);
+ std::vector<cmListFileArgument> args{
+ cmListFileArgument("RETURN_VALUE", cmListFileArgument::Unquoted, 0),
+ cmListFileArgument("return_value", cmListFileArgument::Unquoted, 0),
+ };
- for (Part p = PartStart; notest && p != PartCount;
- p = static_cast<Part>(p + 1)) {
- notest = !this->Impl->Parts[p];
+ if (this->Impl->Parts[PartStart]) {
+ auto const func = cmListFileFunction(
+ "ctest_start", 0, 0,
+ {
+ { this->GetTestModelString(), cmListFileArgument::Unquoted, 0 },
+ { "GROUP", cmListFileArgument::Unquoted, 0 },
+ { this->GetTestGroupString(), cmListFileArgument::Unquoted, 0 },
+ });
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status)) {
+ return 12;
+ }
+ } else if (!this->ReadExistingTag(true) && !this->CreateNewTag(false)) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Problem initializing the dashboard." << std::endl);
+ return 12;
}
+
if (this->Impl->Parts[PartUpdate] &&
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
- cmCTestUpdateHandler* uphandler = this->GetUpdateHandler();
- uphandler->SetPersistentOption(
- "SourceDirectory", this->GetCTestConfiguration("SourceDirectory"));
- update_count = uphandler->ProcessHandler();
- if (update_count < 0) {
+ auto const func = cmListFileFunction("ctest_update", 0, 0, args);
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status)) {
res |= cmCTest::UPDATE_ERRORS;
}
}
- if (this->Impl->TestModel == cmCTest::CONTINUOUS && !update_count) {
+ if (this->Impl->TestModel == cmCTest::CONTINUOUS &&
+ mf.GetDefinition("return_value").IsOff()) {
return 0;
}
if (this->Impl->Parts[PartConfigure] &&
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
- if (this->GetConfigureHandler()->ProcessHandler() < 0) {
+ auto const func = cmListFileFunction("ctest_configure", 0, 0, args);
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status) ||
+ std::stoi(mf.GetDefinition("return_value")) < 0) {
res |= cmCTest::CONFIGURE_ERRORS;
}
}
if (this->Impl->Parts[PartBuild] &&
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
this->UpdateCTestConfiguration();
- if (this->GetBuildHandler()->ProcessHandler() < 0) {
+ this->SetCMakeVariables(mf);
+ auto const func = cmListFileFunction("ctest_build", 0, 0, args);
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status) ||
+ std::stoi(mf.GetDefinition("return_value")) < 0) {
res |= cmCTest::BUILD_ERRORS;
}
}
- if ((this->Impl->Parts[PartTest] || notest) &&
+ if (this->Impl->Parts[PartTest] &&
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
this->UpdateCTestConfiguration();
- if (this->GetTestHandler()->ProcessHandler() < 0) {
+ this->SetCMakeVariables(mf);
+ auto const func = cmListFileFunction("ctest_test", 0, 0, args);
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status) ||
+ std::stoi(mf.GetDefinition("return_value")) < 0) {
res |= cmCTest::TEST_ERRORS;
}
}
if (this->Impl->Parts[PartCoverage] &&
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
this->UpdateCTestConfiguration();
- if (this->GetCoverageHandler()->ProcessHandler() < 0) {
+ this->SetCMakeVariables(mf);
+ auto const func = cmListFileFunction("ctest_coverage", 0, 0, args);
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status) ||
+ std::stoi(mf.GetDefinition("return_value")) < 0) {
res |= cmCTest::COVERAGE_ERRORS;
}
}
if (this->Impl->Parts[PartMemCheck] &&
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
this->UpdateCTestConfiguration();
- if (this->GetMemCheckHandler()->ProcessHandler() < 0) {
+ this->SetCMakeVariables(mf);
+ auto const func = cmListFileFunction("ctest_memcheck", 0, 0, args);
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status) ||
+ std::stoi(mf.GetDefinition("return_value")) < 0) {
res |= cmCTest::MEMORY_ERRORS;
}
}
- if (!notest) {
- std::string notes_dir = this->Impl->BinaryDir + "/Testing/Notes";
- if (cmSystemTools::FileIsDirectory(notes_dir)) {
- cmsys::Directory d;
- d.Load(notes_dir);
- unsigned long kk;
- for (kk = 0; kk < d.GetNumberOfFiles(); kk++) {
- const char* file = d.GetFile(kk);
- std::string fullname = notes_dir + "/" + file;
- if (cmSystemTools::FileExists(fullname, true)) {
- if (!this->Impl->NotesFiles.empty()) {
- this->Impl->NotesFiles += ";";
- }
- this->Impl->NotesFiles += fullname;
- this->Impl->Parts[PartNotes].Enable();
+ std::string notes_dir = this->Impl->BinaryDir + "/Testing/Notes";
+ if (cmSystemTools::FileIsDirectory(notes_dir)) {
+ cmsys::Directory d;
+ d.Load(notes_dir);
+ unsigned long kk;
+ for (kk = 0; kk < d.GetNumberOfFiles(); kk++) {
+ char const* file = d.GetFile(kk);
+ std::string fullname = notes_dir + "/" + file;
+ if (cmSystemTools::FileExists(fullname, true)) {
+ if (!this->Impl->NotesFiles.empty()) {
+ this->Impl->NotesFiles += ";";
}
+ this->Impl->NotesFiles += fullname;
+ this->Impl->Parts[PartNotes].Enable();
}
}
}
if (this->Impl->Parts[PartNotes]) {
this->UpdateCTestConfiguration();
if (!this->Impl->NotesFiles.empty()) {
- this->GenerateNotesFile(this->Impl->NotesFiles);
+ this->GenerateNotesFile(script.GetCMake(), this->Impl->NotesFiles);
}
}
if (this->Impl->Parts[PartSubmit]) {
this->UpdateCTestConfiguration();
- if (this->GetSubmitHandler()->ProcessHandler() < 0) {
+ this->SetCMakeVariables(mf);
+
+ std::string count = this->GetCTestConfiguration("CTestSubmitRetryCount");
+ std::string delay = this->GetCTestConfiguration("CTestSubmitRetryDelay");
+ auto const func = cmListFileFunction(
+ "ctest_submit", 0, 0,
+ {
+ cmListFileArgument("RETRY_COUNT", cmListFileArgument::Unquoted, 0),
+ cmListFileArgument(count, cmListFileArgument::Quoted, 0),
+ cmListFileArgument("RETRY_DELAY", cmListFileArgument::Unquoted, 0),
+ cmListFileArgument(delay, cmListFileArgument::Quoted, 0),
+ cmListFileArgument("RETURN_VALUE", cmListFileArgument::Unquoted, 0),
+ cmListFileArgument("return_value", cmListFileArgument::Unquoted, 0),
+ });
+ auto status = cmExecutionStatus(mf);
+ if (!mf.ExecuteCommand(func, status) ||
+ std::stoi(mf.GetDefinition("return_value")) < 0) {
res |= cmCTest::SUBMIT_ERRORS;
}
}
- if (res != 0) {
- cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest" << std::endl);
- if (!this->Impl->OutputTestOutputOnTestFailure) {
- const std::string lastTestLog =
- this->GetBinaryDir() + "/Testing/Temporary/LastTest.log";
- cmCTestLog(this, ERROR_MESSAGE,
- "Output from these tests are in: " << lastTestLog
- << std::endl);
- cmCTestLog(this, ERROR_MESSAGE,
- "Use \"--rerun-failed --output-on-failure\" to re-run the "
- "failed cases verbosely."
- << std::endl);
- }
- }
return res;
}
-std::string cmCTest::GetTestModelString()
+std::string cmCTest::GetTestModelString() const
{
- if (!this->Impl->SpecificGroup.empty()) {
- return this->Impl->SpecificGroup;
- }
switch (this->Impl->TestModel) {
case cmCTest::NIGHTLY:
return "Nightly";
@@ -1058,7 +878,15 @@ std::string cmCTest::GetTestModelString()
return "Experimental";
}
-int cmCTest::GetTestModelFromString(const std::string& str)
+std::string cmCTest::GetTestGroupString() const
+{
+ if (!this->Impl->SpecificGroup.empty()) {
+ return this->Impl->SpecificGroup;
+ }
+ return this->GetTestModelString();
+}
+
+int cmCTest::GetTestModelFromString(std::string const& str)
{
if (str.empty()) {
return cmCTest::EXPERIMENTAL;
@@ -1073,8 +901,8 @@ int cmCTest::GetTestModelFromString(const std::string& str)
return cmCTest::EXPERIMENTAL;
}
-bool cmCTest::RunMakeCommand(const std::string& command, std::string& output,
- int* retVal, const char* dir, cmDuration timeout,
+bool cmCTest::RunMakeCommand(std::string const& command, std::string& output,
+ int* retVal, char const* dir, cmDuration timeout,
std::ostream& ofs, Encoding encoding)
{
// First generate the command and arguments
@@ -1185,178 +1013,7 @@ bool cmCTest::RunMakeCommand(const std::string& command, std::string& output,
return true;
}
-bool cmCTest::RunTest(const std::vector<std::string>& argv,
- std::string* output, int* retVal, std::ostream* log,
- cmDuration testTimeOut,
- std::vector<std::string>* environment, Encoding encoding)
-{
- bool modifyEnv = (environment && !environment->empty());
-
- // determine how much time we have
- cmDuration timeout = this->GetRemainingTimeAllowed();
- if (timeout != cmCTest::MaxDuration()) {
- timeout -= std::chrono::minutes(2);
- }
- if (this->Impl->TimeOut > cmDuration::zero() &&
- this->Impl->TimeOut < timeout) {
- timeout = this->Impl->TimeOut;
- }
- if (testTimeOut > cmDuration::zero() &&
- testTimeOut < this->GetRemainingTimeAllowed()) {
- timeout = testTimeOut;
- }
-
- // always have at least 1 second if we got to here
- if (timeout <= cmDuration::zero()) {
- timeout = std::chrono::seconds(1);
- }
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- "Test timeout computed to be: "
- << (timeout == cmCTest::MaxDuration()
- ? std::string("infinite")
- : std::to_string(cmDurationTo<unsigned int>(timeout)))
- << "\n");
- if (cmSystemTools::SameFile(argv[0], cmSystemTools::GetCTestCommand()) &&
- !this->Impl->ForceNewCTestProcess) {
- cmCTest inst;
- inst.Impl->ConfigType = this->Impl->ConfigType;
- inst.Impl->TimeOut = timeout;
-
- // Capture output of the child ctest.
- std::ostringstream oss;
- inst.SetStreams(&oss, &oss);
-
- std::vector<std::string> args;
- for (auto const& i : argv) {
- // make sure we pass the timeout in for any build and test
- // invocations. Since --build-generator is required this is a
- // good place to check for it, and to add the arguments in
- if (i == "--build-generator" && timeout != cmCTest::MaxDuration() &&
- timeout > cmDuration::zero()) {
- args.emplace_back("--test-timeout");
- args.push_back(std::to_string(cmDurationTo<unsigned int>(timeout)));
- }
- args.emplace_back(i);
- }
- if (log) {
- *log << "* Run internal CTest" << std::endl;
- }
-
- std::unique_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
- if (modifyEnv) {
- saveEnv = cm::make_unique<cmSystemTools::SaveRestoreEnvironment>();
- cmSystemTools::AppendEnv(*environment);
- }
-
- *retVal = inst.Run(args, output);
- if (output) {
- *output += oss.str();
- }
- if (log && output) {
- *log << *output;
- }
- if (output) {
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- "Internal cmCTest object used to run test." << std::endl
- << *output
- << std::endl);
- }
-
- return true;
- }
- std::vector<char> tempOutput;
- if (output) {
- output->clear();
- }
-
- std::unique_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
- if (modifyEnv) {
- saveEnv = cm::make_unique<cmSystemTools::SaveRestoreEnvironment>();
- cmSystemTools::AppendEnv(*environment);
- }
-
- cmUVProcessChainBuilder builder;
- builder.AddCommand(argv).SetMergedBuiltinStreams();
- cmCTestLog(this, DEBUG, "Command is: " << argv[0] << std::endl);
- auto chain = builder.Start();
-
- cmProcessOutput processOutput(encoding);
- cm::uv_pipe_ptr outputStream;
- outputStream.init(chain.GetLoop(), 0);
- uv_pipe_open(outputStream, chain.OutputStream());
- auto outputHandle = cmUVStreamRead(
- outputStream,
- [this, &processOutput, &output, &tempOutput,
- &log](std::vector<char> data) {
- std::string strdata;
- processOutput.DecodeText(data.data(), data.size(), strdata);
- if (output) {
- cm::append(tempOutput, data.data(), data.data() + data.size());
- }
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, strdata);
- if (log) {
- log->write(strdata.c_str(), strdata.size());
- }
- },
- [this, &processOutput, &log]() {
- std::string strdata;
- processOutput.DecodeText(std::string(), strdata);
- if (!strdata.empty()) {
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, strdata);
- if (log) {
- log->write(strdata.c_str(), strdata.size());
- }
- }
- });
-
- bool complete = chain.Wait(static_cast<uint64_t>(timeout.count() * 1000.0));
- processOutput.DecodeText(tempOutput, tempOutput);
- if (output && tempOutput.begin() != tempOutput.end()) {
- output->append(tempOutput.data(), tempOutput.size());
- }
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- "-- Process completed" << std::endl);
-
- bool result = false;
-
- if (complete) {
- auto const& status = chain.GetStatus(0);
- auto exception = status.GetException();
- switch (exception.first) {
- case cmUVProcessChain::ExceptionCode::None:
- *retVal = static_cast<int>(status.ExitStatus);
- if (*retVal != 0 && this->Impl->OutputTestOutputOnTestFailure) {
- this->OutputTestErrors(tempOutput);
- }
- result = true;
- break;
- case cmUVProcessChain::ExceptionCode::Spawn: {
- std::string outerr =
- cmStrCat("\n*** ERROR executing: ", exception.second);
- if (output) {
- *output += outerr;
- }
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl);
- } break;
- default: {
- if (this->Impl->OutputTestOutputOnTestFailure) {
- this->OutputTestErrors(tempOutput);
- }
- *retVal = status.TermSignal;
- std::string outerr =
- cmStrCat("\n*** Exception executing: ", exception.second);
- if (output) {
- *output += outerr;
- }
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl);
- } break;
- }
- }
-
- return result;
-}
-
-std::string cmCTest::SafeBuildIdField(const std::string& value)
+std::string cmCTest::SafeBuildIdField(std::string const& value)
{
std::string safevalue(value);
@@ -1364,7 +1021,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
// Disallow non-filename and non-space whitespace characters.
// If they occur, replace them with ""
//
- const char* disallowed = "\\:*?\"<>|\n\r\t\f\v";
+ char const* disallowed = "\\:*?\"<>|\n\r\t\f\v";
if (safevalue.find_first_of(disallowed) != std::string::npos) {
std::string::size_type i = 0;
@@ -1386,7 +1043,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
return safevalue;
}
-void cmCTest::StartXML(cmXMLWriter& xml, bool append)
+void cmCTest::StartXML(cmXMLWriter& xml, cmake* cm, bool append)
{
if (this->Impl->CurrentTag.empty()) {
cmCTestLog(this, ERROR_MESSAGE,
@@ -1405,7 +1062,7 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append)
std::string buildname =
cmCTest::SafeBuildIdField(this->GetCTestConfiguration("BuildName"));
std::string stamp = cmCTest::SafeBuildIdField(this->Impl->CurrentTag + "-" +
- this->GetTestModelString());
+ this->GetTestGroupString());
std::string site =
cmCTest::SafeBuildIdField(this->GetCTestConfiguration("Site"));
@@ -1448,25 +1105,17 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append)
xml.Attribute("ChangeId", changeId);
}
- this->AddSiteProperties(xml);
+ this->AddSiteProperties(xml, cm);
}
-void cmCTest::AddSiteProperties(cmXMLWriter& xml)
+void cmCTest::AddSiteProperties(cmXMLWriter& xml, cmake* cm)
{
- cmCTestScriptHandler* ch = this->GetScriptHandler();
- cmake* cm = ch->GetCMake();
- // if no CMake then this is the old style script and props like
- // this will not work anyway.
- if (!cm) {
- return;
- }
// This code should go when cdash is changed to use labels only
cmValue subproject = cm->GetState()->GetGlobalProperty("SubProject");
if (subproject) {
xml.StartElement("Subproject");
xml.Attribute("name", *subproject);
- cmValue labels =
- ch->GetCMake()->GetState()->GetGlobalProperty("SubProjectLabels");
+ cmValue labels = cm->GetState()->GetGlobalProperty("SubProjectLabels");
if (labels) {
xml.StartElement("Labels");
cmList args{ *labels };
@@ -1518,7 +1167,7 @@ void cmCTest::EndXML(cmXMLWriter& xml)
xml.EndDocument();
}
-int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
+int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, cmake* cm,
std::vector<std::string> const& files)
{
std::string buildname =
@@ -1531,11 +1180,11 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
xml.StartElement("Site");
xml.Attribute("BuildName", buildname);
xml.Attribute("BuildStamp",
- this->Impl->CurrentTag + "-" + this->GetTestModelString());
+ this->Impl->CurrentTag + "-" + this->GetTestGroupString());
xml.Attribute("Name", this->GetCTestConfiguration("Site"));
xml.Attribute("Generator",
std::string("ctest-") + cmVersion::GetCMakeVersion());
- this->AddSiteProperties(xml);
+ this->AddSiteProperties(xml, cm);
xml.StartElement("Notes");
for (std::string const& file : files) {
@@ -1569,7 +1218,8 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
return 1;
}
-int cmCTest::GenerateNotesFile(std::vector<std::string> const& files)
+int cmCTest::GenerateNotesFile(cmake* cm,
+ std::vector<std::string> const& files)
{
cmGeneratedFileStream ofs;
if (!this->OpenOutputFile(this->Impl->CurrentTag, "Notes.xml", ofs)) {
@@ -1577,11 +1227,11 @@ int cmCTest::GenerateNotesFile(std::vector<std::string> const& files)
return 1;
}
cmXMLWriter xml(ofs);
- this->GenerateCTestNotesOutput(xml, files);
+ this->GenerateCTestNotesOutput(xml, cm, files);
return 0;
}
-int cmCTest::GenerateNotesFile(const std::string& cfiles)
+int cmCTest::GenerateNotesFile(cmake* cm, std::string const& cfiles)
{
if (cfiles.empty()) {
return 1;
@@ -1595,7 +1245,7 @@ int cmCTest::GenerateNotesFile(const std::string& cfiles)
return 1;
}
- return this->GenerateNotesFile(files);
+ return this->GenerateNotesFile(cm, files);
}
int cmCTest::GenerateDoneFile()
@@ -1616,31 +1266,14 @@ int cmCTest::GenerateDoneFile()
return 0;
}
-bool cmCTest::TryToChangeDirectory(std::string const& dir)
-{
- cmCTestLog(this, OUTPUT,
- "Internal ctest changing into directory: " << dir << std::endl);
- cmsys::Status status = cmSystemTools::ChangeDirectory(dir);
- if (!status) {
- auto msg = "Failed to change working directory to \"" + dir +
- "\" : " + status.GetString() + "\n";
- cmCTestLog(this, ERROR_MESSAGE, msg);
- return false;
- }
- return true;
-}
-
std::string cmCTest::Base64GzipEncodeFile(std::string const& file)
{
- const std::string currDir = cmSystemTools::GetCurrentWorkingDirectory();
- std::string parentDir = cmSystemTools::GetParentDirectory(file);
-
// Temporarily change to the file's directory so the tar gets created
// with a flat directory structure.
- if (currDir != parentDir) {
- if (!this->TryToChangeDirectory(parentDir)) {
- return "";
- }
+ cmWorkingDirectory workdir(cmSystemTools::GetParentDirectory(file));
+ if (workdir.Failed()) {
+ cmCTestLog(this, ERROR_MESSAGE, workdir.GetError() << std::endl);
+ return "";
}
std::string tarFile = file + "_temp.tar.gz";
@@ -1657,12 +1290,6 @@ std::string cmCTest::Base64GzipEncodeFile(std::string const& file)
}
std::string base64 = this->Base64EncodeFile(tarFile);
cmSystemTools::RemoveFile(tarFile);
-
- // Change back to the directory we started in.
- if (currDir != parentDir) {
- cmSystemTools::ChangeDirectory(currDir);
- }
-
return base64;
}
@@ -1702,7 +1329,7 @@ bool cmCTest::SubmitExtraFiles(std::vector<std::string> const& files)
return true;
}
-bool cmCTest::SubmitExtraFiles(const std::string& cfiles)
+bool cmCTest::SubmitExtraFiles(std::string const& cfiles)
{
if (cfiles.empty()) {
return true;
@@ -1721,7 +1348,7 @@ bool cmCTest::SubmitExtraFiles(const std::string& cfiles)
// for a -D argument convert the next argument into
// the proper list of dashboard steps via SetTest
-bool cmCTest::AddTestsForDashboardType(std::string& targ)
+bool cmCTest::AddTestsForDashboardType(std::string const& targ)
{
if (targ == "Experimental") {
this->SetTestModel(cmCTest::EXPERIMENTAL);
@@ -1844,7 +1471,7 @@ bool cmCTest::AddTestsForDashboardType(std::string& targ)
return true;
}
-void cmCTest::ErrorMessageUnknownDashDValue(std::string& val)
+void cmCTest::ErrorMessageUnknownDashDValue(std::string const& val)
{
cmCTestLog(this, ERROR_MESSAGE,
"CTest -D called with incorrect option: " << val << '\n');
@@ -1863,395 +1490,12 @@ void cmCTest::ErrorMessageUnknownDashDValue(std::string& val)
" ctest -D NightlyMemoryCheck\n");
}
-bool cmCTest::CheckArgument(const std::string& arg, cm::string_view varg1,
- const char* varg2)
+bool cmCTest::CheckArgument(std::string const& arg, cm::string_view varg1,
+ char const* varg2)
{
return (arg == varg1) || (varg2 && arg == varg2);
}
-// Processes one command line argument (and its arguments if any)
-// for many simple options and then returns
-bool cmCTest::HandleCommandLineArguments(size_t& i,
- std::vector<std::string>& args,
- 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")) {
- cm::optional<size_t> parallelLevel;
- // No value or an empty value tells ctest to choose a default.
- if (i + 1 < args.size() && !cmHasLiteralPrefix(args[i + 1], "-")) {
- ++i;
- if (!args[i].empty()) {
- // A non-empty value must be a non-negative integer.
- unsigned long plevel = 0;
- if (!cmStrToULong(args[i], &plevel)) {
- errormsg =
- cmStrCat("'", arg, "' given invalid value '", args[i], "'");
- return false;
- }
- parallelLevel = plevel;
- }
- }
- this->SetParallelLevel(parallelLevel);
- this->Impl->ParallelLevelSetInCli = true;
- } else if (cmHasPrefix(arg, "-j")) {
- // The value must be a non-negative integer.
- unsigned long plevel = 0;
- if (!cmStrToULong(arg.substr(2), &plevel)) {
- errormsg = cmStrCat("'", arg, "' given invalid value '", args[i], "'");
- return false;
- }
- this->SetParallelLevel(plevel);
- this->Impl->ParallelLevelSetInCli = true;
- }
-
- else if (this->CheckArgument(arg, "--repeat-until-fail"_s)) {
- if (i >= args.size() - 1) {
- errormsg = "'--repeat-until-fail' requires an argument";
- return false;
- }
- if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
- errormsg = "At most one '--repeat' option may be used.";
- return false;
- }
- i++;
- long repeat = 1;
- if (!cmStrToLong(args[i], &repeat)) {
- errormsg = cmStrCat("'--repeat-until-fail' given non-integer value '",
- args[i], "'");
- return false;
- }
- this->Impl->RepeatCount = static_cast<int>(repeat);
- if (repeat > 1) {
- this->Impl->RepeatMode = cmCTest::Repeat::UntilFail;
- }
- }
-
- else if (this->CheckArgument(arg, "--repeat"_s)) {
- if (i >= args.size() - 1) {
- errormsg = "'--repeat' requires an argument";
- return false;
- }
- if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
- errormsg = "At most one '--repeat' option may be used.";
- return false;
- }
- i++;
- cmsys::RegularExpression repeatRegex(
- "^(until-fail|until-pass|after-timeout):([0-9]+)$");
- if (repeatRegex.find(args[i])) {
- std::string const& count = repeatRegex.match(2);
- unsigned long n = 1;
- cmStrToULong(count, &n); // regex guarantees success
- this->Impl->RepeatCount = static_cast<int>(n);
- if (this->Impl->RepeatCount > 1) {
- std::string const& mode = repeatRegex.match(1);
- if (mode == "until-fail") {
- this->Impl->RepeatMode = cmCTest::Repeat::UntilFail;
- } else if (mode == "until-pass") {
- this->Impl->RepeatMode = cmCTest::Repeat::UntilPass;
- } else if (mode == "after-timeout") {
- this->Impl->RepeatMode = cmCTest::Repeat::AfterTimeout;
- }
- }
- } else {
- errormsg = cmStrCat("'--repeat' given invalid value '", args[i], "'");
- return false;
- }
- }
-
- else if (this->CheckArgument(arg, "--test-load"_s) && i < args.size() - 1) {
- i++;
- unsigned long load;
- if (cmStrToULong(args[i], &load)) {
- this->SetTestLoad(load);
- } else {
- cmCTestLog(this, WARNING,
- "Invalid value for 'Test Load' : " << args[i] << '\n');
- }
- }
-
- else if (this->CheckArgument(arg, "--no-compress-output"_s)) {
- this->Impl->CompressTestOutput = false;
- }
-
- else if (this->CheckArgument(arg, "--print-labels"_s)) {
- this->Impl->PrintLabels = true;
- }
-
- else if (this->CheckArgument(arg, "--http1.0"_s)) {
- this->Impl->UseHTTP10 = true;
- }
-
- else if (this->CheckArgument(arg, "--timeout"_s) && i < args.size() - 1) {
- i++;
- auto timeout = cmDuration(atof(args[i].c_str()));
- this->Impl->GlobalTimeout = timeout;
- }
-
- else if (this->CheckArgument(arg, "--stop-time"_s) && i < args.size() - 1) {
- i++;
- this->SetStopTime(args[i]);
- }
-
- else if (this->CheckArgument(arg, "--stop-on-failure"_s)) {
- this->Impl->StopOnFailure = true;
- }
-
- else if (this->CheckArgument(arg, "-C"_s, "--build-config") &&
- i < args.size() - 1) {
- i++;
- this->SetConfigType(args[i]);
- }
-
- else if (this->CheckArgument(arg, "--debug"_s)) {
- this->Impl->Debug = true;
- this->Impl->ShowLineNumbers = true;
- } else if ((this->CheckArgument(arg, "--group"_s) ||
- // This is an undocumented / deprecated option.
- // "Track" has been renamed to "Group".
- this->CheckArgument(arg, "--track"_s)) &&
- i < args.size() - 1) {
- i++;
- this->Impl->SpecificGroup = args[i];
- } else if (this->CheckArgument(arg, "--show-line-numbers"_s)) {
- this->Impl->ShowLineNumbers = true;
- } else if (this->CheckArgument(arg, "--no-label-summary"_s)) {
- this->Impl->LabelSummary = false;
- } else if (this->CheckArgument(arg, "--no-subproject-summary"_s)) {
- this->Impl->SubprojectSummary = false;
- } else if (this->CheckArgument(arg, "-Q"_s, "--quiet")) {
- this->Impl->Quiet = true;
- } else if (this->CheckArgument(arg, "--progress"_s)) {
- this->Impl->TestProgressOutput = true;
- } else if (this->CheckArgument(arg, "-V"_s, "--verbose")) {
- this->Impl->Verbose = true;
- } else if (this->CheckArgument(arg, "-VV"_s, "--extra-verbose")) {
- this->Impl->ExtraVerbose = true;
- this->Impl->Verbose = true;
- } else if (this->CheckArgument(arg, "--output-on-failure"_s)) {
- this->Impl->OutputTestOutputOnTestFailure = true;
- } else if (this->CheckArgument(arg, "--test-output-size-passed"_s) &&
- i < args.size() - 1) {
- i++;
- long outputSize;
- if (cmStrToLong(args[i], &outputSize)) {
- this->Impl->TestHandler.SetTestOutputSizePassed(
- static_cast<int>(outputSize));
- } else {
- cmCTestLog(this, WARNING,
- "Invalid value for '--test-output-size-passed': " << args[i]
- << "\n");
- }
- } else if (this->CheckArgument(arg, "--test-output-size-failed"_s) &&
- i < args.size() - 1) {
- i++;
- long outputSize;
- if (cmStrToLong(args[i], &outputSize)) {
- this->Impl->TestHandler.SetTestOutputSizeFailed(
- static_cast<int>(outputSize));
- } else {
- cmCTestLog(this, WARNING,
- "Invalid value for '--test-output-size-failed': " << args[i]
- << "\n");
- }
- } else if (this->CheckArgument(arg, "--test-output-truncation"_s) &&
- i < args.size() - 1) {
- i++;
- if (!this->Impl->TestHandler.SetTestOutputTruncation(args[i])) {
- errormsg = "Invalid value for '--test-output-truncation': " + args[i];
- return false;
- }
- } else if (this->CheckArgument(arg, "-N"_s, "--show-only")) {
- this->Impl->ShowOnly = true;
- } else if (cmHasLiteralPrefix(arg, "--show-only=")) {
- this->Impl->ShowOnly = true;
-
- // Check if a specific format is requested. Defaults to human readable
- // text.
- std::string argWithFormat = "--show-only=";
- std::string format = arg.substr(argWithFormat.length());
- if (format == "json-v1") {
- // Force quiet mode so the only output is the json object model.
- this->Impl->Quiet = true;
- this->Impl->OutputAsJson = true;
- this->Impl->OutputAsJsonVersion = 1;
- } else if (format != "human") {
- errormsg = "'--show-only=' given unknown value '" + format + "'";
- return false;
- }
- }
-
- else if (this->CheckArgument(arg, "-O"_s, "--output-log") &&
- i < args.size() - 1) {
- i++;
- this->SetOutputLogFileName(args[i]);
- }
-
- else if (this->CheckArgument(arg, "--tomorrow-tag"_s)) {
- this->Impl->TomorrowTag = true;
- } else if (this->CheckArgument(arg, "--force-new-ctest-process"_s)) {
- this->Impl->ForceNewCTestProcess = true;
- } else if (this->CheckArgument(arg, "-W"_s, "--max-width") &&
- i < args.size() - 1) {
- i++;
- this->Impl->MaxTestNameWidth = atoi(args[i].c_str());
- } else if (this->CheckArgument(arg, "--interactive-debug-mode"_s) &&
- i < args.size() - 1) {
- i++;
- this->Impl->InteractiveDebugMode = cmIsOn(args[i]);
- } else if (this->CheckArgument(arg, "--submit-index"_s) &&
- i < args.size() - 1) {
- i++;
- this->Impl->SubmitIndex = atoi(args[i].c_str());
- if (this->Impl->SubmitIndex < 0) {
- this->Impl->SubmitIndex = 0;
- }
- }
-
- else if (this->CheckArgument(arg, "--overwrite"_s) && i < args.size() - 1) {
- i++;
- this->AddCTestConfigurationOverwrite(args[i]);
- } else if (this->CheckArgument(arg, "-A"_s, "--add-notes") &&
- i < args.size() - 1) {
- this->Impl->ProduceXML = true;
- this->SetTest("Notes");
- i++;
- this->SetNotesFiles(args[i]);
- return true;
- } else if (this->CheckArgument(arg, "--test-dir"_s)) {
- if (i >= args.size() - 1) {
- errormsg = "'--test-dir' requires an argument";
- return false;
- }
- i++;
- this->Impl->TestDir = std::string(args[i]);
- } else if (this->CheckArgument(arg, "--output-junit"_s)) {
- if (i >= args.size() - 1) {
- errormsg = "'--output-junit' requires an argument";
- return false;
- }
- i++;
- this->SetOutputJUnitFileName(std::string(args[i]));
- }
-
- else if (cmHasPrefix(arg, noTestsPrefix)) {
- cm::string_view noTestsMode =
- cm::string_view(arg).substr(noTestsPrefix.length());
- if (noTestsMode == "error") {
- this->Impl->NoTestsMode = cmCTest::NoTests::Error;
- } else if (noTestsMode != "ignore") {
- errormsg =
- cmStrCat("'--no-tests=' given unknown value '", noTestsMode, '\'');
- return false;
- } else {
- this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;
- }
- this->Impl->NoTestsModeSetInCli = true;
- }
-
- // options that control what tests are run
- else if (this->CheckArgument(arg, "-I"_s, "--tests-information") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption("TestsToRunInformation",
- args[i]);
- this->GetMemCheckHandler()->SetPersistentOption("TestsToRunInformation",
- args[i]);
- } else if (this->CheckArgument(arg, "-U"_s, "--union")) {
- this->GetTestHandler()->SetPersistentOption("UseUnion", "true");
- this->GetMemCheckHandler()->SetPersistentOption("UseUnion", "true");
- } else if (this->CheckArgument(arg, "-R"_s, "--tests-regex") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption("IncludeRegularExpression",
- args[i]);
- this->GetMemCheckHandler()->SetPersistentOption("IncludeRegularExpression",
- args[i]);
- } else if (this->CheckArgument(arg, "-L"_s, "--label-regex") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->AddPersistentMultiOption("LabelRegularExpression",
- args[i]);
- this->GetMemCheckHandler()->AddPersistentMultiOption(
- "LabelRegularExpression", args[i]);
- } else if (this->CheckArgument(arg, "-LE"_s, "--label-exclude") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->AddPersistentMultiOption(
- "ExcludeLabelRegularExpression", args[i]);
- this->GetMemCheckHandler()->AddPersistentMultiOption(
- "ExcludeLabelRegularExpression", args[i]);
- }
-
- else if (this->CheckArgument(arg, "-E"_s, "--exclude-regex") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption("ExcludeRegularExpression",
- args[i]);
- this->GetMemCheckHandler()->SetPersistentOption("ExcludeRegularExpression",
- args[i]);
- }
-
- else if (this->CheckArgument(arg, "-FA"_s, "--fixture-exclude-any") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption(
- "ExcludeFixtureRegularExpression", args[i]);
- this->GetMemCheckHandler()->SetPersistentOption(
- "ExcludeFixtureRegularExpression", args[i]);
- } else if (this->CheckArgument(arg, "-FS"_s, "--fixture-exclude-setup") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption(
- "ExcludeFixtureSetupRegularExpression", args[i]);
- this->GetMemCheckHandler()->SetPersistentOption(
- "ExcludeFixtureSetupRegularExpression", args[i]);
- } else if (this->CheckArgument(arg, "-FC"_s, "--fixture-exclude-cleanup") &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption(
- "ExcludeFixtureCleanupRegularExpression", args[i]);
- this->GetMemCheckHandler()->SetPersistentOption(
- "ExcludeFixtureCleanupRegularExpression", args[i]);
- }
-
- else if (this->CheckArgument(arg, "--resource-spec-file"_s) &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption("ResourceSpecFile", args[i]);
- this->GetMemCheckHandler()->SetPersistentOption("ResourceSpecFile",
- args[i]);
- }
-
- else if (this->CheckArgument(arg, "--tests-from-file"_s) &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption("TestListFile", args[i]);
- this->GetMemCheckHandler()->SetPersistentOption("TestListFile", args[i]);
- }
-
- else if (this->CheckArgument(arg, "--exclude-from-file"_s) &&
- i < args.size() - 1) {
- i++;
- this->GetTestHandler()->SetPersistentOption("ExcludeTestListFile",
- args[i]);
- this->GetMemCheckHandler()->SetPersistentOption("ExcludeTestListFile",
- args[i]);
- }
-
- else if (this->CheckArgument(arg, "--rerun-failed"_s)) {
- this->GetTestHandler()->SetPersistentOption("RerunFailed", "true");
- this->GetMemCheckHandler()->SetPersistentOption("RerunFailed", "true");
- } else {
- return false;
- }
- return true;
-}
-
#if !defined(_WIN32)
bool cmCTest::ConsoleIsNotDumb()
{
@@ -2296,47 +1540,7 @@ bool cmCTest::ColoredOutputSupportedByConsole()
#endif
}
-// handle the -S -SR and -SP arguments
-bool cmCTest::HandleScriptArguments(size_t& i, std::vector<std::string>& args,
- bool& SRArgumentSpecified)
-{
- std::string arg = args[i];
- if (this->CheckArgument(arg, "-SP"_s, "--script-new-process") &&
- i < args.size() - 1) {
- this->Impl->RunConfigurationScript = true;
- i++;
- cmCTestScriptHandler* ch = this->GetScriptHandler();
- // -SR is an internal argument, -SP should be ignored when it is passed
- if (!SRArgumentSpecified) {
- ch->AddConfigurationScript(args[i], false);
- }
- }
-
- else if (this->CheckArgument(arg, "-SR"_s, "--script-run") &&
- i < args.size() - 1) {
- SRArgumentSpecified = true;
- this->Impl->RunConfigurationScript = true;
- i++;
- cmCTestScriptHandler* ch = this->GetScriptHandler();
- ch->AddConfigurationScript(args[i], true);
- }
-
- else if (this->CheckArgument(arg, "-S"_s, "--script") &&
- i < args.size() - 1) {
- this->Impl->RunConfigurationScript = true;
- i++;
- cmCTestScriptHandler* ch = this->GetScriptHandler();
- // -SR is an internal argument, -S should be ignored when it is passed
- if (!SRArgumentSpecified) {
- ch->AddConfigurationScript(args[i], true);
- }
- } else {
- return false;
- }
- return true;
-}
-
-bool cmCTest::AddVariableDefinition(const std::string& arg)
+bool cmCTest::AddVariableDefinition(std::string const& arg)
{
std::string name;
std::string value;
@@ -2350,28 +1554,10 @@ bool cmCTest::AddVariableDefinition(const std::string& arg)
return false;
}
-void cmCTest::SetPersistentOptionIfNotEmpty(const std::string& value,
- const std::string& optionName)
-{
- if (!value.empty()) {
- this->GetTestHandler()->SetPersistentOption(optionName, value);
- this->GetMemCheckHandler()->SetPersistentOption(optionName, value);
- }
-}
-
-void cmCTest::AddPersistentMultiOptionIfNotEmpty(const std::string& value,
- const std::string& optionName)
-{
- if (!value.empty()) {
- this->GetTestHandler()->AddPersistentMultiOption(optionName, value);
- this->GetMemCheckHandler()->AddPersistentMultiOption(optionName, value);
- }
-}
-
-bool cmCTest::SetArgsFromPreset(const std::string& presetName,
+bool cmCTest::SetArgsFromPreset(std::string const& presetName,
bool listPresets)
{
- const auto workingDirectory = cmSystemTools::GetCurrentWorkingDirectory();
+ auto const workingDirectory = cmSystemTools::GetLogicalWorkingDirectory();
cmCMakePresetsGraph settingsFile;
auto result = settingsFile.ReadProjectPresets(workingDirectory);
@@ -2457,7 +1643,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
// Set build directory to value specified by the configure preset.
this->AddCTestConfigurationOverwrite(
cmStrCat("BuildDirectory=", expandedConfigurePreset->BinaryDir));
- for (const auto& kvp : expandedPreset->OverwriteConfigurationFile) {
+ for (auto const& kvp : expandedPreset->OverwriteConfigurationFile) {
this->AddCTestConfigurationOverwrite(kvp);
}
@@ -2466,7 +1652,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
expandedPreset->Output->ShortProgress.value_or(false);
if (expandedPreset->Output->Verbosity) {
- const auto& verbosity = *expandedPreset->Output->Verbosity;
+ auto const& verbosity = *expandedPreset->Output->Verbosity;
switch (verbosity) {
case cmCMakePresetsGraph::TestPreset::OutputOptions::VerbosityEnum::
Extra:
@@ -2485,8 +1671,6 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
}
this->Impl->Debug = expandedPreset->Output->Debug.value_or(false);
- this->Impl->ShowLineNumbers =
- expandedPreset->Output->Debug.value_or(false);
this->Impl->OutputTestOutputOnTestFailure =
expandedPreset->Output->OutputOnFailure.value_or(false);
this->Impl->Quiet = expandedPreset->Output->Quiet.value_or(false);
@@ -2504,17 +1688,17 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
expandedPreset->Output->SubprojectSummary.value_or(true);
if (expandedPreset->Output->MaxPassedTestOutputSize) {
- this->Impl->TestHandler.SetTestOutputSizePassed(
- *expandedPreset->Output->MaxPassedTestOutputSize);
+ this->Impl->TestOptions.OutputSizePassed =
+ *expandedPreset->Output->MaxPassedTestOutputSize;
}
if (expandedPreset->Output->MaxFailedTestOutputSize) {
- this->Impl->TestHandler.SetTestOutputSizeFailed(
- *expandedPreset->Output->MaxFailedTestOutputSize);
+ this->Impl->TestOptions.OutputSizeFailed =
+ *expandedPreset->Output->MaxFailedTestOutputSize;
}
if (expandedPreset->Output->TestOutputTruncation) {
- this->Impl->TestHandler.TestOutputTruncation =
+ this->Impl->TestOptions.OutputTruncation =
*expandedPreset->Output->TestOutputTruncation;
}
@@ -2525,16 +1709,18 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
if (expandedPreset->Filter) {
if (expandedPreset->Filter->Include) {
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Filter->Include->Name, "IncludeRegularExpression");
- this->AddPersistentMultiOptionIfNotEmpty(
- expandedPreset->Filter->Include->Label, "LabelRegularExpression");
+ this->Impl->TestOptions.IncludeRegularExpression =
+ expandedPreset->Filter->Include->Name;
+ if (!expandedPreset->Filter->Include->Label.empty()) {
+ this->Impl->TestOptions.LabelRegularExpression.push_back(
+ expandedPreset->Filter->Include->Label);
+ }
if (expandedPreset->Filter->Include->Index) {
if (expandedPreset->Filter->Include->Index->IndexFile.empty()) {
- const auto& start = expandedPreset->Filter->Include->Index->Start;
- const auto& end = expandedPreset->Filter->Include->Index->End;
- const auto& stride = expandedPreset->Filter->Include->Index->Stride;
+ auto const& start = expandedPreset->Filter->Include->Index->Start;
+ auto const& end = expandedPreset->Filter->Include->Index->End;
+ auto const& stride = expandedPreset->Filter->Include->Index->Stride;
std::string indexOptions;
indexOptions += (start ? std::to_string(*start) : "") + ",";
indexOptions += (end ? std::to_string(*end) : "") + ",";
@@ -2542,38 +1728,32 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
indexOptions +=
cmJoin(expandedPreset->Filter->Include->Index->SpecificTests, ",");
- this->SetPersistentOptionIfNotEmpty(indexOptions,
- "TestsToRunInformation");
+ this->Impl->TestOptions.TestsToRunInformation = indexOptions;
} else {
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Filter->Include->Index->IndexFile,
- "TestsToRunInformation");
+ this->Impl->TestOptions.TestsToRunInformation =
+ expandedPreset->Filter->Include->Index->IndexFile;
}
}
- if (expandedPreset->Filter->Include->UseUnion.value_or(false)) {
- this->GetTestHandler()->SetPersistentOption("UseUnion", "true");
- this->GetMemCheckHandler()->SetPersistentOption("UseUnion", "true");
- }
+ this->Impl->TestOptions.UseUnion =
+ expandedPreset->Filter->Include->UseUnion.value_or(false);
}
if (expandedPreset->Filter->Exclude) {
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Filter->Exclude->Name, "ExcludeRegularExpression");
- this->AddPersistentMultiOptionIfNotEmpty(
- expandedPreset->Filter->Exclude->Label,
- "ExcludeLabelRegularExpression");
+ this->Impl->TestOptions.ExcludeRegularExpression =
+ expandedPreset->Filter->Exclude->Name;
+ if (!expandedPreset->Filter->Exclude->Label.empty()) {
+ this->Impl->TestOptions.ExcludeLabelRegularExpression.push_back(
+ expandedPreset->Filter->Exclude->Label);
+ }
if (expandedPreset->Filter->Exclude->Fixtures) {
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Filter->Exclude->Fixtures->Any,
- "ExcludeFixtureRegularExpression");
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Filter->Exclude->Fixtures->Setup,
- "ExcludeFixtureSetupRegularExpression");
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Filter->Exclude->Fixtures->Cleanup,
- "ExcludeFixtureCleanupRegularExpression");
+ this->Impl->TestOptions.ExcludeFixtureRegularExpression =
+ expandedPreset->Filter->Exclude->Fixtures->Any;
+ this->Impl->TestOptions.ExcludeFixtureSetupRegularExpression =
+ expandedPreset->Filter->Exclude->Fixtures->Setup;
+ this->Impl->TestOptions.ExcludeFixtureCleanupRegularExpression =
+ expandedPreset->Filter->Exclude->Fixtures->Cleanup;
}
}
}
@@ -2590,8 +1770,8 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
this->Impl->ParallelLevelSetInCli = true;
}
- this->SetPersistentOptionIfNotEmpty(
- expandedPreset->Execution->ResourceSpecFile, "ResourceSpecFile");
+ this->Impl->TestOptions.ResourceSpecFile =
+ expandedPreset->Execution->ResourceSpecFile;
if (expandedPreset->Execution->TestLoad) {
auto testLoad = *expandedPreset->Execution->TestLoad;
@@ -2675,12 +1855,13 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
}
// the main entry point of ctest, called from main
-int cmCTest::Run(std::vector<std::string>& args, std::string* output)
+int cmCTest::Run(std::vector<std::string> const& args)
{
- const char* ctestExec = "ctest";
+ char const* ctestExec = "ctest";
bool cmakeAndTest = false;
- bool executeTests = true;
+ bool processSteps = false;
bool SRArgumentSpecified = false;
+ std::vector<std::pair<std::string, bool>> runScripts;
// copy the command line
cm::append(this->Impl->InitialCommandLineArguments, args);
@@ -2702,10 +1883,10 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
success = this->SetArgsFromPreset("", listPresets);
} else {
if (cmHasLiteralPrefix(*it, "--preset=")) {
- auto presetName = it->substr(9);
+ auto const& presetName = it->substr(9);
success = this->SetArgsFromPreset(presetName, listPresets);
} else if (++it != args.end()) {
- auto presetName = *it;
+ auto const& presetName = *it;
success = this->SetArgsFromPreset(presetName, listPresets);
} else {
cmSystemTools::Error("'--preset' requires an argument");
@@ -2722,103 +1903,681 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
}
}
- // process the command line arguments
- for (size_t i = 1; i < args.size(); ++i) {
- // handle the simple commandline arguments
- std::string errormsg;
- bool validArg = this->HandleCommandLineArguments(i, args, errormsg);
- if (!validArg && !errormsg.empty()) {
- cmSystemTools::Error(errormsg);
- return 1;
+ auto const dashD = [this, &processSteps](std::string const& targ) -> bool {
+ // AddTestsForDashboard parses the dashboard type and converts it
+ // into the separate stages
+ if (this->AddTestsForDashboardType(targ)) {
+ processSteps = true;
+ return true;
}
- std::string arg = args[i];
-
- // handle the script arguments -S -SR -SP
- validArg =
- validArg || this->HandleScriptArguments(i, args, SRArgumentSpecified);
-
- // --dashboard: handle a request for a dashboard
- if (this->CheckArgument(arg, "-D"_s, "--dashboard") &&
- i < args.size() - 1) {
- this->Impl->ProduceXML = true;
- i++;
- std::string targ = args[i];
- // AddTestsForDashboard parses the dashboard type and converts it
- // into the separate stages
- if (!this->AddTestsForDashboardType(targ)) {
- if (!this->AddVariableDefinition(targ)) {
- this->ErrorMessageUnknownDashDValue(targ);
- executeTests = false;
- }
- }
- validArg = true;
+ if (this->AddVariableDefinition(targ)) {
+ return true;
}
-
- // If it's not exactly -D, but it starts with -D, then try to parse out
- // a variable definition from it, same as CMake does. Unsuccessful
- // attempts are simply ignored since previous ctest versions ignore
- // this too. (As well as many other unknown command line args.)
- //
- if (arg != "-D" && cmHasLiteralPrefix(arg, "-D")) {
- std::string input = arg.substr(2);
- this->AddVariableDefinition(input);
- validArg = true;
+ this->ErrorMessageUnknownDashDValue(targ);
+ return false;
+ };
+ auto const dashT = [this, &processSteps,
+ ctestExec](std::string const& action) -> bool {
+ if (!this->SetTest(action, false)) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "CTest -T called with incorrect option: " << action << '\n');
+ /* clang-format off */
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Available options are:\n"
+ " " << ctestExec << " -T all\n"
+ " " << ctestExec << " -T start\n"
+ " " << ctestExec << " -T update\n"
+ " " << ctestExec << " -T configure\n"
+ " " << ctestExec << " -T build\n"
+ " " << ctestExec << " -T test\n"
+ " " << ctestExec << " -T coverage\n"
+ " " << ctestExec << " -T memcheck\n"
+ " " << ctestExec << " -T notes\n"
+ " " << ctestExec << " -T submit\n");
+ /* clang-format on */
+ return false;
}
-
- // --test-action: calls SetTest(<stage>, /*report=*/ false) to enable
- // the corresponding stage
- if (!this->HandleTestActionArgument(ctestExec, i, args, validArg)) {
- executeTests = false;
+ processSteps = true;
+ return true;
+ };
+ auto const dashM = [this, &processSteps,
+ ctestExec](std::string const& model) -> bool {
+ if (cmSystemTools::LowerCase(model) == "nightly"_s) {
+ this->SetTestModel(cmCTest::NIGHTLY);
+ } else if (cmSystemTools::LowerCase(model) == "continuous"_s) {
+ this->SetTestModel(cmCTest::CONTINUOUS);
+ } else if (cmSystemTools::LowerCase(model) == "experimental"_s) {
+ this->SetTestModel(cmCTest::EXPERIMENTAL);
+ } else {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "CTest -M called with incorrect option: " << model << '\n');
+ /* clang-format off */
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Available options are:\n"
+ " " << ctestExec << " -M Continuous\n"
+ " " << ctestExec << " -M Experimental\n"
+ " " << ctestExec << " -M Nightly\n");
+ /* clang-format on */
+ return false;
}
-
- // --test-model: what type of test model
- if (!this->HandleTestModelArgument(ctestExec, i, args, validArg)) {
- executeTests = false;
+ processSteps = true;
+ return true;
+ };
+ auto const dashSP =
+ [&runScripts, &SRArgumentSpecified](std::string const& script) -> bool {
+ // -SR is an internal argument, -SP should be ignored when it is passed
+ if (!SRArgumentSpecified) {
+ runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script),
+ false);
}
-
- // --extra-submit
- if (this->CheckArgument(arg, "--extra-submit"_s) && i < args.size() - 1) {
- this->Impl->ProduceXML = true;
- this->SetTest("Submit");
- i++;
- if (!this->SubmitExtraFiles(args[i])) {
- return 0;
+ return true;
+ };
+ auto const dashSR =
+ [&runScripts, &SRArgumentSpecified](std::string const& script) -> bool {
+ // -SR should be processed only once
+ if (!SRArgumentSpecified) {
+ SRArgumentSpecified = true;
+ runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script),
+ true);
+ }
+ return true;
+ };
+ auto const dash_S =
+ [&runScripts, &SRArgumentSpecified](std::string const& script) -> bool {
+ // -SR is an internal argument, -S should be ignored when it is passed
+ if (!SRArgumentSpecified) {
+ runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script),
+ true);
+ }
+ return true;
+ };
+ auto const dashJ = [this](cm::string_view arg,
+ std::string const& j) -> bool {
+ cm::optional<size_t> parallelLevel;
+ // No value or an empty value tells ctest to choose a default.
+ if (!j.empty()) {
+ // A non-empty value must be a non-negative integer.
+ unsigned long plevel = 0;
+ if (!cmStrToULong(j, &plevel)) {
+ cmSystemTools::Error(
+ cmStrCat('\'', arg, "' given invalid value '", j, '\''));
+ return false;
}
- validArg = true;
+ parallelLevel = plevel;
}
+ this->SetParallelLevel(parallelLevel);
+ this->Impl->ParallelLevelSetInCli = true;
+ return true;
+ };
+ auto const dashC = [this](std::string const& config) -> bool {
+ this->SetConfigType(config);
+ return true;
+ };
+ auto const dashGroup = [this](std::string const& group) -> bool {
+ this->Impl->SpecificGroup = group;
+ return true;
+ };
+ auto const dashQ = [this](std::string const&) -> bool {
+ this->Impl->Quiet = true;
+ return true;
+ };
+ auto const dashV = [this](std::string const&) -> bool {
+ this->Impl->Verbose = true;
+ return true;
+ };
+ auto const dashVV = [this](std::string const&) -> bool {
+ this->Impl->ExtraVerbose = true;
+ this->Impl->Verbose = true;
+ return true;
+ };
+ auto const dashO = [this](std::string const& log) -> bool {
+ this->SetOutputLogFileName(log);
+ return true;
+ };
+ auto const dashW = [this](std::string const& width) -> bool {
+ this->Impl->MaxTestNameWidth = atoi(width.c_str());
+ return true;
+ };
+ auto const dashA = [this, &processSteps](std::string const& notes) -> bool {
+ processSteps = true;
+ this->SetTest("Notes");
+ this->SetNotesFiles(notes);
+ return true;
+ };
+ auto const dashI = [this](std::string const& tests) -> bool {
+ this->Impl->TestOptions.TestsToRunInformation = tests;
+ return true;
+ };
+ auto const dashU = [this](std::string const&) -> bool {
+ this->Impl->TestOptions.UseUnion = true;
+ return true;
+ };
+ auto const dashR = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.IncludeRegularExpression = expr;
+ return true;
+ };
+ auto const dashE = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.ExcludeRegularExpression = expr;
+ return true;
+ };
+ auto const dashL = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.LabelRegularExpression.push_back(expr);
+ return true;
+ };
+ auto const dashLE = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.ExcludeLabelRegularExpression.push_back(expr);
+ return true;
+ };
+ auto const dashFA = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.ExcludeFixtureRegularExpression = expr;
+ return true;
+ };
+ auto const dashFS = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.ExcludeFixtureSetupRegularExpression = expr;
+ return true;
+ };
+ auto const dashFC = [this](std::string const& expr) -> bool {
+ this->Impl->TestOptions.ExcludeFixtureCleanupRegularExpression = expr;
+ return true;
+ };
- // --build-and-test options
- if (this->CheckArgument(arg, "--build-and-test"_s) &&
- i < args.size() - 1) {
- cmakeAndTest = true;
- validArg = true;
- }
+ using CommandArgument =
+ cmCommandLineArgument<bool(std::string const& value)>;
+
+ auto const arguments = std::vector<CommandArgument>{
+ CommandArgument{ "--dashboard", CommandArgument::Values::One, dashD },
+ CommandArgument{ "-D",
+ "-D must be followed by dashboard mode or VAR=VALUE.",
+ CommandArgument::Values::One, dashD },
+ CommandArgument{
+ "-D", "-D must be followed by dashboard mode or VAR=VALUE.",
+ CommandArgument::Values::One, CommandArgument::RequiresSeparator::No,
+ [this](std::string const& def) -> bool {
+ // Unsuccessful parsing of VAR=VALUE has historically
+ // been ignored.
+ this->AddVariableDefinition(def);
+ return true;
+ } },
+ CommandArgument{ "-T", CommandArgument::Values::One, dashT },
+ CommandArgument{ "--test-action", CommandArgument::Values::One, dashT },
+ CommandArgument{ "-M", CommandArgument::Values::One, dashM },
+ CommandArgument{ "--test-model", CommandArgument::Values::One, dashM },
+ CommandArgument{ "--extra-submit", CommandArgument::Values::One,
+ [this, &processSteps](std::string const& extra) -> bool {
+ processSteps = true;
+ this->SetTest("Submit");
+ return this->SubmitExtraFiles(extra);
+ } },
+ CommandArgument{
+ "--build-and-test", "--build-and-test must have source and binary dir",
+ CommandArgument::Values::Two,
+ [this, &cmakeAndTest](std::string const& dirs) -> bool {
+ cmakeAndTest = true;
+ cmList dirList{ dirs };
+ if (dirList.size() != 2) {
+ return false;
+ }
+ this->Impl->BuildAndTest.SourceDir =
+ cmSystemTools::ToNormalizedPathOnDisk(dirList[0]);
+ this->Impl->BuildAndTest.BinaryDir =
+ cmSystemTools::ToNormalizedPathOnDisk(dirList[1]);
+ cmSystemTools::MakeDirectory(this->Impl->BuildAndTest.BinaryDir);
+ return true;
+ } },
+ CommandArgument{ "--build-target", CommandArgument::Values::One,
+ [this](std::string const& t) -> bool {
+ this->Impl->BuildAndTest.BuildTargets.emplace_back(t);
+ return true;
+ } },
+ CommandArgument{ "--build-noclean", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->BuildAndTest.BuildNoClean = true;
+ return true;
+ } },
+ CommandArgument{ "--build-nocmake", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->BuildAndTest.BuildNoCMake = true;
+ return true;
+ } },
+ CommandArgument{ "--build-two-config", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->BuildAndTest.BuildTwoConfig = true;
+ return true;
+ } },
+ CommandArgument{ "--build-run-dir", CommandArgument::Values::One,
+ [this](std::string const& dir) -> bool {
+ this->Impl->BuildAndTest.BuildRunDir = dir;
+ return true;
+ } },
+ CommandArgument{ "--build-exe-dir", CommandArgument::Values::One,
+ [this](std::string const& dir) -> bool {
+ this->Impl->BuildAndTest.ExecutableDirectory = dir;
+ return true;
+ } },
+ CommandArgument{ "--test-timeout", CommandArgument::Values::One,
+ [this](std::string const& t) -> bool {
+ this->Impl->BuildAndTest.Timeout =
+ cmDuration(atof(t.c_str()));
+ return true;
+ } },
+ CommandArgument{ "--build-generator", CommandArgument::Values::One,
+ [this](std::string const& g) -> bool {
+ this->Impl->BuildAndTest.BuildGenerator = g;
+ return true;
+ } },
+ CommandArgument{ "--build-generator-platform",
+ CommandArgument::Values::One,
+ [this](std::string const& p) -> bool {
+ this->Impl->BuildAndTest.BuildGeneratorPlatform = p;
+ return true;
+ } },
+ CommandArgument{ "--build-generator-toolset", CommandArgument::Values::One,
+ [this](std::string const& t) -> bool {
+ this->Impl->BuildAndTest.BuildGeneratorToolset = t;
+ return true;
+ } },
+ CommandArgument{ "--build-project", CommandArgument::Values::One,
+ [this](std::string const& p) -> bool {
+ this->Impl->BuildAndTest.BuildProject = p;
+ return true;
+ } },
+ CommandArgument{ "--build-makeprogram", CommandArgument::Values::One,
+ [this](std::string const& p) -> bool {
+ this->Impl->BuildAndTest.BuildMakeProgram = p;
+ return true;
+ } },
+ CommandArgument{ "--build-config-sample", CommandArgument::Values::One,
+ [this](std::string const& s) -> bool {
+ this->Impl->BuildAndTest.ConfigSample = s;
+ return true;
+ } },
+ CommandArgument{ "-SP", CommandArgument::Values::One, dashSP },
+ CommandArgument{ "--script-new-process", CommandArgument::Values::One,
+ dashSP },
+ CommandArgument{ "-SR", CommandArgument::Values::One, dashSR },
+ CommandArgument{ "--script-run", CommandArgument::Values::One, dashSR },
+ CommandArgument{ "-S", CommandArgument::Values::One, dash_S },
+ CommandArgument{ "--script", CommandArgument::Values::One, dash_S },
+ CommandArgument{ "-F", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->Failover = true;
+ return true;
+ } },
+ CommandArgument{
+ "-j", CommandArgument::Values::ZeroOrOne,
+ [&dashJ](std::string const& j) -> bool { return dashJ("-j"_s, j); } },
+ CommandArgument{ "--parallel", CommandArgument::Values::ZeroOrOne,
+ [&dashJ](std::string const& j) -> bool {
+ return dashJ("--parallel"_s, j);
+ } },
+ CommandArgument{ "-j", CommandArgument::Values::One,
+ CommandArgument::RequiresSeparator::No,
+ [this](std::string const& j) -> bool {
+ // The value must be a non-negative integer.
+ unsigned long plevel = 0;
+ if (!cmStrToULong(j, &plevel)) {
+ cmSystemTools::Error(
+ cmStrCat("'-j' given invalid value '", j, '\''));
+ return false;
+ }
+ this->SetParallelLevel(plevel);
+ this->Impl->ParallelLevelSetInCli = true;
+ return true;
+ } },
+ CommandArgument{
+ "--repeat-until-fail", "'--repeat-until-fail' requires an argument",
+ CommandArgument::Values::One,
+ [this](std::string const& r) -> bool {
+ if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
+ cmSystemTools::Error("At most one '--repeat' option may be used.");
+ return false;
+ }
+ long repeat = 1;
+ if (!cmStrToLong(r, &repeat)) {
+ cmSystemTools::Error(cmStrCat(
+ "'--repeat-until-fail' given non-integer value '", r, '\''));
+ return false;
+ }
+ this->Impl->RepeatCount = static_cast<int>(repeat);
+ if (repeat > 1) {
+ this->Impl->RepeatMode = cmCTest::Repeat::UntilFail;
+ }
+ return true;
+ } },
+ CommandArgument{
+ "--repeat", CommandArgument::Values::One,
+ [this](std::string const& r) -> bool {
+ if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
+ cmSystemTools::Error("At most one '--repeat' option may be used.");
+ return false;
+ }
+ cmsys::RegularExpression repeatRegex(
+ "^(until-fail|until-pass|after-timeout):([0-9]+)$");
+ if (repeatRegex.find(r)) {
+ std::string const& count = repeatRegex.match(2);
+ unsigned long n = 1;
+ cmStrToULong(count, &n); // regex guarantees success
+ this->Impl->RepeatCount = static_cast<int>(n);
+ if (this->Impl->RepeatCount > 1) {
+ std::string const& mode = repeatRegex.match(1);
+ if (mode == "until-fail") {
+ this->Impl->RepeatMode = cmCTest::Repeat::UntilFail;
+ } else if (mode == "until-pass") {
+ this->Impl->RepeatMode = cmCTest::Repeat::UntilPass;
+ } else if (mode == "after-timeout") {
+ this->Impl->RepeatMode = cmCTest::Repeat::AfterTimeout;
+ }
+ }
+ } else {
+ cmSystemTools::Error(
+ cmStrCat("'--repeat' given invalid value '", r, '\''));
+ return false;
+ }
+ return true;
+ } },
+ CommandArgument{ "--test-load", CommandArgument::Values::One,
+ [this](std::string const& l) -> bool {
+ unsigned long load;
+ if (cmStrToULong(l, &load)) {
+ this->SetTestLoad(load);
+ } else {
+ cmCTestLog(
+ this, WARNING,
+ "Invalid value for 'Test Load' : " << l << '\n');
+ }
+ return true;
+ } },
+ CommandArgument{ "--no-compress-output", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->CompressTestOutput = false;
+ return true;
+ } },
+ CommandArgument{ "--print-labels", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->PrintLabels = true;
+ return true;
+ } },
+ CommandArgument{ "--http1.0", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->UseHTTP10 = true;
+ return true;
+ } },
+ CommandArgument{ "--timeout", CommandArgument::Values::One,
+ [this](std::string const& t) -> bool {
+ auto timeout = cmDuration(atof(t.c_str()));
+ this->Impl->GlobalTimeout = timeout;
+ return true;
+ } },
+ CommandArgument{ "--stop-time", CommandArgument::Values::One,
+ [this](std::string const& t) -> bool {
+ this->SetStopTime(t);
+ return true;
+ } },
+ CommandArgument{ "--stop-on-failure", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->StopOnFailure = true;
+ return true;
+ } },
+ CommandArgument{ "-C", CommandArgument::Values::One, dashC },
+ CommandArgument{ "--build-config", CommandArgument::Values::One, dashC },
+ CommandArgument{ "--debug", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->Debug = true;
+ return true;
+ } },
+ CommandArgument{ "--group", CommandArgument::Values::One, dashGroup },
+ // This is an undocumented / deprecated option.
+ // "Track" has been renamed to "Group".
+ CommandArgument{ "--track", CommandArgument::Values::One, dashGroup },
+ CommandArgument{ "--show-line-numbers", CommandArgument::Values::Zero,
+ [](std::string const&) -> bool {
+ // Silently ignore this never-documented and now-removed
+ // option.
+ return true;
+ } },
+ CommandArgument{ "--no-label-summary", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->LabelSummary = false;
+ return true;
+ } },
+ CommandArgument{ "--no-subproject-summary", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->SubprojectSummary = false;
+ return true;
+ } },
+ CommandArgument{ "--progress", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->TestProgressOutput = true;
+ return true;
+ } },
+ CommandArgument{ "-Q", CommandArgument::Values::Zero, dashQ },
+ CommandArgument{ "--quiet", CommandArgument::Values::Zero, dashQ },
+ CommandArgument{ "-V", CommandArgument::Values::Zero, dashV },
+ CommandArgument{ "--verbose", CommandArgument::Values::Zero, dashV },
+ CommandArgument{ "-VV", CommandArgument::Values::Zero, dashVV },
+ CommandArgument{ "--extra-verbose", CommandArgument::Values::Zero,
+ dashVV },
+ CommandArgument{ "--output-on-failure", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->OutputTestOutputOnTestFailure = true;
+ return true;
+ } },
+ CommandArgument{ "--test-output-size-passed", CommandArgument::Values::One,
+ [this](std::string const& sz) -> bool {
+ long outputSize;
+ if (cmStrToLong(sz, &outputSize)) {
+ this->Impl->TestOptions.OutputSizePassed =
+ static_cast<int>(outputSize);
+ } else {
+ cmCTestLog(
+ this, WARNING,
+ "Invalid value for '--test-output-size-passed': "
+ << sz << "\n");
+ }
+ return true;
+ } },
+ CommandArgument{ "--test-output-size-failed", CommandArgument::Values::One,
+ [this](std::string const& sz) -> bool {
+ long outputSize;
+ if (cmStrToLong(sz, &outputSize)) {
+ this->Impl->TestOptions.OutputSizeFailed =
+ static_cast<int>(outputSize);
+ } else {
+ cmCTestLog(
+ this, WARNING,
+ "Invalid value for '--test-output-size-failed': "
+ << sz << "\n");
+ }
+ return true;
+ } },
+ CommandArgument{
+ "--test-output-truncation", CommandArgument::Values::One,
+ [this](std::string const& mode) -> bool {
+ if (!SetTruncationMode(this->Impl->TestOptions.OutputTruncation,
+ mode)) {
+ cmSystemTools::Error(
+ cmStrCat("Invalid value for '--test-output-truncation': ", mode));
+ return false;
+ }
+ return true;
+ } },
+ CommandArgument{ "--show-only", CommandArgument::Values::ZeroOrOne,
+ [this](std::string const& format) -> bool {
+ this->Impl->ShowOnly = true;
+ // Check if a specific format is requested.
+ // Defaults to human readable text.
+ if (format == "json-v1") {
+ // Force quiet mode so the only output
+ // is the json object model.
+ this->Impl->Quiet = true;
+ this->Impl->OutputAsJson = true;
+ this->Impl->OutputAsJsonVersion = 1;
+ } else if (format == "human") {
+ } else if (!format.empty()) {
+ cmSystemTools::Error(
+ cmStrCat("'--show-only=' given unknown value '",
+ format, '\''));
+ return false;
+ }
+ return true;
+ } },
+ CommandArgument{ "-N", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->ShowOnly = true;
+ return true;
+ } },
+ CommandArgument{ "-O", CommandArgument::Values::One, dashO },
+ CommandArgument{ "--output-log", CommandArgument::Values::One, dashO },
+ CommandArgument{ "--tomorrow-tag", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->TomorrowTag = true;
+ return true;
+ } },
+ CommandArgument{ "--force-new-ctest-process",
+ CommandArgument::Values::Zero,
+ [](std::string const&) -> bool {
+ // Silently ignore now-removed option.
+ return true;
+ } },
+ CommandArgument{ "-W", CommandArgument::Values::One, dashW },
+ CommandArgument{ "--max-width", CommandArgument::Values::One, dashW },
+ CommandArgument{ "--interactive-debug-mode", CommandArgument::Values::One,
+ [this](std::string const& idm) -> bool {
+ this->Impl->InteractiveDebugMode = cmIsOn(idm);
+ return true;
+ } },
+ CommandArgument{ "--http-header", CommandArgument::Values::One,
+ [this](std::string const& h) -> bool {
+ this->Impl->CommandLineHttpHeaders.push_back(h);
+ return true;
+ } },
+ CommandArgument{ "--submit-index", CommandArgument::Values::One,
+ [this](std::string const& index) -> bool {
+ this->Impl->SubmitIndex = atoi(index.c_str());
+ if (this->Impl->SubmitIndex < 0) {
+ this->Impl->SubmitIndex = 0;
+ }
+ return true;
+ } },
+ CommandArgument{ "--overwrite", CommandArgument::Values::One,
+ [this](std::string const& opt) -> bool {
+ this->AddCTestConfigurationOverwrite(opt);
+ return true;
+ } },
+ CommandArgument{ "-A", CommandArgument::Values::One, dashA },
+ CommandArgument{ "--add-notes", CommandArgument::Values::One, dashA },
+ CommandArgument{ "--test-dir", "'--test-dir' requires an argument",
+ CommandArgument::Values::One,
+ [this](std::string const& dir) -> bool {
+ this->Impl->TestDir = dir;
+ return true;
+ } },
+ CommandArgument{ "--output-junit", CommandArgument::Values::One,
+ [this](std::string const& file) -> bool {
+ this->SetOutputJUnitFileName(file);
+ return true;
+ } },
+ CommandArgument{ "--no-tests", CommandArgument::Values::One,
+ [this](std::string const& action) -> bool {
+ if (action == "error"_s) {
+ this->Impl->NoTestsMode = cmCTest::NoTests::Error;
+ } else if (action == "ignore"_s) {
+ this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;
+ } else {
+ cmSystemTools::Error(
+ cmStrCat("'--no-tests=' given unknown value '",
+ action, '\''));
+ return false;
+ }
+ this->Impl->NoTestsModeSetInCli = true;
+ return true;
+ } },
+ CommandArgument{ "-I", CommandArgument::Values::One, dashI },
+ CommandArgument{ "--tests-information", CommandArgument::Values::One,
+ dashI },
+ CommandArgument{ "-U", CommandArgument::Values::One, dashU },
+ CommandArgument{ "--union", CommandArgument::Values::One, dashU },
+ CommandArgument{ "-R", CommandArgument::Values::One, dashR },
+ CommandArgument{ "--tests-regex", CommandArgument::Values::One, dashR },
+ CommandArgument{ "-E", CommandArgument::Values::One, dashE },
+ CommandArgument{ "--exclude-regex", CommandArgument::Values::One, dashE },
+ CommandArgument{ "-L", CommandArgument::Values::One, dashL },
+ CommandArgument{ "--label-regex", CommandArgument::Values::One, dashL },
+ CommandArgument{ "-LE", CommandArgument::Values::One, dashLE },
+ CommandArgument{ "--label-exclude", CommandArgument::Values::One, dashLE },
+ CommandArgument{ "-FA", CommandArgument::Values::One, dashFA },
+ CommandArgument{ "--fixture-exclude-any", CommandArgument::Values::One,
+ dashFA },
+ CommandArgument{ "-FS", CommandArgument::Values::One, dashFS },
+ CommandArgument{ "--fixture-exclude-setup", CommandArgument::Values::One,
+ dashFS },
+ CommandArgument{ "-FC", CommandArgument::Values::One, dashFC },
+ CommandArgument{ "--fixture-exclude-cleanup", CommandArgument::Values::One,
+ dashFC },
+ CommandArgument{ "--resource-spec-file", CommandArgument::Values::One,
+ [this](std::string const& file) -> bool {
+ this->Impl->TestOptions.ResourceSpecFile = file;
+ return true;
+ } },
+ CommandArgument{ "--tests-from-file", CommandArgument::Values::One,
+ [this](std::string const& file) -> bool {
+ this->Impl->TestOptions.TestListFile = file;
+ return true;
+ } },
+ CommandArgument{ "--exclude-from-file", CommandArgument::Values::One,
+ [this](std::string const& file) -> bool {
+ this->Impl->TestOptions.ExcludeTestListFile = file;
+ return true;
+ } },
+ CommandArgument{ "--schedule-random", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->TestOptions.ScheduleRandom = true;
+ return true;
+ } },
+ CommandArgument{ "--rerun-failed", CommandArgument::Values::Zero,
+ [this](std::string const&) -> bool {
+ this->Impl->TestOptions.RerunFailed = true;
+ return 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, validArg)) {
- cmCTestLog(
- this, ERROR_MESSAGE,
- "Problem parsing command line arguments within a handler\n");
- return 0;
+ // process the command line arguments
+ for (size_t i = 1; i < args.size(); ++i) {
+ std::string const& arg = args[i];
+ bool matched = false;
+ for (auto const& m : arguments) {
+ if (m.matches(arg)) {
+ matched = true;
+ if (!m.parse(arg, i, args)) {
+ return 1;
+ }
+ break;
}
}
-
- if (!validArg && cmHasLiteralPrefix(arg, "-") &&
+ if (!matched && arg == "--build-options"_s) {
+ matched = true;
+ while (i + 1 < args.size() && args[i + 1] != "--build-target"_s &&
+ args[i + 1] != "--test-command"_s) {
+ ++i;
+ this->Impl->BuildAndTest.BuildOptions.emplace_back(args[i]);
+ }
+ }
+ if (!matched && arg == "--test-command"_s && i + 1 < args.size()) {
+ matched = true;
+ ++i;
+ this->Impl->BuildAndTest.TestCommand = args[i];
+ while (i + 1 < args.size()) {
+ ++i;
+ this->Impl->BuildAndTest.TestCommandArgs.emplace_back(args[i]);
+ }
+ }
+ if (!matched && 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
if (!this->Impl->ParallelLevelSetInCli) {
@@ -2872,161 +2631,120 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
// now what should cmake do? if --build-and-test was specified then
// we run the build and test handler and return
if (cmakeAndTest) {
- return this->RunCMakeAndTest(output);
+ return this->RunCMakeAndTest();
}
- if (executeTests) {
- return this->ExecuteTests();
+ // -S, -SP, and/or -SP was specified
+ if (!runScripts.empty()) {
+ return this->RunScripts(runScripts);
}
- return 1;
-}
+ // Establish the working directory.
+ std::string const currDir = cmSystemTools::GetLogicalWorkingDirectory();
+ std::string workDir = currDir;
+ if (!this->Impl->TestDir.empty()) {
+ workDir = cmSystemTools::ToNormalizedPathOnDisk(this->Impl->TestDir);
+ }
+ cmWorkingDirectory changeDir(workDir);
+ if (changeDir.Failed()) {
+ cmCTestLog(this, ERROR_MESSAGE, changeDir.GetError() << std::endl);
+ return 1;
+ }
+ this->Impl->BinaryDir = workDir;
-bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i,
- 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)) {
- success = false;
- cmCTestLog(this, ERROR_MESSAGE,
- "CTest -T called with incorrect option: " << args[i] << '\n');
- /* clang-format off */
- cmCTestLog(this, ERROR_MESSAGE,
- "Available options are:\n"
- " " << ctestExec << " -T all\n"
- " " << ctestExec << " -T start\n"
- " " << ctestExec << " -T update\n"
- " " << ctestExec << " -T configure\n"
- " " << ctestExec << " -T build\n"
- " " << ctestExec << " -T test\n"
- " " << ctestExec << " -T coverage\n"
- " " << ctestExec << " -T memcheck\n"
- " " << ctestExec << " -T notes\n"
- " " << ctestExec << " -T submit\n");
- /* clang-format on */
- }
+ // -D, -T, and/or -M was specified
+ if (processSteps) {
+ return this->ProcessSteps();
}
- return success;
+
+ return this->ExecuteTests(args);
}
-bool cmCTest::HandleTestModelArgument(const char* ctestExec, size_t& i,
- const std::vector<std::string>& args,
- bool& validArg)
+int cmCTest::RunScripts(
+ std::vector<std::pair<std::string, bool>> const& scripts)
{
- 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) {
- this->SetTestModel(cmCTest::NIGHTLY);
- } else if (cmSystemTools::LowerCase(str) == "continuous"_s) {
- this->SetTestModel(cmCTest::CONTINUOUS);
- } else if (cmSystemTools::LowerCase(str) == "experimental"_s) {
- this->SetTestModel(cmCTest::EXPERIMENTAL);
- } else {
- success = false;
- cmCTestLog(this, ERROR_MESSAGE,
- "CTest -M called with incorrect option: " << str << '\n');
- /* clang-format off */
- cmCTestLog(this, ERROR_MESSAGE,
- "Available options are:\n"
- " " << ctestExec << " -M Continuous\n"
- " " << ctestExec << " -M Experimental\n"
- " " << ctestExec << " -M Nightly\n");
- /* clang-format on */
- }
+ if (this->Impl->ExtraVerbose) {
+ cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl);
+ }
+
+ auto ch = cm::make_unique<cmCTestScriptHandler>(this);
+ for (auto const& script : scripts) {
+ ch->AddConfigurationScript(script.first, script.second);
}
- return success;
+
+ int res = ch->ProcessHandler();
+ if (res != 0) {
+ cmCTestLog(this, DEBUG,
+ "running script failing returning: " << res << std::endl);
+ }
+
+ return res;
}
-int cmCTest::ExecuteTests()
+int cmCTest::ExecuteTests(std::vector<std::string> const& args)
{
- int res;
- // call process directory
- if (this->Impl->RunConfigurationScript) {
- if (this->Impl->ExtraVerbose) {
- cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl);
- }
- for (auto& handler : this->Impl->GetTestingHandlers()) {
- handler->SetVerbose(this->Impl->ExtraVerbose);
- handler->SetSubmitIndex(this->Impl->SubmitIndex);
- }
- this->GetScriptHandler()->SetVerbose(this->Impl->Verbose);
- res = this->GetScriptHandler()->ProcessHandler();
- if (res != 0) {
- cmCTestLog(this, DEBUG,
- "running script failing returning: " << res << std::endl);
- }
+ this->Impl->ExtraVerbose = this->Impl->Verbose;
+ this->Impl->Verbose = true;
+ cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
+ if (!this->Impl->InteractiveDebugMode) {
+ this->BlockTestErrorDiagnostics();
} else {
- // What is this? -V seems to be the same as -VV,
- // and Verbose is always on in this case
- this->Impl->ExtraVerbose = this->Impl->Verbose;
- this->Impl->Verbose = true;
- for (auto& handler : this->Impl->GetTestingHandlers()) {
- handler->SetVerbose(this->Impl->Verbose);
- handler->SetSubmitIndex(this->Impl->SubmitIndex);
- }
+ cmSystemTools::PutEnv("CTEST_INTERACTIVE_DEBUG_MODE=1");
+ }
- const std::string currDir = cmSystemTools::GetCurrentWorkingDirectory();
- std::string workDir = currDir;
- if (!this->Impl->TestDir.empty()) {
- workDir = cmSystemTools::CollapseFullPath(this->Impl->TestDir);
- }
+ this->UpdateCTestConfiguration();
- if (currDir != workDir) {
- if (!this->TryToChangeDirectory(workDir)) {
- return 1;
- }
- }
+ cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
- if (!this->Initialize(workDir, nullptr)) {
- res = 12;
- cmCTestLog(this, ERROR_MESSAGE,
- "Problem initializing the dashboard." << std::endl);
- } else {
- res = this->ProcessSteps();
- }
- this->Finalize();
+ cmCTestTestHandler handler(this);
- if (currDir != workDir) {
- cmSystemTools::ChangeDirectory(currDir);
- }
+ {
+ cmake cm(cmake::RoleScript, cmState::CTest);
+ cm.SetHomeDirectory("");
+ cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
+ cmGlobalGenerator gg(&cm);
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
+ this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
+ handler.PopulateCustomVectors(&mf);
}
- if (res != 0) {
- cmCTestLog(this, DEBUG,
- "Running a test(s) failed returning : " << res << std::endl);
+
+ handler.SetVerbose(this->Impl->Verbose);
+
+ cmInstrumentation instrumentation(this->GetBinaryDir());
+ auto processHandler = [&handler]() -> int {
+ return handler.ProcessHandler();
+ };
+ int ret = instrumentation.InstrumentCommand("ctest", args, processHandler);
+ instrumentation.CollectTimingData(cmInstrumentationQuery::Hook::PostTest);
+ if (ret < 0) {
+ cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n");
+ if (!this->Impl->OutputTestOutputOnTestFailure) {
+ std::string const lastTestLog =
+ this->GetBinaryDir() + "/Testing/Temporary/LastTest.log";
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Output from these tests are in: " << lastTestLog << '\n');
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Use \"--rerun-failed --output-on-failure\" to re-run the "
+ "failed cases verbosely.\n");
+ }
+ return cmCTest::TEST_ERRORS;
}
- return res;
+
+ return 0;
}
-int cmCTest::RunCMakeAndTest(std::string* output)
+int cmCTest::RunCMakeAndTest()
{
- this->Impl->Verbose = true;
- cmCTestBuildAndTestHandler* handler = this->GetBuildAndTestHandler();
- int retv = handler->ProcessHandler();
- *output = handler->GetOutput();
+ int retv = this->Impl->BuildAndTest.Run();
#ifndef CMAKE_BOOTSTRAP
cmDynamicLoader::FlushCache();
#endif
- if (retv != 0) {
- cmCTestLog(this, DEBUG,
- "build and test failing returning: " << retv << std::endl);
- }
return retv;
}
-void cmCTest::SetNotesFiles(const std::string& notes)
+void cmCTest::SetNotesFiles(std::string const& notes)
{
this->Impl->NotesFiles = notes;
}
@@ -3094,17 +2812,25 @@ void cmCTest::SetScheduleType(std::string const& type)
this->Impl->ScheduleType = type;
}
-int cmCTest::ReadCustomConfigurationFileTree(const std::string& dir,
- cmMakefile* mf)
+void cmCTest::ReadCustomConfigurationFileTree(std::string const& dir,
+ cmMakefile* mf)
{
- bool found = false;
cmCTestLog(this, DEBUG,
"* Read custom CTest configuration directory: " << dir
<< std::endl);
- std::string fname = cmStrCat(dir, "/CTestCustom.cmake");
- cmCTestLog(this, DEBUG, "* Check for file: " << fname << std::endl);
- if (cmSystemTools::FileExists(fname)) {
+ auto const fname = [this, &dir]() -> std::string {
+ for (char const* ext : { ".cmake", ".ctest" }) {
+ std::string path = cmStrCat(dir, "/CTestCustom", ext);
+ cmCTestLog(this, DEBUG, "* Check for file: " << path << std::endl);
+ if (cmSystemTools::FileExists(path)) {
+ return path;
+ }
+ }
+ return "";
+ }();
+
+ if (!fname.empty()) {
cmCTestLog(this, DEBUG,
"* Read custom CTest configuration file: " << fname
<< std::endl);
@@ -3116,46 +2842,13 @@ int cmCTest::ReadCustomConfigurationFileTree(const std::string& dir,
"Problem reading custom configuration: " << fname
<< std::endl);
}
- found = true;
if (erroroc) {
cmSystemTools::SetErrorOccurred();
}
}
-
- std::string rexpr = cmStrCat(dir, "/CTestCustom.ctest");
- cmCTestLog(this, DEBUG, "* Check for file: " << rexpr << std::endl);
- if (!found && cmSystemTools::FileExists(rexpr)) {
- cmsys::Glob gl;
- gl.RecurseOn();
- gl.FindFiles(rexpr);
- std::vector<std::string>& files = gl.GetFiles();
- for (const std::string& file : files) {
- cmCTestLog(this, DEBUG,
- "* Read custom CTest configuration file: " << file
- << std::endl);
- if (!mf->ReadListFile(file) || cmSystemTools::GetErrorOccurredFlag()) {
- cmCTestLog(this, ERROR_MESSAGE,
- "Problem reading custom configuration: " << file
- << std::endl);
- }
- }
- found = true;
- }
-
- if (found) {
- for (auto& handler : this->Impl->GetNamedTestingHandlers()) {
- cmCTestLog(this, DEBUG,
- "* Read custom CTest configuration vectors for handler: "
- << handler.first << " (" << handler.second << ")"
- << std::endl);
- handler.second->PopulateCustomVectors(mf);
- }
- }
-
- return 1;
}
-void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
+void cmCTest::PopulateCustomVector(cmMakefile* mf, std::string const& def,
std::vector<std::string>& vec)
{
cmValue dval = mf->GetDefinition(def);
@@ -3171,7 +2864,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
}
}
-void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def,
+void cmCTest::PopulateCustomInteger(cmMakefile* mf, std::string const& def,
int& val)
{
cmValue dval = mf->GetDefinition(def);
@@ -3181,12 +2874,11 @@ void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def,
val = atoi(dval->c_str());
}
-std::string cmCTest::GetShortPathToFile(const std::string& cfname)
+std::string cmCTest::GetShortPathToFile(std::string const& cfname)
{
- const std::string& sourceDir = cmSystemTools::CollapseFullPath(
- this->GetCTestConfiguration("SourceDirectory"));
- const std::string& buildDir = cmSystemTools::CollapseFullPath(
- this->GetCTestConfiguration("BuildDirectory"));
+ std::string const& sourceDir =
+ this->GetCTestConfiguration("SourceDirectory");
+ std::string const& buildDir = this->GetCTestConfiguration("BuildDirectory");
std::string fname = cmSystemTools::CollapseFullPath(cfname);
// Find relative paths to both directories
@@ -3231,7 +2923,7 @@ std::string cmCTest::GetShortPathToFile(const std::string& cfname)
return path;
}
-std::string cmCTest::GetCTestConfiguration(const std::string& name)
+std::string cmCTest::GetCTestConfiguration(std::string const& name)
{
if (this->Impl->CTestConfigurationOverwrites.find(name) !=
this->Impl->CTestConfigurationOverwrites.end()) {
@@ -3245,7 +2937,7 @@ void cmCTest::EmptyCTestConfiguration()
this->Impl->CTestConfiguration.clear();
}
-void cmCTest::SetCTestConfiguration(const char* name, const std::string& value,
+void cmCTest::SetCTestConfiguration(char const* name, std::string const& value,
bool suppress)
{
cmCTestOptionalLog(this, HANDLER_VERBOSE_OUTPUT,
@@ -3367,7 +3059,7 @@ std::vector<std::string>& cmCTest::GetInitialCommandLineArguments()
return this->Impl->InitialCommandLineArguments;
}
-const char* cmCTest::GetSpecificGroup()
+char const* cmCTest::GetSpecificGroup()
{
if (this->Impl->SpecificGroup.empty()) {
return nullptr;
@@ -3375,7 +3067,7 @@ const char* cmCTest::GetSpecificGroup()
return this->Impl->SpecificGroup.c_str();
}
-void cmCTest::SetSpecificGroup(const char* group)
+void cmCTest::SetSpecificGroup(char const* group)
{
if (!group) {
this->Impl->SpecificGroup.clear();
@@ -3409,10 +3101,9 @@ bool cmCTest::GetExtraVerbose() const
return this->Impl->ExtraVerbose;
}
-void cmCTest::SetStreams(std::ostream* out, std::ostream* err)
+bool cmCTest::GetInteractiveDebugMode() const
{
- this->Impl->StreamOut = out;
- this->Impl->StreamErr = err;
+ return this->Impl->InteractiveDebugMode;
}
bool cmCTest::GetLabelSummary() const
@@ -3430,7 +3121,7 @@ bool cmCTest::GetOutputTestOutputOnTestFailure() const
return this->Impl->OutputTestOutputOnTestFailure;
}
-const std::map<std::string, std::string>& cmCTest::GetDefinitions() const
+std::map<std::string, std::string> const& cmCTest::GetDefinitions() const
{
return this->Impl->Definitions;
}
@@ -3450,7 +3141,7 @@ cmCTest::NoTests cmCTest::GetNoTestsMode() const
return this->Impl->NoTestsMode;
}
-void cmCTest::SetBuildID(const std::string& id)
+void cmCTest::SetBuildID(std::string const& id)
{
this->Impl->BuildID = id;
}
@@ -3460,7 +3151,17 @@ std::string cmCTest::GetBuildID() const
return this->Impl->BuildID;
}
-void cmCTest::AddSubmitFile(Part part, const std::string& name)
+cmCTestTestOptions const& cmCTest::GetTestOptions() const
+{
+ return this->Impl->TestOptions;
+}
+
+std::vector<std::string> cmCTest::GetCommandLineHttpHeaders() const
+{
+ return this->Impl->CommandLineHttpHeaders;
+}
+
+void cmCTest::AddSubmitFile(Part part, std::string const& name)
{
this->Impl->Parts[part].SubmitFiles.emplace_back(name);
}
@@ -3475,12 +3176,7 @@ void cmCTest::ClearSubmitFiles(Part part)
this->Impl->Parts[part].SubmitFiles.clear();
}
-void cmCTest::SetSuppressUpdatingCTestConfiguration(bool val)
-{
- this->Impl->SuppressUpdatingCTestConfiguration = val;
-}
-
-void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
+void cmCTest::AddCTestConfigurationOverwrite(std::string const& overStr)
{
size_t epos = overStr.find('=');
if (epos == std::string::npos) {
@@ -3496,7 +3192,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
this->Impl->CTestConfigurationOverwrites[key] = value;
}
-void cmCTest::SetConfigType(const std::string& ct)
+void cmCTest::SetConfigType(std::string const& ct)
{
this->Impl->ConfigType = ct;
cmSystemTools::ReplaceString(this->Impl->ConfigType, ".\\", "");
@@ -3505,7 +3201,7 @@ void cmCTest::SetConfigType(const std::string& ct)
}
bool cmCTest::SetCTestConfigurationFromCMakeVariable(
- cmMakefile* mf, const char* dconfig, const std::string& cmake_var,
+ cmMakefile* mf, char const* dconfig, std::string const& cmake_var,
bool suppress)
{
cmValue ctvar = mf->GetDefinition(cmake_var);
@@ -3520,12 +3216,90 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(
return true;
}
+void cmCTest::SetCMakeVariables(cmMakefile& mf)
+{
+ auto set = [&](char const* cmake_var, char const* ctest_opt) {
+ std::string val = this->GetCTestConfiguration(ctest_opt);
+ if (!val.empty()) {
+ cmCTestOptionalLog(
+ this, HANDLER_VERBOSE_OUTPUT,
+ "SetCMakeVariable:" << cmake_var << ":" << val << std::endl, false);
+ mf.AddDefinition(cmake_var, val);
+ }
+ };
+
+ set("CTEST_SITE", "Site");
+ set("CTEST_BUILD_NAME", "BuildName");
+ set("CTEST_NIGHTLY_START_TIME", "NightlyStartTime");
+ set("CTEST_SOURCE_DIRECTORY", "SourceDirectory");
+ set("CTEST_BINARY_DIRECTORY", "BuildDirectory");
+
+ // CTest Update Step
+ set("CTEST_UPDATE_COMMAND", "UpdateCommand");
+ set("CTEST_UPDATE_OPTIONS", "UpdateOptions");
+ set("CTEST_UPDATE_TYPE", "UpdateType");
+ set("CTEST_CVS_COMMAND", "CVSCommand");
+ set("CTEST_CVS_UPDATE_OPTIONS", "CVSUpdateOptions");
+ set("CTEST_SVN_COMMAND", "SVNCommand");
+ set("CTEST_SVN_UPDATE_OPTIONS", "SVNUpdateOptions");
+ set("CTEST_SVN_OPTIONS", "SVNOptions");
+ set("CTEST_BZR_COMMAND", "BZRCommand");
+ set("CTEST_BZR_UPDATE_OPTIONS", "BZRUpdateOptions");
+ set("CTEST_GIT_COMMAND", "GITCommand");
+ set("CTEST_GIT_UPDATE_OPTIONS", "GITUpdateOptions");
+ set("CTEST_GIT_INIT_SUBMODULES", "GITInitSubmodules");
+ set("CTEST_GIT_UPDATE_CUSTOM", "GITUpdateCustom");
+ set("CTEST_UPDATE_VERSION_ONLY", "UpdateVersionOnly");
+ set("CTEST_UPDATE_VERSION_OVERRIDE", "UpdateVersionOverride");
+ set("CTEST_HG_COMMAND", "HGCommand");
+ set("CTEST_HG_UPDATE_OPTIONS", "HGUpdateOptions");
+ set("CTEST_P4_COMMAND", "P4Command");
+ set("CTEST_P4_UPDATE_CUSTOM", "P4UpdateCustom");
+ set("CTEST_P4_UPDATE_OPTIONS", "P4UpdateOptions");
+ set("CTEST_P4_CLIENT", "P4Client");
+ set("CTEST_P4_OPTIONS", "P4Options");
+
+ // CTest Configure Step
+ set("CTEST_CONFIGURE_COMMAND", "ConfigureCommand");
+ set("CTEST_LABELS_FOR_SUBPROJECTS", "LabelsForSubprojects");
+
+ // CTest Build Step
+ set("CTEST_BUILD_COMMAND", "MakeCommand");
+ set("CTEST_USE_LAUNCHERS", "UseLaunchers");
+
+ // CTest Test Step
+ set("CTEST_TEST_TIMEOUT", "TimeOut");
+
+ // CTest Coverage Step
+ set("CTEST_COVERAGE_COMMAND", "CoverageCommand");
+ set("CTEST_COVERAGE_EXTRA_FLAGS", "CoverageExtraFlags");
+
+ // CTest MemCheck Step
+ set("CTEST_MEMORYCHECK_TYPE", "MemoryCheckType");
+ set("CTEST_MEMORYCHECK_SANITIZER_OPTIONS", "MemoryCheckSanitizerOptions");
+ set("CTEST_MEMORYCHECK_COMMAND", "MemoryCheckCommand");
+ set("CTEST_MEMORYCHECK_COMMAND_OPTIONS", "MemoryCheckCommandOptions");
+ set("CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", "MemoryCheckSuppressionFile");
+
+ // CTest Submit Step
+ set("CTEST_SUBMIT_URL", "SubmitURL");
+ set("CTEST_DROP_METHOD", "DropMethod");
+ set("CTEST_DROP_SITE_USER", "DropSiteUser");
+ set("CTEST_DROP_SITE_PASSWORD", "DropSitePassword");
+ set("CTEST_DROP_SITE", "DropSite");
+ set("CTEST_DROP_LOCATION", "DropLocation");
+ set("CTEST_TLS_VERIFY", "TLSVerify");
+ set("CTEST_TLS_VERSION", "TLSVersion");
+ set("CTEST_CURL_OPTIONS", "CurlOptions");
+ set("CTEST_SUBMIT_INACTIVITY_TIMEOUT", "SubmitInactivityTimeout");
+}
+
bool cmCTest::RunCommand(std::vector<std::string> const& args,
std::string* stdOut, std::string* stdErr, int* retVal,
- const char* dir, cmDuration timeout,
+ char const* dir, cmDuration timeout,
Encoding encoding)
{
- std::vector<const char*> argv;
+ std::vector<char const*> argv;
argv.reserve(args.size() + 1);
for (std::string const& a : args) {
argv.push_back(a.c_str());
@@ -3610,7 +3384,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args,
bool result = true;
if (timedOut) {
- const char* error_str = "Process terminated due to timeout\n";
+ char const* error_str = "Process terminated due to timeout\n";
cmCTestLog(this, ERROR_MESSAGE, error_str << std::endl);
stdErr->append(error_str, strlen(error_str));
result = false;
@@ -3638,7 +3412,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args,
return result;
}
-void cmCTest::SetOutputLogFileName(const std::string& name)
+void cmCTest::SetOutputLogFileName(std::string const& name)
{
if (!name.empty()) {
this->Impl->OutputLogFile = cm::make_unique<cmGeneratedFileStream>(name);
@@ -3647,36 +3421,27 @@ void cmCTest::SetOutputLogFileName(const std::string& name)
}
}
-void cmCTest::SetOutputJUnitFileName(const std::string& name)
+void cmCTest::SetOutputJUnitFileName(std::string const& name)
{
- this->Impl->TestHandler.SetJUnitXMLFileName(name);
+ this->Impl->TestOptions.JUnitXMLFileName = name;
// Turn test output compression off.
// This makes it easier to include test output in the resulting
// JUnit XML report.
this->Impl->CompressTestOutput = false;
}
-static const char* cmCTestStringLogType[] = { "DEBUG",
+static char const* cmCTestStringLogType[] = { "DEBUG",
"OUTPUT",
"HANDLER_OUTPUT",
"HANDLER_PROGRESS_OUTPUT",
"HANDLER_TEST_PROGRESS_OUTPUT",
"HANDLER_VERBOSE_OUTPUT",
"WARNING",
- "ERROR_MESSAGE",
- nullptr };
-
-#define cmCTestLogOutputFileLine(stream) \
- do { \
- if (this->Impl->ShowLineNumbers) { \
- (stream) << std::endl << file << ":" << line << " "; \
- } \
- } while (false)
+ "ERROR_MESSAGE" };
-void cmCTest::Log(int logType, const char* file, int line, const char* msg,
- bool suppress)
+void cmCTest::Log(LogType logType, std::string msg, bool suppress)
{
- if (!msg || !*msg) {
+ if (msg.empty()) {
return;
}
if (suppress && logType != cmCTest::ERROR_MESSAGE) {
@@ -3696,49 +3461,38 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg,
display = false;
}
if (display) {
- cmCTestLogOutputFileLine(*this->Impl->OutputLogFile);
- if (logType != this->Impl->OutputLogFileLastTag) {
- *this->Impl->OutputLogFile << "[";
- if (logType >= OTHER || logType < 0) {
- *this->Impl->OutputLogFile << "OTHER";
- } else {
- *this->Impl->OutputLogFile << cmCTestStringLogType[logType];
- }
- *this->Impl->OutputLogFile << "] " << std::endl;
+ if (this->Impl->OutputLogFileLastTag &&
+ logType != *this->Impl->OutputLogFileLastTag) {
+ *this->Impl->OutputLogFile << "[" << cmCTestStringLogType[logType]
+ << "] " << std::endl;
}
*this->Impl->OutputLogFile << msg << std::flush;
- if (logType != this->Impl->OutputLogFileLastTag) {
+ if (this->Impl->OutputLogFileLastTag &&
+ logType != *this->Impl->OutputLogFileLastTag) {
*this->Impl->OutputLogFile << std::endl;
this->Impl->OutputLogFileLastTag = logType;
}
}
}
if (!this->Impl->Quiet) {
- std::ostream& out = *this->Impl->StreamOut;
- std::ostream& err = *this->Impl->StreamErr;
-
if (logType == HANDLER_TEST_PROGRESS_OUTPUT) {
if (this->Impl->TestProgressOutput) {
- cmCTestLogOutputFileLine(out);
if (this->Impl->FlushTestProgressLine) {
printf("\r");
this->Impl->FlushTestProgressLine = false;
- out.flush();
+ std::cout.flush();
}
- std::string msg_str{ msg };
- auto const lineBreakIt = msg_str.find('\n');
- if (lineBreakIt != std::string::npos) {
+ if (msg.find('\n') != std::string::npos) {
this->Impl->FlushTestProgressLine = true;
- msg_str.erase(std::remove(msg_str.begin(), msg_str.end(), '\n'),
- msg_str.end());
+ msg.erase(std::remove(msg.begin(), msg.end(), '\n'), msg.end());
}
- out << msg_str;
+ std::cout << msg;
#ifndef _WIN32
printf("\x1B[K"); // move caret to end
#endif
- out.flush();
+ std::cout.flush();
return;
}
logType = HANDLER_OUTPUT;
@@ -3747,41 +3501,29 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg,
switch (logType) {
case DEBUG:
if (this->Impl->Debug) {
- cmCTestLogOutputFileLine(out);
- out << msg;
- out.flush();
+ std::cout << msg << std::flush;
}
break;
case OUTPUT:
case HANDLER_OUTPUT:
if (this->Impl->Debug || this->Impl->Verbose) {
- cmCTestLogOutputFileLine(out);
- out << msg;
- out.flush();
+ std::cout << msg << std::flush;
}
break;
case HANDLER_VERBOSE_OUTPUT:
if (this->Impl->Debug || this->Impl->ExtraVerbose) {
- cmCTestLogOutputFileLine(out);
- out << msg;
- out.flush();
+ std::cout << msg << std::flush;
}
break;
case WARNING:
- cmCTestLogOutputFileLine(err);
- err << msg;
- err.flush();
+ std::cerr << msg << std::flush;
break;
case ERROR_MESSAGE:
- cmCTestLogOutputFileLine(err);
- err << msg;
- err.flush();
+ std::cerr << msg << std::flush;
cmSystemTools::SetErrorOccurred();
break;
default:
- cmCTestLogOutputFileLine(out);
- out << msg;
- out.flush();
+ std::cout << msg << std::flush;
}
}
}
@@ -3789,34 +3531,35 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg,
std::string cmCTest::GetColorCode(Color color) const
{
if (this->Impl->OutputColorCode) {
- return "\033[0;" + std::to_string(static_cast<int>(color)) + "m";
+ return cmStrCat("\033[0;", static_cast<int>(color), 'm');
}
- return "";
+ return {};
}
-cmDuration cmCTest::GetRemainingTimeAllowed()
+void cmCTest::SetTimeLimit(cmValue val)
{
- return this->GetScriptHandler()->GetRemainingTimeAllowed();
+ this->Impl->TimeLimit =
+ val ? cmDuration(atof(val->c_str())) : cmCTest::MaxDuration();
}
-cmDuration cmCTest::MaxDuration()
+cmDuration cmCTest::GetElapsedTime() const
{
- return cmDuration(1.0e7);
+ return std::chrono::duration_cast<cmDuration>(
+ std::chrono::steady_clock::now() - this->Impl->StartTime);
}
-void cmCTest::SetRunCurrentScript(bool value)
+cmDuration cmCTest::GetRemainingTimeAllowed() const
{
- this->GetScriptHandler()->SetRunCurrentScript(value);
+ if (this->Impl->TimeLimit == cmCTest::MaxDuration()) {
+ return cmCTest::MaxDuration();
+ }
+ return this->Impl->TimeLimit - this->GetElapsedTime();
}
-void cmCTest::OutputTestErrors(std::vector<char> const& process_output)
+cmDuration cmCTest::MaxDuration()
{
- std::string test_outputs("\n*** Test Failed:\n");
- if (!process_output.empty()) {
- test_outputs.append(process_output.data(), process_output.size());
- }
- cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl);
+ return cmDuration(1.0e7);
}
bool cmCTest::CompressString(std::string& str)
@@ -3863,3 +3606,192 @@ bool cmCTest::CompressString(std::string& str)
return true;
}
+
+bool cmCTest::StartResultingXML(Part part, char const* name, int submitIndex,
+ cmGeneratedFileStream& xofs)
+{
+ if (!name) {
+ cmCTestLog(
+ this, ERROR_MESSAGE,
+ "Cannot create resulting XML file without providing the name\n");
+ return false;
+ }
+ if (submitIndex == 0) {
+ submitIndex = this->Impl->SubmitIndex;
+ }
+ std::ostringstream ostr;
+ ostr << name;
+ if (submitIndex > 0) {
+ ostr << "_" << submitIndex;
+ }
+ ostr << ".xml";
+ if (this->Impl->CurrentTag.empty()) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Current Tag empty, this may mean NightlyStartTime / "
+ "CTEST_NIGHTLY_START_TIME was not set correctly. Or "
+ "maybe you forgot to call ctest_start() before calling "
+ "ctest_configure().\n");
+ cmSystemTools::SetFatalErrorOccurred();
+ return false;
+ }
+ if (!this->OpenOutputFile(this->Impl->CurrentTag, ostr.str(), xofs, true)) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Cannot create resulting XML file: " << ostr.str() << '\n');
+ return false;
+ }
+ this->AddSubmitFile(part, ostr.str());
+ return true;
+}
+
+bool cmCTest::StartLogFile(char const* name, int submitIndex,
+ cmGeneratedFileStream& xofs)
+{
+ if (!name) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Cannot create log file without providing the name\n");
+ return false;
+ }
+ if (submitIndex == 0) {
+ submitIndex = this->Impl->SubmitIndex;
+ }
+ std::ostringstream ostr;
+ ostr << "Last" << name;
+ if (submitIndex > 0) {
+ ostr << "_" << submitIndex;
+ }
+ if (!this->Impl->CurrentTag.empty()) {
+ ostr << "_" << this->Impl->CurrentTag;
+ }
+ ostr << ".log";
+ if (!this->OpenOutputFile("Temporary", ostr.str(), xofs)) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Cannot create log file: " << ostr.str() << '\n');
+ return false;
+ }
+ return true;
+}
+
+cmInstrumentation& cmCTest::GetInstrumentation()
+{
+ if (!this->Impl->Instrumentation) {
+ this->Impl->Instrumentation =
+ cm::make_unique<cmInstrumentation>(this->GetBinaryDir());
+ }
+ return *this->Impl->Instrumentation;
+}
+
+bool cmCTest::GetUseVerboseInstrumentation() const
+{
+ return this->Impl->UseVerboseInstrumentation;
+}
+
+void cmCTest::ConvertInstrumentationSnippetsToXML(cmXMLWriter& xml,
+ std::string const& subdir)
+{
+ std::string data_dir =
+ cmStrCat(this->GetInstrumentation().GetCDashDir(), '/', subdir);
+
+ cmsys::Directory d;
+ if (!d.Load(data_dir) || d.GetNumberOfFiles() == 0) {
+ return;
+ }
+
+ xml.StartElement("Commands");
+
+ for (unsigned int i = 0; i < d.GetNumberOfFiles(); i++) {
+ std::string fpath = d.GetFilePath(i);
+ std::string fname = d.GetFile(i);
+ if (fname.rfind('.', 0) == 0) {
+ continue;
+ }
+ this->ConvertInstrumentationJSONFileToXML(fpath, xml);
+ }
+
+ xml.EndElement(); // Commands
+}
+
+bool cmCTest::ConvertInstrumentationJSONFileToXML(std::string const& fpath,
+ cmXMLWriter& xml)
+{
+ Json::Value root;
+ this->Impl->parseState = cmJSONState(fpath, &root);
+ if (!this->Impl->parseState.errors.empty()) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ this->Impl->parseState.GetErrorMessage(true) << std::endl);
+ return false;
+ }
+
+ if (root.type() != Json::objectValue) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Expected object, found " << root.type() << " for "
+ << root.asString() << std::endl);
+ return false;
+ }
+
+ std::vector<std::string> required_members = {
+ "command",
+ "role",
+ "dynamicSystemInformation",
+ };
+ for (std::string const& required_member : required_members) {
+ if (!root.isMember(required_member)) {
+ cmCTestLog(this, ERROR_MESSAGE,
+ fpath << " is missing the '" << required_member << "' key"
+ << std::endl);
+ return false;
+ }
+ }
+
+ // Do not record command-level data for Test.xml files because
+ // it is redundant with information actually captured by CTest.
+ bool generating_test_xml = root["role"] == "test";
+ if (!generating_test_xml) {
+ std::string element_name = root["role"].asString();
+ element_name[0] = static_cast<char>(std::toupper(element_name[0]));
+ xml.StartElement(element_name);
+ std::vector<std::string> keys = root.getMemberNames();
+ for (auto const& key : keys) {
+ auto key_type = root[key].type();
+ if (key_type == Json::objectValue || key_type == Json::arrayValue) {
+ continue;
+ }
+ if (key == "role" || key == "target" || key == "targetType" ||
+ key == "targetLabels") {
+ continue;
+ }
+ // Truncate the full command line if verbose instrumentation
+ // was not requested.
+ if (key == "command" && !this->GetUseVerboseInstrumentation()) {
+ std::string command_str = root[key].asString();
+ std::string truncated = command_str.substr(0, command_str.find(' '));
+ if (command_str != truncated) {
+ truncated = cmStrCat(truncated, " (truncated)");
+ }
+ xml.Attribute(key.c_str(), truncated);
+ continue;
+ }
+ xml.Attribute(key.c_str(), root[key].asString());
+ }
+ }
+
+ // Record dynamicSystemInformation section as XML.
+ auto dynamic_information = root["dynamicSystemInformation"];
+ std::vector<std::string> keys = dynamic_information.getMemberNames();
+ for (auto const& key : keys) {
+ std::string measurement_name = key;
+ measurement_name[0] = static_cast<char>(std::toupper(measurement_name[0]));
+
+ xml.StartElement("NamedMeasurement");
+ xml.Attribute("type", "numeric/double");
+ xml.Attribute("name", measurement_name);
+ xml.Element("Value", dynamic_information[key].asString());
+ xml.EndElement(); // NamedMeasurement
+ }
+
+ if (!generating_test_xml) {
+ xml.EndElement(); // role
+ }
+
+ cmSystemTools::RemoveFile(fpath);
+ return true;
+}
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 85f75fd..53e9b0e 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,6 +10,7 @@
#include <memory>
#include <sstream>
#include <string>
+#include <utility>
#include <vector>
#include <cm/optional>
@@ -18,20 +19,13 @@
#include "cmDuration.h"
#include "cmProcessOutput.h"
-class cmCTestBuildHandler;
-class cmCTestBuildAndTestHandler;
-class cmCTestCoverageHandler;
-class cmCTestScriptHandler;
-class cmCTestTestHandler;
-class cmCTestUpdateHandler;
-class cmCTestConfigureHandler;
-class cmCTestMemCheckHandler;
-class cmCTestSubmitHandler;
-class cmCTestUploadHandler;
-class cmCTestStartCommand;
+class cmake;
class cmGeneratedFileStream;
+class cmInstrumentation;
class cmMakefile;
+class cmValue;
class cmXMLWriter;
+struct cmCTestTestOptions;
/** \class cmCTest
* \brief Represents a ctest invocation.
@@ -64,33 +58,19 @@ public:
/** Get a testing part id from its string name. Returns PartCount
if the string does not name a valid part. */
- Part GetPartFromName(const std::string& name);
+ Part GetPartFromName(std::string const& name);
/** Process Command line arguments */
- int Run(std::vector<std::string>&, std::string* output = nullptr);
+ int Run(std::vector<std::string> const& args);
- /**
- * Initialize and finalize testing
- */
- bool InitializeFromCommand(cmCTestStartCommand* command);
- void Finalize();
+ /** Initialize a dashboard run in the given build tree. */
+ void Initialize(std::string const& binary_dir);
+
+ bool CreateNewTag(bool quiet);
+ bool ReadExistingTag(bool quiet);
/**
* Process the dashboard client steps.
- *
- * Steps are enabled using SetTest()
- *
- * The execution of the steps (or #Part) should look like this:
- *
- * /code
- * ctest foo;
- * foo.Initialize();
- * // Set some things on foo
- * foo.ProcessSteps();
- * foo.Finalize();
- * /endcode
- *
- * \sa Initialize(), Finalize(), Part, PartInfo, SetTest()
*/
int ProcessSteps();
@@ -126,13 +106,13 @@ public:
/**
* Check if CTest file exists
*/
- bool CTestFileExists(const std::string& filename);
- bool AddIfExists(Part part, const std::string& file);
+ bool CTestFileExists(std::string const& filename);
+ bool AddIfExists(Part part, std::string const& file);
/**
* Set the cmake test
*/
- bool SetTest(const std::string&, bool report = true);
+ bool SetTest(std::string const&, bool report = true);
/**
* Set the cmake test mode (experimental, nightly, continuous).
@@ -140,12 +120,13 @@ public:
void SetTestModel(int mode);
int GetTestModel() const;
- std::string GetTestModelString();
- static int GetTestModelFromString(const std::string& str);
- static std::string CleanString(const std::string& str,
+ std::string GetTestModelString() const;
+ std::string GetTestGroupString() const;
+ static int GetTestModelFromString(std::string const& str);
+ static std::string CleanString(std::string const& str,
std::string::size_type spos = 0);
- std::string GetCTestConfiguration(const std::string& name);
- void SetCTestConfiguration(const char* name, const std::string& value,
+ std::string GetCTestConfiguration(std::string const& name);
+ void SetCTestConfiguration(char const* name, std::string const& value,
bool suppress = false);
void EmptyCTestConfiguration();
@@ -157,15 +138,15 @@ public:
cmCTest();
~cmCTest();
- cmCTest(const cmCTest&) = delete;
- cmCTest& operator=(const cmCTest&) = delete;
+ cmCTest(cmCTest const&) = delete;
+ cmCTest& operator=(cmCTest const&) = delete;
/** Set the notes files to be created. */
- void SetNotesFiles(const std::string& notes);
+ void SetNotesFiles(std::string const& notes);
- void PopulateCustomVector(cmMakefile* mf, const std::string& definition,
+ void PopulateCustomVector(cmMakefile* mf, std::string const& definition,
std::vector<std::string>& vec);
- void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val);
+ void PopulateCustomInteger(cmMakefile* mf, std::string const& def, int& val);
/** Get the current time as string */
std::string CurrentTime();
@@ -175,19 +156,22 @@ public:
/** base64 encode a file */
std::string Base64EncodeFile(std::string const& file);
+ void SetTimeLimit(cmValue val);
+ cmDuration GetElapsedTime() const;
+
/**
* Return the time remaining that the script is allowed to run in
* seconds if the user has set the variable CTEST_TIME_LIMIT. If that has
* not been set it returns a very large duration.
*/
- cmDuration GetRemainingTimeAllowed();
+ cmDuration GetRemainingTimeAllowed() const;
static cmDuration MaxDuration();
/**
* Open file in the output directory and set the stream
*/
- bool OpenOutputFile(const std::string& path, const std::string& name,
+ bool OpenOutputFile(std::string const& path, std::string const& name,
cmGeneratedFileStream& stream, bool compress = false);
/** Should we only show what we would do? */
@@ -235,7 +219,7 @@ public:
*/
bool RunCommand(std::vector<std::string> const& args, std::string* stdOut,
std::string* stdErr, int* retVal = nullptr,
- const char* dir = nullptr,
+ char const* dir = nullptr,
cmDuration timeout = cmDuration::zero(),
Encoding encoding = cmProcessOutput::Auto);
@@ -243,10 +227,10 @@ public:
* Clean/make safe for xml the given value such that it may be used as
* one of the key fields by CDash when computing the buildid.
*/
- static std::string SafeBuildIdField(const std::string& value);
+ static std::string SafeBuildIdField(std::string const& value);
/** Start CTest XML output file */
- void StartXML(cmXMLWriter& xml, bool append);
+ void StartXML(cmXMLWriter& xml, cmake* cm, bool append);
/** End CTest XML output file */
void EndXML(cmXMLWriter& xml);
@@ -255,8 +239,8 @@ public:
* Run command specialized for make and configure. Returns process status
* and retVal is return value or exception.
*/
- bool RunMakeCommand(const std::string& command, std::string& output,
- int* retVal, const char* dir, cmDuration timeout,
+ bool RunMakeCommand(std::string const& command, std::string& output,
+ int* retVal, char const* dir, cmDuration timeout,
std::ostream& ofs,
Encoding encoding = cmProcessOutput::Auto);
@@ -272,7 +256,7 @@ public:
* This means if the file is in binary or
* source directory, it will become /.../relative/path/to/file
*/
- std::string GetShortPathToFile(const std::string& fname);
+ std::string GetShortPathToFile(std::string const& fname);
enum
{
@@ -299,77 +283,51 @@ public:
void SetProduceXML(bool v);
/**
- * Run command specialized for tests. Returns process status and retVal is
- * return value or exception. If environment is non-null, it is used to set
- * environment variables prior to running the test. After running the test,
- * environment variables are restored to their previous values.
- */
- bool RunTest(const std::vector<std::string>& args, std::string* output,
- int* retVal, std::ostream* logfile, cmDuration testTimeOut,
- std::vector<std::string>* environment,
- Encoding encoding = cmProcessOutput::Auto);
-
- /**
- * Get the handler object
- */
- cmCTestBuildHandler* GetBuildHandler();
- cmCTestBuildAndTestHandler* GetBuildAndTestHandler();
- cmCTestCoverageHandler* GetCoverageHandler();
- cmCTestScriptHandler* GetScriptHandler();
- cmCTestTestHandler* GetTestHandler();
- cmCTestUpdateHandler* GetUpdateHandler();
- cmCTestConfigureHandler* GetConfigureHandler();
- cmCTestMemCheckHandler* GetMemCheckHandler();
- cmCTestSubmitHandler* GetSubmitHandler();
- cmCTestUploadHandler* GetUploadHandler();
-
- /**
* Set the CTest variable from CMake variable
*/
bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf,
- const char* dconfig,
- const std::string& cmake_var,
+ char const* dconfig,
+ std::string const& cmake_var,
bool suppress = false);
- /** Decode a URL to the original string. */
- static std::string DecodeURL(const std::string&);
-
/**
- * Should ctect configuration be updated. When using new style ctest
- * script, this should be true.
+ * Set CMake variables from CTest Options
*/
- void SetSuppressUpdatingCTestConfiguration(bool val);
+ void SetCMakeVariables(cmMakefile& mf);
+
+ /** Decode a URL to the original string. */
+ static std::string DecodeURL(std::string const&);
/**
* Add overwrite to ctest configuration.
*
* The format is key=value
*/
- void AddCTestConfigurationOverwrite(const std::string& encstr);
+ void AddCTestConfigurationOverwrite(std::string const& encstr);
/** Create XML file that contains all the notes specified */
- int GenerateNotesFile(std::vector<std::string> const& files);
+ int GenerateNotesFile(cmake* cm, std::vector<std::string> const& files);
/** Create XML file to indicate that build is complete */
int GenerateDoneFile();
/** Submit extra files to the server */
- bool SubmitExtraFiles(const std::string& files);
+ bool SubmitExtraFiles(std::string const& files);
bool SubmitExtraFiles(std::vector<std::string> const& files);
/** Set the output log file name */
- void SetOutputLogFileName(const std::string& name);
+ void SetOutputLogFileName(std::string const& name);
/** Set the output JUnit file name */
- void SetOutputJUnitFileName(const std::string& name);
+ void SetOutputJUnitFileName(std::string const& name);
/** Set the visual studio or Xcode config type */
- void SetConfigType(const std::string& ct);
+ void SetConfigType(std::string const& ct);
/** Various log types */
- enum
+ enum LogType
{
- DEBUG = 0,
+ DEBUG,
OUTPUT,
HANDLER_OUTPUT,
HANDLER_PROGRESS_OUTPUT,
@@ -377,12 +335,10 @@ public:
HANDLER_VERBOSE_OUTPUT,
WARNING,
ERROR_MESSAGE,
- OTHER
};
/** Add log to the output */
- void Log(int logType, const char* file, int line, const char* msg,
- bool suppress = false);
+ void Log(LogType logType, std::string msg, bool suppress = false);
/** Color values */
enum class Color
@@ -398,24 +354,24 @@ public:
std::string GetColorCode(Color color) const;
/** The Build ID is assigned by CDash */
- void SetBuildID(const std::string& id);
+ void SetBuildID(std::string const& id);
std::string GetBuildID() const;
/** Add file to be submitted */
- void AddSubmitFile(Part part, const std::string& name);
+ void AddSubmitFile(Part part, std::string const& name);
std::vector<std::string> const& GetSubmitFiles(Part part) const;
void ClearSubmitFiles(Part part);
/**
* Read the custom configuration files and apply them to the current ctest
*/
- int ReadCustomConfigurationFileTree(const std::string& dir, cmMakefile* mf);
+ void ReadCustomConfigurationFileTree(std::string const& dir, cmMakefile* mf);
std::vector<std::string>& GetInitialCommandLineArguments();
/** Set the group to submit to */
- void SetSpecificGroup(const char* group);
- const char* GetSpecificGroup();
+ void SetSpecificGroup(char const* group);
+ char const* GetSpecificGroup();
void SetFailover(bool failover);
bool GetFailover() const;
@@ -425,10 +381,19 @@ public:
bool GetVerbose() const;
bool GetExtraVerbose() const;
- /** Direct process output to given streams. */
- void SetStreams(std::ostream* out, std::ostream* err);
+ bool StartResultingXML(Part part, char const* name, int submitIndex,
+ cmGeneratedFileStream& xofs);
+ bool StartLogFile(char const* name, int submitIndex,
+ cmGeneratedFileStream& xofs);
- void AddSiteProperties(cmXMLWriter& xml);
+ void ConvertInstrumentationSnippetsToXML(cmXMLWriter& xml,
+ std::string const& subdir);
+ bool ConvertInstrumentationJSONFileToXML(std::string const& fpath,
+ cmXMLWriter& xml);
+
+ void AddSiteProperties(cmXMLWriter& xml, cmake* cm);
+
+ bool GetInteractiveDebugMode() const;
bool GetLabelSummary() const;
bool GetSubprojectSummary() const;
@@ -437,7 +402,7 @@ public:
bool GetOutputTestOutputOnTestFailure() const;
- const std::map<std::string, std::string>& GetDefinitions() const;
+ std::map<std::string, std::string> const& GetDefinitions() const;
/** Return the number of times a test should be run */
int GetRepeatCount() const;
@@ -462,43 +427,31 @@ public:
void GenerateSubprojectsOutput(cmXMLWriter& xml);
std::vector<std::string> GetLabelsForSubprojects();
- void SetRunCurrentScript(bool value);
+ /** Reread the configuration file */
+ bool UpdateCTestConfiguration();
-private:
- void SetPersistentOptionIfNotEmpty(const std::string& value,
- const std::string& optionName);
- void AddPersistentMultiOptionIfNotEmpty(const std::string& value,
- const std::string& optionName);
+ cmCTestTestOptions const& GetTestOptions() const;
+ std::vector<std::string> GetCommandLineHttpHeaders() const;
- int GenerateNotesFile(const std::string& files);
+ cmInstrumentation& GetInstrumentation();
+ bool GetUseVerboseInstrumentation() const;
- void BlockTestErrorDiagnostics();
+private:
+ int GenerateNotesFile(cmake* cm, std::string const& files);
- /**
- * Initialize a dashboard run in the given build tree. The "command"
- * argument is non-NULL when running from a command-driven (ctest_start)
- * dashboard script, and NULL when running from the CTest command
- * line. Note that a declarative dashboard script does not actually
- * call this method because it sets CTEST_COMMAND to drive a build
- * through the ctest command line.
- */
- int Initialize(const std::string& binary_dir, cmCTestStartCommand* command);
+ void BlockTestErrorDiagnostics();
/** parse the option after -D and convert it into the appropriate steps */
- bool AddTestsForDashboardType(std::string& targ);
+ bool AddTestsForDashboardType(std::string const& targ);
/** read as "emit an error message for an unknown -D value" */
- void ErrorMessageUnknownDashDValue(std::string& val);
+ void ErrorMessageUnknownDashDValue(std::string const& val);
/** add a variable definition from a command line -D value */
- bool AddVariableDefinition(const std::string& arg);
+ bool AddVariableDefinition(std::string const& arg);
/** set command line arguments read from a test preset */
- bool SetArgsFromPreset(const std::string& presetName, bool listPresets);
-
- /** parse and process most common command line arguments */
- bool HandleCommandLineArguments(size_t& i, std::vector<std::string>& args,
- std::string& errormsg);
+ bool SetArgsFromPreset(std::string const& presetName, bool listPresets);
#if !defined(_WIN32)
/** returns true iff the console supports progress output */
@@ -511,39 +464,17 @@ private:
/** returns true iff the console supports colored output */
static bool ColoredOutputSupportedByConsole();
- /** handle the -S -SP and -SR arguments */
- bool HandleScriptArguments(size_t& i, std::vector<std::string>& args,
- bool& SRArgumentSpecified);
-
- /** Reread the configuration file */
- bool UpdateCTestConfiguration();
-
/** Create note from files. */
- int GenerateCTestNotesOutput(cmXMLWriter& xml,
+ int GenerateCTestNotesOutput(cmXMLWriter& xml, cmake* cm,
std::vector<std::string> const& files);
/** Check if the argument is the one specified */
- static bool CheckArgument(const std::string& arg, cm::string_view varg1,
- const char* varg2 = nullptr);
-
- /** Output errors from a test */
- void OutputTestErrors(std::vector<char> const& process_output);
-
- /** Handle the --test-action command line argument */
- bool HandleTestActionArgument(const char* ctestExec, size_t& i,
- 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,
- bool& validArg);
-
- int RunCMakeAndTest(std::string* output);
- int ExecuteTests();
+ static bool CheckArgument(std::string const& arg, cm::string_view varg1,
+ char const* varg2 = nullptr);
- /** return true iff change directory was successful */
- bool TryToChangeDirectory(std::string const& dir);
+ int RunCMakeAndTest();
+ int RunScripts(std::vector<std::pair<std::string, bool>> const& scripts);
+ int ExecuteTests(std::vector<std::string> const& args);
struct Private;
std::unique_ptr<Private> Impl;
@@ -553,14 +484,12 @@ private:
do { \
std::ostringstream cmCTestLog_msg; \
cmCTestLog_msg << msg; \
- (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \
- cmCTestLog_msg.str().c_str()); \
+ (ctSelf)->Log(cmCTest::logType, cmCTestLog_msg.str()); \
} while (false)
#define cmCTestOptionalLog(ctSelf, logType, msg, suppress) \
do { \
std::ostringstream cmCTestLog_msg; \
cmCTestLog_msg << msg; \
- (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \
- cmCTestLog_msg.str().c_str(), suppress); \
+ (ctSelf)->Log(cmCTest::logType, cmCTestLog_msg.str(), suppress); \
} while (false)
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 51b2300..e0dc6e3 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCacheManager.h"
#include <algorithm>
@@ -20,7 +20,7 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
-void cmCacheManager::CleanCMakeFiles(const std::string& path)
+void cmCacheManager::CleanCMakeFiles(std::string const& path)
{
std::string glob = cmStrCat(path, "/CMakeFiles/*.cmake");
cmsys::Glob globIt;
@@ -29,7 +29,7 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path)
std::for_each(files.begin(), files.end(), cmSystemTools::RemoveFile);
}
-bool cmCacheManager::LoadCache(const std::string& path, bool internal,
+bool cmCacheManager::LoadCache(std::string const& path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes)
{
@@ -47,7 +47,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
if (!fin) {
return false;
}
- const char* realbuffer;
+ char const* realbuffer;
std::string buffer;
std::string entryKey;
unsigned int lineno = 0;
@@ -167,19 +167,19 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
return true;
}
-const char* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED",
+char const* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED",
"STRINGS" };
-bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey,
- const CacheEntry& e)
+bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
+ CacheEntry const& e)
{
// All property entries are internal.
if (e.Type != cmStateEnums::INTERNAL) {
return false;
}
- const char* end = entryKey.c_str() + entryKey.size();
- for (const char* p : cmCacheManager::PersistentProperties) {
+ char const* end = entryKey.c_str() + entryKey.size();
+ for (char const* p : cmCacheManager::PersistentProperties) {
std::string::size_type plen = strlen(p) + 1;
if (entryKey.size() > plen && *(end - plen) == '-' &&
strcmp(end - plen + 1, p) == 0) {
@@ -199,11 +199,11 @@ bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey,
}
void cmCacheManager::WritePropertyEntries(std::ostream& os,
- const std::string& entryKey,
- const CacheEntry& e,
+ std::string const& entryKey,
+ CacheEntry const& e,
cmMessenger* messenger) const
{
- for (const char* p : cmCacheManager::PersistentProperties) {
+ for (char const* p : cmCacheManager::PersistentProperties) {
if (cmValue value = e.GetProperty(p)) {
std::string helpstring =
cmStrCat(p, " property for variable: ", entryKey);
@@ -220,7 +220,7 @@ void cmCacheManager::WritePropertyEntries(std::ostream& os,
}
}
-bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
+bool cmCacheManager::SaveCache(std::string const& path, cmMessenger* messenger)
{
std::string cacheFile = cmStrCat(path, "/CMakeCache.txt");
cmGeneratedFileStream fout(cacheFile);
@@ -354,7 +354,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
return true;
}
-bool cmCacheManager::DeleteCache(const std::string& path)
+bool cmCacheManager::DeleteCache(std::string const& path)
{
std::string cacheFile = path;
cmSystemTools::ConvertToUnixSlashes(cacheFile);
@@ -375,7 +375,7 @@ bool cmCacheManager::DeleteCache(const std::string& path)
void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
{
// support : in key name by double quoting
- const char* q =
+ char const* q =
(key.find(':') != std::string::npos || cmHasLiteralPrefix(key, "//"))
? "\""
: "";
@@ -406,7 +406,7 @@ void cmCacheManager::OutputValueNoNewlines(std::ostream& fout,
}
void cmCacheManager::OutputHelpString(std::ostream& fout,
- const std::string& helpString)
+ std::string const& helpString)
{
std::string::size_type end = helpString.size();
if (end == 0) {
@@ -414,7 +414,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout,
}
std::string oneLine;
std::string::size_type pos = 0;
- for (std::string::size_type i = 0; i <= end; i++) {
+ for (std::string::size_type i = 1; i <= end; i++) {
if ((i == end) || (helpString[i] == '\n') ||
((i - pos >= 60) && (helpString[i] == ' '))) {
fout << "//";
@@ -472,13 +472,13 @@ void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout,
}
}
-void cmCacheManager::RemoveCacheEntry(const std::string& key)
+void cmCacheManager::RemoveCacheEntry(std::string const& key)
{
this->Cache.erase(key);
}
cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
- const std::string& key)
+ std::string const& key)
{
auto i = this->Cache.find(key);
if (i != this->Cache.end()) {
@@ -487,8 +487,8 @@ cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
return nullptr;
}
-const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
- const std::string& key) const
+cmCacheManager::CacheEntry const* cmCacheManager::GetCacheEntry(
+ std::string const& key) const
{
auto i = this->Cache.find(key);
if (i != this->Cache.end()) {
@@ -497,9 +497,9 @@ const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
return nullptr;
}
-cmValue cmCacheManager::GetInitializedCacheValue(const std::string& key) const
+cmValue cmCacheManager::GetInitializedCacheValue(std::string const& key) const
{
- if (const auto* entry = this->GetCacheEntry(key)) {
+ if (auto const* entry = this->GetCacheEntry(key)) {
if (entry->Initialized) {
return cmValue(entry->GetValue());
}
@@ -522,7 +522,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
"=================================================\n";
}
-void cmCacheManager::AddCacheEntry(const std::string& key, cmValue value,
+void cmCacheManager::AddCacheEntry(std::string const& key, cmValue value,
cmValue helpString,
cmStateEnums::CacheEntryType type)
{
@@ -563,7 +563,7 @@ std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const
return this->Properties.GetKeys();
}
-cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
+cmValue cmCacheManager::CacheEntry::GetProperty(std::string const& prop) const
{
if (prop == "TYPE") {
return cmValue(cmState::CacheEntryTypeToString(this->Type));
@@ -575,13 +575,13 @@ cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
}
bool cmCacheManager::CacheEntry::GetPropertyAsBool(
- const std::string& prop) const
+ std::string const& prop) const
{
return this->GetProperty(prop).IsOn();
}
-void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
- const std::string& value)
+void cmCacheManager::CacheEntry::SetProperty(std::string const& prop,
+ std::string const& value)
{
if (prop == "TYPE") {
this->Type = cmState::StringToCacheEntryType(value);
@@ -592,12 +592,12 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
}
}
-void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v)
+void cmCacheManager::CacheEntry::SetProperty(std::string const& p, bool v)
{
this->SetProperty(p, v ? std::string{ "ON" } : std::string{ "OFF" });
}
-void cmCacheManager::CacheEntry::RemoveProperty(const std::string& prop)
+void cmCacheManager::CacheEntry::RemoveProperty(std::string const& prop)
{
if (prop == "TYPE") {
this->Type = cmState::StringToCacheEntryType("STRING");
@@ -608,8 +608,8 @@ void cmCacheManager::CacheEntry::RemoveProperty(const std::string& prop)
}
}
-void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
- const std::string& value,
+void cmCacheManager::CacheEntry::AppendProperty(std::string const& prop,
+ std::string const& value,
bool asString)
{
if (prop == "TYPE") {
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index ae32759..4eb58e7 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,19 +30,19 @@ class cmCacheManager
friend class cmCacheManager;
public:
- const std::string& GetValue() const { return this->Value; }
+ std::string const& GetValue() const { return this->Value; }
void SetValue(cmValue);
cmStateEnums::CacheEntryType GetType() const { return this->Type; }
void SetType(cmStateEnums::CacheEntryType ty) { this->Type = ty; }
std::vector<std::string> GetPropertyList() const;
- cmValue GetProperty(const std::string& property) const;
- bool GetPropertyAsBool(const std::string& property) const;
- void SetProperty(const std::string& property, const std::string& value);
- void SetProperty(const std::string& property, bool value);
- void RemoveProperty(const std::string& property);
- void AppendProperty(const std::string& property, const std::string& value,
+ cmValue GetProperty(std::string const& property) const;
+ bool GetPropertyAsBool(std::string const& property) const;
+ void SetProperty(std::string const& property, std::string const& value);
+ void SetProperty(std::string const& property, bool value);
+ void RemoveProperty(std::string const& property);
+ void AppendProperty(std::string const& property, std::string const& value,
bool asString = false);
private:
@@ -54,15 +54,15 @@ class cmCacheManager
public:
//! Load a cache for given makefile. Loads from path/CMakeCache.txt.
- bool LoadCache(const std::string& path, bool internal,
+ bool LoadCache(std::string const& path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes);
//! Save cache for given makefile. Saves to output path/CMakeCache.txt
- bool SaveCache(const std::string& path, cmMessenger* messenger);
+ bool SaveCache(std::string const& path, cmMessenger* messenger);
//! Delete the cache given
- bool DeleteCache(const std::string& path);
+ bool DeleteCache(std::string const& path);
//! Print the cache to a stream
void PrintCache(std::ostream&) const;
@@ -71,11 +71,11 @@ public:
bool IsCacheLoaded() const { return this->CacheLoaded; }
//! Get a value from the cache given a key
- cmValue GetInitializedCacheValue(const std::string& key) const;
+ cmValue GetInitializedCacheValue(std::string const& key) const;
- cmValue GetCacheEntryValue(const std::string& key) const
+ cmValue GetCacheEntryValue(std::string const& key) const
{
- if (const auto* entry = this->GetCacheEntry(key)) {
+ if (auto const* entry = this->GetCacheEntry(key)) {
return cmValue(entry->GetValue());
}
return nullptr;
@@ -90,7 +90,7 @@ public:
cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const
{
- if (const auto* entry = this->GetCacheEntry(key)) {
+ if (auto const* entry = this->GetCacheEntry(key)) {
return entry->GetType();
}
return cmStateEnums::UNINITIALIZED;
@@ -99,7 +99,7 @@ public:
std::vector<std::string> GetCacheEntryPropertyList(
std::string const& key) const
{
- if (const auto* entry = this->GetCacheEntry(key)) {
+ if (auto const* entry = this->GetCacheEntry(key)) {
return entry->GetPropertyList();
}
return {};
@@ -108,7 +108,7 @@ public:
cmValue GetCacheEntryProperty(std::string const& key,
std::string const& propName) const
{
- if (const auto* entry = this->GetCacheEntry(key)) {
+ if (auto const* entry = this->GetCacheEntry(key)) {
return entry->GetProperty(propName);
}
return nullptr;
@@ -117,7 +117,7 @@ public:
bool GetCacheEntryPropertyAsBool(std::string const& key,
std::string const& propName) const
{
- if (const auto* entry = this->GetCacheEntry(key)) {
+ if (auto const* entry = this->GetCacheEntry(key)) {
return entry->GetPropertyAsBool(propName);
}
return false;
@@ -173,34 +173,34 @@ public:
unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; }
//! Add an entry into the cache
- void AddCacheEntry(const std::string& key, const std::string& value,
- const std::string& helpString,
+ void AddCacheEntry(std::string const& key, std::string const& value,
+ std::string const& helpString,
cmStateEnums::CacheEntryType type)
{
this->AddCacheEntry(key, cmValue{ value }, cmValue{ helpString }, type);
}
- void AddCacheEntry(const std::string& key, cmValue value,
- const std::string& helpString,
+ void AddCacheEntry(std::string const& key, cmValue value,
+ std::string const& helpString,
cmStateEnums::CacheEntryType type)
{
this->AddCacheEntry(key, value, cmValue{ helpString }, type);
}
- void AddCacheEntry(const std::string& key, cmValue value, cmValue helpString,
+ void AddCacheEntry(std::string const& key, cmValue value, cmValue helpString,
cmStateEnums::CacheEntryType type);
//! Remove an entry from the cache
- void RemoveCacheEntry(const std::string& key);
+ void RemoveCacheEntry(std::string const& key);
private:
//! Get a cache entry object for a key
- CacheEntry* GetCacheEntry(const std::string& key);
- const CacheEntry* GetCacheEntry(const std::string& key) const;
+ CacheEntry* GetCacheEntry(std::string const& key);
+ CacheEntry const* GetCacheEntry(std::string const& key) const;
//! Clean out the CMakeFiles directory if no CMakeCache.txt
- void CleanCMakeFiles(const std::string& path);
+ void CleanCMakeFiles(std::string const& path);
static void OutputHelpString(std::ostream& fout,
- const std::string& helpString);
+ std::string const& helpString);
static void OutputWarningComment(std::ostream& fout,
std::string const& message,
bool wrapSpaces);
@@ -213,10 +213,10 @@ private:
static void OutputValueNoNewlines(std::ostream& fout,
std::string const& value);
- static const char* PersistentProperties[];
- bool ReadPropertyEntry(const std::string& key, const CacheEntry& e);
- void WritePropertyEntries(std::ostream& os, const std::string& entryKey,
- const CacheEntry& e, cmMessenger* messenger) const;
+ static char const* PersistentProperties[];
+ bool ReadPropertyEntry(std::string const& key, CacheEntry const& e);
+ void WritePropertyEntries(std::ostream& os, std::string const& entryKey,
+ CacheEntry const& e, cmMessenger* messenger) const;
std::map<std::string, CacheEntry> Cache;
bool CacheLoaded = false;
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index 292b9a3..e6a3e02 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCallVisualStudioMacro.h"
#include <sstream>
@@ -53,8 +53,8 @@ static bool LogErrorsAsMessages;
}
//! Using the given instance of Visual Studio, call the named macro
-HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
- const std::string& args)
+HRESULT InstanceCallMacro(IDispatch* vsIDE, std::string const& macro,
+ std::string const& args)
{
HRESULT hr = E_POINTER;
@@ -112,15 +112,15 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
" wReserved: " << excep.wReserved << '\n';
/* clang-format on */
if (excep.bstrSource) {
- oss << " bstrSource: " << (const char*)(_bstr_t)excep.bstrSource
+ oss << " bstrSource: " << (char const*)(_bstr_t)excep.bstrSource
<< '\n';
}
if (excep.bstrDescription) {
oss << " bstrDescription: "
- << (const char*)(_bstr_t)excep.bstrDescription << '\n';
+ << (char const*)(_bstr_t)excep.bstrDescription << '\n';
}
if (excep.bstrHelpFile) {
- oss << " bstrHelpFile: " << (const char*)(_bstr_t)excep.bstrHelpFile
+ oss << " bstrHelpFile: " << (char const*)(_bstr_t)excep.bstrHelpFile
<< '\n';
}
/* clang-format off */
@@ -305,7 +305,7 @@ HRESULT GetRunningInstances(std::map<std::string, IUnknownPtr>& mrot)
//! Do the two file names refer to the same Visual Studio solution? Or are
//! we perhaps looking for any and all solutions?
-bool FilesSameSolution(const std::string& slnFile, const std::string& slnName)
+bool FilesSameSolution(std::string const& slnFile, std::string const& slnName)
{
if (slnFile == "ALL"_s || slnName == "ALL"_s) {
return true;
@@ -324,7 +324,7 @@ bool FilesSameSolution(const std::string& slnFile, const std::string& slnName)
//! Find instances of Visual Studio with the given solution file
//! open. Pass "ALL" for slnFile to gather all running instances
//! of Visual Studio.
-HRESULT FindVisualStudioInstances(const std::string& slnFile,
+HRESULT FindVisualStudioInstances(std::string const& slnFile,
std::vector<IDispatchPtr>& instances)
{
std::map<std::string, IUnknownPtr> mrot;
@@ -363,7 +363,7 @@ HRESULT FindVisualStudioInstances(const std::string& slnFile,
#endif // defined(HAVE_COMDEF_H)
int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances(
- const std::string& slnFile)
+ std::string const& slnFile)
{
int count = 0;
@@ -396,10 +396,10 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances(
//! Get all running objects from the Windows running object table.
//! Save them in a map by their display names.
-int cmCallVisualStudioMacro::CallMacro(const std::string& slnFile,
- const std::string& macro,
- const std::string& args,
- const bool logErrorsAsMessages)
+int cmCallVisualStudioMacro::CallMacro(std::string const& slnFile,
+ std::string const& macro,
+ std::string const& args,
+ bool const logErrorsAsMessages)
{
int err = 1; // no comdef.h
diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h
index 78f22ae..f3beab2 100644
--- a/Source/cmCallVisualStudioMacro.h
+++ b/Source/cmCallVisualStudioMacro.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,14 +18,14 @@ public:
//! Call the named macro in instances of Visual Studio with the
//! given solution file open. Pass "ALL" for slnFile to call the
//! macro in each Visual Studio instance.
- static int CallMacro(const std::string& slnFile, const std::string& macro,
- const std::string& args, bool logErrorsAsMessages);
+ static int CallMacro(std::string const& slnFile, std::string const& macro,
+ std::string const& args, bool logErrorsAsMessages);
//! Count the number of running instances of Visual Studio with the
//! given solution file open. Pass "ALL" for slnFile to count all
//! running Visual Studio instances.
static int GetNumberOfRunningVisualStudioInstances(
- const std::string& slnFile);
+ std::string const& slnFile);
protected:
private:
diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx
deleted file mode 100644
index 0c2734e..0000000
--- a/Source/cmCommand.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCommand.h"
-
-#include <utility>
-
-#include "cmExecutionStatus.h"
-#include "cmMakefile.h"
-
-struct cmListFileArgument;
-
-void cmCommand::SetExecutionStatus(cmExecutionStatus* status)
-{
- this->Status = status;
- this->Makefile = &status->GetMakefile();
-}
-
-bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus& status)
-{
- std::vector<std::string> expandedArguments;
- if (!this->Makefile->ExpandArguments(args, expandedArguments)) {
- // There was an error expanding arguments. It was already
- // reported, so we can skip this command without error.
- return true;
- }
- return this->InitialPass(expandedArguments, status);
-}
-
-void cmCommand::SetError(const std::string& e)
-{
- this->Status->SetError(e);
-}
-
-cmLegacyCommandWrapper::cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd)
- : Command(std::move(cmd))
-{
-}
-
-cmLegacyCommandWrapper::cmLegacyCommandWrapper(
- cmLegacyCommandWrapper const& other)
- : Command(other.Command->Clone())
-{
-}
-
-cmLegacyCommandWrapper& cmLegacyCommandWrapper::operator=(
- cmLegacyCommandWrapper const& other)
-{
- this->Command = other.Command->Clone();
- return *this;
-}
-
-bool cmLegacyCommandWrapper::operator()(
- std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) const
-{
- auto cmd = this->Command->Clone();
- cmd->SetExecutionStatus(&status);
- return cmd->InvokeInitialPass(args, status);
-}
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
deleted file mode 100644
index f5a5190..0000000
--- a/Source/cmCommand.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* 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 <memory>
-#include <string>
-#include <vector>
-
-class cmExecutionStatus;
-class cmMakefile;
-struct cmListFileArgument;
-
-/** \class cmCommand
- * \brief Superclass for all commands in CMake.
- *
- * cmCommand is the base class for all commands in CMake. A command
- * manifests as an entry in CMakeLists.txt and produces one or
- * more makefile rules. Commands are associated with a particular
- * makefile. This base class cmCommand defines the API for commands
- * to support such features as enable/disable, inheritance,
- * documentation, and construction.
- */
-class cmCommand
-{
-public:
- /**
- * Construct the command. By default it has no makefile.
- */
- cmCommand() = default;
-
- /**
- * Need virtual destructor to destroy real command type.
- */
- virtual ~cmCommand() = default;
-
- cmCommand(cmCommand const&) = delete;
- cmCommand& operator=(cmCommand const&) = delete;
-
- /**
- * Specify the makefile.
- */
- cmMakefile* GetMakefile() { return this->Makefile; }
-
- void SetExecutionStatus(cmExecutionStatus* s);
- cmExecutionStatus* GetExecutionStatus() { return this->Status; }
-
- /**
- * This is called by the cmMakefile when the command is first
- * encountered in the CMakeLists.txt file. It expands the command's
- * arguments and then invokes the InitialPass.
- */
- bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus& status);
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&) = 0;
-
- /**
- * This is a virtual constructor for the command.
- */
- virtual std::unique_ptr<cmCommand> Clone() = 0;
-
- /**
- * Set the error message
- */
- void SetError(const std::string& e);
-
-protected:
- cmMakefile* Makefile = nullptr;
-
-private:
- cmExecutionStatus* Status = nullptr;
-};
-
-class cmLegacyCommandWrapper
-{
-public:
- explicit cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd);
-
- cmLegacyCommandWrapper(cmLegacyCommandWrapper const& other);
- cmLegacyCommandWrapper& operator=(cmLegacyCommandWrapper const& other);
-
- cmLegacyCommandWrapper(cmLegacyCommandWrapper&&) = default;
- cmLegacyCommandWrapper& operator=(cmLegacyCommandWrapper&&) = default;
-
- bool operator()(std::vector<cmListFileArgument> const& args,
- cmExecutionStatus& status) const;
-
-private:
- std::unique_ptr<cmCommand> Command;
-};
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
deleted file mode 100644
index a20f5a5..0000000
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ /dev/null
@@ -1,296 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCommandArgumentParserHelper.h"
-
-#include <cstring>
-#include <iostream>
-#include <sstream>
-#include <utility>
-
-#include <cm/memory>
-#include <cm/optional>
-#include <cmext/string_view>
-
-#include "cmCommandArgumentLexer.h"
-#include "cmListFileCache.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-
-int cmCommandArgument_yyparse(yyscan_t yyscanner);
-//
-cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
-{
- this->FileLine = -1;
- this->FileName = nullptr;
- this->RemoveEmpty = true;
-
- this->NoEscapeMode = false;
- this->ReplaceAtSyntax = false;
-}
-
-cmCommandArgumentParserHelper::~cmCommandArgumentParserHelper()
-{
- this->CleanupParser();
-}
-
-void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file)
-{
- this->FileLine = line;
- this->FileName = file;
-}
-
-const char* cmCommandArgumentParserHelper::AddString(const std::string& str)
-{
- if (str.empty()) {
- return "";
- }
- auto stVal = cm::make_unique<char[]>(str.size() + 1);
- strcpy(stVal.get(), str.c_str());
- this->Variables.push_back(std::move(stVal));
- return this->Variables.back().get();
-}
-
-const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
- const char* key, const char* var)
-{
- if (!key) {
- return this->ExpandVariable(var);
- }
- if (!var) {
- return "";
- }
- if (strcmp(key, "ENV") == 0) {
- std::string str;
- if (cmSystemTools::GetEnv(var, str)) {
- if (this->EscapeQuotes) {
- return this->AddString(cmEscapeQuotes(str));
- }
- return this->AddString(str);
- }
- return "";
- }
- if (strcmp(key, "CACHE") == 0) {
- if (cmValue c =
- this->Makefile->GetState()->GetInitializedCacheValue(var)) {
- if (this->EscapeQuotes) {
- return this->AddString(cmEscapeQuotes(*c));
- }
- return this->AddString(*c);
- }
- return "";
- }
- std::ostringstream e;
- e << "Syntax $" << key << "{} is not supported. "
- << "Only ${}, $ENV{}, and $CACHE{} are allowed.";
- this->SetError(e.str());
- return nullptr;
-}
-
-const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
-{
- if (!var) {
- return nullptr;
- }
- if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
- std::string line;
- cmListFileBacktrace bt = this->Makefile->GetBacktrace();
- cmListFileContext const& top = bt.Top();
- if (top.DeferId) {
- line = cmStrCat("DEFERRED:"_s, *top.DeferId);
- } else {
- line = std::to_string(this->FileLine);
- }
- return this->AddString(line);
- }
- cmValue value = this->Makefile->GetDefinition(var);
- if (!value) {
- this->Makefile->MaybeWarnUninitialized(var, this->FileName);
- if (!this->RemoveEmpty) {
- return nullptr;
- }
- }
- if (this->EscapeQuotes && value) {
- return this->AddString(cmEscapeQuotes(*value));
- }
- return this->AddString(value);
-}
-
-const char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
-{
- if (this->ReplaceAtSyntax) {
- // try to expand the variable
- const char* ret = this->ExpandVariable(var);
- // if the return was 0 and we want to replace empty strings
- // then return an empty string
- if (!ret && this->RemoveEmpty) {
- return this->AddString("");
- }
- // if the ret was not 0, then return it
- if (ret) {
- return ret;
- }
- }
- // at this point we want to put it back because of one of these cases:
- // - this->ReplaceAtSyntax is false
- // - this->ReplaceAtSyntax is true, but this->RemoveEmpty is false,
- // and the variable was not defined
- std::string ref = cmStrCat('@', var, '@');
- return this->AddString(ref);
-}
-
-const char* cmCommandArgumentParserHelper::CombineUnions(const char* in1,
- const char* in2)
-{
- if (!in1) {
- return in2;
- }
- if (!in2) {
- return in1;
- }
- size_t len = strlen(in1) + strlen(in2) + 1;
- auto out = cm::make_unique<char[]>(len);
- strcpy(out.get(), in1);
- strcat(out.get(), in2);
- this->Variables.push_back(std::move(out));
- return this->Variables.back().get();
-}
-
-void cmCommandArgumentParserHelper::AllocateParserType(
- cmCommandArgumentParserHelper::ParserType* pt, const char* str, int len)
-{
- pt->str = nullptr;
- if (len == 0) {
- len = static_cast<int>(strlen(str));
- }
- if (len == 0) {
- return;
- }
- auto out = cm::make_unique<char[]>(len + 1);
- memcpy(out.get(), str, len);
- out.get()[len] = 0;
- pt->str = out.get();
- this->Variables.push_back(std::move(out));
-}
-
-bool cmCommandArgumentParserHelper::HandleEscapeSymbol(
- cmCommandArgumentParserHelper::ParserType* pt, char symbol)
-{
- switch (symbol) {
- case '\\':
- case '"':
- case ' ':
- case '#':
- case '(':
- case ')':
- case '$':
- case '@':
- case '^':
- this->AllocateParserType(pt, &symbol, 1);
- break;
- case ';':
- this->AllocateParserType(pt, "\\;", 2);
- break;
- case 't':
- this->AllocateParserType(pt, "\t", 1);
- break;
- case 'n':
- this->AllocateParserType(pt, "\n", 1);
- break;
- case 'r':
- this->AllocateParserType(pt, "\r", 1);
- break;
- case '0':
- this->AllocateParserType(pt, "\0", 1);
- break;
- default: {
- std::ostringstream e;
- e << "Invalid escape sequence \\" << symbol;
- this->SetError(e.str());
- }
- return false;
- }
- return true;
-}
-
-void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes);
-
-int cmCommandArgumentParserHelper::ParseString(std::string const& str,
- int verb)
-{
- if (str.empty()) {
- return 0;
- }
- this->InputSize = str.size();
- this->Verbose = verb;
-
- this->Result.clear();
-
- yyscan_t yyscanner;
- cmCommandArgument_yylex_init(&yyscanner);
- auto* scanBuf = cmCommandArgument_yy_scan_string(str.c_str(), yyscanner);
- cmCommandArgument_yyset_extra(this, yyscanner);
- cmCommandArgument_SetupEscapes(yyscanner, this->NoEscapeMode);
- int res = cmCommandArgument_yyparse(yyscanner);
- cmCommandArgument_yy_delete_buffer(scanBuf, yyscanner);
- cmCommandArgument_yylex_destroy(yyscanner);
- if (res != 0) {
- return 0;
- }
-
- this->CleanupParser();
-
- if (this->Verbose) {
- std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]"
- << std::endl;
- }
- return 1;
-}
-
-void cmCommandArgumentParserHelper::CleanupParser()
-{
- this->Variables.clear();
-}
-
-void cmCommandArgumentParserHelper::Error(const char* str)
-{
- auto pos = this->InputBufferPos;
- auto const isEof = (this->InputSize < this->InputBufferPos);
- if (!isEof) {
- pos -= this->LastTokenLength;
- }
-
- std::ostringstream ostr;
- ostr << str << " (" << pos << ")";
- this->SetError(ostr.str());
-}
-
-void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf)
-{
- this->Makefile = mf;
-}
-
-void cmCommandArgumentParserHelper::SetResult(const char* value)
-{
- if (!value) {
- this->Result.clear();
- return;
- }
- this->Result = value;
-}
-
-void cmCommandArgumentParserHelper::SetError(std::string const& msg)
-{
- // Keep only the first error.
- if (this->ErrorString.empty()) {
- this->ErrorString = msg;
- }
-}
-
-void cmCommandArgumentParserHelper::UpdateInputPosition(int const tokenLength)
-{
- this->InputBufferPos += tokenLength;
- this->LastTokenLength = tokenLength;
-}
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
deleted file mode 100644
index f79ca2c..0000000
--- a/Source/cmCommandArgumentParserHelper.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* 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 <memory>
-#include <string>
-#include <vector>
-
-class cmMakefile;
-
-class cmCommandArgumentParserHelper
-{
-public:
- struct ParserType
- {
- const char* str;
- };
-
- cmCommandArgumentParserHelper();
- ~cmCommandArgumentParserHelper();
-
- cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&) = delete;
- cmCommandArgumentParserHelper& operator=(
- cmCommandArgumentParserHelper const&) = delete;
-
- int ParseString(std::string const& str, int verb);
-
- // For the lexer:
- void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
- const char* str, int len = 0);
- bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
- char symbol);
-
- void Error(const char* str);
-
- // For yacc
- const char* CombineUnions(const char* in1, const char* in2);
-
- const char* ExpandSpecialVariable(const char* key, const char* var);
- const char* ExpandVariable(const char* var);
- const char* ExpandVariableForAt(const char* var);
- void SetResult(const char* value);
-
- void SetMakefile(const cmMakefile* mf);
-
- void UpdateInputPosition(int tokenLength);
-
- std::string& GetResult() { return this->Result; }
-
- void SetLineFile(long line, const char* file);
- void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
- void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
- void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
- void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
-
- const char* GetError() { return this->ErrorString.c_str(); }
-
-private:
- std::string::size_type InputBufferPos{ 1 };
- std::string::size_type LastTokenLength{};
- std::string::size_type InputSize{};
- std::vector<char> OutputBuffer;
-
- void Print(const char* place, const char* str);
- void SafePrintMissing(const char* str, int line, int cnt);
-
- const char* AddString(const std::string& str);
-
- void CleanupParser();
- void SetError(std::string const& msg);
-
- std::vector<std::unique_ptr<char[]>> Variables;
- const cmMakefile* Makefile;
- std::string Result;
- std::string ErrorString;
- const char* FileName;
- long FileLine;
- int Verbose;
- bool EscapeQuotes;
- bool NoEscapeMode;
- bool ReplaceAtSyntax;
- bool RemoveEmpty;
-};
-
-#define YYSTYPE cmCommandArgumentParserHelper::ParserType
-#define YYSTYPE_IS_DECLARED
-#define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
-#define YY_DECL \
- int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
diff --git a/Source/cmCommandLineArgument.h b/Source/cmCommandLineArgument.h
index 003e972..f11d1fb 100644
--- a/Source/cmCommandLineArgument.h
+++ b/Source/cmCommandLineArgument.h
@@ -1,8 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
+#include <cctype>
+
#include <cm/optional>
+#include <cm/string_view>
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -126,7 +129,7 @@ struct cmCommandLineArgument
if (input.size() == this->Name.size()) {
auto nextValueIndex = index + 1;
if (nextValueIndex >= allArgs.size() ||
- allArgs[nextValueIndex][0] == '-') {
+ IsFlag(allArgs[nextValueIndex])) {
if (this->Type == Values::ZeroOrOne) {
parseState =
this->StoreCall(std::string{}, std::forward<CallState>(state)...)
@@ -153,8 +156,8 @@ struct cmCommandLineArgument
}
} else if (this->Type == Values::Two) {
if (input.size() == this->Name.size()) {
- if (index + 2 >= allArgs.size() || allArgs[index + 1][0] == '-' ||
- allArgs[index + 2][0] == '-') {
+ if (index + 2 >= allArgs.size() || IsFlag(allArgs[index + 1]) ||
+ IsFlag(allArgs[index + 2])) {
parseState = ParseMode::ValueError;
} else {
index += 2;
@@ -169,12 +172,12 @@ struct cmCommandLineArgument
if (input.size() == this->Name.size()) {
auto nextValueIndex = index + 1;
if (nextValueIndex >= allArgs.size() ||
- allArgs[nextValueIndex][0] == '-') {
+ IsFlag(allArgs[nextValueIndex])) {
parseState = ParseMode::ValueError;
} else {
std::string buffer = allArgs[nextValueIndex++];
while (nextValueIndex < allArgs.size() &&
- allArgs[nextValueIndex][0] != '-') {
+ !IsFlag(allArgs[nextValueIndex])) {
buffer = cmStrCat(buffer, ";", allArgs[nextValueIndex++]);
}
parseState =
@@ -222,41 +225,41 @@ private:
class ArgumentLambdaHelper;
template <typename... CallState>
- class ArgumentLambdaHelper<bool(const std::string&, CallState...)>
+ class ArgumentLambdaHelper<bool(std::string const&, CallState...)>
{
public:
- static std::function<bool(const std::string&, CallState...)>
+ static std::function<bool(std::string const&, CallState...)>
generateSetToTrue(bool& value1)
{
- return [&value1](const std::string&, CallState&&...) -> bool {
+ return [&value1](std::string const&, CallState&&...) -> bool {
value1 = true;
return true;
};
}
- static std::function<bool(const std::string&, CallState...)>
+ static std::function<bool(std::string const&, CallState...)>
generateSetToTrue(bool& value1, bool& value2)
{
- return [&value1, &value2](const std::string&, CallState&&...) -> bool {
+ return [&value1, &value2](std::string const&, CallState&&...) -> bool {
value1 = true;
value2 = true;
return true;
};
}
- static std::function<bool(const std::string&, CallState...)>
+ static std::function<bool(std::string const&, CallState...)>
generateSetToValue(std::string& value1)
{
- return [&value1](const std::string& arg, CallState&&...) -> bool {
+ return [&value1](std::string const& arg, CallState&&...) -> bool {
value1 = arg;
return true;
};
}
- static std::function<bool(const std::string&, CallState...)>
+ static std::function<bool(std::string const&, CallState...)>
generateSetToValue(cm::optional<std::string>& value1)
{
- return [&value1](const std::string& arg, CallState&&...) -> bool {
+ return [&value1](std::string const& arg, CallState&&...) -> bool {
value1 = arg;
return true;
};
@@ -281,4 +284,10 @@ private:
}
return std::string(possible_value);
}
+
+ static bool IsFlag(cm::string_view arg)
+ {
+ return !arg.empty() && arg[0] == '-' &&
+ !(arg.size() >= 2 && std::isdigit(arg[1]));
+ }
};
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 089bafc..0b25313 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCommands.h"
@@ -52,6 +52,7 @@
#include "cmInstallCommand.h"
#include "cmInstallFilesCommand.h"
#include "cmInstallTargetsCommand.h"
+#include "cmInstrumentationCommand.h"
#include "cmLinkDirectoriesCommand.h"
#include "cmListCommand.h"
#include "cmMacroCommand.h"
@@ -92,29 +93,21 @@
# include "cmAddCompileOptionsCommand.h"
# include "cmAddLinkOptionsCommand.h"
# include "cmAuxSourceDirectoryCommand.h"
-# include "cmBuildNameCommand.h"
# include "cmCMakeHostSystemInformationCommand.h"
# include "cmCMakePkgConfigCommand.h"
# include "cmExportCommand.h"
-# include "cmExportLibraryDependenciesCommand.h"
# include "cmFLTKWrapUICommand.h"
# include "cmFileAPICommand.h"
# include "cmIncludeExternalMSProjectCommand.h"
# include "cmInstallProgramsCommand.h"
# include "cmLinkLibrariesCommand.h"
# include "cmLoadCacheCommand.h"
-# include "cmLoadCommandCommand.h"
-# include "cmOutputRequiredFilesCommand.h"
# include "cmQTWrapCPPCommand.h"
# include "cmQTWrapUICommand.h"
# include "cmRemoveCommand.h"
# include "cmRemoveDefinitionsCommand.h"
# include "cmSourceGroupCommand.h"
-# include "cmSubdirDependsCommand.h"
# include "cmTargetLinkDirectoriesCommand.h"
-# include "cmUseMangledMesaCommand.h"
-# include "cmUtilitySourceCommand.h"
-# include "cmVariableRequiresCommand.h"
# include "cmVariableWatchCommand.h"
# include "cmWriteFileCommand.h"
#endif
@@ -215,12 +208,11 @@ void GetScriptingCommands(cmState* state)
state->AddBuiltinCommand("variable_watch", cmVariableWatchCommand);
state->AddBuiltinCommand("write_file", cmWriteFileCommand);
- state->AddDisallowedCommand(
- "build_name", cmBuildNameCommand, cmPolicies::CMP0036,
- "The build_name command should not be called; see CMP0036.");
- state->AddDisallowedCommand(
- "use_mangled_mesa", cmUseMangledMesaCommand, cmPolicies::CMP0030,
- "The use_mangled_mesa command should not be called; see CMP0030.");
+ state->AddRemovedCommand(
+ "build_name", "The build_name command has been removed; see CMP0036.");
+ state->AddRemovedCommand(
+ "use_mangled_mesa",
+ "The use_mangled_mesa command has been removed; see CMP0030.");
state->AddDisallowedCommand("exec_program", cmExecProgramCommand,
cmPolicies::CMP0153,
"The exec_program command should not be called; "
@@ -301,27 +293,25 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("remove_definitions", cmRemoveDefinitionsCommand);
state->AddBuiltinCommand("source_group", cmSourceGroupCommand);
state->AddBuiltinCommand("cmake_file_api", cmFileAPICommand);
+ state->AddBuiltinCommand("cmake_instrumentation", cmInstrumentationCommand);
- state->AddDisallowedCommand(
- "export_library_dependencies", cmExportLibraryDependenciesCommand,
- cmPolicies::CMP0033,
- "The export_library_dependencies command should not be called; "
- "see CMP0033.");
- state->AddDisallowedCommand(
- "load_command", cmLoadCommandCommand, cmPolicies::CMP0031,
- "The load_command command should not be called; see CMP0031.");
- state->AddDisallowedCommand(
- "output_required_files", cmOutputRequiredFilesCommand, cmPolicies::CMP0032,
- "The output_required_files command should not be called; see CMP0032.");
- state->AddDisallowedCommand(
- "subdir_depends", cmSubdirDependsCommand, cmPolicies::CMP0029,
- "The subdir_depends command should not be called; see CMP0029.");
- state->AddDisallowedCommand(
- "utility_source", cmUtilitySourceCommand, cmPolicies::CMP0034,
- "The utility_source command should not be called; see CMP0034.");
- state->AddDisallowedCommand(
- "variable_requires", cmVariableRequiresCommand, cmPolicies::CMP0035,
- "The variable_requires command should not be called; see CMP0035.");
+ state->AddRemovedCommand(
+ "export_library_dependencies",
+ "The export_library_dependencies command has been removed; see CMP0033.");
+ state->AddRemovedCommand(
+ "load_command", "The load_command command has been removed; see CMP0031.");
+ state->AddRemovedCommand(
+ "output_required_files",
+ "The output_required_files command has been removed; see CMP0032.");
+ state->AddRemovedCommand(
+ "subdir_depends",
+ "The subdir_depends command has been removed; see CMP0029.");
+ state->AddRemovedCommand(
+ "utility_source",
+ "The utility_source command has been removed; see CMP0034.");
+ state->AddRemovedCommand(
+ "variable_requires",
+ "The variable_requires command has been removed; see CMP0035.");
#endif
}
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index 5605430..a4ba3a2 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
class cmState;
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index d183dc2..9495c06 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCommonTargetGenerator.h"
#include <algorithm>
@@ -48,8 +48,8 @@ std::vector<std::string> const& cmCommonTargetGenerator::GetConfigNames() const
return this->ConfigNames;
}
-cmValue cmCommonTargetGenerator::GetFeature(const std::string& feature,
- const std::string& config)
+cmValue cmCommonTargetGenerator::GetFeature(std::string const& feature,
+ std::string const& config)
{
return this->GeneratorTarget->GetFeature(feature, config);
}
@@ -57,7 +57,7 @@ cmValue cmCommonTargetGenerator::GetFeature(const std::string& feature,
void cmCommonTargetGenerator::AppendFortranFormatFlags(
std::string& flags, cmSourceFile const& source)
{
- const std::string srcfmt = source.GetSafeProperty("Fortran_FORMAT");
+ std::string const srcfmt = source.GetSafeProperty("Fortran_FORMAT");
cmOutputConverter::FortranFormat format =
cmOutputConverter::GetFortranFormat(srcfmt);
if (format == cmOutputConverter::FortranFormatNone) {
@@ -65,7 +65,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT");
format = cmOutputConverter::GetFortranFormat(tgtfmt);
}
- const char* var = nullptr;
+ char const* var = nullptr;
switch (format) {
case cmOutputConverter::FortranFormatFixed:
var = "CMAKE_Fortran_FORMAT_FIXED_FLAG";
@@ -86,7 +86,7 @@ void cmCommonTargetGenerator::AppendFortranPreprocessFlags(
std::string& flags, cmSourceFile const& source,
PreprocessFlagsRequired requires_pp)
{
- const std::string srcpp = source.GetSafeProperty("Fortran_PREPROCESS");
+ std::string const srcpp = source.GetSafeProperty("Fortran_PREPROCESS");
cmOutputConverter::FortranPreprocess preprocess =
cmOutputConverter::GetFortranPreprocess(srcpp);
if (preprocess == cmOutputConverter::FortranPreprocess::Unset) {
@@ -94,7 +94,7 @@ void cmCommonTargetGenerator::AppendFortranPreprocessFlags(
this->GeneratorTarget->GetSafeProperty("Fortran_PREPROCESS");
preprocess = cmOutputConverter::GetFortranPreprocess(tgtpp);
}
- const char* var = nullptr;
+ char const* var = nullptr;
switch (preprocess) {
case cmOutputConverter::FortranPreprocess::Needed:
if (requires_pp == PreprocessFlagsRequired::YES) {
@@ -113,11 +113,11 @@ void cmCommonTargetGenerator::AppendFortranPreprocessFlags(
}
}
-std::string cmCommonTargetGenerator::GetFlags(const std::string& l,
- const std::string& config,
- const std::string& arch)
+std::string cmCommonTargetGenerator::GetFlags(std::string const& l,
+ std::string const& config,
+ std::string const& arch)
{
- const std::string key = config + arch;
+ std::string const key = config + arch;
auto i = this->Configs[key].FlagsByLanguage.find(l);
if (i == this->Configs[key].FlagsByLanguage.end()) {
@@ -132,8 +132,8 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l,
return i->second;
}
-std::string cmCommonTargetGenerator::GetDefines(const std::string& l,
- const std::string& config)
+std::string cmCommonTargetGenerator::GetDefines(std::string const& l,
+ std::string const& config)
{
auto i = this->Configs[config].DefinesByLanguage.find(l);
if (i == this->Configs[config].DefinesByLanguage.end()) {
@@ -151,7 +151,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l,
}
std::string cmCommonTargetGenerator::GetIncludes(std::string const& l,
- const std::string& config)
+ std::string const& config)
{
auto i = this->Configs[config].IncludesByLanguage.find(l);
if (i == this->Configs[config].IncludesByLanguage.end()) {
@@ -165,7 +165,7 @@ std::string cmCommonTargetGenerator::GetIncludes(std::string const& l,
cmCommonTargetGenerator::LinkedTargetDirs
cmCommonTargetGenerator::GetLinkedTargetDirectories(
- const std::string& lang, const std::string& config) const
+ std::string const& lang, std::string const& config) const
{
LinkedTargetDirs dirs;
std::set<cmGeneratorTarget const*> forward_emitted;
@@ -240,7 +240,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories(
}
std::string cmCommonTargetGenerator::ComputeTargetCompilePDB(
- const std::string& config) const
+ std::string const& config) const
{
std::string compilePdbPath;
if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) {
@@ -267,7 +267,7 @@ std::string cmCommonTargetGenerator::ComputeTargetCompilePDB(
return compilePdbPath;
}
-std::string cmCommonTargetGenerator::GetManifests(const std::string& config)
+std::string cmCommonTargetGenerator::GetManifests(std::string const& config)
{
std::vector<cmSourceFile const*> manifest_srcs;
this->GeneratorTarget->GetManifests(manifest_srcs, config);
@@ -304,8 +304,8 @@ std::string cmCommonTargetGenerator::GetAIXExports(std::string const&)
}
void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags,
- const std::string& lang,
- const char* name, bool so)
+ std::string const& lang,
+ char const* name, bool so)
{
// Lookup the flag to specify the version.
std::string fvar = cmStrCat("CMAKE_", lang, "_OSX_", name, "_VERSION_FLAG");
@@ -494,7 +494,7 @@ std::string cmCommonTargetGenerator::GenerateCodeCheckRules(
}
std::string cmCommonTargetGenerator::GetLinkerLauncher(
- const std::string& config)
+ std::string const& config)
{
std::string lang = this->GeneratorTarget->GetLinkerLanguage(config);
std::string propName = lang + "_LINKER_LAUNCHER";
@@ -522,7 +522,7 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher(
}
bool cmCommonTargetGenerator::HaveRequiredLanguages(
- const std::vector<cmSourceFile const*>& sources,
+ std::vector<cmSourceFile const*> const& sources,
std::set<std::string>& languagesNeeded) const
{
for (cmSourceFile const* sf : sources) {
@@ -531,8 +531,8 @@ bool cmCommonTargetGenerator::HaveRequiredLanguages(
auto* makefile = this->Makefile;
auto* state = makefile->GetState();
- auto unary = [&state, &makefile](const std::string& lang) -> bool {
- const bool valid = state->GetLanguageEnabled(lang);
+ auto unary = [&state, &makefile](std::string const& lang) -> bool {
+ bool const valid = state->GetLanguageEnabled(lang);
if (!valid) {
makefile->IssueMessage(
MessageType::FATAL_ERROR,
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 0452649..b97b947 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,7 +31,7 @@ public:
protected:
// Feature query methods.
- cmValue GetFeature(const std::string& feature, const std::string& config);
+ cmValue GetFeature(std::string const& feature, std::string const& config);
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
@@ -53,19 +53,19 @@ protected:
PreprocessFlagsRequired requires_pp = PreprocessFlagsRequired::YES);
virtual void AddIncludeFlags(std::string& flags, std::string const& lang,
- const std::string& config) = 0;
+ std::string const& config) = 0;
virtual std::string GetClangTidyReplacementsFilePath(
std::string const& directory, cmSourceFile const& source,
std::string const& config) const = 0;
- void AppendOSXVerFlag(std::string& flags, const std::string& lang,
- const char* name, bool so);
+ void AppendOSXVerFlag(std::string& flags, std::string const& lang,
+ char const* name, bool so);
- std::string GetFlags(const std::string& l, const std::string& config,
- const std::string& arch = std::string());
- std::string GetDefines(const std::string& l, const std::string& config);
- std::string GetIncludes(std::string const& l, const std::string& config);
- std::string GetManifests(const std::string& config);
+ std::string GetFlags(std::string const& l, std::string const& config,
+ std::string const& arch = std::string());
+ std::string GetDefines(std::string const& l, std::string const& config);
+ std::string GetIncludes(std::string const& l, std::string const& config);
+ std::string GetManifests(std::string const& config);
std::string GetAIXExports(std::string const& config);
std::string GenerateCodeCheckRules(
cmSourceFile const& source, std::string& compilerLauncher,
@@ -81,13 +81,13 @@ protected:
std::vector<std::string> Forward;
};
- LinkedTargetDirs GetLinkedTargetDirectories(const std::string& lang,
- const std::string& config) const;
- std::string ComputeTargetCompilePDB(const std::string& config) const;
+ LinkedTargetDirs GetLinkedTargetDirectories(std::string const& lang,
+ std::string const& config) const;
+ std::string ComputeTargetCompilePDB(std::string const& config) const;
- std::string GetLinkerLauncher(const std::string& config);
+ std::string GetLinkerLauncher(std::string const& config);
- bool HaveRequiredLanguages(const std::vector<cmSourceFile const*>& sources,
+ bool HaveRequiredLanguages(std::vector<cmSourceFile const*> const& sources,
std::set<std::string>& languagesNeeded) const;
private:
diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx
index 16540c3..7f4f209 100644
--- a/Source/cmComputeComponentGraph.cxx
+++ b/Source/cmComputeComponentGraph.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmComputeComponentGraph.h"
#include <algorithm>
@@ -7,7 +7,7 @@
#include <cstddef>
#include <limits>
-const size_t cmComputeComponentGraph::INVALID_COMPONENT =
+size_t const cmComputeComponentGraph::INVALID_COMPONENT =
std::numeric_limits<size_t>::max();
cmComputeComponentGraph::cmComputeComponentGraph(Graph const& input)
diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h
index 878e36d..1dfe74b 100644
--- a/Source/cmComputeComponentGraph.h
+++ b/Source/cmComputeComponentGraph.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -54,7 +54,7 @@ public:
return this->TarjanComponents;
}
- static const size_t INVALID_COMPONENT;
+ static size_t const INVALID_COMPONENT;
private:
void TransferEdges();
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 6b97280..9669524 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmComputeLinkDepends.h"
#include <algorithm>
@@ -222,9 +222,9 @@ struct LinkLibraryFeatureAttributeSet
};
std::map<std::string, LinkLibraryFeatureAttributeSet>
LinkLibraryFeatureAttributes;
-const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes(
+LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes(
cmMakefile* makefile, std::string const& linkLanguage,
- const std::string& feature)
+ std::string const& feature)
{
auto it = LinkLibraryFeatureAttributes.find(feature);
if (it != LinkLibraryFeatureAttributes.end()) {
@@ -257,7 +257,7 @@ const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes(
if (processingOption.match(1) == "LIBRARY_TYPE") {
featureAttributes.LibraryTypes.clear();
for (auto const& value :
- cmTokenize(processingOption.match(2), ","_s)) {
+ cmTokenize(processingOption.match(2), ',')) {
if (value == "STATIC") {
featureAttributes.LibraryTypes.emplace(
cmStateEnums::STATIC_LIBRARY);
@@ -292,7 +292,8 @@ const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes(
}
} else if (processingOption.match(1) == "OVERRIDE") {
featureAttributes.Override.clear();
- auto values = cmTokenize(processingOption.match(2), ","_s);
+ std::vector<std::string> values =
+ cmTokenize(processingOption.match(2), ',');
featureAttributes.Override.insert(values.begin(), values.end());
}
} else {
@@ -314,10 +315,10 @@ const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes(
}
// LINK_GROUP helpers
-const cm::string_view LG_BEGIN = "<LINK_GROUP:"_s;
-const cm::string_view LG_END = "</LINK_GROUP:"_s;
-const cm::string_view LG_ITEM_BEGIN = "<LINK_GROUP>"_s;
-const cm::string_view LG_ITEM_END = "</LINK_GROUP>"_s;
+cm::string_view const LG_BEGIN = "<LINK_GROUP:"_s;
+cm::string_view const LG_END = "</LINK_GROUP:"_s;
+cm::string_view const LG_ITEM_BEGIN = "<LINK_GROUP>"_s;
+cm::string_view const LG_ITEM_END = "</LINK_GROUP>"_s;
inline std::string ExtractGroupFeature(std::string const& item)
{
@@ -346,15 +347,15 @@ public:
using LinkEntry = cmComputeLinkDepends::LinkEntry;
using EntryVector = cmComputeLinkDepends::EntryVector;
- EntriesProcessing(const cmGeneratorTarget* target,
- const std::string& linkLanguage, EntryVector& entries,
+ EntriesProcessing(cmGeneratorTarget const* target,
+ std::string const& linkLanguage, EntryVector& entries,
EntryVector& finalEntries)
: Target(target)
, LinkLanguage(linkLanguage)
, Entries(entries)
, FinalEntries(finalEntries)
{
- const auto* makefile = target->Makefile;
+ auto const* makefile = target->Makefile;
switch (target->GetPolicyStatusCMP0156()) {
case cmPolicies::WARN:
@@ -372,40 +373,19 @@ public:
case cmPolicies::OLD:
// rely on default initialization of the class
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- makefile->GetCMakeInstance()->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0156),
- target->GetBacktrace());
- CM_FALLTHROUGH;
case cmPolicies::NEW: {
// Policy 0179 applies only when policy 0156 is new
- switch (target->GetPolicyStatusCMP0179()) {
- case cmPolicies::WARN:
- if (!makefile->GetCMakeInstance()->GetIsInTryCompile() &&
- makefile->PolicyOptionalWarningEnabled(
- "CMAKE_POLICY_WARNING_CMP0179")) {
- makefile->GetCMakeInstance()->IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0179),
- "\nSince the policy is not set, static libraries "
- "de-duplication will keep the last occurrence of the "
- "static libraries."),
- target->GetBacktrace());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- makefile->GetCMakeInstance()->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0179),
- target->GetBacktrace());
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- break;
+ if (target->GetPolicyStatusCMP0179() == cmPolicies::WARN &&
+ !makefile->GetCMakeInstance()->GetIsInTryCompile() &&
+ makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0179")) {
+ makefile->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0179),
+ "\nSince the policy is not set, static libraries "
+ "de-duplication will keep the last occurrence of the "
+ "static libraries."),
+ target->GetBacktrace());
}
if (auto libProcessing = makefile->GetDefinition(cmStrCat(
@@ -463,13 +443,13 @@ public:
}
}
- void AddGroups(const std::map<size_t, std::vector<size_t>>& groups)
+ void AddGroups(std::map<size_t, std::vector<size_t>> const& groups)
{
if (!groups.empty()) {
this->Groups = &groups;
// record all libraries as part of groups to ensure correct
// deduplication: libraries as part of groups are always kept.
- for (const auto& g : groups) {
+ for (auto const& g : groups) {
for (auto index : g.second) {
this->Emitted.insert(index);
}
@@ -477,7 +457,7 @@ public:
}
}
- void AddLibraries(const std::vector<size_t>& libEntries)
+ void AddLibraries(std::vector<size_t> const& libEntries)
{
if (this->Order == Reverse) {
std::vector<size_t> entries;
@@ -507,7 +487,7 @@ public:
}
}
- void AddObjects(const std::vector<size_t>& objectEntries)
+ void AddObjects(std::vector<size_t> const& objectEntries)
{
// Place explicitly linked object files in the front. The linker will
// always use them anyway, and they may depend on symbols from libraries.
@@ -534,12 +514,12 @@ public:
// expand groups
if (this->Groups) {
- for (const auto& g : *this->Groups) {
- const LinkEntry& groupEntry = this->Entries[g.first];
+ for (auto const& g : *this->Groups) {
+ LinkEntry const& groupEntry = this->Entries[g.first];
auto it = this->FinalEntries.begin();
while (true) {
it = std::find_if(it, this->FinalEntries.end(),
- [&groupEntry](const LinkEntry& entry) -> bool {
+ [&groupEntry](LinkEntry const& entry) -> bool {
return groupEntry.Item == entry.Item;
});
if (it == this->FinalEntries.end()) {
@@ -594,7 +574,7 @@ private:
}
template <typename Range>
- void AddLibraries(const Range& libEntries)
+ void AddLibraries(Range const& libEntries)
{
for (auto index : libEntries) {
LinkEntry const& entry = this->Entries[index];
@@ -606,21 +586,21 @@ private:
OrderKind Order = Reverse;
DeduplicationKind Deduplication = Shared;
- const cmGeneratorTarget* Target;
- const std::string& LinkLanguage;
+ cmGeneratorTarget const* Target;
+ std::string const& LinkLanguage;
EntryVector& Entries;
EntryVector& FinalEntries;
std::set<size_t> Emitted;
- const std::map<size_t, std::vector<size_t>>* Groups = nullptr;
+ std::map<size_t, std::vector<size_t>> const* Groups = nullptr;
};
}
std::string const& cmComputeLinkDepends::LinkEntry::DEFAULT =
cmLinkItem::DEFAULT;
-cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
- const std::string& config,
- const std::string& linkLanguage,
+cmComputeLinkDepends::cmComputeLinkDepends(cmGeneratorTarget const* target,
+ std::string const& config,
+ std::string const& linkLanguage,
LinkLibrariesStrategy strategy)
: Target(target)
, Makefile(this->Target->Target->GetMakefile())
@@ -630,7 +610,7 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
, DebugMode(this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE") ||
this->Target->GetProperty("LINK_DEPENDS_DEBUG_MODE").IsOn())
, LinkLanguage(linkLanguage)
- , LinkType(CMP0003_ComputeLinkType(
+ , LinkType(ComputeLinkType(
this->Config, this->Makefile->GetCMakeInstance()->GetDebugConfigs()))
, Strategy(strategy)
@@ -679,24 +659,20 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
*linkLibraryOverride, target->GetLocalGenerator(), config, target,
&dagChecker, target, linkLanguage);
- auto overrideList = cmTokenize(overrideValue, ","_s);
+ std::vector<std::string> overrideList =
+ cmTokenize(overrideValue, ',', cmTokenizerMode::New);
if (overrideList.size() >= 2) {
auto const& feature = overrideList.front();
- for_each(overrideList.cbegin() + 1, overrideList.cend(),
- [this, &feature](std::string const& item) {
- this->LinkLibraryOverride.emplace(item, feature);
- });
+ std::for_each(overrideList.cbegin() + 1, overrideList.cend(),
+ [this, &feature](std::string const& item) {
+ this->LinkLibraryOverride.emplace(item, feature);
+ });
}
}
}
cmComputeLinkDepends::~cmComputeLinkDepends() = default;
-void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
-{
- this->OldLinkDirMode = b;
-}
-
std::vector<cmComputeLinkDepends::LinkEntry> const&
cmComputeLinkDepends::Compute()
{
@@ -887,7 +863,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry qe)
// Follow the target dependencies.
if (cmLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) {
- const bool isIface =
+ bool const isIface =
entry.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY;
// This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries);
@@ -905,11 +881,6 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry qe)
// Handle dependent shared libraries.
this->FollowSharedDeps(depender_index, iface);
-
- // Support for CMP0003.
- for (cmLinkItem const& oi : iface->WrongConfigLibraries) {
- this->CheckWrongConfigItem(oi);
- }
}
} else {
// Follow the old-style dependency list.
@@ -979,7 +950,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
}
void cmComputeLinkDepends::AddVarLinkEntries(
- cm::optional<size_t> const& depender_index, const char* value)
+ cm::optional<size_t> const& depender_index, char const* value)
{
// This is called to add the dependencies named by
// <item>_LIB_DEPENDS. The variable contains a semicolon-separated
@@ -1020,9 +991,6 @@ void cmComputeLinkDepends::AddVarLinkEntries(
// If the library is meant for this link type then use it.
if (llt == GENERAL_LibraryType || llt == this->LinkType) {
actual_libs.emplace_back(this->ResolveLinkItem(depender_index, d));
- } else if (this->OldLinkDirMode) {
- cmLinkItem item = this->ResolveLinkItem(depender_index, d);
- this->CheckWrongConfigItem(item);
}
// Reset the link type until another explicit type is given.
@@ -1049,9 +1017,6 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
this->AddLinkEntries(cm::nullopt, runtimeEntries->second);
}
}
- for (cmLinkItem const& wi : impl->WrongConfigLibraries) {
- this->CheckWrongConfigItem(wi);
- }
}
template <typename T>
@@ -1076,7 +1041,7 @@ void cmComputeLinkDepends::AddLinkEntries(
// emit a warning if an undefined feature is used as part of
// an imported target
if (item.Feature != LinkEntry::DEFAULT && depender_index) {
- const auto& depender = this->EntryList[*depender_index];
+ auto const& depender = this->EntryList[*depender_index];
if (depender.Target && depender.Target->IsImported() &&
!IsFeatureSupported(this->Makefile, this->LinkLanguage,
item.Feature)) {
@@ -1126,8 +1091,8 @@ void cmComputeLinkDepends::AddLinkEntries(
}
if (depender_index && group) {
- const auto& depender = this->EntryList[*depender_index];
- const auto& groupFeature = this->EntryList[group->first].Feature;
+ auto const& depender = this->EntryList[*depender_index];
+ auto const& groupFeature = this->EntryList[group->first].Feature;
if (depender.Target && depender.Target->IsImported() &&
!IsGroupFeatureSupported(this->Makefile, this->LinkLanguage,
groupFeature)) {
@@ -1159,7 +1124,7 @@ void cmComputeLinkDepends::AddLinkEntries(
entry.Target->GetType() ==
cmStateEnums::TargetType::INTERFACE_LIBRARY)) {
supportedItem = false;
- const auto& groupFeature = this->EntryList[group->first].Feature;
+ auto const& groupFeature = this->EntryList[group->first].Feature;
this->CMakeInstance->IssueMessage(
MessageType::AUTHOR_WARNING,
cmStrCat(
@@ -1201,9 +1166,9 @@ void cmComputeLinkDepends::AddLinkEntries(
if (supportedItem) {
if (group) {
- const auto& currentFeature = this->EntryList[group->first].Feature;
- for (const auto& g : this->GroupItems) {
- const auto& groupFeature = this->EntryList[g.first].Feature;
+ auto const& currentFeature = this->EntryList[group->first].Feature;
+ for (auto const& g : this->GroupItems) {
+ auto const& groupFeature = this->EntryList[g.first].Feature;
if (groupFeature == currentFeature) {
continue;
}
@@ -1279,7 +1244,7 @@ void cmComputeLinkDepends::AddLinkEntries(
std::vector<size_t> indexes;
bool entryHandled = false;
// search any occurrence of the library in already defined groups
- for (const auto& g : this->GroupItems) {
+ for (auto const& g : this->GroupItems) {
for (auto index : g.second) {
if (entry.Item.Value == this->EntryList[index].Item.Value) {
indexes.push_back(g.first);
@@ -1339,7 +1304,7 @@ void cmComputeLinkDepends::AddLinkObjects(std::vector<cmLinkItem> const& objs)
}
cmLinkItem cmComputeLinkDepends::ResolveLinkItem(
- cm::optional<size_t> const& depender_index, const std::string& name)
+ cm::optional<size_t> const& depender_index, std::string const& name)
{
// Look for a target in the scope of the depender.
cmGeneratorTarget const* from = this->Target;
@@ -1401,7 +1366,7 @@ void cmComputeLinkDepends::UpdateGroupDependencies()
continue;
}
// search the item in the defined groups
- for (const auto& groupItems : this->GroupItems) {
+ for (auto const& groupItems : this->GroupItems) {
auto pos = std::find(groupItems.second.cbegin(),
groupItems.second.cend(), index);
if (pos != groupItems.second.cend()) {
@@ -1757,17 +1722,3 @@ void cmComputeLinkDepends::DisplayFinalEntries()
}
fprintf(stderr, "\n");
}
-
-void cmComputeLinkDepends::CheckWrongConfigItem(cmLinkItem const& item)
-{
- if (!this->OldLinkDirMode) {
- return;
- }
-
- // For CMake 2.4 bug-compatibility we need to consider the output
- // directories of targets linked in another configuration as link
- // directories.
- if (item.Target && !item.Target->IsImported()) {
- this->OldWrongConfigItems.insert(item.Target);
- }
-}
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index dc2fa45..a82db2b 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -40,13 +40,13 @@ class cmComputeLinkDepends
{
public:
cmComputeLinkDepends(cmGeneratorTarget const* target,
- const std::string& config,
- const std::string& linkLanguage,
+ std::string const& config,
+ std::string const& linkLanguage,
LinkLibrariesStrategy strategy);
~cmComputeLinkDepends();
- cmComputeLinkDepends(const cmComputeLinkDepends&) = delete;
- cmComputeLinkDepends& operator=(const cmComputeLinkDepends&) = delete;
+ cmComputeLinkDepends(cmComputeLinkDepends const&) = delete;
+ cmComputeLinkDepends& operator=(cmComputeLinkDepends const&) = delete;
// Basic information about each link item.
struct LinkEntry
@@ -85,12 +85,6 @@ public:
using EntryVector = std::vector<LinkEntry>;
EntryVector const& Compute();
- void SetOldLinkDirMode(bool b);
- std::set<cmGeneratorTarget const*> const& GetOldWrongConfigItems() const
- {
- return this->OldWrongConfigItems;
- }
-
private:
// Context information.
cmGeneratorTarget const* Target = nullptr;
@@ -115,14 +109,14 @@ private:
cm::optional<size_t> const& groupIndex);
void AddLinkObject(cmLinkItem const& item);
void AddVarLinkEntries(cm::optional<size_t> const& depender_index,
- const char* value);
+ char const* value);
void AddDirectLinkEntries();
template <typename T>
void AddLinkEntries(cm::optional<size_t> const& depender_index,
std::vector<T> const& libs);
void AddLinkObjects(std::vector<cmLinkItem> const& objs);
cmLinkItem ResolveLinkItem(cm::optional<size_t> const& depender_index,
- const std::string& name);
+ std::string const& name);
// One entry for each unique item.
std::vector<LinkEntry> EntryList;
@@ -136,7 +130,7 @@ private:
{
size_t Index;
cm::optional<size_t> GroupIndex;
- const char* LibDepends;
+ char const* LibDepends;
};
std::queue<BFSEntry> BFSQueue;
void FollowLinkEntry(BFSEntry qe);
@@ -212,12 +206,9 @@ private:
// Record of the original link line.
std::vector<size_t> OriginalEntries;
- std::set<cmGeneratorTarget const*> OldWrongConfigItems;
- void CheckWrongConfigItem(cmLinkItem const& item);
// Record of explicitly linked object files.
std::vector<size_t> ObjectEntries;
size_t ComponentOrderId;
- bool OldLinkDirMode = false;
};
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index c2c210b..612555f 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmComputeLinkInformation.h"
#include <algorithm>
@@ -24,7 +24,6 @@
#include "cmMessageType.h"
#include "cmOrderDirectories.h"
#include "cmPlaceholderExpander.h"
-#include "cmPolicies.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
@@ -251,7 +250,7 @@ because this need be done only for shared libraries without soname-s.
*/
cmComputeLinkInformation::cmComputeLinkInformation(
- const cmGeneratorTarget* target, const std::string& config)
+ cmGeneratorTarget const* target, std::string const& config)
// Store context information.
: Target(target)
, Makefile(target->Target->GetMakefile())
@@ -325,7 +324,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Get options needed to specify RPATHs.
this->RuntimeUseChrpath = false;
if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
- const char* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE)
+ char const* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE)
? "EXECUTABLE"
: "SHARED_LIBRARY");
std::string rtVar =
@@ -421,34 +420,12 @@ cmComputeLinkInformation::cmComputeLinkInformation(
this->OrderDependentRPath->SetImplicitDirectories(this->ImplicitLinkDirs);
this->OrderDependentRPath->AddLanguageDirectories(this->RuntimeLinkDirs);
}
-
- // Decide whether to enable compatible library search path mode.
- // There exists code that effectively does
- //
- // /path/to/libA.so -lB
- //
- // where -lB is meant to link to /path/to/libB.so. This is broken
- // because it specified -lB without specifying a link directory (-L)
- // in which to search for B. This worked in CMake 2.4 and below
- // because -L/path/to would be added by the -L/-l split for A. In
- // order to support such projects we need to add the directories
- // containing libraries linked with a full path to the -L path.
- this->OldLinkDirMode =
- this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
- if (this->OldLinkDirMode) {
- // Construct a mask to not bother with this behavior for link
- // directories already specified by the user.
- this->OldLinkDirMask.insert(directories.begin(), directories.end());
- }
-
- this->CMP0060Warn = this->Makefile->PolicyOptionalWarningEnabled(
- "CMAKE_POLICY_WARNING_CMP0060");
}
cmComputeLinkInformation::~cmComputeLinkInformation() = default;
namespace {
-const std::string& DEFAULT = cmComputeLinkDepends::LinkEntry::DEFAULT;
+std::string const& DEFAULT = cmComputeLinkDepends::LinkEntry::DEFAULT;
}
void cmComputeLinkInformation::AppendValues(
@@ -480,14 +457,14 @@ cmComputeLinkInformation::GetDirectoriesWithBacktraces()
{
std::vector<BT<std::string>> directoriesWithBacktraces;
- std::vector<BT<std::string>> targetLinkDirectores =
+ std::vector<BT<std::string>> targetLinkDirectories =
this->Target->GetLinkDirectories(this->Config, this->LinkLanguage);
- const std::vector<std::string>& orderedDirectories = this->GetDirectories();
- for (const std::string& dir : orderedDirectories) {
- auto result =
- std::find(targetLinkDirectores.begin(), targetLinkDirectores.end(), dir);
- if (result != targetLinkDirectores.end()) {
+ std::vector<std::string> const& orderedDirectories = this->GetDirectories();
+ for (std::string const& dir : orderedDirectories) {
+ auto result = std::find(targetLinkDirectories.begin(),
+ targetLinkDirectories.end(), dir);
+ if (result != targetLinkDirectories.end()) {
directoriesWithBacktraces.emplace_back(std::move(*result));
} else {
directoriesWithBacktraces.emplace_back(dir);
@@ -533,13 +510,13 @@ cmComputeLinkInformation::GetXcFrameworkHeaderPaths() const
return this->XcFrameworkHeaderPaths;
}
-const std::set<const cmGeneratorTarget*>&
+std::set<cmGeneratorTarget const*> const&
cmComputeLinkInformation::GetSharedLibrariesLinked() const
{
return this->SharedLibrariesLinked;
}
-const std::vector<const cmGeneratorTarget*>&
+std::vector<cmGeneratorTarget const*> const&
cmComputeLinkInformation::GetExternalObjectTargets() const
{
return this->ExternalObjectTargets;
@@ -587,14 +564,13 @@ bool cmComputeLinkInformation::Compute()
// Compute the ordered link line items.
cmComputeLinkDepends cld(this->Target, this->Config, this->LinkLanguage,
strategy);
- cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
FeatureDescriptor const* currentFeature = nullptr;
// Add the link line items.
for (cmComputeLinkDepends::LinkEntry const& linkEntry : linkEntries) {
if (linkEntry.Kind == cmComputeLinkDepends::LinkEntry::Group) {
- const auto& groupFeature = this->GetGroupFeature(linkEntry.Feature);
+ auto const& groupFeature = this->GetGroupFeature(linkEntry.Feature);
if (groupFeature.Supported) {
if (linkEntry.Item.Value == "</LINK_GROUP>" && currentFeature) {
// emit feature suffix, if any
@@ -667,46 +643,9 @@ bool cmComputeLinkInformation::Compute()
this->SetCurrentLinkType(this->StartLinkType);
}
- // Finish listing compatibility paths.
- if (this->OldLinkDirMode) {
- // For CMake 2.4 bug-compatibility we need to consider the output
- // directories of targets linked in another configuration as link
- // directories.
- std::set<cmGeneratorTarget const*> const& wrongItems =
- cld.GetOldWrongConfigItems();
- for (cmGeneratorTarget const* tgt : wrongItems) {
- cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(this->Config)
- ? cmStateEnums::ImportLibraryArtifact
- : cmStateEnums::RuntimeBinaryArtifact;
- this->OldLinkDirItems.push_back(
- tgt->GetFullPath(this->Config, artifact, true));
- }
- }
-
- // Finish setting up linker search directories.
- if (!this->FinishLinkerSearchDirectories()) {
- return false;
- }
-
// Add implicit language runtime libraries and directories.
this->AddImplicitLinkInfo();
- if (!this->CMP0060WarnItems.empty()) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n"
- "Some library files are in directories implicitly searched by "
- "the linker when invoked for " << this->LinkLanguage << ":\n"
- " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n"
- "For compatibility with older versions of CMake, the generated "
- "link line will ask the linker to search for these by library "
- "name."
- ;
- /* clang-format on */
- this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
- }
-
// Record targets referenced by $<TARGET_OBJECTS:...> sources.
this->AddExternalObjectTargets();
@@ -714,8 +653,8 @@ bool cmComputeLinkInformation::Compute()
}
namespace {
-void FinalizeFeatureFormat(std::string& format, const std::string& activeTag,
- const std::string& otherTag)
+void FinalizeFeatureFormat(std::string& format, std::string const& activeTag,
+ std::string const& otherTag)
{
auto pos = format.find(otherTag);
if (pos != std::string::npos) {
@@ -731,7 +670,7 @@ void FinalizeFeatureFormat(std::string& format, const std::string& activeTag,
}
}
-bool IsValidFeatureFormat(const std::string& format)
+bool IsValidFeatureFormat(std::string const& format)
{
return format.find("<LIBRARY>") != std::string::npos ||
format.find("<LIB_ITEM>") != std::string::npos ||
@@ -741,9 +680,9 @@ bool IsValidFeatureFormat(const std::string& format)
class FeaturePlaceHolderExpander : public cmPlaceholderExpander
{
public:
- FeaturePlaceHolderExpander(const std::string* library,
- const std::string* libItem = nullptr,
- const std::string* linkItem = nullptr)
+ FeaturePlaceHolderExpander(std::string const* library,
+ std::string const* libItem = nullptr,
+ std::string const* linkItem = nullptr)
: Library(library)
, LibItem(libItem)
, LinkItem(linkItem)
@@ -766,9 +705,9 @@ private:
return variable;
}
- const std::string* Library = nullptr;
- const std::string* LibItem = nullptr;
- const std::string* LinkItem = nullptr;
+ std::string const* Library = nullptr;
+ std::string const* LibItem = nullptr;
+ std::string const* LinkItem = nullptr;
};
}
@@ -1173,7 +1112,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
BT<std::string> const& item = entry.Item;
// Compute the proper name to use to link this library.
- const std::string& config = this->Config;
+ std::string const& config = this->Config;
bool impexe = (tgt && tgt->IsExecutableWithExports());
if (impexe && !tgt->HasImportLibrary(config) && !this->LoaderFlag) {
// Skip linking to executables on platforms with no import
@@ -1301,7 +1240,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
}
} else if (entry.Kind != cmComputeLinkDepends::LinkEntry::Object) {
// This is a library or option specified by the user.
- this->AddUserItem(entry, true);
+ this->AddUserItem(entry);
}
}
}
@@ -1309,7 +1248,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry)
{
BT<std::string> const& item = entry.Item;
- const cmGeneratorTarget* tgt = entry.Target;
+ cmGeneratorTarget const* tgt = entry.Target;
// Record dependencies on DLLs.
if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
@@ -1399,7 +1338,7 @@ void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry)
if (order) {
if (tgt) {
std::string soName = tgt->GetSOName(this->Config);
- const char* soname = soName.empty() ? nullptr : soName.c_str();
+ char const* soname = soName.empty() ? nullptr : soName.c_str();
order->AddRuntimeLibrary(lib, soname);
} else {
order->AddRuntimeLibrary(lib);
@@ -1428,7 +1367,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
// Lookup link type selection flags.
cmValue static_link_type_flag = nullptr;
cmValue shared_link_type_flag = nullptr;
- const char* target_type_str = nullptr;
+ char const* target_type_str = nullptr;
switch (this->Target->GetType()) {
case cmStateEnums::EXECUTABLE:
target_type_str = "EXE";
@@ -1581,7 +1520,7 @@ std::string cmComputeLinkInformation::CreateExtensionRegex(
{
// Build a list of extension choices.
std::string libext = "(";
- const char* sep = "";
+ char const* sep = "";
for (std::string const& i : exts) {
// Separate this choice from the previous one.
libext += sep;
@@ -1674,15 +1613,7 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry)
return;
}
- // For compatibility with CMake 2.4 include the item's directory in
- // the linker search path.
- if (this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
- !cm::contains(this->OldLinkDirMask,
- cmSystemTools::GetFilenamePath(item.Value))) {
- this->OldLinkDirItems.push_back(item.Value);
- }
-
- const bool isImportedFrameworkFolderOnApple =
+ bool const isImportedFrameworkFolderOnApple =
target->IsImportedFrameworkFolderOnApple(this->Config);
if (target->IsFrameworkOnApple() || isImportedFrameworkFolderOnApple) {
// Add the framework directory and the framework item itself
@@ -1760,19 +1691,6 @@ void cmComputeLinkInformation::AddFullItem(LinkEntry const& entry)
return;
}
- // Full path libraries should specify a valid library file name.
- // See documentation of CMP0008.
- std::string generator = this->GlobalGenerator->GetName();
- if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
- (generator.find("Visual Studio") != std::string::npos ||
- generator.find("Xcode") != std::string::npos)) {
- std::string file = cmSystemTools::GetFilenameName(item.Value);
- if (!this->ExtractAnyLibraryName.find(file)) {
- this->HandleBadFullItem(entry, file);
- return;
- }
- }
-
// This is called to handle a link item that is a full path.
// If the target is not a static library make sure the link type is
// shared. This is because dynamic-mode linking can handle both
@@ -1790,14 +1708,6 @@ void cmComputeLinkInformation::AddFullItem(LinkEntry const& entry)
}
}
- // For compatibility with CMake 2.4 include the item's directory in
- // the linker search path.
- if (this->OldLinkDirMode &&
- !cm::contains(this->OldLinkDirMask,
- cmSystemTools::GetFilenamePath(item.Value))) {
- this->OldLinkDirItems.push_back(item.Value);
- }
-
// Now add the full path to the library.
this->Items.emplace_back(
item, ItemIsPath::Yes, nullptr, entry.ObjectSource,
@@ -1835,45 +1745,10 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(LinkEntry const& entry)
return false;
}
- // Check the policy for whether we should use the approach below.
- switch (this->Target->GetPolicyStatusCMP0060()) {
- case cmPolicies::WARN:
- if (this->CMP0060Warn) {
- // Print the warning at most once for this item.
- std::string const& wid =
- cmStrCat("CMP0060-WARNING-GIVEN-", item.Value);
- if (!this->CMakeInstance->GetPropertyAsBool(wid)) {
- this->CMakeInstance->SetProperty(wid, "1");
- this->CMP0060WarnItems.insert(item.Value);
- }
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- return false;
- }
-
- // Many system linkers support multiple architectures by
- // automatically selecting the implicit linker search path for the
- // current architecture. If the library appears in an implicit link
- // directory then just report the file name without the directory
- // portion. This will allow the system linker to locate the proper
- // library for the architecture at link time.
- LinkEntry fileEntry{ entry };
- fileEntry.Item = file;
- this->AddUserItem(fileEntry, false);
-
- // Make sure the link directory ordering will find the library.
- this->OrderLinkerSearchPath->AddLinkLibrary(item.Value);
-
- return true;
+ return false;
}
-void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry,
- bool pathNotKnown)
+void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry)
{
// This is called to handle a link item that does not match a CMake
// target and is not a full path. We check here if it looks like a
@@ -1883,19 +1758,11 @@ void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry,
// foo ==> -lfoo
// libfoo.a ==> -Wl,-Bstatic -lfoo
+ cm::string_view const LINKER{ "LINKER:" };
BT<std::string> const& item = entry.Item;
if (item.Value[0] == '-' || item.Value[0] == '$' || item.Value[0] == '`') {
// Pass flags through untouched.
- // if this is a -l option then we might need to warn about
- // CMP0003 so put it in OldUserFlagItems, if it is not a -l
- // or -Wl,-l (-framework -pthread), then allow it without a
- // CMP0003 as -L will not affect those other linker flags
- if (cmHasLiteralPrefix(item.Value, "-l") ||
- cmHasLiteralPrefix(item.Value, "-Wl,-l")) {
- // This is a linker option provided by the user.
- this->OldUserFlagItems.push_back(item.Value);
- }
// Restore the target link type since this item does not specify
// one.
@@ -1906,6 +1773,16 @@ void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry,
return;
}
+ if (cmHasPrefix(item.Value, LINKER)) {
+ std::vector<BT<std::string>> linkerFlag{ 1, item };
+ this->Target->ResolveLinkerWrapper(linkerFlag, this->GetLinkLanguage(),
+ /* joinItems = */ true);
+ if (!linkerFlag.empty()) {
+ this->Items.emplace_back(linkerFlag.front(), ItemIsPath::No);
+ }
+ return;
+ }
+
// Parse out the prefix, base, and suffix components of the
// library name. If the name matches that of a shared or static
// library then set the link type accordingly.
@@ -1958,11 +1835,6 @@ void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry,
// Use just the library name so the linker will search.
lib = this->ExtractAnyLibraryName.match(2);
} else {
- // This is a name specified by the user.
- if (pathNotKnown) {
- this->OldUserFlagItems.push_back(item.Value);
- }
-
// We must ask the linker to search for a library with this name.
// Restore the target link type since this item does not specify
// one.
@@ -2009,7 +1881,7 @@ void cmComputeLinkInformation::AddFrameworkItem(LinkEntry const& entry)
return;
}
- const std::string& fw_path = fwDescriptor->Directory;
+ std::string const& fw_path = fwDescriptor->Directory;
if (!fw_path.empty()) {
// Add the directory portion to the framework search path.
this->AddFrameworkPath(fw_path);
@@ -2148,176 +2020,12 @@ void cmComputeLinkInformation::AddSharedLibNoSOName(LinkEntry const& entry)
// path instead of just the name.
LinkEntry fileEntry{ entry };
fileEntry.Item = cmSystemTools::GetFilenameName(entry.Item.Value);
- this->AddUserItem(fileEntry, false);
+ this->AddUserItem(fileEntry);
// Make sure the link directory ordering will find the library.
this->OrderLinkerSearchPath->AddLinkLibrary(entry.Item.Value);
}
-void cmComputeLinkInformation::HandleBadFullItem(LinkEntry const& entry,
- std::string const& file)
-{
- std::string const& item = entry.Item.Value;
- // Do not depend on things that do not exist.
- auto i = std::find(this->Depends.begin(), this->Depends.end(), item);
- if (i != this->Depends.end()) {
- this->Depends.erase(i);
- }
-
- // Tell the linker to search for the item and provide the proper
- // path for it. Do not contribute to any CMP0003 warning (do not
- // put in OldLinkDirItems or OldUserFlagItems).
- LinkEntry fileEntry{ entry };
- fileEntry.Item = file;
- this->AddUserItem(fileEntry, false);
- this->OrderLinkerSearchPath->AddLinkLibrary(item);
-
- // Produce any needed message.
- switch (this->Target->GetPolicyStatusCMP0008()) {
- case cmPolicies::WARN: {
- // Print the warning at most once for this item.
- std::string wid = cmStrCat("CMP0008-WARNING-GIVEN-", item);
- if (!this->CMakeInstance->GetState()->GetGlobalPropertyAsBool(wid)) {
- this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1");
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n"
- "Target \"" << this->Target->GetName() << "\" links to item\n"
- " " << item << "\n"
- "which is a full-path but not a valid library file name.";
- /* clang-format on */
- this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
- }
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD: // NOLINT(bugprone-branch-clone)
- // OLD behavior does not warn.
- break;
- case cmPolicies::NEW:
- // NEW behavior will not get here.
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS: {
- std::ostringstream e;
- /* clang-format off */
- e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n"
- "Target \"" << this->Target->GetName() << "\" links to item\n"
- " " << item << "\n"
- "which is a full-path but not a valid library file name.";
- /* clang-format on */
- this->CMakeInstance->IssueMessage(MessageType::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
- } break;
- }
-}
-
-bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
-{
- // Support broken projects if necessary.
- if (this->OldLinkDirItems.empty() || this->OldUserFlagItems.empty() ||
- !this->OldLinkDirMode) {
- return true;
- }
-
- // Enforce policy constraints.
- switch (this->Target->GetPolicyStatusCMP0003()) {
- case cmPolicies::WARN:
- if (!this->CMakeInstance->GetState()->GetGlobalPropertyAsBool(
- "CMP0003-WARNING-GIVEN")) {
- this->CMakeInstance->GetState()->SetGlobalProperty(
- "CMP0003-WARNING-GIVEN", "1");
- std::ostringstream w;
- this->PrintLinkPolicyDiagnosis(w);
- this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to add the paths containing libraries with
- // known full paths as link directories.
- break;
- case cmPolicies::NEW:
- // Should never happen due to assignment of OldLinkDirMode
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS: {
- std::ostringstream e;
- e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << '\n';
- this->PrintLinkPolicyDiagnosis(e);
- this->CMakeInstance->IssueMessage(MessageType::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
- return false;
- }
- }
-
- // Add the link directories for full path items.
- for (std::string const& i : this->OldLinkDirItems) {
- this->OrderLinkerSearchPath->AddLinkLibrary(i);
- }
- return true;
-}
-
-void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
-{
- // Tell the user what to do.
- /* clang-format off */
- os << "Policy CMP0003 should be set before this line. "
- "Add code such as\n"
- " if(COMMAND cmake_policy)\n"
- " cmake_policy(SET CMP0003 NEW)\n"
- " endif(COMMAND cmake_policy)\n"
- "as early as possible but after the most recent call to "
- "cmake_minimum_required or cmake_policy(VERSION). ";
- /* clang-format on */
-
- // List the items that might need the old-style paths.
- os << "This warning appears because target \"" << this->Target->GetName()
- << "\" links to some libraries for which the linker must search:\n";
- {
- // Format the list of unknown items to be as short as possible while
- // still fitting in the allowed width (a true solution would be the
- // bin packing problem if we were allowed to change the order).
- std::string::size_type max_size = 76;
- std::string line;
- const char* sep = " ";
- for (std::string const& i : this->OldUserFlagItems) {
- // If the addition of another item will exceed the limit then
- // output the current line and reset it. Note that the separator
- // is either " " or ", " which is always 2 characters.
- if (!line.empty() && (line.size() + i.size() + 2) > max_size) {
- os << line << '\n';
- sep = " ";
- line.clear();
- }
- line += sep;
- line += i;
- // Convert to the other separator.
- sep = ", ";
- }
- if (!line.empty()) {
- os << line << '\n';
- }
- }
-
- // List the paths old behavior is adding.
- os << "and other libraries with known full path:\n";
- std::set<std::string> emitted;
- for (std::string const& i : this->OldLinkDirItems) {
- if (emitted.insert(cmSystemTools::GetFilenamePath(i)).second) {
- os << " " << i << '\n';
- }
- }
-
- // Explain.
- os << "CMake is adding directories in the second list to the linker "
- "search path in case they are needed to find libraries from the "
- "first list (for backwards compatibility with CMake 2.4). "
- "Set policy CMP0003 to OLD or NEW to enable or disable this "
- "behavior explicitly. "
- "Run \"cmake --help-policy CMP0003\" for more information.";
-}
-
void cmComputeLinkInformation::LoadImplicitLinkInfo()
{
// Get platform-wide implicit directories.
@@ -2398,7 +2106,7 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
// Try to get the soname of the library. Only files with this name
// could possibly conflict.
std::string soName = target->GetSOName(this->Config);
- const char* soname = soName.empty() ? nullptr : soName.c_str();
+ char const* soname = soName.empty() ? nullptr : soName.c_str();
// Include this library in the runtime path ordering.
this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname);
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 97db90d..54c7ba1 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -1,10 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
-#include <iosfwd>
#include <map>
#include <memory>
#include <set>
@@ -35,9 +34,9 @@ private:
public:
cmComputeLinkInformation(cmGeneratorTarget const* target,
- const std::string& config);
- cmComputeLinkInformation(const cmComputeLinkInformation&) = delete;
- cmComputeLinkInformation& operator=(const cmComputeLinkInformation&) =
+ std::string const& config);
+ cmComputeLinkInformation(cmComputeLinkInformation const&) = delete;
+ cmComputeLinkInformation& operator=(cmComputeLinkInformation const&) =
delete;
~cmComputeLinkInformation();
bool Compute();
@@ -69,7 +68,7 @@ public:
cmSourceFile const* ObjectSource = nullptr;
bool HasFeature() const { return this->Feature != nullptr; }
- const std::string& GetFeatureName() const
+ std::string const& GetFeatureName() const
{
return HasFeature() ? this->Feature->Name
: cmComputeLinkDepends::LinkEntry::DEFAULT;
@@ -125,7 +124,7 @@ public:
std::string GetConfig() const { return this->Config; }
- const cmGeneratorTarget* GetTarget() { return this->Target; }
+ cmGeneratorTarget const* GetTarget() { return this->Target; }
private:
using LinkEntry = cmComputeLinkDepends::LinkEntry;
@@ -210,13 +209,12 @@ private:
void AddTargetItem(LinkEntry const& entry);
void AddFullItem(LinkEntry const& entry);
bool CheckImplicitDirItem(LinkEntry const& entry);
- void AddUserItem(LinkEntry const& entry, bool pathNotKnown);
+ void AddUserItem(LinkEntry const& entry);
void AddFrameworkItem(LinkEntry const& entry);
void AddXcFrameworkItem(LinkEntry const& entry);
void DropDirectoryItem(BT<std::string> const& item);
bool CheckSharedLibNoSOName(LinkEntry const& entry);
void AddSharedLibNoSOName(LinkEntry const& entry);
- void HandleBadFullItem(LinkEntry const& entry, std::string const& file);
// Framework info.
void ComputeFrameworkInfo();
@@ -227,8 +225,6 @@ private:
// Linker search path computation.
std::unique_ptr<cmOrderDirectories> OrderLinkerSearchPath;
- bool FinishLinkerSearchDirectories();
- void PrintLinkPolicyDiagnosis(std::ostream&);
void AddExternalObjectTargets();
@@ -243,17 +239,11 @@ private:
// Additional paths configured by the runtime linker
std::vector<std::string> RuntimeLinkDirs;
- // Linker search path compatibility mode.
- std::set<std::string> OldLinkDirMask;
- std::vector<std::string> OldLinkDirItems;
- std::vector<std::string> OldUserFlagItems;
- std::set<std::string> CMP0060WarnItems;
// Dependent library path computation.
std::unique_ptr<cmOrderDirectories> OrderDependentRPath;
// Runtime path computation.
std::unique_ptr<cmOrderDirectories> OrderRuntimeSearchPath;
- bool OldLinkDirMode;
bool IsOpenBSD;
bool LinkDependsNoShared;
bool RuntimeUseChrpath;
@@ -261,10 +251,9 @@ private:
bool LinkWithRuntimePath;
bool LinkTypeEnabled;
bool ArchivesMayBeShared;
- bool CMP0060Warn;
void AddLibraryRuntimeInfo(std::string const& fullPath,
- const cmGeneratorTarget* target);
+ cmGeneratorTarget const* target);
void AddLibraryRuntimeInfo(std::string const& fullPath);
class FeatureDescriptor
@@ -272,10 +261,10 @@ private:
public:
FeatureDescriptor() = default;
- const std::string Name;
- const bool Supported = false;
- const std::string Prefix;
- const std::string Suffix;
+ std::string const Name;
+ bool const Supported = false;
+ std::string const Prefix;
+ std::string const Suffix;
std::string GetDecoratedItem(std::string const& library,
ItemIsPath isPath) const;
std::string GetDecoratedItem(std::string const& library,
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index e2faf94..02a8a3e 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmComputeTargetDepends.h"
#include <cassert>
@@ -17,12 +17,12 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocationKind.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
@@ -177,8 +177,8 @@ void cmComputeTargetDepends::CollectTargets()
{
// Collect all targets from all generators.
auto const& lgens = this->GlobalGenerator->GetLocalGenerators();
- for (const auto& lgen : lgens) {
- for (const auto& ti : lgen->GetGeneratorTargets()) {
+ for (auto const& lgen : lgens) {
+ for (auto const& ti : lgen->GetGeneratorTargets()) {
size_t index = this->Targets.size();
this->TargetIndex[ti.get()] = index;
this->Targets.push_back(ti.get());
@@ -262,8 +262,8 @@ void cmComputeTargetDepends::CollectTargetDepends(size_t depender_index)
}
void cmComputeTargetDepends::AddInterfaceDepends(
- size_t depender_index, const cmGeneratorTarget* dependee,
- cmListFileBacktrace const& dependee_backtrace, const std::string& config,
+ size_t depender_index, cmGeneratorTarget const* dependee,
+ cmListFileBacktrace const& dependee_backtrace, std::string const& config,
std::set<cmLinkItem>& emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
@@ -292,7 +292,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
void cmComputeTargetDepends::AddInterfaceDepends(
size_t depender_index, cmLinkItem const& dependee_name,
- const std::string& config, std::set<cmLinkItem>& emitted)
+ std::string const& config, std::set<cmLinkItem>& emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
cmGeneratorTarget const* dependee = dependee_name.Target;
@@ -353,31 +353,11 @@ void cmComputeTargetDepends::AddTargetDepend(size_t depender_index,
if (!dependee && !linking &&
(depender->GetType() != cmStateEnums::GLOBAL_TARGET)) {
- MessageType messageType = MessageType::AUTHOR_WARNING;
- bool issueMessage = false;
- std::ostringstream e;
- switch (depender->GetPolicyStatusCMP0046()) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";
- issueMessage = true;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- issueMessage = true;
- messageType = MessageType::FATAL_ERROR;
- break;
- }
- if (issueMessage) {
- cmake* cm = this->GlobalGenerator->GetCMakeInstance();
-
- e << "The dependency target \"" << dependee_name << "\" of target \""
- << depender->GetName() << "\" does not exist.";
-
- cm->IssueMessage(messageType, e.str(), dependee_name.Backtrace);
- }
+ this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("The dependency target \"", dependee_name.AsStr(),
+ "\" of target \"", depender->GetName(), "\" does not exist."),
+ dependee_name.Backtrace);
}
// Skip targets that will not really be linked. This is probably a
@@ -527,7 +507,7 @@ void cmComputeTargetDepends::OptimizeLinkDependencies(
}
void cmComputeTargetDepends::DisplayGraph(Graph const& graph,
- const std::string& name)
+ std::string const& name)
{
fprintf(stderr, "The %s target dependency graph is:\n", name.c_str());
size_t n = graph.size();
@@ -575,7 +555,7 @@ void cmComputeTargetDepends::DisplaySideEffects()
}
void cmComputeTargetDepends::DisplayComponents(
- cmComputeComponentGraph const& ccg, const std::string& name)
+ cmComputeComponentGraph const& ccg, std::string const& name)
{
fprintf(stderr, "The strongly connected components for the %s graph are:\n",
name.c_str());
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 3ed041b..cb5bd16 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,12 +69,12 @@ private:
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
void AddInterfaceDepends(size_t depender_index,
cmLinkItem const& dependee_name,
- const std::string& config,
+ std::string const& config,
std::set<cmLinkItem>& emitted);
void AddInterfaceDepends(size_t depender_index,
cmGeneratorTarget const* dependee,
cmListFileBacktrace const& dependee_backtrace,
- const std::string& config,
+ std::string const& config,
std::set<cmLinkItem>& emitted);
void AddObjectDepends(size_t depender_index, cmSourceFile const* o,
std::set<cmLinkItem>& emitted);
@@ -96,12 +96,12 @@ private:
Graph IntermediateGraph;
Graph FinalGraph;
std::vector<TargetSideEffects> SideEffects;
- void DisplayGraph(Graph const& graph, const std::string& name);
+ void DisplayGraph(Graph const& graph, std::string const& name);
void DisplaySideEffects();
// Deal with connected components.
void DisplayComponents(cmComputeComponentGraph const& ccg,
- const std::string& name);
+ std::string const& name);
bool CheckComponents(cmComputeComponentGraph const& ccg);
void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, size_t c,
bool strong = false);
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 5a2b33a..1c0900c 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConditionEvaluator.h"
#include <array>
@@ -25,7 +25,6 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
-#include "cmake.h"
namespace {
auto const keyAND = "AND"_s;
@@ -105,9 +104,9 @@ std::string bool2string(bool const value)
static_cast<char>('0' + static_cast<int>(value)));
}
-bool looksLikeSpecialVariable(const std::string& var,
+bool looksLikeSpecialVariable(std::string const& var,
cm::static_string_view prefix,
- const std::size_t varNameLen)
+ std::size_t const varNameLen)
{
// NOTE Expecting a variable name at least 1 char length:
// <prefix> + `{` + <varname> + `}`
@@ -199,13 +198,13 @@ public:
CurrentAndTwoMoreIter make3ArgsIterator() { return *this; }
template <typename Iter>
- void ReduceOneArg(const bool value, Iter args)
+ void ReduceOneArg(bool const value, Iter args)
{
*args.current = cmExpandedCommandArgument(bool2string(value), true);
this->erase(args.next);
}
- void ReduceTwoArgs(const bool value, CurrentAndTwoMoreIter args)
+ void ReduceTwoArgs(bool const value, CurrentAndTwoMoreIter args)
{
*args.current = cmExpandedCommandArgument(bool2string(value), true);
this->erase(args.nextnext);
@@ -219,10 +218,6 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
cmListFileBacktrace bt)
: Makefile(makefile)
, Backtrace(std::move(bt))
- , Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012))
- , Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054))
- , Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057))
- , Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064))
, Policy139Status(makefile.GetPolicyStatus(cmPolicies::CMP0139))
{
}
@@ -244,7 +239,7 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
// directly. AND OR take variables or the values 0 or 1.
bool cmConditionEvaluator::IsTrue(
- const std::vector<cmExpandedCommandArgument>& args, std::string& errorString,
+ std::vector<cmExpandedCommandArgument> const& args, std::string& errorString,
MessageType& status)
{
errorString.clear();
@@ -262,7 +257,7 @@ bool cmConditionEvaluator::IsTrue(
// parens
using handlerFn_t = bool (cmConditionEvaluator::*)(
cmArgumentList&, std::string&, MessageType&);
- const std::array<handlerFn_t, 5> handlers = { {
+ std::array<handlerFn_t, 5> const handlers = { {
&cmConditionEvaluator::HandleLevel0, // parenthesis
&cmConditionEvaluator::HandleLevel1, // predicates
&cmConditionEvaluator::HandleLevel2, // binary ops
@@ -292,45 +287,23 @@ bool cmConditionEvaluator::IsTrue(
return false;
}
- return this->GetBooleanValueWithAutoDereference(newArgs.front(), errorString,
- status, true);
+ return this->GetBooleanValue(newArgs.front());
}
//=========================================================================
cmValue cmConditionEvaluator::GetDefinitionIfUnquoted(
cmExpandedCommandArgument const& argument) const
{
- if ((this->Policy54Status != cmPolicies::WARN &&
- this->Policy54Status != cmPolicies::OLD) &&
- argument.WasQuoted()) {
+ if (argument.WasQuoted()) {
return nullptr;
}
- cmValue def = this->Makefile.GetDefinition(argument.GetValue());
-
- if (def && argument.WasQuoted() &&
- this->Policy54Status == cmPolicies::WARN) {
- if (!this->Makefile.HasCMP0054AlreadyBeenReported(this->Backtrace.Top())) {
- std::ostringstream e;
- // clang-format off
- e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054))
- << "\n"
- "Quoted variables like \"" << argument.GetValue() << "\" "
- "will no longer be dereferenced when the policy is set to NEW. "
- "Since the policy is not set the OLD behavior will be used.";
- // clang-format on
-
- this->Makefile.GetCMakeInstance()->IssueMessage(
- MessageType::AUTHOR_WARNING, e.str(), this->Backtrace);
- }
- }
-
- return def;
+ return this->Makefile.GetDefinition(argument.GetValue());
}
//=========================================================================
cmValue cmConditionEvaluator::GetVariableOrString(
- const cmExpandedCommandArgument& argument) const
+ cmExpandedCommandArgument const& argument) const
{
cmValue def = this->GetDefinitionIfUnquoted(argument);
@@ -344,35 +317,13 @@ cmValue cmConditionEvaluator::GetVariableOrString(
//=========================================================================
bool cmConditionEvaluator::IsKeyword(
cm::static_string_view keyword,
- const cmExpandedCommandArgument& argument) const
+ cmExpandedCommandArgument const& argument) const
{
- if ((this->Policy54Status != cmPolicies::WARN &&
- this->Policy54Status != cmPolicies::OLD) &&
- argument.WasQuoted()) {
+ if (argument.WasQuoted()) {
return false;
}
- const auto isKeyword = argument.GetValue() == keyword;
-
- if (isKeyword && argument.WasQuoted() &&
- this->Policy54Status == cmPolicies::WARN) {
- if (!this->Makefile.HasCMP0054AlreadyBeenReported(this->Backtrace.Top())) {
- std::ostringstream e;
- // clang-format off
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)
- << "\n"
- "Quoted keywords like \"" << argument.GetValue() << "\" "
- "will no longer be interpreted as keywords "
- "when the policy is set to NEW. "
- "Since the policy is not set the OLD behavior will be used.";
- // clang-format on
-
- this->Makefile.GetCMakeInstance()->IssueMessage(
- MessageType::AUTHOR_WARNING, e.str(), this->Backtrace);
- }
- }
-
- return isKeyword;
+ return argument.GetValue() == keyword;
}
//=========================================================================
@@ -390,7 +341,7 @@ bool cmConditionEvaluator::GetBooleanValue(
// Check for numbers.
if (!arg.empty()) {
char* end;
- const double d = std::strtod(arg.GetValue().c_str(), &end);
+ double const d = std::strtod(arg.GetValue().c_str(), &end);
if (*end == '\0') {
// The whole string is a number. Use C conversion to bool.
return static_cast<bool>(d);
@@ -402,75 +353,9 @@ bool cmConditionEvaluator::GetBooleanValue(
return !def.IsOff();
}
-//=========================================================================
-// Boolean value behavior from CMake 2.6.4 and below.
-bool cmConditionEvaluator::GetBooleanValueOld(
- cmExpandedCommandArgument const& arg, bool const one) const
-{
- if (one) {
- // Old IsTrue behavior for single argument.
- if (arg == "0") {
- return false;
- }
- if (arg == "1") {
- return true;
- }
- cmValue def = this->GetDefinitionIfUnquoted(arg);
- return !def.IsOff();
- }
- // Old GetVariableOrNumber behavior.
- cmValue def = this->GetDefinitionIfUnquoted(arg);
- if (!def && std::atoi(arg.GetValue().c_str())) {
- def = cmValue(arg.GetValue());
- }
- return !def.IsOff();
-}
-
-//=========================================================================
-// returns the resulting boolean value
-bool cmConditionEvaluator::GetBooleanValueWithAutoDereference(
- cmExpandedCommandArgument& newArg, std::string& errorString,
- MessageType& status, bool const oneArg) const
-{
- // Use the policy if it is set.
- if (this->Policy12Status == cmPolicies::NEW) {
- return this->GetBooleanValue(newArg);
- }
- if (this->Policy12Status == cmPolicies::OLD) {
- return this->GetBooleanValueOld(newArg, oneArg);
- }
-
- // Check policy only if old and new results differ.
- const auto newResult = this->GetBooleanValue(newArg);
- const auto oldResult = this->GetBooleanValueOld(newArg, oneArg);
- if (newResult != oldResult) {
- switch (this->Policy12Status) {
- case cmPolicies::WARN:
- errorString = "An argument named \"" + newArg.GetValue() +
- "\" appears in a conditional statement. " +
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0012);
- status = MessageType::AUTHOR_WARNING;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- return oldResult;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS: {
- errorString = "An argument named \"" + newArg.GetValue() +
- "\" appears in a conditional statement. " +
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012);
- status = MessageType::FATAL_ERROR;
- break;
- }
- case cmPolicies::NEW:
- break;
- }
- }
- return newResult;
-}
-
template <int N>
inline int cmConditionEvaluator::matchKeysImpl(
- const cmExpandedCommandArgument&)
+ cmExpandedCommandArgument const&)
{
// Zero means "not found"
return 0;
@@ -478,7 +363,7 @@ inline int cmConditionEvaluator::matchKeysImpl(
template <int N, typename T, typename... Keys>
inline int cmConditionEvaluator::matchKeysImpl(
- const cmExpandedCommandArgument& arg, T current, Keys... key)
+ cmExpandedCommandArgument const& arg, T current, Keys... key)
{
if (this->IsKeyword(current, arg)) {
// Stop searching as soon as smth has found
@@ -489,7 +374,7 @@ inline int cmConditionEvaluator::matchKeysImpl(
template <typename... Keys>
inline int cmConditionEvaluator::matchKeys(
- const cmExpandedCommandArgument& arg, Keys... key)
+ cmExpandedCommandArgument const& arg, Keys... key)
{
// Get index of the matched key (1-based)
return matchKeysImpl<1>(arg, key...);
@@ -518,12 +403,12 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs,
// store the reduced args in this vector
auto argOpen = std::next(arg);
- const std::vector<cmExpandedCommandArgument> subExpr(
+ std::vector<cmExpandedCommandArgument> const subExpr(
argOpen, std::prev(argClose));
// now recursively invoke IsTrue to handle the values inside the
// parenthetical expression
- const auto value = this->IsTrue(subExpr, errorString, status);
+ auto const value = this->IsTrue(subExpr, errorString, status);
*arg = cmExpandedCommandArgument(bool2string(value), true);
argOpen = std::next(arg);
// remove the now evaluated parenthetical expression
@@ -540,26 +425,6 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
{
for (auto args = newArgs.make2ArgsIterator(); args.current != newArgs.end();
args.advance(newArgs)) {
-
- auto policyCheck = [&, this](const cmPolicies::PolicyID id,
- const cmPolicies::PolicyStatus status,
- const cm::static_string_view kw) {
- if (status == cmPolicies::WARN && this->IsKeyword(kw, *args.current)) {
- std::ostringstream e;
- e << cmPolicies::GetPolicyWarning(id) << "\n"
- << kw
- << " will be interpreted as an operator "
- "when the policy is set to NEW. "
- "Since the policy is not set the OLD behavior will be used.";
-
- this->Makefile.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- }
- };
-
- // NOTE Checking policies for warnings are not require an access to the
- // next arg. Check them first!
- policyCheck(cmPolicies::CMP0064, this->Policy64Status, keyTEST);
-
// NOTE Fail fast: All the predicates below require the next arg to be
// valid
if (args.next == newArgs.end()) {
@@ -625,17 +490,17 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
}
// is a variable defined
else if (this->IsKeyword(keyDEFINED, *args.current)) {
- const auto& var = args.next->GetValue();
- const auto varNameLen = var.size();
+ auto const& var = args.next->GetValue();
+ auto const varNameLen = var.size();
auto result = false;
if (looksLikeSpecialVariable(var, "ENV"_s, varNameLen)) {
- const auto env = args.next->GetValue().substr(4, varNameLen - 5);
+ auto const env = args.next->GetValue().substr(4, varNameLen - 5);
result = cmSystemTools::HasEnv(env);
}
else if (looksLikeSpecialVariable(var, "CACHE"_s, varNameLen)) {
- const auto cache = args.next->GetValue().substr(6, varNameLen - 7);
+ auto const cache = args.next->GetValue().substr(6, varNameLen - 7);
result = static_cast<bool>(
this->Makefile.GetState()->GetCacheEntryValue(cache));
}
@@ -647,10 +512,6 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
}
// does a test exist
else if (this->IsKeyword(keyTEST, *args.current)) {
- if (this->Policy64Status == cmPolicies::OLD ||
- this->Policy64Status == cmPolicies::WARN) {
- continue;
- }
newArgs.ReduceOneArg(
static_cast<bool>(this->Makefile.GetTest(args.next->GetValue())),
args);
@@ -699,7 +560,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
this->Makefile.ClearMatches();
- const auto& rex = args.nextnext->GetValue();
+ auto const& rex = args.nextnext->GetValue();
cmsys::RegularExpression regEntry;
if (!regEntry.compile(rex)) {
std::ostringstream error;
@@ -709,7 +570,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
return false;
}
- const auto match = regEntry.find(*def);
+ auto const match = regEntry.find(*def);
if (match) {
this->Makefile.StoreMatches(regEntry);
}
@@ -744,9 +605,9 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
keySTRLESS_EQUAL, keySTRGREATER,
keySTRGREATER_EQUAL, keySTREQUAL))) {
- const cmValue lhs = this->GetVariableOrString(*args.current);
- const cmValue rhs = this->GetVariableOrString(*args.nextnext);
- const auto val = (*lhs).compare(*rhs);
+ cmValue const lhs = this->GetVariableOrString(*args.current);
+ cmValue const rhs = this->GetVariableOrString(*args.nextnext);
+ auto const val = (*lhs).compare(*rhs);
// clang-format off
const auto result = cmRt2CtSelector<
std::less, std::less_equal,
@@ -761,10 +622,10 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
this->matchKeys(*args.next, keyVERSION_LESS,
keyVERSION_LESS_EQUAL, keyVERSION_GREATER,
keyVERSION_GREATER_EQUAL, keyVERSION_EQUAL))) {
- const auto op = MATCH2CMPOP[matchNo - 1];
- const cmValue lhs = this->GetVariableOrString(*args.current);
- const cmValue rhs = this->GetVariableOrString(*args.nextnext);
- const auto result = cmSystemTools::VersionCompare(op, lhs, rhs);
+ auto const op = MATCH2CMPOP[matchNo - 1];
+ cmValue const lhs = this->GetVariableOrString(*args.current);
+ cmValue const rhs = this->GetVariableOrString(*args.nextnext);
+ auto const result = cmSystemTools::VersionCompare(op, lhs, rhs);
newArgs.ReduceTwoArgs(result, args);
}
@@ -778,29 +639,12 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
}
else if (this->IsKeyword(keyIN_LIST, *args.next)) {
+ cmValue lhs = this->GetVariableOrString(*args.current);
+ cmValue rhs = this->Makefile.GetDefinition(args.nextnext->GetValue());
- if (this->Policy57Status != cmPolicies::OLD &&
- this->Policy57Status != cmPolicies::WARN) {
-
- cmValue lhs = this->GetVariableOrString(*args.current);
- cmValue rhs = this->Makefile.GetDefinition(args.nextnext->GetValue());
-
- newArgs.ReduceTwoArgs(
- rhs &&
- cm::contains(cmList{ *rhs, cmList::EmptyElements::Yes }, *lhs),
- args);
- }
-
- else if (this->Policy57Status == cmPolicies::WARN) {
- std::ostringstream e;
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0057)
- << "\n"
- "IN_LIST will be interpreted as an operator "
- "when the policy is set to NEW. "
- "Since the policy is not set the OLD behavior will be used.";
-
- this->Makefile.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- }
+ newArgs.ReduceTwoArgs(
+ rhs && cm::contains(cmList{ *rhs, cmList::EmptyElements::Yes }, *lhs),
+ args);
}
else if (this->IsKeyword(keyPATH_EQUAL, *args.next)) {
@@ -810,7 +654,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
cmValue lhs = this->GetVariableOrString(*args.current);
cmValue rhs = this->GetVariableOrString(*args.nextnext);
- const auto result = cmCMakePath{ *lhs } == cmCMakePath{ *rhs };
+ auto const result = cmCMakePath{ *lhs } == cmCMakePath{ *rhs };
newArgs.ReduceTwoArgs(result, args);
}
@@ -831,15 +675,13 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
//=========================================================================
// level 3 handles NOT
-bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs,
- std::string& errorString,
- MessageType& status)
+bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs, std::string&,
+ MessageType&)
{
for (auto args = newArgs.make2ArgsIterator(); args.next != newArgs.end();
args.advance(newArgs)) {
if (this->IsKeyword(keyNOT, *args.current)) {
- const auto rhs = this->GetBooleanValueWithAutoDereference(
- *args.next, errorString, status);
+ auto const rhs = this->GetBooleanValue(*args.next);
newArgs.ReduceOneArg(!rhs, args);
}
}
@@ -848,9 +690,8 @@ bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs,
//=========================================================================
// level 4 handles AND OR
-bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs,
- std::string& errorString,
- MessageType& status)
+bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs, std::string&,
+ MessageType&)
{
for (auto args = newArgs.make3ArgsIterator(); args.nextnext != newArgs.end();
args.advance(newArgs)) {
@@ -858,10 +699,8 @@ bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs,
int matchNo;
if ((matchNo = this->matchKeys(*args.next, keyAND, keyOR))) {
- const auto lhs = this->GetBooleanValueWithAutoDereference(
- *args.current, errorString, status);
- const auto rhs = this->GetBooleanValueWithAutoDereference(
- *args.nextnext, errorString, status);
+ auto const lhs = this->GetBooleanValue(*args.current);
+ auto const rhs = this->GetBooleanValue(*args.nextnext);
// clang-format off
const auto result =
cmRt2CtSelector<
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index 4f42206..0d9c78d 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,39 +25,30 @@ public:
// this is a shared function for both If and Else to determine if the
// arguments were valid, and if so, was the response true. If there is
// an error, the errorString will be set.
- bool IsTrue(const std::vector<cmExpandedCommandArgument>& args,
+ bool IsTrue(std::vector<cmExpandedCommandArgument> const& args,
std::string& errorString, MessageType& status);
private:
class cmArgumentList;
- // Filter the given variable definition based on policy CMP0054.
cmValue GetDefinitionIfUnquoted(
- const cmExpandedCommandArgument& argument) const;
+ cmExpandedCommandArgument const& argument) const;
- cmValue GetVariableOrString(const cmExpandedCommandArgument& argument) const;
+ cmValue GetVariableOrString(cmExpandedCommandArgument const& argument) const;
bool IsKeyword(cm::static_string_view keyword,
- const cmExpandedCommandArgument& argument) const;
+ cmExpandedCommandArgument const& argument) const;
bool GetBooleanValue(cmExpandedCommandArgument& arg) const;
- bool GetBooleanValueOld(cmExpandedCommandArgument const& arg,
- bool one) const;
-
- bool GetBooleanValueWithAutoDereference(cmExpandedCommandArgument& newArg,
- std::string& errorString,
- MessageType& status,
- bool oneArg = false) const;
-
template <int N>
- int matchKeysImpl(const cmExpandedCommandArgument&);
+ int matchKeysImpl(cmExpandedCommandArgument const&);
template <int N, typename T, typename... Keys>
- int matchKeysImpl(const cmExpandedCommandArgument&, T, Keys...);
+ int matchKeysImpl(cmExpandedCommandArgument const&, T, Keys...);
template <typename... Keys>
- int matchKeys(const cmExpandedCommandArgument&, Keys...);
+ int matchKeys(cmExpandedCommandArgument const&, Keys...);
bool HandleLevel0(cmArgumentList& newArgs, std::string& errorString,
MessageType& status);
@@ -75,9 +66,5 @@ private:
cmMakefile& Makefile;
cmListFileBacktrace Backtrace;
- cmPolicies::PolicyStatus Policy12Status;
- cmPolicies::PolicyStatus Policy54Status;
- cmPolicies::PolicyStatus Policy57Status;
- cmPolicies::PolicyStatus Policy64Status;
cmPolicies::PolicyStatus Policy139Status;
};
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 23e4846..4b932f2 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmsys/Configure.hxx" // IWYU pragma: export
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index bf83b38..42ef230 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigureFileCommand.h"
#include <set>
@@ -28,7 +28,7 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args,
}
std::string const& inFile = args[0];
- const std::string inputFile = cmSystemTools::CollapseFullPath(
+ std::string const inputFile = cmSystemTools::CollapseFullPath(
inFile, status.GetMakefile().GetCurrentSourceDirectory());
// If the input location is a directory, error out.
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 009c145..6ba62c0 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmConfigureLog.cxx b/Source/cmConfigureLog.cxx
index a6658e2..a7ada17 100644
--- a/Source/cmConfigureLog.cxx
+++ b/Source/cmConfigureLog.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigureLog.h"
#include <cassert>
@@ -28,7 +28,7 @@ cmConfigureLog::cmConfigureLog(std::string logDir,
, LogVersions(std::move(logVersions))
{
// Always emit events for the latest log version.
- static const unsigned long LatestLogVersion = 1;
+ static unsigned long const LatestLogVersion = 1;
if (!cm::contains(this->LogVersions, LatestLogVersion)) {
this->LogVersions.emplace_back(LatestLogVersion);
}
@@ -196,7 +196,7 @@ void cmConfigureLog::WriteValue(cm::string_view key,
void cmConfigureLog::WriteValue(cm::string_view key,
std::map<std::string, std::string> const& map)
{
- static const std::string rawKeyChars = //
+ static std::string const rawKeyChars = //
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" //
"abcdefghijklmnopqrstuvwxyz" //
"0123456789" //
diff --git a/Source/cmConfigureLog.h b/Source/cmConfigureLog.h
index 7edc3ed..ff9b4ee 100644
--- a/Source/cmConfigureLog.h
+++ b/Source/cmConfigureLog.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
diff --git a/Source/cmConsoleBuf.cxx b/Source/cmConsoleBuf.cxx
index 8ce9ebc..286c4c3 100644
--- a/Source/cmConsoleBuf.cxx
+++ b/Source/cmConsoleBuf.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConsoleBuf.h"
#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
diff --git a/Source/cmConsoleBuf.h b/Source/cmConsoleBuf.h
index 0a6d3b5..72e9da7 100644
--- a/Source/cmConsoleBuf.h
+++ b/Source/cmConsoleBuf.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmConstStack.h b/Source/cmConstStack.h
index f0bca32..d6059e7 100644
--- a/Source/cmConstStack.h
+++ b/Source/cmConstStack.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmConstStack.tcc b/Source/cmConstStack.tcc
index 81918ee..ee69c9c 100644
--- a/Source/cmConstStack.tcc
+++ b/Source/cmConstStack.tcc
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cassert>
#include <memory>
diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx
index c6cecbe..347f1a2 100644
--- a/Source/cmContinueCommand.cxx
+++ b/Source/cmContinueCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmContinueCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 29a219f..122f9ee 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmConvertMSBuildXMLToJSON.py b/Source/cmConvertMSBuildXMLToJSON.py
index 2be3781..b1e58bc 100644
--- a/Source/cmConvertMSBuildXMLToJSON.py
+++ b/Source/cmConvertMSBuildXMLToJSON.py
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
import argparse
import codecs
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 4d739ff..d300ad4 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCoreTryCompile.h"
#include <array>
@@ -36,7 +36,7 @@
#include "cmake.h"
namespace {
-constexpr const char* unique_binary_directory = "CMAKE_BINARY_DIR_USE_MKDTEMP";
+constexpr char const* unique_binary_directory = "CMAKE_BINARY_DIR_USE_MKDTEMP";
constexpr size_t lang_property_start = 0;
constexpr size_t lang_property_size = 4;
constexpr size_t pie_property_start = 4;
@@ -110,6 +110,8 @@ std::string const kCMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT =
"CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT";
std::string const kCMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT =
"CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT";
+std::string const kCMAKE_MSVC_RUNTIME_CHECKS_DEFAULT =
+ "CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT";
/* GHS Multi platform variables */
std::set<std::string> const ghs_platform_vars{
@@ -135,14 +137,14 @@ ArgumentParser::Continue TryCompileCompileDefs(Arguments& args,
}
cmArgumentParser<Arguments> makeTryCompileParser(
- const cmArgumentParser<Arguments>& base)
+ cmArgumentParser<Arguments> const& base)
{
return cmArgumentParser<Arguments>{ base }.Bind("OUTPUT_VARIABLE"_s,
&Arguments::OutputVariable);
}
cmArgumentParser<Arguments> makeTryRunParser(
- const cmArgumentParser<Arguments>& base)
+ cmArgumentParser<Arguments> const& base)
{
return cmArgumentParser<Arguments>{ base }
.Bind("COMPILE_OUTPUT_VARIABLE"_s, &Arguments::CompileOutputVariable)
@@ -254,8 +256,8 @@ ArgumentParser::Continue cmCoreTryCompile::Arguments::SetSourceType(
}
Arguments cmCoreTryCompile::ParseArgs(
- const cmRange<std::vector<std::string>::const_iterator>& args,
- const cmArgumentParser<Arguments>& parser,
+ cmRange<std::vector<std::string>::const_iterator> const& args,
+ cmArgumentParser<Arguments> const& parser,
std::vector<std::string>& unparsedArguments)
{
Arguments arguments{ this->Makefile };
@@ -263,7 +265,7 @@ Arguments cmCoreTryCompile::ParseArgs(
if (!arguments.MaybeReportError(*(this->Makefile)) &&
!unparsedArguments.empty()) {
std::string m = "Unknown arguments:";
- for (const auto& i : unparsedArguments) {
+ for (auto const& i : unparsedArguments) {
m = cmStrCat(m, "\n \"", i, '"');
}
this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m);
@@ -275,7 +277,7 @@ Arguments cmCoreTryCompile::ParseArgs(
cmRange<std::vector<std::string>::const_iterator> args, bool isTryRun)
{
std::vector<std::string> unparsedArguments;
- const auto& second = *(++args.begin());
+ auto const& second = *(++args.begin());
if (!isTryRun && second == "PROJECT") {
// New PROJECT signature (try_compile only).
@@ -359,7 +361,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
of the same executable name (some filesystems fail on that). */
char targetNameBuf[64];
snprintf(targetNameBuf, sizeof(targetNameBuf), "cmTC_%05x",
- cmSystemTools::RandomSeed() & 0xFFFFF);
+ cmSystemTools::RandomNumber() & 0xFFFFF);
targetName = targetNameBuf;
}
@@ -534,8 +536,8 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (arguments.SourceFromContent) {
auto const k = arguments.SourceFromContent->size();
for (auto i = decltype(k){ 0 }; i < k; i += 2) {
- const auto& name = (*arguments.SourceFromContent)[i + 0].first;
- const auto& content = (*arguments.SourceFromContent)[i + 1].first;
+ auto const& name = (*arguments.SourceFromContent)[i + 0].first;
+ auto const& content = (*arguments.SourceFromContent)[i + 1].first;
auto out = this->WriteSource(name, content, "SOURCE_FROM_CONTENT");
if (out.empty()) {
return cm::nullopt;
@@ -547,9 +549,9 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (arguments.SourceFromVar) {
auto const k = arguments.SourceFromVar->size();
for (auto i = decltype(k){ 0 }; i < k; i += 2) {
- const auto& name = (*arguments.SourceFromVar)[i + 0].first;
- const auto& var = (*arguments.SourceFromVar)[i + 1].first;
- const auto& content = this->Makefile->GetDefinition(var);
+ auto const& name = (*arguments.SourceFromVar)[i + 0].first;
+ auto const& var = (*arguments.SourceFromVar)[i + 1].first;
+ auto const& content = this->Makefile->GetDefinition(var);
auto out = this->WriteSource(name, content, "SOURCE_FROM_VAR");
if (out.empty()) {
return cm::nullopt;
@@ -561,11 +563,11 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (arguments.SourceFromFile) {
auto const k = arguments.SourceFromFile->size();
for (auto i = decltype(k){ 0 }; i < k; i += 2) {
- const auto& dst = (*arguments.SourceFromFile)[i + 0].first;
- const auto& src = (*arguments.SourceFromFile)[i + 1].first;
+ auto const& dst = (*arguments.SourceFromFile)[i + 0].first;
+ auto const& src = (*arguments.SourceFromFile)[i + 1].first;
if (!cmSystemTools::GetFilenamePath(dst).empty()) {
- const auto& msg =
+ auto const& msg =
cmStrCat("SOURCE_FROM_FILE given invalid filename \"", dst, '"');
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg);
return cm::nullopt;
@@ -574,7 +576,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
auto dstPath = cmStrCat(this->BinaryDirectory, '/', dst);
auto const result = cmSystemTools::CopyFileAlways(src, dstPath);
if (!result.IsSuccess()) {
- const auto& msg = cmStrCat("SOURCE_FROM_FILE failed to copy \"", src,
+ auto const& msg = cmStrCat("SOURCE_FROM_FILE failed to copy \"", src,
"\": ", result.GetString());
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg);
return cm::nullopt;
@@ -683,6 +685,13 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
!msvcDebugInformationFormatDefault->empty() ? "NEW" : "OLD");
}
+ /* Set MSVC runtime checks policy to match our selection. */
+ if (cmValue msvcRuntimeChecksDefault =
+ this->Makefile->GetDefinition(kCMAKE_MSVC_RUNTIME_CHECKS_DEFAULT)) {
+ fprintf(fout, "cmake_policy(SET CMP0184 %s)\n",
+ !msvcRuntimeChecksDefault->empty() ? "NEW" : "OLD");
+ }
+
/* Set cache/normal variable policy to match outer project.
It may affect toolchain files. */
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) !=
@@ -769,12 +778,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
case cmPolicies::OLD:
// OLD behavior is to do nothing.
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0066));
- CM_FALLTHROUGH;
case cmPolicies::NEW: {
// NEW behavior is to pass config-specific compiler flags.
std::string const cfg = !tcConfig.empty()
@@ -792,42 +795,14 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
}
} break;
}
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0056)) {
- case cmPolicies::WARN:
- if (this->Makefile->PolicyOptionalWarningEnabled(
- "CMAKE_POLICY_WARNING_CMP0056")) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n"
- "For compatibility with older versions of CMake, try_compile "
- "is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) "
- "in the test project."
- ;
- /* clang-format on */
- this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to do nothing.
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0056));
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior is to pass linker flags.
- {
- cmValue exeLinkFlags =
- this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
- fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
- cmOutputConverter::EscapeForCMake(*exeLinkFlags).c_str());
- if (exeLinkFlags) {
- cmakeVariables.emplace("CMAKE_EXE_LINKER_FLAGS", *exeLinkFlags);
- }
- }
- break;
+ {
+ cmValue exeLinkFlags =
+ this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
+ fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
+ cmOutputConverter::EscapeForCMake(*exeLinkFlags).c_str());
+ if (exeLinkFlags) {
+ cmakeVariables.emplace("CMAKE_EXE_LINKER_FLAGS", *exeLinkFlags);
+ }
}
fprintf(fout,
"set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}"
@@ -859,11 +834,11 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
fname.c_str());
// Create all relevant alias targets
if (arguments.LinkLibraries) {
- const auto& aliasTargets = this->Makefile->GetAliasTargets();
+ auto const& aliasTargets = this->Makefile->GetAliasTargets();
for (std::string const& i : *arguments.LinkLibraries) {
auto alias = aliasTargets.find(i);
if (alias != aliasTargets.end()) {
- const auto& aliasTarget =
+ auto const& aliasTarget =
this->Makefile->FindTargetToUse(alias->second);
// Create equivalent library/executable alias
if (aliasTarget->GetType() == cmStateEnums::EXECUTABLE) {
@@ -881,13 +856,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
fprintf(fout, "\n");
}
- /* Set the appropriate policy information for ENABLE_EXPORTS */
- fprintf(fout, "cmake_policy(SET CMP0065 %s)\n",
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0065) ==
- cmPolicies::NEW
- ? "NEW"
- : "OLD");
-
/* Set the appropriate policy information for PIE link flags */
fprintf(fout, "cmake_policy(SET CMP0083 %s)\n",
this->Makefile->GetPolicyStatus(cmPolicies::CMP0083) ==
@@ -910,6 +878,14 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
? "OLD"
: "NEW");
+ /* Set the appropriate policy information for the LINKER: prefix expansion
+ */
+ fprintf(fout, "cmake_policy(SET CMP0181 %s)\n",
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0181) ==
+ cmPolicies::NEW
+ ? "NEW"
+ : "OLD");
+
// Workaround for -Wl,-headerpad_max_install_names issue until we can avoid
// adding that flag in the platform and compiler language files
fprintf(fout,
@@ -990,12 +966,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
// OLD behavior is to not honor the language standard variables.
honorStandard = false;
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0067));
- break;
case cmPolicies::NEW:
// NEW behavior is to honor the language standard variables.
// We already initialized honorStandard to true.
@@ -1060,7 +1030,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (!arguments.LinkOptions.empty()) {
std::vector<std::string> options;
options.reserve(arguments.LinkOptions.size());
- for (const auto& option : arguments.LinkOptions) {
+ for (auto const& option : arguments.LinkOptions) {
options.emplace_back(cmOutputConverter::EscapeForCMake(option));
}
@@ -1150,6 +1120,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s);
vars.emplace("CMAKE_WATCOM_RUNTIME_LIBRARY"_s);
vars.emplace("CMAKE_MSVC_DEBUG_INFORMATION_FORMAT"_s);
+ vars.emplace("CMAKE_MSVC_RUNTIME_CHECKS"_s);
vars.emplace("CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS"_s);
vars.emplace("CMAKE_VS_USE_DEBUG_LIBRARIES"_s);
@@ -1243,7 +1214,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (!this->SrcFileSignature &&
this->Makefile->GetState()->GetGlobalPropertyAsBool(
"PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE")) {
- const std::string var = "CMAKE_PROJECT_TOP_LEVEL_INCLUDES";
+ std::string const var = "CMAKE_PROJECT_TOP_LEVEL_INCLUDES";
if (cmValue val = this->Makefile->GetDefinition(var)) {
std::string flag = cmStrCat("-D", var, "=\'", *val, '\'');
arguments.CMakeFlags.emplace_back(std::move(flag));
@@ -1377,7 +1348,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir)
dir.Load(binDir);
std::set<std::string> deletedFiles;
for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
- const char* fileName = dir.GetFile(i);
+ char const* fileName = dir.GetFile(i);
if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0 &&
// Do not delete NFS temporary files.
!cmHasPrefix(fileName, ".nfs")) {
@@ -1420,7 +1391,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir)
}
}
-void cmCoreTryCompile::FindOutputFile(const std::string& targetName)
+void cmCoreTryCompile::FindOutputFile(std::string const& targetName)
{
this->FindErrorMessage.clear();
this->OutputFile.clear();
@@ -1465,7 +1436,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename,
char const* command) const
{
if (!cmSystemTools::GetFilenamePath(filename).empty()) {
- const auto& msg =
+ auto const& msg =
cmStrCat(command, " given invalid filename \"", filename, '"');
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg);
return {};
@@ -1474,7 +1445,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename,
auto filepath = cmStrCat(this->BinaryDirectory, '/', filename);
cmsys::ofstream file{ filepath.c_str(), std::ios::out };
if (!file) {
- const auto& msg =
+ auto const& msg =
cmStrCat(command, " failed to open \"", filename, "\" for writing");
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg);
return {};
@@ -1482,7 +1453,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename,
file << content;
if (!file) {
- const auto& msg = cmStrCat(command, " failed to write \"", filename, '"');
+ auto const& msg = cmStrCat(command, " failed to write \"", filename, '"');
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg);
return {};
}
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 6a26e88..41d712f 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -146,7 +146,7 @@ public:
TryCompileCode. The result is stored in OutputFile. If nothing is found,
the error message is stored in FindErrorMessage.
*/
- void FindOutputFile(const std::string& targetName);
+ void FindOutputFile(std::string const& targetName);
static void WriteTryCompileEventFields(
cmConfigureLog& log, cmTryCompileResult const& compileResult);
@@ -162,7 +162,7 @@ private:
char const* command) const;
Arguments ParseArgs(
- const cmRange<std::vector<std::string>::const_iterator>& args,
- const cmArgumentParser<Arguments>& parser,
+ cmRange<std::vector<std::string>::const_iterator> const& args,
+ cmArgumentParser<Arguments> const& parser,
std::vector<std::string>& unparsedArguments);
};
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 9edbafe..b1dba7f 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCreateTestSourceList.h"
#include <algorithm>
@@ -22,7 +22,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
std::string extraInclude;
std::string function;
std::vector<std::string> tests;
- // extract extra include and function ot
+ // extract extra include and function
for (; i != args.end(); i++) {
if (*i == "EXTRA_INCLUDE") {
++i;
@@ -46,7 +46,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
// Name of the source list
- const char* sourceList = i->c_str();
+ char const* sourceList = i->c_str();
++i;
// Name of the test driver
@@ -93,7 +93,8 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
tests_func_name.end();
tests_func_name.push_back(func_name);
if (!already_declared) {
- forwardDeclareCode += cmStrCat("int ", func_name, "(int, char*[]);\n");
+ forwardDeclareCode +=
+ cmStrCat("extern int ", func_name, "(int, char*[]);\n");
}
}
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index a7f11a6..6fcb007 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 1b5c3a1..5d1936f 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCryptoHash.h"
#include <cassert>
@@ -131,7 +131,7 @@ bool cmCryptoHash::IntFromHexDigit(char input, char& output)
}
std::string cmCryptoHash::ByteHashToString(
- const std::vector<unsigned char>& hash)
+ std::vector<unsigned char> const& hash)
{
// Map from 4-bit index to hexadecimal representation.
static char const hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
@@ -153,7 +153,7 @@ std::vector<unsigned char> cmCryptoHash::ByteHashString(cm::string_view input)
return this->Finalize();
}
-std::vector<unsigned char> cmCryptoHash::ByteHashFile(const std::string& file)
+std::vector<unsigned char> cmCryptoHash::ByteHashFile(std::string const& file)
{
cmsys::ifstream fin(file.c_str(), std::ios::in | std::ios::binary);
if (fin) {
@@ -192,7 +192,7 @@ std::string cmCryptoHash::HashString(cm::string_view input)
return ByteHashToString(this->ByteHashString(input));
}
-std::string cmCryptoHash::HashFile(const std::string& file)
+std::string cmCryptoHash::HashFile(std::string const& file)
{
return ByteHashToString(this->ByteHashFile(file));
}
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index bb026a2..600a50c 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -52,7 +52,7 @@ public:
static bool IntFromHexDigit(char input, char& output);
/// @brief Converts a byte hash to a sequence of hex character pairs
- static std::string ByteHashToString(const std::vector<unsigned char>& hash);
+ static std::string ByteHashToString(std::vector<unsigned char> const& hash);
/// @brief Calculates a binary hash from string input data
/// @return Binary hash vector
@@ -62,7 +62,7 @@ public:
/// @see ByteHashString()
/// @return Non empty binary hash vector if the file was read successfully.
/// An empty vector otherwise.
- std::vector<unsigned char> ByteHashFile(const std::string& file);
+ std::vector<unsigned char> ByteHashFile(std::string const& file);
/// @brief Calculates a hash string from string input data
/// @return Sequence of hex characters pairs for each byte of the binary hash
@@ -72,7 +72,7 @@ public:
/// @see HashString()
/// @return Non empty hash string if the file was read successfully.
/// An empty string otherwise.
- std::string HashFile(const std::string& file);
+ std::string HashFile(std::string const& file);
/// @brief Returns the name of the hash type.
/// @return The name of the hash type associated with this hash generator.
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index ddd2fec..ba473eb 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCurl.h"
#include <cm/string_view>
@@ -122,7 +122,7 @@ cm::optional<std::string> cmCurlPrintTLSVersion(int curl_tls_version)
return s;
}
-std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile)
+std::string cmCurlSetCAInfo(::CURL* curl, std::string const& cafile)
{
std::string e;
std::string env_ca;
@@ -172,13 +172,22 @@ std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile)
}
# undef CMAKE_CAPATH_AIX
# endif
+# ifdef __sun
+# define CMAKE_CAPATH_SUNOS_CSW "/etc/opt/csw/ssl/certs"
+ if (cmSystemTools::FileIsDirectory(CMAKE_CAPATH_SUNOS_CSW)) {
+ ::CURLcode res =
+ ::curl_easy_setopt(curl, CURLOPT_CAPATH, CMAKE_CAPATH_SUNOS_CSW);
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAPATH: ");
+ }
+# undef CMAKE_CAPATH_SUNOS_CSW
+# endif
}
#endif
return e;
}
-std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
- const std::string& netrc_file)
+std::string cmCurlSetNETRCOption(::CURL* curl, std::string const& netrc_level,
+ std::string const& netrc_file)
{
std::string e;
long curl_netrc_level = CURL_NETRC_LAST;
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index b1cc436..6279925 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,9 +13,9 @@
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);
+std::string cmCurlSetCAInfo(::CURL* curl, std::string const& cafile = {});
+std::string cmCurlSetNETRCOption(::CURL* curl, std::string const& netrc_level,
+ std::string const& netrc_file);
std::string cmCurlFixFileURL(std::string url);
::CURLcode cm_curl_global_init(long flags);
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 9958e4d..5ec451e 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCustomCommand.h"
#include <cassert>
@@ -9,7 +9,7 @@
#include "cmStateSnapshot.h"
-const std::vector<std::string>& cmCustomCommand::GetOutputs() const
+std::vector<std::string> const& cmCustomCommand::GetOutputs() const
{
return this->Outputs;
}
@@ -24,7 +24,7 @@ void cmCustomCommand::SetOutputs(std::string output)
this->Outputs = { std::move(output) };
}
-const std::vector<std::string>& cmCustomCommand::GetByproducts() const
+std::vector<std::string> const& cmCustomCommand::GetByproducts() const
{
return this->Byproducts;
}
@@ -34,7 +34,7 @@ void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts)
this->Byproducts = std::move(byproducts);
}
-const std::vector<std::string>& cmCustomCommand::GetDepends() const
+std::vector<std::string> const& cmCustomCommand::GetDepends() const
{
return this->Depends;
}
@@ -48,7 +48,7 @@ void cmCustomCommand::SetDepends(std::vector<std::string> depends)
Depends = std::move(depends);
}
-const std::string& cmCustomCommand::GetMainDependency() const
+std::string const& cmCustomCommand::GetMainDependency() const
{
assert(this->HasMainDependency_);
return this->Depends[0];
@@ -67,7 +67,7 @@ void cmCustomCommand::SetMainDependency(std::string main_dependency)
}
}
-const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
+cmCustomCommandLines const& cmCustomCommand::GetCommandLines() const
{
return this->CommandLines;
}
@@ -77,24 +77,24 @@ void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
this->CommandLines = std::move(commandLines);
}
-const char* cmCustomCommand::GetComment() const
+char const* cmCustomCommand::GetComment() const
{
- const char* no_comment = nullptr;
+ char const* no_comment = nullptr;
return this->HaveComment ? this->Comment.c_str() : no_comment;
}
-void cmCustomCommand::SetComment(const char* comment)
+void cmCustomCommand::SetComment(char const* comment)
{
this->Comment = comment ? comment : "";
this->HaveComment = (comment != nullptr);
}
-void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
+void cmCustomCommand::AppendCommands(cmCustomCommandLines const& commandLines)
{
cm::append(this->CommandLines, commandLines);
}
-void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
+void cmCustomCommand::AppendDepends(std::vector<std::string> const& depends)
{
cm::append(this->Depends, depends);
}
@@ -154,6 +154,16 @@ void cmCustomCommand::SetUsesTerminal(bool b)
this->UsesTerminal = b;
}
+void cmCustomCommand::SetRole(std::string const& role)
+{
+ this->Role = role;
+}
+
+std::string const& cmCustomCommand::GetRole() const
+{
+ return this->Role;
+}
+
bool cmCustomCommand::GetCommandExpandLists() const
{
return this->CommandExpandLists;
@@ -174,22 +184,22 @@ void cmCustomCommand::SetDependsExplicitOnly(bool b)
this->DependsExplicitOnly = b;
}
-const std::string& cmCustomCommand::GetDepfile() const
+std::string const& cmCustomCommand::GetDepfile() const
{
return this->Depfile;
}
-void cmCustomCommand::SetDepfile(const std::string& depfile)
+void cmCustomCommand::SetDepfile(std::string const& depfile)
{
this->Depfile = depfile;
}
-const std::string& cmCustomCommand::GetJobPool() const
+std::string const& cmCustomCommand::GetJobPool() const
{
return this->JobPool;
}
-void cmCustomCommand::SetJobPool(const std::string& job_pool)
+void cmCustomCommand::SetJobPool(std::string const& job_pool)
{
this->JobPool = job_pool;
}
@@ -212,19 +222,18 @@ void cmCustomCommand::SetJobserverAware(bool b)
CM_FOR_EACH_CUSTOM_COMMAND_POLICY(DEFINE_CC_POLICY_ACCESSOR)
#undef DEFINE_CC_POLICY_ACCESSOR
-void cmCustomCommand::RecordPolicyValues(const cmStateSnapshot& snapshot)
-{
+void cmCustomCommand::RecordPolicyValues(cmStateSnapshot const& snapshot){
#define SET_CC_POLICY(P) this->P##Status = snapshot.GetPolicy(cmPolicies::P);
CM_FOR_EACH_CUSTOM_COMMAND_POLICY(SET_CC_POLICY)
#undef SET_CC_POLICY
}
-const std::string& cmCustomCommand::GetTarget() const
+std::string const& cmCustomCommand::GetTarget() const
{
return this->Target;
}
-void cmCustomCommand::SetTarget(const std::string& target)
+void cmCustomCommand::SetTarget(std::string const& target)
{
this->Target = target;
}
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 6f63d0a..927747e 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,20 +28,20 @@ class cmCustomCommand
{
public:
/** Get the output file produced by the command. */
- const std::vector<std::string>& GetOutputs() const;
+ std::vector<std::string> const& GetOutputs() const;
void SetOutputs(std::vector<std::string> outputs);
void SetOutputs(std::string output);
/** Get the extra files produced by the command. */
- const std::vector<std::string>& GetByproducts() const;
+ std::vector<std::string> const& GetByproducts() const;
void SetByproducts(std::vector<std::string> byproducts);
/** Get the vector that holds the list of dependencies. */
- const std::vector<std::string>& GetDepends() const;
+ std::vector<std::string> const& GetDepends() const;
void SetDepends(std::vector<std::string> depends);
bool HasMainDependency() const { return this->HasMainDependency_; }
- const std::string& GetMainDependency() const;
+ std::string const& GetMainDependency() const;
void SetMainDependency(std::string main_dependency);
/** Get the working directory. */
@@ -50,18 +50,18 @@ public:
return this->WorkingDirectory;
}
- void SetWorkingDirectory(const char* workingDirectory)
+ void SetWorkingDirectory(char const* workingDirectory)
{
this->WorkingDirectory = (workingDirectory ? workingDirectory : "");
}
/** Get the list of command lines. */
- const cmCustomCommandLines& GetCommandLines() const;
+ cmCustomCommandLines const& GetCommandLines() const;
void SetCommandLines(cmCustomCommandLines commandLines);
/** Get the comment string for the command. */
- const char* GetComment() const;
- void SetComment(const char* comment);
+ char const* GetComment() const;
+ void SetComment(char const* comment);
/** Get a value indicating if the command uses UTF-8 output pipes. */
bool GetStdPipesUTF8() const { return this->StdPipesUTF8; }
@@ -71,10 +71,10 @@ public:
}
/** Append to the list of command lines. */
- void AppendCommands(const cmCustomCommandLines& commandLines);
+ void AppendCommands(cmCustomCommandLines const& commandLines);
/** Append to the list of dependencies. */
- void AppendDepends(const std::vector<std::string>& depends);
+ void AppendDepends(std::vector<std::string> const& depends);
/** Set/Get whether old-style escaping should be used. */
bool GetEscapeOldStyle() const;
@@ -108,12 +108,12 @@ public:
void SetDependsExplicitOnly(bool b);
/** Set/Get the depfile (used by the Ninja generator) */
- const std::string& GetDepfile() const;
- void SetDepfile(const std::string& depfile);
+ std::string const& GetDepfile() const;
+ void SetDepfile(std::string const& depfile);
/** Set/Get the job_pool (used by the Ninja generator) */
- const std::string& GetJobPool() const;
- void SetJobPool(const std::string& job_pool);
+ std::string const& GetJobPool() const;
+ void SetJobPool(std::string const& job_pool);
/** Set/Get whether this custom command should be given access to the
jobserver (if possible). */
@@ -126,11 +126,15 @@ public:
#undef DECLARE_CC_POLICY_ACCESSOR
/** Record policy values from state snapshot */
- void RecordPolicyValues(const cmStateSnapshot& snapshot);
+ void RecordPolicyValues(cmStateSnapshot const& snapshot);
/** Set/Get the associated target */
- const std::string& GetTarget() const;
- void SetTarget(const std::string& target);
+ std::string const& GetTarget() const;
+ void SetTarget(std::string const& target);
+
+ /** Set/Get the custom command rolee */
+ std::string const& GetRole() const;
+ void SetRole(std::string const& role);
/** Record if the custom command can be used for code generation. */
bool GetCodegen() const { return Codegen; }
@@ -148,6 +152,7 @@ private:
std::string WorkingDirectory;
std::string Depfile;
std::string JobPool;
+ std::string Role;
bool JobserverAware = false;
bool HaveComment = false;
bool EscapeAllowMakeVars = false;
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 2dea338..4d34d66 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCustomCommandGenerator.h"
#include <cstddef>
@@ -150,7 +150,7 @@ std::string EvaluateDepfile(std::string const& path,
return cge->Evaluate(lg, config);
}
-std::string EvaluateComment(const char* comment,
+std::string EvaluateComment(char const* comment,
cmGeneratorExpression const& ge,
cmLocalGenerator* lg, std::string const& config)
{
@@ -162,7 +162,7 @@ std::string EvaluateComment(const char* comment,
cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg,
bool transformDepfile, cm::optional<std::string> crossConfig,
- std::function<std::string(const std::string&, const std::string&)>
+ std::function<std::string(std::string const&, std::string const&)>
computeInternalDepfile)
: CC(&cc)
, OutputConfig(crossConfig ? *crossConfig : config)
@@ -181,7 +181,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
bool const distinctConfigs = this->OutputConfig != this->CommandConfig;
- const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines();
+ cmCustomCommandLines const& cmdlines = this->CC->GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
cmCustomCommandLine argv;
// For the command itself, we default to the COMMAND_CONFIG.
@@ -258,7 +258,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
this->Depends = EvaluateDepends(cc.GetDepends(), ge, this->LG,
this->OutputConfig, this->CommandConfig);
- const std::string& workingdirectory = this->CC->GetWorkingDirectory();
+ std::string const& workingdirectory = this->CC->GetWorkingDirectory();
if (!workingdirectory.empty()) {
this->WorkingDirectory = EvaluateSplitConfigGenex(
workingdirectory, ge, this->LG, true, this->OutputConfig,
@@ -320,7 +320,7 @@ std::vector<std::string> cmCustomCommandGenerator::GetCrossCompilingEmulator(
return this->EmulatorsWithArguments[c];
}
-const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const
+char const* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const
{
// If the command is the plain name of an executable target, we replace it
// with the path to the executable artifact in the command config.
@@ -353,14 +353,14 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
if (!emulator.empty()) {
return emulator[0];
}
- if (const char* location = this->GetArgv0Location(c)) {
+ if (char const* location = this->GetArgv0Location(c)) {
return std::string(location);
}
return this->CommandLines[c][0];
}
-static std::string escapeForShellOldStyle(const std::string& str)
+static std::string escapeForShellOldStyle(std::string const& str)
{
std::string result;
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -373,7 +373,7 @@ static std::string escapeForShellOldStyle(const std::string& str)
}
return str;
#else
- for (const char* ch = str.c_str(); *ch != '\0'; ++ch) {
+ for (char const* ch = str.c_str(); *ch != '\0'; ++ch) {
if (*ch == ' ') {
result += '\\';
}
@@ -406,7 +406,7 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c,
cmCustomCommandLine const& commandLine = this->CommandLines[c];
for (unsigned int j = offset; j < commandLine.size(); ++j) {
std::string arg;
- if (const char* location = j == 0 ? this->GetArgv0Location(c) : nullptr) {
+ if (char const* location = j == 0 ? this->GetArgv0Location(c) : nullptr) {
// GetCommand returned the emulator instead of the argv0 location,
// so transform the latter now.
arg = location;
@@ -426,7 +426,7 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c,
std::string cmCustomCommandGenerator::GetDepfile() const
{
- const auto& depfile = this->CC->GetDepfile();
+ auto const& depfile = this->CC->GetDepfile();
if (depfile.empty()) {
return "";
}
@@ -450,7 +450,7 @@ std::string cmCustomCommandGenerator::GetFullDepfile() const
}
std::string cmCustomCommandGenerator::GetInternalDepfileName(
- const std::string& /*config*/, const std::string& depfile) const
+ std::string const& /*config*/, std::string const& depfile) const
{
cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
std::string extension;
@@ -482,7 +482,7 @@ std::string cmCustomCommandGenerator::GetInternalDepfile() const
cm::optional<std::string> cmCustomCommandGenerator::GetComment() const
{
- const char* comment = this->CC->GetComment();
+ char const* comment = this->CC->GetComment();
if (!comment) {
return cm::nullopt;
}
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index 43bdd10..1bf12e9 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,8 +20,8 @@ class cmLocalGenerator;
class cmCustomCommandGenerator
{
- std::string GetInternalDepfileName(const std::string&,
- const std::string&) const;
+ std::string GetInternalDepfileName(std::string const&,
+ std::string const&) const;
cmCustomCommand const* CC;
std::string OutputConfig;
@@ -37,22 +37,22 @@ class cmCustomCommandGenerator
std::vector<std::string> Depends;
std::string WorkingDirectory;
std::set<BT<std::pair<std::string, bool>>> Utilities;
- std::function<std::string(const std::string&, const std::string&)>
+ std::function<std::string(std::string const&, std::string const&)>
ComputeInternalDepfile;
void FillEmulatorsWithArguments();
std::vector<std::string> GetCrossCompilingEmulator(unsigned int c) const;
- const char* GetArgv0Location(unsigned int c) const;
+ char const* GetArgv0Location(unsigned int c) const;
public:
cmCustomCommandGenerator(
cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg,
bool transformDepfile = true, cm::optional<std::string> crossConfig = {},
- std::function<std::string(const std::string&, const std::string&)>
+ std::function<std::string(std::string const&, std::string const&)>
computeInternalDepfile = {});
- cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete;
+ cmCustomCommandGenerator(cmCustomCommandGenerator const&) = delete;
cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default;
- cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) =
+ cmCustomCommandGenerator& operator=(cmCustomCommandGenerator const&) =
delete;
cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default;
cmCustomCommand const& GetCC() const { return *(this->CC); }
@@ -70,6 +70,6 @@ public:
std::string GetFullDepfile() const;
std::string GetInternalDepfile() const;
- const std::string& GetOutputConfig() const { return this->OutputConfig; }
- const std::string& GetCommandConfig() const { return this->CommandConfig; }
+ std::string const& GetOutputConfig() const { return this->OutputConfig; }
+ std::string const& GetCommandConfig() const { return this->CommandConfig; }
};
diff --git a/Source/cmCustomCommandLines.cxx b/Source/cmCustomCommandLines.cxx
index 37ad75b..0c69e51 100644
--- a/Source/cmCustomCommandLines.cxx
+++ b/Source/cmCustomCommandLines.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCustomCommandLines.h"
cmCustomCommandLine cmMakeCommandLine(
diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h
index ee8d080..40ca1dd 100644
--- a/Source/cmCustomCommandLines.h
+++ b/Source/cmCustomCommandLines.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCustomCommandTypes.h b/Source/cmCustomCommandTypes.h
index 324da9e..d1bfc38 100644
--- a/Source/cmCustomCommandTypes.h
+++ b/Source/cmCustomCommandTypes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx
index 4b2aec7..4b60832 100644
--- a/Source/cmCxxModuleMapper.cxx
+++ b/Source/cmCxxModuleMapper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCxxModuleMapper.h"
#include <cassert>
diff --git a/Source/cmCxxModuleMapper.h b/Source/cmCxxModuleMapper.h
index 898396c..8309937 100644
--- a/Source/cmCxxModuleMapper.h
+++ b/Source/cmCxxModuleMapper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmCxxModuleUsageEffects.cxx b/Source/cmCxxModuleUsageEffects.cxx
index eea5245..aa1a13f 100644
--- a/Source/cmCxxModuleUsageEffects.cxx
+++ b/Source/cmCxxModuleUsageEffects.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmCxxModuleUsageEffects.h"
cmCxxModuleUsageEffects::cmCxxModuleUsageEffects(
diff --git a/Source/cmCxxModuleUsageEffects.h b/Source/cmCxxModuleUsageEffects.h
index a63919c..1c3933c 100644
--- a/Source/cmCxxModuleUsageEffects.h
+++ b/Source/cmCxxModuleUsageEffects.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebugTools.h b/Source/cmDebugTools.h
index c3e05a6..bb1adaf 100644
--- a/Source/cmDebugTools.h
+++ b/Source/cmDebugTools.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iostream>
@@ -13,7 +13,7 @@ namespace cm {
namespace {
template <typename T>
-T dbg_impl(const char* fname, int line, const char* expr, T value)
+T dbg_impl(char const* fname, int line, char const* expr, T value)
{
if (!cmSystemTools::GetEnvVar("CMAKE_NO_DBG")) {
std::cerr << fname << ':' << line << ": " << expr << " = " << value
diff --git a/Source/cmDebuggerAdapter.cxx b/Source/cmDebuggerAdapter.cxx
index c2e0d4f..7dc6e7f 100644
--- a/Source/cmDebuggerAdapter.cxx
+++ b/Source/cmDebuggerAdapter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
@@ -70,7 +70,7 @@ public:
{
}
- inline void Notify()
+ void Notify()
{
std::unique_lock<std::mutex> lock(Mutex);
Count++;
@@ -78,7 +78,7 @@ public:
Cv.notify_one();
}
- inline void Wait()
+ void Wait()
{
std::unique_lock<std::mutex> lock(Mutex);
while (Count == 0) {
@@ -128,7 +128,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
// Handle errors reported by the Session. These errors include protocol
// parsing errors and receiving messages with no handler.
- Session->onError([this](const char* msg) {
+ Session->onError([this](char const* msg) {
if (SessionLog) {
dap::writef(SessionLog, "dap::Session error: %s\n", msg);
}
@@ -144,10 +144,11 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize
- Session->registerHandler([this](const dap::CMakeInitializeRequest& req) {
+ Session->registerHandler([this](dap::CMakeInitializeRequest const& req) {
SupportsVariableType = req.supportsVariableType.value(false);
dap::CMakeInitializeResponse response;
response.supportsConfigurationDoneRequest = true;
+ response.supportsValueFormattingOptions = true;
response.cmakeVersion.major = CMake_VERSION_MAJOR;
response.cmakeVersion.minor = CMake_VERSION_MINOR;
response.cmakeVersion.patch = CMake_VERSION_PATCH;
@@ -158,12 +159,12 @@ cmDebuggerAdapter::cmDebuggerAdapter(
// https://microsoft.github.io/debug-adapter-protocol/specification#Events_Initialized
Session->registerSentHandler(
- [&](const dap::ResponseOrError<dap::CMakeInitializeResponse>&) {
+ [&](dap::ResponseOrError<dap::CMakeInitializeResponse> const&) {
Session->send(dap::InitializedEvent());
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Threads
- Session->registerHandler([this](const dap::ThreadsRequest& req) {
+ Session->registerHandler([this](dap::ThreadsRequest const& req) {
(void)req;
std::unique_lock<std::mutex> lock(Mutex);
dap::ThreadsResponse response;
@@ -181,12 +182,12 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_StackTrace
- Session->registerHandler([this](const dap::StackTraceRequest& request)
+ Session->registerHandler([this](dap::StackTraceRequest const& request)
-> dap::ResponseOrError<dap::StackTraceResponse> {
std::unique_lock<std::mutex> lock(Mutex);
cm::optional<dap::StackTraceResponse> response =
- ThreadManager->GetThreadStackTraceResponse(request.threadId);
+ ThreadManager->GetThreadStackTraceResponse(request);
if (response.has_value()) {
return response.value();
}
@@ -195,7 +196,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Scopes
- Session->registerHandler([this](const dap::ScopesRequest& request)
+ Session->registerHandler([this](dap::ScopesRequest const& request)
-> dap::ResponseOrError<dap::ScopesResponse> {
std::unique_lock<std::mutex> lock(Mutex);
return DefaultThread->GetScopesResponse(request.frameId,
@@ -203,27 +204,27 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Variables
- Session->registerHandler([this](const dap::VariablesRequest& request)
+ Session->registerHandler([this](dap::VariablesRequest const& request)
-> dap::ResponseOrError<dap::VariablesResponse> {
return DefaultThread->GetVariablesResponse(request);
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Pause
- Session->registerHandler([this](const dap::PauseRequest& req) {
+ Session->registerHandler([this](dap::PauseRequest const& req) {
(void)req;
PauseRequest.store(true);
return dap::PauseResponse();
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Continue
- Session->registerHandler([this](const dap::ContinueRequest& req) {
+ Session->registerHandler([this](dap::ContinueRequest const& req) {
(void)req;
ContinueSem->Notify();
return dap::ContinueResponse();
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Next
- Session->registerHandler([this](const dap::NextRequest& req) {
+ Session->registerHandler([this](dap::NextRequest const& req) {
(void)req;
NextStepFrom.store(DefaultThread->GetStackFrameSize());
ContinueSem->Notify();
@@ -231,7 +232,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_StepIn
- Session->registerHandler([this](const dap::StepInRequest& req) {
+ Session->registerHandler([this](dap::StepInRequest const& req) {
(void)req;
// This would stop after stepped in, single line stepped or stepped out.
StepInRequest.store(true);
@@ -240,7 +241,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_StepOut
- Session->registerHandler([this](const dap::StepOutRequest& req) {
+ Session->registerHandler([this](dap::StepOutRequest const& req) {
(void)req;
StepOutDepth.store(DefaultThread->GetStackFrameSize() - 1);
ContinueSem->Notify();
@@ -248,13 +249,13 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Launch
- Session->registerHandler([](const dap::LaunchRequest& req) {
+ Session->registerHandler([](dap::LaunchRequest const& req) {
(void)req;
return dap::LaunchResponse();
});
// Handler for disconnect requests
- Session->registerHandler([this](const dap::DisconnectRequest& request) {
+ Session->registerHandler([this](dap::DisconnectRequest const& request) {
(void)request;
BreakpointManager->ClearAll();
ExceptionManager->ClearAll();
@@ -265,7 +266,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
return dap::DisconnectResponse();
});
- Session->registerHandler([this](const dap::EvaluateRequest& request) {
+ Session->registerHandler([this](dap::EvaluateRequest const& request) {
dap::EvaluateResponse response;
if (request.frameId.has_value()) {
std::shared_ptr<cmDebuggerStackFrame> frame =
@@ -285,7 +286,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
// The ConfigurationDone request is made by the client once all configuration
// requests have been made.
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ConfigurationDone
- Session->registerHandler([this](const dap::ConfigurationDoneRequest& req) {
+ Session->registerHandler([this](dap::ConfigurationDoneRequest const& req) {
(void)req;
ConfigurationDoneEvent->Fire();
return dap::ConfigurationDoneResponse();
@@ -396,7 +397,7 @@ void cmDebuggerAdapter::OnBeginFunctionCall(cmMakefile* mf,
dap::array<dap::integer> hitBreakpoints;
hitBreakpoints.resize(hits.size());
std::transform(hits.begin(), hits.end(), hitBreakpoints.begin(),
- [&](const int64_t& id) { return dap::integer(id); });
+ [&](int64_t const& id) { return dap::integer(id); });
stoppedEvent.reason = "breakpoint";
stoppedEvent.hitBreakpointIds = hitBreakpoints;
}
diff --git a/Source/cmDebuggerAdapter.h b/Source/cmDebuggerAdapter.h
index 3403b36..b459993 100644
--- a/Source/cmDebuggerAdapter.h
+++ b/Source/cmDebuggerAdapter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerBreakpointManager.cxx b/Source/cmDebuggerBreakpointManager.cxx
index db18c6e..dfd131c 100644
--- a/Source/cmDebuggerBreakpointManager.cxx
+++ b/Source/cmDebuggerBreakpointManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerBreakpointManager.h"
#include <algorithm>
@@ -22,7 +22,7 @@ cmDebuggerBreakpointManager::cmDebuggerBreakpointManager(
: DapSession(dapSession)
{
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetBreakpoints
- DapSession->registerHandler([&](const dap::SetBreakpointsRequest& request) {
+ DapSession->registerHandler([&](dap::SetBreakpointsRequest const& request) {
return HandleSetBreakpointsRequest(request);
});
}
@@ -76,8 +76,8 @@ cmDebuggerBreakpointManager::HandleSetBreakpointsRequest(
auto sourcePath =
cmSystemTools::GetActualCaseForPath(request.source.path.value());
- const dap::array<dap::SourceBreakpoint> defaultValue{};
- const auto& breakpoints = request.breakpoints.value(defaultValue);
+ dap::array<dap::SourceBreakpoint> const defaultValue{};
+ auto const& breakpoints = request.breakpoints.value(defaultValue);
if (Breakpoints.find(sourcePath) != Breakpoints.end()) {
Breakpoints[sourcePath].clear();
@@ -173,7 +173,7 @@ std::vector<int64_t> cmDebuggerBreakpointManager::GetBreakpoints(
std::string const& sourcePath, int64_t line)
{
std::unique_lock<std::mutex> lock(Mutex);
- const auto& all = Breakpoints[sourcePath];
+ auto const& all = Breakpoints[sourcePath];
std::vector<int64_t> breakpoints;
if (all.empty()) {
return breakpoints;
@@ -182,7 +182,7 @@ std::vector<int64_t> cmDebuggerBreakpointManager::GetBreakpoints(
auto it = all.begin();
while ((it = std::find_if(
- it, all.end(), [&](const cmDebuggerSourceBreakpoint& breakpoint) {
+ it, all.end(), [&](cmDebuggerSourceBreakpoint const& breakpoint) {
return (breakpoint.GetIsValid() && breakpoint.GetLine() == line);
})) != all.end()) {
breakpoints.emplace_back(it->GetId());
diff --git a/Source/cmDebuggerBreakpointManager.h b/Source/cmDebuggerBreakpointManager.h
index 815262a..7040011 100644
--- a/Source/cmDebuggerBreakpointManager.h
+++ b/Source/cmDebuggerBreakpointManager.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerExceptionManager.cxx b/Source/cmDebuggerExceptionManager.cxx
index 470e44c..a2744e1 100644
--- a/Source/cmDebuggerExceptionManager.cxx
+++ b/Source/cmDebuggerExceptionManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerExceptionManager.h"
#include <utility>
@@ -20,12 +20,12 @@ cmDebuggerExceptionManager::cmDebuggerExceptionManager(
{
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetExceptionBreakpoints
DapSession->registerHandler(
- [&](const dap::SetExceptionBreakpointsRequest& request) {
+ [&](dap::SetExceptionBreakpointsRequest const& request) {
return HandleSetExceptionBreakpointsRequest(request);
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ExceptionInfo
- DapSession->registerHandler([&](const dap::ExceptionInfoRequest& request) {
+ DapSession->registerHandler([&](dap::ExceptionInfoRequest const& request) {
(void)request;
return HandleExceptionInfoRequest();
});
@@ -61,7 +61,7 @@ cmDebuggerExceptionManager::HandleSetExceptionBreakpointsRequest(
std::unique_lock<std::mutex> lock(Mutex);
dap::SetExceptionBreakpointsResponse response;
RaiseExceptions.clear();
- for (const auto& filter : request.filters) {
+ for (auto const& filter : request.filters) {
RaiseExceptions[filter] = true;
}
diff --git a/Source/cmDebuggerExceptionManager.h b/Source/cmDebuggerExceptionManager.h
index 4c044d7..2524b67 100644
--- a/Source/cmDebuggerExceptionManager.h
+++ b/Source/cmDebuggerExceptionManager.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerPosixPipeConnection.cxx b/Source/cmDebuggerPosixPipeConnection.cxx
index 0587450..ac5fd04 100644
--- a/Source/cmDebuggerPosixPipeConnection.cxx
+++ b/Source/cmDebuggerPosixPipeConnection.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerPosixPipeConnection.h"
#include <cerrno>
diff --git a/Source/cmDebuggerPosixPipeConnection.h b/Source/cmDebuggerPosixPipeConnection.h
index 42642fa..98e3f6f 100644
--- a/Source/cmDebuggerPosixPipeConnection.h
+++ b/Source/cmDebuggerPosixPipeConnection.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerProtocol.cxx b/Source/cmDebuggerProtocol.cxx
index 505de35..79c6e9e 100644
--- a/Source/cmDebuggerProtocol.cxx
+++ b/Source/cmDebuggerProtocol.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerProtocol.h"
diff --git a/Source/cmDebuggerProtocol.h b/Source/cmDebuggerProtocol.h
index d4b1a96..4f457cc 100644
--- a/Source/cmDebuggerProtocol.h
+++ b/Source/cmDebuggerProtocol.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerSourceBreakpoint.cxx b/Source/cmDebuggerSourceBreakpoint.cxx
index d4665e6..875d76a 100644
--- a/Source/cmDebuggerSourceBreakpoint.cxx
+++ b/Source/cmDebuggerSourceBreakpoint.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerSourceBreakpoint.h"
namespace cmDebugger {
diff --git a/Source/cmDebuggerSourceBreakpoint.h b/Source/cmDebuggerSourceBreakpoint.h
index f6d6cac..0273eb5 100644
--- a/Source/cmDebuggerSourceBreakpoint.h
+++ b/Source/cmDebuggerSourceBreakpoint.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerStackFrame.cxx b/Source/cmDebuggerStackFrame.cxx
index 789b0a5..10a0fb5 100644
--- a/Source/cmDebuggerStackFrame.cxx
+++ b/Source/cmDebuggerStackFrame.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerStackFrame.h"
#include <utility>
@@ -25,4 +25,10 @@ int64_t cmDebuggerStackFrame::GetLine() const noexcept
return this->Function.Line();
}
+std::vector<cmListFileArgument> const& cmDebuggerStackFrame::GetArguments()
+ const noexcept
+{
+ return this->Function.Arguments();
+}
+
} // namespace cmDebugger
diff --git a/Source/cmDebuggerStackFrame.h b/Source/cmDebuggerStackFrame.h
index f4e6612..2ac4fca 100644
--- a/Source/cmDebuggerStackFrame.h
+++ b/Source/cmDebuggerStackFrame.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -7,8 +7,10 @@
#include <atomic>
#include <cstdint>
#include <string>
+#include <vector>
class cmListFileFunction;
+struct cmListFileArgument;
class cmMakefile;
namespace cmDebugger {
@@ -32,6 +34,7 @@ public:
{
return this->Function;
}
+ std::vector<cmListFileArgument> const& GetArguments() const noexcept;
};
} // namespace cmDebugger
diff --git a/Source/cmDebuggerThread.cxx b/Source/cmDebuggerThread.cxx
index f7a1778..2f682ed 100644
--- a/Source/cmDebuggerThread.cxx
+++ b/Source/cmDebuggerThread.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerThread.h"
@@ -14,6 +14,7 @@
#include "cmDebuggerVariablesHelper.h"
#include "cmDebuggerVariablesManager.h"
#include "cmListFileCache.h"
+#include "cmStringAlgorithms.h"
namespace cmDebugger {
@@ -117,8 +118,27 @@ dap::VariablesResponse cmDebuggerThread::GetVariablesResponse(
}
dap::StackTraceResponse GetStackTraceResponse(
- std::shared_ptr<cmDebuggerThread> const& thread)
+ std::shared_ptr<cmDebuggerThread> const& thread,
+ dap::optional<dap::StackFrameFormat> format)
{
+ dap::boolean showParameters = false;
+ dap::boolean showParameterValues = false;
+ dap::boolean showLine = false;
+ if (format.has_value()) {
+ auto formatValue = format.value();
+ if (formatValue.parameters.has_value()) {
+ showParameters = formatValue.parameters.value();
+ }
+
+ if (formatValue.parameterValues.has_value()) {
+ showParameterValues = formatValue.parameterValues.value();
+ }
+
+ if (formatValue.line.has_value()) {
+ showLine = formatValue.line.value();
+ }
+ }
+
dap::StackTraceResponse response;
std::unique_lock<std::mutex> lock(thread->Mutex);
for (int i = static_cast<int>(thread->Frames.size()) - 1; i >= 0; --i) {
@@ -136,10 +156,29 @@ dap::StackTraceResponse GetStackTraceResponse(
#endif
stackFrame.line = thread->Frames[i]->GetLine();
stackFrame.column = 1;
- stackFrame.name = thread->Frames[i]->GetFunction().OriginalName();
stackFrame.id = thread->Frames[i]->GetId();
stackFrame.source = source;
+ auto stackName = thread->Frames[i]->GetFunction().OriginalName();
+ if (showParameters) {
+ stackName.push_back('(');
+ if (showParameterValues && !thread->Frames[i]->GetArguments().empty()) {
+ for (auto const& arg : thread->Frames[i]->GetArguments()) {
+ stackName = cmStrCat(stackName, arg.Value, ", ");
+ }
+
+ stackName.erase(stackName.end() - 2, stackName.end());
+ }
+
+ stackName.push_back(')');
+ }
+
+ if (showLine) {
+ stackName =
+ cmStrCat(stackName, " Line: ", static_cast<int64_t>(stackFrame.line));
+ }
+
+ stackFrame.name = stackName;
response.stackFrames.push_back(stackFrame);
}
diff --git a/Source/cmDebuggerThread.h b/Source/cmDebuggerThread.h
index 65ee2cf..56201b4 100644
--- a/Source/cmDebuggerThread.h
+++ b/Source/cmDebuggerThread.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,6 +23,11 @@ class cmDebuggerVariables;
class cmDebuggerVariablesManager;
}
+namespace dap {
+template <typename T>
+class optional;
+}
+
namespace cmDebugger {
class cmDebuggerThread
@@ -41,7 +46,7 @@ class cmDebuggerThread
public:
cmDebuggerThread(int64_t id, std::string name);
int64_t GetId() const { return this->Id; }
- const std::string& GetName() const { return this->Name; }
+ std::string const& GetName() const { return this->Name; }
void PushStackFrame(cmMakefile* mf, std::string const& sourcePath,
cmListFileFunction const& lff);
void PopStackFrame();
@@ -53,7 +58,8 @@ public:
dap::VariablesResponse GetVariablesResponse(
dap::VariablesRequest const& request);
friend dap::StackTraceResponse GetStackTraceResponse(
- std::shared_ptr<cmDebuggerThread> const& thread);
+ std::shared_ptr<cmDebuggerThread> const& thread,
+ dap::optional<dap::StackFrameFormat> format);
};
} // namespace cmDebugger
diff --git a/Source/cmDebuggerThreadManager.cxx b/Source/cmDebuggerThreadManager.cxx
index 0eb443b..951a101 100644
--- a/Source/cmDebuggerThreadManager.cxx
+++ b/Source/cmDebuggerThreadManager.cxx
@@ -1,11 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerThreadManager.h"
#include <algorithm>
#include <cm3p/cppdap/protocol.h>
+#include <cm3p/cppdap/types.h>
#include "cmDebuggerThread.h"
@@ -30,18 +31,19 @@ void cmDebuggerThreadManager::EndThread(
}
cm::optional<dap::StackTraceResponse>
-cmDebuggerThreadManager::GetThreadStackTraceResponse(int64_t id)
+cmDebuggerThreadManager::GetThreadStackTraceResponse(
+ dap::StackTraceRequest const& request)
{
auto it = find_if(Threads.begin(), Threads.end(),
- [&](const std::shared_ptr<cmDebuggerThread>& t) {
- return t->GetId() == id;
+ [&](std::shared_ptr<cmDebuggerThread> const& t) {
+ return t->GetId() == request.threadId;
});
if (it == Threads.end()) {
return {};
}
- return GetStackTraceResponse(*it);
+ return GetStackTraceResponse(*it, request.format);
}
} // namespace cmDebugger
diff --git a/Source/cmDebuggerThreadManager.h b/Source/cmDebuggerThreadManager.h
index 934cf85..9ee494d 100644
--- a/Source/cmDebuggerThreadManager.h
+++ b/Source/cmDebuggerThreadManager.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,6 +17,7 @@ class cmDebuggerThread;
}
namespace dap {
+struct StackTraceRequest;
struct StackTraceResponse;
}
@@ -32,7 +33,7 @@ public:
std::shared_ptr<cmDebuggerThread> StartThread(std::string const& name);
void EndThread(std::shared_ptr<cmDebuggerThread> const& thread);
cm::optional<dap::StackTraceResponse> GetThreadStackTraceResponse(
- std::int64_t id);
+ dap::StackTraceRequest const& request);
};
} // namespace cmDebugger
diff --git a/Source/cmDebuggerVariables.cxx b/Source/cmDebuggerVariables.cxx
index 8e3c2be..0935210 100644
--- a/Source/cmDebuggerVariables.cxx
+++ b/Source/cmDebuggerVariables.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerVariables.h"
@@ -15,11 +15,11 @@
namespace cmDebugger {
namespace {
-const dap::VariablePresentationHint PrivatePropertyHint = { {},
+dap::VariablePresentationHint const PrivatePropertyHint = { {},
"property",
{},
"private" };
-const dap::VariablePresentationHint PrivateDataHint = { {},
+dap::VariablePresentationHint const PrivateDataHint = { {},
"data",
{},
"private" };
diff --git a/Source/cmDebuggerVariables.h b/Source/cmDebuggerVariables.h
index 753b811..ba5270a 100644
--- a/Source/cmDebuggerVariables.h
+++ b/Source/cmDebuggerVariables.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,7 +43,7 @@ struct cmDebuggerVariableEntry
, Type("string")
{
}
- cmDebuggerVariableEntry(std::string name, const char* value)
+ cmDebuggerVariableEntry(std::string name, char const* value)
: Name(std::move(name))
, Value(value ? value : "")
, Type("string")
@@ -88,7 +88,7 @@ class cmDebuggerVariables
friend class cmDebuggerVariablesManager;
protected:
- const bool SupportsVariableType;
+ bool const SupportsVariableType;
std::shared_ptr<cmDebuggerVariablesManager> VariablesManager;
void EnumerateSubVariablesIfAny(
dap::array<dap::Variable>& toBeReturned) const;
@@ -102,22 +102,16 @@ public:
std::shared_ptr<cmDebuggerVariablesManager> variablesManager,
std::string name, bool supportsVariableType,
std::function<std::vector<cmDebuggerVariableEntry>()> getKeyValuesFunc);
- inline int64_t GetId() const noexcept { return this->Id; }
- inline std::string GetName() const noexcept { return this->Name; }
- inline std::string GetValue() const noexcept { return this->Value; }
- inline void SetValue(std::string const& value) noexcept
- {
- this->Value = value;
- }
+ int64_t GetId() const noexcept { return this->Id; }
+ std::string GetName() const noexcept { return this->Name; }
+ std::string GetValue() const noexcept { return this->Value; }
+ void SetValue(std::string const& value) noexcept { this->Value = value; }
void AddSubVariables(std::shared_ptr<cmDebuggerVariables> const& variables);
- inline void SetIgnoreEmptyStringEntries(bool value) noexcept
+ void SetIgnoreEmptyStringEntries(bool value) noexcept
{
this->IgnoreEmptyStringEntries = value;
}
- inline void SetEnableSorting(bool value) noexcept
- {
- this->EnableSorting = value;
- }
+ void SetEnableSorting(bool value) noexcept { this->EnableSorting = value; }
virtual ~cmDebuggerVariables();
};
diff --git a/Source/cmDebuggerVariablesHelper.cxx b/Source/cmDebuggerVariablesHelper.cxx
index 6880eab..b8bc328 100644
--- a/Source/cmDebuggerVariablesHelper.cxx
+++ b/Source/cmDebuggerVariablesHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerVariablesHelper.h"
@@ -23,6 +23,7 @@
#include "cmPropertyMap.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmTest.h"
#include "cmValue.h"
@@ -39,8 +40,6 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::Create(
{ cmPolicies::PolicyStatus::OLD, "OLD" },
{ cmPolicies::PolicyStatus::WARN, "WARN" },
{ cmPolicies::PolicyStatus::NEW, "NEW" },
- { cmPolicies::PolicyStatus::REQUIRED_IF_USED, "REQUIRED_IF_USED" },
- { cmPolicies::PolicyStatus::REQUIRED_ALWAYS, "REQUIRED_ALWAYS" }
};
return std::make_shared<cmDebuggerVariables>(
@@ -102,7 +101,7 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny(
ret.reserve(items.size());
int i = 0;
for (std::string const& item : items) {
- ret.emplace_back("[" + std::to_string(i++) + "]", item);
+ ret.emplace_back(cmStrCat('[', i++, ']'), item);
}
return ret;
});
@@ -624,7 +623,7 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny(
return ret;
});
- if (const auto* ic = gen->GetInstallComponents()) {
+ if (auto const* ic = gen->GetInstallComponents()) {
variables->AddSubVariables(CreateIfAny(
variablesManager, "InstallComponents", supportsVariableType, *ic));
}
diff --git a/Source/cmDebuggerVariablesHelper.h b/Source/cmDebuggerVariablesHelper.h
index 9b11eaf..e39a857 100644
--- a/Source/cmDebuggerVariablesHelper.h
+++ b/Source/cmDebuggerVariablesHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerVariablesManager.cxx b/Source/cmDebuggerVariablesManager.cxx
index 9b9b476..8a51805 100644
--- a/Source/cmDebuggerVariablesManager.cxx
+++ b/Source/cmDebuggerVariablesManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerVariablesManager.h"
diff --git a/Source/cmDebuggerVariablesManager.h b/Source/cmDebuggerVariablesManager.h
index 9a64f10..4c0a821 100644
--- a/Source/cmDebuggerVariablesManager.h
+++ b/Source/cmDebuggerVariablesManager.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDebuggerWindowsPipeConnection.cxx b/Source/cmDebuggerWindowsPipeConnection.cxx
index 5f6f848..1e8c35b 100644
--- a/Source/cmDebuggerWindowsPipeConnection.cxx
+++ b/Source/cmDebuggerWindowsPipeConnection.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDebuggerWindowsPipeConnection.h"
#include <algorithm>
diff --git a/Source/cmDebuggerWindowsPipeConnection.h b/Source/cmDebuggerWindowsPipeConnection.h
index 6a57435..5611255 100644
--- a/Source/cmDebuggerWindowsPipeConnection.h
+++ b/Source/cmDebuggerWindowsPipeConnection.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 31ee665..220a483 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDefinePropertyCommand.h"
#include <algorithm>
@@ -100,12 +100,12 @@ bool cmDefinePropertyCommand(std::vector<std::string> const& args,
}
// Make sure the variable is not reserved.
- static constexpr const char* reservedPrefixes[] = {
+ static constexpr char const* reservedPrefixes[] = {
"CMAKE_",
"_CMAKE_",
};
if (std::any_of(std::begin(reservedPrefixes), std::end(reservedPrefixes),
- [&initializeFromVariable](const char* prefix) {
+ [&initializeFromVariable](char const* prefix) {
return cmHasPrefix(initializeFromVariable, prefix);
})) {
status.SetError(cmStrCat("variable name \"", initializeFromVariable,
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 3c478b3..21f70c8 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 453c0d1..c7cc47a 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDefinitions.h"
#include <cassert>
@@ -10,7 +10,7 @@
cmDefinitions::Def cmDefinitions::NoDef;
-cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
+cmDefinitions::Def const& cmDefinitions::GetInternal(std::string const& key,
StackIter begin,
StackIter end, bool raise)
{
@@ -33,20 +33,20 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
return begin->Map.emplace(key, def).first->second;
}
-cmValue cmDefinitions::Get(const std::string& key, StackIter begin,
+cmValue cmDefinitions::Get(std::string const& key, StackIter begin,
StackIter end)
{
Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
return def.Value ? cmValue(def.Value.str_if_stable()) : nullptr;
}
-void cmDefinitions::Raise(const std::string& key, StackIter begin,
+void cmDefinitions::Raise(std::string const& key, StackIter begin,
StackIter end)
{
cmDefinitions::GetInternal(key, begin, end, true);
}
-bool cmDefinitions::HasKey(const std::string& key, StackIter begin,
+bool cmDefinitions::HasKey(std::string const& key, StackIter begin,
StackIter end)
{
for (StackIter it = begin; it != end; ++it) {
@@ -97,12 +97,12 @@ std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
return defined;
}
-void cmDefinitions::Set(const std::string& key, cm::string_view value)
+void cmDefinitions::Set(std::string const& key, cm::string_view value)
{
this->Map[key] = Def(value);
}
-void cmDefinitions::Unset(const std::string& key)
+void cmDefinitions::Unset(std::string const& key)
{
this->Map[key] = Def();
}
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 11d8947..b423cac 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,11 +28,11 @@ class cmDefinitions
public:
// -- Static member functions
- static cmValue Get(const std::string& key, StackIter begin, StackIter end);
+ static cmValue Get(std::string const& key, StackIter begin, StackIter end);
- static void Raise(const std::string& key, StackIter begin, StackIter end);
+ static void Raise(std::string const& key, StackIter begin, StackIter end);
- static bool HasKey(const std::string& key, StackIter begin, StackIter end);
+ static bool HasKey(std::string const& key, StackIter begin, StackIter end);
static std::vector<std::string> ClosureKeys(StackIter begin, StackIter end);
@@ -41,10 +41,10 @@ public:
// -- Member functions
/** Set a value associated with a key. */
- void Set(const std::string& key, cm::string_view value);
+ void Set(std::string const& key, cm::string_view value);
/** Unset a definition. */
- void Unset(const std::string& key);
+ void Unset(std::string const& key);
private:
/** String with existence boolean. */
@@ -62,6 +62,6 @@ private:
std::unordered_map<cm::String, Def> Map;
- static Def const& GetInternal(const std::string& key, StackIter begin,
+ static Def const& GetInternal(std::string const& key, StackIter begin,
StackIter end, bool raise);
};
diff --git a/Source/cmDependencyProvider.h b/Source/cmDependencyProvider.h
index a6670b4..173f3e9 100644
--- a/Source/cmDependencyProvider.h
+++ b/Source/cmDependencyProvider.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-file Copyright.txt or https://cmake.org/licensing for details. */
+file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 34f67d0..4d23399 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDepends.h"
#include <utility>
@@ -61,8 +61,8 @@ bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/)
return true;
}
-bool cmDepends::Check(const std::string& makeFile,
- const std::string& internalFile,
+bool cmDepends::Check(std::string const& makeFile,
+ std::string const& internalFile,
DependencyMap& validDeps)
{
// Check whether dependencies must be regenerated.
@@ -78,7 +78,7 @@ bool cmDepends::Check(const std::string& makeFile,
return okay;
}
-void cmDepends::Clear(const std::string& file) const
+void cmDepends::Clear(std::string const& file) const
{
// Print verbose output.
if (this->Verbose) {
@@ -92,8 +92,8 @@ void cmDepends::Clear(const std::string& file) const
"# This may be replaced when dependencies are built.\n";
}
-bool cmDepends::WriteDependencies(const std::set<std::string>& /*unused*/,
- const std::string& /*unused*/,
+bool cmDepends::WriteDependencies(std::set<std::string> const& /*unused*/,
+ std::string const& /*unused*/,
std::ostream& /*unused*/,
std::ostream& /*unused*/)
{
@@ -102,7 +102,7 @@ bool cmDepends::WriteDependencies(const std::set<std::string>& /*unused*/,
}
bool cmDepends::CheckDependencies(std::istream& internalDepends,
- const std::string& internalDependsFileName,
+ std::string const& internalDependsFileName,
DependencyMap& validDeps)
{
// Read internal depends file time
@@ -227,7 +227,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
return okay;
}
-void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
+void cmDepends::SetIncludePathFromLanguage(std::string const& lang)
{
// Look for the new per "TARGET_" variant first:
std::string includePathVar =
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index 76af4db..6ae3179 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,10 +43,10 @@ public:
}
/** Set the specific language to be scanned. */
- void SetLanguage(const std::string& lang) { this->Language = lang; }
+ void SetLanguage(std::string const& lang) { this->Language = lang; }
/** Set the target build directory. */
- void SetTargetDirectory(const std::string& dir)
+ void SetTargetDirectory(std::string const& dir)
{
this->TargetDirectory = dir;
}
@@ -65,11 +65,11 @@ public:
they must be generated Clear has already been called to wipe out
the old dependencies.
Dependencies which are still valid will be stored in validDeps. */
- bool Check(const std::string& makeFile, const std::string& internalFile,
+ bool Check(std::string const& makeFile, std::string const& internalFile,
DependencyMap& validDeps);
/** Clear dependencies for the target file so they will be regenerated. */
- void Clear(const std::string& file) const;
+ void Clear(std::string const& file) const;
/** Set the file comparison object */
void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; }
@@ -77,8 +77,8 @@ public:
protected:
// Write dependencies for the target file to the given stream.
// Return true for success and false for failure.
- virtual bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& obj,
+ virtual bool WriteDependencies(std::set<std::string> const& sources,
+ std::string const& obj,
std::ostream& makeDepends,
std::ostream& internalDepends);
@@ -86,7 +86,7 @@ protected:
// Return false if dependencies must be regenerated and true
// otherwise.
virtual bool CheckDependencies(std::istream& internalDepends,
- const std::string& internalDependsFileName,
+ std::string const& internalDependsFileName,
DependencyMap& validDeps);
// Finalize the dependency information for the target.
@@ -108,5 +108,5 @@ protected:
// The include file search path.
std::vector<std::string> IncludePath;
- void SetIncludePathFromLanguage(const std::string& lang);
+ void SetIncludePathFromLanguage(std::string const& lang);
};
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index a39bb37..f63b7ca 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDependsC.h"
#include <utility>
@@ -26,8 +26,8 @@
cmDependsC::cmDependsC() = default;
cmDependsC::cmDependsC(cmLocalUnixMakefileGenerator3* lg,
- const std::string& targetDir, const std::string& lang,
- const DependencyMap* validDeps)
+ std::string const& targetDir, std::string const& lang,
+ DependencyMap const* validDeps)
: cmDepends(lg, targetDir)
, ValidDeps(validDeps)
{
@@ -73,8 +73,8 @@ cmDependsC::~cmDependsC()
this->WriteCacheFile();
}
-bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
- const std::string& obj,
+bool cmDependsC::WriteDependencies(std::set<std::string> const& sources,
+ std::string const& obj,
std::ostream& makeDepends,
std::ostream& internalDepends)
{
@@ -215,7 +215,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
std::string obj_m = this->LocalGenerator->ConvertToMakefilePath(obj_i);
internalDepends << obj_i << '\n';
if (!dependencies.empty()) {
- const auto& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
+ auto const& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
this->LocalGenerator->GetGlobalGenerator())
->LineContinueDirective;
bool supportLongLineDepend = static_cast<cmGlobalUnixMakefileGenerator3*>(
@@ -340,8 +340,8 @@ void cmDependsC::WriteCacheFile() const
}
}
-void cmDependsC::Scan(std::istream& is, const std::string& directory,
- const std::string& fullName)
+void cmDependsC::Scan(std::istream& is, std::string const& directory,
+ std::string const& fullName)
{
cmIncludeLines& newCacheEntry = this->FileCache[fullName];
newCacheEntry.Used = true;
@@ -406,7 +406,7 @@ void cmDependsC::SetupTransforms()
// Construct the regular expression to match lines to be
// transformed.
std::string xform = "^([ \t]*[#%][ \t]*(include|import)[ \t]*)(";
- const char* sep = "";
+ char const* sep = "";
for (auto const& tr : this->TransformRules) {
xform += sep;
xform += tr.first;
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index c79da1a..f47b233 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,8 +26,8 @@ public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
cmDependsC();
- cmDependsC(cmLocalUnixMakefileGenerator3* lg, const std::string& targetDir,
- const std::string& lang, const DependencyMap* validDeps);
+ cmDependsC(cmLocalUnixMakefileGenerator3* lg, std::string const& targetDir,
+ std::string const& lang, DependencyMap const* validDeps);
/** Virtual destructor to cleanup subclasses properly. */
~cmDependsC() override;
@@ -37,13 +37,13 @@ public:
protected:
// Implement writing/checking methods required by superclass.
- bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& obj, std::ostream& makeDepends,
+ bool WriteDependencies(std::set<std::string> const& sources,
+ std::string const& obj, std::ostream& makeDepends,
std::ostream& internalDepends) override;
// Method to scan a single file.
- void Scan(std::istream& is, const std::string& directory,
- const std::string& fullName);
+ void Scan(std::istream& is, std::string const& directory,
+ std::string const& fullName);
// Regular expression to identify C preprocessor include directives.
cmsys::RegularExpression IncludeRegexLine;
@@ -80,7 +80,7 @@ public:
};
protected:
- const DependencyMap* ValidDeps = nullptr;
+ DependencyMap const* ValidDeps = nullptr;
std::set<std::string> Encountered;
std::queue<UnscannedEntry> Unscanned;
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx
index 17ec43b..c3f6dce 100644
--- a/Source/cmDependsCompiler.cxx
+++ b/Source/cmDependsCompiler.cxx
@@ -1,10 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDependsCompiler.h"
#include <algorithm>
-#include <iterator>
#include <map>
#include <string>
#include <unordered_set>
@@ -26,9 +25,9 @@
#include "cmSystemTools.h"
bool cmDependsCompiler::CheckDependencies(
- const std::string& internalDepFile, const std::vector<std::string>& depFiles,
+ std::string const& internalDepFile, std::vector<std::string> const& depFiles,
cmDepends::DependencyMap& dependencies,
- const std::function<bool(const std::string&)>& isValidPath)
+ std::function<bool(std::string const&)> const& isValidPath)
{
bool status = true;
bool forceReadDeps = true;
@@ -75,10 +74,10 @@ bool cmDependsCompiler::CheckDependencies(
// dependencies files
cmFileTime depFileTime;
for (auto dep = depFiles.begin(); dep != depFiles.end(); dep++) {
- const auto& source = *dep++;
- const auto& target = *dep++;
- const auto& format = *dep++;
- const auto& depFile = *dep;
+ auto const& source = *dep++;
+ auto const& target = *dep++;
+ auto const& format = *dep++;
+ auto const& depFile = *dep;
if (!cmSystemTools::FileExists(depFile)) {
continue;
@@ -111,13 +110,9 @@ bool cmDependsCompiler::CheckDependencies(
// copy depends for each target, except first one, which can be
// moved
for (auto index = entry.rules.size() - 1; index > 0; --index) {
- auto& rule_deps = dependencies[entry.rules[index]];
- rule_deps.insert(rule_deps.end(), depends.cbegin(),
- depends.cend());
+ dependencies[entry.rules[index]] = depends;
}
- auto& rule_deps = dependencies[entry.rules.front()];
- std::move(depends.cbegin(), depends.cend(),
- std::back_inserter(rule_deps));
+ dependencies[entry.rules.front()] = std::move(depends);
}
} else {
if (format == "msvc"_s) {
@@ -190,11 +185,11 @@ bool cmDependsCompiler::CheckDependencies(
}
void cmDependsCompiler::WriteDependencies(
- const cmDepends::DependencyMap& dependencies, std::ostream& makeDepends,
+ cmDepends::DependencyMap const& dependencies, std::ostream& makeDepends,
std::ostream& internalDepends)
{
// dependencies file consumed by make tool
- const auto& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
+ auto const& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
this->LocalGenerator->GetGlobalGenerator())
->LineContinueDirective;
bool supportLongLineDepend = static_cast<cmGlobalUnixMakefileGenerator3*>(
@@ -209,7 +204,7 @@ void cmDependsCompiler::WriteDependencies(
this->LocalGenerator->MaybeRelativeToTopBinDir(node.first));
auto& deps = node.second;
std::transform(deps.cbegin(), deps.cend(), deps.begin(),
- [this](const std::string& dep) {
+ [this](std::string const& dep) {
return this->LocalGenerator->ConvertToMakefilePath(
this->LocalGenerator->MaybeRelativeToTopBinDir(dep));
});
@@ -218,7 +213,7 @@ void cmDependsCompiler::WriteDependencies(
if (supportLongLineDepend) {
makeDepends << target << ": ";
}
- for (const auto& dep : deps) {
+ for (auto const& dep : deps) {
if (supportLongLineDepend) {
if (first_dep) {
first_dep = false;
@@ -236,14 +231,14 @@ void cmDependsCompiler::WriteDependencies(
}
// add phony targets
- for (const auto& target : phonyTargets) {
+ for (auto const& target : phonyTargets) {
makeDepends << std::endl << target << ':' << std::endl;
}
// internal dependencies file
- for (const auto& node : dependencies) {
+ for (auto const& node : dependencies) {
internalDepends << node.first << std::endl;
- for (const auto& dep : node.second) {
+ for (auto const& dep : node.second) {
internalDepends << ' ' << dep << std::endl;
}
internalDepends << std::endl;
@@ -251,7 +246,7 @@ void cmDependsCompiler::WriteDependencies(
}
void cmDependsCompiler::ClearDependencies(
- const std::vector<std::string>& depFiles)
+ std::vector<std::string> const& depFiles)
{
for (auto dep = depFiles.begin(); dep != depFiles.end(); dep++) {
dep += 3;
diff --git a/Source/cmDependsCompiler.h b/Source/cmDependsCompiler.h
index 838156d..73675df 100644
--- a/Source/cmDependsCompiler.h
+++ b/Source/cmDependsCompiler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,18 +41,18 @@ public:
dependencies didn't changed and false if not.
Up-to-date Dependencies will be stored in deps. */
bool CheckDependencies(
- const std::string& internalDepFile,
- const std::vector<std::string>& depFiles,
+ std::string const& internalDepFile,
+ std::vector<std::string> const& depFiles,
cmDepends::DependencyMap& dependencies,
- const std::function<bool(const std::string&)>& isValidPath);
+ std::function<bool(std::string const&)> const& isValidPath);
/** Write dependencies for the target file. */
- void WriteDependencies(const cmDepends::DependencyMap& dependencies,
+ void WriteDependencies(cmDepends::DependencyMap const& dependencies,
std::ostream& makeDepends,
std::ostream& internalDepends);
/** Clear dependencies for the target so they will be regenerated. */
- void ClearDependencies(const std::vector<std::string>& depFiles);
+ void ClearDependencies(std::vector<std::string> const& depFiles);
private:
bool Verbose = false;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index b23dabd..be63469 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDependsFortran.h"
#include <cassert>
@@ -56,8 +56,8 @@ public:
using ObjectInfoMap = std::map<std::string, cmFortranSourceInfo>;
ObjectInfoMap ObjectInfo;
- cmFortranSourceInfo& CreateObjectInfo(const std::string& obj,
- const std::string& src)
+ cmFortranSourceInfo& CreateObjectInfo(std::string const& obj,
+ std::string const& src)
{
auto i = this->ObjectInfo.find(obj);
if (i == this->ObjectInfo.end()) {
@@ -100,8 +100,8 @@ cmDependsFortran::cmDependsFortran(cmLocalUnixMakefileGenerator3* lg)
cmDependsFortran::~cmDependsFortran() = default;
-bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources,
- const std::string& obj,
+bool cmDependsFortran::WriteDependencies(std::set<std::string> const& sources,
+ std::string const& obj,
std::ostream& /*makeDepends*/,
std::ostream& /*internalDepends*/)
{
@@ -156,7 +156,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
}
// Get the directory in which stamp files will be stored.
- const std::string& stamp_dir = this->TargetDirectory;
+ std::string const& stamp_dir = this->TargetDirectory;
// Get the directory in which module files will be created.
cmMakefile* mf = this->LocalGenerator->GetMakefile();
@@ -166,7 +166,11 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
}
+ // ATTENTION Before 4.0 the property name was misspelled.
+ // Check the correct name first and than the old name.
bool building_intrinsics =
+ !mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INTRINSIC_MODULES")
+ .empty() ||
!mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INSTRINSIC_MODULES")
.empty();
@@ -277,7 +281,7 @@ void cmDependsFortran::MatchLocalModules()
}
void cmDependsFortran::MatchRemoteModules(std::istream& fin,
- const std::string& stampDir)
+ std::string const& stampDir)
{
std::string line;
bool doing_provides = false;
@@ -307,8 +311,8 @@ void cmDependsFortran::MatchRemoteModules(std::istream& fin,
}
}
-void cmDependsFortran::ConsiderModule(const std::string& name,
- const std::string& stampDir)
+void cmDependsFortran::ConsiderModule(std::string const& name,
+ std::string const& stampDir)
{
// Locate each required module.
auto required = this->Internal->TargetRequires.find(name);
@@ -336,7 +340,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i);
internalDepends << obj_i << "\n " << src << '\n';
if (!info.Includes.empty()) {
- const auto& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
+ auto const& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
this->LocalGenerator->GetGlobalGenerator())
->LineContinueDirective;
bool supportLongLineDepend = static_cast<cmGlobalUnixMakefileGenerator3*>(
@@ -478,7 +482,7 @@ bool cmDependsFortran::FindModule(std::string const& name, std::string& module)
return false;
}
-bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
+bool cmDependsFortran::CopyModule(std::vector<std::string> const& args)
{
// Implements
//
@@ -539,7 +543,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
// Helper function to look for a short sequence in a stream. If this
// is later used for longer sequences it should be re-written using an
// efficient string search algorithm such as Boyer-Moore.
-static bool cmFortranStreamContainsSequence(std::istream& ifs, const char* seq,
+static bool cmFortranStreamContainsSequence(std::istream& ifs, char const* seq,
int len)
{
assert(len > 0);
@@ -588,9 +592,9 @@ static bool cmFortranStreamsDiffer(std::istream& ifs1, std::istream& ifs2)
return true;
}
-bool cmDependsFortran::ModulesDiffer(const std::string& modFile,
- const std::string& stampFile,
- const std::string& compilerId)
+bool cmDependsFortran::ModulesDiffer(std::string const& modFile,
+ std::string const& stampFile,
+ std::string const& compilerId)
{
/*
gnu >= 4.9:
@@ -657,8 +661,8 @@ bool cmDependsFortran::ModulesDiffer(const std::string& modFile,
bool okay = !finModFile.read(reinterpret_cast<char*>(hdr), 2).fail();
finModFile.seekg(0);
if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) {
- const char seq[1] = { '\n' };
- const int seqlen = 1;
+ char const seq[1] = { '\n' };
+ int const seqlen = 1;
if (!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) {
// The module is of unexpected format. Assume it is different.
@@ -673,8 +677,8 @@ bool cmDependsFortran::ModulesDiffer(const std::string& modFile,
}
}
} else if (compilerId == "Intel" || compilerId == "IntelLLVM") {
- const char seq[2] = { '\n', '\0' };
- const int seqlen = 2;
+ char const seq[2] = { '\n', '\0' };
+ int const seqlen = 2;
// Skip the leading byte which appears to be a version number.
// We do not need to check for an error because the sequence search
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index 763f7bb..20b0adc 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,13 +41,13 @@ public:
/** Callback from build system after a .mod file has been generated
by a Fortran90 compiler to copy the .mod file to the
corresponding stamp file. */
- static bool CopyModule(const std::vector<std::string>& args);
+ static bool CopyModule(std::vector<std::string> const& args);
/** Determine if a mod file and the corresponding mod.stamp file
are representing different module information. */
- static bool ModulesDiffer(const std::string& modFile,
- const std::string& stampFile,
- const std::string& compilerId);
+ static bool ModulesDiffer(std::string const& modFile,
+ std::string const& stampFile,
+ std::string const& compilerId);
protected:
// Finalize the dependency information for the target.
@@ -57,13 +57,13 @@ protected:
// Find all the modules required by the target.
bool LocateModules();
void MatchLocalModules();
- void MatchRemoteModules(std::istream& fin, const std::string& stampDir);
- void ConsiderModule(const std::string& name, const std::string& stampDir);
+ void MatchRemoteModules(std::istream& fin, std::string const& stampDir);
+ void ConsiderModule(std::string const& name, std::string const& stampDir);
bool FindModule(std::string const& name, std::string& module);
// Implement writing/checking methods required by superclass.
- bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& file, std::ostream& makeDepends,
+ bool WriteDependencies(std::set<std::string> const& sources,
+ std::string const& file, std::ostream& makeDepends,
std::ostream& internalDepends) override;
// Actually write the dependencies to the streams.
diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx
index b17b2ba..e85fcf5 100644
--- a/Source/cmDependsJava.cxx
+++ b/Source/cmDependsJava.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDependsJava.h"
#include "cmSystemTools.h"
@@ -8,8 +8,8 @@ cmDependsJava::cmDependsJava() = default;
cmDependsJava::~cmDependsJava() = default;
-bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources,
- const std::string& /*obj*/,
+bool cmDependsJava::WriteDependencies(std::set<std::string> const& sources,
+ std::string const& /*obj*/,
std::ostream& /*makeDepends*/,
std::ostream& /*internalDepends*/)
{
@@ -24,7 +24,7 @@ bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources,
bool cmDependsJava::CheckDependencies(
std::istream& /*internalDepends*/,
- const std::string& /*internalDependsFileName*/, DependencyMap& /*validDeps*/)
+ std::string const& /*internalDependsFileName*/, DependencyMap& /*validDeps*/)
{
return true;
}
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 1db7ce1..9b9710b 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,10 +28,10 @@ public:
protected:
// Implement writing/checking methods required by superclass.
- bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& file, std::ostream& makeDepends,
+ bool WriteDependencies(std::set<std::string> const& sources,
+ std::string const& file, std::ostream& makeDepends,
std::ostream& internalDepends) override;
bool CheckDependencies(std::istream& internalDepends,
- const std::string& internalDependsFileName,
+ std::string const& internalDependsFileName,
DependencyMap& validDeps) override;
};
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index e2718e4..a24bcd0 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDependsJavaParserHelper.h"
#include <cstdio>
@@ -36,7 +36,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
}
void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
- std::vector<std::string>* files, const char* prefix, const char* sep) const
+ std::vector<std::string>* files, char const* prefix, char const* sep) const
{
std::string rname;
if (prefix) {
@@ -62,7 +62,7 @@ void cmDependsJavaParserHelper::DeallocateParserType(char** pt)
this->UnionsAvailable--;
}
-void cmDependsJavaParserHelper::AddClassFound(const char* sclass)
+void cmDependsJavaParserHelper::AddClassFound(char const* sclass)
{
if (!sclass) {
return;
@@ -75,7 +75,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass)
this->ClassesFound.emplace_back(sclass);
}
-void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass)
+void cmDependsJavaParserHelper::AddPackagesImport(char const* sclass)
{
for (std::string const& pi : this->PackagesImport) {
if (pi == sclass) {
@@ -85,7 +85,7 @@ void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass)
this->PackagesImport.emplace_back(sclass);
}
-void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line,
+void cmDependsJavaParserHelper::SafePrintMissing(char const* str, int line,
int cnt)
{
if (str) {
@@ -103,15 +103,15 @@ void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line,
std::cout << "- " << strlen(str) << std::endl;
}
}
-void cmDependsJavaParserHelper::Print(const char* place, const char* str) const
+void cmDependsJavaParserHelper::Print(char const* place, char const* str) const
{
if (this->Verbose) {
std::cout << "[" << place << "=" << str << "]" << std::endl;
}
}
-void cmDependsJavaParserHelper::CombineUnions(char** out, const char* in1,
- char** in2, const char* sep)
+void cmDependsJavaParserHelper::CombineUnions(char** out, char const* in1,
+ char** in2, char const* sep)
{
size_t len = 1;
if (in1) {
@@ -160,7 +160,7 @@ void cmDependsJavaParserHelper::PrepareElement(
}
void cmDependsJavaParserHelper::AllocateParserType(
- cmDependsJavaParserHelper::ParserType* pt, const char* str, int len)
+ cmDependsJavaParserHelper::ParserType* pt, char const* str, int len)
{
pt->str = nullptr;
if (len == 0) {
@@ -177,7 +177,7 @@ void cmDependsJavaParserHelper::AllocateParserType(
this->Allocates.push_back(std::move(up));
}
-void cmDependsJavaParserHelper::StartClass(const char* cls)
+void cmDependsJavaParserHelper::StartClass(char const* cls)
{
CurrentClass cl;
cl.Name = cls;
@@ -224,7 +224,7 @@ std::vector<std::string> cmDependsJavaParserHelper::GetFilesProduced()
return files;
}
-int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
+int cmDependsJavaParserHelper::ParseString(char const* str, int verb)
{
if (!str) {
return 0;
@@ -295,7 +295,7 @@ int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen)
buf[0] = '\n';
return 0;
}
-void cmDependsJavaParserHelper::Error(const char* str)
+void cmDependsJavaParserHelper::Error(char const* str)
{
unsigned long pos = static_cast<unsigned long>(this->InputBufferPos);
fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", str, pos,
@@ -306,8 +306,8 @@ void cmDependsJavaParserHelper::Error(const char* str)
<< "]" << std::endl;
}
-void cmDependsJavaParserHelper::UpdateCombine(const char* str1,
- const char* str2)
+void cmDependsJavaParserHelper::UpdateCombine(char const* str1,
+ char const* str2)
{
if (this->CurrentCombine.empty() && str1) {
this->CurrentCombine = str1;
@@ -316,7 +316,7 @@ void cmDependsJavaParserHelper::UpdateCombine(const char* str1,
this->CurrentCombine += str2;
}
-int cmDependsJavaParserHelper::ParseFile(const char* file)
+int cmDependsJavaParserHelper::ParseFile(char const* file)
{
if (!cmSystemTools::FileExists(file)) {
return 0;
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index 4057bb7..f5afa08 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,33 +24,33 @@ public:
cmDependsJavaParserHelper();
~cmDependsJavaParserHelper();
- cmDependsJavaParserHelper(const cmDependsJavaParserHelper&) = delete;
- cmDependsJavaParserHelper& operator=(const cmDependsJavaParserHelper&) =
+ cmDependsJavaParserHelper(cmDependsJavaParserHelper const&) = delete;
+ cmDependsJavaParserHelper& operator=(cmDependsJavaParserHelper const&) =
delete;
- int ParseString(const char* str, int verb);
- int ParseFile(const char* file);
+ int ParseString(char const* str, int verb);
+ int ParseFile(char const* file);
// For the lexer:
void AllocateParserType(cmDependsJavaParserHelper::ParserType* pt,
- const char* str, int len = 0);
+ char const* str, int len = 0);
int LexInput(char* buf, int maxlen);
- void Error(const char* str);
+ void Error(char const* str);
// For yacc
- void AddClassFound(const char* sclass);
+ void AddClassFound(char const* sclass);
void PrepareElement(ParserType* me);
void DeallocateParserType(char** pt);
void CheckEmpty(int line, int cnt, ParserType* pt);
- void StartClass(const char* cls);
+ void StartClass(char const* cls);
void EndClass();
- void AddPackagesImport(const char* sclass);
- void SetCurrentPackage(const char* pkg) { this->CurrentPackage = pkg; }
- const char* GetCurrentPackage() { return this->CurrentPackage.c_str(); }
- void SetCurrentCombine(const char* cmb) { this->CurrentCombine = cmb; }
- const char* GetCurrentCombine() { return this->CurrentCombine.c_str(); }
- void UpdateCombine(const char* str1, const char* str2);
+ void AddPackagesImport(char const* sclass);
+ void SetCurrentPackage(char const* pkg) { this->CurrentPackage = pkg; }
+ char const* GetCurrentPackage() { return this->CurrentPackage.c_str(); }
+ void SetCurrentCombine(char const* cmb) { this->CurrentCombine = cmb; }
+ char const* GetCurrentCombine() { return this->CurrentCombine.c_str(); }
+ void UpdateCombine(char const* str1, char const* str2);
std::vector<std::string>& GetClassesFound() { return this->ClassesFound; }
@@ -63,7 +63,7 @@ private:
std::string Name;
std::vector<CurrentClass> NestedClasses;
void AddFileNamesForPrinting(std::vector<std::string>* files,
- const char* prefix, const char* sep) const;
+ char const* prefix, char const* sep) const;
};
std::string CurrentPackage;
std::string::size_type InputBufferPos;
@@ -85,9 +85,9 @@ private:
void PrintClasses();
- void Print(const char* place, const char* str) const;
- void CombineUnions(char** out, const char* in1, char** in2, const char* sep);
- void SafePrintMissing(const char* str, int line, int cnt);
+ void Print(char const* place, char const* str) const;
+ void CombineUnions(char** out, char const* in1, char** in2, char const* sep);
+ void SafePrintMissing(char const* str, int line, int cnt);
void CleanupParser();
};
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index db2a606..2cd57b6 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDocumentation.h"
#include <algorithm>
@@ -19,7 +19,7 @@
#include "cmVersion.h"
namespace {
-const cmDocumentationEntry cmDocumentationStandardOptions[21] = {
+cmDocumentationEntry const cmDocumentationStandardOptions[21] = {
{ "-h,-H,--help,-help,-usage,/?", "Print usage information and exit." },
{ "--version,-version,/V [<file>]", "Print version number and exit." },
{ "--help <keyword> [<file>]", "Print help for one keyword and exit." },
@@ -49,18 +49,18 @@ const cmDocumentationEntry cmDocumentationStandardOptions[21] = {
{ "--help-variables [<file>]", "Print cmake-variables manual and exit." }
};
-const cmDocumentationEntry cmDocumentationCPackGeneratorsHeader = {
+cmDocumentationEntry const cmDocumentationCPackGeneratorsHeader = {
{},
"The following generators are available on this platform:"
};
-const cmDocumentationEntry cmDocumentationCMakeGeneratorsHeader = {
+cmDocumentationEntry const cmDocumentationCMakeGeneratorsHeader = {
{},
"The following generators are available on this platform (* marks "
"default):"
};
-bool isOption(const char* arg)
+bool isOption(char const* arg)
{
return ((arg[0] == '-') || (strcmp(arg, "/V") == 0) ||
(strcmp(arg, "/?") == 0));
@@ -183,7 +183,7 @@ void cmDocumentation::WarnFormFromFilename(
std::string cmDocumentation::GeneralizeKeyword(std::string cname)
{
- std::map<std::string, const std::vector<std::string>> conversions;
+ std::map<std::string, std::vector<std::string> const> conversions;
std::vector<std::string> languages = {
"C", "CXX", "CSharp", "CUDA", "OBJC",
"OBJCXX", "Fortran", "HIP", "ISPC", "Swift",
@@ -233,8 +233,8 @@ void cmDocumentation::addCPackStandardDocSections()
this->AllSections.emplace("Generators", std::move(sec));
}
-bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
- const char* exitOpt)
+bool cmDocumentation::CheckOptions(int argc, char const* const* argv,
+ char const* exitOpt)
{
// Providing zero arguments gives usage information.
if (argc == 1) {
@@ -244,7 +244,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
return true;
}
- auto get_opt_argument = [=](const int nextIdx, std::string& target) -> bool {
+ auto get_opt_argument = [=](int const nextIdx, std::string& target) -> bool {
if ((nextIdx < argc) && !isOption(argv[nextIdx])) {
target = argv[nextIdx];
return true;
@@ -389,24 +389,24 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
return result;
}
-void cmDocumentation::SetName(const std::string& name)
+void cmDocumentation::SetName(std::string const& name)
{
this->NameString = name;
}
-void cmDocumentation::SetSection(const char* name,
+void cmDocumentation::SetSection(char const* name,
cmDocumentationSection section)
{
this->SectionAtName(name) = std::move(section);
}
-cmDocumentationSection& cmDocumentation::SectionAtName(const char* name)
+cmDocumentationSection& cmDocumentation::SectionAtName(char const* name)
{
return this->AllSections.emplace(name, cmDocumentationSection{ name })
.first->second;
}
-void cmDocumentation::AppendSection(const char* name,
+void cmDocumentation::AppendSection(char const* name,
cmDocumentationEntry& docs)
{
@@ -415,7 +415,7 @@ void cmDocumentation::AppendSection(const char* name,
this->AppendSection(name, docsVec);
}
-void cmDocumentation::PrependSection(const char* name,
+void cmDocumentation::PrependSection(char const* name,
cmDocumentationEntry& docs)
{
@@ -619,7 +619,7 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os)
bool cmDocumentation::PrintHelpListGenerators(std::ostream& os)
{
- const auto si = this->AllSections.find("Generators");
+ auto const si = this->AllSections.find("Generators");
if (si != this->AllSections.end()) {
this->Formatter.PrintSection(os, si->second);
}
@@ -647,7 +647,7 @@ bool cmDocumentation::PrintHelpListVariables(std::ostream& os)
bool cmDocumentation::PrintUsage(std::ostream& os)
{
- const auto si = this->AllSections.find("Usage");
+ auto const si = this->AllSections.find("Usage");
if (si != this->AllSections.end()) {
this->Formatter.PrintSection(os, si->second);
}
@@ -673,7 +673,7 @@ bool cmDocumentation::PrintHelp(std::ostream& os)
return true;
}
-const char* cmDocumentation::GetNameString() const
+char const* cmDocumentation::GetNameString() const
{
if (!this->NameString.empty()) {
return this->NameString.c_str();
@@ -689,8 +689,8 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os)
cmSystemTools::GetFilenameLastExtension(filename));
std::string name = cmSystemTools::GetFilenameWithoutLastExtension(filename);
- const char* summary = "cmake --help-custom-modules no longer supported\n";
- const char* detail =
+ char const* summary = "cmake --help-custom-modules no longer supported\n";
+ char const* detail =
"CMake versions prior to 3.0 exposed their internal module help page\n"
"generation functionality through the --help-custom-modules option.\n"
"CMake versions 3.0 and above use other means to generate their module\n"
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 3e6bdfb..392e9a9 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -54,8 +54,8 @@ public:
* all arguments after the -E are ignored and not searched for
* help arguments.
*/
- bool CheckOptions(int argc, const char* const* argv,
- const char* exitOpt = nullptr);
+ bool CheckOptions(int argc, char const* const* argv,
+ char const* exitOpt = nullptr);
/**
* Print help requested on the command line. Call after
@@ -71,13 +71,13 @@ public:
void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; }
/** Set the program name for standard document generation. */
- void SetName(const std::string& name);
+ void SetName(std::string const& name);
/** Set a section of the documentation. Typical sections include Name,
Usage, Description, Options */
- void SetSection(const char* sectionName, cmDocumentationSection section);
+ void SetSection(char const* sectionName, cmDocumentationSection section);
template <typename Iterable>
- void SetSection(const char* sectionName, const Iterable& docs)
+ void SetSection(char const* sectionName, Iterable const& docs)
{
cmDocumentationSection sec{ sectionName };
sec.Append(docs);
@@ -86,17 +86,17 @@ public:
/** Add the documentation to the beginning/end of the section */
template <typename Iterable>
- void PrependSection(const char* sectionName, const Iterable& docs)
+ void PrependSection(char const* sectionName, Iterable const& docs)
{
this->SectionAtName(sectionName).Prepend(docs);
}
- void PrependSection(const char* sectionName, cmDocumentationEntry& docs);
+ void PrependSection(char const* sectionName, cmDocumentationEntry& docs);
template <typename Iterable>
- void AppendSection(const char* sectionName, const Iterable& docs)
+ void AppendSection(char const* sectionName, Iterable const& docs)
{
this->SectionAtName(sectionName).Append(docs);
}
- void AppendSection(const char* sectionName, cmDocumentationEntry& docs);
+ void AppendSection(char const* sectionName, cmDocumentationEntry& docs);
/** Add common (to all tools) documentation section(s) */
void addCommonStandardDocSections();
@@ -135,13 +135,13 @@ private:
bool PrintHelpListGenerators(std::ostream& os);
bool PrintOldCustomModules(std::ostream& os);
- const char* GetNameString() const;
+ char const* GetNameString() const;
bool ShowGenerators;
std::string NameString;
std::map<std::string, cmDocumentationSection> AllSections;
- cmDocumentationSection& SectionAtName(const char* name);
+ cmDocumentationSection& SectionAtName(char const* name);
std::string CurrentArgument;
diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h
index d971836..15d7030 100644
--- a/Source/cmDocumentationEntry.h
+++ b/Source/cmDocumentationEntry.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,14 +10,14 @@
struct cmDocumentationEntry
{
#if __cplusplus <= 201103L
- cmDocumentationEntry(const std::string& name, const std::string& brief)
+ cmDocumentationEntry(std::string const& name, std::string const& brief)
: Name{ name }
, Brief{ brief }
{
}
#endif
- std::string Name = {};
- std::string Brief = {};
+ std::string Name;
+ std::string Brief;
char CustomNamePrefix = ' ';
};
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx
index b85b2f5..ea644d9 100644
--- a/Source/cmDocumentationFormatter.cxx
+++ b/Source/cmDocumentationFormatter.cxx
@@ -1,195 +1,164 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDocumentationFormatter.h"
#include <algorithm> // IWYU pragma: keep
#include <cassert>
#include <iomanip>
+#include <iterator>
#include <ostream>
#include <string>
#include <vector>
+#include <cm/string_view>
+#include <cmext/string_view>
+
#include "cmDocumentationEntry.h"
#include "cmDocumentationSection.h"
+#include "cmStringAlgorithms.h"
namespace {
-const char* skipSpaces(const char* ptr)
-{
- assert(ptr);
- for (; *ptr == ' '; ++ptr) {
- ;
- }
- return ptr;
-}
-const char* skipToSpace(const char* ptr)
-{
- assert(ptr);
- for (; *ptr && (*ptr != '\n') && (*ptr != ' '); ++ptr) {
- ;
- }
- return ptr;
-}
-}
-
-void cmDocumentationFormatter::PrintFormatted(std::ostream& os,
- std::string const& text) const
+auto const EOL = "\n"_s;
+auto const SPACE = " "_s;
+auto const TWO_SPACES = " "_s;
+auto const MAX_WIDTH_PADDING =
+ std::string(cmDocumentationFormatter::TEXT_WIDTH, ' ');
+
+void FormatLine(std::back_insert_iterator<std::vector<cm::string_view>> outIt,
+ cm::string_view const text, cm::string_view const padding)
{
- if (text.empty()) {
+ auto tokens = cmTokenizedView(text, ' ', cmTokenizerMode::New);
+ if (tokens.empty()) {
return;
}
- struct Buffer
- {
- // clang-format off
- using PrinterFn = void (cmDocumentationFormatter::*)(
- std::ostream&, std::string const&
- ) const;
- // clang-format on
- std::string collected;
- const PrinterFn printer;
- };
- // const auto NORMAL_IDX = 0u;
- const auto PREFORMATTED_IDX = 1u;
- const auto HANDLERS_SIZE = 2u;
- Buffer buffers[HANDLERS_SIZE] = {
- { {}, &cmDocumentationFormatter::PrintParagraph },
- { {}, &cmDocumentationFormatter::PrintPreformatted }
- };
-
- const auto padding = std::string(this->TextIndent, ' ');
-
- for (std::size_t pos = 0u, eol = 0u; pos < text.size(); pos = eol) {
- const auto current_idx = std::size_t(text[pos] == ' ');
- // size_t(!bool(current_idx))
- const auto other_idx = current_idx ^ 1u;
-
- // Flush the other buffer if anything has been collected
- if (!buffers[other_idx].collected.empty()) {
- // NOTE Whatever the other index is, the current buffered
- // string expected to be empty.
- assert(buffers[current_idx].collected.empty());
-
- (this->*buffers[other_idx].printer)(os, buffers[other_idx].collected);
- buffers[other_idx].collected.clear();
- }
-
- // ATTENTION The previous implementation had called `PrintParagraph()`
- // **for every processed (char by char) input line**.
- // The method unconditionally append the `\n' character after the
- // printed text. To keep the backward-compatible behavior it's needed to
- // add the '\n' character to the previously collected line...
- if (!buffers[current_idx].collected.empty() &&
- current_idx != PREFORMATTED_IDX) {
- buffers[current_idx].collected += '\n';
- }
-
- // Lookup EOL
- eol = text.find('\n', pos);
- if (current_idx == PREFORMATTED_IDX) {
- buffers[current_idx].collected.append(padding);
- }
- buffers[current_idx].collected.append(
- text, pos, eol == std::string::npos ? eol : ++eol - pos);
+ // Push padding in front of a first line
+ if (!padding.empty()) {
+ outIt = padding;
}
- for (auto& buf : buffers) {
- if (!buf.collected.empty()) {
- (this->*buf.printer)(os, buf.collected);
+ auto currentWidth = padding.size();
+ auto newSentence = false;
+
+ for (auto token : tokens) {
+ // It's no need to add a space if this is a very first
+ // word on a line.
+ auto const needSpace = currentWidth > padding.size();
+ // Evaluate the size of a current token + possibly spaces before it.
+ auto const tokenWithSpaceSize = token.size() + std::size_t(needSpace) +
+ std::size_t(needSpace && newSentence);
+ // Check if a current word fits on a line.
+ // Also, take in account:
+ // - extra space if not a first word on a line
+ // - extra space if last token ends w/ a period
+ if (currentWidth + tokenWithSpaceSize <=
+ cmDocumentationFormatter::TEXT_WIDTH) {
+ // If not a first word on a line...
+ if (needSpace) {
+ // ... add a space after the last token +
+ // possibly one more space if the last token
+ // ends with a period (means, end of a sentence).
+ outIt = newSentence ? TWO_SPACES : SPACE;
+ }
+ outIt = token;
+ currentWidth += tokenWithSpaceSize;
+ } else {
+ // Start a new line!
+ outIt = EOL;
+ if (!padding.empty()) {
+ outIt = padding;
+ }
+ outIt = token;
+ currentWidth = padding.size() + token.size();
}
- }
-}
-void cmDocumentationFormatter::PrintPreformatted(std::ostream& os,
- std::string const& text) const
-{
- os << text << '\n';
+ // Start a new sentence if the current word ends with period
+ newSentence = token.back() == '.';
+ }
+ // Always add EOL at the end of formatted text
+ outIt = EOL;
}
+} // anonymous namespace
-void cmDocumentationFormatter::PrintParagraph(std::ostream& os,
- std::string const& text) const
+std::string cmDocumentationFormatter::Format(std::string text) const
{
- if (this->TextIndent) {
- os << std::string(this->TextIndent, ' ');
+ // Exit early on empty text
+ if (text.empty()) {
+ return {};
}
- this->PrintColumn(os, text);
- os << '\n';
-}
-void cmDocumentationFormatter::PrintColumn(std::ostream& os,
- std::string const& text) const
-{
- // Print text arranged in an indented column of fixed width.
- bool newSentence = false;
- bool firstLine = true;
-
- assert(this->TextIndent < this->TextWidth);
- const std::ptrdiff_t width = this->TextWidth - this->TextIndent;
- std::ptrdiff_t column = 0;
-
- // Loop until the end of the text.
- for (const char *l = text.c_str(), *r = skipToSpace(text.c_str()); *l;
- l = skipSpaces(r), r = skipToSpace(l)) {
- // Does it fit on this line?
- if (r - l < width - column - std::ptrdiff_t(newSentence)) {
- // Word fits on this line.
- if (r > l) {
- if (column) {
- // Not first word on line. Separate from the previous word
- // by a space, or two if this is a new sentence.
- os << &(" "[std::size_t(!newSentence)]);
- column += 1u + std::ptrdiff_t(newSentence);
- } else if (!firstLine && this->TextIndent) {
- // First word on line. Print indentation unless this is the
- // first line.
- os << std::string(this->TextIndent, ' ');
- }
+ assert(this->TextIndent < this->TEXT_WIDTH);
- // Print the word.
- os.write(l, r - l);
- newSentence = (*(r - 1) == '.');
- }
+ auto const padding =
+ cm::string_view(MAX_WIDTH_PADDING.c_str(), this->TextIndent);
- if (*r == '\n') {
- // Text provided a newline. Start a new line.
- os << '\n';
- ++r;
- column = 0;
- firstLine = false;
- } else {
- // No provided newline. Continue this line.
- column += r - l;
+ std::vector<cm::string_view> tokens;
+ auto outIt = std::back_inserter(tokens);
+ auto prevWasPreFormatted = false;
+
+ // NOTE Can't use `cmTokenizedView()` cuz every sequential EOL does matter
+ // (and `cmTokenizedView()` will squeeze 'em)
+ for ( // clang-format off
+ std::string::size_type start = 0
+ , end = text.find('\n')
+ ; start < text.size()
+ ; start = end + ((end != std::string::npos) ? 1 : 0)
+ , end = text.find('\n', start)
+ ) // clang-format on
+ {
+ auto const isLastLine = end == std::string::npos;
+ auto const line = isLastLine
+ ? cm::string_view{ text.c_str() + start }
+ : cm::string_view{ text.c_str() + start, end - start };
+
+ if (!line.empty() && line.front() == ' ') {
+ // Preformatted lines go as is w/ a leading padding
+ if (!padding.empty()) {
+ outIt = padding;
}
+ outIt = line;
+ prevWasPreFormatted = true;
} else {
- // Word does not fit on this line. Start a new line.
- os << '\n';
- firstLine = false;
- if (r > l) {
- os << std::string(this->TextIndent, ' ');
- os.write(l, r - l);
- column = r - l;
- newSentence = (*(r - 1) == '.');
+ // Separate a normal paragraph from a pre-formatted
+ // w/ an extra EOL
+ if (prevWasPreFormatted) {
+ outIt = EOL;
+ }
+ if (line.empty()) {
+ if (!isLastLine) {
+ outIt = EOL;
+ }
} else {
- column = 0;
+ FormatLine(outIt, line, padding);
}
+ prevWasPreFormatted = false;
}
- // Move to beginning of next word. Skip over whitespace.
+ if (!isLastLine) {
+ outIt = EOL;
+ }
+ }
+
+ if (prevWasPreFormatted) {
+ outIt = EOL;
}
+
+ return cmJoinStrings(tokens, {}, {});
}
void cmDocumentationFormatter::PrintSection(
std::ostream& os, cmDocumentationSection const& section)
{
- const std::size_t PREFIX_SIZE =
+ std::size_t const PREFIX_SIZE =
sizeof(cmDocumentationEntry::CustomNamePrefix) + 1u;
// length of the "= " literal (see below)
- const std::size_t SUFFIX_SIZE = 2u;
+ std::size_t const SUFFIX_SIZE = 2u;
// legacy magic number ;-)
- const std::size_t NAME_SIZE = 29u;
+ std::size_t const NAME_SIZE = 29u;
- const std::size_t PADDING_SIZE = PREFIX_SIZE + SUFFIX_SIZE;
- const std::size_t TITLE_SIZE = NAME_SIZE + PADDING_SIZE;
+ std::size_t const PADDING_SIZE = PREFIX_SIZE + SUFFIX_SIZE;
+ std::size_t const TITLE_SIZE = NAME_SIZE + PADDING_SIZE;
- const auto savedIndent = this->TextIndent;
+ auto const savedIndent = this->TextIndent;
os << section.GetName() << '\n';
@@ -202,13 +171,10 @@ void cmDocumentationFormatter::PrintSection(
if (entry.Name.size() > NAME_SIZE) {
os << '\n' << std::setw(int(this->TextIndent - PREFIX_SIZE)) << ' ';
}
- os << "= ";
- this->PrintColumn(os, entry.Brief);
- os << '\n';
+ os << "= " << this->Format(entry.Brief).substr(this->TextIndent);
} else {
- os << '\n';
this->TextIndent = 0u;
- this->PrintFormatted(os, entry.Brief);
+ os << '\n' << this->Format(entry.Brief);
}
}
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index 9d35e0a..22b9c47 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -14,15 +14,20 @@ class cmDocumentationSection;
class cmDocumentationFormatter
{
public:
- void SetIndent(std::size_t indent) { this->TextIndent = indent; }
- void PrintFormatted(std::ostream& os, std::string const& text) const;
+ std::string Format(std::string text) const;
void PrintSection(std::ostream& os, cmDocumentationSection const& section);
+ void PrintFormatted(std::ostream& os, std::string const& text) const
+ {
+ os << this->Format(text);
+ }
+ void SetIndent(std::size_t indent) { this->TextIndent = indent; }
+
+ static constexpr std::size_t TEXT_WIDTH = 77u;
private:
void PrintPreformatted(std::ostream& os, std::string const&) const;
void PrintParagraph(std::ostream& os, std::string const&) const;
void PrintColumn(std::ostream& os, std::string const&) const;
- std::size_t TextWidth = 77u;
std::size_t TextIndent = 0u;
};
diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h
index b5e24fe..e1de7c1 100644
--- a/Source/cmDocumentationSection.h
+++ b/Source/cmDocumentationSection.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,7 +19,7 @@ class cmDocumentationSection
{
public:
/** Create a cmSection, with a special name for man-output mode. */
- explicit cmDocumentationSection(const char* name)
+ explicit cmDocumentationSection(char const* name)
: Name(name)
{
}
@@ -34,19 +34,19 @@ public:
std::string GetName() const { return this->Name; }
/** Return a pointer to the first entry of this section. */
- const std::vector<cmDocumentationEntry>& GetEntries() const
+ std::vector<cmDocumentationEntry> const& GetEntries() const
{
return this->Entries;
}
/** Append an entry to this section. */
- void Append(const cmDocumentationEntry& entry)
+ void Append(cmDocumentationEntry const& entry)
{
this->Entries.push_back(entry);
}
template <typename Iterable>
- void Append(const Iterable& entries)
+ void Append(Iterable const& entries)
{
this->Entries.insert(std::end(this->Entries), std::begin(entries),
std::end(entries));
@@ -54,7 +54,7 @@ public:
/** prepend some documentation to this section */
template <typename Iterable>
- void Prepend(const Iterable& entries)
+ void Prepend(Iterable const& entries)
{
this->Entries.insert(std::begin(this->Entries), std::begin(entries),
std::end(entries));
diff --git a/Source/cmDuration.cxx b/Source/cmDuration.cxx
index 8ca5d8d..b017d0a 100644
--- a/Source/cmDuration.cxx
+++ b/Source/cmDuration.cxx
@@ -1,10 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#define CMDURATION_CPP
#include "cmDuration.h"
template <typename T>
-T cmDurationTo(const cmDuration& duration)
+T cmDurationTo(cmDuration const& duration)
{
/* This works because the comparison operators for duration rely on
* std::common_type.
@@ -23,5 +23,5 @@ T cmDurationTo(const cmDuration& duration)
.count();
}
-template int cmDurationTo<int>(const cmDuration&);
-template unsigned int cmDurationTo<unsigned int>(const cmDuration&);
+template int cmDurationTo<int>(cmDuration const&);
+template unsigned int cmDurationTo<unsigned int>(cmDuration const&);
diff --git a/Source/cmDuration.h b/Source/cmDuration.h
index ccd1cc1..c0268f9 100644
--- a/Source/cmDuration.h
+++ b/Source/cmDuration.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <chrono>
@@ -16,9 +16,9 @@ using cmDuration = std::chrono::duration<double, std::ratio<1>>;
* the permissible valid values for T.
*/
template <typename T>
-T cmDurationTo(const cmDuration& duration);
+T cmDurationTo(cmDuration const& duration);
#ifndef CMDURATION_CPP
-extern template int cmDurationTo<int>(const cmDuration&);
-extern template unsigned int cmDurationTo<unsigned int>(const cmDuration&);
+extern template int cmDurationTo<int>(cmDuration const&);
+extern template unsigned int cmDurationTo<unsigned int>(cmDuration const&);
#endif
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index a3731c1..c88c324 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDynamicLoader.h"
#include <map>
@@ -11,10 +11,10 @@ class cmDynamicLoaderCache
{
public:
~cmDynamicLoaderCache();
- void CacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle /*p*/);
- bool GetCacheFile(const char* path,
+ void CacheFile(char const* path, cmsys::DynamicLoader::LibraryHandle /*p*/);
+ bool GetCacheFile(char const* path,
cmsys::DynamicLoader::LibraryHandle& /*p*/);
- bool FlushCache(const char* path);
+ bool FlushCache(char const* path);
void FlushCache();
static cmDynamicLoaderCache& GetInstance();
@@ -28,7 +28,7 @@ cmDynamicLoaderCache cmDynamicLoaderCache::Instance;
cmDynamicLoaderCache::~cmDynamicLoaderCache() = default;
-void cmDynamicLoaderCache::CacheFile(const char* path,
+void cmDynamicLoaderCache::CacheFile(char const* path,
cmsys::DynamicLoader::LibraryHandle p)
{
cmsys::DynamicLoader::LibraryHandle h;
@@ -38,7 +38,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path,
this->CacheMap[path] = p;
}
-bool cmDynamicLoaderCache::GetCacheFile(const char* path,
+bool cmDynamicLoaderCache::GetCacheFile(char const* path,
cmsys::DynamicLoader::LibraryHandle& p)
{
auto it = this->CacheMap.find(path);
@@ -49,7 +49,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path,
return false;
}
-bool cmDynamicLoaderCache::FlushCache(const char* path)
+bool cmDynamicLoaderCache::FlushCache(char const* path)
{
auto it = this->CacheMap.find(path);
bool ret = false;
@@ -75,7 +75,7 @@ cmDynamicLoaderCache& cmDynamicLoaderCache::GetInstance()
}
cmsys::DynamicLoader::LibraryHandle cmDynamicLoader::OpenLibrary(
- const char* libname)
+ char const* libname)
{
cmsys::DynamicLoader::LibraryHandle lh;
if (cmDynamicLoaderCache::GetInstance().GetCacheFile(libname, lh)) {
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index 53ea5cb..e2fcedc 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
// .NAME cmDynamicLoader - class interface to system dynamic libraries
// .SECTION Description
// cmDynamicLoader provides a portable interface to loading dynamic
@@ -18,7 +18,7 @@ public:
// Load a dynamic library into the current process.
// The returned cmsys::DynamicLoader::LibraryHandle can be used to access
// the symbols in the library.
- static cmsys::DynamicLoader::LibraryHandle OpenLibrary(const char*);
+ static cmsys::DynamicLoader::LibraryHandle OpenLibrary(char const*);
// Description:
// Flush the cache of dynamic loader.
diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx
index f42136f..98aaab2 100644
--- a/Source/cmDyndepCollation.cxx
+++ b/Source/cmDyndepCollation.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmDyndepCollation.h"
@@ -239,7 +239,7 @@ Json::Value CollationInformationBmiInstallation(cmGeneratorTarget const* gt,
tdi_bmi_info["permissions"] = bmi_gen->GetFilePermissions();
tdi_bmi_info["destination"] = bmi_gen->GetDestination(config);
- const char* msg_level = "";
+ char const* msg_level = "";
switch (bmi_gen->GetMessageLevel()) {
case cmInstallGenerator::MessageDefault:
break;
diff --git a/Source/cmDyndepCollation.h b/Source/cmDyndepCollation.h
index b193467..7e6dfce 100644
--- a/Source/cmDyndepCollation.h
+++ b/Source/cmDyndepCollation.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 003f47b..372fb9b 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmELF.h"
#include <cstddef>
@@ -107,7 +107,7 @@ public:
virtual unsigned long GetDynamicEntryPosition(int j) = 0;
virtual cmELF::DynamicEntryList GetDynamicEntries() = 0;
virtual std::vector<char> EncodeDynamicEntries(
- const cmELF::DynamicEntryList&) = 0;
+ cmELF::DynamicEntryList const&) = 0;
virtual StringEntry const* GetDynamicSectionString(unsigned int tag) = 0;
virtual bool IsMips() const = 0;
virtual void PrintInfo(std::ostream& os) const = 0;
@@ -164,7 +164,7 @@ protected:
int DynamicSectionIndex;
// Helper methods for subclasses.
- void SetErrorMessage(const char* msg)
+ void SetErrorMessage(char const* msg)
{
this->External->ErrorMessage = msg;
this->ELFType = cmELF::FileTypeInvalid;
@@ -182,7 +182,7 @@ struct cmELFTypes32
using ELF_Dyn = Elf32_Dyn;
using ELF_Half = Elf32_Half;
using tagtype = ::uint32_t;
- static const char* GetName() { return "32-bit"; }
+ static char const* GetName() { return "32-bit"; }
};
// Configure the implementation template for 64-bit ELF files.
@@ -193,7 +193,7 @@ struct cmELFTypes64
using ELF_Dyn = Elf64_Dyn;
using ELF_Half = Elf64_Half;
using tagtype = ::uint64_t;
- static const char* GetName() { return "64-bit"; }
+ static char const* GetName() { return "64-bit"; }
};
// Parser implementation template.
@@ -224,7 +224,7 @@ public:
cmELF::DynamicEntryList GetDynamicEntries() override;
std::vector<char> EncodeDynamicEntries(
- const cmELF::DynamicEntryList&) override;
+ cmELF::DynamicEntryList const&) override;
// Lookup a string from the dynamic section with the given tag.
StringEntry const* GetDynamicSectionString(unsigned int tag) override;
@@ -509,7 +509,7 @@ unsigned long cmELFInternalImpl<Types>::GetDynamicEntryPosition(int j)
return 0;
}
ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex];
- return static_cast<unsigned long>(sec.sh_offset + sec.sh_entsize * j);
+ return sec.sh_offset + sec.sh_entsize * static_cast<unsigned long>(j);
}
template <class Types>
@@ -533,7 +533,7 @@ cmELF::DynamicEntryList cmELFInternalImpl<Types>::GetDynamicEntries()
template <class Types>
std::vector<char> cmELFInternalImpl<Types>::EncodeDynamicEntries(
- const cmELF::DynamicEntryList& entries)
+ cmELF::DynamicEntryList const& entries)
{
std::vector<char> result;
result.reserve(sizeof(ELF_Dyn) * entries.size());
@@ -655,11 +655,11 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
//============================================================================
// External class implementation.
-const long cmELF::TagRPath = DT_RPATH;
-const long cmELF::TagRunPath = DT_RUNPATH;
-const long cmELF::TagMipsRldMapRel = DT_MIPS_RLD_MAP_REL;
+long const cmELF::TagRPath = DT_RPATH;
+long const cmELF::TagRunPath = DT_RUNPATH;
+long const cmELF::TagMipsRldMapRel = DT_MIPS_RLD_MAP_REL;
-cmELF::cmELF(const char* fname)
+cmELF::cmELF(char const* fname)
{
// Try to open the file.
auto fin = cm::make_unique<cmsys::ifstream>(fname, std::ios::binary);
@@ -766,7 +766,7 @@ cmELF::DynamicEntryList cmELF::GetDynamicEntries() const
}
std::vector<char> cmELF::EncodeDynamicEntries(
- const cmELF::DynamicEntryList& dentries) const
+ cmELF::DynamicEntryList const& dentries) const
{
if (this->Valid()) {
return this->Internal->EncodeDynamicEntries(dentries);
diff --git a/Source/cmELF.h b/Source/cmELF.h
index dd37c65..041b986 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,13 +20,13 @@ class cmELF
{
public:
/** Construct with the name of the ELF input file to parse. */
- cmELF(const char* fname);
+ cmELF(char const* fname);
/** Destruct. */
~cmELF();
- cmELF(const cmELF&) = delete;
- cmELF& operator=(const cmELF&) = delete;
+ cmELF(cmELF const&) = delete;
+ cmELF& operator=(cmELF const&) = delete;
/** Get the error message if any. */
std::string const& GetErrorMessage() const { return this->ErrorMessage; }
@@ -86,7 +86,7 @@ public:
/** Encodes a DYNAMIC section header entry list into a char vector according
to the type of ELF file this is */
std::vector<char> EncodeDynamicEntries(
- const DynamicEntryList& entries) const;
+ DynamicEntryList const& entries) const;
/** Returns true if the ELF file has a dynamic section **/
bool HasDynamicSection() const;
@@ -109,7 +109,7 @@ public:
/** Interesting dynamic tags.
If the tag is 0, it does not exist in the host ELF implementation */
- static const long TagRPath, TagRunPath, TagMipsRldMapRel;
+ static long const TagRPath, TagRunPath, TagMipsRldMapRel;
private:
friend class cmELFInternal;
diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx
index 87fb077..96a845b 100644
--- a/Source/cmEnableLanguageCommand.cxx
+++ b/Source/cmEnableLanguageCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmEnableLanguageCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 730ba65..2da71c9 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index 89212c8..f499ed9 100644
--- a/Source/cmEnableTestingCommand.cxx
+++ b/Source/cmEnableTestingCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmEnableTestingCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index a1374f3..c2bd688 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmEvaluatedTargetProperty.cxx b/Source/cmEvaluatedTargetProperty.cxx
index 56c31a3..dab80ae 100644
--- a/Source/cmEvaluatedTargetProperty.cxx
+++ b/Source/cmEvaluatedTargetProperty.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmEvaluatedTargetProperty.h"
#include <unordered_map>
diff --git a/Source/cmEvaluatedTargetProperty.h b/Source/cmEvaluatedTargetProperty.h
index e7b910d..f9cdada 100644
--- a/Source/cmEvaluatedTargetProperty.h
+++ b/Source/cmEvaluatedTargetProperty.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 21ea463..5f09bb6 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExecProgramCommand.h"
#include <cstdio>
@@ -16,7 +16,7 @@ using Encoding = cmProcessOutput::Encoding;
namespace {
bool RunCommand(std::string command, std::string& output, int& retVal,
- const char* directory = nullptr, bool verbose = true,
+ char const* directory = nullptr, bool verbose = true,
Encoding encoding = cmProcessOutput::Auto);
}
@@ -123,7 +123,7 @@ bool cmExecProgramCommand(std::vector<std::string> const& args,
namespace {
bool RunCommand(std::string command, std::string& output, int& retVal,
- const char* dir, bool verbose, Encoding encoding)
+ char const* dir, bool verbose, Encoding encoding)
{
if (cmSystemTools::GetRunCommandOutput()) {
verbose = false;
@@ -188,7 +188,7 @@ bool RunCommand(std::string command, std::string& output, int& retVal,
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
}
cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
- const char* cmd[] = { command.c_str(), nullptr };
+ char const* cmd[] = { command.c_str(), nullptr };
cmsysProcess_SetCommand(cp, cmd);
#else
std::string commandInDir;
@@ -206,7 +206,7 @@ bool RunCommand(std::string command, std::string& output, int& retVal,
}
fflush(stdout);
fflush(stderr);
- const char* cmd[] = { "/bin/sh", "-c", command.c_str(), nullptr };
+ char const* cmd[] = { "/bin/sh", "-c", command.c_str(), nullptr };
cmsysProcess_SetCommand(cp, cmd);
#endif
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 111a56e..655662f 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index e186a08..4a4af16 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExecuteProcessCommand.h"
#include <cstdint>
@@ -43,7 +43,7 @@ bool cmExecuteProcessCommandIsWhitespace(char c)
return (cmIsSpace(c) || c == '\n' || c == '\r');
}
-FILE* FopenCLOEXEC(std::string const& path, const char* mode)
+FILE* FopenCLOEXEC(std::string const& path, char const* mode)
{
FILE* f = cmsys::SystemTools::Fopen(path, mode);
#ifndef _WIN32
@@ -59,7 +59,7 @@ FILE* FopenCLOEXEC(std::string const& path, const char* mode)
void cmExecuteProcessCommandFixText(std::vector<char>& output,
bool strip_trailing_whitespace);
-void cmExecuteProcessCommandAppend(std::vector<char>& output, const char* data,
+void cmExecuteProcessCommandAppend(std::vector<char>& output, char const* data,
std::size_t length);
}
@@ -120,7 +120,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
.Bind("COMMAND_ERROR_IS_FATAL"_s, &Arguments::CommandErrorIsFatal);
std::vector<std::string> unparsedArguments;
- Arguments const arguments = parser.Parse(args, &unparsedArguments);
+ Arguments arguments = parser.Parse(args, &unparsedArguments);
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
@@ -161,11 +161,12 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
status.SetError(" called with no COMMAND argument.");
return false;
}
- for (std::vector<std::string> const& cmd : arguments.Commands) {
+ for (std::vector<std::string>& cmd : arguments.Commands) {
if (cmd.empty()) {
status.SetError(" given COMMAND argument with no value.");
return false;
}
+ cmSystemTools::MaybePrependCmdExe(cmd);
}
// Parse the timeout string.
@@ -177,12 +178,25 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
}
- if (!arguments.CommandErrorIsFatal.empty()) {
- if (arguments.CommandErrorIsFatal != "ANY"_s &&
- arguments.CommandErrorIsFatal != "LAST"_s) {
- status.SetError("COMMAND_ERROR_IS_FATAL option can be ANY or LAST");
+ std::string commandErrorIsFatal = arguments.CommandErrorIsFatal;
+ if (commandErrorIsFatal.empty() && arguments.ResultVariable.empty() &&
+ arguments.ResultsVariable.empty()) {
+ commandErrorIsFatal = status.GetMakefile().GetSafeDefinition(
+ "CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL");
+ }
+
+ if (!commandErrorIsFatal.empty() && commandErrorIsFatal != "ANY"_s &&
+ commandErrorIsFatal != "LAST"_s && commandErrorIsFatal != "NONE"_s) {
+ if (!arguments.CommandErrorIsFatal.empty()) {
+ status.SetError(
+ "COMMAND_ERROR_IS_FATAL option can be ANY, LAST or NONE");
return false;
}
+ status.SetError(cmStrCat(
+ "Using CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL with invalid value "
+ "\"",
+ commandErrorIsFatal, "\". This variable can be ANY, LAST or NONE"));
+ return false;
}
// Create a process instance.
cmUVProcessChainBuilder builder;
@@ -281,7 +295,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
if (echo_stdout || echo_stderr) {
std::string command;
- for (const auto& cmd : arguments.Commands) {
+ for (auto const& cmd : arguments.Commands) {
command += "'";
command += cmJoin(cmd, "' '");
command += "'";
@@ -479,7 +493,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
exception.second);
};
- if (arguments.CommandErrorIsFatal == "ANY"_s) {
+ if (commandErrorIsFatal == "ANY"_s) {
bool ret = true;
if (timedOut) {
status.SetError("Process terminated due to timeout");
@@ -510,7 +524,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
}
- if (arguments.CommandErrorIsFatal == "LAST"_s) {
+ if (commandErrorIsFatal == "LAST"_s) {
bool ret = true;
if (timedOut) {
status.SetError("Process terminated due to timeout");
@@ -523,7 +537,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
ret = false;
} else {
int lastIndex = static_cast<int>(arguments.Commands.size() - 1);
- const std::string processStatus = queryProcessStatusByIndex(lastIndex);
+ std::string const processStatus = queryProcessStatusByIndex(lastIndex);
if (!processStatus.empty()) {
status.SetError("last command failed");
ret = false;
@@ -570,7 +584,7 @@ void cmExecuteProcessCommandFixText(std::vector<char>& output,
output.push_back('\0');
}
-void cmExecuteProcessCommandAppend(std::vector<char>& output, const char* data,
+void cmExecuteProcessCommandAppend(std::vector<char>& output, char const* data,
std::size_t length)
{
#if defined(__APPLE__)
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index cc8cc38..ba0eb96 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index e023971..7e28027 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cmConfigure.h> // IWYU pragma: keep
@@ -41,7 +41,7 @@ public:
this->ReturnInvoked = true;
}
bool GetReturnInvoked() const { return this->ReturnInvoked; }
- const std::vector<std::string>& GetReturnVariables() const
+ std::vector<std::string> const& GetReturnVariables() const
{
return this->Variables;
}
diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx
index 1f14fc4..5456bf5 100644
--- a/Source/cmExpandedCommandArgument.cxx
+++ b/Source/cmExpandedCommandArgument.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExpandedCommandArgument.h"
#include <utility>
@@ -23,7 +23,7 @@ bool cmExpandedCommandArgument::WasQuoted() const
return this->Quoted;
}
-bool cmExpandedCommandArgument::operator==(const char* value) const
+bool cmExpandedCommandArgument::operator==(char const* value) const
{
return this->Value == value;
}
diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h
index 1ff6ed1..4dc98be 100644
--- a/Source/cmExpandedCommandArgument.h
+++ b/Source/cmExpandedCommandArgument.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,7 +23,7 @@ public:
bool WasQuoted() const;
- bool operator==(const char* value) const;
+ bool operator==(char const* value) const;
bool operator==(std::string const& value) const;
bool empty() const;
diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx
index acc64da..f75270b 100644
--- a/Source/cmExperimental.cxx
+++ b/Source/cmExperimental.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExperimental.h"
@@ -30,7 +30,7 @@ cmExperimental::FeatureData LookupTable[] = {
false },
// WindowsKernelModeDriver
{ "WindowsKernelModeDriver",
- "fac18f65-504e-4dbb-b068-f356bb1f2ddb",
+ "9157bf90-2313-44d6-aefa-67cd83c8be7c",
"CMAKE_EXPERIMENTAL_WINDOWS_KERNEL_MODE_DRIVER",
"CMake's Windows kernel-mode driver support is experimental. It is meant "
"only for experimentation and feedback to CMake developers.",
@@ -46,6 +46,16 @@ cmExperimental::FeatureData LookupTable[] = {
{},
cmExperimental::TryCompileCondition::Always,
false },
+ // ImportPackageInfo
+ { "ImportPackageInfo",
+ "e82e467b-f997-4464-8ace-b00808fff261",
+ "CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES",
+ "CMake's support for importing package information in the Common Package "
+ "Specification format (via find_package) is experimental. It is meant "
+ "only for experimentation and feedback to CMake developers.",
+ {},
+ cmExperimental::TryCompileCondition::Always,
+ false },
// ExportPackageInfo
{ "ExportPackageInfo",
"b80be207-778e-46ba-8080-b23bba22639e",
@@ -65,6 +75,15 @@ cmExperimental::FeatureData LookupTable[] = {
{},
cmExperimental::TryCompileCondition::Never,
false },
+ // Instrumentation
+ { "Instrumentation",
+ "a37d1069-1972-4901-b9c9-f194aaf2b6e0",
+ "CMAKE_EXPERIMENTAL_INSTRUMENTATION",
+ "CMake's support for collecting instrumentation data is experimental. It "
+ "is meant only for experimentation and feedback to CMake developers.",
+ {},
+ cmExperimental::TryCompileCondition::Never,
+ false },
};
static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
static_cast<size_t>(cmExperimental::Feature::Sentinel),
@@ -77,7 +96,7 @@ cmExperimental::FeatureData& DataForFeature(cmExperimental::Feature f)
}
}
-const cmExperimental::FeatureData& cmExperimental::DataForFeature(Feature f)
+cmExperimental::FeatureData const& cmExperimental::DataForFeature(Feature f)
{
return ::DataForFeature(f);
}
diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h
index 875491c..f68fa87 100644
--- a/Source/cmExperimental.h
+++ b/Source/cmExperimental.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -20,8 +20,10 @@ public:
ExportPackageDependencies,
WindowsKernelModeDriver,
CxxImportStd,
+ ImportPackageInfo,
ExportPackageInfo,
ExportBuildDatabase,
+ Instrumentation,
Sentinel,
};
@@ -44,7 +46,7 @@ public:
bool Warned;
};
- static const FeatureData& DataForFeature(Feature f);
+ static FeatureData const& DataForFeature(Feature f);
static cm::optional<Feature> FeatureByName(std::string const& name);
static bool HasSupportEnabled(cmMakefile const& mf, Feature f);
};
diff --git a/Source/cmExportAndroidMKGenerator.cxx b/Source/cmExportAndroidMKGenerator.cxx
index 34dc1a7..524fe58 100644
--- a/Source/cmExportAndroidMKGenerator.cxx
+++ b/Source/cmExportAndroidMKGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportAndroidMKGenerator.h"
#include <sstream>
@@ -12,13 +12,9 @@
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmList.h"
-#include "cmMakefile.h"
-#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-#include "cmTarget.h"
cmExportAndroidMKGenerator::cmExportAndroidMKGenerator() = default;
@@ -52,20 +48,6 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
(this->Configurations.empty() ? std::string{} : this->Configurations[0]);
GenerateType const type = this->GetGenerateType();
- bool const newCMP0022Behavior =
- target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
- if (!newCMP0022Behavior) {
- std::ostringstream w;
- if (type == BUILD) {
- w << "export(TARGETS ... ANDROID_MK) called with policy CMP0022";
- } else {
- w << "install( EXPORT_ANDROID_MK ...) called with policy CMP0022";
- }
- w << " set to OLD for target " << target->Target->GetName() << ". "
- << "The export will only work with CMP0022 set to NEW.";
- target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
- }
if (!properties.empty()) {
os << "LOCAL_CPP_FEATURES := rtti exceptions\n";
for (auto const& property : properties) {
diff --git a/Source/cmExportAndroidMKGenerator.h b/Source/cmExportAndroidMKGenerator.h
index fb0f03b..dbf544b 100644
--- a/Source/cmExportAndroidMKGenerator.h
+++ b/Source/cmExportAndroidMKGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index a5f6ca3..c3cffc2 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportBuildAndroidMKGenerator.h"
#include <sstream>
@@ -7,7 +7,6 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -34,13 +33,8 @@ bool cmExportBuildAndroidMKGenerator::GenerateMainFile(std::ostream& os)
return false;
}
- bool const newCMP0022Behavior =
- gte->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
- if (newCMP0022Behavior) {
- this->PopulateInterfaceLinkLibrariesProperty(
- gte, cmGeneratorExpression::BuildInterface, properties);
- }
+ this->PopulateInterfaceLinkLibrariesProperty(
+ gte, cmGeneratorExpression::BuildInterface, properties);
this->GenerateInterfaceProperties(gte, os, properties);
}
diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h
index deb3893..0624f2b 100644
--- a/Source/cmExportBuildAndroidMKGenerator.h
+++ b/Source/cmExportBuildAndroidMKGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportBuildCMakeConfigGenerator.cxx b/Source/cmExportBuildCMakeConfigGenerator.cxx
index 87aeb3c..1e58d79 100644
--- a/Source/cmExportBuildCMakeConfigGenerator.cxx
+++ b/Source/cmExportBuildCMakeConfigGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportBuildCMakeConfigGenerator.h"
#include <algorithm>
@@ -24,7 +24,6 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -72,13 +71,8 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
return false;
}
- bool const newCMP0022Behavior =
- gte->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
- if (newCMP0022Behavior) {
- this->PopulateInterfaceLinkLibrariesProperty(
- gte, cmGeneratorExpression::BuildInterface, properties);
- }
+ this->PopulateInterfaceLinkLibrariesProperty(
+ gte, cmGeneratorExpression::BuildInterface, properties);
this->GenerateInterfaceProperties(gte, os, properties);
diff --git a/Source/cmExportBuildCMakeConfigGenerator.h b/Source/cmExportBuildCMakeConfigGenerator.h
index 0648dc3..7c089b5 100644
--- a/Source/cmExportBuildCMakeConfigGenerator.h
+++ b/Source/cmExportBuildCMakeConfigGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index a319f0c..86e1b91 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportBuildFileGenerator.h"
#include <algorithm>
@@ -139,10 +139,9 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
// The target is not in the export.
if (!this->AppendMode) {
auto const& exportInfo = this->FindExportInfo(dependee);
- auto const& exportFiles = exportInfo.first;
- if (exportFiles.size() == 1) {
- std::string missingTarget = exportInfo.second;
+ if (exportInfo.Namespaces.size() == 1 && exportInfo.Sets.size() == 1) {
+ std::string missingTarget = *exportInfo.Namespaces.begin();
missingTarget += dependee->GetExportName();
link_libs += missingTarget;
@@ -151,7 +150,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
}
// We are not appending, so all exported targets should be
// known here. This is probably user-error.
- this->ComplainAboutMissingTarget(depender, dependee, exportFiles);
+ this->ComplainAboutMissingTarget(depender, dependee, exportInfo);
}
// Assume the target will be exported by another command.
// Append it with the export namespace.
@@ -179,42 +178,51 @@ cmExportFileGenerator::ExportInfo cmExportBuildFileGenerator::FindExportInfo(
cmGeneratorTarget const* target) const
{
std::vector<std::string> exportFiles;
- std::string ns;
+ std::set<std::string> exportSets;
+ std::set<std::string> namespaces;
auto const& name = target->GetName();
- auto& exportSets =
+ auto& allExportSets =
target->GetLocalGenerator()->GetGlobalGenerator()->GetBuildExportSets();
- for (auto const& exp : exportSets) {
+ for (auto const& exp : allExportSets) {
auto const& exportSet = exp.second;
std::vector<TargetExport> targets;
exportSet->GetTargets(targets);
if (std::any_of(
targets.begin(), targets.end(),
[&name](TargetExport const& te) { return te.Name == name; })) {
+ exportSets.insert(exp.first);
exportFiles.push_back(exp.first);
- ns = exportSet->GetNamespace();
+ namespaces.insert(exportSet->GetNamespace());
}
}
- return { exportFiles, exportFiles.size() == 1 ? ns : std::string{} };
+ return { exportFiles, exportSets, namespaces };
}
void cmExportBuildFileGenerator::ComplainAboutMissingTarget(
cmGeneratorTarget const* depender, cmGeneratorTarget const* dependee,
- std::vector<std::string> const& exportFiles) const
+ ExportInfo const& exportInfo) const
{
std::ostringstream e;
e << "export called with target \"" << depender->GetName()
<< "\" which requires target \"" << dependee->GetName() << "\" ";
- if (exportFiles.empty()) {
+ if (exportInfo.Sets.empty()) {
e << "that is not in any export set.";
} else {
- e << "that is not in this export set, but in multiple other export sets: "
- << cmJoin(exportFiles, ", ") << ".\n";
- e << "An exported target cannot depend upon another target which is "
- "exported multiple times. Consider consolidating the exports of the "
- "\""
+ if (exportInfo.Sets.size() == 1) {
+ e << "that is not in this export set, but in another export set which "
+ "is "
+ "exported multiple times with different namespaces: ";
+ } else {
+ e << "that is not in this export set, but in multiple other export "
+ "sets: ";
+ }
+ e << cmJoin(exportInfo.Files, ", ") << ".\n"
+ << "An exported target cannot depend upon another target which is "
+ "exported in more than one export set or with more than one "
+ "namespace. Consider consolidating the exports of the \""
<< dependee->GetName() << "\" target to a single export.";
}
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index dfd0416..6b30815 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -79,9 +79,9 @@ protected:
cmGeneratorTarget const* depender,
cmGeneratorTarget* dependee) override;
- void ComplainAboutMissingTarget(
- cmGeneratorTarget const* depender, cmGeneratorTarget const* dependee,
- std::vector<std::string> const& exportFiles) const;
+ void ComplainAboutMissingTarget(cmGeneratorTarget const* depender,
+ cmGeneratorTarget const* dependee,
+ ExportInfo const& exportInfo) const;
void ComplainAboutDuplicateTarget(
std::string const& targetName) const override;
diff --git a/Source/cmExportCMakeConfigGenerator.cxx b/Source/cmExportCMakeConfigGenerator.cxx
index e85d949..1bf43ca 100644
--- a/Source/cmExportCMakeConfigGenerator.cxx
+++ b/Source/cmExportCMakeConfigGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportCMakeConfigGenerator.h"
#include <algorithm>
@@ -17,12 +17,10 @@
#include "cmFindPackageStack.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
-#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -30,6 +28,8 @@
#include "cmValue.h"
#include "cmVersion.h"
+struct cmLinkInterface;
+
static std::string cmExportFileGeneratorEscape(std::string const& str)
{
// Escape a property value for writing into a .cmake file.
@@ -93,8 +93,8 @@ void cmExportCMakeConfigGenerator::GenerateInterfaceProperties(
cmStrCat(this->Namespace, target->GetExportName());
os << "set_target_properties(" << targetName << " PROPERTIES\n";
for (auto const& property : properties) {
- os << " " << property.first << " "
- << cmExportFileGeneratorEscape(property.second) << "\n";
+ os << " " << property.first << ' '
+ << cmExportFileGeneratorEscape(property.second) << '\n';
}
os << ")\n\n";
}
@@ -111,14 +111,6 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
return;
}
- if (iface->ImplementationIsInterface) {
- // Policy CMP0022 must not be NEW.
- this->SetImportLinkProperty(
- suffix, target, "IMPORTED_LINK_INTERFACE_LIBRARIES", iface->Libraries,
- properties, ImportLinkPropertyTargetNames::Yes);
- return;
- }
-
cmValue propContent;
if (cmValue prop_suffixed =
@@ -130,11 +122,7 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
return;
}
- bool const newCMP0022Behavior =
- target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
-
- if (newCMP0022Behavior && !this->ExportOld) {
+ if (!this->ExportOld) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::ostringstream e;
e << "Target \"" << target->GetName()
@@ -164,37 +152,37 @@ void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os)
{
// Protect that file against use with older CMake versions.
/* clang-format off */
- os << "# Generated by CMake\n\n";
- os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.8)\n"
- << " message(FATAL_ERROR \"CMake >= "
+ os << "# Generated by CMake\n\n"
+ "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.8)\n"
+ " message(FATAL_ERROR \"CMake >= "
<< this->RequiredCMakeVersionMajor << '.'
<< this->RequiredCMakeVersionMinor << '.'
<< this->RequiredCMakeVersionPatch << " required\")\n"
- << "endif()\n"
- << "if(CMAKE_VERSION VERSION_LESS \""
+ "endif()\n"
+ "if(CMAKE_VERSION VERSION_LESS \""
<< this->RequiredCMakeVersionMajor << '.'
<< this->RequiredCMakeVersionMinor << '.'
<< this->RequiredCMakeVersionPatch << "\")\n"
- << " message(FATAL_ERROR \"CMake >= "
+ " message(FATAL_ERROR \"CMake >= "
<< this->RequiredCMakeVersionMajor << '.'
<< this->RequiredCMakeVersionMinor << '.'
<< this->RequiredCMakeVersionPatch << " required\")\n"
- << "endif()\n";
+ "endif()\n";
/* clang-format on */
// Isolate the file policy level.
// Support CMake versions as far back as the
// RequiredCMakeVersion{Major,Minor,Patch}, but also support using NEW
- // policy settings for up to CMake 3.29 (this upper limit may be reviewed
+ // policy settings for up to CMake 3.30 (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.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
- << "cmake_policy(VERSION "
+ "cmake_policy(VERSION "
<< this->RequiredCMakeVersionMajor << '.'
<< this->RequiredCMakeVersionMinor << '.'
- << this->RequiredCMakeVersionPatch << "...3.29)\n";
+ << this->RequiredCMakeVersionPatch << "...3.30)\n";
/* clang-format on */
}
@@ -207,32 +195,30 @@ void cmExportCMakeConfigGenerator::GenerateImportHeaderCode(
std::ostream& os, std::string const& config)
{
os << "#----------------------------------------------------------------\n"
- << "# Generated CMake target import file";
+ "# Generated CMake target import file";
if (!config.empty()) {
os << " for configuration \"" << config << "\".\n";
} else {
os << ".\n";
}
os << "#----------------------------------------------------------------\n"
- << "\n";
+ "\n";
this->GenerateImportVersionCode(os);
}
void cmExportCMakeConfigGenerator::GenerateImportFooterCode(std::ostream& os)
{
os << "# Commands beyond this point should not need to know the version.\n"
- << "set(CMAKE_IMPORT_FILE_VERSION)\n";
+ "set(CMAKE_IMPORT_FILE_VERSION)\n";
}
void cmExportCMakeConfigGenerator::GenerateImportVersionCode(std::ostream& os)
{
// Store an import file format version. This will let us change the
// format later while still allowing old import files to work.
- /* clang-format off */
os << "# Commands may need to know the format version.\n"
- << "set(CMAKE_IMPORT_FILE_VERSION 1)\n"
- << "\n";
- /* clang-format on */
+ "set(CMAKE_IMPORT_FILE_VERSION 1)\n"
+ "\n";
}
void cmExportCMakeConfigGenerator::GenerateExpectedTargetsCode(
@@ -355,7 +341,7 @@ void cmExportCMakeConfigGenerator::GenerateImportTargetCode(
os << "set_property(TARGET " << targetName << " PROPERTY SYSTEM 0)\n";
}
- os << "\n";
+ os << '\n';
}
void cmExportCMakeConfigGenerator::GenerateImportPropertyCode(
@@ -370,22 +356,24 @@ void cmExportCMakeConfigGenerator::GenerateImportPropertyCode(
// Set the import properties.
os << "# Import target \"" << targetName << "\" for configuration \""
- << config << "\"\n";
- os << "set_property(TARGET " << targetName
- << " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
+ << config
+ << "\"\n"
+ "set_property(TARGET "
+ << targetName << " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
if (!config.empty()) {
os << cmSystemTools::UpperCase(config);
} else {
os << "NOCONFIG";
}
- os << ")\n";
- os << "set_target_properties(" << targetName << " PROPERTIES\n";
+ os << ")\n"
+ "set_target_properties("
+ << targetName << " PROPERTIES\n";
std::string importedLocationProp = cmStrCat("IMPORTED_LOCATION", suffix);
for (auto const& property : properties) {
if (importedXcFrameworkLocation.empty() ||
property.first != importedLocationProp) {
- os << " " << property.first << " "
- << cmExportFileGeneratorEscape(property.second) << "\n";
+ os << " " << property.first << ' '
+ << cmExportFileGeneratorEscape(property.second) << '\n';
}
}
os << " )\n";
@@ -396,15 +384,15 @@ void cmExportCMakeConfigGenerator::GenerateImportPropertyCode(
<< cmExportFileGeneratorEscape(importedXcFrameworkLocation)
<< ")\n"
" set_property(TARGET "
- << targetName << " PROPERTY " << importedLocationProp << " "
+ << targetName << " PROPERTY " << importedLocationProp << ' '
<< cmExportFileGeneratorEscape(importedXcFrameworkLocation)
<< ")\nelse()\n set_property(TARGET " << targetName << " PROPERTY "
- << importedLocationProp << " "
+ << importedLocationProp << ' '
<< cmExportFileGeneratorEscape(importedLocationIt->second)
<< ")\nendif()\n";
}
}
- os << "\n";
+ os << '\n';
}
void cmExportCMakeConfigGenerator::GenerateFindDependencyCalls(
@@ -467,7 +455,7 @@ void cmExportCMakeConfigGenerator::GenerateFindDependencyCalls(
if (it.second.Enabled == cmExportSet::PackageDependencyExportEnabled::On) {
os << "find_dependency(" << it.first;
for (auto const& arg : it.second.ExtraArguments) {
- os << " " << cmOutputConverter::EscapeForCMake(arg);
+ os << ' ' << cmOutputConverter::EscapeForCMake(arg);
}
os << ")\n";
}
@@ -479,26 +467,21 @@ void cmExportCMakeConfigGenerator::GenerateMissingTargetsCheckCode(
std::ostream& os)
{
if (this->MissingTargets.empty()) {
- /* clang-format off */
os << "# This file does not depend on other imported targets which have\n"
"# been exported from the same project but in a separate "
- "export set.\n\n";
- /* clang-format on */
+ "export set.\n\n";
return;
}
- /* clang-format off */
os << "# Make sure the targets which have been exported in some other\n"
"# export set exist.\n"
"unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
"foreach(_target ";
- /* clang-format on */
std::set<std::string> emitted;
for (std::string const& missingTarget : this->MissingTargets) {
if (emitted.insert(missingTarget).second) {
- os << "\"" << missingTarget << "\" ";
+ os << '"' << missingTarget << "\" ";
}
}
- /* clang-format off */
os << ")\n"
" if(NOT TARGET \"${_target}\" )\n"
" set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \""
@@ -513,16 +496,15 @@ void cmExportCMakeConfigGenerator::GenerateMissingTargetsCheckCode(
" set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
"\"The following imported targets are "
"referenced, but are missing: "
- "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
+ "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
" else()\n"
" message(FATAL_ERROR \"The following imported targets are "
"referenced, but are missing: "
- "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
+ "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
" endif()\n"
"endif()\n"
"unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
"\n";
- /* clang-format on */
}
void cmExportCMakeConfigGenerator::GenerateImportedFileCheckLoop(
@@ -535,7 +517,6 @@ void cmExportCMakeConfigGenerator::GenerateImportedFileCheckLoop(
// the non-development package, something similar happened to me without
// on SUSE with a mysql pkg-config file, which claimed everything is fine,
// but the development package was not installed.).
- /* clang-format off */
os << "# Loop over all imported files and verify that they actually exist\n"
"foreach(_cmake_target IN LISTS _cmake_import_check_targets)\n"
" if(CMAKE_VERSION VERSION_LESS \"3.28\"\n"
@@ -565,7 +546,6 @@ void cmExportCMakeConfigGenerator::GenerateImportedFileCheckLoop(
"unset(_cmake_target)\n"
"unset(_cmake_import_check_targets)\n"
"\n";
- /* clang-format on */
}
void cmExportCMakeConfigGenerator::GenerateImportedFileChecksCode(
@@ -582,12 +562,12 @@ void cmExportCMakeConfigGenerator::GenerateImportedFileChecksCode(
os << "set(_cmake_import_check_xcframework_for_" << targetName << ' '
<< cmExportFileGeneratorEscape(importedXcFrameworkLocation) << ")\n";
}
- os << "list(APPEND _cmake_import_check_files_for_" << targetName << " ";
+ os << "list(APPEND _cmake_import_check_files_for_" << targetName << ' ';
for (std::string const& li : importedLocations) {
auto pi = properties.find(li);
if (pi != properties.end()) {
- os << cmExportFileGeneratorEscape(pi->second) << " ";
+ os << cmExportFileGeneratorEscape(pi->second) << ' ';
}
}
@@ -602,7 +582,7 @@ void cmExportCMakeConfigGenerator::GenerateTargetFileSets(
std::string targetName = cmStrCat(this->Namespace, gte->GetExportName());
os << "if(NOT CMAKE_VERSION VERSION_LESS \"3.23.0\")\n"
" target_sources("
- << targetName << "\n";
+ << targetName << '\n';
for (auto const& name : interfaceFileSets) {
auto* fileSet = gte->Target->GetFileSet(name);
@@ -621,7 +601,7 @@ void cmExportCMakeConfigGenerator::GenerateTargetFileSets(
<< cmOutputConverter::EscapeForCMake(fileSet->GetType())
<< "\n BASE_DIRS "
<< this->GetFileSetDirectories(gte, fileSet, te) << "\n FILES "
- << this->GetFileSetFiles(gte, fileSet, te) << "\n";
+ << this->GetFileSetFiles(gte, fileSet, te) << '\n';
}
os << " )\nelse()\n set_property(TARGET " << targetName
@@ -667,8 +647,8 @@ void cmExportCMakeConfigGenerator::GenerateCxxModuleInformation(
// Write the include.
os << "# Include C++ module properties\n"
- << "include(\"${CMAKE_CURRENT_LIST_DIR}/" << cxx_module_dirname
- << "/cxx-modules-" << name << ".cmake\")\n\n";
+ "include(\"${CMAKE_CURRENT_LIST_DIR}/"
+ << cxx_module_dirname << "/cxx-modules-" << name << ".cmake\")\n\n";
// Include all configuration-specific include files.
cmGeneratedFileStream ap(this->GetCxxModuleFile(name), true);
diff --git a/Source/cmExportCMakeConfigGenerator.h b/Source/cmExportCMakeConfigGenerator.h
index 90f7aa7..f95676f 100644
--- a/Source/cmExportCMakeConfigGenerator.h
+++ b/Source/cmExportCMakeConfigGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 4c6ddfc..21b6d53 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportCommand.h"
#include <map>
@@ -47,7 +47,7 @@ static bool HandlePackage(std::vector<std::string> const& args,
cmExecutionStatus& status);
static void StorePackageRegistry(cmMakefile& mf, std::string const& package,
- const char* content, const char* hash);
+ char const* content, char const* hash);
bool cmExportCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -383,7 +383,7 @@ static bool HandlePackage(std::vector<std::string> const& args,
status.SetError("PACKAGE must be given a package name.");
return false;
}
- const char* packageExpr = "^[A-Za-z0-9_.-]+$";
+ char const* packageExpr = "^[A-Za-z0-9_.-]+$";
cmsys::RegularExpression packageRegex(packageExpr);
if (!packageRegex.find(package)) {
std::ostringstream e;
@@ -405,8 +405,6 @@ static bool HandlePackage(std::vector<std::string> const& args,
return true;
}
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// Default is to not export, but can be enabled.
if (!mf.IsOn("CMAKE_EXPORT_PACKAGE_REGISTRY")) {
@@ -418,7 +416,7 @@ static bool HandlePackage(std::vector<std::string> const& args,
// We store the current build directory in the registry as a value
// named by a hash of its own content. This is deterministic and is
// unique with high probability.
- const std::string& outDir = mf.GetCurrentBinaryDirectory();
+ std::string const& outDir = mf.GetCurrentBinaryDirectory();
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
std::string hash = hasher.HashString(outDir);
StorePackageRegistry(mf, package, outDir.c_str(), hash.c_str());
@@ -445,7 +443,7 @@ static void ReportRegistryError(cmMakefile& mf, std::string const& msg,
}
static void StorePackageRegistry(cmMakefile& mf, std::string const& package,
- const char* content, const char* hash)
+ char const* content, char const* hash)
{
std::string key = cmStrCat("Software\\Kitware\\CMake\\Packages\\", package);
HKEY hKey;
@@ -472,7 +470,7 @@ static void StorePackageRegistry(cmMakefile& mf, std::string const& package,
}
#else
static void StorePackageRegistry(cmMakefile& mf, std::string const& package,
- const char* content, const char* hash)
+ char const* content, char const* hash)
{
# if defined(__HAIKU__)
char dir[B_PATH_NAME_LENGTH];
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index 3f87bcf..555bca6 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 5e9461d..583a256 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportFileGenerator.h"
#include <array>
@@ -318,7 +318,7 @@ void cmExportFileGenerator::PopulateCustomTransitiveInterfaceProperties(
properties);
this->PopulateInterfaceProperty("TRANSITIVE_LINK_PROPERTIES", target,
properties);
- cmGeneratorTarget::CheckLinkLibrariesSuppressionRAII cllSuppressRAII;
+ cmGeneratorTarget::CheckLinkLibrariesSuppressionRAII suppress;
std::set<std::string> ifaceProperties;
for (std::string const& config : this->Configurations) {
for (auto const& i : target->GetCustomTransitiveProperties(
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index b1c9ce3..740fbba 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -8,7 +8,6 @@
#include <map>
#include <set>
#include <string>
-#include <utility>
#include <vector>
#include <cm/string_view>
@@ -133,7 +132,12 @@ protected:
virtual void ReportError(std::string const& errorMessage) const = 0;
- using ExportInfo = std::pair<std::vector<std::string>, std::string>;
+ struct ExportInfo
+ {
+ std::vector<std::string> Files;
+ std::set<std::string> Sets;
+ std::set<std::string> Namespaces;
+ };
/** Find the set of export files and the unique namespace (if any) for a
* target. */
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index c9c2f4e..5ebde1f 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportInstallAndroidMKGenerator.h"
#include <cstddef>
@@ -12,7 +12,6 @@
#include "cmGeneratorTarget.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -58,13 +57,8 @@ bool cmExportInstallAndroidMKGenerator::GenerateMainFile(std::ostream& os)
return false;
}
- bool const newCMP0022Behavior =
- gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
- if (newCMP0022Behavior) {
- this->PopulateInterfaceLinkLibrariesProperty(
- gt, cmGeneratorExpression::InstallInterface, properties);
- }
+ this->PopulateInterfaceLinkLibrariesProperty(
+ gt, cmGeneratorExpression::InstallInterface, properties);
this->GenerateInterfaceProperties(gt, os, properties);
}
diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h
index 1e1a5a8..f587086 100644
--- a/Source/cmExportInstallAndroidMKGenerator.h
+++ b/Source/cmExportInstallAndroidMKGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportInstallCMakeConfigGenerator.cxx b/Source/cmExportInstallCMakeConfigGenerator.cxx
index e1b2285..2154e69 100644
--- a/Source/cmExportInstallCMakeConfigGenerator.cxx
+++ b/Source/cmExportInstallCMakeConfigGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportInstallCMakeConfigGenerator.h"
#include <algorithm>
@@ -25,7 +25,6 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -83,15 +82,10 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
return false;
}
- bool const newCMP0022Behavior =
- gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
- if (newCMP0022Behavior) {
- if (this->PopulateInterfaceLinkLibrariesProperty(
- gt, cmGeneratorExpression::InstallInterface, properties) &&
- !this->ExportOld) {
- this->SetRequiredCMakeVersion(2, 8, 12);
- }
+ if (this->PopulateInterfaceLinkLibrariesProperty(
+ gt, cmGeneratorExpression::InstallInterface, properties) &&
+ !this->ExportOld) {
+ this->SetRequiredCMakeVersion(2, 8, 12);
}
if (targetType == cmStateEnums::INTERFACE_LIBRARY) {
this->SetRequiredCMakeVersion(3, 0, 0);
diff --git a/Source/cmExportInstallCMakeConfigGenerator.h b/Source/cmExportInstallCMakeConfigGenerator.h
index e56836b..4729c23 100644
--- a/Source/cmExportInstallCMakeConfigGenerator.h
+++ b/Source/cmExportInstallCMakeConfigGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 7b62bb4..9accd7d 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportInstallFileGenerator.h"
#include <algorithm>
@@ -19,12 +19,12 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmValue.h"
+#include "cmake.h"
cmExportInstallFileGenerator::cmExportInstallFileGenerator(
cmInstallExportGenerator* iegen)
@@ -247,10 +247,9 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
cmGeneratorTarget* dependee)
{
auto const& exportInfo = this->FindExportInfo(dependee);
- auto const& exportFiles = exportInfo.first;
- if (exportFiles.size() == 1) {
- std::string missingTarget = exportInfo.second;
+ if (exportInfo.Namespaces.size() == 1 && exportInfo.Sets.size() == 1) {
+ std::string missingTarget = *exportInfo.Namespaces.begin();
missingTarget += dependee->GetExportName();
link_libs += missingTarget;
@@ -258,7 +257,7 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
} else {
// All exported targets should be known here and should be unique.
// This is probably user-error.
- this->ComplainAboutMissingTarget(depender, dependee, exportFiles);
+ this->ComplainAboutMissingTarget(depender, dependee, exportInfo);
}
}
@@ -266,13 +265,14 @@ cmExportFileGenerator::ExportInfo cmExportInstallFileGenerator::FindExportInfo(
cmGeneratorTarget const* target) const
{
std::vector<std::string> exportFiles;
- std::string ns;
+ std::set<std::string> exportSets;
+ std::set<std::string> namespaces;
auto const& name = target->GetName();
- auto& exportSets =
+ auto& allExportSets =
target->GetLocalGenerator()->GetGlobalGenerator()->GetExportSets();
- for (auto const& exp : exportSets) {
+ for (auto const& exp : allExportSets) {
auto const& exportSet = exp.second;
auto const& targets = exportSet.GetTargetExports();
@@ -282,33 +282,43 @@ cmExportFileGenerator::ExportInfo cmExportInstallFileGenerator::FindExportInfo(
})) {
std::vector<cmInstallExportGenerator const*> const* installs =
exportSet.GetInstallations();
- for (cmInstallExportGenerator const* install : *installs) {
- exportFiles.push_back(install->GetDestinationFile());
- ns = install->GetNamespace();
+ if (!installs->empty()) {
+ exportSets.insert(exp.first);
+ for (cmInstallExportGenerator const* install : *installs) {
+ exportFiles.push_back(install->GetDestinationFile());
+ namespaces.insert(install->GetNamespace());
+ }
}
}
}
-
- return { exportFiles, exportFiles.size() == 1 ? ns : std::string{} };
+ return { exportFiles, exportSets, namespaces };
}
void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
cmGeneratorTarget const* depender, cmGeneratorTarget const* dependee,
- std::vector<std::string> const& exportFiles) const
+ ExportInfo const& exportInfo) const
{
std::ostringstream e;
e << "install(" << this->IEGen->InstallSubcommand() << " \""
<< this->GetExportName() << "\" ...) "
<< "includes target \"" << depender->GetName()
<< "\" which requires target \"" << dependee->GetName() << "\" ";
- if (exportFiles.empty()) {
+ if (exportInfo.Sets.empty()) {
e << "that is not in any export set.";
} else {
- e << "that is not in this export set, but in multiple other export sets: "
- << cmJoin(exportFiles, ", ") << ".\n";
- e << "An exported target cannot depend upon another target which is "
- "exported multiple times. Consider consolidating the exports of the "
- "\""
+ if (exportInfo.Sets.size() == 1) {
+ e << "that is not in this export set, but in another export set which "
+ "is "
+ "exported multiple times with different namespaces: ";
+ } else {
+ e << "that is not in this export set, but in multiple other export "
+ "sets: ";
+ }
+ e << cmJoin(exportInfo.Files, ", ") << ".\n"
+ << "An exported target cannot depend upon another target which is "
+ "exported in more than one export set or with more than one "
+ "namespace. "
+ "Consider consolidating the exports of the \""
<< dependee->GetName() << "\" target to a single export.";
}
this->ReportError(e.str());
@@ -328,7 +338,9 @@ void cmExportInstallFileGenerator::ComplainAboutDuplicateTarget(
void cmExportInstallFileGenerator::ReportError(
std::string const& errorMessage) const
{
- cmSystemTools::Error(errorMessage);
+ this->IEGen->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR, errorMessage,
+ this->IEGen->GetLocalGenerator()->GetMakefile()->GetBacktrace());
}
std::string cmExportInstallFileGenerator::InstallNameDir(
@@ -428,26 +440,9 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
if (cmHasPrefix(li, this->GetImportPrefixWithSlash())) {
continue;
}
- MessageType messageType = MessageType::FATAL_ERROR;
std::ostringstream e;
if (genexPos != std::string::npos) {
- if (prop == "INTERFACE_INCLUDE_DIRECTORIES") {
- switch (target->GetPolicyStatusCMP0041()) {
- case cmPolicies::WARN:
- messageType = MessageType::WARNING;
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0041) << "\n";
- break;
- case cmPolicies::OLD:
- continue;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- hadFatalError = true;
- break; // Issue fatal message.
- }
- } else {
- hadFatalError = true;
- }
+ hadFatalError = true;
}
if (!cmSystemTools::FileIsFullPath(li)) {
/* clang-format off */
@@ -455,51 +450,18 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
" property contains relative path:\n"
" \"" << li << "\"";
/* clang-format on */
- target->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ target->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR,
+ e.str());
}
bool inBinary = isSubDirectory(li, topBinaryDir);
bool inSource = isSubDirectory(li, topSourceDir);
if (isSubDirectory(li, installDir)) {
// The include directory is inside the install tree. If the
- // install tree is not inside the source tree or build tree then
+ // install tree is inside the source tree or build tree then do not
// fall through to the checks below that the include directory is not
// also inside the source tree or build tree.
- bool shouldContinue =
- (!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
- (!inSource || isSubDirectory(installDir, topSourceDir));
-
- if (prop == "INTERFACE_INCLUDE_DIRECTORIES") {
- if (!shouldContinue) {
- switch (target->GetPolicyStatusCMP0052()) {
- case cmPolicies::WARN: {
- std::ostringstream s;
- s << cmPolicies::GetPolicyWarning(cmPolicies::CMP0052) << "\n";
- s << "Directory:\n \"" << li
- << "\"\nin "
- "INTERFACE_INCLUDE_DIRECTORIES of target \""
- << target->GetName()
- << "\" is a subdirectory of the install "
- "directory:\n \""
- << installDir
- << "\"\nhowever it is also "
- "a subdirectory of the "
- << (inBinary ? "build" : "source") << " tree:\n \""
- << (inBinary ? topBinaryDir : topSourceDir) << "\"\n";
- target->GetLocalGenerator()->IssueMessage(
- MessageType::AUTHOR_WARNING, s.str());
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD:
- shouldContinue = true;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- break;
- }
- }
- }
- if (shouldContinue) {
+ if ((!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
+ (!inSource || isSubDirectory(installDir, topSourceDir))) {
continue;
}
}
@@ -509,7 +471,8 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
" property contains path:\n"
" \"" << li << "\"\nwhich is prefixed in the build directory.";
/* clang-format on */
- target->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ target->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR,
+ e.str());
}
if (!inSourceBuild) {
if (inSource) {
@@ -517,7 +480,8 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
<< " property contains path:\n"
" \""
<< li << "\"\nwhich is prefixed in the source directory.";
- target->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ target->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR,
+ e.str());
}
}
}
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index f33ecc1..2df3264 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -86,9 +86,9 @@ protected:
void ReplaceInstallPrefix(std::string& input) const override;
- void ComplainAboutMissingTarget(
- cmGeneratorTarget const* depender, cmGeneratorTarget const* dependee,
- std::vector<std::string> const& exportFiles) const;
+ void ComplainAboutMissingTarget(cmGeneratorTarget const* depender,
+ cmGeneratorTarget const* dependee,
+ ExportInfo const& exportInfo) const;
void ComplainAboutDuplicateTarget(
std::string const& targetName) const override;
diff --git a/Source/cmExportInstallPackageInfoGenerator.cxx b/Source/cmExportInstallPackageInfoGenerator.cxx
index b9b715e..930c593 100644
--- a/Source/cmExportInstallPackageInfoGenerator.cxx
+++ b/Source/cmExportInstallPackageInfoGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportInstallPackageInfoGenerator.h"
#include <memory>
diff --git a/Source/cmExportInstallPackageInfoGenerator.h b/Source/cmExportInstallPackageInfoGenerator.h
index 5861b05..d7f9c27 100644
--- a/Source/cmExportInstallPackageInfoGenerator.h
+++ b/Source/cmExportInstallPackageInfoGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
deleted file mode 100644
index 02d0444..0000000
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmExportLibraryDependenciesCommand.h"
-
-#include <map>
-#include <unordered_map>
-#include <utility>
-
-#include <cm/memory>
-
-#include "cmsys/FStream.hxx"
-
-#include "cmExecutionStatus.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
-#include "cmStateTypes.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmTarget.h"
-#include "cmTargetLinkLibraryType.h"
-#include "cmValue.h"
-#include "cmake.h"
-
-class cmListFileBacktrace;
-
-static void FinalAction(cmMakefile& makefile, std::string const& filename,
- bool append)
-{
- // Use copy-if-different if not appending.
- std::unique_ptr<cmsys::ofstream> foutPtr;
- if (append) {
- const auto openmodeApp = std::ios::app;
- foutPtr = cm::make_unique<cmsys::ofstream>(filename.c_str(), openmodeApp);
- } else {
- std::unique_ptr<cmGeneratedFileStream> ap(
- new cmGeneratedFileStream(filename, true));
- ap->SetCopyIfDifferent(true);
- foutPtr = std::move(ap);
- }
- std::ostream& fout = *foutPtr;
-
- if (!fout) {
- cmSystemTools::Error("Error Writing " + filename);
- cmSystemTools::ReportLastSystemError("");
- return;
- }
-
- // Collect dependency information about all library targets built in
- // the project.
- cmake* cm = makefile.GetCMakeInstance();
- cmGlobalGenerator* global = cm->GetGlobalGenerator();
- const auto& locals = global->GetMakefiles();
- std::map<std::string, std::string> libDepsOld;
- std::map<std::string, std::string> libDepsNew;
- std::map<std::string, std::string> libTypes;
- for (const auto& local : locals) {
- for (auto const& tgt : local->GetTargets()) {
- // Get the current target.
- cmTarget const& target = tgt.second;
-
- // Skip non-library targets.
- if (target.GetType() < cmStateEnums::STATIC_LIBRARY ||
- target.GetType() > cmStateEnums::MODULE_LIBRARY) {
- continue;
- }
-
- // Construct the dependency variable name.
- std::string targetEntry = cmStrCat(target.GetName(), "_LIB_DEPENDS");
-
- // Construct the dependency variable value with the direct link
- // dependencies.
- std::string valueOld;
- std::string valueNew;
- cmTarget::LinkLibraryVectorType const& libs =
- target.GetOriginalLinkLibraries();
- for (cmTarget::LibraryID const& li : libs) {
- std::string ltVar = cmStrCat(li.first, "_LINK_TYPE");
- std::string ltValue;
- switch (li.second) {
- case GENERAL_LibraryType:
- valueNew += "general;";
- ltValue = "general";
- break;
- case DEBUG_LibraryType:
- valueNew += "debug;";
- ltValue = "debug";
- break;
- case OPTIMIZED_LibraryType:
- valueNew += "optimized;";
- ltValue = "optimized";
- break;
- }
- std::string lib = li.first;
- if (cmTarget* libtgt = global->FindTarget(lib)) {
- // Handle simple output name changes. This command is
- // deprecated so we do not support full target name
- // translation (which requires per-configuration info).
- if (cmValue outname = libtgt->GetProperty("OUTPUT_NAME")) {
- lib = *outname;
- }
- }
- valueOld += lib;
- valueOld += ";";
- valueNew += lib;
- valueNew += ";";
-
- std::string& ltEntry = libTypes[ltVar];
- if (ltEntry.empty()) {
- ltEntry = ltValue;
- } else if (ltEntry != ltValue) {
- ltEntry = "general";
- }
- }
- libDepsNew[targetEntry] = valueNew;
- libDepsOld[targetEntry] = valueOld;
- }
- }
-
- // Generate dependency information for both old and new style CMake
- // versions.
- const char* vertest =
- "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
- fout << "# Generated by CMake\n\n";
- fout << "if(" << vertest << ")\n";
- fout << " # Information for CMake 2.6 and above.\n";
- for (auto const& i : libDepsNew) {
- if (!i.second.empty()) {
- fout << " set(\"" << i.first << "\" \"" << i.second << "\")\n";
- }
- }
- fout << "else()\n";
- fout << " # Information for CMake 2.4 and lower.\n";
- for (auto const& i : libDepsOld) {
- if (!i.second.empty()) {
- fout << " set(\"" << i.first << "\" \"" << i.second << "\")\n";
- }
- }
- for (auto const& i : libTypes) {
- if (i.second != "general") {
- fout << " set(\"" << i.first << "\" \"" << i.second << "\")\n";
- }
- }
- fout << "endif()\n";
-}
-
-bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.empty()) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- std::string const& filename = args[0];
- bool const append = args.size() > 1 && args[1] == "APPEND";
- status.GetMakefile().AddGeneratorAction(
- [filename, append](cmLocalGenerator& lg, const cmListFileBacktrace&) {
- FinalAction(*lg.GetMakefile(), filename, append);
- });
-
- return true;
-}
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
deleted file mode 100644
index 1834bfa..0000000
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmExportPackageInfoGenerator.cxx b/Source/cmExportPackageInfoGenerator.cxx
index 3f6628b..bd8b8f8 100644
--- a/Source/cmExportPackageInfoGenerator.cxx
+++ b/Source/cmExportPackageInfoGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportPackageInfoGenerator.h"
#include <memory>
@@ -26,7 +26,7 @@
#include "cmTarget.h"
#include "cmValue.h"
-static const std::string kCPS_VERSION_STR = "0.12.0";
+static std::string const kCPS_VERSION_STR = "0.13.0";
cmExportPackageInfoGenerator::cmExportPackageInfoGenerator(
std::string packageName, std::string version, std::string versionCompat,
@@ -127,9 +127,22 @@ void cmExportPackageInfoGenerator::GeneratePackageRequires(
{
if (!this->Requirements.empty()) {
Json::Value& requirements = package["requires"];
+
+ // Build description for each requirement.
for (auto const& requirement : this->Requirements) {
+ auto data = Json::Value{ Json::objectValue };
+
+ // Add required components.
+ if (!requirement.second.empty()) {
+ auto components = Json::Value{ Json::arrayValue };
+ for (std::string const& component : requirement.second) {
+ components.append(component);
+ }
+ data["components"] = components;
+ }
+
// TODO: version, hint
- requirements[requirement] = Json::Value{};
+ requirements[requirement.first] = data;
}
}
}
@@ -257,17 +270,17 @@ bool cmExportPackageInfoGenerator::NoteLinkedTarget(
return false;
}
+ std::string component = linkedName.substr(prefix.length());
+ this->LinkTargets.emplace(linkedName, cmStrCat(pkgName, ':', component));
// TODO: Record package version, hint.
- this->Requirements.emplace(pkgName);
- this->LinkTargets.emplace(
- linkedName, cmStrCat(pkgName, ':', linkedName.substr(prefix.length())));
+ this->Requirements[pkgName].emplace(std::move(component));
return true;
}
- // Target belongs to another export from this build.
+ // Target belongs to multiple namespaces or multiple export sets.
auto const& exportInfo = this->FindExportInfo(linkedTarget);
- if (exportInfo.first.size() == 1) {
- auto const& linkNamespace = exportInfo.second;
+ if (exportInfo.Namespaces.size() == 1 && exportInfo.Sets.size() == 1) {
+ auto const& linkNamespace = *exportInfo.Namespaces.begin();
if (!cmHasSuffix(linkNamespace, "::")) {
target->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -278,22 +291,19 @@ bool cmExportPackageInfoGenerator::NoteLinkedTarget(
return false;
}
- auto pkgName =
- cm::string_view{ linkNamespace.data(), linkNamespace.size() - 2 };
-
+ std::string pkgName{ linkNamespace.data(), linkNamespace.size() - 2 };
+ std::string component = linkedTarget->GetExportName();
if (pkgName == this->GetPackageName()) {
- this->LinkTargets.emplace(linkedName,
- cmStrCat(':', linkedTarget->GetExportName()));
+ this->LinkTargets.emplace(linkedName, cmStrCat(':', component));
} else {
- this->Requirements.emplace(pkgName);
- this->LinkTargets.emplace(
- linkedName, cmStrCat(pkgName, ':', linkedTarget->GetExportName()));
+ this->LinkTargets.emplace(linkedName, cmStrCat(pkgName, ':', component));
+ this->Requirements[pkgName].emplace(std::move(component));
}
return true;
}
// cmExportFileGenerator::HandleMissingTarget should have complained about
- // this already. (In fact, we probably shouldn't ever get here.)
+ // this already.
return false;
}
diff --git a/Source/cmExportPackageInfoGenerator.h b/Source/cmExportPackageInfoGenerator.h
index 6fe1e35..4ca9dd3 100644
--- a/Source/cmExportPackageInfoGenerator.h
+++ b/Source/cmExportPackageInfoGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -110,5 +110,5 @@ private:
std::vector<std::string> DefaultConfigurations;
std::map<std::string, std::string> LinkTargets;
- std::set<std::string> Requirements;
+ std::map<std::string, std::set<std::string>> Requirements;
};
diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx
index b32bb8d..f5d93ba 100644
--- a/Source/cmExportSet.cxx
+++ b/Source/cmExportSet.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportSet.h" // IWYU pragma: associated
#include <algorithm>
@@ -21,7 +21,7 @@ cmExportSet::cmExportSet(std::string name)
cmExportSet::~cmExportSet() = default;
cmExportSet::PackageDependency& cmExportSet::GetPackageDependencyForSetup(
- const std::string& name)
+ std::string const& name)
{
auto& dep = this->PackageDependencies[name];
if (!dep.SpecifiedIndex) {
@@ -39,7 +39,7 @@ bool cmExportSet::Compute(cmLocalGenerator* lg)
auto const interfaceFileSets =
tgtExport->Target->Target->GetAllInterfaceFileSets();
auto const fileSetInTargetExport =
- [&tgtExport, lg](const std::string& fileSetName) -> bool {
+ [&tgtExport, lg](std::string const& fileSetName) -> bool {
auto* fileSet = tgtExport->Target->Target->GetFileSet(fileSetName);
if (!tgtExport->FileSetGenerators.count(fileSet)) {
@@ -72,8 +72,8 @@ void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation)
this->Installations.push_back(installation);
}
-void cmExportSet::SetXcFrameworkLocation(const std::string& name,
- const std::string& location)
+void cmExportSet::SetXcFrameworkLocation(std::string const& name,
+ std::string const& location)
{
for (auto& te : this->TargetExports) {
if (name == te->TargetName) {
@@ -82,7 +82,7 @@ void cmExportSet::SetXcFrameworkLocation(const std::string& name,
}
}
-cmExportSet& cmExportSetMap::operator[](const std::string& name)
+cmExportSet& cmExportSetMap::operator[](std::string const& name)
{
auto it = this->find(name);
if (it == this->end()) // Export set not found
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
index f2fc4a7..7196a20 100644
--- a/Source/cmExportSet.h
+++ b/Source/cmExportSet.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,8 +24,8 @@ public:
/// Destructor
~cmExportSet();
- cmExportSet(const cmExportSet&) = delete;
- cmExportSet& operator=(const cmExportSet&) = delete;
+ cmExportSet(cmExportSet const&) = delete;
+ cmExportSet& operator=(cmExportSet const&) = delete;
bool Compute(cmLocalGenerator* lg);
@@ -33,8 +33,8 @@ public:
void AddInstallation(cmInstallExportGenerator const* installation);
- void SetXcFrameworkLocation(const std::string& name,
- const std::string& location);
+ void SetXcFrameworkLocation(std::string const& name,
+ std::string const& location);
std::string const& GetName() const { return this->Name; }
@@ -64,9 +64,9 @@ public:
cm::optional<unsigned int> FindPackageIndex;
};
- PackageDependency& GetPackageDependencyForSetup(const std::string& name);
+ PackageDependency& GetPackageDependencyForSetup(std::string const& name);
- const std::map<std::string, PackageDependency>& GetPackageDependencies()
+ std::map<std::string, PackageDependency> const& GetPackageDependencies()
const
{
return this->PackageDependencies;
@@ -89,5 +89,5 @@ public:
* The operator is overloaded because cmExportSet has no default constructor:
* we do not want unnamed export sets.
*/
- cmExportSet& operator[](const std::string& name);
+ cmExportSet& operator[](std::string const& name);
};
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index ea55f47..e67df5f 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExportTryCompileFileGenerator.h"
#include <map>
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 58d1f5e..2637dfe 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,7 +31,7 @@ public:
protected:
// Implement virtual methods from the superclass.
void ComplainAboutDuplicateTarget(
- std::string const& /*targetName*/) const override{};
+ std::string const& /*targetName*/) const override {};
void ReportError(std::string const& errorMessage) const override;
bool GenerateMainFile(std::ostream& os) override;
@@ -47,7 +47,7 @@ protected:
ExportInfo FindExportInfo(cmGeneratorTarget const* /*target*/) const override
{
- return { {}, {} };
+ return { {}, {}, {} };
}
void PopulateProperties(cmGeneratorTarget const* target,
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index cc8b8b7..eabda19 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExprParserHelper.h"
#include <iostream>
@@ -21,7 +21,7 @@ cmExprParserHelper::cmExprParserHelper()
cmExprParserHelper::~cmExprParserHelper() = default;
-int cmExprParserHelper::ParseString(const char* str, int verb)
+int cmExprParserHelper::ParseString(char const* str, int verb)
{
if (!str) {
return 0;
@@ -91,7 +91,7 @@ int cmExprParserHelper::LexInput(char* buf, int maxlen)
return (0);
}
-void cmExprParserHelper::Error(const char* str)
+void cmExprParserHelper::Error(char const* str)
{
unsigned long pos = static_cast<unsigned long>(this->InputBufferPos);
std::ostringstream ostr;
diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h
index 919e492..54ef7fd 100644
--- a/Source/cmExprParserHelper.h
+++ b/Source/cmExprParserHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,16 +20,16 @@ public:
cmExprParserHelper();
~cmExprParserHelper();
- int ParseString(const char* str, int verb);
+ int ParseString(char const* str, int verb);
int LexInput(char* buf, int maxlen);
- void Error(const char* str);
+ void Error(char const* str);
void SetResult(KWIML_INT_int64_t value);
KWIML_INT_int64_t GetResult() const { return this->Result; }
- const char* GetError() { return this->ErrorString.c_str(); }
+ char const* GetError() { return this->ErrorString.c_str(); }
void UnexpectedChar(char c);
@@ -42,12 +42,12 @@ private:
int CurrentLine;
int Verbose;
- void Print(const char* place, const char* str);
+ void Print(char const* place, char const* str);
void SetError(std::string errorString);
KWIML_INT_int64_t Result;
- const char* FileName;
+ char const* FileName;
long FileLine;
std::string ErrorString;
std::string WarningString;
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index 5fecb35..6508705 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExternalMakefileProjectGenerator.h"
#include <utility>
@@ -15,7 +15,7 @@ void cmExternalMakefileProjectGenerator::EnableLanguage(
}
std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
- const std::string& globalGenerator, const std::string& extraGenerator)
+ std::string const& globalGenerator, std::string const& extraGenerator)
{
if (globalGenerator.empty()) {
return {};
@@ -27,7 +27,7 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
}
bool cmExternalMakefileProjectGenerator::Open(
- const std::string& /*bindir*/, const std::string& /*projectName*/,
+ std::string const& /*bindir*/, std::string const& /*projectName*/,
bool /*dryRun*/)
{
return false;
@@ -60,7 +60,7 @@ cmExternalMakefileProjectGeneratorFactory::GetSupportedGlobalGenerators() const
}
void cmExternalMakefileProjectGeneratorFactory::AddSupportedGlobalGenerator(
- const std::string& base)
+ std::string const& base)
{
this->SupportedGlobalGenerators.push_back(base);
}
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index 311a2ef..63f3a1e 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,7 +38,7 @@ public:
}
//! Return the list of global generators supported by this extra generator
- const std::vector<std::string>& GetSupportedGlobalGenerators() const
+ std::vector<std::string> const& GetSupportedGlobalGenerators() const
{
return this->SupportedGlobalGenerators;
}
@@ -47,22 +47,22 @@ public:
* extra generator name
*/
static std::string CreateFullGeneratorName(
- const std::string& globalGenerator, const std::string& extraGenerator);
+ std::string const& globalGenerator, std::string const& extraGenerator);
//! Generate the project files, the Makefiles have already been generated
virtual void Generate() = 0;
- void SetName(const std::string& n) { this->Name = n; }
+ void SetName(std::string const& n) { this->Name = n; }
std::string GetName() const { return this->Name; }
- virtual bool Open(const std::string& bindir, const std::string& projectName,
+ virtual bool Open(std::string const& bindir, std::string const& projectName,
bool dryRun);
protected:
//! Contains the names of the global generators support by this generator.
std::vector<std::string> SupportedGlobalGenerators;
//! the global generator which creates the makefiles
- const cmGlobalGenerator* GlobalGenerator = nullptr;
+ cmGlobalGenerator const* GlobalGenerator = nullptr;
std::string Name;
};
@@ -81,7 +81,7 @@ public:
virtual std::unique_ptr<cmExternalMakefileProjectGenerator>
CreateExternalMakefileProjectGenerator() const = 0;
- void AddSupportedGlobalGenerator(const std::string& base);
+ void AddSupportedGlobalGenerator(std::string const& base);
private:
std::string Name;
@@ -94,8 +94,8 @@ class cmExternalMakefileProjectGeneratorSimpleFactory
: public cmExternalMakefileProjectGeneratorFactory
{
public:
- cmExternalMakefileProjectGeneratorSimpleFactory(const std::string& n,
- const std::string& doc)
+ cmExternalMakefileProjectGeneratorSimpleFactory(std::string const& n,
+ std::string const& doc)
: cmExternalMakefileProjectGeneratorFactory(n, doc)
{
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index bc58447..d6b24a1 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExtraCodeBlocksGenerator.h"
#include <map>
@@ -74,7 +74,7 @@ void cmExtraCodeBlocksGenerator::Generate()
/* create the project file */
void cmExtraCodeBlocksGenerator::CreateProjectFile(
- const std::vector<cmLocalGenerator*>& lgs)
+ std::vector<cmLocalGenerator*> const& lgs)
{
std::string outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string projectName = lgs[0]->GetProjectName();
@@ -97,20 +97,20 @@ struct Tree
std::string path; // only one component of the path
std::vector<Tree> folders;
std::set<std::string> files;
- void InsertPath(const std::vector<std::string>& split,
+ void InsertPath(std::vector<std::string> const& split,
std::vector<std::string>::size_type start,
- const std::string& fileName);
+ std::string const& fileName);
void BuildVirtualFolder(cmXMLWriter& xml) const;
void BuildVirtualFolderImpl(std::string& virtualFolders,
- const std::string& prefix) const;
- void BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const;
- void BuildUnitImpl(cmXMLWriter& xml, const std::string& virtualFolderPath,
- const std::string& fsPath) const;
+ std::string const& prefix) const;
+ void BuildUnit(cmXMLWriter& xml, std::string const& fsPath) const;
+ void BuildUnitImpl(cmXMLWriter& xml, std::string const& virtualFolderPath,
+ std::string const& fsPath) const;
};
-void Tree::InsertPath(const std::vector<std::string>& split,
+void Tree::InsertPath(std::vector<std::string> const& split,
std::vector<std::string>::size_type start,
- const std::string& fileName)
+ std::string const& fileName)
{
if (start == split.size()) {
this->files.insert(fileName);
@@ -152,7 +152,7 @@ void Tree::BuildVirtualFolder(cmXMLWriter& xml) const
}
void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
- const std::string& prefix) const
+ std::string const& prefix) const
{
virtualFolders += "CMake Files\\" + prefix + this->path + "\\;";
for (Tree const& folder : this->folders) {
@@ -160,7 +160,7 @@ void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
}
}
-void Tree::BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const
+void Tree::BuildUnit(cmXMLWriter& xml, std::string const& fsPath) const
{
for (std::string const& f : this->files) {
xml.StartElement("Unit");
@@ -178,8 +178,8 @@ void Tree::BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const
}
void Tree::BuildUnitImpl(cmXMLWriter& xml,
- const std::string& virtualFolderPath,
- const std::string& fsPath) const
+ std::string const& virtualFolderPath,
+ std::string const& fsPath) const
{
for (std::string const& f : this->files) {
xml.StartElement("Unit");
@@ -200,9 +200,9 @@ void Tree::BuildUnitImpl(cmXMLWriter& xml,
}
void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
- const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
+ std::vector<cmLocalGenerator*> const& lgs, std::string const& filename)
{
- const cmMakefile* mf = lgs[0]->GetMakefile();
+ cmMakefile const* mf = lgs[0]->GetMakefile();
cmGeneratedFileStream fout(filename);
if (!fout) {
return;
@@ -225,7 +225,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
continue;
}
- const std::string& relative = cmSystemTools::RelativePath(
+ std::string const& relative = cmSystemTools::RelativePath(
it.second[0]->GetSourceDirectory(), listFile);
std::vector<std::string> split;
cmSystemTools::SplitPath(relative, split, false);
@@ -239,7 +239,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
//
// Also we can disable external (outside the project) files by setting ON
// CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable.
- const bool excludeExternal = it.second[0]->GetMakefile()->IsOn(
+ bool const excludeExternal = it.second[0]->GetMakefile()->IsOn(
"CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES");
if (!split.empty() &&
(!excludeExternal || (relative.find("..") == std::string::npos)) &&
@@ -251,8 +251,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// figure out the compiler
std::string compiler = this->GetCBCompilerId(mf);
- const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
- const std::string& makeArgs =
+ std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::string const& makeArgs =
mf->GetSafeDefinition("CMAKE_CODEBLOCKS_MAKE_ARGUMENTS");
cmXMLWriter xml(fout);
@@ -288,8 +288,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
for (cmLocalGenerator* lg : lgs) {
- const auto& targets = lg->GetGeneratorTargets();
- for (const auto& target : targets) {
+ auto const& targets = lg->GetGeneratorTargets();
+ for (auto const& target : targets) {
std::string targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
@@ -346,8 +346,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
for (cmLocalGenerator* lg : lgs) {
cmMakefile* makefile = lg->GetMakefile();
- const auto& targets = lg->GetGeneratorTargets();
- for (const auto& target : targets) {
+ auto const& targets = lg->GetGeneratorTargets();
+ for (auto const& target : targets) {
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
@@ -379,11 +379,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
std::string const& fullPath = s->ResolveFullPath();
// Check file position relative to project root dir.
- const std::string relative =
+ std::string const relative =
cmSystemTools::RelativePath(lg->GetSourceDirectory(), fullPath);
// Do not add this file if it has ".." in relative path and
// if CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable is on.
- const bool excludeExternal = lg->GetMakefile()->IsOn(
+ bool const excludeExternal = lg->GetMakefile()->IsOn(
"CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES");
if (excludeExternal &&
(relative.find("..") != std::string::npos)) {
@@ -483,9 +483,9 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
// Generate the xml code for one target.
void cmExtraCodeBlocksGenerator::AppendTarget(
- cmXMLWriter& xml, const std::string& targetName, cmGeneratorTarget* target,
- const std::string& make, const cmLocalGenerator* lg,
- const std::string& compiler, const std::string& makeFlags)
+ cmXMLWriter& xml, std::string const& targetName, cmGeneratorTarget* target,
+ std::string const& make, cmLocalGenerator const* lg,
+ std::string const& compiler, std::string const& makeFlags)
{
cmMakefile const* makefile = lg->GetMakefile();
std::string makefileName =
@@ -626,7 +626,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
}
// Translate the cmake compiler id into the CodeBlocks compiler id
-std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
+std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(cmMakefile const* mf)
{
// allow the user to overwrite the detected compiler
std::string userCompiler =
@@ -719,8 +719,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target)
// Create the command line for building the given target using the selected
// make
std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
- const std::string& make, const std::string& makefile,
- const std::string& target, const std::string& makeFlags)
+ std::string const& make, std::string const& makefile,
+ std::string const& target, std::string const& makeFlags)
{
std::string command = make;
if (!makeFlags.empty()) {
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index cada5dd..38ffc79 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,24 +29,24 @@ public:
private:
struct CbpUnit
{
- std::vector<const cmGeneratorTarget*> Targets;
+ std::vector<cmGeneratorTarget const*> Targets;
};
- void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
+ void CreateProjectFile(std::vector<cmLocalGenerator*> const& lgs);
- void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
- const std::string& filename);
+ void CreateNewProjectFile(std::vector<cmLocalGenerator*> const& lgs,
+ std::string const& filename);
std::string CreateDummyTargetFile(cmLocalGenerator* lg,
cmGeneratorTarget* target) const;
- std::string GetCBCompilerId(const cmMakefile* mf);
+ std::string GetCBCompilerId(cmMakefile const* mf);
int GetCBTargetType(cmGeneratorTarget* target);
- std::string BuildMakeCommand(const std::string& make,
- const std::string& makefile,
- const std::string& target,
- const std::string& makeFlags);
- void AppendTarget(cmXMLWriter& xml, const std::string& targetName,
- cmGeneratorTarget* target, const std::string& make,
- const cmLocalGenerator* lg, const std::string& compiler,
- const std::string& makeFlags);
+ std::string BuildMakeCommand(std::string const& make,
+ std::string const& makefile,
+ std::string const& target,
+ std::string const& makeFlags);
+ void AppendTarget(cmXMLWriter& xml, std::string const& targetName,
+ cmGeneratorTarget* target, std::string const& make,
+ cmLocalGenerator const* lg, std::string const& compiler,
+ std::string const& makeFlags);
};
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 5d2b045..7538a75 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExtraCodeLiteGenerator.h"
#include <cstring>
@@ -55,7 +55,7 @@ void cmExtraCodeLiteGenerator::Generate()
std::string workspaceFileName;
std::string workspaceSourcePath;
- const std::map<std::string, std::vector<cmLocalGenerator*>>& projectMap =
+ std::map<std::string, std::vector<cmLocalGenerator*>> const& projectMap =
this->GlobalGenerator->GetProjectMap();
// loop projects and locate the root project.
@@ -63,7 +63,7 @@ void cmExtraCodeLiteGenerator::Generate()
// root makefile
for (auto const& it : projectMap) {
cmLocalGenerator* lg = it.second[0];
- const cmMakefile* mf = lg->GetMakefile();
+ cmMakefile const* mf = lg->GetMakefile();
this->ConfigName = this->GetConfigurationName(mf);
if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) {
@@ -117,9 +117,9 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
{
std::vector<std::string> retval;
// for each target in the workspace create a codelite project
- const auto& lgs = this->GlobalGenerator->GetLocalGenerators();
- for (const auto& lg : lgs) {
- for (const auto& lt : lg->GetGeneratorTargets()) {
+ auto const& lgs = this->GlobalGenerator->GetLocalGenerators();
+ for (auto const& lg : lgs) {
+ for (auto const& lt : lg->GetGeneratorTargets()) {
cmStateEnums::TargetType type = lt->GetType();
std::string const& outputDir = lg->GetCurrentBinaryDirectory();
std::string targetName = lt->GetName();
@@ -181,7 +181,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps(
/* create the project file */
void cmExtraCodeLiteGenerator::CreateProjectFile(
- const std::vector<cmLocalGenerator*>& lgs)
+ std::vector<cmLocalGenerator*> const& lgs)
{
std::string const& outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string projectName = lgs[0]->GetProjectName();
@@ -192,7 +192,7 @@ void cmExtraCodeLiteGenerator::CreateProjectFile(
}
std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
- const cmMakefile* makefile, const cmGeneratorTarget* gt,
+ cmMakefile const* makefile, cmGeneratorTarget const* gt,
std::map<std::string, cmSourceFile*>& cFiles,
std::set<std::string>& otherFiles)
{
@@ -241,9 +241,9 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
}
void cmExtraCodeLiteGenerator::CreateNewProjectFile(
- const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
+ std::vector<cmLocalGenerator*> const& lgs, std::string const& filename)
{
- const cmMakefile* mf = lgs[0]->GetMakefile();
+ cmMakefile const* mf = lgs[0]->GetMakefile();
cmGeneratedFileStream fout(filename);
if (!fout) {
return;
@@ -266,7 +266,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
for (cmLocalGenerator* lg : lgs) {
cmMakefile* makefile = lg->GetMakefile();
- for (const auto& target : lg->GetGeneratorTargets()) {
+ for (auto const& target : lg->GetGeneratorTargets()) {
projectType =
this->CollectSourceFiles(makefile, target.get(), cFiles, otherFiles);
}
@@ -287,7 +287,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles(
std::set<std::string>& otherFiles)
{
- const std::vector<std::string>& headerExts =
+ std::vector<std::string> const& headerExts =
this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
// The following loop tries to add header files matching to implementation
@@ -320,7 +320,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles(
void cmExtraCodeLiteGenerator::CreateFoldersAndFiles(
std::set<std::string>& cFiles, cmXMLWriter& xml,
- const std::string& projectPath)
+ std::string const& projectPath)
{
std::vector<std::string> tmp_path;
std::vector<std::string> components;
@@ -386,7 +386,7 @@ void cmExtraCodeLiteGenerator::CreateFoldersAndFiles(
void cmExtraCodeLiteGenerator::CreateFoldersAndFiles(
std::map<std::string, cmSourceFile*>& cFiles, cmXMLWriter& xml,
- const std::string& projectPath)
+ std::string const& projectPath)
{
std::set<std::string> s;
for (auto const& it : cFiles) {
@@ -398,8 +398,8 @@ void cmExtraCodeLiteGenerator::CreateFoldersAndFiles(
void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
std::map<std::string, cmSourceFile*>& cFiles,
std::set<std::string>& otherFiles, cmXMLWriter* _xml,
- const std::string& projectPath, const cmMakefile* mf,
- const std::string& projectType, const std::string& targetName)
+ std::string const& projectPath, cmMakefile const* mf,
+ std::string const& projectType, std::string const& targetName)
{
cmXMLWriter& xml(*_xml);
this->FindMatchingHeaderfiles(cFiles, otherFiles);
@@ -537,9 +537,9 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
}
void cmExtraCodeLiteGenerator::CreateNewProjectFile(
- const cmGeneratorTarget* gt, const std::string& filename)
+ cmGeneratorTarget const* gt, std::string const& filename)
{
- const cmMakefile* mf = gt->Makefile;
+ cmMakefile const* mf = gt->Makefile;
cmGeneratedFileStream fout(filename);
if (!fout) {
return;
@@ -584,7 +584,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
}
std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(
- const cmMakefile* mf) const
+ cmMakefile const* mf) const
{
// figure out which language to use
// for now care only for C and C++
@@ -610,7 +610,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(
}
std::string cmExtraCodeLiteGenerator::GetConfigurationName(
- const cmMakefile* mf) const
+ cmMakefile const* mf) const
{
std::string confName = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Trim the configuration name from whitespaces (left and right)
@@ -623,10 +623,10 @@ std::string cmExtraCodeLiteGenerator::GetConfigurationName(
}
std::string cmExtraCodeLiteGenerator::GetBuildCommand(
- const cmMakefile* mf, const std::string& targetName) const
+ cmMakefile const* mf, std::string const& targetName) const
{
- const std::string& generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
- const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::string const& generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
+ std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand = make; // Default
std::ostringstream ss;
if (generator == "NMake Makefiles" || generator == "Ninja") {
@@ -645,7 +645,7 @@ std::string cmExtraCodeLiteGenerator::GetBuildCommand(
}
std::string cmExtraCodeLiteGenerator::GetCleanCommand(
- const cmMakefile* mf, const std::string& targetName) const
+ cmMakefile const* mf, std::string const& targetName) const
{
std::string generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
std::ostringstream ss;
@@ -659,18 +659,18 @@ std::string cmExtraCodeLiteGenerator::GetCleanCommand(
}
std::string cmExtraCodeLiteGenerator::GetRebuildCommand(
- const cmMakefile* mf, const std::string& targetName) const
+ cmMakefile const* mf, std::string const& targetName) const
{
return this->GetCleanCommand(mf, targetName) + " && " +
this->GetBuildCommand(mf, targetName);
}
std::string cmExtraCodeLiteGenerator::GetSingleFileBuildCommand(
- const cmMakefile* mf) const
+ cmMakefile const* mf) const
{
std::string buildCommand;
- const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
- const std::string& generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
+ std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::string const& generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
if (generator == "Unix Makefiles" || generator == "MinGW Makefiles") {
std::ostringstream ss;
#if defined(_WIN32)
diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h
index 2bb1c04..a1d8e90 100644
--- a/Source/cmExtraCodeLiteGenerator.h
+++ b/Source/cmExtraCodeLiteGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,19 +24,19 @@ protected:
std::string WorkspacePath;
unsigned int CpuCount = 2;
- std::string GetCodeLiteCompilerName(const cmMakefile* mf) const;
- std::string GetConfigurationName(const cmMakefile* mf) const;
- std::string GetBuildCommand(const cmMakefile* mf,
- const std::string& targetName) const;
- std::string GetCleanCommand(const cmMakefile* mf,
- const std::string& targetName) const;
- std::string GetRebuildCommand(const cmMakefile* mf,
- const std::string& targetName) const;
- std::string GetSingleFileBuildCommand(const cmMakefile* mf) const;
+ std::string GetCodeLiteCompilerName(cmMakefile const* mf) const;
+ std::string GetConfigurationName(cmMakefile const* mf) const;
+ std::string GetBuildCommand(cmMakefile const* mf,
+ std::string const& targetName) const;
+ std::string GetCleanCommand(cmMakefile const* mf,
+ std::string const& targetName) const;
+ std::string GetRebuildCommand(cmMakefile const* mf,
+ std::string const& targetName) const;
+ std::string GetSingleFileBuildCommand(cmMakefile const* mf) const;
std::vector<std::string> CreateProjectsByTarget(cmXMLWriter* xml);
std::vector<std::string> CreateProjectsByProjectMaps(cmXMLWriter* xml);
- std::string CollectSourceFiles(const cmMakefile* makefile,
- const cmGeneratorTarget* gt,
+ std::string CollectSourceFiles(cmMakefile const* makefile,
+ cmGeneratorTarget const* gt,
std::map<std::string, cmSourceFile*>& cFiles,
std::set<std::string>& otherFiles);
void FindMatchingHeaderfiles(std::map<std::string, cmSourceFile*>& cFiles,
@@ -44,14 +44,14 @@ protected:
void CreateProjectSourceEntries(std::map<std::string, cmSourceFile*>& cFiles,
std::set<std::string>& otherFiles,
cmXMLWriter* xml,
- const std::string& projectPath,
- const cmMakefile* mf,
- const std::string& projectType,
- const std::string& targetName);
+ std::string const& projectPath,
+ cmMakefile const* mf,
+ std::string const& projectType,
+ std::string const& targetName);
void CreateFoldersAndFiles(std::set<std::string>& cFiles, cmXMLWriter& xml,
- const std::string& projectPath);
+ std::string const& projectPath);
void CreateFoldersAndFiles(std::map<std::string, cmSourceFile*>& cFiles,
- cmXMLWriter& xml, const std::string& projectPath);
+ cmXMLWriter& xml, std::string const& projectPath);
public:
cmExtraCodeLiteGenerator();
@@ -59,10 +59,10 @@ public:
static cmExternalMakefileProjectGeneratorFactory* GetFactory();
void Generate() override;
- void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
+ void CreateProjectFile(std::vector<cmLocalGenerator*> const& lgs);
- void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
- const std::string& filename);
- void CreateNewProjectFile(const cmGeneratorTarget* lg,
- const std::string& filename);
+ void CreateNewProjectFile(std::vector<cmLocalGenerator*> const& lgs,
+ std::string const& filename);
+ void CreateNewProjectFile(cmGeneratorTarget const* lg,
+ std::string const& filename);
};
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 6cba37b..b2deea8 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExtraEclipseCDT4Generator.h"
#include <algorithm>
@@ -30,7 +30,7 @@
#include "cmXMLWriter.h"
#include "cmake.h"
-static void AppendAttribute(cmXMLWriter& xml, const char* keyval)
+static void AppendAttribute(cmXMLWriter& xml, char const* keyval)
{
xml.StartElement("attribute");
xml.Attribute("key", keyval);
@@ -39,7 +39,7 @@ static void AppendAttribute(cmXMLWriter& xml, const char* keyval)
}
template <typename T>
-void AppendDictionary(cmXMLWriter& xml, const char* key, T const& value)
+void AppendDictionary(cmXMLWriter& xml, char const* key, T const& value)
{
xml.StartElement("dictionary");
xml.Element("key", key);
@@ -102,8 +102,8 @@ void cmExtraEclipseCDT4Generator::EnableLanguage(
void cmExtraEclipseCDT4Generator::Generate()
{
- const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0];
- const cmMakefile* mf = lg->GetMakefile();
+ auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ cmMakefile const* mf = lg->GetMakefile();
std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION");
cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*");
@@ -179,10 +179,10 @@ void cmExtraEclipseCDT4Generator::Generate()
void cmExtraEclipseCDT4Generator::CreateSettingsResourcePrefsFile()
{
- const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
cmMakefile* mf = lg->GetMakefile();
- const std::string filename =
+ std::string const filename =
this->HomeOutputDirectory + "/.settings/org.eclipse.core.resources.prefs";
cmGeneratedFileStream fout(filename);
@@ -202,12 +202,12 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
assert(this->HomeDirectory != this->HomeOutputDirectory);
// set up the project name: <project>-Source@<baseSourcePathName>
- const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
std::string name = cmExtraEclipseCDT4Generator::GenerateProjectName(
lg->GetProjectName(), "Source",
cmExtraEclipseCDT4Generator::GetPathBasename(this->HomeDirectory));
- const std::string filename = this->HomeDirectory + "/.project";
+ std::string const filename = this->HomeDirectory + "/.project";
cmGeneratedFileStream fout(filename);
if (!fout) {
return;
@@ -234,7 +234,7 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
}
void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
- const char* envVar,
+ char const* envVar,
cmLocalGenerator& lg)
{
cmMakefile* mf = lg.GetMakefile();
@@ -243,7 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// figure out which one to use:
std::string envVarValue;
- const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
+ bool const envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
std::string cacheEntryName = cmStrCat("CMAKE_ECLIPSE_ENVVAR_", envVar);
cmValue cacheValue = lg.GetState()->GetInitializedCacheValue(cacheEntryName);
@@ -285,10 +285,10 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
void cmExtraEclipseCDT4Generator::CreateProjectFile()
{
- const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
cmMakefile* mf = lg->GetMakefile();
- const std::string filename = this->HomeOutputDirectory + "/.project";
+ std::string const filename = this->HomeOutputDirectory + "/.project";
cmGeneratedFileStream fout(filename);
if (!fout) {
@@ -475,7 +475,7 @@ void cmExtraEclipseCDT4Generator::WriteGroups(
if (!children.empty()) {
this->WriteGroups(children, linkName, xml);
}
- std::vector<const cmSourceFile*> sFiles = sg.GetSourceFiles();
+ std::vector<cmSourceFile const*> sFiles = sg.GetSourceFiles();
for (cmSourceFile const* file : sFiles) {
std::string const& fullPath = file->GetFullPath();
@@ -496,11 +496,11 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
cmExtraEclipseCDT4Generator::AppendLinkedResource(
xml, linkName, "virtual:/virtual", VirtualFolder);
- for (const auto& lg : this->GlobalGenerator->GetLocalGenerators()) {
+ for (auto const& lg : this->GlobalGenerator->GetLocalGenerators()) {
cmMakefile* makefile = lg->GetMakefile();
- const auto& targets = lg->GetGeneratorTargets();
+ auto const& targets = lg->GetGeneratorTargets();
- for (const auto& target : targets) {
+ for (auto const& target : targets) {
std::string linkName2 = cmStrCat(linkName, '/');
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
@@ -508,7 +508,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
- const char* prefix =
+ char const* prefix =
(target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
: "[lib] ");
linkName2 += prefix;
@@ -543,7 +543,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
}
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
- cmXMLWriter& xml, const std::string& baseDir)
+ cmXMLWriter& xml, std::string const& baseDir)
{
if (!this->GenerateLinkedResources) {
return;
@@ -574,7 +574,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
}
void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
- cmXMLWriter& xml, const std::vector<std::string>& includeDirs,
+ cmXMLWriter& xml, std::vector<std::string> const& includeDirs,
std::set<std::string>& emittedDirs)
{
for (std::string const& inc : includeDirs) {
@@ -607,10 +607,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{
std::set<std::string> emitted;
- const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0];
- const cmMakefile* mf = lg->GetMakefile();
+ auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ cmMakefile const* mf = lg->GetMakefile();
- const std::string filename = this->HomeOutputDirectory + "/.cproject";
+ std::string const filename = this->HomeOutputDirectory + "/.cproject";
cmGeneratedFileStream fout(filename);
if (!fout) {
@@ -626,7 +626,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
xml.StartElement("storageModule");
xml.Attribute("moduleId", "org.eclipse.cdt.core.settings");
- xml.StartElement("cconfiguration");
+ xml.StartElement("cconfiguration"); // noqa: spellcheck disable-line
xml.Attribute("id", "org.eclipse.cdt.core.default.config.1");
// Configuration settings...
@@ -753,7 +753,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// add pre-processor definitions to allow eclipse to gray out sections
emitted.clear();
- for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) {
+ for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) {
if (cmValue cdefs =
lgen->GetMakefile()->GetProperty("COMPILE_DEFINITIONS")) {
@@ -860,9 +860,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// include dirs
emitted.clear();
- for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) {
- const auto& targets = lgen->GetGeneratorTargets();
- for (const auto& target : targets) {
+ for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) {
+ auto const& targets = lgen->GetGeneratorTargets();
+ for (auto const& target : targets) {
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
@@ -897,8 +897,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
xml.Attribute("moduleId", "org.eclipse.cdt.make.core.buildtargets");
xml.StartElement("buildTargets");
emitted.clear();
- const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
- const std::string& makeArgs =
+ std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::string const& makeArgs =
mf->GetSafeDefinition("CMAKE_ECLIPSE_MAKE_ARGUMENTS");
cmGlobalGenerator* generator =
@@ -915,15 +915,15 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
- for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) {
- const auto& targets = lgen->GetGeneratorTargets();
+ for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) {
+ auto const& targets = lgen->GetGeneratorTargets();
std::string subdir =
lgen->MaybeRelativeToTopBinDir(lgen->GetCurrentBinaryDirectory());
if (subdir == ".") {
subdir.clear();
}
- for (const auto& target : targets) {
+ for (auto const& target : targets) {
std::string targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
@@ -954,7 +954,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
- const char* prefix =
+ char const* prefix =
(target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
: "[lib] ");
cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make,
@@ -1002,7 +1002,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::vector<std::string> objectFileTargets;
lg->GetIndividualFileTargets(objectFileTargets);
for (std::string const& f : objectFileTargets) {
- const char* prefix = "[obj] ";
+ char const* prefix = "[obj] ";
if (f.back() == 's') {
prefix = "[to asm] ";
} else if (f.back() == 'i') {
@@ -1018,7 +1018,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
cmExtraEclipseCDT4Generator::AppendStorageScanners(xml, *mf);
+ // noqa: spellcheck off
xml.EndElement(); // cconfiguration
+ // noqa: spellcheck on
xml.EndElement(); // storageModule
xml.StartElement("storageModule");
@@ -1042,7 +1044,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
std::string cmExtraEclipseCDT4Generator::GetEclipsePath(
- const std::string& path)
+ std::string const& path)
{
#if defined(__CYGWIN__)
std::string cmd = "cygpath -m " + path;
@@ -1059,7 +1061,7 @@ std::string cmExtraEclipseCDT4Generator::GetEclipsePath(
}
std::string cmExtraEclipseCDT4Generator::GetPathBasename(
- const std::string& path)
+ std::string const& path)
{
std::string outputBasename = path;
while (!outputBasename.empty() &&
@@ -1075,17 +1077,17 @@ std::string cmExtraEclipseCDT4Generator::GetPathBasename(
}
std::string cmExtraEclipseCDT4Generator::GenerateProjectName(
- const std::string& name, const std::string& type, const std::string& path)
+ std::string const& name, std::string const& type, std::string const& path)
{
return name + (type.empty() ? "" : "-") + type + "@" + path;
}
// Helper functions
void cmExtraEclipseCDT4Generator::AppendStorageScanners(
- cmXMLWriter& xml, const cmMakefile& makefile)
+ cmXMLWriter& xml, cmMakefile const& makefile)
{
// we need the "make" and the C (or C++) compiler which are used, Alex
- const std::string& make =
+ std::string const& make =
makefile.GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string compiler = makefile.GetSafeDefinition("CMAKE_C_COMPILER");
std::string arg1 = makefile.GetSafeDefinition("CMAKE_C_COMPILER_ARG1");
@@ -1135,9 +1137,9 @@ void cmExtraEclipseCDT4Generator::AppendStorageScanners(
// without it, "asm" would be the first targets in the list, with the "to"
// they are the last targets, which makes more sense.
void cmExtraEclipseCDT4Generator::AppendTarget(
- cmXMLWriter& xml, const std::string& target, const std::string& make,
- const std::string& makeArgs, const std::string& path, const char* prefix,
- const char* makeTarget)
+ cmXMLWriter& xml, std::string const& target, std::string const& make,
+ std::string const& makeArgs, std::string const& path, char const* prefix,
+ char const* makeTarget)
{
xml.StartElement("target");
xml.Attribute("name", prefix + target);
@@ -1153,10 +1155,10 @@ void cmExtraEclipseCDT4Generator::AppendTarget(
}
void cmExtraEclipseCDT4Generator::AppendScannerProfile(
- cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled,
- const std::string& openActionFilePath, bool pParserEnabled,
- const std::string& scannerInfoProviderID,
- const std::string& runActionArguments, const std::string& runActionCommand,
+ cmXMLWriter& xml, std::string const& profileID, bool openActionEnabled,
+ std::string const& openActionFilePath, bool pParserEnabled,
+ std::string const& scannerInfoProviderID,
+ std::string const& runActionArguments, std::string const& runActionCommand,
bool runActionUseDefault, bool sipParserEnabled)
{
xml.StartElement("profile");
@@ -1188,11 +1190,11 @@ void cmExtraEclipseCDT4Generator::AppendScannerProfile(
}
void cmExtraEclipseCDT4Generator::AppendLinkedResource(cmXMLWriter& xml,
- const std::string& name,
- const std::string& path,
+ std::string const& name,
+ std::string const& path,
LinkType linkType)
{
- const char* locationTag = "location";
+ char const* locationTag = "location";
int typeTag = 2;
if (linkType == VirtualFolder) // ... and not a linked folder
{
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index c4ed577..d59a28a 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -52,44 +52,44 @@ private:
void CreateCProjectFile() const;
// If built with cygwin cmake, convert posix to windows path.
- static std::string GetEclipsePath(const std::string& path);
+ static std::string GetEclipsePath(std::string const& path);
// Extract basename.
- static std::string GetPathBasename(const std::string& path);
+ static std::string GetPathBasename(std::string const& path);
// Generate the project name as: <name>-<type>@<path>
- static std::string GenerateProjectName(const std::string& name,
- const std::string& type,
- const std::string& path);
+ static std::string GenerateProjectName(std::string const& name,
+ std::string const& type,
+ std::string const& path);
// Helper functions
static void AppendStorageScanners(cmXMLWriter& xml,
- const cmMakefile& makefile);
- static void AppendTarget(cmXMLWriter& xml, const std::string& target,
- const std::string& make,
- const std::string& makeArguments,
- const std::string& path, const char* prefix = "",
- const char* makeTarget = nullptr);
+ cmMakefile const& makefile);
+ static void AppendTarget(cmXMLWriter& xml, std::string const& target,
+ std::string const& make,
+ std::string const& makeArguments,
+ std::string const& path, char const* prefix = "",
+ char const* makeTarget = nullptr);
static void AppendScannerProfile(
- cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled,
- const std::string& openActionFilePath, bool pParserEnabled,
- const std::string& scannerInfoProviderID,
- const std::string& runActionArguments, const std::string& runActionCommand,
+ cmXMLWriter& xml, std::string const& profileID, bool openActionEnabled,
+ std::string const& openActionFilePath, bool pParserEnabled,
+ std::string const& scannerInfoProviderID,
+ std::string const& runActionArguments, std::string const& runActionCommand,
bool runActionUseDefault, bool sipParserEnabled);
- static void AppendLinkedResource(cmXMLWriter& xml, const std::string& name,
- const std::string& path, LinkType linkType);
+ static void AppendLinkedResource(cmXMLWriter& xml, std::string const& name,
+ std::string const& path, LinkType linkType);
static void AppendIncludeDirectories(
- cmXMLWriter& xml, const std::vector<std::string>& includeDirs,
+ cmXMLWriter& xml, std::vector<std::string> const& includeDirs,
std::set<std::string>& emittedDirs);
- static void AddEnvVar(std::ostream& out, const char* envVar,
+ static void AddEnvVar(std::ostream& out, char const* envVar,
cmLocalGenerator& lg);
void WriteGroups(std::vector<cmSourceGroup> const& sourceGroups,
std::string& linkName, cmXMLWriter& xml);
- void CreateLinksToSubprojects(cmXMLWriter& xml, const std::string& baseDir);
+ void CreateLinksToSubprojects(cmXMLWriter& xml, std::string const& baseDir);
void CreateLinksForTargets(cmXMLWriter& xml);
std::vector<std::string> SrcLinkedResources;
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 6e6d009..6bb3739 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExtraKateGenerator.h"
#include <cstring>
@@ -44,8 +44,8 @@ cmExternalMakefileProjectGeneratorFactory* cmExtraKateGenerator::GetFactory()
void cmExtraKateGenerator::Generate()
{
- const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0];
- const cmMakefile* mf = lg->GetMakefile();
+ auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ cmMakefile const* mf = lg->GetMakefile();
this->ProjectName = this->GenerateProjectName(
lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(lg->GetBinaryDirectory()));
@@ -58,7 +58,7 @@ void cmExtraKateGenerator::Generate()
}
void cmExtraKateGenerator::CreateKateProjectFile(
- const cmLocalGenerator& lg) const
+ cmLocalGenerator const& lg) const
{
std::string filename = cmStrCat(lg.GetBinaryDirectory(), "/.kateproject");
cmGeneratedFileStream fout(filename);
@@ -77,15 +77,15 @@ void cmExtraKateGenerator::CreateKateProjectFile(
fout << "}\n";
}
-void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg,
+void cmExtraKateGenerator::WriteTargets(cmLocalGenerator const& lg,
cmGeneratedFileStream& fout) const
{
cmMakefile const* mf = lg.GetMakefile();
- const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
- const std::string& makeArgs =
+ std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::string const& makeArgs =
mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS");
std::string const& homeOutputDir = lg.GetBinaryDirectory();
- const auto configs = mf->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+ auto const configs = mf->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
/* clang-format off */
fout <<
@@ -116,12 +116,12 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg,
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
- for (const auto& localGen : this->GlobalGenerator->GetLocalGenerators()) {
- const auto& targets = localGen->GetGeneratorTargets();
- const std::string currentDir = localGen->GetCurrentBinaryDirectory();
+ for (auto const& localGen : this->GlobalGenerator->GetLocalGenerators()) {
+ auto const& targets = localGen->GetGeneratorTargets();
+ std::string const currentDir = localGen->GetCurrentBinaryDirectory();
bool topLevel = (currentDir == localGen->GetBinaryDirectory());
- for (const auto& target : targets) {
+ for (auto const& target : targets) {
std::string const& targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
@@ -194,14 +194,14 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg,
}
void cmExtraKateGenerator::AppendTarget(
- cmGeneratedFileStream& fout, const std::string& target,
- const std::vector<std::string>& configs, const std::string& make,
- const std::string& makeArgs, const std::string& path,
- const std::string& homeOutputDir) const
+ cmGeneratedFileStream& fout, std::string const& target,
+ std::vector<std::string> const& configs, std::string const& make,
+ std::string const& makeArgs, std::string const& path,
+ std::string const& homeOutputDir) const
{
static char JsonSep = ' ';
- for (const std::string& conf : configs) {
+ for (std::string const& conf : configs) {
fout << "\t\t\t" << JsonSep << R"({"name":")" << target
<< ((configs.size() > 1) ? (std::string(":") + conf) : std::string())
<< "\", "
@@ -218,7 +218,7 @@ void cmExtraKateGenerator::AppendTarget(
}
void cmExtraKateGenerator::CreateDummyKateProjectFile(
- const cmLocalGenerator& lg) const
+ cmLocalGenerator const& lg) const
{
std::string filename =
cmStrCat(lg.GetBinaryDirectory(), '/', this->ProjectName, ".kateproject");
@@ -232,15 +232,15 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile(
}
std::string cmExtraKateGenerator::GenerateFilesString(
- const cmLocalGenerator& lg) const
+ cmLocalGenerator const& lg) const
{
- const cmMakefile* mf = lg.GetMakefile();
+ cmMakefile const* mf = lg.GetMakefile();
std::string mode =
cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE"));
- static const std::string gitString = "\"git\": 1 ";
- static const std::string svnString = "\"svn\": 1 ";
- static const std::string hgString = "\"hg\": 1 ";
- static const std::string fossilString = "\"fossil\": 1 ";
+ static std::string const gitString = "\"git\": 1 ";
+ static std::string const svnString = "\"svn\": 1 ";
+ static std::string const hgString = "\"hg\": 1 ";
+ static std::string const fossilString = "\"fossil\": 1 ";
if (mode == "SVN") {
return svnString;
@@ -289,18 +289,18 @@ std::string cmExtraKateGenerator::GenerateFilesString(
std::set<std::string> files;
std::string tmp;
- const auto& lgs = this->GlobalGenerator->GetLocalGenerators();
+ auto const& lgs = this->GlobalGenerator->GetLocalGenerators();
- for (const auto& lgen : lgs) {
+ for (auto const& lgen : lgs) {
cmMakefile* makefile = lgen->GetMakefile();
- const std::vector<std::string>& listFiles = makefile->GetListFiles();
+ std::vector<std::string> const& listFiles = makefile->GetListFiles();
for (std::string const& listFile : listFiles) {
if (listFile.find("/CMakeFiles/") == std::string::npos) {
files.insert(listFile);
}
}
- for (const auto& sf : makefile->GetSourceFiles()) {
+ for (auto const& sf : makefile->GetSourceFiles()) {
if (sf->GetIsGenerated()) {
continue;
}
@@ -310,7 +310,7 @@ std::string cmExtraKateGenerator::GenerateFilesString(
}
}
- const char* sep = "";
+ char const* sep = "";
tmp = "\"list\": [";
for (std::string const& f : files) {
tmp += sep;
@@ -325,14 +325,14 @@ std::string cmExtraKateGenerator::GenerateFilesString(
}
std::string cmExtraKateGenerator::GenerateProjectName(
- const std::string& name, const std::string& type,
- const std::string& path) const
+ std::string const& name, std::string const& type,
+ std::string const& path) const
{
return name + (type.empty() ? "" : "-") + type + '@' + path;
}
std::string cmExtraKateGenerator::GetPathBasename(
- const std::string& path) const
+ std::string const& path) const
{
std::string outputBasename = path;
while (!outputBasename.empty() &&
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 203fa2f..aa87007 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,21 +25,21 @@ public:
void Generate() override;
private:
- void CreateKateProjectFile(const cmLocalGenerator& lg) const;
- void CreateDummyKateProjectFile(const cmLocalGenerator& lg) const;
- void WriteTargets(const cmLocalGenerator& lg,
+ void CreateKateProjectFile(cmLocalGenerator const& lg) const;
+ void CreateDummyKateProjectFile(cmLocalGenerator const& lg) const;
+ void WriteTargets(cmLocalGenerator const& lg,
cmGeneratedFileStream& fout) const;
- void AppendTarget(cmGeneratedFileStream& fout, const std::string& target,
- const std::vector<std::string>& configs,
- const std::string& make, const std::string& makeArgs,
- const std::string& path,
- const std::string& homeOutputDir) const;
-
- std::string GenerateFilesString(const cmLocalGenerator& lg) const;
- std::string GetPathBasename(const std::string& path) const;
- std::string GenerateProjectName(const std::string& name,
- const std::string& type,
- const std::string& path) const;
+ void AppendTarget(cmGeneratedFileStream& fout, std::string const& target,
+ std::vector<std::string> const& configs,
+ std::string const& make, std::string const& makeArgs,
+ std::string const& path,
+ std::string const& homeOutputDir) const;
+
+ std::string GenerateFilesString(cmLocalGenerator const& lg) const;
+ std::string GetPathBasename(std::string const& path) const;
+ std::string GenerateProjectName(std::string const& name,
+ std::string const& type,
+ std::string const& path) const;
std::string ProjectName;
bool UseNinja;
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 37c4a7c..6bdbd9c 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmExtraSublimeTextGenerator.h"
#include <cstring>
@@ -81,35 +81,35 @@ void cmExtraSublimeTextGenerator::Generate()
}
void cmExtraSublimeTextGenerator::CreateProjectFile(
- const std::vector<cmLocalGenerator*>& lgs)
+ std::vector<cmLocalGenerator*> const& lgs)
{
std::string outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string projectName = lgs[0]->GetProjectName();
- const std::string filename =
+ std::string const filename =
outputDir + "/" + projectName + ".sublime-project";
this->CreateNewProjectFile(lgs, filename);
}
void cmExtraSublimeTextGenerator::CreateNewProjectFile(
- const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
+ std::vector<cmLocalGenerator*> const& lgs, std::string const& filename)
{
- const cmMakefile* mf = lgs[0]->GetMakefile();
+ cmMakefile const* mf = lgs[0]->GetMakefile();
cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
- const std::string& sourceRootRelativeToOutput = cmSystemTools::RelativePath(
+ std::string const& sourceRootRelativeToOutput = cmSystemTools::RelativePath(
lgs[0]->GetBinaryDirectory(), lgs[0]->GetSourceDirectory());
// Write the folder entries to the project file
fout << "{\n";
fout << "\t\"folders\":\n\t[\n\t";
if (!sourceRootRelativeToOutput.empty()) {
fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\"";
- const std::string& outputRelativeToSourceRoot =
+ std::string const& outputRelativeToSourceRoot =
cmSystemTools::RelativePath(lgs[0]->GetSourceDirectory(),
lgs[0]->GetBinaryDirectory());
if ((!outputRelativeToSourceRoot.empty()) &&
@@ -170,10 +170,10 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
}
void cmExtraSublimeTextGenerator::AppendAllTargets(
- const std::vector<cmLocalGenerator*>& lgs, const cmMakefile* mf,
+ std::vector<cmLocalGenerator*> const& lgs, cmMakefile const* mf,
cmGeneratedFileStream& fout, MapSourceFileFlags& sourceFileFlags)
{
- const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string compiler;
if (!lgs.empty()) {
this->AppendTarget(fout, "all", lgs[0], nullptr, make.c_str(), mf,
@@ -186,8 +186,8 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
// and UTILITY targets
for (cmLocalGenerator* lg : lgs) {
cmMakefile* makefile = lg->GetMakefile();
- const auto& targets = lg->GetGeneratorTargets();
- for (const auto& target : targets) {
+ auto const& targets = lg->GetGeneratorTargets();
+ for (auto const& target : targets) {
std::string targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
@@ -236,9 +236,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
}
void cmExtraSublimeTextGenerator::AppendTarget(
- cmGeneratedFileStream& fout, const std::string& targetName,
- cmLocalGenerator* lg, cmGeneratorTarget* target, const char* make,
- const cmMakefile* makefile, const char* /*compiler*/,
+ cmGeneratedFileStream& fout, std::string const& targetName,
+ cmLocalGenerator* lg, cmGeneratorTarget* target, char const* make,
+ cmMakefile const* makefile, char const* /*compiler*/,
MapSourceFileFlags& sourceFileFlags, bool firstTarget)
{
@@ -266,7 +266,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(
cmsys::RegularExpression flagRegex;
// Regular expression to extract compiler flags from a string
// https://gist.github.com/3944250
- const char* regexString =
+ char const* regexString =
R"((^|[ ])-[DIOUWfgs][^= ]+(=\"[^"]+\"|=[^"][^ ]+)?)";
flagRegex.compile(regexString);
std::string workString =
@@ -311,8 +311,8 @@ void cmExtraSublimeTextGenerator::AppendTarget(
// Create the command line for building the given target using the selected
// make
std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
- const std::string& make, const std::string& makefile,
- const std::string& target)
+ std::string const& make, std::string const& makefile,
+ std::string const& target)
{
std::string command = cmStrCat('"', make, '"');
std::string generator = this->GlobalGenerator->GetName();
@@ -365,12 +365,12 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
cmGeneratorExpressionInterpreter genexInterpreter(lg, config, gtgt,
language);
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
if (cmValue cflags = source->GetProperty(COMPILE_FLAGS)) {
lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
}
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
if (cmValue coptions = source->GetProperty(COMPILE_OPTIONS)) {
lg->AppendCompileOptions(
flags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS));
@@ -387,14 +387,14 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
{
std::set<std::string> defines;
cmMakefile* makefile = lg->GetMakefile();
- const std::string& language = source->GetOrDetermineLanguage();
- const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ std::string const& language = source->GetOrDetermineLanguage();
+ std::string const& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target,
language);
// Add preprocessor definitions for this target and configuration.
lg->GetTargetDefines(target, config, language, defines);
- const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (cmValue compile_defs = source->GetProperty(COMPILE_DEFINITIONS)) {
lg->AppendDefines(
defines, genexInterpreter.Evaluate(*compile_defs, COMPILE_DEFINITIONS));
@@ -420,13 +420,13 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes(
{
std::vector<std::string> includes;
cmMakefile* makefile = lg->GetMakefile();
- const std::string& language = source->GetOrDetermineLanguage();
- const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ std::string const& language = source->GetOrDetermineLanguage();
+ std::string const& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target,
language);
// Add include directories for this source file
- const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (cmValue cincludes = source->GetProperty(INCLUDE_DIRECTORIES)) {
lg->AppendIncludeDirectories(
includes, genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES),
@@ -442,8 +442,8 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes(
return includesString;
}
-bool cmExtraSublimeTextGenerator::Open(const std::string& bindir,
- const std::string& projectName,
+bool cmExtraSublimeTextGenerator::Open(std::string const& bindir,
+ std::string const& projectName,
bool dryRun)
{
cmValue sublExecutable =
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 671b65a..c429504 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,30 +29,30 @@ public:
void Generate() override;
private:
- void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
+ void CreateProjectFile(std::vector<cmLocalGenerator*> const& lgs);
- void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
- const std::string& filename);
+ void CreateNewProjectFile(std::vector<cmLocalGenerator*> const& lgs,
+ std::string const& filename);
/** Appends all targets as build systems to the project file and get all
* include directories and compiler definitions used.
*/
- void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
- const cmMakefile* mf, cmGeneratedFileStream& fout,
+ void AppendAllTargets(std::vector<cmLocalGenerator*> const& lgs,
+ cmMakefile const* mf, cmGeneratedFileStream& fout,
MapSourceFileFlags& sourceFileFlags);
/** Returns the build command that needs to be executed to build the
* specified target.
*/
- std::string BuildMakeCommand(const std::string& make,
- const std::string& makefile,
- const std::string& target);
+ std::string BuildMakeCommand(std::string const& make,
+ std::string const& makefile,
+ std::string const& target);
/** Appends the specified target to the generated project file as a Sublime
* Text build system.
*/
- void AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName,
+ void AppendTarget(cmGeneratedFileStream& fout, std::string const& targetName,
cmLocalGenerator* lg, cmGeneratorTarget* target,
- const char* make, const cmMakefile* makefile,
- const char* compiler, MapSourceFileFlags& sourceFileFlags,
+ char const* make, cmMakefile const* makefile,
+ char const* compiler, MapSourceFileFlags& sourceFileFlags,
bool firstTarget);
/**
* Compute the flags for compilation of object files for a given @a language.
@@ -68,7 +68,7 @@ private:
std::string ComputeIncludes(cmSourceFile* source, cmLocalGenerator* lg,
cmGeneratorTarget* gtgt);
- bool Open(const std::string& bindir, const std::string& projectName,
+ bool Open(std::string const& bindir, std::string const& projectName,
bool dryRun) override;
bool ExcludeBuildFolder;
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 373a3cf..bfca378 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFLTKWrapUICommand.h"
#include <cstddef>
@@ -23,7 +23,7 @@ class cmListFileBacktrace;
class cmTarget;
static void FinalAction(cmMakefile& makefile, std::string const& name,
- const cmListFileBacktrace& lfbt)
+ cmListFileBacktrace const& lfbt)
{
// people should add the srcs to the target themselves, but the old command
// didn't support that, so check and see if they added the files in and if
@@ -131,7 +131,7 @@ bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
mf.AddDefinition(varName, sourceListValue);
mf.AddGeneratorAction(
- [target](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
+ [target](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt) {
FinalAction(*lg.GetMakefile(), target, lfbt);
});
return true;
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index 7c1fc52..bcf2e52 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFSPermissions.cxx b/Source/cmFSPermissions.cxx
index 4015a51..9ab5510 100644
--- a/Source/cmFSPermissions.cxx
+++ b/Source/cmFSPermissions.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFSPermissions.h"
bool cmFSPermissions::stringToModeT(std::string const& arg,
diff --git a/Source/cmFSPermissions.h b/Source/cmFSPermissions.h
index 78f2240..7c28be3 100644
--- a/Source/cmFSPermissions.h
+++ b/Source/cmFSPermissions.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,29 +12,29 @@ namespace cmFSPermissions {
// Table of permissions flags.
#if defined(_WIN32) && !defined(__CYGWIN__)
-static const mode_t mode_owner_read = S_IREAD;
-static const mode_t mode_owner_write = S_IWRITE;
-static const mode_t mode_owner_execute = S_IEXEC;
-static const mode_t mode_group_read = 040;
-static const mode_t mode_group_write = 020;
-static const mode_t mode_group_execute = 010;
-static const mode_t mode_world_read = 04;
-static const mode_t mode_world_write = 02;
-static const mode_t mode_world_execute = 01;
-static const mode_t mode_setuid = 04000;
-static const mode_t mode_setgid = 02000;
+static mode_t const mode_owner_read = S_IREAD;
+static mode_t const mode_owner_write = S_IWRITE;
+static mode_t const mode_owner_execute = S_IEXEC;
+static mode_t const mode_group_read = 040;
+static mode_t const mode_group_write = 020;
+static mode_t const mode_group_execute = 010;
+static mode_t const mode_world_read = 04;
+static mode_t const mode_world_write = 02;
+static mode_t const mode_world_execute = 01;
+static mode_t const mode_setuid = 04000;
+static mode_t const mode_setgid = 02000;
#else
-static const mode_t mode_owner_read = S_IRUSR;
-static const mode_t mode_owner_write = S_IWUSR;
-static const mode_t mode_owner_execute = S_IXUSR;
-static const mode_t mode_group_read = S_IRGRP;
-static const mode_t mode_group_write = S_IWGRP;
-static const mode_t mode_group_execute = S_IXGRP;
-static const mode_t mode_world_read = S_IROTH;
-static const mode_t mode_world_write = S_IWOTH;
-static const mode_t mode_world_execute = S_IXOTH;
-static const mode_t mode_setuid = S_ISUID;
-static const mode_t mode_setgid = S_ISGID;
+static mode_t const mode_owner_read = S_IRUSR;
+static mode_t const mode_owner_write = S_IWUSR;
+static mode_t const mode_owner_execute = S_IXUSR;
+static mode_t const mode_group_read = S_IRGRP;
+static mode_t const mode_group_write = S_IWGRP;
+static mode_t const mode_group_execute = S_IXGRP;
+static mode_t const mode_world_read = S_IROTH;
+static mode_t const mode_world_write = S_IWOTH;
+static mode_t const mode_world_execute = S_IXOTH;
+static mode_t const mode_setuid = S_ISUID;
+static mode_t const mode_setgid = S_ISGID;
#endif
bool stringToModeT(std::string const& arg, mode_t& permissions);
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index 1f15612..46d610c 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPI.h"
#include <algorithm>
@@ -200,7 +200,28 @@ std::string cmFileAPI::WriteJsonFile(
}
// Compute the final name for the file.
- fileName = prefix + "-" + computeSuffix(tmpFile) + ".json";
+ std::string suffix = computeSuffix(tmpFile);
+ std::string suffixWithExtension = cmStrCat("-", suffix, ".json");
+ fileName = cmStrCat(prefix, suffixWithExtension);
+
+ // Truncate the file name length
+ // eCryptFS has a maximal file name length recommendation of 140
+ size_t const maxFileNameLength = 140;
+ size_t const fileNameLength = fileName.size();
+ if (fileNameLength > maxFileNameLength) {
+ size_t const newHashLength = 20;
+ size_t const newSuffixLength =
+ suffixWithExtension.size() - suffix.size() + newHashLength;
+ size_t const overLength =
+ fileNameLength - maxFileNameLength + newSuffixLength;
+ size_t const startPos = fileNameLength - overLength;
+ std::string const toBeRemoved = fileName.substr(startPos, overLength);
+ suffix = cmCryptoHash(cmCryptoHash::AlgoSHA256)
+ .HashString(toBeRemoved)
+ .substr(0, newHashLength);
+ suffixWithExtension = cmStrCat("-", suffix, ".json");
+ fileName.replace(startPos, overLength, suffixWithExtension);
+ }
// Create the destination.
std::string file = this->APIv1 + "/reply";
@@ -457,10 +478,10 @@ Json::Value const& cmFileAPI::AddReplyIndexObject(Object const& o)
return indexEntry;
}
-const char* cmFileAPI::ObjectKindName(ObjectKind kind)
+char const* cmFileAPI::ObjectKindName(ObjectKind kind)
{
// Keep in sync with ObjectKind enum.
- static const char* objectKindNames[] = {
+ static char const* objectKindNames[] = {
"codemodel", //
"configureLog", //
"cache", //
@@ -746,7 +767,7 @@ std::string cmFileAPI::NoSupportedVersion(
// The "codemodel" object kind.
// Update Help/manual/cmake-file-api.7.rst when updating this constant.
-static unsigned int const CodeModelV2Minor = 7;
+static unsigned int const CodeModelV2Minor = 8;
void cmFileAPI::BuildClientRequestCodeModel(
ClientRequest& r, std::vector<RequestVersion> const& versions)
diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h
index ace19ee..79fc5ad 100644
--- a/Source/cmFileAPI.h
+++ b/Source/cmFileAPI.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -180,7 +180,7 @@ private:
static Json::Value BuildReplyError(std::string const& error);
Json::Value const& AddReplyIndexObject(Object const& o);
- static const char* ObjectKindName(ObjectKind kind);
+ static char const* ObjectKindName(ObjectKind kind);
static std::string ObjectName(Object const& o);
static Json::Value BuildVersion(unsigned int major, unsigned int minor);
diff --git a/Source/cmFileAPICMakeFiles.cxx b/Source/cmFileAPICMakeFiles.cxx
index bc80319..68c13e8 100644
--- a/Source/cmFileAPICMakeFiles.cxx
+++ b/Source/cmFileAPICMakeFiles.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPICMakeFiles.h"
#include <memory>
@@ -76,7 +76,7 @@ Json::Value CMakeFiles::DumpInputs()
cmGlobalGenerator* gg =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator();
- for (const auto& lg : gg->GetLocalGenerators()) {
+ for (auto const& lg : gg->GetLocalGenerators()) {
cmMakefile const* mf = lg->GetMakefile();
for (std::string const& file : mf->GetListFiles()) {
inputs.append(this->DumpInput(file));
diff --git a/Source/cmFileAPICMakeFiles.h b/Source/cmFileAPICMakeFiles.h
index 5b48ed3..06f6ff5 100644
--- a/Source/cmFileAPICMakeFiles.h
+++ b/Source/cmFileAPICMakeFiles.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileAPICache.cxx b/Source/cmFileAPICache.cxx
index ba38ef7..74b3aa5 100644
--- a/Source/cmFileAPICache.cxx
+++ b/Source/cmFileAPICache.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPICache.h"
#include <algorithm>
diff --git a/Source/cmFileAPICache.h b/Source/cmFileAPICache.h
index bd9feeb..dc179fa 100644
--- a/Source/cmFileAPICache.h
+++ b/Source/cmFileAPICache.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index b9daffb..5054021 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPICodemodel.h"
#include <algorithm>
@@ -257,7 +257,7 @@ class CodemodelConfig
struct Project
{
cmStateSnapshot Snapshot;
- static const Json::ArrayIndex NoParentIndex =
+ static Json::ArrayIndex const NoParentIndex =
static_cast<Json::ArrayIndex>(-1);
Json::ArrayIndex ParentIndex = NoParentIndex;
Json::Value ChildIndexes = Json::arrayValue;
@@ -505,9 +505,11 @@ class Target
Json::Value DumpDependencies();
Json::Value DumpDependency(cmTargetDepend const& td);
Json::Value DumpFolder();
- Json::Value DumpLauncher(const char* name, const char* type);
+ Json::Value DumpLauncher(char const* name, char const* type);
Json::Value DumpLaunchers();
+ Json::Value DumpDebugger();
+
public:
Target(cmGeneratorTarget* gt, std::string const& config);
Json::Value Dump();
@@ -542,7 +544,7 @@ Json::Value Codemodel::DumpConfigurations()
Json::Value configurations = Json::arrayValue;
cmGlobalGenerator* gg =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator();
- const auto& makefiles = gg->GetMakefiles();
+ auto const& makefiles = gg->GetMakefiles();
if (!makefiles.empty()) {
std::vector<std::string> const& configs =
makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
@@ -589,7 +591,7 @@ void CodemodelConfig::ProcessDirectories()
// Add directories in forward order to process parents before children.
this->Directories.reserve(localGens.size());
- for (const auto& lg : localGens) {
+ for (auto const& lg : localGens) {
auto directoryIndex =
static_cast<Json::ArrayIndex>(this->Directories.size());
this->Directories.emplace_back();
@@ -608,7 +610,7 @@ void CodemodelConfig::ProcessDirectories()
Directory& d = *di;
// Accumulate the presence of install rules on the way up.
- for (const auto& gen :
+ for (auto const& gen :
d.LocalGenerator->GetMakefile()->GetInstallGenerators()) {
if (!dynamic_cast<cmInstallSubdirectoryGenerator*>(gen.get())) {
d.HasInstallRule = true;
@@ -671,7 +673,7 @@ Json::Value CodemodelConfig::DumpTargets()
std::vector<cmGeneratorTarget*> targetList;
cmGlobalGenerator* gg =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator();
- for (const auto& lg : gg->GetLocalGenerators()) {
+ for (auto const& lg : gg->GetLocalGenerators()) {
cm::append(targetList, lg->GetGeneratorTargets());
}
std::sort(targetList.begin(), targetList.end(),
@@ -701,12 +703,6 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
{
Target t(gt, this->Config);
std::string prefix = "target-" + gt->GetName();
- for (char& c : prefix) {
- // CMP0037 OLD behavior allows slashes in target names. Remove them.
- if (c == '/' || c == '\\') {
- c = '_';
- }
- }
if (!this->Config.empty()) {
prefix += "-" + this->Config;
}
@@ -893,7 +889,7 @@ Json::Value DirectoryObject::DumpPaths()
Json::Value DirectoryObject::DumpInstallers()
{
Json::Value installers = Json::arrayValue;
- for (const auto& gen : this->LG->GetMakefile()->GetInstallGenerators()) {
+ for (auto const& gen : this->LG->GetMakefile()->GetInstallGenerators()) {
Json::Value installer = this->DumpInstaller(gen.get());
if (!installer.empty()) {
installers.append(std::move(installer)); // NOLINT(*)
@@ -1273,6 +1269,11 @@ Json::Value Target::Dump()
target["backtraceGraph"] = this->Backtraces.Dump();
+ Json::Value debugger = this->DumpDebugger();
+ if (!debugger.isNull()) {
+ target["debugger"] = std::move(debugger);
+ }
+
return target;
}
@@ -1366,12 +1367,12 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
cmGeneratorExpressionInterpreter genexInterpreter(lg, this->Config, this->GT,
fd.Language);
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
if (cmValue cflags = sf->GetProperty(COMPILE_FLAGS)) {
std::string flags = genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS);
fd.Flags.emplace_back(std::move(flags), JBTIndex());
}
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
for (BT<std::string> tmpOpt : sf->GetCompileOptions()) {
tmpOpt.Value = genexInterpreter.Evaluate(tmpOpt.Value, COMPILE_OPTIONS);
// After generator evaluation we need to use the AppendCompileOptions
@@ -1388,8 +1389,8 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
this->GT->GetPchArchs(this->Config, fd.Language);
std::unordered_map<std::string, std::string> pchSources;
- for (const std::string& arch : pchArchs) {
- const std::string pchSource =
+ for (std::string const& arch : pchArchs) {
+ std::string const pchSource =
this->GT->GetPchSource(this->Config, fd.Language, arch);
if (!pchSource.empty()) {
pchSources.insert(std::make_pair(pchSource, arch));
@@ -1421,7 +1422,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
// Add include directories from source file properties.
{
- const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
for (BT<std::string> tmpInclude : sf->GetIncludeDirectories()) {
tmpInclude.Value =
genexInterpreter.Evaluate(tmpInclude.Value, INCLUDE_DIRECTORIES);
@@ -1443,7 +1444,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
}
}
- const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
std::set<BT<std::string>> fileDefines;
for (BT<std::string> tmpDef : sf->GetCompileDefinitions()) {
tmpDef.Value =
@@ -1453,14 +1454,14 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
// so we handle situations where backtrace entries have lists.
std::set<std::string> tmp;
lg->AppendDefines(tmp, tmpDef.Value);
- for (const std::string& i : tmp) {
+ for (std::string const& i : tmp) {
BT<std::string> def(i, tmpDef.Backtrace);
fileDefines.insert(def);
}
}
std::set<std::string> configFileDefines;
- const std::string defPropName =
+ std::string const defPropName =
"COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(this->Config);
if (cmValue config_defs = sf->GetProperty(defPropName)) {
lg->AppendDefines(
@@ -1900,7 +1901,7 @@ Json::Value Target::DumpArtifacts()
this->GT->GetObjectSources(objectSources, this->Config);
std::string const obj_dir = this->GT->GetObjectDirectory(this->Config);
for (cmSourceFile const* sf : objectSources) {
- const std::string& obj = this->GT->GetObjectName(sf);
+ std::string const& obj = this->GT->GetObjectName(sf);
Json::Value artifact = Json::objectValue;
artifact["path"] = RelativeIfUnder(this->TopBuild, obj_dir + obj);
artifacts.append(std::move(artifact)); // NOLINT(*)
@@ -2089,7 +2090,7 @@ Json::Value Target::DumpFolder()
return folder;
}
-Json::Value Target::DumpLauncher(const char* name, const char* type)
+Json::Value Target::DumpLauncher(char const* name, char const* type)
{
cmValue property = this->GT->GetProperty(name);
Json::Value launcher;
@@ -2134,6 +2135,19 @@ Json::Value Target::DumpLaunchers()
}
}
+Json::Value Target::DumpDebugger()
+{
+ Json::Value debuggerInformation;
+ if (cmValue debuggerWorkingDirectory =
+ this->GT->GetGlobalGenerator()->GetDebuggerWorkingDirectory(
+ this->GT)) {
+ debuggerInformation = Json::objectValue;
+ debuggerInformation["workingDirectory"] = *debuggerWorkingDirectory;
+ }
+
+ return debuggerInformation;
+}
+
Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI, unsigned long version)
{
Codemodel codemodel(fileAPI, version);
diff --git a/Source/cmFileAPICodemodel.h b/Source/cmFileAPICodemodel.h
index 263f675..6a3d7b2 100644
--- a/Source/cmFileAPICodemodel.h
+++ b/Source/cmFileAPICodemodel.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileAPICommand.cxx b/Source/cmFileAPICommand.cxx
index d051c9c..ddc78f4 100644
--- a/Source/cmFileAPICommand.cxx
+++ b/Source/cmFileAPICommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-file Copyright.txt or https://cmake.org/licensing for details. */
+file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPICommand.h"
#include <algorithm>
@@ -30,7 +30,7 @@ bool isCharDigit(char ch)
std::string processObjectKindVersions(cmFileAPI& fileApi,
cmFileAPI::ObjectKind objectKind,
cm::string_view keyword,
- const std::vector<std::string>& versions)
+ std::vector<std::string> const& versions)
{
// The "versions" vector is empty only when the keyword was not present.
// It is an error to provide the keyword with no versions after it, and that
@@ -40,8 +40,8 @@ std::string processObjectKindVersions(cmFileAPI& fileApi,
}
// The first supported version listed is what we use
- for (const std::string& ver : versions) {
- const char* vStart = ver.c_str();
+ for (std::string const& ver : versions) {
+ char const* vStart = ver.c_str();
int majorVersion = std::atoi(vStart);
int minorVersion = 0;
std::string::size_type pos = ver.find('.');
@@ -106,7 +106,7 @@ bool handleQueryCommand(std::vector<std::string> const& args,
status.SetError("QUERY subcommand given a non-integer API_VERSION.");
return false;
}
- const int apiVersion = std::atoi(arguments.ApiVersion.c_str());
+ int const apiVersion = std::atoi(arguments.ApiVersion.c_str());
if (apiVersion != 1) {
status.SetError(
cmStrCat("QUERY subcommand given an unsupported API_VERSION \"",
@@ -136,9 +136,9 @@ bool handleQueryCommand(std::vector<std::string> const& args,
};
if (!std::all_of(errors.begin(), errors.end(),
- [](const std::string& s) -> bool { return s.empty(); })) {
+ [](std::string const& s) -> bool { return s.empty(); })) {
std::string message("QUERY subcommand was given invalid arguments:");
- for (const std::string& s : errors) {
+ for (std::string const& s : errors) {
if (!s.empty()) {
message = cmStrCat(message, "\n ", s);
}
diff --git a/Source/cmFileAPICommand.h b/Source/cmFileAPICommand.h
index 28a4571..c9ed094 100644
--- a/Source/cmFileAPICommand.h
+++ b/Source/cmFileAPICommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-file Copyright.txt or https://cmake.org/licensing for details. */
+file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileAPIConfigureLog.cxx b/Source/cmFileAPIConfigureLog.cxx
index ad0997c..8870d77 100644
--- a/Source/cmFileAPIConfigureLog.cxx
+++ b/Source/cmFileAPIConfigureLog.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPIConfigureLog.h"
#include <cm3p/json/value.h>
diff --git a/Source/cmFileAPIConfigureLog.h b/Source/cmFileAPIConfigureLog.h
index deaa403..b290828 100644
--- a/Source/cmFileAPIConfigureLog.h
+++ b/Source/cmFileAPIConfigureLog.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileAPIToolchains.cxx b/Source/cmFileAPIToolchains.cxx
index a51ae20..516aefa 100644
--- a/Source/cmFileAPIToolchains.cxx
+++ b/Source/cmFileAPIToolchains.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileAPIToolchains.h"
#include <memory>
@@ -73,14 +73,14 @@ Json::Value Toolchains::DumpToolchains()
Json::Value Toolchains::DumpToolchain(std::string const& lang)
{
- static const std::vector<ToolchainVariable> CompilerVariables{
+ static std::vector<ToolchainVariable> const CompilerVariables{
{ "path", "COMPILER", false },
{ "id", "COMPILER_ID", false },
{ "version", "COMPILER_VERSION", false },
{ "target", "COMPILER_TARGET", false },
};
- static const std::vector<ToolchainVariable> CompilerImplicitVariables{
+ static std::vector<ToolchainVariable> const CompilerImplicitVariables{
{ "includeDirectories", "IMPLICIT_INCLUDE_DIRECTORIES", true },
{ "linkDirectories", "IMPLICIT_LINK_DIRECTORIES", true },
{ "linkFrameworkDirectories", "IMPLICIT_LINK_FRAMEWORK_DIRECTORIES",
@@ -88,11 +88,11 @@ Json::Value Toolchains::DumpToolchain(std::string const& lang)
{ "linkLibraries", "IMPLICIT_LINK_LIBRARIES", true },
};
- static const ToolchainVariable SourceFileExtensionsVariable{
+ static ToolchainVariable const SourceFileExtensionsVariable{
"sourceFileExtensions", "SOURCE_FILE_EXTENSIONS", true
};
- const auto& mf =
+ auto const& mf =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator()->GetMakefiles()[0];
Json::Value toolchain = Json::objectValue;
toolchain["language"] = lang;
@@ -110,7 +110,7 @@ Json::Value Toolchains::DumpToolchainVariables(
std::vector<ToolchainVariable> const& variables)
{
Json::Value object = Json::objectValue;
- for (const auto& variable : variables) {
+ for (auto const& variable : variables) {
this->DumpToolchainVariable(mf, object, lang, variable);
}
return object;
diff --git a/Source/cmFileAPIToolchains.h b/Source/cmFileAPIToolchains.h
index c188807..b6b48fb 100644
--- a/Source/cmFileAPIToolchains.h
+++ b/Source/cmFileAPIToolchains.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index fccbcc8..d215681 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileCommand.h"
#include <algorithm>
@@ -409,8 +409,6 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
}
have_regex = true;
switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0159)) {
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// store_regex = true
break;
@@ -527,7 +525,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
current_str += static_cast<char>(c);
} else if (encoding == encoding_utf8) {
// Check for UTF-8 encoded string (up to 4 octets)
- static const unsigned char utf8_check_table[3][2] = {
+ static unsigned char const utf8_check_table[3][2] = {
{ 0xE0, 0xC0 },
{ 0xF0, 0xE0 },
{ 0xF8, 0xF0 },
@@ -640,7 +638,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
}
// Encode the result in a CMake list.
- const char* sep = "";
+ char const* sep = "";
std::string output;
for (std::string const& sr : strings) {
// Separate the strings in the output to make it a list.
@@ -679,31 +677,15 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
i++;
cmsys::Glob g;
g.SetRecurse(recurse);
-
- bool explicitFollowSymlinks = false;
- cmPolicies::PolicyStatus policyStatus =
- status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0009);
if (recurse) {
- switch (policyStatus) {
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- g.RecurseThroughSymlinksOff();
- break;
- case cmPolicies::WARN:
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- g.RecurseThroughSymlinksOn();
- break;
- }
+ g.RecurseThroughSymlinksOff();
}
cmake* cm = status.GetMakefile().GetCMakeInstance();
std::vector<std::string> files;
bool configureDepends = false;
bool warnConfigureLate = false;
- bool warnFollowedSymlinks = false;
- const cmake::WorkingMode workingMode = cm->GetWorkingMode();
+ cmake::WorkingMode const workingMode = cm->GetWorkingMode();
while (i != args.end()) {
if (*i == "LIST_DIRECTORIES") {
++i; // skip LIST_DIRECTORIES
@@ -726,7 +708,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
} else if (*i == "FOLLOW_SYMLINKS") {
++i; // skip FOLLOW_SYMLINKS
if (recurse) {
- explicitFollowSymlinks = true;
g.RecurseThroughSymlinksOn();
if (i == args.end()) {
status.SetError(
@@ -809,11 +790,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
}
}
- if (recurse && !explicitFollowSymlinks &&
- g.GetFollowedSymlinkCount() != 0) {
- warnFollowedSymlinks = true;
- }
-
std::vector<std::string>& foundFiles = g.GetFiles();
cm::append(files, foundFiles);
@@ -838,26 +814,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
}
}
- switch (policyStatus) {
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Correct behavior, yay!
- break;
- case cmPolicies::OLD:
- // Probably not really the expected behavior, but the author explicitly
- // asked for the old behavior... no warning.
- case cmPolicies::WARN:
- // Possibly unexpected old behavior *and* we actually traversed
- // symlinks without being explicitly asked to: warn the author.
- if (warnFollowedSymlinks) {
- status.GetMakefile().IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0009));
- }
- break;
- }
-
std::sort(files.begin(), files.end());
files.erase(std::unique(files.begin(), files.end()), files.end());
status.GetMakefile().AddDefinition(variable, cmList::to_string(files));
@@ -920,7 +876,7 @@ bool HandleMakeDirectoryCommand(std::vector<std::string> const& args,
std::string expr;
for (std::string const& arg : argsRange) {
- const std::string* cdir = &arg;
+ std::string const* cdir = &arg;
if (!cmsys::SystemTools::FileIsFullPath(arg)) {
expr =
cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', arg);
@@ -1008,9 +964,9 @@ bool HandleDifferentCommand(std::vector<std::string> const& args,
*/
// Evaluate arguments.
- const char* file_lhs = nullptr;
- const char* file_rhs = nullptr;
- const char* var = nullptr;
+ char const* file_lhs = nullptr;
+ char const* file_rhs = nullptr;
+ char const* var = nullptr;
enum Doing
{
DoingNone,
@@ -1046,7 +1002,7 @@ bool HandleDifferentCommand(std::vector<std::string> const& args,
}
// Compare the files.
- const char* result =
+ char const* result =
cmSystemTools::FilesDiffer(file_lhs, file_rhs) ? "1" : "0";
status.GetMakefile().AddDefinition(var, result);
return true;
@@ -1108,7 +1064,7 @@ bool HandleRPathChangeCommand(std::vector<std::string> const& args,
if (!cmSystemTools::ChangeRPath(file, *oldRPath, *newRPath,
removeEnvironmentRPath, &emsg, &changed)) {
status.SetError(cmStrCat("RPATH_CHANGE could not write new RPATH:\n ",
- *newRPath, "\nto the file:\n ", file, "\n",
+ *newRPath, "\nto the file:\n ", file, '\n',
emsg));
success = false;
}
@@ -1163,7 +1119,7 @@ bool HandleRPathSetCommand(std::vector<std::string> const& args,
if (!cmSystemTools::SetRPath(file, *newRPath, &emsg, &changed)) {
status.SetError(cmStrCat("RPATH_SET could not write new RPATH:\n ",
- *newRPath, "\nto the file:\n ", file, "\n",
+ *newRPath, "\nto the file:\n ", file, '\n',
emsg));
success = false;
}
@@ -1213,7 +1169,7 @@ bool HandleRPathRemoveCommand(std::vector<std::string> const& args,
if (!cmSystemTools::RemoveRPath(file, &emsg, &removed)) {
status.SetError(
cmStrCat("RPATH_REMOVE could not remove RPATH from file: \n ", file,
- "\n", emsg));
+ '\n', emsg));
success = false;
}
if (success) {
@@ -1387,8 +1343,6 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
cmPolicies::PolicyStatus policyStatus =
status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0152);
switch (policyStatus) {
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
break;
case cmPolicies::WARN:
@@ -1407,8 +1361,7 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
auto basePath = cmCMakePath{ *arguments.BaseDirectory };
path = basePath.Append(path);
}
- result = cmSystemTools::GetActualCaseForPath(
- cmSystemTools::GetRealPath(path.String()));
+ result = cmSystemTools::GetRealPath(path.String());
};
std::string realPath;
@@ -1457,9 +1410,9 @@ bool HandleRelativePathCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& outVar = args[1];
- const std::string& directoryName = args[2];
- const std::string& fileName = args[3];
+ std::string const& outVar = args[1];
+ std::string const& directoryName = args[2];
+ std::string const& fileName = args[3];
if (!cmSystemTools::FileIsFullPath(directoryName)) {
std::string errstring =
@@ -1545,7 +1498,7 @@ bool HandleRename(std::vector<std::string> const& args,
break;
}
status.SetError(cmStrCat("RENAME failed to rename\n ", oldname, "\nto\n ",
- newname, "\nbecause: ", err, "\n"));
+ newname, "\nbecause: ", err, '\n'));
return false;
}
@@ -1638,7 +1591,7 @@ bool HandleCopyFile(std::vector<std::string> const& args,
status.GetMakefile().AddDefinition(arguments.Result, err);
} else {
status.SetError(cmStrCat("COPY_FILE failed to copy\n ", oldname,
- "\nto\n ", newname, "\nbecause: ", err, "\n"));
+ "\nto\n ", newname, "\nbecause: ", err, '\n'));
result = false;
}
}
@@ -1686,9 +1639,9 @@ bool HandleRemoveRecurse(std::vector<std::string> const& args,
return HandleRemoveImpl(args, true, status);
}
-std::string ToNativePath(const std::string& path)
+std::string ToNativePath(std::string const& path)
{
- const auto& outPath = cmSystemTools::ConvertToOutputPath(path);
+ auto const& outPath = cmSystemTools::ConvertToOutputPath(path);
if (outPath.size() > 1 && outPath.front() == '\"' &&
outPath.back() == '\"') {
return outPath.substr(1, outPath.size() - 2);
@@ -1696,7 +1649,7 @@ std::string ToNativePath(const std::string& path)
return outPath;
}
-std::string ToCMakePath(const std::string& path)
+std::string ToCMakePath(std::string const& path)
{
auto temp = path;
cmSystemTools::ConvertToUnixSlashes(temp);
@@ -1738,8 +1691,8 @@ bool HandleNativePathCommand(std::vector<std::string> const& args,
#if !defined(CMAKE_BOOTSTRAP)
-const bool TLS_VERIFY_DEFAULT = true;
-const std::string TLS_VERSION_DEFAULT = "1.2";
+bool const TLS_VERIFY_DEFAULT = true;
+std::string const TLS_VERSION_DEFAULT = "1.2";
// Stuff for curl download/upload
using cmFileCommandVectorOfChar = std::vector<char>;
@@ -1749,7 +1702,7 @@ size_t cmWriteToFileCallback(void* ptr, size_t size, size_t nmemb, void* data)
int realsize = static_cast<int>(size * nmemb);
cmsys::ofstream* fout = static_cast<cmsys::ofstream*>(data);
if (fout) {
- const char* chPtr = static_cast<char*>(ptr);
+ char const* chPtr = static_cast<char*>(ptr);
fout->write(chPtr, realsize);
}
return realsize;
@@ -1759,7 +1712,7 @@ size_t cmWriteToMemoryCallback(void* ptr, size_t size, size_t nmemb,
void* data)
{
int realsize = static_cast<int>(size * nmemb);
- const char* chPtr = static_cast<char*>(ptr);
+ char const* chPtr = static_cast<char*>(ptr);
cm::append(*static_cast<cmFileCommandVectorOfChar*>(data), chPtr,
chPtr + realsize);
return realsize;
@@ -1795,17 +1748,17 @@ int cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr,
}
# if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM >= 0x072000
-const CURLoption CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_XFERINFOFUNCTION;
+CURLoption const CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_XFERINFOFUNCTION;
using cm_curl_off_t = curl_off_t;
# else
-const CURLoption CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_PROGRESSFUNCTION;
+CURLoption const CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_PROGRESSFUNCTION;
using cm_curl_off_t = double;
# endif
class cURLProgressHelper
{
public:
- cURLProgressHelper(cmMakefile* mf, const char* text)
+ cURLProgressHelper(cmMakefile* mf, char const* text)
: Makefile(mf)
, Text(text)
{
@@ -1829,7 +1782,7 @@ public:
if (updated) {
status =
- cmStrCat("[", this->Text, " ", this->CurrentPercentage, "% complete]");
+ cmStrCat('[', this->Text, ' ', this->CurrentPercentage, "% complete]");
}
return updated;
@@ -1894,8 +1847,8 @@ public:
}
}
- cURLEasyGuard(const cURLEasyGuard&) = delete;
- cURLEasyGuard& operator=(const cURLEasyGuard&) = delete;
+ cURLEasyGuard(cURLEasyGuard const&) = delete;
+ cURLEasyGuard& operator=(cURLEasyGuard const&) = delete;
void release() { this->Easy = nullptr; }
@@ -2237,7 +2190,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
check_curl_result(res, "DOWNLOAD cannot set TLS/SSL Verify off: ");
}
- for (const auto& range : curl_ranges) {
+ for (auto const& range : curl_ranges) {
std::string curl_range = range.first + '-' +
(range.second.has_value() ? range.second.value() : "");
res = ::curl_easy_setopt(curl, CURLOPT_RANGE, curl_range.c_str());
@@ -2340,7 +2293,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
"set environment variable CMAKE_TLS_VERIFY=0 to suppress it.");
}
status.GetMakefile().AddDefinition(
- statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), "\""));
+ statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), '"'));
}
::curl_global_cleanup();
@@ -2740,7 +2693,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
"set environment variable CMAKE_TLS_VERIFY=0 to suppress it.");
}
status.GetMakefile().AddDefinition(
- statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), "\""));
+ statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), '"'));
}
::curl_global_cleanup();
@@ -2775,11 +2728,11 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
#endif
}
-void AddEvaluationFile(const std::string& inputName,
- const std::string& targetName,
- const std::string& outputExpr,
- const std::string& condition, bool inputIsContent,
- const std::string& newLineCharacter, mode_t permissions,
+void AddEvaluationFile(std::string const& inputName,
+ std::string const& targetName,
+ std::string const& outputExpr,
+ std::string const& condition, bool inputIsContent,
+ std::string const& newLineCharacter, mode_t permissions,
cmExecutionStatus& status)
{
cmListFileBacktrace lfbt = status.GetMakefile().GetBacktrace();
@@ -2857,7 +2810,7 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
status.SetError("GENERATE requires INPUT or CONTENT option.");
return false;
}
- const bool inputIsContent = arguments.ParsedKeywords[1] == "CONTENT"_s;
+ bool const inputIsContent = arguments.ParsedKeywords[1] == "CONTENT"_s;
if (!inputIsContent && arguments.ParsedKeywords[1] != "INPUT") {
status.SetError("Unknown argument to GENERATE subcommand.");
return false;
@@ -2985,7 +2938,7 @@ bool HandleLockCommand(std::vector<std::string> const& args,
release = true;
} else if (args[i] == "GUARD") {
++i;
- const char* merr = "expected FUNCTION, FILE or PROCESS after GUARD";
+ char const* merr = "expected FUNCTION, FILE or PROCESS after GUARD";
if (i >= args.size()) {
status.GetMakefile().IssueMessage(MessageType::FATAL_ERROR, merr);
return false;
@@ -3090,12 +3043,12 @@ bool HandleLockCommand(std::vector<std::string> const& args,
}
}
- const std::string result = fileLockResult.GetOutputMessage();
+ std::string const result = fileLockResult.GetOutputMessage();
if (resultVariable.empty() && !fileLockResult.IsOk()) {
status.GetMakefile().IssueMessage(
MessageType::FATAL_ERROR,
- cmStrCat("error locking file\n \"", path, "\"\n", result, "."));
+ cmStrCat("error locking file\n \"", path, "\"\n", result, '.'));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3132,7 +3085,7 @@ bool HandleTimestampCommand(std::vector<std::string> const& args,
filename);
}
- const std::string& outputVariable = args[argsIndex++];
+ std::string const& outputVariable = args[argsIndex++];
std::string formatString;
if (args.size() > argsIndex && args[argsIndex] != "UTC") {
@@ -3170,9 +3123,9 @@ bool HandleSizeCommand(std::vector<std::string> const& args,
unsigned int argsIndex = 1;
- const std::string& filename = args[argsIndex++];
+ std::string const& filename = args[argsIndex++];
- const std::string& outputVariable = args[argsIndex++];
+ std::string const& outputVariable = args[argsIndex++];
if (!cmSystemTools::FileExists(filename, true)) {
status.SetError(
@@ -3195,8 +3148,8 @@ bool HandleReadSymlinkCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& filename = args[1];
- const std::string& outputVariable = args[2];
+ std::string const& filename = args[1];
+ std::string const& outputVariable = args[2];
std::string result;
if (!cmSystemTools::ReadSymlink(filename, result)) {
@@ -3344,7 +3297,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
platform)) {
status.SetError(
cmStrCat("GET_RUNTIME_DEPENDENCIES is not supported on system \"",
- platform, "\""));
+ platform, '"'));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3411,7 +3364,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
auto argIt = unrecognizedArguments.begin();
if (argIt != unrecognizedArguments.end()) {
- status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\""));
+ status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"'));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3543,7 +3496,7 @@ bool HandleConfigureCommand(std::vector<std::string> const& args,
auto argIt = unrecognizedArguments.begin();
if (argIt != unrecognizedArguments.end()) {
status.SetError(
- cmStrCat("CONFIGURE Unrecognized argument: \"", *argIt, "\""));
+ cmStrCat("CONFIGURE Unrecognized argument: \"", *argIt, '"'));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3598,9 +3551,9 @@ bool HandleConfigureCommand(std::vector<std::string> const& args,
makeFile.AddCMakeOutputFile(outputFile);
// Create output directory
- const std::string::size_type slashPos = outputFile.rfind('/');
+ std::string::size_type const slashPos = outputFile.rfind('/');
if (slashPos != std::string::npos) {
- const std::string path = outputFile.substr(0, slashPos);
+ std::string const path = outputFile.substr(0, slashPos);
cmSystemTools::MakeDirectory(path);
}
@@ -3677,7 +3630,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
auto argIt = unrecognizedArguments.begin();
if (argIt != unrecognizedArguments.end()) {
- status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\""));
+ status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"'));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3687,7 +3640,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
return true;
}
- const char* knownFormats[] = {
+ char const* knownFormats[] = {
"7zip", "gnutar", "pax", "paxr", "raw", "zip"
};
@@ -3699,7 +3652,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
return false;
}
- const char* zipFileFormats[] = { "7zip", "zip" };
+ char const* zipFileFormats[] = { "7zip", "zip" };
if (!parsedArgs.Compression.empty() &&
cm::contains(zipFileFormats, parsedArgs.Format)) {
status.SetError(cmStrCat("archive format ", parsedArgs.Format,
@@ -3806,7 +3759,7 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
auto argIt = unrecognizedArguments.begin();
if (argIt != unrecognizedArguments.end()) {
- status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\""));
+ status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"'));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3831,7 +3784,7 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
if (cmSystemTools::FileIsFullPath(parsedArgs.Destination)) {
destDir = parsedArgs.Destination;
} else {
- destDir = cmStrCat(destDir, "/", parsedArgs.Destination);
+ destDir = cmStrCat(destDir, '/', parsedArgs.Destination);
}
if (!cmSystemTools::MakeDirectory(destDir)) {
@@ -3842,14 +3795,13 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
if (!cmSystemTools::FileIsFullPath(inFile)) {
inFile =
- cmStrCat(cmSystemTools::GetCurrentWorkingDirectory(), "/", inFile);
+ cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(), '/', inFile);
}
}
cmWorkingDirectory workdir(destDir);
if (workdir.Failed()) {
- status.SetError(
- cmStrCat("failed to change working directory to: ", destDir));
+ status.SetError(workdir.GetError());
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -3876,7 +3828,7 @@ bool ValidateAndConvertPermissions(
if (!permissions) {
return true;
}
- for (const auto& i : *permissions) {
+ for (auto const& i : *permissions) {
if (!cmFSPermissions::stringToModeT(i, perms)) {
status.SetError(i + " is an invalid permission specifier");
cmSystemTools::SetFatalErrorOccurred();
@@ -3886,7 +3838,7 @@ bool ValidateAndConvertPermissions(
return true;
}
-bool SetPermissions(const std::string& filename, const mode_t& perms,
+bool SetPermissions(std::string const& filename, mode_t const& perms,
cmExecutionStatus& status)
{
if (!cmSystemTools::SetPermissions(filename, perms)) {
@@ -3966,7 +3918,7 @@ bool HandleChmodCommandImpl(std::vector<std::string> const& args, bool recurse,
if (recurse) {
std::vector<std::string> tempPathEntries;
- for (const auto& i : pathEntries) {
+ for (auto const& i : pathEntries) {
if (cmSystemTools::FileIsDirectory(i)) {
globber.FindFiles(i + "/*");
tempPathEntries = globber.GetFiles();
@@ -3982,7 +3934,7 @@ bool HandleChmodCommandImpl(std::vector<std::string> const& args, bool recurse,
}
// chmod
- for (const auto& i : allPathEntries) {
+ for (auto const& i : allPathEntries) {
if (!(cmSystemTools::FileExists(i) || cmSystemTools::FileIsDirectory(i))) {
status.SetError(cmStrCat("does not exist:\n ", i));
cmSystemTools::SetFatalErrorOccurred();
@@ -3991,7 +3943,7 @@ bool HandleChmodCommandImpl(std::vector<std::string> const& args, bool recurse,
if (cmSystemTools::FileExists(i, true)) {
bool success = true;
- const mode_t& filePermissions =
+ mode_t const& filePermissions =
parsedArgs.FilePermissions ? fperms : perms;
if (filePermissions) {
success = SetPermissions(i, filePermissions, status);
@@ -4003,7 +3955,7 @@ bool HandleChmodCommandImpl(std::vector<std::string> const& args, bool recurse,
else if (cmSystemTools::FileIsDirectory(i)) {
bool success = true;
- const mode_t& directoryPermissions =
+ mode_t const& directoryPermissions =
parsedArgs.DirectoryPermissions ? dperms : perms;
if (directoryPermissions) {
success = SetPermissions(i, directoryPermissions, status);
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index ec9ee47..3e2968b 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileCommand_ReadMacho.cxx b/Source/cmFileCommand_ReadMacho.cxx
index 870b3ca..9f247d5 100644
--- a/Source/cmFileCommand_ReadMacho.cxx
+++ b/Source/cmFileCommand_ReadMacho.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileCommand_ReadMacho.h"
#include "cmArgumentParser.h"
diff --git a/Source/cmFileCommand_ReadMacho.h b/Source/cmFileCommand_ReadMacho.h
index b79e15f..807f6c8 100644
--- a/Source/cmFileCommand_ReadMacho.h
+++ b/Source/cmFileCommand_ReadMacho.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 686162b..c541bb9 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileCopier.h"
@@ -28,7 +28,7 @@
using namespace cmFSPermissions;
-cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name)
+cmFileCopier::cmFileCopier(cmExecutionStatus& status, char const* name)
: Status(status)
, Makefile(&status.GetMakefile())
, Name(name)
@@ -38,13 +38,13 @@ cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name)
cmFileCopier::~cmFileCopier() = default;
cmFileCopier::MatchProperties cmFileCopier::CollectMatchProperties(
- const std::string& file)
+ std::string const& file)
{
// Match rules are case-insensitive on some platforms.
#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
- const std::string file_to_match = cmSystemTools::LowerCase(file);
+ std::string const file_to_match = cmSystemTools::LowerCase(file);
#else
- const std::string& file_to_match = file;
+ std::string const& file_to_match = file;
#endif
// Collect properties from all matching rules.
@@ -63,7 +63,7 @@ cmFileCopier::MatchProperties cmFileCopier::CollectMatchProperties(
return result;
}
-bool cmFileCopier::SetPermissions(const std::string& toFile,
+bool cmFileCopier::SetPermissions(std::string const& toFile,
mode_t permissions)
{
if (permissions) {
@@ -116,7 +116,7 @@ std::string const& cmFileCopier::ToName(std::string const& fromName)
return fromName;
}
-bool cmFileCopier::ReportMissing(const std::string& fromFile)
+bool cmFileCopier::ReportMissing(std::string const& fromFile)
{
// The input file does not exist and installation is not optional.
this->Status.SetError(cmStrCat(this->Name, " cannot find \"", fromFile,
@@ -171,7 +171,7 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
"CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
if (cmNonempty(default_dir_install_permissions)) {
cmList items{ *default_dir_install_permissions };
- for (const auto& arg : items) {
+ for (auto const& arg : items) {
if (!this->CheckPermissions(arg, **mode)) {
this->Status.SetError(
" Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS variable.");
@@ -438,8 +438,8 @@ bool cmFileCopier::Run(std::vector<std::string> const& args)
return true;
}
-bool cmFileCopier::Install(const std::string& fromFile,
- const std::string& toFile)
+bool cmFileCopier::Install(std::string const& fromFile,
+ std::string const& toFile)
{
if (fromFile.empty()) {
this->Status.SetError(
@@ -525,8 +525,8 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile,
return true;
}
-bool cmFileCopier::InstallSymlink(const std::string& fromFile,
- const std::string& toFile)
+bool cmFileCopier::InstallSymlink(std::string const& fromFile,
+ std::string const& toFile)
{
// Read the original symlink.
std::string symlinkTarget;
@@ -589,8 +589,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
return true;
}
-bool cmFileCopier::InstallFile(const std::string& fromFile,
- const std::string& toFile,
+bool cmFileCopier::InstallFile(std::string const& fromFile,
+ std::string const& toFile,
MatchProperties match_properties)
{
// Determine whether we will copy the file.
@@ -647,8 +647,8 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
return this->SetPermissions(toFile, permissions);
}
-bool cmFileCopier::InstallDirectory(const std::string& source,
- const std::string& destination,
+bool cmFileCopier::InstallDirectory(std::string const& source,
+ std::string const& destination,
MatchProperties match_properties)
{
// Inform the user about this directory installation.
@@ -713,7 +713,7 @@ bool cmFileCopier::InstallDirectory(const std::string& source,
if (!source.empty()) {
dir.Load(source);
}
- unsigned long numFiles = static_cast<unsigned long>(dir.GetNumberOfFiles());
+ unsigned long numFiles = dir.GetNumberOfFiles();
for (unsigned long fileNum = 0; fileNum < numFiles; ++fileNum) {
if (!(strcmp(dir.GetFile(fileNum), ".") == 0 ||
strcmp(dir.GetFile(fileNum), "..") == 0)) {
diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h
index 1fd2062..673ae03 100644
--- a/Source/cmFileCopier.h
+++ b/Source/cmFileCopier.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,7 +19,7 @@ class cmMakefile;
// File installation helper class.
struct cmFileCopier
{
- cmFileCopier(cmExecutionStatus& status, const char* name = "COPY");
+ cmFileCopier(cmExecutionStatus& status, char const* name = "COPY");
virtual ~cmFileCopier();
bool Run(std::vector<std::string> const& args);
@@ -27,7 +27,7 @@ struct cmFileCopier
protected:
cmExecutionStatus& Status;
cmMakefile* Makefile;
- const char* Name;
+ char const* Name;
bool Always = false;
cmFileTimeCache FileTimes;
@@ -58,22 +58,22 @@ protected:
std::vector<MatchRule> MatchRules;
// Get the properties from rules matching this input file.
- MatchProperties CollectMatchProperties(const std::string& file);
+ MatchProperties CollectMatchProperties(std::string const& file);
- bool SetPermissions(const std::string& toFile, mode_t permissions);
+ bool SetPermissions(std::string const& toFile, mode_t permissions);
// Translate an argument to a permissions bit.
bool CheckPermissions(std::string const& arg, mode_t& permissions);
bool InstallSymlinkChain(std::string& fromFile, std::string& toFile);
- bool InstallSymlink(const std::string& fromFile, const std::string& toFile);
- virtual bool InstallFile(const std::string& fromFile,
- const std::string& toFile,
+ bool InstallSymlink(std::string const& fromFile, std::string const& toFile);
+ virtual bool InstallFile(std::string const& fromFile,
+ std::string const& toFile,
MatchProperties match_properties);
- bool InstallDirectory(const std::string& source,
- const std::string& destination,
+ bool InstallDirectory(std::string const& source,
+ std::string const& destination,
MatchProperties match_properties);
- virtual bool Install(const std::string& fromFile, const std::string& toFile);
+ virtual bool Install(std::string const& fromFile, std::string const& toFile);
virtual std::string const& ToName(std::string const& fromName);
enum Type
@@ -82,8 +82,8 @@ protected:
TypeDir,
TypeLink
};
- virtual void ReportCopy(const std::string&, Type, bool) {}
- virtual bool ReportMissing(const std::string& fromFile);
+ virtual void ReportCopy(std::string const&, Type, bool) {}
+ virtual bool ReportMissing(std::string const& fromFile);
MatchRule* CurrentMatchRule = nullptr;
bool UseGivenPermissionsFile = false;
diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx
index 5cfb2cf..6d88980 100644
--- a/Source/cmFileInstaller.cxx
+++ b/Source/cmFileInstaller.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileInstaller.h"
@@ -55,7 +55,7 @@ std::string const& cmFileInstaller::ToName(std::string const& fromName)
return this->Rename.empty() ? fromName : this->Rename;
}
-void cmFileInstaller::ReportCopy(const std::string& toFile, Type type,
+void cmFileInstaller::ReportCopy(std::string const& toFile, Type type,
bool copy)
{
if (!this->MessageNever && (copy || !this->MessageLazy)) {
@@ -68,12 +68,12 @@ void cmFileInstaller::ReportCopy(const std::string& toFile, Type type,
this->ManifestAppend(toFile);
}
}
-bool cmFileInstaller::ReportMissing(const std::string& fromFile)
+bool cmFileInstaller::ReportMissing(std::string const& fromFile)
{
return (this->Optional || this->cmFileCopier::ReportMissing(fromFile));
}
-bool cmFileInstaller::Install(const std::string& fromFile,
- const std::string& toFile)
+bool cmFileInstaller::Install(std::string const& fromFile,
+ std::string const& toFile)
{
// Support installing from empty source to make a directory.
if (this->InstallType == cmInstallType_DIRECTORY && fromFile.empty()) {
@@ -82,8 +82,8 @@ bool cmFileInstaller::Install(const std::string& fromFile,
return this->cmFileCopier::Install(fromFile, toFile);
}
-bool cmFileInstaller::InstallFile(const std::string& fromFile,
- const std::string& toFile,
+bool cmFileInstaller::InstallFile(std::string const& fromFile,
+ std::string const& toFile,
MatchProperties match_properties)
{
if (this->InstallMode == cmInstallMode::COPY) {
@@ -228,7 +228,7 @@ bool cmFileInstaller::Parse(std::vector<std::string> const& args)
return false;
}
- static const std::map<cm::string_view, cmInstallMode> install_mode_dict{
+ static std::map<cm::string_view, cmInstallMode> const install_mode_dict{
{ "ABS_SYMLINK"_s, cmInstallMode::ABS_SYMLINK },
{ "ABS_SYMLINK_OR_COPY"_s, cmInstallMode::ABS_SYMLINK_OR_COPY },
{ "REL_SYMLINK"_s, cmInstallMode::REL_SYMLINK },
@@ -351,7 +351,7 @@ bool cmFileInstaller::CheckValue(std::string const& arg)
return true;
}
-bool cmFileInstaller::GetTargetTypeFromString(const std::string& stype)
+bool cmFileInstaller::GetTargetTypeFromString(std::string const& stype)
{
if (stype == "EXECUTABLE") {
this->InstallType = cmInstallType_EXECUTABLE;
diff --git a/Source/cmFileInstaller.h b/Source/cmFileInstaller.h
index 0b6f15d..dec135d 100644
--- a/Source/cmFileInstaller.h
+++ b/Source/cmFileInstaller.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,11 +33,11 @@ protected:
std::string const& ToName(std::string const& fromName) override;
- void ReportCopy(const std::string& toFile, Type type, bool copy) override;
- bool ReportMissing(const std::string& fromFile) override;
- bool Install(const std::string& fromFile,
- const std::string& toFile) override;
- bool InstallFile(const std::string& fromFile, const std::string& toFile,
+ void ReportCopy(std::string const& toFile, Type type, bool copy) override;
+ bool ReportMissing(std::string const& fromFile) override;
+ bool Install(std::string const& fromFile,
+ std::string const& toFile) override;
+ bool InstallFile(std::string const& fromFile, std::string const& toFile,
MatchProperties match_properties) override;
bool Parse(std::vector<std::string> const& args) override;
enum
@@ -49,6 +49,6 @@ protected:
bool CheckKeyword(std::string const& arg) override;
bool CheckValue(std::string const& arg) override;
void DefaultFilePermissions() override;
- bool GetTargetTypeFromString(const std::string& stype);
+ bool GetTargetTypeFromString(std::string const& stype);
bool HandleInstallDestination();
};
diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx
index 548e327..1541bf9 100644
--- a/Source/cmFileLock.cxx
+++ b/Source/cmFileLock.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileLock.h"
#include <cassert>
@@ -14,12 +14,15 @@ cmFileLock::cmFileLock(cmFileLock&& other) noexcept
this->File = other.File;
other.File = (decltype(other.File))-1;
this->Filename = std::move(other.Filename);
+#if defined(_WIN32)
+ this->Overlapped = std::move(other.Overlapped);
+#endif
}
cmFileLock::~cmFileLock()
{
if (!this->Filename.empty()) {
- const cmFileLockResult result = this->Release();
+ cmFileLockResult const result = this->Release();
static_cast<void>(result);
assert(result.IsOk());
}
@@ -30,11 +33,14 @@ cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept
this->File = other.File;
other.File = (decltype(other.File))-1;
this->Filename = std::move(other.Filename);
+#if defined(_WIN32)
+ this->Overlapped = std::move(other.Overlapped);
+#endif
return *this;
}
-cmFileLockResult cmFileLock::Lock(const std::string& filename,
+cmFileLockResult cmFileLock::Lock(std::string const& filename,
unsigned long timeout)
{
if (filename.empty()) {
@@ -66,7 +72,7 @@ cmFileLockResult cmFileLock::Lock(const std::string& filename,
return result;
}
-bool cmFileLock::IsLocked(const std::string& filename) const
+bool cmFileLock::IsLocked(std::string const& filename) const
{
return filename == this->Filename;
}
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 0f2e7d9..73c023f 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -7,6 +7,7 @@
#include <string>
#if defined(_WIN32)
+# include <memory>
using HANDLE = void*;
#endif
@@ -33,7 +34,7 @@ public:
* @brief Lock the file.
* @param timeoutSec Lock timeout. If -1 try until success or fatal error.
*/
- cmFileLockResult Lock(const std::string& filename, unsigned long timeoutSec);
+ cmFileLockResult Lock(std::string const& filename, unsigned long timeoutSec);
/**
* @brief Unlock the file.
@@ -45,7 +46,7 @@ public:
* @details This function helps to find double locks (deadlocks) and to do
* explicit unlocks.
*/
- bool IsLocked(const std::string& filename) const;
+ bool IsLocked(std::string const& filename) const;
private:
cmFileLockResult OpenFile();
@@ -54,6 +55,7 @@ private:
#if defined(_WIN32)
HANDLE File = (HANDLE)-1;
+ std::unique_ptr<struct _OVERLAPPED> Overlapped;
int LockFile(int flags);
#else
int File = -1;
diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index c23a99c..a2f8c43 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileLockPool.h"
#include <algorithm>
@@ -35,7 +35,7 @@ void cmFileLockPool::PopFileScope()
this->FileScopes.pop_back();
}
-cmFileLockResult cmFileLockPool::LockFunctionScope(const std::string& filename,
+cmFileLockResult cmFileLockPool::LockFunctionScope(std::string const& filename,
unsigned long timeoutSec)
{
if (this->IsAlreadyLocked(filename)) {
@@ -47,7 +47,7 @@ cmFileLockResult cmFileLockPool::LockFunctionScope(const std::string& filename,
return this->FunctionScopes.back().Lock(filename, timeoutSec);
}
-cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename,
+cmFileLockResult cmFileLockPool::LockFileScope(std::string const& filename,
unsigned long timeoutSec)
{
if (this->IsAlreadyLocked(filename)) {
@@ -57,7 +57,7 @@ cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename,
return this->FileScopes.back().Lock(filename, timeoutSec);
}
-cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename,
+cmFileLockResult cmFileLockPool::LockProcessScope(std::string const& filename,
unsigned long timeoutSec)
{
if (this->IsAlreadyLocked(filename)) {
@@ -66,17 +66,17 @@ cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename,
return this->ProcessScope.Lock(filename, timeoutSec);
}
-cmFileLockResult cmFileLockPool::Release(const std::string& filename)
+cmFileLockResult cmFileLockPool::Release(std::string const& filename)
{
for (auto& funcScope : this->FunctionScopes) {
- const cmFileLockResult result = funcScope.Release(filename);
+ cmFileLockResult const result = funcScope.Release(filename);
if (!result.IsOk()) {
return result;
}
}
for (auto& fileScope : this->FileScopes) {
- const cmFileLockResult result = fileScope.Release(filename);
+ cmFileLockResult const result = fileScope.Release(filename);
if (!result.IsOk()) {
return result;
}
@@ -85,17 +85,17 @@ cmFileLockResult cmFileLockPool::Release(const std::string& filename)
return this->ProcessScope.Release(filename);
}
-bool cmFileLockPool::IsAlreadyLocked(const std::string& filename) const
+bool cmFileLockPool::IsAlreadyLocked(std::string const& filename) const
{
for (auto const& funcScope : this->FunctionScopes) {
- const bool result = funcScope.IsAlreadyLocked(filename);
+ bool const result = funcScope.IsAlreadyLocked(filename);
if (result) {
return true;
}
}
for (auto const& fileScope : this->FileScopes) {
- const bool result = fileScope.IsAlreadyLocked(filename);
+ bool const result = fileScope.IsAlreadyLocked(filename);
if (result) {
return true;
}
@@ -120,11 +120,11 @@ cmFileLockPool::ScopePool& cmFileLockPool::ScopePool::operator=(
return *this;
}
-cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename,
+cmFileLockResult cmFileLockPool::ScopePool::Lock(std::string const& filename,
unsigned long timeoutSec)
{
cmFileLock lock;
- const cmFileLockResult result = lock.Lock(filename, timeoutSec);
+ cmFileLockResult const result = lock.Lock(filename, timeoutSec);
if (result.IsOk()) {
this->Locks.push_back(std::move(lock));
return cmFileLockResult::MakeOk();
@@ -133,7 +133,7 @@ cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename,
}
cmFileLockResult cmFileLockPool::ScopePool::Release(
- const std::string& filename)
+ std::string const& filename)
{
for (auto& lock : this->Locks) {
if (lock.IsLocked(filename)) {
@@ -144,7 +144,7 @@ cmFileLockResult cmFileLockPool::ScopePool::Release(
}
bool cmFileLockPool::ScopePool::IsAlreadyLocked(
- const std::string& filename) const
+ std::string const& filename) const
{
return std::any_of(this->Locks.begin(), this->Locks.end(),
[&filename](cmFileLock const& lock) -> bool {
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index f2f9f23..7db0e02 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,21 +41,21 @@ public:
* @brief Lock the file in given scope.
* @param timeoutSec Lock timeout. If -1 try until success or fatal error.
*/
- cmFileLockResult LockFunctionScope(const std::string& filename,
+ cmFileLockResult LockFunctionScope(std::string const& filename,
unsigned long timeoutSec);
- cmFileLockResult LockFileScope(const std::string& filename,
+ cmFileLockResult LockFileScope(std::string const& filename,
unsigned long timeoutSec);
- cmFileLockResult LockProcessScope(const std::string& filename,
+ cmFileLockResult LockProcessScope(std::string const& filename,
unsigned long timeoutSec);
//@}
/**
* @brief Unlock the file explicitly.
*/
- cmFileLockResult Release(const std::string& filename);
+ cmFileLockResult Release(std::string const& filename);
private:
- bool IsAlreadyLocked(const std::string& filename) const;
+ bool IsAlreadyLocked(std::string const& filename) const;
class ScopePool
{
@@ -68,10 +68,10 @@ private:
ScopePool& operator=(ScopePool const&) = delete;
ScopePool& operator=(ScopePool&&) noexcept;
- cmFileLockResult Lock(const std::string& filename,
+ cmFileLockResult Lock(std::string const& filename,
unsigned long timeoutSec);
- cmFileLockResult Release(const std::string& filename);
- bool IsAlreadyLocked(const std::string& filename) const;
+ cmFileLockResult Release(std::string const& filename);
+ bool IsAlreadyLocked(std::string const& filename) const;
private:
using List = std::vector<cmFileLock>;
diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx
index cbe4fec..decb383 100644
--- a/Source/cmFileLockResult.cxx
+++ b/Source/cmFileLockResult.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileLockResult.h"
#include <cerrno>
@@ -17,9 +17,9 @@ cmFileLockResult cmFileLockResult::MakeOk()
cmFileLockResult cmFileLockResult::MakeSystem()
{
#if defined(_WIN32)
- const Error lastError = GetLastError();
+ Error const lastError = GetLastError();
#else
- const Error lastError = errno;
+ Error const lastError = errno;
#endif
return { SYSTEM, lastError };
}
@@ -63,7 +63,7 @@ std::string cmFileLockResult::GetOutputMessage() const
if (FormatMessageA(flags, nullptr, this->ErrorValue,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)winmsg, WINMSG_BUF_LEN, nullptr)) {
- const std::string message = winmsg;
+ std::string const message = winmsg;
return message;
} else {
return "Internal error (FormatMessageA failed)";
diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h
index e252de7..d30e0a6 100644
--- a/Source/cmFileLockResult.h
+++ b/Source/cmFileLockResult.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx
index 613c6ee..301342d 100644
--- a/Source/cmFileLockUnix.cxx
+++ b/Source/cmFileLockUnix.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cerrno> // errno
#include <cstdio> // SEEK_SET
@@ -16,7 +16,7 @@ cmFileLockResult cmFileLock::Release()
if (this->Filename.empty()) {
return cmFileLockResult::MakeOk();
}
- const int lockResult = this->LockFile(F_SETLK, F_UNLCK);
+ int const lockResult = this->LockFile(F_SETLK, F_UNLCK);
this->Filename = "";
diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx
index 244ade2..436a5c0 100644
--- a/Source/cmFileLockWin32.cxx
+++ b/Source/cmFileLockWin32.cxx
@@ -1,12 +1,18 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include <windows.h> // CreateFileW
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#include <cm/memory>
+
+#include <windows.h>
#include "cmFileLock.h"
#include "cmSystemTools.h"
+static unsigned long const LOCK_LEN = static_cast<unsigned long>(-1);
+
cmFileLock::cmFileLock()
+ : Overlapped(cm::make_unique<OVERLAPPED>())
{
+ ZeroMemory(this->Overlapped.get(), sizeof(*this->Overlapped));
}
cmFileLockResult cmFileLock::Release()
@@ -14,15 +20,16 @@ cmFileLockResult cmFileLock::Release()
if (this->Filename.empty()) {
return cmFileLockResult::MakeOk();
}
- const unsigned long len = static_cast<unsigned long>(-1);
- static OVERLAPPED overlapped;
const DWORD reserved = 0;
+ ZeroMemory(this->Overlapped.get(), sizeof(*this->Overlapped));
+
const BOOL unlockResult =
- UnlockFileEx(File, reserved, len, len, &overlapped);
+ UnlockFileEx(File, reserved, LOCK_LEN, LOCK_LEN, this->Overlapped.get());
this->Filename = "";
CloseHandle(this->File);
+
this->File = INVALID_HANDLE_VALUE;
if (unlockResult) {
@@ -51,37 +58,63 @@ cmFileLockResult cmFileLock::OpenFile()
cmFileLockResult cmFileLock::LockWithoutTimeout()
{
+ cmFileLockResult lock_result = cmFileLockResult::MakeOk();
if (!this->LockFile(LOCKFILE_EXCLUSIVE_LOCK)) {
- return cmFileLockResult::MakeSystem();
- } else {
- return cmFileLockResult::MakeOk();
+ lock_result = cmFileLockResult::MakeSystem();
}
+ CloseHandle(this->Overlapped->hEvent);
+ return lock_result;
}
cmFileLockResult cmFileLock::LockWithTimeout(unsigned long seconds)
{
+ cmFileLockResult lock_result = cmFileLockResult::MakeOk();
const DWORD flags = LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY;
- while (true) {
- const BOOL result = this->LockFile(flags);
- if (result) {
- return cmFileLockResult::MakeOk();
- }
- const DWORD error = GetLastError();
- if (error != ERROR_LOCK_VIOLATION) {
- return cmFileLockResult::MakeSystem();
- }
- if (seconds == 0) {
- return cmFileLockResult::MakeTimeout();
+ bool in_time = true;
+ while (in_time && !this->LockFile(flags)) {
+ switch (GetLastError()) {
+ case ERROR_INVALID_HANDLE:
+ lock_result = cmFileLockResult::MakeSystem();
+ break;
+ case ERROR_LOCK_VIOLATION:
+ if (seconds == 0) {
+ in_time = false;
+ lock_result = cmFileLockResult::MakeTimeout();
+ continue;
+ }
+ --seconds;
+ cmSystemTools::Delay(1000);
+ continue;
+ case ERROR_IO_PENDING:
+ switch (
+ WaitForSingleObject(this->Overlapped->hEvent, seconds * 1000)) {
+ case WAIT_OBJECT_0:
+ break;
+ case WAIT_TIMEOUT:
+ lock_result = cmFileLockResult::MakeTimeout();
+ break;
+ default:
+ lock_result = cmFileLockResult::MakeSystem();
+ break;
+ }
+ break;
+ default:
+ lock_result = cmFileLockResult::MakeSystem();
+ break;
}
- --seconds;
- cmSystemTools::Delay(1000);
}
+ CloseHandle(this->Overlapped->hEvent);
+ return lock_result;
}
int cmFileLock::LockFile(int flags)
{
const DWORD reserved = 0;
- const unsigned long len = static_cast<unsigned long>(-1);
- static OVERLAPPED overlapped;
- return LockFileEx(this->File, flags, reserved, len, len, &overlapped);
+
+ this->Overlapped->hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ if (this->Overlapped->hEvent == nullptr) {
+ return false;
+ }
+ return LockFileEx(this->File, flags, reserved, LOCK_LEN, LOCK_LEN,
+ this->Overlapped.get());
}
diff --git a/Source/cmFilePathChecksum.cxx b/Source/cmFilePathChecksum.cxx
index 6b52230..0c0c9f9 100644
--- a/Source/cmFilePathChecksum.cxx
+++ b/Source/cmFilePathChecksum.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFilePathChecksum.h"
#include <vector>
diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h
index a6f7bd3..e7f2bf2 100644
--- a/Source/cmFilePathChecksum.h
+++ b/Source/cmFilePathChecksum.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,7 +23,7 @@ class cmFilePathChecksum
{
public:
/// Maximum number of characters to use from the path checksum
- static const size_t partLengthDefault = 10;
+ static size_t const partLengthDefault = 10;
/// @brief Parent directories are empty
cmFilePathChecksum();
diff --git a/Source/cmFileSet.cxx b/Source/cmFileSet.cxx
index a00c10e..066a494 100644
--- a/Source/cmFileSet.cxx
+++ b/Source/cmFileSet.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileSet.h"
#include <sstream>
@@ -155,9 +155,9 @@ cmFileSet::CompileDirectoryEntries() const
}
std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
- const std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>& cges,
- cmLocalGenerator* lg, const std::string& config,
- const cmGeneratorTarget* target,
+ std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> const& cges,
+ cmLocalGenerator* lg, std::string const& config,
+ cmGeneratorTarget const* target,
cmGeneratorExpressionDAGChecker* dagChecker) const
{
struct DirCacheEntry
@@ -178,7 +178,7 @@ std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
auto dirCacheResult = dirCache.emplace(dir, DirCacheEntry());
auto& dirCacheEntry = dirCacheResult.first->second;
- const auto isNewCacheEntry = dirCacheResult.second;
+ auto const isNewCacheEntry = dirCacheResult.second;
if (isNewCacheEntry) {
cmSystemTools::FileId fileId;
@@ -215,11 +215,11 @@ std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
}
void cmFileSet::EvaluateFileEntry(
- const std::vector<std::string>& dirs,
+ std::vector<std::string> const& dirs,
std::map<std::string, std::vector<std::string>>& filesPerDir,
- const std::unique_ptr<cmCompiledGeneratorExpression>& cge,
- cmLocalGenerator* lg, const std::string& config,
- const cmGeneratorTarget* target,
+ std::unique_ptr<cmCompiledGeneratorExpression> const& cge,
+ cmLocalGenerator* lg, std::string const& config,
+ cmGeneratorTarget const* target,
cmGeneratorExpressionDAGChecker* dagChecker) const
{
auto files = cge->Evaluate(lg, config, target, dagChecker);
@@ -255,9 +255,9 @@ void cmFileSet::EvaluateFileEntry(
}
}
-bool cmFileSet::IsValidName(const std::string& name)
+bool cmFileSet::IsValidName(std::string const& name)
{
- static const cmsys::RegularExpression regex("^[a-z0-9][a-zA-Z0-9_]*$");
+ static cmsys::RegularExpression const regex("^[a-z0-9][a-zA-Z0-9_]*$");
cmsys::RegularExpressionMatch match;
return regex.find(name.c_str(), match);
diff --git a/Source/cmFileSet.h b/Source/cmFileSet.h
index 6ad4c9e..1175be8 100644
--- a/Source/cmFileSet.h
+++ b/Source/cmFileSet.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
@@ -39,22 +39,22 @@ public:
cmFileSet(cmake& cmakeInstance, std::string name, std::string type,
cmFileSetVisibility visibility);
- const std::string& GetName() const { return this->Name; }
- const std::string& GetType() const { return this->Type; }
+ std::string const& GetName() const { return this->Name; }
+ std::string const& GetType() const { return this->Type; }
cmFileSetVisibility GetVisibility() const { return this->Visibility; }
void CopyEntries(cmFileSet const* fs);
void ClearDirectoryEntries();
void AddDirectoryEntry(BT<std::string> directories);
- const std::vector<BT<std::string>>& GetDirectoryEntries() const
+ std::vector<BT<std::string>> const& GetDirectoryEntries() const
{
return this->DirectoryEntries;
}
void ClearFileEntries();
void AddFileEntry(BT<std::string> files);
- const std::vector<BT<std::string>>& GetFileEntries() const
+ std::vector<BT<std::string>> const& GetFileEntries() const
{
return this->FileEntries;
}
@@ -66,20 +66,20 @@ public:
CompileDirectoryEntries() const;
std::vector<std::string> EvaluateDirectoryEntries(
- const std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>& cges,
- cmLocalGenerator* lg, const std::string& config,
- const cmGeneratorTarget* target,
+ std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> const& cges,
+ cmLocalGenerator* lg, std::string const& config,
+ cmGeneratorTarget const* target,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
void EvaluateFileEntry(
- const std::vector<std::string>& dirs,
+ std::vector<std::string> const& dirs,
std::map<std::string, std::vector<std::string>>& filesPerDir,
- const std::unique_ptr<cmCompiledGeneratorExpression>& cge,
- cmLocalGenerator* lg, const std::string& config,
- const cmGeneratorTarget* target,
+ std::unique_ptr<cmCompiledGeneratorExpression> const& cge,
+ cmLocalGenerator* lg, std::string const& config,
+ cmGeneratorTarget const* target,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
- static bool IsValidName(const std::string& name);
+ static bool IsValidName(std::string const& name);
private:
cmake& CMakeInstance;
diff --git a/Source/cmFileTime.cxx b/Source/cmFileTime.cxx
index 3d103d3..04a0203 100644
--- a/Source/cmFileTime.cxx
+++ b/Source/cmFileTime.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileTime.h"
#include <string>
diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h
index ccc9633..52ecf50 100644
--- a/Source/cmFileTime.h
+++ b/Source/cmFileTime.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,8 +24,8 @@ public:
#endif
cmFileTime() = default;
~cmFileTime() = default;
- cmFileTime(const cmFileTime&) = default;
- cmFileTime& operator=(const cmFileTime&) = default;
+ cmFileTime(cmFileTime const&) = default;
+ cmFileTime& operator=(cmFileTime const&) = default;
/**
* @brief Loads the file time of fileName from the file system
diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx
index 0d1dae5..235880b 100644
--- a/Source/cmFileTimeCache.cxx
+++ b/Source/cmFileTimeCache.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileTimeCache.h"
#include <string>
diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h
index 336136e..d6204ee 100644
--- a/Source/cmFileTimeCache.h
+++ b/Source/cmFileTimeCache.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,8 +18,8 @@ public:
cmFileTimeCache();
~cmFileTimeCache();
- cmFileTimeCache(const cmFileTimeCache&) = delete;
- cmFileTimeCache& operator=(const cmFileTimeCache&) = delete;
+ cmFileTimeCache(cmFileTimeCache const&) = delete;
+ cmFileTimeCache& operator=(cmFileTimeCache const&) = delete;
/**
* @brief Loads the file time from the cache or the file system.
diff --git a/Source/cmFileTimes.cxx b/Source/cmFileTimes.cxx
index 6835e46..f8a9446 100644
--- a/Source/cmFileTimes.cxx
+++ b/Source/cmFileTimes.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFileTimes.h"
#include <utility>
diff --git a/Source/cmFileTimes.h b/Source/cmFileTimes.h
index 58d24bc..d3ad3f6 100644
--- a/Source/cmFileTimes.h
+++ b/Source/cmFileTimes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 81e081c..a7e00fd 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindBase.h"
#include <algorithm>
@@ -56,7 +56,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
} else if (argsIn[j] == "ENV") {
if (j + 1 < size) {
j++;
- cmSystemTools::GetPath(args, argsIn[j].c_str());
+ std::vector<std::string> p =
+ cmSystemTools::GetEnvPathNormalized(argsIn[j]);
+ std::move(p.begin(), p.end(), std::back_inserter(args));
}
} else {
args.push_back(argsIn[j]);
@@ -131,7 +133,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
newStyle = true;
} else if (args[j] == "REGISTRY_VIEW") {
if (++j == args.size()) {
- this->SetError("missing required argument for \"REGISTRY_VIEW\"");
+ this->SetError("missing required argument for REGISTRY_VIEW");
return false;
}
auto view = cmWindowsRegistry::ToView(args[j]);
@@ -139,30 +141,30 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
this->RegistryView = *view;
} else {
this->SetError(
- cmStrCat("given invalid value for \"REGISTRY_VIEW\": ", args[j]));
+ cmStrCat("given invalid value for REGISTRY_VIEW: ", args[j]));
return false;
}
} else if (args[j] == "VALIDATOR") {
if (++j == args.size()) {
- this->SetError("missing required argument for \"VALIDATOR\"");
+ this->SetError("missing required argument for VALIDATOR");
return false;
}
auto command = this->Makefile->GetState()->GetCommand(args[j]);
if (!command) {
this->SetError(cmStrCat(
- "command specified for \"VALIDATOR\" is undefined: ", args[j], '.'));
+ "command specified for VALIDATOR is undefined: ", args[j], '.'));
return false;
}
// ensure a macro is not specified as validator
- const auto& validatorName = args[j];
+ auto const& validatorName = args[j];
cmList macros{ this->Makefile->GetProperty("MACROS") };
if (std::find_if(macros.begin(), macros.end(),
- [&validatorName](const std::string& item) {
+ [&validatorName](std::string const& item) {
return cmSystemTools::Strucmp(validatorName.c_str(),
item.c_str()) == 0;
}) != macros.end()) {
this->SetError(cmStrCat(
- "command specified for \"VALIDATOR\" is not a function: ", args[j],
+ "command specified for VALIDATOR is not a function: ", args[j],
'.'));
return false;
}
@@ -217,7 +219,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
return true;
}
-bool cmFindBase::Validate(const std::string& path) const
+bool cmFindBase::Validate(std::string const& path) const
{
if (this->ValidatorName.empty()) {
return true;
@@ -338,7 +340,6 @@ namespace {
struct entry_to_remove
{
entry_to_remove(std::string const& name, cmMakefile* makefile)
- : value()
{
if (cmValue to_skip = makefile->GetDefinition(
cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_COUNT"))) {
@@ -355,14 +356,16 @@ struct entry_to_remove
{
if (this->valid()) {
long to_skip = this->count;
- long index_to_remove = 0;
- for (const auto& path : entries) {
+ size_t index_to_remove = 0;
+ for (auto const& path : entries) {
if (path == this->value && --to_skip == 0) {
break;
}
++index_to_remove;
}
- entries.erase(entries.begin() + index_to_remove);
+ if (index_to_remove < entries.size() && to_skip == 0) {
+ entries.erase(entries.begin() + index_to_remove);
+ }
}
}
@@ -375,10 +378,10 @@ void cmFindBase::FillCMakeSystemVariablePath()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem];
- const bool install_prefix_in_list =
+ bool const install_prefix_in_list =
!this->Makefile->IsOn("CMAKE_FIND_NO_INSTALL_PREFIX");
- const bool remove_install_prefix = this->NoCMakeInstallPath;
- const bool add_install_prefix = !this->NoCMakeInstallPath &&
+ bool const remove_install_prefix = this->NoCMakeInstallPath;
+ bool const add_install_prefix = !this->NoCMakeInstallPath &&
this->Makefile->IsDefinitionSet("CMAKE_FIND_USE_INSTALL_PREFIX");
// We have 3 possible states for `CMAKE_SYSTEM_PREFIX_PATH` and
@@ -404,9 +407,11 @@ void cmFindBase::FillCMakeSystemVariablePath()
cmList expanded{ *prefix_paths };
install_entry.remove_self(expanded);
staging_entry.remove_self(expanded);
-
- paths.AddPrefixPaths(expanded,
- this->Makefile->GetCurrentSourceDirectory().c_str());
+ for (std::string& p : expanded) {
+ p = cmSystemTools::CollapseFullPath(
+ p, this->Makefile->GetCurrentSourceDirectory());
+ }
+ paths.AddPrefixPaths(expanded);
} else if (add_install_prefix && !install_prefix_in_list) {
paths.AddCMakePrefixPath("CMAKE_INSTALL_PREFIX");
paths.AddCMakePrefixPath("CMAKE_STAGING_PREFIX");
@@ -459,7 +464,7 @@ bool cmFindBase::CheckForVariableDefined()
if (cached && cacheType != cmStateEnums::UNINITIALIZED) {
this->VariableType = cacheType;
- if (const auto& hs =
+ if (auto const& hs =
state->GetCacheEntryProperty(this->VariableName, "HELPSTRING")) {
this->VariableDocumentation = *hs;
}
@@ -484,7 +489,7 @@ void cmFindBase::NormalizeFindResult()
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) ==
cmPolicies::NEW) {
// ensure the path returned by find_* command is absolute
- const auto& existingValue =
+ auto const& existingValue =
this->Makefile->GetDefinition(this->VariableName);
std::string value;
if (!existingValue->empty()) {
@@ -494,7 +499,6 @@ void cmFindBase::NormalizeFindResult()
this->Makefile->GetCMakeInstance()->GetCMakeWorkingDirectory()))
.Normal()
.GenericString();
- // value = cmSystemTools::CollapseFullPath(*existingValue);
if (!cmSystemTools::FileExists(value, false)) {
value = *existingValue;
}
@@ -551,7 +555,7 @@ void cmFindBase::NormalizeFindResult()
}
}
-void cmFindBase::StoreFindResult(const std::string& value)
+void cmFindBase::StoreFindResult(std::string const& value)
{
bool force =
this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) == cmPolicies::NEW;
@@ -609,65 +613,62 @@ cmFindBaseDebugState::cmFindBaseDebugState(std::string commandName,
cmFindBaseDebugState::~cmFindBaseDebugState()
{
- if (this->FindCommand->DebugMode) {
- std::string buffer =
- cmStrCat(this->CommandName, " called with the following settings:\n");
- buffer += cmStrCat(" VAR: ", this->FindCommand->VariableName, "\n");
- buffer += cmStrCat(
- " NAMES: ", cmWrap("\"", this->FindCommand->Names, "\"", "\n "),
- "\n");
- buffer += cmStrCat(
- " Documentation: ", this->FindCommand->VariableDocumentation, "\n");
- buffer += " Framework\n";
- buffer += cmStrCat(" Only Search Frameworks: ",
- this->FindCommand->SearchFrameworkOnly, "\n");
-
- buffer += cmStrCat(" Search Frameworks Last: ",
- this->FindCommand->SearchFrameworkLast, "\n");
- buffer += cmStrCat(" Search Frameworks First: ",
- this->FindCommand->SearchFrameworkFirst, "\n");
- buffer += " AppBundle\n";
- buffer += cmStrCat(" Only Search AppBundle: ",
- this->FindCommand->SearchAppBundleOnly, "\n");
- buffer += cmStrCat(" Search AppBundle Last: ",
- this->FindCommand->SearchAppBundleLast, "\n");
- buffer += cmStrCat(" Search AppBundle First: ",
- this->FindCommand->SearchAppBundleFirst, "\n");
-
- if (this->FindCommand->NoDefaultPath) {
- buffer += " NO_DEFAULT_PATH Enabled\n";
- } else {
- buffer += cmStrCat(
- " CMAKE_FIND_USE_CMAKE_PATH: ", !this->FindCommand->NoCMakePath, "\n",
- " CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: ",
- !this->FindCommand->NoCMakeEnvironmentPath, "\n",
- " CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: ",
- !this->FindCommand->NoSystemEnvironmentPath, "\n",
- " CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: ",
- !this->FindCommand->NoCMakeSystemPath, "\n",
- " CMAKE_FIND_USE_INSTALL_PREFIX: ",
- !this->FindCommand->NoCMakeInstallPath, "\n");
- }
+ if (!this->FindCommand->DebugMode) {
+ return;
+ }
- buffer +=
- cmStrCat(this->CommandName, " considered the following locations:\n");
- for (auto const& state : this->FailedSearchLocations) {
- std::string path = cmStrCat(" ", state.path);
- if (!state.regexName.empty()) {
- path = cmStrCat(path, "/", state.regexName);
- }
- buffer += cmStrCat(path, "\n");
- }
+ // clang-format off
+ auto buffer =
+ cmStrCat(
+ this->CommandName, " called with the following settings:"
+ "\n VAR: ", this->FindCommand->VariableName,
+ "\n NAMES: ", cmWrap('"', this->FindCommand->Names, '"', "\n "),
+ "\n Documentation: ", this->FindCommand->VariableDocumentation,
+ "\n Framework"
+ "\n Only Search Frameworks: ", this->FindCommand->SearchFrameworkOnly,
+ "\n Search Frameworks Last: ", this->FindCommand->SearchFrameworkLast,
+ "\n Search Frameworks First: ", this->FindCommand->SearchFrameworkFirst,
+ "\n AppBundle"
+ "\n Only Search AppBundle: ", this->FindCommand->SearchAppBundleOnly,
+ "\n Search AppBundle Last: ", this->FindCommand->SearchAppBundleLast,
+ "\n Search AppBundle First: ", this->FindCommand->SearchAppBundleFirst,
+ "\n"
+ );
+ // clang-format on
+
+ if (this->FindCommand->NoDefaultPath) {
+ buffer += " NO_DEFAULT_PATH Enabled\n";
+ } else {
+ // clang-format off
+ buffer += cmStrCat(
+ " CMAKE_FIND_USE_CMAKE_PATH: ", !this->FindCommand->NoCMakePath,
+ "\n CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: ", !this->FindCommand->NoCMakeEnvironmentPath,
+ "\n CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: ", !this->FindCommand->NoSystemEnvironmentPath,
+ "\n CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: ", !this->FindCommand->NoCMakeSystemPath,
+ "\n CMAKE_FIND_USE_INSTALL_PREFIX: ", !this->FindCommand->NoCMakeInstallPath,
+ "\n"
+ );
+ // clang-format on
+ }
- if (!this->FoundSearchLocation.path.empty()) {
- buffer += cmStrCat("The item was found at\n ",
- this->FoundSearchLocation.path, "\n");
- } else {
- buffer += "The item was not found.\n";
+ buffer +=
+ cmStrCat(this->CommandName, " considered the following locations:\n");
+ for (auto const& state : this->FailedSearchLocations) {
+ std::string path = cmStrCat(" ", state.path);
+ if (!state.regexName.empty()) {
+ path = cmStrCat(path, '/', state.regexName);
}
+ buffer += cmStrCat(path, '\n');
+ }
- this->FindCommand->DebugMessage(buffer);
+ if (!this->FoundSearchLocation.path.empty()) {
+ buffer += cmStrCat("The item was found at\n ",
+ this->FoundSearchLocation.path, '\n');
+ } else {
+ buffer += "The item was not found.\n";
}
+
+ this->FindCommand->DebugMessage(buffer);
}
void cmFindBaseDebugState::FoundAt(std::string const& path,
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 75d9a6d..8655b22 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,7 +34,7 @@ public:
/**
* To check validity of a found path using user's validator, if any
*/
- bool Validate(const std::string& path) const;
+ bool Validate(std::string const& path) const;
protected:
friend class cmFindBaseDebugState;
@@ -46,7 +46,7 @@ protected:
bool CheckForVariableDefined();
void NormalizeFindResult();
- void StoreFindResult(const std::string& value);
+ void StoreFindResult(std::string const& value);
// actual find command name
std::string FindCommandName;
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 31243f6..b7783b6 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindCommon.h"
#include <algorithm>
@@ -118,20 +118,13 @@ void cmFindCommon::InitializeSearchPathGroups()
this->PathGroupOrder.push_back(PathGroup::All);
// Create the individual labeled search paths
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::PackageRoot, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::CMake, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::CMakeEnvironment, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::Hints, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::SystemEnvironment, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::CMakeSystem, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::Guess, cmSearchPath(this)));
+ this->LabeledPaths.emplace(PathLabel::PackageRoot, cmSearchPath(this));
+ this->LabeledPaths.emplace(PathLabel::CMake, cmSearchPath(this));
+ this->LabeledPaths.emplace(PathLabel::CMakeEnvironment, cmSearchPath(this));
+ this->LabeledPaths.emplace(PathLabel::Hints, cmSearchPath(this));
+ this->LabeledPaths.emplace(PathLabel::SystemEnvironment, cmSearchPath(this));
+ this->LabeledPaths.emplace(PathLabel::CMakeSystem, cmSearchPath(this));
+ this->LabeledPaths.emplace(PathLabel::Guess, cmSearchPath(this));
}
void cmFindCommon::SelectDefaultRootPathMode()
@@ -193,7 +186,7 @@ void cmFindCommon::SelectDefaultMacMode()
void cmFindCommon::SelectDefaultSearchModes()
{
- const std::array<std::pair<bool&, std::string>, 6> search_paths = {
+ std::array<std::pair<bool&, std::string>, 6> const search_paths = {
{ { this->NoPackageRootPath, "CMAKE_FIND_USE_PACKAGE_ROOT_PATH" },
{ this->NoCMakePath, "CMAKE_FIND_USE_CMAKE_PATH" },
{ this->NoCMakeEnvironmentPath,
@@ -215,12 +208,6 @@ void cmFindCommon::SelectDefaultSearchModes()
void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
std::string* debugBuffer)
{
-#if 0
- for(std::string const& p : paths)
- {
- fprintf(stderr, "[%s]\n", p.c_str());
- }
-#endif
// Short-circuit if there is nothing to do.
if (this->FindRootPathMode == RootPathModeNever) {
return;
@@ -231,10 +218,10 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE");
cmValue sysrootLink = this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK");
cmValue rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
- const bool noSysroot = !cmNonempty(sysroot);
- const bool noCompileSysroot = !cmNonempty(sysrootCompile);
- const bool noLinkSysroot = !cmNonempty(sysrootLink);
- const bool noRootPath = !cmNonempty(rootPath);
+ bool const noSysroot = !cmNonempty(sysroot);
+ bool const noCompileSysroot = !cmNonempty(sysrootCompile);
+ bool const noLinkSysroot = !cmNonempty(sysrootLink);
+ bool const noRootPath = !cmNonempty(rootPath);
if (noSysroot && noCompileSysroot && noLinkSysroot && noRootPath) {
return;
}
@@ -244,16 +231,16 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
*debugBuffer, "Prepending the following roots to each prefix:\n");
}
- auto debugRoot = [this, debugBuffer](const std::string& name,
+ auto debugRoot = [this, debugBuffer](std::string const& name,
cmValue value) {
if (this->DebugMode && debugBuffer) {
- *debugBuffer = cmStrCat(*debugBuffer, name, "\n");
+ *debugBuffer = cmStrCat(*debugBuffer, name, '\n');
cmList roots{ value };
if (roots.empty()) {
*debugBuffer = cmStrCat(*debugBuffer, " none\n");
}
for (auto const& root : roots) {
- *debugBuffer = cmStrCat(*debugBuffer, " ", root, "\n");
+ *debugBuffer = cmStrCat(*debugBuffer, " ", root, '\n');
}
}
};
@@ -261,19 +248,19 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
// Construct the list of path roots with no trailing slashes.
cmList roots;
debugRoot("CMAKE_FIND_ROOT_PATH", rootPath);
- if (rootPath) {
+ if (cmNonempty(rootPath)) {
roots.assign(*rootPath);
}
debugRoot("CMAKE_SYSROOT_COMPILE", sysrootCompile);
- if (sysrootCompile) {
+ if (cmNonempty(sysrootCompile)) {
roots.emplace_back(*sysrootCompile);
}
debugRoot("CMAKE_SYSROOT_LINK", sysrootLink);
- if (sysrootLink) {
+ if (cmNonempty(sysrootLink)) {
roots.emplace_back(*sysrootLink);
}
debugRoot("CMAKE_SYSROOT", sysroot);
- if (sysroot) {
+ if (cmNonempty(sysroot)) {
roots.emplace_back(*sysroot);
}
for (auto& r : roots) {
@@ -325,13 +312,11 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
{
- static constexpr const char* paths[] = {
- "CMAKE_SYSTEM_IGNORE_PATH",
- "CMAKE_IGNORE_PATH",
- };
+ std::array<char const*, 2> const paths = { { "CMAKE_SYSTEM_IGNORE_PATH",
+ "CMAKE_IGNORE_PATH" } };
// Construct the list of path roots with no trailing slashes.
- for (const char* pathName : paths) {
+ for (char const* pathName : paths) {
// Get the list of paths to ignore from the variable.
cmList::append(ignore, this->Makefile->GetDefinition(pathName));
}
@@ -350,13 +335,11 @@ void cmFindCommon::GetIgnoredPaths(std::set<std::string>& ignore)
void cmFindCommon::GetIgnoredPrefixPaths(std::vector<std::string>& ignore)
{
- static constexpr const char* paths[] = {
- "CMAKE_SYSTEM_IGNORE_PREFIX_PATH",
- "CMAKE_IGNORE_PREFIX_PATH",
+ std::array<char const*, 2> const paths = {
+ { "CMAKE_SYSTEM_IGNORE_PREFIX_PATH", "CMAKE_IGNORE_PREFIX_PATH" }
};
-
// Construct the list of path roots with no trailing slashes.
- for (const char* pathName : paths) {
+ for (char const* pathName : paths) {
// Get the list of paths to ignore from the variable.
cmList::append(ignore, this->Makefile->GetDefinition(pathName));
}
@@ -377,31 +360,46 @@ bool cmFindCommon::CheckCommonArgument(std::string const& arg)
{
if (arg == "NO_DEFAULT_PATH") {
this->NoDefaultPath = true;
- } else if (arg == "NO_PACKAGE_ROOT_PATH") {
+ return true;
+ }
+ if (arg == "NO_PACKAGE_ROOT_PATH") {
this->NoPackageRootPath = true;
- } else if (arg == "NO_CMAKE_PATH") {
+ return true;
+ }
+ if (arg == "NO_CMAKE_PATH") {
this->NoCMakePath = true;
- } else if (arg == "NO_CMAKE_ENVIRONMENT_PATH") {
+ return true;
+ }
+ if (arg == "NO_CMAKE_ENVIRONMENT_PATH") {
this->NoCMakeEnvironmentPath = true;
- } else if (arg == "NO_SYSTEM_ENVIRONMENT_PATH") {
+ return true;
+ }
+ if (arg == "NO_SYSTEM_ENVIRONMENT_PATH") {
this->NoSystemEnvironmentPath = true;
- } else if (arg == "NO_CMAKE_SYSTEM_PATH") {
+ return true;
+ }
+ if (arg == "NO_CMAKE_SYSTEM_PATH") {
this->NoCMakeSystemPath = true;
- } else if (arg == "NO_CMAKE_INSTALL_PREFIX") {
+ return true;
+ }
+ if (arg == "NO_CMAKE_INSTALL_PREFIX") {
this->NoCMakeInstallPath = true;
- } else if (arg == "NO_CMAKE_FIND_ROOT_PATH") {
+ return true;
+ }
+ if (arg == "NO_CMAKE_FIND_ROOT_PATH") {
this->FindRootPathMode = RootPathModeNever;
- } else if (arg == "ONLY_CMAKE_FIND_ROOT_PATH") {
+ return true;
+ }
+ if (arg == "ONLY_CMAKE_FIND_ROOT_PATH") {
this->FindRootPathMode = RootPathModeOnly;
- } else if (arg == "CMAKE_FIND_ROOT_PATH_BOTH") {
+ return true;
+ }
+ if (arg == "CMAKE_FIND_ROOT_PATH_BOTH") {
this->FindRootPathMode = RootPathModeBoth;
- } else {
- // The argument is not one of the above.
- return false;
+ return true;
}
-
- // The argument is one of the above.
- return true;
+ // The argument is not one of the above.
+ return false;
}
void cmFindCommon::AddPathSuffix(std::string const& arg)
@@ -429,12 +427,6 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
this->SearchPathSuffixes.push_back(std::move(suffix));
}
-static void AddTrailingSlash(std::string& s)
-{
- if (!s.empty() && s.back() != '/') {
- s += '/';
- }
-}
void cmFindCommon::ComputeFinalPaths(IgnorePaths ignorePaths,
std::string* debugBuffer)
{
@@ -459,5 +451,9 @@ void cmFindCommon::ComputeFinalPaths(IgnorePaths ignorePaths,
// Add a trailing slash to all paths to aid the search process.
std::for_each(this->SearchPaths.begin(), this->SearchPaths.end(),
- &AddTrailingSlash);
+ [](std::string& s) {
+ if (!s.empty() && s.back() != '/') {
+ s += '/';
+ }
+ });
}
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 1abf567..cf1a7aa 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,7 +43,7 @@ protected:
PathGroup();
public:
- PathGroup(const std::string& label)
+ PathGroup(std::string const& label)
: cmPathLabel(label)
{
}
@@ -57,7 +57,7 @@ protected:
PathLabel();
public:
- PathLabel(const std::string& label)
+ PathLabel(std::string const& label)
: cmPathLabel(label)
{
}
diff --git a/Source/cmFindFileCommand.cxx b/Source/cmFindFileCommand.cxx
index a88c1b1..f2c6b31 100644
--- a/Source/cmFindFileCommand.cxx
+++ b/Source/cmFindFileCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindFileCommand.h"
#include "cmStateTypes.h"
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 368a7c9..925619a 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 9df7665..83bc09f 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -1,13 +1,16 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindLibraryCommand.h"
#include <algorithm>
+#include <cctype>
#include <cstdio>
#include <cstring>
#include <set>
#include <utility>
+#include <cm/optional>
+
#include "cmsys/RegularExpression.hxx"
#include "cmGlobalGenerator.h"
@@ -76,7 +79,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
return true;
}
-void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
+void cmFindLibraryCommand::AddArchitecturePaths(char const* suffix)
{
std::vector<std::string> original;
original.swap(this->SearchPaths);
@@ -105,7 +108,7 @@ static bool cmLibDirsLinked(std::string const& l, std::string const& r)
}
void cmFindLibraryCommand::AddArchitecturePath(
- std::string const& dir, std::string::size_type start_pos, const char* suffix,
+ std::string const& dir, std::string::size_type start_pos, char const* suffix,
bool fresh)
{
std::string::size_type pos = dir.find("lib/", start_pos);
@@ -200,7 +203,9 @@ struct cmFindLibraryHelper
cmList Prefixes;
cmList Suffixes;
std::string PrefixRegexStr;
+ std::string ICasePrefixRegexStr; // case insensitive
std::string SuffixRegexStr;
+ std::string ICaseSuffixRegexStr; // case insensitive
// Keep track of the best library file found so far.
using size_type = std::vector<std::string>::size_type;
@@ -217,14 +222,14 @@ struct cmFindLibraryHelper
bool TryRaw = false;
std::string Raw;
cmsys::RegularExpression Regex;
+ cmsys::RegularExpression ICaseRegex; // case insensitive
};
std::vector<Name> Names;
- // Current full path under consideration.
- std::string TestPath;
-
- void RegexFromLiteral(std::string& out, std::string const& in);
- void RegexFromList(std::string& out, cmList const& in);
+ void RegexFromLiteral(std::string& out, std::string const& in,
+ cmSystemTools::DirCase dirCase);
+ void RegexFromList(std::string& out, cmList const& in,
+ cmSystemTools::DirCase dirCase);
size_type GetPrefixIndex(std::string const& prefix)
{
return std::find(this->Prefixes.begin(), this->Prefixes.end(), prefix) -
@@ -241,7 +246,7 @@ struct cmFindLibraryHelper
bool CheckDirectory(std::string const& path);
bool CheckDirectoryForName(std::string const& path, Name& name);
- bool Validate(const std::string& path) const
+ bool Validate(std::string const& path) const
{
return this->FindBase->Validate(path);
}
@@ -253,9 +258,9 @@ struct cmFindLibraryHelper
if (this->DebugMode) {
// To improve readability of the debug output, if there is only one
// prefix/suffix, use the plain prefix/suffix instead of the regex.
- const auto& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0]
+ auto const& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0]
: this->PrefixRegexStr;
- const auto& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0]
+ auto const& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0]
: this->SuffixRegexStr;
auto regexName = cmStrCat(prefix, name, suffix);
@@ -316,8 +321,14 @@ cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf,
this->Prefixes.assign(prefixes_list, cmList::EmptyElements::Yes);
this->Suffixes.assign(suffixes_list, cmList::EmptyElements::Yes);
- this->RegexFromList(this->PrefixRegexStr, this->Prefixes);
- this->RegexFromList(this->SuffixRegexStr, this->Suffixes);
+ this->RegexFromList(this->PrefixRegexStr, this->Prefixes,
+ cmSystemTools::DirCase::Sensitive);
+ this->RegexFromList(this->ICasePrefixRegexStr, this->Prefixes,
+ cmSystemTools::DirCase::Insensitive);
+ this->RegexFromList(this->SuffixRegexStr, this->Suffixes,
+ cmSystemTools::DirCase::Sensitive);
+ this->RegexFromList(this->ICaseSuffixRegexStr, this->Suffixes,
+ cmSystemTools::DirCase::Insensitive);
// Check whether to use OpenBSD-style library version comparisons.
this->IsOpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool(
@@ -325,7 +336,8 @@ cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf,
}
void cmFindLibraryHelper::RegexFromLiteral(std::string& out,
- std::string const& in)
+ std::string const& in,
+ cmSystemTools::DirCase dirCase)
{
for (char ch : in) {
if (ch == '[' || ch == ']' || ch == '(' || ch == ')' || ch == '\\' ||
@@ -333,27 +345,28 @@ void cmFindLibraryHelper::RegexFromLiteral(std::string& out,
ch == '^' || ch == '$') {
out += "\\";
}
-#if defined(_WIN32) || defined(__APPLE__)
- out += static_cast<char>(tolower(ch));
-#else
- out += ch;
-#endif
+ if (dirCase == cmSystemTools::DirCase::Insensitive) {
+ out += static_cast<char>(tolower(ch));
+ } else {
+ out += ch;
+ }
}
}
-void cmFindLibraryHelper::RegexFromList(std::string& out, cmList const& in)
+void cmFindLibraryHelper::RegexFromList(std::string& out, cmList const& in,
+ cmSystemTools::DirCase dirCase)
{
// Surround the list in parens so the '|' does not apply to anything
// else and the result can be checked after matching.
out += "(";
- const char* sep = "";
+ char const* sep = "";
for (auto const& s : in) {
// Separate from previous item.
out += sep;
sep = "|";
// Append this item.
- this->RegexFromLiteral(out, s);
+ this->RegexFromLiteral(out, s, dirCase);
}
out += ")";
}
@@ -387,14 +400,29 @@ void cmFindLibraryHelper::AddName(std::string const& name)
entry.Raw = name;
// Build a regular expression to match library names.
- std::string regex = cmStrCat('^', this->PrefixRegexStr);
- this->RegexFromLiteral(regex, name);
- regex += this->SuffixRegexStr;
- if (this->IsOpenBSD) {
- regex += "(\\.[0-9]+\\.[0-9]+)?";
- }
- regex += "$";
- entry.Regex.compile(regex);
+ {
+ std::string regex = cmStrCat('^', this->PrefixRegexStr);
+ this->RegexFromLiteral(regex, name, cmSystemTools::DirCase::Sensitive);
+ regex += this->SuffixRegexStr;
+ if (this->IsOpenBSD) {
+ regex += "(\\.[0-9]+\\.[0-9]+)?";
+ }
+ regex += "$";
+ entry.Regex.compile(regex);
+ }
+
+ // case insensitive version
+ {
+ std::string regex = cmStrCat('^', this->ICasePrefixRegexStr);
+ this->RegexFromLiteral(regex, name, cmSystemTools::DirCase::Insensitive);
+ regex += this->ICaseSuffixRegexStr;
+ if (this->IsOpenBSD) {
+ regex += "(\\.[0-9]+\\.[0-9]+)?";
+ }
+ regex += "$";
+ entry.ICaseRegex.compile(regex);
+ }
+
this->Names.push_back(std::move(entry));
}
@@ -423,20 +451,17 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
// one cannot tell just from the library name whether it is a static
// library or an import library).
if (name.TryRaw) {
- this->TestPath = cmStrCat(path, name.Raw);
+ std::string testPath = cmStrCat(path, name.Raw);
- const bool exists = cmSystemTools::FileExists(this->TestPath, true);
- if (!exists) {
- this->DebugLibraryFailed(name.Raw, path);
- } else {
- auto testPath = cmSystemTools::CollapseFullPath(this->TestPath);
+ if (cmSystemTools::FileExists(testPath, true)) {
+ testPath = cmSystemTools::ToNormalizedPathOnDisk(testPath);
if (this->Validate(testPath)) {
this->DebugLibraryFound(name.Raw, path);
this->BestPath = testPath;
return true;
}
- this->DebugLibraryFailed(name.Raw, path);
}
+ this->DebugLibraryFailed(name.Raw, path);
}
// No library file has yet been found.
@@ -446,41 +471,45 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
unsigned int bestMinor = 0;
// Search for a file matching the library name regex.
- std::string dir = path;
- cmSystemTools::ConvertToUnixSlashes(dir);
- std::set<std::string> const& files = this->GG->GetDirectoryContent(dir);
+ cm::optional<cmSystemTools::DirCase> dirCase =
+ cmSystemTools::GetDirCase(path).value_or(
+ cmSystemTools::DirCase::Sensitive);
+ cmsys::RegularExpression& regex =
+ dirCase == cmSystemTools::DirCase::Insensitive ? name.ICaseRegex
+ : name.Regex;
+ std::set<std::string> const& files = this->GG->GetDirectoryContent(path);
for (std::string const& origName : files) {
-#if defined(_WIN32) || defined(__APPLE__)
- std::string testName = cmSystemTools::LowerCase(origName);
-#else
- std::string const& testName = origName;
-#endif
- if (name.Regex.find(testName)) {
- this->TestPath = cmStrCat(path, origName);
+ std::string testName = dirCase == cmSystemTools::DirCase::Insensitive
+ ? cmSystemTools::LowerCase(origName)
+ : origName;
+
+ if (regex.find(testName)) {
+ std::string testPath = cmStrCat(path, origName);
// Make sure the path is readable and is not a directory.
- if (cmSystemTools::FileExists(this->TestPath, true)) {
- if (!this->Validate(cmSystemTools::CollapseFullPath(this->TestPath))) {
+ if (cmSystemTools::FileExists(testPath, true)) {
+ testPath = cmSystemTools::ToNormalizedPathOnDisk(testPath);
+ if (!this->Validate(testPath)) {
continue;
}
- this->DebugLibraryFound(name.Raw, dir);
+ this->DebugLibraryFound(name.Raw, path);
// This is a matching file. Check if it is better than the
// best name found so far. Earlier prefixes are preferred,
// followed by earlier suffixes. For OpenBSD, shared library
// version extensions are compared.
- size_type prefix = this->GetPrefixIndex(name.Regex.match(1));
- size_type suffix = this->GetSuffixIndex(name.Regex.match(2));
+ size_type prefix = this->GetPrefixIndex(regex.match(1));
+ size_type suffix = this->GetSuffixIndex(regex.match(2));
unsigned int major = 0;
unsigned int minor = 0;
if (this->IsOpenBSD) {
- sscanf(name.Regex.match(3).c_str(), ".%u.%u", &major, &minor);
+ sscanf(regex.match(3).c_str(), ".%u.%u", &major, &minor);
}
if (this->BestPath.empty() || prefix < bestPrefix ||
(prefix == bestPrefix && suffix < bestSuffix) ||
(prefix == bestPrefix && suffix == bestSuffix &&
(major > bestMajor ||
(major == bestMajor && minor > bestMinor)))) {
- this->BestPath = this->TestPath;
+ this->BestPath = testPath;
bestPrefix = prefix;
bestSuffix = suffix;
bestMajor = major;
@@ -491,7 +520,7 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
}
if (this->BestPath.empty()) {
- this->DebugLibraryFailed(name.Raw, dir);
+ this->DebugLibraryFailed(name.Raw, path);
} else {
this->DebugLibraryFound(name.Raw, this->BestPath);
}
@@ -560,7 +589,7 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir()
for (std::string const& n : this->Names) {
fwPath = cmStrCat(d, n, ".xcframework");
if (cmSystemTools::FileIsDirectory(fwPath)) {
- auto finalPath = cmSystemTools::CollapseFullPath(fwPath);
+ auto finalPath = cmSystemTools::ToNormalizedPathOnDisk(fwPath);
if (this->Validate(finalPath)) {
return finalPath;
}
@@ -568,7 +597,7 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir()
fwPath = cmStrCat(d, n, ".framework");
if (cmSystemTools::FileIsDirectory(fwPath)) {
- auto finalPath = cmSystemTools::CollapseFullPath(fwPath);
+ auto finalPath = cmSystemTools::ToNormalizedPathOnDisk(fwPath);
if (this->Validate(finalPath)) {
return finalPath;
}
@@ -588,7 +617,7 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName()
for (std::string const& d : this->SearchPaths) {
fwPath = cmStrCat(d, n, ".xcframework");
if (cmSystemTools::FileIsDirectory(fwPath)) {
- auto finalPath = cmSystemTools::CollapseFullPath(fwPath);
+ auto finalPath = cmSystemTools::ToNormalizedPathOnDisk(fwPath);
if (this->Validate(finalPath)) {
return finalPath;
}
@@ -596,7 +625,7 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName()
fwPath = cmStrCat(d, n, ".framework");
if (cmSystemTools::FileIsDirectory(fwPath)) {
- auto finalPath = cmSystemTools::CollapseFullPath(fwPath);
+ auto finalPath = cmSystemTools::ToNormalizedPathOnDisk(fwPath);
if (this->Validate(finalPath)) {
return finalPath;
}
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index f3874ff..7a81daa 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,10 +26,10 @@ public:
bool InitialPass(std::vector<std::string> const& args);
protected:
- void AddArchitecturePaths(const char* suffix);
+ void AddArchitecturePaths(char const* suffix);
void AddArchitecturePath(std::string const& dir,
std::string::size_type start_pos,
- const char* suffix, bool fresh = true);
+ char const* suffix, bool fresh = true);
std::string FindLibrary();
private:
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index cc150fd..bae7d38 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindPackageCommand.h"
#include <algorithm>
@@ -12,6 +12,7 @@
#include <utility>
#include <cm/optional>
+#include <cmext/algorithm>
#include <cmext/string_view>
#include "cmsys/Directory.hxx"
@@ -22,6 +23,8 @@
#include "cmAlgorithms.h"
#include "cmDependencyProvider.h"
+#include "cmExecutionStatus.h"
+#include "cmExperimental.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
@@ -53,14 +56,15 @@
# endif
#endif
-class cmExecutionStatus;
-
namespace {
+using pdt = cmFindPackageCommand::PackageDescriptionType;
+using ParsedVersion = cmPackageInfoReader::Pep440Version;
+
template <template <typename> class Op>
struct StrverscmpOp
{
- bool operator()(const std::string& lhs, const std::string& rhs) const
+ bool operator()(std::string const& lhs, std::string const& rhs) const
{
return Op<int>()(cmSystemTools::strverscmp(lhs, rhs), 0);
}
@@ -70,7 +74,7 @@ std::size_t collectPathsForDebug(std::string& buffer,
cmSearchPath const& searchPath,
std::size_t const startIndex = 0)
{
- const auto& paths = searchPath.GetPaths();
+ auto const& paths = searchPath.GetPaths();
if (paths.empty()) {
buffer += " none\n";
return 0;
@@ -84,10 +88,10 @@ std::size_t collectPathsForDebug(std::string& buffer,
#if !(defined(_WIN32) && !defined(__CYGWIN__))
class cmFindPackageCommandHoldFile
{
- const char* File;
+ char const* File;
public:
- cmFindPackageCommandHoldFile(const char* const f)
+ cmFindPackageCommandHoldFile(char const* const f)
: File(f)
{
}
@@ -97,14 +101,14 @@ public:
cmSystemTools::RemoveFile(this->File);
}
}
- cmFindPackageCommandHoldFile(const cmFindPackageCommandHoldFile&) = delete;
+ cmFindPackageCommandHoldFile(cmFindPackageCommandHoldFile const&) = delete;
cmFindPackageCommandHoldFile& operator=(
- const cmFindPackageCommandHoldFile&) = delete;
+ cmFindPackageCommandHoldFile const&) = delete;
void Release() { this->File = nullptr; }
};
#endif
-bool isDirentryToIgnore(const char* const fname)
+bool isDirentryToIgnore(char const* const fname)
{
assert(fname);
assert(fname[0] != 0);
@@ -120,35 +124,35 @@ public:
{
}
- std::string GetNextCandidate(const std::string& parent)
+ std::string GetNextCandidate(std::string const& parent)
{
if (this->NeedReset) {
return {};
}
this->NeedReset = true;
- return cmStrCat(parent, '/', this->DirName);
+ return cmStrCat(parent, this->DirName, '/');
}
void Reset() { this->NeedReset = false; }
private:
- const cm::string_view DirName;
+ cm::string_view const DirName;
bool NeedReset = false;
};
class cmEnumPathSegmentsGenerator
{
public:
- cmEnumPathSegmentsGenerator(const std::vector<cm::string_view>& init)
+ cmEnumPathSegmentsGenerator(std::vector<cm::string_view> const& init)
: Names{ init }
, Current{ this->Names.get().cbegin() }
{
}
- std::string GetNextCandidate(const std::string& parent)
+ std::string GetNextCandidate(std::string const& parent)
{
if (this->Current != this->Names.get().cend()) {
- return cmStrCat(parent, '/', *this->Current++);
+ return cmStrCat(parent, *this->Current++, '/');
}
return {};
}
@@ -156,7 +160,7 @@ public:
void Reset() { this->Current = this->Names.get().cbegin(); }
private:
- std::reference_wrapper<const std::vector<cm::string_view>> Names;
+ std::reference_wrapper<std::vector<cm::string_view> const> Names;
std::vector<cm::string_view>::const_iterator Current;
};
@@ -164,12 +168,11 @@ class cmCaseInsensitiveDirectoryListGenerator
{
public:
cmCaseInsensitiveDirectoryListGenerator(cm::string_view name)
- : DirectoryLister{}
- , DirName{ name }
+ : DirName{ name }
{
}
- std::string GetNextCandidate(const std::string& parent)
+ std::string GetNextCandidate(std::string const& parent)
{
if (!this->Loaded) {
this->CurrentIdx = 0ul;
@@ -180,13 +183,13 @@ public:
}
while (this->CurrentIdx < this->DirectoryLister.GetNumberOfFiles()) {
- const char* const fname =
+ char const* const fname =
this->DirectoryLister.GetFile(this->CurrentIdx++);
if (isDirentryToIgnore(fname)) {
continue;
}
if (cmsysString_strcasecmp(fname, this->DirName.data()) == 0) {
- auto candidate = cmStrCat(parent, '/', fname);
+ auto candidate = cmStrCat(parent, fname, '/');
if (cmSystemTools::FileIsDirectory(candidate)) {
return candidate;
}
@@ -199,7 +202,7 @@ public:
private:
cmsys::Directory DirectoryLister;
- const cm::string_view DirName;
+ cm::string_view const DirName;
unsigned long CurrentIdx = 0ul;
bool Loaded = false;
};
@@ -207,15 +210,18 @@ private:
class cmDirectoryListGenerator
{
public:
- cmDirectoryListGenerator(std::vector<std::string> const& names)
+ cmDirectoryListGenerator(std::vector<std::string> const* names,
+ bool exactMatch)
: Names{ names }
- , Matches{}
+ , ExactMatch{ exactMatch }
, Current{ this->Matches.cbegin() }
{
+ assert(names || !exactMatch);
+ assert(!names || !names->empty());
}
virtual ~cmDirectoryListGenerator() = default;
- std::string GetNextCandidate(const std::string& parent)
+ std::string GetNextCandidate(std::string const& parent)
{
// Construct a list of matches if not yet
if (this->Matches.empty()) {
@@ -232,22 +238,34 @@ public:
// TODO If so, just start with index 2 and drop the
// `isDirentryToIgnore(i)` condition to check.
for (auto i = 0ul; i < directoryLister.GetNumberOfFiles(); ++i) {
- const char* const fname = directoryLister.GetFile(i);
+ char const* const fname = directoryLister.GetFile(i);
+ // Skip entries to ignore or that aren't directories.
if (isDirentryToIgnore(fname)) {
continue;
}
- for (const auto& n : this->Names.get()) {
- // NOTE Customization point for `cmMacProjectDirectoryListGenerator`
- const auto name = this->TransformNameBeforeCmp(n);
- // Skip entries that don't match and non-directories.
- // ATTENTION BTW, original code also didn't check if it's a symlink
- // to a directory!
- const auto equal =
- (cmsysString_strncasecmp(fname, name.c_str(), name.length()) == 0);
- if (equal && directoryLister.FileIsDirectory(i)) {
+ if (!this->Names) {
+ if (directoryLister.FileIsDirectory(i)) {
this->Matches.emplace_back(fname);
}
+ } else {
+ for (auto const& n : *this->Names) {
+ // NOTE Customization point for
+ // `cmMacProjectDirectoryListGenerator`
+ auto const name = this->TransformNameBeforeCmp(n);
+ // Skip entries that don't match.
+ auto const equal =
+ ((this->ExactMatch
+ ? cmsysString_strcasecmp(fname, name.c_str())
+ : cmsysString_strncasecmp(fname, name.c_str(),
+ name.length())) == 0);
+ if (equal) {
+ if (directoryLister.FileIsDirectory(i)) {
+ this->Matches.emplace_back(fname);
+ }
+ break;
+ }
+ }
}
}
// NOTE Customization point for `cmProjectDirectoryListGenerator`
@@ -257,7 +275,7 @@ public:
}
if (this->Current != this->Matches.cend()) {
- auto candidate = cmStrCat(parent, '/', *this->Current++);
+ auto candidate = cmStrCat(parent, *this->Current++, '/');
return candidate;
}
@@ -274,7 +292,8 @@ protected:
virtual void OnMatchesLoaded() {}
virtual std::string TransformNameBeforeCmp(std::string same) { return same; }
- std::reference_wrapper<const std::vector<std::string>> Names;
+ std::vector<std::string> const* Names;
+ bool const ExactMatch;
std::vector<std::string> Matches;
std::vector<std::string>::const_iterator Current;
};
@@ -282,10 +301,11 @@ protected:
class cmProjectDirectoryListGenerator : public cmDirectoryListGenerator
{
public:
- cmProjectDirectoryListGenerator(std::vector<std::string> const& names,
+ cmProjectDirectoryListGenerator(std::vector<std::string> const* names,
cmFindPackageCommand::SortOrderType so,
- cmFindPackageCommand::SortDirectionType sd)
- : cmDirectoryListGenerator{ names }
+ cmFindPackageCommand::SortDirectionType sd,
+ bool exactMatch)
+ : cmDirectoryListGenerator{ names, exactMatch }
, SortOrder{ so }
, SortDirection{ sd }
{
@@ -303,16 +323,16 @@ protected:
private:
// sort parameters
- const cmFindPackageCommand::SortOrderType SortOrder;
- const cmFindPackageCommand::SortDirectionType SortDirection;
+ cmFindPackageCommand::SortOrderType const SortOrder;
+ cmFindPackageCommand::SortDirectionType const SortDirection;
};
class cmMacProjectDirectoryListGenerator : public cmDirectoryListGenerator
{
public:
- cmMacProjectDirectoryListGenerator(const std::vector<std::string>& names,
+ cmMacProjectDirectoryListGenerator(std::vector<std::string> const* names,
cm::string_view ext)
- : cmDirectoryListGenerator{ names }
+ : cmDirectoryListGenerator{ names, true }
, Extension{ ext }
{
}
@@ -324,52 +344,17 @@ protected:
}
private:
- const cm::string_view Extension;
+ cm::string_view const Extension;
};
-class cmFileListGeneratorGlob
+class cmAnyDirectoryListGenerator : public cmProjectDirectoryListGenerator
{
public:
- cmFileListGeneratorGlob(cm::string_view pattern)
- : Pattern(pattern)
- , Files{}
- , Current{}
- {
- }
-
- std::string GetNextCandidate(const std::string& parent)
- {
- if (this->Files.empty()) {
- // Glob the set of matching files.
- std::string expr = cmStrCat(parent, this->Pattern);
- cmsys::Glob g;
- if (!g.FindFiles(expr)) {
- return {};
- }
- this->Files = g.GetFiles();
- this->Current = this->Files.cbegin();
- }
-
- // Skip non-directories
- for (; this->Current != this->Files.cend() &&
- !cmSystemTools::FileIsDirectory(*this->Current);
- ++this->Current) {
- }
-
- return (this->Current != this->Files.cend()) ? *this->Current++
- : std::string{};
- }
-
- void Reset()
+ cmAnyDirectoryListGenerator(cmFindPackageCommand::SortOrderType so,
+ cmFindPackageCommand::SortDirectionType sd)
+ : cmProjectDirectoryListGenerator(nullptr, so, sd, false)
{
- this->Files.clear();
- this->Current = this->Files.cbegin();
}
-
-private:
- cm::string_view Pattern;
- std::vector<std::string> Files;
- std::vector<std::string>::const_iterator Current;
};
#if defined(__LCC__)
@@ -402,23 +387,25 @@ void ResetGenerator(Generator&& generator, Generators&&... generators)
template <typename CallbackFn>
bool TryGeneratedPaths(CallbackFn&& filesCollector,
- const std::string& fullPath)
+ cmFindPackageCommand::PackageDescriptionType type,
+ std::string const& fullPath)
{
- assert(!fullPath.empty() && fullPath.back() != '/');
- return std::forward<CallbackFn&&>(filesCollector)(fullPath + '/');
+ assert(!fullPath.empty() && fullPath.back() == '/');
+ return std::forward<CallbackFn&&>(filesCollector)(fullPath, type);
}
template <typename CallbackFn, typename Generator, typename... Rest>
bool TryGeneratedPaths(CallbackFn&& filesCollector,
- const std::string& startPath, Generator&& gen,
+ cmFindPackageCommand::PackageDescriptionType type,
+ std::string const& startPath, Generator&& gen,
Rest&&... tail)
{
ResetGenerator(std::forward<Generator&&>(gen));
for (auto path = gen.GetNextCandidate(startPath); !path.empty();
path = gen.GetNextCandidate(startPath)) {
ResetGenerator(std::forward<Rest&&>(tail)...);
- if (TryGeneratedPaths(std::forward<CallbackFn&&>(filesCollector), path,
- std::forward<Rest&&>(tail)...)) {
+ if (TryGeneratedPaths(std::forward<CallbackFn&&>(filesCollector), type,
+ path, std::forward<Rest&&>(tail)...)) {
return true;
}
}
@@ -447,11 +434,12 @@ bool TryGeneratedPaths(CallbackFn&& filesCollector,
// Parse the version number and store the results that were
// successfully parsed.
-int parseVersion(const std::string& version, unsigned int& major,
- unsigned int& minor, unsigned int& patch, unsigned int& tweak)
+unsigned int parseVersion(std::string const& version, unsigned int& major,
+ unsigned int& minor, unsigned int& patch,
+ unsigned int& tweak)
{
- return std::sscanf(version.c_str(), "%u.%u.%u.%u", &major, &minor, &patch,
- &tweak);
+ return static_cast<unsigned int>(std::sscanf(
+ version.c_str(), "%u.%u.%u.%u", &major, &minor, &patch, &tweak));
}
} // anonymous namespace
@@ -491,12 +479,10 @@ class cmFindPackageCommand::SetRestoreFindDefinitions
cmFindPackageCommand& Command;
public:
- SetRestoreFindDefinitions(
- cmFindPackageCommand& command, const std::string& components,
- const std::vector<std::pair<std::string, const char*>>& componentVarDefs)
+ SetRestoreFindDefinitions(cmFindPackageCommand& command)
: Command(command)
{
- Command.SetModuleVariables(components, componentVarDefs);
+ Command.SetModuleVariables();
}
~SetRestoreFindDefinitions() { Command.RestoreFindDefinitions(); }
};
@@ -510,9 +496,9 @@ cmFindPackageCommand::PathLabel cmFindPackageCommand::PathLabel::Builds(
cmFindPackageCommand::PathLabel
cmFindPackageCommand::PathLabel::SystemRegistry("SYSTEM_PACKAGE_REGISTRY");
-const cm::string_view cmFindPackageCommand::VERSION_ENDPOINT_INCLUDED(
+cm::string_view const cmFindPackageCommand::VERSION_ENDPOINT_INCLUDED(
"INCLUDE");
-const cm::string_view cmFindPackageCommand::VERSION_ENDPOINT_EXCLUDED(
+cm::string_view const cmFindPackageCommand::VERSION_ENDPOINT_EXCLUDED(
"EXCLUDE");
void cmFindPackageCommand::Sort(std::vector<std::string>::iterator begin,
@@ -572,14 +558,45 @@ void cmFindPackageCommand::AppendSearchPathGroups()
PathLabel::SystemRegistry);
// Create the new path objects
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::PackageRedirect, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::UserRegistry, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::Builds, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::make_pair(PathLabel::SystemRegistry, cmSearchPath(this)));
+ this->LabeledPaths.emplace(PathLabel::PackageRedirect, cmSearchPath{ this });
+ this->LabeledPaths.emplace(PathLabel::UserRegistry, cmSearchPath{ this });
+ this->LabeledPaths.emplace(PathLabel::Builds, cmSearchPath{ this });
+ this->LabeledPaths.emplace(PathLabel::SystemRegistry, cmSearchPath{ this });
+}
+
+void cmFindPackageCommand::InheritOptions(cmFindPackageCommand* other)
+{
+ this->RequiredCMakeVersion = other->RequiredCMakeVersion;
+ this->LibraryArchitecture = other->LibraryArchitecture;
+ this->UseLib32Paths = other->UseLib32Paths;
+ this->UseLib64Paths = other->UseLib64Paths;
+ this->UseLibx32Paths = other->UseLibx32Paths;
+ this->NoUserRegistry = other->NoUserRegistry;
+ this->NoSystemRegistry = other->NoSystemRegistry;
+ this->UseRealPath = other->UseRealPath;
+ this->SortOrder = other->SortOrder;
+ this->SortDirection = other->SortDirection;
+
+ this->GlobalScope = other->GlobalScope;
+ this->RegistryView = other->RegistryView;
+ this->NoDefaultPath = other->NoDefaultPath;
+ this->NoPackageRootPath = other->NoPackageRootPath;
+ this->NoCMakePath = other->NoCMakePath;
+ this->NoCMakeEnvironmentPath = other->NoCMakeEnvironmentPath;
+ this->NoSystemEnvironmentPath = other->NoSystemEnvironmentPath;
+ this->NoCMakeSystemPath = other->NoCMakeSystemPath;
+ this->NoCMakeInstallPath = other->NoCMakeInstallPath;
+ this->FindRootPathMode = other->FindRootPathMode;
+
+ this->SearchFrameworkLast = other->SearchFrameworkLast;
+ this->SearchFrameworkFirst = other->SearchFrameworkFirst;
+ this->SearchFrameworkOnly = other->SearchFrameworkOnly;
+ this->SearchAppBundleLast = other->SearchAppBundleLast;
+ this->SearchAppBundleFirst = other->SearchAppBundleFirst;
+ this->SearchAppBundleOnly = other->SearchAppBundleOnly;
+ this->SearchPathSuffixes = other->SearchPathSuffixes;
+
+ this->Quiet = other->Quiet;
}
bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
@@ -667,7 +684,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->SortDirection = (*sd == "ASC") ? Asc : Dec;
}
- // Find what search path locations have been enabled/disable
+ // Find what search path locations have been enabled/disable.
this->SelectDefaultSearchModes();
// Find the current root path mode.
@@ -678,11 +695,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// Record options.
this->Name = args[0];
- std::string components;
- const char* components_sep = "";
- std::set<std::string> requiredComponents;
- std::set<std::string> optionalComponents;
- std::vector<std::pair<std::string, const char*>> componentVarDefs;
+ cm::string_view componentsSep = ""_s;
bool bypassProvider = false;
// Always search directly in a generated path.
@@ -777,7 +790,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
doing = DoingNone;
} else if (args[i] == "REGISTRY_VIEW") {
if (++i == args.size()) {
- this->SetError("missing required argument for \"REGISTRY_VIEW\"");
+ this->SetError("missing required argument for REGISTRY_VIEW");
return false;
}
auto view = cmWindowsRegistry::ToView(args[i]);
@@ -786,7 +799,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->RegistryViewDefined = true;
} else {
this->SetError(
- cmStrCat("given invalid value for \"REGISTRY_VIEW\": ", args[i]));
+ cmStrCat("given invalid value for REGISTRY_VIEW: ", args[i]));
return false;
}
} else if (this->CheckCommonArgument(args[i])) {
@@ -796,21 +809,16 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
(doing == DoingOptionalComponents)) {
// Set a variable telling the find script whether this component
// is required.
- const char* isRequired = "1";
if (doing == DoingOptionalComponents) {
- isRequired = "0";
- optionalComponents.insert(args[i]);
+ this->OptionalComponents.insert(args[i]);
} else {
- requiredComponents.insert(args[i]);
+ this->RequiredComponents.insert(args[i]);
}
- componentVarDefs.emplace_back(this->Name + "_FIND_REQUIRED_" + args[i],
- isRequired);
-
// Append to the list of required components.
- components += components_sep;
- components += args[i];
- components_sep = ";";
+ this->Components += componentsSep;
+ this->Components += args[i];
+ componentsSep = ";"_s;
} else if (doing == DoingNames) {
this->Names.push_back(args[i]);
} else if (doing == DoingPaths) {
@@ -828,7 +836,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
"a path and with a \".cmake\" extension."));
return false;
}
- this->Configs.push_back(args[i]);
+ this->Configs.emplace_back(args[i], pdt::CMake);
} else if (!haveVersion && versionRegex.find(args[i])) {
haveVersion = true;
this->VersionComplete = args[i];
@@ -846,20 +854,28 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
std::vector<std::string> doubledComponents;
- std::set_intersection(requiredComponents.begin(), requiredComponents.end(),
- optionalComponents.begin(), optionalComponents.end(),
- std::back_inserter(doubledComponents));
+ std::set_intersection(
+ this->RequiredComponents.begin(), this->RequiredComponents.end(),
+ this->OptionalComponents.begin(), this->OptionalComponents.end(),
+ std::back_inserter(doubledComponents));
if (!doubledComponents.empty()) {
this->SetError(
cmStrCat("called with components that are both required and "
"optional:\n",
- cmWrap(" ", doubledComponents, "", "\n"), "\n"));
+ cmWrap(" ", doubledComponents, "", "\n"), '\n'));
return false;
}
// Check and eliminate search modes not allowed by the args provided
this->UseFindModules = configArgs.empty();
this->UseConfigFiles = moduleArgs.empty();
+ if (this->UseConfigFiles &&
+ cmExperimental::HasSupportEnabled(
+ *this->Makefile, cmExperimental::Feature::ImportPackageInfo)) {
+ this->UseCpsFiles = this->Configs.empty();
+ } else {
+ this->UseCpsFiles = false;
+ }
if (!this->UseFindModules && !this->UseConfigFiles) {
std::ostringstream e;
e << "given options exclusive to Module mode:\n";
@@ -883,7 +899,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
"Ignoring EXACT since no version is requested.");
}
- if (this->VersionComplete.empty() || components.empty()) {
+ if (this->VersionComplete.empty() || this->Components.empty()) {
// Check whether we are recursing inside "Find<name>.cmake" within
// another find_package(<name>) call.
std::string const mod = cmStrCat(this->Name, "_FIND_MODULE");
@@ -898,9 +914,18 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
std::string const exact = cmStrCat(this->Name, "_FIND_VERSION_EXACT");
this->VersionExact = this->Makefile->IsOn(exact);
}
- if (components.empty()) {
- std::string const components_var = this->Name + "_FIND_COMPONENTS";
- components = this->Makefile->GetSafeDefinition(components_var);
+ if (this->Components.empty()) {
+ std::string const componentsVar = this->Name + "_FIND_COMPONENTS";
+ this->Components = this->Makefile->GetSafeDefinition(componentsVar);
+ for (auto const& component : cmList{ this->Components }) {
+ std::string const crVar =
+ cmStrCat(this->Name, "_FIND_REQUIRED_"_s, component);
+ if (this->Makefile->GetDefinition(crVar).IsOn()) {
+ this->RequiredComponents.insert(component);
+ } else {
+ this->OptionalComponents.insert(component);
+ }
+ }
}
}
}
@@ -951,9 +976,15 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->VersionMaxPatch, this->VersionMaxTweak);
}
- const std::string makePackageRequiredVar =
+ return this->FindPackage(bypassProvider ? std::vector<std::string>{} : args);
+}
+
+bool cmFindPackageCommand::FindPackage(
+ std::vector<std::string> const& argsForProvider)
+{
+ std::string const makePackageRequiredVar =
cmStrCat("CMAKE_REQUIRE_FIND_PACKAGE_", this->Name);
- const bool makePackageRequiredSet =
+ bool const makePackageRequiredSet =
this->Makefile->IsOn(makePackageRequiredVar);
if (makePackageRequiredSet) {
if (this->Required) {
@@ -1024,7 +1055,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
cmState* const state = this->Makefile->GetState();
cmState::Command const providerCommand = state->GetDependencyProviderCommand(
cmDependencyProvider::Method::FindPackage);
- if (bypassProvider) {
+ if (argsForProvider.empty()) {
if (this->DebugMode && providerCommand) {
this->DebugMessage(
"BYPASS_PROVIDER given, skipping dependency provider");
@@ -1035,11 +1066,11 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
state->GetDependencyProvider()->GetCommand(),
"()"));
}
- std::vector<cmListFileArgument> listFileArgs(args.size() + 1);
+ std::vector<cmListFileArgument> listFileArgs(argsForProvider.size() + 1);
listFileArgs[0] =
cmListFileArgument("FIND_PACKAGE", cmListFileArgument::Unquoted, 0);
- std::transform(args.begin(), args.end(), listFileArgs.begin() + 1,
- [](const std::string& arg) {
+ std::transform(argsForProvider.begin(), argsForProvider.end(),
+ listFileArgs.begin() + 1, [](std::string const& arg) {
return cmListFileArgument(arg,
cmListFileArgument::Bracket, 0);
});
@@ -1070,11 +1101,10 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
}
- // RAII objects to ensure we leave this function with consistent state
+ // RAII objects to ensure we leave this function with consistent state.
FlushDebugBufferOnExit flushDebugBufferOnExit(*this);
PushPopRootPathStack pushPopRootPathStack(*this);
- SetRestoreFindDefinitions setRestoreFindDefinitions(*this, components,
- componentVarDefs);
+ SetRestoreFindDefinitions setRestoreFindDefinitions(*this);
cmMakefile::FindPackageStackRAII findPackageStackRAII(this->Makefile,
this->Name);
@@ -1087,13 +1117,13 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
overrideNames.push_back(this->Name);
}
bool forceConfigMode = false;
- const auto redirectsDir =
+ auto const redirectsDir =
this->Makefile->GetSafeDefinition("CMAKE_FIND_PACKAGE_REDIRECTS_DIR");
- for (const auto& overrideName : overrideNames) {
- const auto nameLower = cmSystemTools::LowerCase(overrideName);
- const auto delegatePropName =
+ for (auto const& overrideName : overrideNames) {
+ auto const nameLower = cmSystemTools::LowerCase(overrideName);
+ auto const delegatePropName =
cmStrCat("_FetchContent_", nameLower, "_override_find_package");
- const cmValue delegateToFetchContentProp =
+ cmValue const delegateToFetchContentProp =
this->Makefile->GetState()->GetGlobalProperty(delegatePropName);
if (delegateToFetchContentProp.IsOn()) {
// When this property is set, the FetchContent module has already been
@@ -1221,11 +1251,22 @@ bool cmFindPackageCommand::FindPackageUsingConfigMode()
// Add the default configs.
if (this->Configs.empty()) {
for (std::string const& n : this->Names) {
- std::string config = cmStrCat(n, "Config.cmake");
- this->Configs.push_back(config);
+ std::string config;
+ if (this->UseCpsFiles) {
+ config = cmStrCat(n, ".cps");
+ this->Configs.emplace_back(std::move(config), pdt::Cps);
+
+ config = cmStrCat(cmSystemTools::LowerCase(n), ".cps");
+ if (config != this->Configs.front().Name) {
+ this->Configs.emplace_back(std::move(config), pdt::Cps);
+ }
+ }
+
+ config = cmStrCat(n, "Config.cmake");
+ this->Configs.emplace_back(std::move(config), pdt::CMake);
config = cmStrCat(cmSystemTools::LowerCase(n), "-config.cmake");
- this->Configs.push_back(std::move(config));
+ this->Configs.emplace_back(std::move(config), pdt::CMake);
}
}
@@ -1253,11 +1294,11 @@ bool cmFindPackageCommand::FindPackageUsingConfigMode()
}
void cmFindPackageCommand::SetVersionVariables(
- const std::function<void(const std::string&, cm::string_view)>&
+ std::function<void(std::string const&, cm::string_view)> const&
addDefinition,
- const std::string& prefix, const std::string& version,
- const unsigned int count, const unsigned int major, const unsigned int minor,
- const unsigned int patch, const unsigned int tweak)
+ std::string const& prefix, std::string const& version,
+ unsigned int const count, unsigned int const major, unsigned int const minor,
+ unsigned int const patch, unsigned int const tweak)
{
addDefinition(prefix, version);
@@ -1274,17 +1315,20 @@ void cmFindPackageCommand::SetVersionVariables(
addDefinition(prefix + "_COUNT", buf);
}
-void cmFindPackageCommand::SetModuleVariables(
- const std::string& components,
- const std::vector<std::pair<std::string, const char*>>& componentVarDefs)
+void cmFindPackageCommand::SetModuleVariables()
{
this->AddFindDefinition("CMAKE_FIND_PACKAGE_NAME", this->Name);
- // Store the list of components and associated variable definitions
+ // Store the list of components and associated variable definitions.
std::string components_var = this->Name + "_FIND_COMPONENTS";
- this->AddFindDefinition(components_var, components);
- for (const auto& varDef : componentVarDefs) {
- this->AddFindDefinition(varDef.first, varDef.second);
+ this->AddFindDefinition(components_var, this->Components);
+ for (auto const& component : this->OptionalComponents) {
+ this->AddFindDefinition(
+ cmStrCat(this->Name, "_FIND_REQUIRED_"_s, component), "0"_s);
+ }
+ for (auto const& component : this->RequiredComponents) {
+ this->AddFindDefinition(
+ cmStrCat(this->Name, "_FIND_REQUIRED_"_s, component), "1"_s);
}
if (this->Quiet) {
@@ -1308,7 +1352,7 @@ void cmFindPackageCommand::SetModuleVariables(
// Tell the module that is about to be read what version of the
// package has been requested.
- auto addDefinition = [this](const std::string& variable,
+ auto addDefinition = [this](std::string const& variable,
cm::string_view value) {
this->AddFindDefinition(variable, value);
};
@@ -1351,8 +1395,8 @@ void cmFindPackageCommand::SetModuleVariables(
}
}
-void cmFindPackageCommand::AddFindDefinition(const std::string& var,
- const cm::string_view value)
+void cmFindPackageCommand::AddFindDefinition(std::string const& var,
+ cm::string_view const value)
{
if (cmValue old = this->Makefile->GetDefinition(var)) {
this->OriginalDefs[var].exists = true;
@@ -1389,7 +1433,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
debugBuffer = cmStrCat(debugBuffer, "The file was not found.\n");
} else {
debugBuffer =
- cmStrCat(debugBuffer, "The file was found at\n ", mfile, "\n");
+ cmStrCat(debugBuffer, "The file was found at\n ", mfile, '\n');
}
this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
@@ -1404,13 +1448,11 @@ bool cmFindPackageCommand::FindModule(bool& found)
case cmPolicies::WARN: {
this->Makefile->IssueMessage(
MessageType::AUTHOR_WARNING,
- cmStrCat(cmPolicies::GetPolicyWarning(it->second), "\n"));
+ cmStrCat(cmPolicies::GetPolicyWarning(it->second), '\n'));
CM_FALLTHROUGH;
}
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
return true;
}
@@ -1441,7 +1483,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
}
bool cmFindPackageCommand::HandlePackageMode(
- const HandlePackageModeType handlePackageModeType)
+ HandlePackageModeType const handlePackageModeType)
{
this->ConsideredConfigs.clear();
@@ -1463,8 +1505,8 @@ bool cmFindPackageCommand::HandlePackageMode(
}
// The file location was cached. Look for the correct file.
std::string file;
- if (this->FindConfigFile(dir, file)) {
- this->FileFound = file;
+ if (this->FindConfigFile(dir, pdt::Any, file)) {
+ this->FileFound = std::move(file);
fileFound = true;
}
def = this->Makefile->GetDefinition(this->Variable);
@@ -1484,6 +1526,7 @@ bool cmFindPackageCommand::HandlePackageMode(
}
}
+ std::string const fileVar = cmStrCat(this->Name, "_CONFIG");
std::string const foundVar = cmStrCat(this->Name, "_FOUND");
std::string const notFoundMessageVar =
cmStrCat(this->Name, "_NOT_FOUND_MESSAGE");
@@ -1493,6 +1536,7 @@ bool cmFindPackageCommand::HandlePackageMode(
bool result = true;
bool found = false;
bool configFileSetFOUNDFalse = false;
+ std::vector<std::string> missingTargets;
if (fileFound) {
if (this->Makefile->IsDefinitionSet(foundVar) &&
@@ -1510,7 +1554,19 @@ bool cmFindPackageCommand::HandlePackageMode(
this->StoreVersionFound();
// Parse the configuration file.
- if (this->ReadListFile(this->FileFound, DoPolicyScope)) {
+ if (this->CpsReader) {
+ // The package has been found.
+ found = true;
+
+ // Don't read a CPS file if we've already read it.
+ cmValue const& previousFileFound =
+ this->Makefile->GetDefinition(fileVar);
+ if (previousFileFound.Compare(this->FileFound) == 0) {
+ result = true;
+ } else {
+ result = this->ReadPackage();
+ }
+ } else if (this->ReadListFile(this->FileFound, DoPolicyScope)) {
// The package has been found.
found = true;
@@ -1523,6 +1579,17 @@ bool cmFindPackageCommand::HandlePackageMode(
notFoundMessage =
this->Makefile->GetSafeDefinition(notFoundMessageVar);
}
+
+ // Check whether the required targets are defined.
+ if (found && !this->RequiredTargets.empty()) {
+ for (std::string const& t : this->RequiredTargets) {
+ std::string qualifiedTarget = cmStrCat(this->Name, "::"_s, t);
+ if (!this->Makefile->FindImportedTarget(qualifiedTarget)) {
+ missingTargets.emplace_back(std::move(qualifiedTarget));
+ found = false;
+ }
+ }
+ }
} else {
// The configuration file is invalid.
result = false;
@@ -1547,25 +1614,34 @@ bool cmFindPackageCommand::HandlePackageMode(
std::ostringstream e;
std::ostringstream aw;
if (configFileSetFOUNDFalse) {
- /* clang-format off */
e << "Found package configuration file:\n"
- " " << this->FileFound << "\n"
- "but it set " << foundVar << " to FALSE so package \"" <<
- this->Name << "\" is considered to be NOT FOUND.";
- /* clang-format on */
+ " "
+ << this->FileFound
+ << "\n"
+ "but it set "
+ << foundVar << " to FALSE so package \"" << this->Name
+ << "\" is considered to be NOT FOUND.";
if (!notFoundMessage.empty()) {
e << " Reason given by package: \n" << notFoundMessage << "\n";
}
- }
- // If there are files in ConsideredConfigs, it means that FooConfig.cmake
- // have been found, but they didn't have appropriate versions.
- else if (!this->ConsideredConfigs.empty()) {
+ } else if (!missingTargets.empty()) {
+ e << "Found package configuration file:\n"
+ " "
+ << this->FileFound
+ << "\n"
+ "but the following required targets were not found:\n"
+ " "
+ << cmJoin(cmMakeRange(missingTargets), ", "_s);
+ } else if (!this->ConsideredConfigs.empty()) {
+ // If there are files in ConsideredConfigs, it means that
+ // FooConfig.cmake have been found, but they didn't have appropriate
+ // versions.
auto duplicate_end = cmRemoveDuplicates(this->ConsideredConfigs);
e << "Could not find a configuration file for package \"" << this->Name
<< "\" that "
<< (this->VersionExact ? "exactly matches" : "is compatible with")
<< " requested version "
- << (this->VersionRange.empty() ? "" : "range ") << "\""
+ << (this->VersionRange.empty() ? "" : "range ") << '"'
<< this->VersionComplete
<< "\".\n"
"The following configuration files were considered but not "
@@ -1573,7 +1649,7 @@ bool cmFindPackageCommand::HandlePackageMode(
for (ConfigFileInfo const& info :
cmMakeRange(this->ConsideredConfigs.cbegin(), duplicate_end)) {
- e << " " << info.filename << ", version: " << info.version << "\n";
+ e << " " << info.filename << ", version: " << info.version << '\n';
}
} else {
std::string requestedVersionString;
@@ -1595,21 +1671,21 @@ bool cmFindPackageCommand::HandlePackageMode(
if (this->Configs.size() == 1) {
e << "Could not find a package configuration file named \""
- << this->Configs[0] << "\" provided by package \"" << this->Name
- << "\"" << requestedVersionString << ".\n";
+ << this->Configs[0].Name << "\" provided by package \""
+ << this->Name << "\"" << requestedVersionString << ".\n";
} else {
+ auto configs = cmMakeRange(this->Configs);
+ auto configNames =
+ configs.transform([](ConfigName const& cn) { return cn.Name; });
e << "Could not find a package configuration file provided by \""
<< this->Name << "\"" << requestedVersionString
<< " with any of the following names:\n"
- << cmWrap(" ", this->Configs, "", "\n") << "\n";
+ << cmWrap(" "_s, configNames, ""_s, "\n"_s) << '\n';
}
e << "Add the installation prefix of \"" << this->Name
- << "\" to "
- "CMAKE_PREFIX_PATH or set \""
- << this->Variable
- << "\" to a "
- "directory containing one of the above files. "
+ << "\" to CMAKE_PREFIX_PATH or set \"" << this->Variable
+ << "\" to a directory containing one of the above files. "
"If \""
<< this->Name
<< "\" provides a separate development "
@@ -1662,7 +1738,6 @@ bool cmFindPackageCommand::HandlePackageMode(
this->Makefile->AddDefinition(foundVar, found ? "1" : "0");
// Set a variable naming the configuration file that was found.
- std::string const fileVar = cmStrCat(this->Name, "_CONFIG");
if (found) {
this->Makefile->AddDefinition(fileVar, this->FileFound);
} else {
@@ -1677,7 +1752,7 @@ bool cmFindPackageCommand::HandlePackageMode(
std::string consideredConfigFiles;
std::string consideredVersions;
- const char* sep = "";
+ char const* sep = "";
for (ConfigFileInfo const& i : this->ConsideredConfigs) {
consideredConfigFiles += sep;
consideredVersions += sep;
@@ -1707,6 +1782,10 @@ bool cmFindPackageCommand::FindConfig()
this->Name, "'s Config module:\n");
}
+ if (!found && this->UseCpsFiles) {
+ found = this->FindEnvironmentConfig();
+ }
+
// Search for frameworks.
if (!found && (this->SearchFrameworkFirst || this->SearchFrameworkOnly)) {
found = this->FindFrameworkConfig();
@@ -1735,7 +1814,7 @@ bool cmFindPackageCommand::FindConfig()
if (this->DebugMode) {
if (found) {
this->DebugBuffer = cmStrCat(
- this->DebugBuffer, "The file was found at\n ", this->FileFound, "\n");
+ this->DebugBuffer, "The file was found at\n ", this->FileFound, '\n');
} else {
this->DebugBuffer =
cmStrCat(this->DebugBuffer, "The file was not found.\n");
@@ -1755,7 +1834,7 @@ bool cmFindPackageCommand::FindConfig()
return found;
}
-void cmFindPackageCommand::SetConfigDirCacheVariable(const std::string& value)
+void cmFindPackageCommand::SetConfigDirCacheVariable(std::string const& value)
{
std::string const help =
cmStrCat("The directory containing a CMake configuration file for ",
@@ -1795,10 +1874,52 @@ bool cmFindPackageCommand::FindAppBundleConfig()
});
}
-bool cmFindPackageCommand::ReadListFile(const std::string& f,
- const PolicyScopeRule psr)
+bool cmFindPackageCommand::FindEnvironmentConfig()
{
- const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
+ std::vector<std::string> const& prefixes =
+ cmSystemTools::GetEnvPathNormalized("CPS_PATH");
+ return std::any_of(prefixes.begin(), prefixes.end(),
+ [this](std::string const& p) -> bool {
+ return this->SearchEnvironmentPrefix(p);
+ });
+}
+
+cmFindPackageCommand::AppendixMap cmFindPackageCommand::FindAppendices(
+ std::string const& base, cmPackageInfoReader const& baseReader) const
+{
+ AppendixMap appendices;
+
+ // Find package appendices.
+ cmsys::Glob glob;
+ glob.RecurseOff();
+ if (glob.FindFiles(cmStrCat(cmSystemTools::GetFilenamePath(base), "/"_s,
+ cmSystemTools::GetFilenameWithoutExtension(base),
+ "[-:]*.[Cc][Pp][Ss]"_s))) {
+ // Check glob results for valid appendices.
+ for (std::string const& extra : glob.GetFiles()) {
+ // Exclude configuration-specific files for now; we look at them later
+ // when we load their respective configuration-agnostic appendices.
+ if (extra.find('@') != std::string::npos) {
+ continue;
+ }
+
+ std::unique_ptr<cmPackageInfoReader> reader =
+ cmPackageInfoReader::Read(extra, &baseReader);
+ if (reader && reader->GetName() == this->Name) {
+ std::vector<std::string> components = reader->GetComponentNames();
+ Appendix appendix{ std::move(reader), std::move(components) };
+ appendices.emplace(extra, std::move(appendix));
+ }
+ }
+ }
+
+ return appendices;
+}
+
+bool cmFindPackageCommand::ReadListFile(std::string const& f,
+ PolicyScopeRule const psr)
+{
+ bool const noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
using ITScope = cmMakefile::ImportedTargetScope;
ITScope scope = this->GlobalScope ? ITScope::Global : ITScope::Local;
@@ -1812,7 +1933,156 @@ bool cmFindPackageCommand::ReadListFile(const std::string& f,
return false;
}
-void cmFindPackageCommand::AppendToFoundProperty(const bool found)
+bool cmFindPackageCommand::ReadPackage()
+{
+ // Resolve any transitive dependencies for the root file.
+ if (!FindPackageDependencies(this->FileFound, *this->CpsReader,
+ this->Required)) {
+ return false;
+ }
+
+ bool const hasComponentsRequested =
+ !this->RequiredComponents.empty() || !this->OptionalComponents.empty();
+
+ cmMakefile::CallRAII scope{ this->Makefile, this->FileFound, this->Status };
+
+ // Loop over appendices.
+ auto iter = this->CpsAppendices.begin();
+ while (iter != this->CpsAppendices.end()) {
+ bool required = false;
+ bool important = false;
+
+ // Check if this appendix provides any requested components.
+ if (hasComponentsRequested) {
+ auto providesAny = [&iter](
+ std::set<std::string> const& desiredComponents) {
+ return std::any_of(iter->second.Components.begin(),
+ iter->second.Components.end(),
+ [&desiredComponents](std::string const& component) {
+ return cm::contains(desiredComponents, component);
+ });
+ };
+
+ if (providesAny(this->RequiredComponents)) {
+ important = true;
+ required = this->Required;
+ } else if (!providesAny(this->OptionalComponents)) {
+ // This appendix doesn't provide any requested components; remove it
+ // from the set to be imported.
+ iter = this->CpsAppendices.erase(iter);
+ continue;
+ }
+ }
+
+ // Resolve any transitive dependencies for the appendix.
+ if (!this->FindPackageDependencies(iter->first, iter->second, required)) {
+ if (important) {
+ // Some dependencies are missing, and we need(ed) this appendix; fail.
+ return false;
+ }
+
+ // Some dependencies are missing, but we don't need this appendix; remove
+ // it from the set to be imported.
+ iter = this->CpsAppendices.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+
+ // Import targets from root file.
+ if (!this->ImportPackageTargets(this->FileFound, *this->CpsReader)) {
+ return false;
+ }
+
+ // Import targets from appendices.
+ // NOLINTNEXTLINE(readability-use-anyofallof)
+ for (auto const& appendix : this->CpsAppendices) {
+ cmMakefile::CallRAII appendixScope{ this->Makefile, appendix.first,
+ this->Status };
+ if (!this->ImportPackageTargets(appendix.first, appendix.second)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool cmFindPackageCommand::FindPackageDependencies(
+ std::string const& fileName, cmPackageInfoReader const& reader,
+ bool required)
+{
+ // Get package requirements.
+ for (cmPackageRequirement const& dep : reader.GetRequirements()) {
+ cmExecutionStatus status{ *this->Makefile };
+ cmMakefile::CallRAII scope{ this->Makefile, fileName, status };
+
+ // For each requirement, set up a nested instance to find it.
+ cmFindPackageCommand fp{ status };
+ fp.InheritOptions(this);
+
+ fp.Name = dep.Name;
+ fp.Required = required;
+ fp.UseFindModules = false;
+ fp.UseCpsFiles = true;
+
+ fp.Version = dep.Version;
+ fp.VersionComplete = dep.Version;
+ fp.VersionCount =
+ parseVersion(fp.Version, fp.VersionMajor, fp.VersionMinor,
+ fp.VersionPatch, fp.VersionTweak);
+
+ fp.Components = cmJoin(cmMakeRange(dep.Components), ";"_s);
+ fp.OptionalComponents =
+ std::set<std::string>{ dep.Components.begin(), dep.Components.end() };
+ fp.RequiredTargets = fp.OptionalComponents;
+
+ // TODO set hints
+
+ // Try to find the requirement; fail if we can't.
+ if (!fp.FindPackage() || fp.FileFound.empty()) {
+ this->SetError(cmStrCat("could not find "_s, dep.Name,
+ ", required by "_s, this->Name, '.'));
+ return false;
+ }
+ }
+
+ // All requirements (if any) were found.
+ return true;
+}
+
+bool cmFindPackageCommand::ImportPackageTargets(std::string const& fileName,
+ cmPackageInfoReader& reader)
+{
+ // Import base file.
+ if (!reader.ImportTargets(this->Makefile, this->Status)) {
+ return false;
+ }
+
+ // Find supplemental configuration files.
+ cmsys::Glob glob;
+ glob.RecurseOff();
+ if (glob.FindFiles(
+ cmStrCat(cmSystemTools::GetFilenamePath(fileName), '/',
+ cmSystemTools::GetFilenameWithoutExtension(fileName),
+ "@*.[Cc][Pp][Ss]"_s))) {
+
+ // Try to read supplemental data from each file found.
+ for (std::string const& extra : glob.GetFiles()) {
+ std::unique_ptr<cmPackageInfoReader> configReader =
+ cmPackageInfoReader::Read(extra, &reader);
+ if (configReader && configReader->GetName() == this->Name) {
+ if (!configReader->ImportTargetConfigurations(this->Makefile,
+ this->Status)) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+void cmFindPackageCommand::AppendToFoundProperty(bool const found)
{
cmList foundContents;
cmValue foundProp =
@@ -1911,12 +2181,6 @@ void cmFindPackageCommand::PushFindPackageRootPathStack()
case cmPolicies::OLD:
// OLD behavior is to ignore the <PackageName>_ROOT variables.
return;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0074));
- return;
case cmPolicies::NEW: {
// NEW behavior is to honor the <PackageName>_ROOT variables.
} break;
@@ -1947,12 +2211,6 @@ void cmFindPackageCommand::PushFindPackageRootPathStack()
rootDEF = nullptr;
rootENV = cm::nullopt;
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0144));
- return;
case cmPolicies::NEW: {
// NEW behavior is to honor the <PACKAGENAME>_ROOT variables.
} break;
@@ -1965,11 +2223,13 @@ void cmFindPackageCommand::PushFindPackageRootPathStack()
cmExpandList(*rootDEF, rootPaths);
}
if (rootEnv) {
- std::vector<std::string> p = cmSystemTools::SplitEnvPath(*rootEnv);
+ std::vector<std::string> p =
+ cmSystemTools::SplitEnvPathNormalized(*rootEnv);
std::move(p.begin(), p.end(), std::back_inserter(rootPaths));
}
if (rootENV) {
- std::vector<std::string> p = cmSystemTools::SplitEnvPath(*rootENV);
+ std::vector<std::string> p =
+ cmSystemTools::SplitEnvPathNormalized(*rootENV);
std::move(p.begin(), p.end(), std::back_inserter(rootPaths));
}
}
@@ -2020,7 +2280,7 @@ void cmFindPackageCommand::FillPrefixesPackageRedirect()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRedirect];
- const auto redirectDir =
+ auto const redirectDir =
this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_REDIRECTS_DIR");
if (redirectDir && !redirectDir->empty()) {
paths.AddPath(*redirectDir);
@@ -2120,9 +2380,9 @@ void cmFindPackageCommand::FillPrefixesSystemEnvironment()
// Use the system search path to generate prefixes.
// Relative paths are interpreted with respect to the current
// working directory.
- std::vector<std::string> tmp;
- cmSystemTools::GetPath(tmp);
- for (std::string const& i : tmp) {
+ std::vector<std::string> envPATH =
+ cmSystemTools::GetEnvPathNormalized("PATH");
+ for (std::string const& i : envPATH) {
// If the path is a PREFIX/bin case then add its parent instead.
if ((cmHasLiteralSuffix(i, "/bin")) || (cmHasLiteralSuffix(i, "/sbin"))) {
paths.AddPath(cmSystemTools::GetFilenamePath(i));
@@ -2211,8 +2471,8 @@ void cmFindPackageCommand::LoadPackageRegistryWinSystem()
}
}
-void cmFindPackageCommand::LoadPackageRegistryWin(const bool user,
- const unsigned int view,
+void cmFindPackageCommand::LoadPackageRegistryWin(bool const user,
+ unsigned int const view,
cmSearchPath& outPaths)
{
std::wstring key = L"Software\\Kitware\\CMake\\Packages\\";
@@ -2297,7 +2557,7 @@ void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir,
}
#endif
-bool cmFindPackageCommand::CheckPackageRegistryEntry(const std::string& fname,
+bool cmFindPackageCommand::CheckPackageRegistryEntry(std::string const& fname,
cmSearchPath& outPaths)
{
// Parse the content of one package registry entry.
@@ -2328,10 +2588,10 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem];
- const bool install_prefix_in_list =
+ bool const install_prefix_in_list =
!this->Makefile->IsOn("CMAKE_FIND_NO_INSTALL_PREFIX");
- const bool remove_install_prefix = this->NoCMakeInstallPath;
- const bool add_install_prefix = !this->NoCMakeInstallPath &&
+ bool const remove_install_prefix = this->NoCMakeInstallPath;
+ bool const add_install_prefix = !this->NoCMakeInstallPath &&
this->Makefile->IsDefinitionSet("CMAKE_FIND_USE_INSTALL_PREFIX");
// We have 3 possible states for `CMAKE_SYSTEM_PREFIX_PATH` and
@@ -2364,7 +2624,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
// remove entry from CMAKE_SYSTEM_PREFIX_PATH
cmList expanded{ *prefix_paths };
long count = 0;
- for (const auto& path : expanded) {
+ for (auto const& path : expanded) {
bool const to_add =
!(path == install_path_to_remove && ++count == install_prefix_count);
if (to_add) {
@@ -2420,7 +2680,8 @@ void cmFindPackageCommand::FillPrefixesUserHints()
}
}
-bool cmFindPackageCommand::SearchDirectory(std::string const& dir)
+bool cmFindPackageCommand::SearchDirectory(std::string const& dir,
+ PackageDescriptionType type)
{
assert(!dir.empty() && dir.back() == '/');
@@ -2431,43 +2692,50 @@ bool cmFindPackageCommand::SearchDirectory(std::string const& dir)
d += s;
d += '/';
}
- if (this->CheckDirectory(d)) {
+ if (this->CheckDirectory(d, type)) {
return true;
}
}
return false;
}
-bool cmFindPackageCommand::CheckDirectory(std::string const& dir)
+bool cmFindPackageCommand::CheckDirectory(std::string const& dir,
+ PackageDescriptionType type)
{
assert(!dir.empty() && dir.back() == '/');
- // Look for the file in this directory.
std::string const d = dir.substr(0, dir.size() - 1);
- if (this->FindConfigFile(d, this->FileFound)) {
- // Remove duplicate slashes.
- cmSystemTools::ConvertToUnixSlashes(this->FileFound);
+ if (cm::contains(this->IgnoredPaths, d)) {
+ return false;
+ }
+
+ // Look for the file in this directory.
+ std::string file;
+ if (this->FindConfigFile(d, type, file)) {
+ this->FileFound = std::move(file);
return true;
}
return false;
}
bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
+ PackageDescriptionType type,
std::string& file)
{
- if (this->IgnoredPaths.count(dir)) {
- return false;
- }
-
- for (std::string const& c : this->Configs) {
- file = cmStrCat(dir, '/', c);
+ for (auto const& config : this->Configs) {
+ if (type != pdt::Any && config.Type != type) {
+ continue;
+ }
+ file = cmStrCat(dir, '/', config.Name);
if (this->DebugMode) {
- this->DebugBuffer = cmStrCat(this->DebugBuffer, " ", file, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, " ", file, '\n');
}
if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) {
// Allow resolving symlinks when the config file is found through a link
if (this->UseRealPath) {
file = cmSystemTools::GetRealPath(file);
+ } else {
+ file = cmSystemTools::ToNormalizedPathOnDisk(file);
}
return true;
}
@@ -2481,27 +2749,158 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
bool haveResult = false;
std::string version = "unknown";
- // Get the filename without the .cmake extension.
+ // Get the file extension.
std::string::size_type pos = config_file.rfind('.');
- std::string version_file_base = config_file.substr(0, pos);
+ std::string ext = cmSystemTools::LowerCase(config_file.substr(pos));
+
+ if (ext == ".cps"_s) {
+ std::unique_ptr<cmPackageInfoReader> reader =
+ cmPackageInfoReader::Read(config_file);
+ if (reader && reader->GetName() == this->Name) {
+ // Read version information.
+ cm::optional<std::string> cpsVersion = reader->GetVersion();
+ cm::optional<ParsedVersion> const& parsedVersion =
+ reader->ParseVersion(cpsVersion);
+ bool const hasVersion = cpsVersion.has_value();
+
+ // Test for version compatibility.
+ result = this->Version.empty();
+ if (hasVersion) {
+ version = std::move(*cpsVersion);
+
+ if (!this->Version.empty()) {
+ if (!parsedVersion) {
+ // If we don't understand the version, compare the exact versions
+ // using full string comparison. This is the correct behavior for
+ // the "custom" schema, and the best we can do otherwise.
+ result = (this->Version == version);
+ } else if (this->VersionExact) {
+ // If EXACT is specified, the version must be exactly the requested
+ // version.
+ result =
+ cmSystemTools::VersionCompareEqual(this->Version, version);
+ } else {
+ // Do we have a compat_version?
+ cm::optional<std::string> const& compatVersion =
+ reader->GetCompatVersion();
+ if (reader->ParseVersion(compatVersion)) {
+ // If yes, the initial result is whether the requested version is
+ // between the actual version and the compat version, inclusive.
+ result = cmSystemTools::VersionCompareGreaterEq(version,
+ this->Version) &&
+ cmSystemTools::VersionCompareGreaterEq(this->Version,
+ *compatVersion);
+
+ if (result && !this->VersionMax.empty()) {
+ // We must also check that the version is less than the version
+ // limit.
+ if (this->VersionRangeMax == VERSION_ENDPOINT_EXCLUDED) {
+ result = cmSystemTools::VersionCompareGreater(
+ this->VersionMax, version);
+ } else {
+ result = cmSystemTools::VersionCompareGreaterEq(
+ this->VersionMax, version);
+ }
+ }
+ } else {
+ // If no, compat_version is assumed to be exactly the actual
+ // version, so the result is whether the requested version is
+ // exactly the actual version, and we can ignore the version
+ // limit.
+ result =
+ cmSystemTools::VersionCompareEqual(this->Version, version);
+ }
+ }
+ }
+ }
- // Look for foo-config-version.cmake
- std::string version_file = cmStrCat(version_file_base, "-version.cmake");
- if (!haveResult && cmSystemTools::FileExists(version_file, true)) {
- result = this->CheckVersionFile(version_file, version);
- haveResult = true;
- }
+ if (result) {
+ // Locate appendices.
+ cmFindPackageCommand::AppendixMap appendices =
+ this->FindAppendices(config_file, *reader);
- // Look for fooConfigVersion.cmake
- version_file = cmStrCat(version_file_base, "Version.cmake");
- if (!haveResult && cmSystemTools::FileExists(version_file, true)) {
- result = this->CheckVersionFile(version_file, version);
- haveResult = true;
- }
+ // Collect available components.
+ std::set<std::string> allComponents;
+
+ std::vector<std::string> const& rootComponents =
+ reader->GetComponentNames();
+ allComponents.insert(rootComponents.begin(), rootComponents.end());
+
+ for (auto const& appendix : appendices) {
+ allComponents.insert(appendix.second.Components.begin(),
+ appendix.second.Components.end());
+ }
- // If no version was requested a versionless package is acceptable.
- if (!haveResult && this->Version.empty()) {
- result = true;
+ // Verify that all required components are available.
+ std::set<std::string> requiredComponents = this->RequiredComponents;
+ requiredComponents.insert(this->RequiredTargets.begin(),
+ this->RequiredTargets.end());
+
+ std::vector<std::string> missingComponents;
+ std::set_difference(requiredComponents.begin(),
+ requiredComponents.end(), allComponents.begin(),
+ allComponents.end(),
+ std::back_inserter(missingComponents));
+ if (!missingComponents.empty()) {
+ result = false;
+ }
+
+ if (result && hasVersion) {
+ this->VersionFound = version;
+
+ if (parsedVersion) {
+ std::vector<unsigned> const& versionParts =
+ parsedVersion->ReleaseComponents;
+
+ this->VersionFoundCount =
+ static_cast<unsigned>(versionParts.size());
+ switch (std::min(this->VersionFoundCount, 4u)) {
+ case 4:
+ this->VersionFoundTweak = versionParts[3];
+ CM_FALLTHROUGH;
+ case 3:
+ this->VersionFoundPatch = versionParts[2];
+ CM_FALLTHROUGH;
+ case 2:
+ this->VersionFoundMinor = versionParts[1];
+ CM_FALLTHROUGH;
+ case 1:
+ this->VersionFoundMajor = versionParts[0];
+ CM_FALLTHROUGH;
+ default:
+ break;
+ }
+ } else {
+ this->VersionFoundCount = 0;
+ }
+ }
+ this->CpsReader = std::move(reader);
+ this->CpsAppendices = std::move(appendices);
+ this->RequiredComponents = std::move(requiredComponents);
+ }
+ }
+ } else {
+ // Get the filename without the .cmake extension.
+ std::string version_file_base = config_file.substr(0, pos);
+
+ // Look for foo-config-version.cmake
+ std::string version_file = cmStrCat(version_file_base, "-version.cmake");
+ if (!haveResult && cmSystemTools::FileExists(version_file, true)) {
+ result = this->CheckVersionFile(version_file, version);
+ haveResult = true;
+ }
+
+ // Look for fooConfigVersion.cmake
+ version_file = cmStrCat(version_file_base, "Version.cmake");
+ if (!haveResult && cmSystemTools::FileExists(version_file, true)) {
+ result = this->CheckVersionFile(version_file, version);
+ haveResult = true;
+ }
+
+ // If no version was requested a versionless package is acceptable.
+ if (!haveResult && this->Version.empty()) {
+ result = true;
+ }
}
ConfigFileInfo configFileInfo;
@@ -2532,7 +2931,7 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_COMPLETE",
this->VersionComplete);
- auto addDefinition = [this](const std::string& variable,
+ auto addDefinition = [this](std::string const& variable,
cm::string_view value) {
this->Makefile->AddDefinition(variable, value);
};
@@ -2558,8 +2957,8 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
this->VersionRangeMax);
}
- // Load the version check file. Pass NoPolicyScope because we do
- // our own policy push/pop independent of CMP0011.
+ // Load the version check file.
+ // Pass NoPolicyScope because we do our own policy push/pop.
bool suitable = false;
if (this->ReadListFile(version_file, NoPolicyScope)) {
// Check the output variables.
@@ -2618,7 +3017,7 @@ void cmFindPackageCommand::StoreVersionFound()
{
// Store the whole version string.
std::string const ver = cmStrCat(this->Name, "_VERSION");
- auto addDefinition = [this](const std::string& variable,
+ auto addDefinition = [this](std::string const& variable,
cm::string_view value) {
this->Makefile->AddDefinition(variable, value);
};
@@ -2633,17 +3032,17 @@ void cmFindPackageCommand::StoreVersionFound()
}
}
-bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
+bool cmFindPackageCommand::SearchPrefix(std::string const& prefix)
{
- assert(!prefix_in.empty() && prefix_in.back() == '/');
+ assert(!prefix.empty() && prefix.back() == '/');
// Skip this if the prefix does not exist.
- if (!cmSystemTools::FileIsDirectory(prefix_in)) {
+ if (!cmSystemTools::FileIsDirectory(prefix)) {
return false;
}
// Skip this if it's in ignored paths.
- std::string prefixWithoutSlash = prefix_in;
+ std::string prefixWithoutSlash = prefix;
if (prefixWithoutSlash != "/" && prefixWithoutSlash.back() == '/') {
prefixWithoutSlash.erase(prefixWithoutSlash.length() - 1);
}
@@ -2652,46 +3051,77 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
return false;
}
- // PREFIX/ (useful on windows or in build trees)
- if (this->SearchDirectory(prefix_in)) {
+ auto searchFn = [this](std::string const& fullPath,
+ PackageDescriptionType type) -> bool {
+ return this->SearchDirectory(fullPath, type);
+ };
+
+ auto iCpsGen = cmCaseInsensitiveDirectoryListGenerator{ "cps"_s };
+ auto iCMakeGen = cmCaseInsensitiveDirectoryListGenerator{ "cmake"_s };
+ auto anyDirGen =
+ cmAnyDirectoryListGenerator{ this->SortOrder, this->SortDirection };
+ auto cpsPkgDirGen =
+ cmProjectDirectoryListGenerator{ &this->Names, this->SortOrder,
+ this->SortDirection, true };
+ auto cmakePkgDirGen =
+ cmProjectDirectoryListGenerator{ &this->Names, this->SortOrder,
+ this->SortDirection, false };
+
+ // PREFIX/(Foo|foo|FOO)/(cps|CPS)/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, cpsPkgDirGen, iCpsGen)) {
return true;
}
- // Strip the trailing slash because the path generator is about to
- // add one.
- std::string const prefix = prefix_in.substr(0, prefix_in.size() - 1);
+ // PREFIX/(Foo|foo|FOO)/*/(cps|CPS)/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, cpsPkgDirGen, iCpsGen,
+ anyDirGen)) {
+ return true;
+ }
- auto searchFn = [this](const std::string& fullPath) -> bool {
- return this->SearchDirectory(fullPath);
- };
+ // PREFIX/(cps|CPS)/(Foo|foo|FOO)/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, iCpsGen, cpsPkgDirGen)) {
+ return true;
+ }
- auto iCMakeGen = cmCaseInsensitiveDirectoryListGenerator{ "cmake"_s };
- auto firstPkgDirGen =
- cmProjectDirectoryListGenerator{ this->Names, this->SortOrder,
- this->SortDirection };
+ // PREFIX/(cps|CPS)/(Foo|foo|FOO)/*/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, iCpsGen, cpsPkgDirGen,
+ anyDirGen)) {
+ return true;
+ }
+
+ // PREFIX/(cps|CPS)/ (useful on windows or in build trees)
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, iCpsGen)) {
+ return true;
+ }
+
+ // PREFIX/ (useful on windows or in build trees)
+ if (this->SearchDirectory(prefix, pdt::CMake)) {
+ return true;
+ }
// PREFIX/(cmake|CMake)/ (useful on windows or in build trees)
- if (TryGeneratedPaths(searchFn, prefix, iCMakeGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, iCMakeGen)) {
return true;
}
// PREFIX/(Foo|foo|FOO).*/
- if (TryGeneratedPaths(searchFn, prefix, firstPkgDirGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, cmakePkgDirGen)) {
return true;
}
// PREFIX/(Foo|foo|FOO).*/(cmake|CMake)/
- if (TryGeneratedPaths(searchFn, prefix, firstPkgDirGen, iCMakeGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, cmakePkgDirGen,
+ iCMakeGen)) {
return true;
}
auto secondPkgDirGen =
- cmProjectDirectoryListGenerator{ this->Names, this->SortOrder,
- this->SortDirection };
+ cmProjectDirectoryListGenerator{ &this->Names, this->SortOrder,
+ this->SortDirection, false };
// PREFIX/(Foo|foo|FOO).*/(cmake|CMake)/(Foo|foo|FOO).*/
- if (TryGeneratedPaths(searchFn, prefix, firstPkgDirGen, iCMakeGen,
- secondPkgDirGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, cmakePkgDirGen,
+ iCMakeGen, secondPkgDirGen)) {
return true;
}
@@ -2714,105 +3144,170 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
common.emplace_back("lib"_s);
common.emplace_back("share"_s);
- auto cmnGen = cmEnumPathSegmentsGenerator{ common };
+ auto commonGen = cmEnumPathSegmentsGenerator{ common };
auto cmakeGen = cmAppendPathSegmentGenerator{ "cmake"_s };
+ auto cpsGen = cmAppendPathSegmentGenerator{ "cps"_s };
+
+ // PREFIX/(lib/ARCH|lib*|share)/cps/(Foo|foo|FOO)/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, commonGen, cpsGen,
+ cpsPkgDirGen)) {
+ return true;
+ }
+
+ // PREFIX/(lib/ARCH|lib*|share)/cps/(Foo|foo|FOO)/*/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, commonGen, cpsGen,
+ cpsPkgDirGen, anyDirGen)) {
+ return true;
+ }
+
+ // PREFIX/(lib/ARCH|lib*|share)/cps/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, commonGen, cpsGen)) {
+ return true;
+ }
// PREFIX/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/
- if (TryGeneratedPaths(searchFn, prefix, cmnGen, cmakeGen, firstPkgDirGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, commonGen, cmakeGen,
+ cmakePkgDirGen)) {
return true;
}
// PREFIX/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/
- if (TryGeneratedPaths(searchFn, prefix, cmnGen, firstPkgDirGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, commonGen,
+ cmakePkgDirGen)) {
return true;
}
// PREFIX/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/(cmake|CMake)/
- if (TryGeneratedPaths(searchFn, prefix, cmnGen, firstPkgDirGen, iCMakeGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, commonGen,
+ cmakePkgDirGen, iCMakeGen)) {
return true;
}
// PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/
- if (TryGeneratedPaths(searchFn, prefix, firstPkgDirGen, cmnGen, cmakeGen,
- secondPkgDirGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, cmakePkgDirGen,
+ commonGen, cmakeGen, secondPkgDirGen)) {
return true;
}
// PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/
- if (TryGeneratedPaths(searchFn, prefix, firstPkgDirGen, cmnGen,
- secondPkgDirGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, cmakePkgDirGen,
+ commonGen, secondPkgDirGen)) {
return true;
}
// PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/(cmake|CMake)/
- return TryGeneratedPaths(searchFn, prefix, firstPkgDirGen, cmnGen,
- secondPkgDirGen, iCMakeGen);
+ return TryGeneratedPaths(searchFn, pdt::CMake, prefix, cmakePkgDirGen,
+ commonGen, secondPkgDirGen, iCMakeGen);
}
-bool cmFindPackageCommand::SearchFrameworkPrefix(std::string const& prefix_in)
+bool cmFindPackageCommand::SearchFrameworkPrefix(std::string const& prefix)
{
- assert(!prefix_in.empty() && prefix_in.back() == '/');
+ assert(!prefix.empty() && prefix.back() == '/');
- // Strip the trailing slash because the path generator is about to
- // add one.
- std::string const prefix = prefix_in.substr(0, prefix_in.size() - 1);
-
- auto searchFn = [this](const std::string& fullPath) -> bool {
- return this->SearchDirectory(fullPath);
+ auto searchFn = [this](std::string const& fullPath,
+ PackageDescriptionType type) -> bool {
+ return this->SearchDirectory(fullPath, type);
};
auto iCMakeGen = cmCaseInsensitiveDirectoryListGenerator{ "cmake"_s };
+ auto iCpsGen = cmCaseInsensitiveDirectoryListGenerator{ "cps"_s };
auto fwGen =
- cmMacProjectDirectoryListGenerator{ this->Names, ".framework"_s };
+ cmMacProjectDirectoryListGenerator{ &this->Names, ".framework"_s };
auto rGen = cmAppendPathSegmentGenerator{ "Resources"_s };
auto vGen = cmAppendPathSegmentGenerator{ "Versions"_s };
- auto grGen = cmFileListGeneratorGlob{ "/*/Resources"_s };
+ auto anyGen =
+ cmAnyDirectoryListGenerator{ this->SortOrder, this->SortDirection };
+
+ // <prefix>/Foo.framework/Versions/*/Resources/CPS/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, fwGen, vGen, anyGen, rGen,
+ iCpsGen)) {
+ return true;
+ }
+
+ // <prefix>/Foo.framework/Resources/CPS/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, fwGen, rGen, iCpsGen)) {
+ return true;
+ }
// <prefix>/Foo.framework/Resources/
- if (TryGeneratedPaths(searchFn, prefix, fwGen, rGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, fwGen, rGen)) {
return true;
}
// <prefix>/Foo.framework/Resources/CMake/
- if (TryGeneratedPaths(searchFn, prefix, fwGen, rGen, iCMakeGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, fwGen, rGen,
+ iCMakeGen)) {
return true;
}
// <prefix>/Foo.framework/Versions/*/Resources/
- if (TryGeneratedPaths(searchFn, prefix, fwGen, vGen, grGen)) {
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, fwGen, vGen, anyGen,
+ rGen)) {
return true;
}
// <prefix>/Foo.framework/Versions/*/Resources/CMake/
- return TryGeneratedPaths(searchFn, prefix, fwGen, vGen, grGen, iCMakeGen);
+ return TryGeneratedPaths(searchFn, pdt::CMake, prefix, fwGen, vGen, anyGen,
+ rGen, iCMakeGen);
}
-bool cmFindPackageCommand::SearchAppBundlePrefix(std::string const& prefix_in)
+bool cmFindPackageCommand::SearchAppBundlePrefix(std::string const& prefix)
{
- assert(!prefix_in.empty() && prefix_in.back() == '/');
+ assert(!prefix.empty() && prefix.back() == '/');
- // Strip the trailing slash because the path generator is about to
- // add one.
- std::string const prefix = prefix_in.substr(0, prefix_in.size() - 1);
-
- auto searchFn = [this](const std::string& fullPath) -> bool {
- return this->SearchDirectory(fullPath);
+ auto searchFn = [this](std::string const& fullPath,
+ PackageDescriptionType type) -> bool {
+ return this->SearchDirectory(fullPath, type);
};
- auto appGen = cmMacProjectDirectoryListGenerator{ this->Names, ".app"_s };
+ auto appGen = cmMacProjectDirectoryListGenerator{ &this->Names, ".app"_s };
auto crGen = cmAppendPathSegmentGenerator{ "Contents/Resources"_s };
- // <prefix>/Foo.app/Contents/Resources
- if (TryGeneratedPaths(searchFn, prefix, appGen, crGen)) {
+ // <prefix>/Foo.app/Contents/Resources/CPS/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, appGen, crGen,
+ cmCaseInsensitiveDirectoryListGenerator{ "cps"_s })) {
+ return true;
+ }
+
+ // <prefix>/Foo.app/Contents/Resources/
+ if (TryGeneratedPaths(searchFn, pdt::CMake, prefix, appGen, crGen)) {
return true;
}
- // <prefix>/Foo.app/Contents/Resources/CMake
+ // <prefix>/Foo.app/Contents/Resources/CMake/
return TryGeneratedPaths(
- searchFn, prefix, appGen, crGen,
+ searchFn, pdt::CMake, prefix, appGen, crGen,
cmCaseInsensitiveDirectoryListGenerator{ "cmake"_s });
}
+bool cmFindPackageCommand::SearchEnvironmentPrefix(std::string const& prefix)
+{
+ assert(!prefix.empty() && prefix.back() == '/');
+
+ // Skip this if the prefix does not exist.
+ if (!cmSystemTools::FileIsDirectory(prefix)) {
+ return false;
+ }
+
+ auto searchFn = [this](std::string const& fullPath,
+ PackageDescriptionType type) -> bool {
+ return this->SearchDirectory(fullPath, type);
+ };
+
+ auto pkgDirGen =
+ cmProjectDirectoryListGenerator{ &this->Names, this->SortOrder,
+ this->SortDirection, true };
+
+ // <environment-path>/(Foo|foo|FOO)/cps/
+ if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, pkgDirGen,
+ cmAppendPathSegmentGenerator{ "cps"_s })) {
+ return true;
+ }
+
+ // <environment-path>/(Foo|foo|FOO)/
+ return TryGeneratedPaths(searchFn, pdt::Cps, prefix, pkgDirGen);
+}
+
// TODO: Debug cmsys::Glob double slash problem.
bool cmFindPackage(std::vector<std::string> const& args,
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 653e15f..bac09ee 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -7,6 +7,7 @@
#include <cstddef>
#include <functional>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -17,6 +18,7 @@
#include <cm3p/kwiml/int.h>
#include "cmFindCommon.h"
+#include "cmPackageInfoReader.h"
#include "cmPolicies.h"
// IWYU insists we should forward-declare instead of including <functional>,
@@ -57,6 +59,13 @@ public:
Dec
};
+ enum class PackageDescriptionType
+ {
+ Any,
+ CMake,
+ Cps,
+ };
+
/*! sorts a given list of string based on the input sort parameters */
static void Sort(std::vector<std::string>::iterator begin,
std::vector<std::string>::iterator end, SortOrderType order,
@@ -73,7 +82,7 @@ private:
PathLabel();
public:
- PathLabel(const std::string& label)
+ PathLabel(std::string const& label)
: cmFindCommon::PathLabel(label)
{
}
@@ -83,6 +92,13 @@ private:
static PathLabel SystemRegistry;
};
+ void InheritOptions(cmFindPackageCommand* other);
+
+ // Try to find a package, assuming most state has already been set up. This
+ // is used for recursive dependency solving, particularly when importing
+ // packages via CPS. Bypasses providers if argsForProvider is empty.
+ bool FindPackage(std::vector<std::string> const& argsForProvider = {});
+
bool FindPackageUsingModuleMode();
bool FindPackageUsingConfigMode();
@@ -93,16 +109,14 @@ private:
void AppendSuccessInformation();
void AppendToFoundProperty(bool found);
void SetVersionVariables(
- const std::function<void(const std::string&, cm::string_view)>&
+ std::function<void(std::string const&, cm::string_view)> const&
addDefinition,
- const std::string& prefix, const std::string& version, unsigned int count,
+ std::string const& prefix, std::string const& version, unsigned int count,
unsigned int major, unsigned int minor, unsigned int patch,
unsigned int tweak);
- void SetModuleVariables(
- const std::string& components,
- const std::vector<std::pair<std::string, const char*>>& componentVarDefs);
+ void SetModuleVariables();
bool FindModule(bool& found);
- void AddFindDefinition(const std::string& var, cm::string_view value);
+ void AddFindDefinition(std::string const& var, cm::string_view value);
void RestoreFindDefinitions();
class SetRestoreFindDefinitions;
@@ -118,14 +132,33 @@ private:
bool FindPrefixedConfig();
bool FindFrameworkConfig();
bool FindAppBundleConfig();
+ bool FindEnvironmentConfig();
enum PolicyScopeRule
{
NoPolicyScope,
DoPolicyScope
};
- bool ReadListFile(const std::string& f, PolicyScopeRule psr);
+ bool ReadListFile(std::string const& f, PolicyScopeRule psr);
+ bool ReadPackage();
+
+ struct Appendix
+ {
+ std::unique_ptr<cmPackageInfoReader> Reader;
+ std::vector<std::string> Components;
+
+ operator cmPackageInfoReader&() const { return *this->Reader; }
+ };
+ using AppendixMap = std::map<std::string, Appendix>;
+ AppendixMap FindAppendices(std::string const& base,
+ cmPackageInfoReader const& baseReader) const;
+ bool FindPackageDependencies(std::string const& fileName,
+ cmPackageInfoReader const& reader,
+ bool required);
+
+ bool ImportPackageTargets(std::string const& fileName,
+ cmPackageInfoReader& reader);
void StoreVersionFound();
- void SetConfigDirCacheVariable(const std::string& value);
+ void SetConfigDirCacheVariable(std::string const& value);
void PushFindPackageRootPathStack();
void PopFindPackageRootPathStack();
@@ -147,17 +180,19 @@ private:
void LoadPackageRegistryWinSystem();
void LoadPackageRegistryWin(bool user, unsigned int view,
cmSearchPath& outPaths);
- bool CheckPackageRegistryEntry(const std::string& fname,
+ bool CheckPackageRegistryEntry(std::string const& fname,
cmSearchPath& outPaths);
- bool SearchDirectory(std::string const& dir);
- bool CheckDirectory(std::string const& dir);
- bool FindConfigFile(std::string const& dir, std::string& file);
+ bool SearchDirectory(std::string const& dir, PackageDescriptionType type);
+ bool CheckDirectory(std::string const& dir, PackageDescriptionType type);
+ bool FindConfigFile(std::string const& dir, PackageDescriptionType type,
+ std::string& file);
bool CheckVersion(std::string const& config_file);
bool CheckVersionFile(std::string const& version_file,
std::string& result_version);
bool SearchPrefix(std::string const& prefix);
- bool SearchFrameworkPrefix(std::string const& prefix_in);
- bool SearchAppBundlePrefix(std::string const& prefix_in);
+ bool SearchFrameworkPrefix(std::string const& prefix);
+ bool SearchAppBundlePrefix(std::string const& prefix);
+ bool SearchEnvironmentPrefix(std::string const& prefix);
struct OriginalDef
{
@@ -168,8 +203,8 @@ private:
std::map<std::string, cmPolicies::PolicyID> DeprecatedFindModules;
- static const cm::string_view VERSION_ENDPOINT_INCLUDED;
- static const cm::string_view VERSION_ENDPOINT_EXCLUDED;
+ static cm::string_view const VERSION_ENDPOINT_INCLUDED;
+ static cm::string_view const VERSION_ENDPOINT_EXCLUDED;
std::string Name;
std::string Variable;
@@ -200,6 +235,7 @@ private:
KWIML_INT_uint64_t RequiredCMakeVersion = 0;
bool Quiet = false;
bool Required = false;
+ bool UseCpsFiles = false;
bool UseConfigFiles = true;
bool UseFindModules = true;
bool NoUserRegistry = false;
@@ -213,11 +249,34 @@ private:
bool RegistryViewDefined = false;
std::string LibraryArchitecture;
std::vector<std::string> Names;
- std::vector<std::string> Configs;
std::set<std::string> IgnoredPaths;
std::set<std::string> IgnoredPrefixPaths;
+ std::string Components;
+ std::set<std::string> RequiredComponents;
+ std::set<std::string> OptionalComponents;
+ std::set<std::string> RequiredTargets;
std::string DebugBuffer;
+ struct ConfigName
+ {
+ ConfigName(std::string const& name, PackageDescriptionType type)
+ : Name{ name }
+ , Type{ type }
+ {
+ }
+ ConfigName(std::string&& name, PackageDescriptionType type)
+ : Name{ std::move(name) }
+ , Type{ type }
+ {
+ }
+ ConfigName(ConfigName const&) = default;
+ ConfigName(ConfigName&&) = default;
+
+ std::string Name;
+ PackageDescriptionType Type;
+ };
+ std::vector<ConfigName> Configs;
+
class FlushDebugBufferOnExit;
/*! the selected sortOrder (None by default)*/
@@ -247,6 +306,9 @@ private:
};
std::vector<ConfigFileInfo> ConsideredConfigs;
+ std::unique_ptr<cmPackageInfoReader> CpsReader;
+ AppendixMap CpsAppendices;
+
friend struct std::hash<ConfigFileInfo>;
};
diff --git a/Source/cmFindPackageStack.cxx b/Source/cmFindPackageStack.cxx
index 1aeb2a7..0803049 100644
--- a/Source/cmFindPackageStack.cxx
+++ b/Source/cmFindPackageStack.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#define cmFindPackageStack_cxx
#include "cmFindPackageStack.h"
diff --git a/Source/cmFindPackageStack.h b/Source/cmFindPackageStack.h
index 2062fbc..e281b51 100644
--- a/Source/cmFindPackageStack.h
+++ b/Source/cmFindPackageStack.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 74a69d8..2169a06 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindPathCommand.h"
#include <utility>
@@ -106,7 +106,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(
globIt.FindFiles(glob);
std::vector<std::string> files = globIt.GetFiles();
if (!files.empty()) {
- std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
+ std::string fheader = cmSystemTools::ToNormalizedPathOnDisk(files[0]);
debug.FoundAt(fheader);
if (this->IncludeFileInPath) {
return fheader;
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index a7746f6..3870a09 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index af7123a..3b9a16c 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFindProgramCommand.h"
#include <algorithm>
@@ -50,12 +50,6 @@ struct cmFindProgramHelper
// Current names under consideration.
std::vector<std::string> Names;
- // Current name with extension under consideration.
- std::string TestNameExt;
-
- // Current full path under consideration.
- std::string TestPath;
-
// Debug state
cmFindBaseDebugState DebugSearches;
cmMakefile* Makefile;
@@ -83,8 +77,6 @@ struct cmFindProgramHelper
{
return std::any_of(this->Names.begin(), this->Names.end(),
[this, &path](std::string const& n) -> bool {
- // Only perform search relative to current directory
- // if the file name contains a directory separator.
return this->CheckDirectoryForName(path, n);
});
}
@@ -95,20 +87,23 @@ struct cmFindProgramHelper
if (!ext.empty() && cmHasSuffix(name, ext)) {
return false;
}
- this->TestNameExt = cmStrCat(name, ext);
- this->TestPath = cmSystemTools::CollapseFullPath(
- this->TestNameExt, path);
- bool exists = this->FileIsValid(this->TestPath);
- exists ? this->DebugSearches.FoundAt(this->TestPath)
- : this->DebugSearches.FailedAt(this->TestPath);
- if (exists) {
- this->BestPath = this->TestPath;
- return true;
+ std::string testNameExt = cmStrCat(name, ext);
+ std::string testPath =
+ cmSystemTools::CollapseFullPath(testNameExt, path);
+ if (this->FileIsExecutable(testPath)) {
+ testPath =
+ cmSystemTools::ToNormalizedPathOnDisk(testPath);
+ if (this->FindBase->Validate(testPath)) {
+ this->BestPath = testPath;
+ this->DebugSearches.FoundAt(testPath);
+ return true;
+ }
}
+ this->DebugSearches.FailedAt(testPath);
return false;
});
}
- bool FileIsValid(std::string const& file) const
+ bool FileIsExecutable(std::string const& file) const
{
if (!this->FileIsExecutableCMP0109(file)) {
return false;
@@ -124,7 +119,7 @@ struct cmFindProgramHelper
}
}
#endif
- return this->FindBase->Validate(file);
+ return true;
}
bool FileIsExecutableCMP0109(std::string const& file) const
{
@@ -132,8 +127,6 @@ struct cmFindProgramHelper
case cmPolicies::OLD:
return cmSystemTools::FileExists(file, true);
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
return cmSystemTools::FileIsExecutable(file);
default:
break;
@@ -330,7 +323,7 @@ std::string cmFindProgramCommand::GetBundleExecutable(
CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle);
if (executableURL) {
- const int MAX_OSX_PATH_SIZE = 1024;
+ int const MAX_OSX_PATH_SIZE = 1024;
UInt8 buffer[MAX_OSX_PATH_SIZE];
if (CFURLGetFileSystemRepresentation(executableURL, false, buffer,
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 161a680..0255b4de 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 33dae79..83a6abf 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmForEachCommand.h"
#include <algorithm>
@@ -12,7 +12,6 @@
#include <cstdlib>
#include <iterator>
#include <map>
-#include <sstream>
#include <stdexcept>
#include <utility>
@@ -49,7 +48,7 @@ public:
bool Replay(std::vector<cmListFileFunction> functions,
cmExecutionStatus& inStatus) override;
- void SetIterationVarsCount(const std::size_t varsCount)
+ void SetIterationVarsCount(std::size_t const varsCount)
{
this->IterationVarsCount = varsCount;
}
@@ -186,18 +185,18 @@ bool cmForEachFunctionBlocker::ReplayZipLists(
// generate names as `var_name_N`,
// where `N` is the count of lists to zip
iterationVars.resize(values.size());
- const auto iter_var_prefix = this->Args.front() + "_";
+ auto const iter_var_prefix = cmStrCat(this->Args.front(), '_');
auto i = 0u;
std::generate(
iterationVars.begin(), iterationVars.end(),
- [&]() -> std::string { return iter_var_prefix + std::to_string(i++); });
+ [&]() -> std::string { return cmStrCat(iter_var_prefix, i++); });
}
assert("Sanity check" && iterationVars.size() == values.size());
// Store old values for iteration variables
std::map<std::string, cm::optional<std::string>> oldDefs;
for (auto i = 0u; i < values.size(); ++i) {
- const auto& varName = iterationVars[i];
+ auto const& varName = iterationVars[i];
if (mf.GetPolicyStatus(cmPolicies::CMP0124) != cmPolicies::NEW) {
oldDefs.emplace(varName, mf.GetSafeDefinition(varName));
} else if (mf.IsNormalDefinitionSet(varName)) {
@@ -297,7 +296,7 @@ bool HandleInMode(std::vector<std::string> const& args,
// Copy iteration variable names first
std::copy(args.begin(), kwInIter, std::back_inserter(fb->Args));
// Remember the count of given iteration variable names
- const auto varsCount = fb->Args.size();
+ auto const varsCount = fb->Args.size();
fb->SetIterationVarsCount(varsCount);
enum Doing
@@ -358,7 +357,7 @@ bool HandleInMode(std::vector<std::string> const& args,
} else {
makefile.IssueMessage(MessageType::FATAL_ERROR,
- cmStrCat("Unknown argument:\n", " ", arg, "\n"));
+ cmStrCat("Unknown argument:\n", " ", arg, '\n'));
return true;
}
}
@@ -367,11 +366,10 @@ bool HandleInMode(std::vector<std::string> const& args,
// make sure the given lists count matches variables...
if (doing == DoingZipLists && varsCount > 1u &&
(2u * varsCount) != fb->Args.size()) {
- makefile.IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("Expected ", std::to_string(varsCount),
- " list variables, but given ",
- std::to_string(fb->Args.size() - varsCount)));
+ makefile.IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Expected ", varsCount,
+ " list variables, but given ",
+ fb->Args.size() - varsCount));
return true;
}
@@ -380,20 +378,16 @@ bool HandleInMode(std::vector<std::string> const& args,
return true;
}
-bool TryParseInteger(cmExecutionStatus& status, const std::string& str, int& i)
+bool TryParseInteger(cmExecutionStatus& status, std::string const& str, int& i)
{
try {
i = std::stoi(str);
- } catch (std::invalid_argument&) {
- std::ostringstream e;
- e << "Invalid integer: '" << str << "'";
- status.SetError(e.str());
+ } catch (std::invalid_argument const&) {
+ status.SetError(cmStrCat("Invalid integer: '", str, '\''));
cmSystemTools::SetFatalErrorOccurred();
return false;
- } catch (std::out_of_range&) {
- std::ostringstream e;
- e << "Integer out of range: '" << str << "'";
- status.SetError(e.str());
+ } catch (std::out_of_range const&) {
+ status.SetError(cmStrCat("Integer out of range: '", str, '\''));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -465,7 +459,7 @@ bool cmForEachCommand(std::vector<std::string> const& args,
// Calculate expected iterations count and reserve enough space
// in the `fb->Args` vector. The first item is the iteration variable
// name...
- const std::size_t iter_cnt = 2u +
+ std::size_t const iter_cnt = 2u +
static_cast<int>(start < stop) * (stop - start) / std::abs(step) +
static_cast<int>(start > stop) * (start - stop) / std::abs(step);
fb->Args.resize(iter_cnt);
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 6476fea..275e052 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index 542b98c..a835e19 100644
--- a/Source/cmFortranParser.h
+++ b/Source/cmFortranParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx)
@@ -17,7 +17,7 @@
using cmFortranParser = struct cmFortranParser_s;
/* Functions to enter/exit #include'd files in order. */
-bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname);
+bool cmFortranParser_FilePush(cmFortranParser* parser, char const* fname);
bool cmFortranParser_FilePop(cmFortranParser* parser);
/* Callbacks for lexer. */
@@ -25,7 +25,7 @@ int cmFortranParser_Input(cmFortranParser* parser, char* buffer,
size_t bufferSize);
void cmFortranParser_StringStart(cmFortranParser* parser);
-const char* cmFortranParser_StringEnd(cmFortranParser* parser);
+char const* cmFortranParser_StringEnd(cmFortranParser* parser);
void cmFortranParser_StringAppend(cmFortranParser* parser, char c);
void cmFortranParser_SetInInterface(cmFortranParser* parser, bool is_in);
@@ -38,26 +38,26 @@ void cmFortranParser_SetOldStartcond(cmFortranParser* parser, int arg);
int cmFortranParser_GetOldStartcond(cmFortranParser* parser);
/* Callbacks for parser. */
-void cmFortranParser_Error(cmFortranParser* parser, const char* message);
-void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name);
+void cmFortranParser_Error(cmFortranParser* parser, char const* message);
+void cmFortranParser_RuleUse(cmFortranParser* parser, char const* module_name);
void cmFortranParser_RuleUseIntrinsic(cmFortranParser* parser,
- const char* module_name);
+ char const* module_name);
void cmFortranParser_RuleLineDirective(cmFortranParser* parser,
- const char* filename);
-void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name);
+ char const* filename);
+void cmFortranParser_RuleInclude(cmFortranParser* parser, char const* name);
void cmFortranParser_RuleModule(cmFortranParser* parser,
- const char* module_name);
+ char const* module_name);
void cmFortranParser_RuleSubmodule(cmFortranParser* parser,
- const char* module_name,
- const char* submodule_name);
+ char const* module_name,
+ char const* submodule_name);
void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser,
- const char* module_name,
- const char* submodule_name,
- const char* nested_submodule_name);
-void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* name);
-void cmFortranParser_RuleUndef(cmFortranParser* parser, const char* name);
-void cmFortranParser_RuleIfdef(cmFortranParser* parser, const char* name);
-void cmFortranParser_RuleIfndef(cmFortranParser* parser, const char* name);
+ char const* module_name,
+ char const* submodule_name,
+ char const* nested_submodule_name);
+void cmFortranParser_RuleDefine(cmFortranParser* parser, char const* name);
+void cmFortranParser_RuleUndef(cmFortranParser* parser, char const* name);
+void cmFortranParser_RuleIfdef(cmFortranParser* parser, char const* name);
+void cmFortranParser_RuleIfndef(cmFortranParser* parser, char const* name);
void cmFortranParser_RuleIf(cmFortranParser* parser);
void cmFortranParser_RuleElif(cmFortranParser* parser);
void cmFortranParser_RuleElse(cmFortranParser* parser);
@@ -144,10 +144,10 @@ struct cmFortranParser_s
std::set<std::string> defines, cmFortranSourceInfo& info);
~cmFortranParser_s();
- cmFortranParser_s(const cmFortranParser_s&) = delete;
- cmFortranParser_s& operator=(const cmFortranParser_s&) = delete;
+ cmFortranParser_s(cmFortranParser_s const&) = delete;
+ cmFortranParser_s& operator=(cmFortranParser_s const&) = delete;
- bool FindIncludeFile(const char* dir, const char* includeName,
+ bool FindIncludeFile(char const* dir, char const* includeName,
std::string& fileName);
std::string ModName(std::string const& mod_name) const;
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index efcc5bb..4c0d5dd 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cassert>
#include <cstdio>
#include <set>
@@ -12,8 +12,8 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-bool cmFortranParser_s::FindIncludeFile(const char* dir,
- const char* includeName,
+bool cmFortranParser_s::FindIncludeFile(char const* dir,
+ char const* includeName,
std::string& fileName)
{
// If the file is a full path, include it directly.
@@ -85,7 +85,7 @@ std::string cmFortranParser_s::SModName(std::string const& mod_name,
return mod_name + this->Compiler.SModSep + sub_name + SModExt;
}
-bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)
+bool cmFortranParser_FilePush(cmFortranParser* parser, char const* fname)
{
// Open the new file and push it onto the stack. Save the old
// buffer with it on the stack.
@@ -146,7 +146,7 @@ void cmFortranParser_StringStart(cmFortranParser* parser)
parser->TokenString.clear();
}
-const char* cmFortranParser_StringEnd(cmFortranParser* parser)
+char const* cmFortranParser_StringEnd(cmFortranParser* parser)
{
return parser->TokenString.c_str();
}
@@ -180,12 +180,12 @@ int cmFortranParser_GetOldStartcond(cmFortranParser* parser)
return parser->OldStartcond;
}
-void cmFortranParser_Error(cmFortranParser* parser, const char* msg)
+void cmFortranParser_Error(cmFortranParser* parser, char const* msg)
{
parser->Error = msg ? msg : "unknown error";
}
-void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name)
+void cmFortranParser_RuleUse(cmFortranParser* parser, char const* module_name)
{
if (parser->InPPFalseBranch) {
return;
@@ -198,7 +198,7 @@ void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name)
}
void cmFortranParser_RuleUseIntrinsic(cmFortranParser* parser,
- const char* module_name)
+ char const* module_name)
{
if (parser->InPPFalseBranch) {
return;
@@ -211,7 +211,7 @@ void cmFortranParser_RuleUseIntrinsic(cmFortranParser* parser,
}
void cmFortranParser_RuleLineDirective(cmFortranParser* parser,
- const char* filename)
+ char const* filename)
{
// This is a #line directive naming a file encountered during preprocessing.
std::string included = filename;
@@ -233,7 +233,7 @@ void cmFortranParser_RuleLineDirective(cmFortranParser* parser,
}
}
-void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name)
+void cmFortranParser_RuleInclude(cmFortranParser* parser, char const* name)
{
if (parser->InPPFalseBranch) {
return;
@@ -261,7 +261,7 @@ void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name)
}
void cmFortranParser_RuleModule(cmFortranParser* parser,
- const char* module_name)
+ char const* module_name)
{
if (parser->InPPFalseBranch) {
return;
@@ -276,8 +276,8 @@ void cmFortranParser_RuleModule(cmFortranParser* parser,
}
void cmFortranParser_RuleSubmodule(cmFortranParser* parser,
- const char* module_name,
- const char* submodule_name)
+ char const* module_name,
+ char const* submodule_name)
{
if (parser->InPPFalseBranch) {
return;
@@ -299,9 +299,9 @@ void cmFortranParser_RuleSubmodule(cmFortranParser* parser,
}
void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser,
- const char* module_name,
- const char* submodule_name,
- const char* nested_submodule_name)
+ char const* module_name,
+ char const* submodule_name,
+ char const* nested_submodule_name)
{
if (parser->InPPFalseBranch) {
return;
@@ -319,14 +319,14 @@ void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser,
parser->Info.Provides.insert(parser->SModName(mod_name, nest_name));
}
-void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* macro)
+void cmFortranParser_RuleDefine(cmFortranParser* parser, char const* macro)
{
if (!parser->InPPFalseBranch) {
parser->PPDefinitions.insert(macro);
}
}
-void cmFortranParser_RuleUndef(cmFortranParser* parser, const char* macro)
+void cmFortranParser_RuleUndef(cmFortranParser* parser, char const* macro)
{
if (!parser->InPPFalseBranch) {
std::set<std::string>::iterator match;
@@ -337,7 +337,7 @@ void cmFortranParser_RuleUndef(cmFortranParser* parser, const char* macro)
}
}
-void cmFortranParser_RuleIfdef(cmFortranParser* parser, const char* macro)
+void cmFortranParser_RuleIfdef(cmFortranParser* parser, char const* macro)
{
// A new PP branch has been opened
parser->SkipToEnd.push(false);
@@ -352,7 +352,7 @@ void cmFortranParser_RuleIfdef(cmFortranParser* parser, const char* macro)
}
}
-void cmFortranParser_RuleIfndef(cmFortranParser* parser, const char* macro)
+void cmFortranParser_RuleIfndef(cmFortranParser* parser, char const* macro)
{
// A new PP branch has been opened
parser->SkipToEnd.push(false);
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
index 523482a..7fc6ffb 100644
--- a/Source/cmFunctionBlocker.cxx
+++ b/Source/cmFunctionBlocker.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFunctionBlocker.h"
#include <cassert>
@@ -12,7 +12,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
-bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
+bool cmFunctionBlocker::IsFunctionBlocked(cmListFileFunction const& lff,
cmExecutionStatus& status)
{
if (lff.LowerCaseName() == this->StartCommandName()) {
@@ -35,7 +35,7 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
<< " " << lfc << "\n"
<< "closes on the line\n"
<< " " << closingContext << "\n"
- << "with mis-matching arguments.";
+ << "with mis-matching arguments."; // noqa: spellcheck disable-line
/* clang-format on */
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
} else if (!this->EndCommandSupportsArguments() &&
diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h
index 3e096f2..0d2166d 100644
--- a/Source/cmFunctionBlocker.h
+++ b/Source/cmFunctionBlocker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 33721fc..8ea6c4d 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmFunctionCommand.h"
#include <utility>
@@ -79,7 +79,7 @@ bool cmFunctionHelperCommand::operator()(
// set the values for ARGV0 ARGV1 ...
for (auto t = 0u; t < expandedArgs.size(); ++t) {
- auto const value = cmStrCat(ARGV, std::to_string(t));
+ auto const value = cmStrCat(ARGV, t);
makefile.AddDefinition(value, expandedArgs[t]);
makefile.MarkVariableAsUsed(value);
}
@@ -91,8 +91,9 @@ bool cmFunctionHelperCommand::operator()(
// define ARGV and ARGN
auto const argvDef = cmList::to_string(expandedArgs);
- auto const eit = expandedArgs.begin() + (this->Args.size() - 1);
- auto const argnDef = cmList::to_string(cmMakeRange(eit, expandedArgs.end()));
+ auto const expIt = expandedArgs.begin() + (this->Args.size() - 1);
+ auto const argnDef =
+ cmList::to_string(cmMakeRange(expIt, expandedArgs.end()));
makefile.AddDefinition(ARGV, argvDef);
makefile.MarkVariableAsUsed(ARGV);
makefile.AddDefinition(ARGN, argnDef);
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index 07ff4f7..154912c 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx
index 9706c50..56f0950 100644
--- a/Source/cmGccDepfileLexerHelper.cxx
+++ b/Source/cmGccDepfileLexerHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGccDepfileLexerHelper.h"
#include <algorithm>
@@ -17,7 +17,7 @@
# include "cmsys/Encoding.h"
#endif
-bool cmGccDepfileLexerHelper::readFile(const char* filePath)
+bool cmGccDepfileLexerHelper::readFile(char const* filePath)
{
#ifdef _WIN32
wchar_t* wpath = cmsysEncoding_DupToWide(filePath);
@@ -84,7 +84,7 @@ void cmGccDepfileLexerHelper::newRuleOrDependency()
}
}
-void cmGccDepfileLexerHelper::addToCurrentPath(const char* s)
+void cmGccDepfileLexerHelper::addToCurrentPath(char const* s)
{
if (this->Content.empty()) {
return;
diff --git a/Source/cmGccDepfileLexerHelper.h b/Source/cmGccDepfileLexerHelper.h
index 91132f5..09c5b62 100644
--- a/Source/cmGccDepfileLexerHelper.h
+++ b/Source/cmGccDepfileLexerHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <utility>
@@ -11,7 +11,7 @@ class cmGccDepfileLexerHelper
public:
cmGccDepfileLexerHelper() = default;
- bool readFile(const char* filePath);
+ bool readFile(char const* filePath);
cmGccDepfileContent extractContent() && { return std::move(this->Content); }
// Functions called by the lexer
@@ -19,7 +19,7 @@ public:
void newRule();
void newDependency();
void newRuleOrDependency();
- void addToCurrentPath(const char* s);
+ void addToCurrentPath(char const* s);
private:
void sanitizeContent();
diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx
index d30dbc3..e5b86ad 100644
--- a/Source/cmGccDepfileReader.cxx
+++ b/Source/cmGccDepfileReader.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGccDepfileReader.h"
#include <type_traits>
@@ -13,7 +13,7 @@
#include "cmSystemTools.h"
cm::optional<cmGccDepfileContent> cmReadGccDepfile(
- const char* filePath, const std::string& prefix,
+ char const* filePath, std::string const& prefix,
GccDepfilePrependPaths prependPaths)
{
cmGccDepfileLexerHelper helper;
diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h
index 2433492..968ebc7 100644
--- a/Source/cmGccDepfileReader.h
+++ b/Source/cmGccDepfileReader.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -18,5 +18,5 @@ enum class GccDepfilePrependPaths
* Read dependencies file and prepend prefix to all relative paths
*/
cm::optional<cmGccDepfileContent> cmReadGccDepfile(
- const char* filePath, const std::string& prefix = {},
+ char const* filePath, std::string const& prefix = {},
GccDepfilePrependPaths prependPaths = GccDepfilePrependPaths::All);
diff --git a/Source/cmGccDepfileReaderTypes.h b/Source/cmGccDepfileReaderTypes.h
index 246e355..c531777 100644
--- a/Source/cmGccDepfileReaderTypes.h
+++ b/Source/cmGccDepfileReaderTypes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 37a2be4..161dcbc 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratedFileStream.h"
#include <cstdio>
@@ -139,7 +139,7 @@ void cmGeneratedFileStreamBase::Open(std::string const& name)
} else {
char buf[64];
snprintf(buf, sizeof(buf), "tmp%05x",
- cmSystemTools::RandomSeed() & 0xFFFFF);
+ cmSystemTools::RandomNumber() & 0xFFFFF);
this->TempName += buf;
}
@@ -203,7 +203,7 @@ int cmGeneratedFileStreamBase::CompressFile(std::string const& oldname,
return 0;
}
size_t res;
- const size_t BUFFER_SIZE = 1024;
+ size_t const BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
while ((res = fread(buffer, 1, BUFFER_SIZE, ifs)) > 0) {
if (!gzwrite(gf, buffer, static_cast<int>(res))) {
@@ -230,7 +230,7 @@ int cmGeneratedFileStreamBase::RenameFile(std::string const& oldname,
return cmSystemTools::RenameFile(oldname, newname);
}
-void cmGeneratedFileStream::SetName(const std::string& fname)
+void cmGeneratedFileStream::SetName(std::string const& fname)
{
this->Name = cmSystemTools::CollapseFullPath(fname);
}
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index a26616d..b30fc64 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -139,7 +139,7 @@ public:
* Set name of the file that will hold the actual output. This method allows
* the output file to be changed during the use of cmGeneratedFileStream.
*/
- void SetName(const std::string& fname);
+ void SetName(std::string const& fname);
/**
* Set set a custom temporary file extension used with 'Open'.
@@ -148,6 +148,11 @@ public:
void SetTempExt(std::string const& ext);
/**
+ * Get the name of the temporary file.
+ */
+ std::string const& GetTempName() const { return this->TempName; }
+
+ /**
* Write a specific string using an alternate encoding.
* Afterward, the original encoding is restored.
*/
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 580d65d..873ed7e 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpression.h"
#include <algorithm>
@@ -42,7 +42,7 @@ std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
}
std::string cmGeneratorExpression::Evaluate(
- std::string input, cmLocalGenerator* lg, const std::string& config,
+ std::string input, cmLocalGenerator* lg, std::string const& config,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
cmGeneratorTarget const* currentTarget, std::string const& language)
@@ -61,11 +61,11 @@ std::string cmGeneratorExpression::Evaluate(
return input;
}
-const std::string& cmCompiledGeneratorExpression::Evaluate(
- cmLocalGenerator* lg, const std::string& config,
- const cmGeneratorTarget* headTarget,
+std::string const& cmCompiledGeneratorExpression::Evaluate(
+ cmLocalGenerator* lg, std::string const& config,
+ cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
- const cmGeneratorTarget* currentTarget, std::string const& language) const
+ cmGeneratorTarget const* currentTarget, std::string const& language) const
{
cmGeneratorExpressionContext context(
lg, config, this->Quiet, headTarget,
@@ -78,7 +78,7 @@ const std::string& cmCompiledGeneratorExpression::Evaluate(
this->Output.clear();
- for (const auto& it : this->Evaluators) {
+ for (auto const& it : this->Evaluators) {
this->Output += it->Evaluate(&context, dagChecker);
this->SeenTargetProperties.insert(context.SeenTargetProperties.cbegin(),
@@ -125,7 +125,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
}
std::string cmGeneratorExpression::StripEmptyListElements(
- const std::string& input)
+ std::string const& input)
{
if (input.find(';') == std::string::npos) {
return input;
@@ -133,8 +133,8 @@ std::string cmGeneratorExpression::StripEmptyListElements(
std::string result;
result.reserve(input.size());
- const char* c = input.c_str();
- const char* last = c;
+ char const* c = input.c_str();
+ char const* last = c;
bool skipSemiColons = true;
for (; *c; ++c) {
if (*c == ';') {
@@ -156,7 +156,7 @@ std::string cmGeneratorExpression::StripEmptyListElements(
return result;
}
-static std::string stripAllGeneratorExpressions(const std::string& input)
+static std::string stripAllGeneratorExpressions(std::string const& input)
{
std::string result;
std::string::size_type pos = 0;
@@ -166,8 +166,8 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
result += input.substr(lastPos, pos - lastPos);
pos += 2;
nestingLevel = 1;
- const char* c = input.c_str() + pos;
- const char* const cStart = c;
+ char const* c = input.c_str() + pos;
+ char const* const cStart = c;
for (; *c; ++c) {
if (cmGeneratorExpression::StartsWithGeneratorExpression(c)) {
++nestingLevel;
@@ -181,7 +181,7 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
}
}
}
- const std::string::size_type traversed = (c - cStart) + 1;
+ std::string::size_type const traversed = (c - cStart) + 1;
if (!*c) {
result += "$<" + input.substr(pos, traversed);
}
@@ -194,12 +194,12 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
return cmGeneratorExpression::StripEmptyListElements(result);
}
-static void prefixItems(const std::string& content, std::string& result,
- const cm::string_view& prefix)
+static void prefixItems(std::string const& content, std::string& result,
+ cm::string_view const& prefix)
{
std::vector<std::string> entries;
cmGeneratorExpression::Split(content, entries);
- const char* sep = "";
+ char const* sep = "";
for (std::string const& e : entries) {
result += sep;
sep = ";";
@@ -212,7 +212,7 @@ static void prefixItems(const std::string& content, std::string& result,
}
static std::string stripExportInterface(
- const std::string& input, cmGeneratorExpression::PreprocessContext context,
+ std::string const& input, cmGeneratorExpression::PreprocessContext context,
cm::string_view importPrefix)
{
std::string result;
@@ -251,8 +251,8 @@ static std::string stripExportInterface(
assert(false && "Invalid position found");
}
nestingLevel = 1;
- const char* c = input.c_str() + pos;
- const char* const cStart = c;
+ char const* c = input.c_str() + pos;
+ char const* const cStart = c;
for (; *c; ++c) {
if (cmGeneratorExpression::StartsWithGeneratorExpression(c)) {
++nestingLevel;
@@ -269,7 +269,7 @@ static std::string stripExportInterface(
result += input.substr(pos, c - cStart);
} else if (context == cmGeneratorExpression::InstallInterface &&
foundGenex == FoundGenex::InstallInterface) {
- const std::string content = input.substr(pos, c - cStart);
+ std::string const content = input.substr(pos, c - cStart);
if (!importPrefix.empty()) {
prefixItems(content, result, importPrefix);
} else {
@@ -279,7 +279,7 @@ static std::string stripExportInterface(
break;
}
}
- const std::string::size_type traversed = (c - cStart) + 1;
+ std::string::size_type const traversed = (c - cStart) + 1;
if (!*c) {
auto remaining = input.substr(pos, traversed);
switch (foundGenex) {
@@ -304,7 +304,7 @@ static std::string stripExportInterface(
return cmGeneratorExpression::StripEmptyListElements(result);
}
-void cmGeneratorExpression::Split(const std::string& input,
+void cmGeneratorExpression::Split(std::string const& input,
std::vector<std::string>& output)
{
std::string::size_type pos = 0;
@@ -327,8 +327,8 @@ void cmGeneratorExpression::Split(const std::string& input,
}
pos += 2;
int nestingLevel = 1;
- const char* c = input.c_str() + pos;
- const char* const cStart = c;
+ char const* c = input.c_str() + pos;
+ char const* const cStart = c;
for (; *c; ++c) {
if (cmGeneratorExpression::StartsWithGeneratorExpression(c)) {
++nestingLevel;
@@ -349,7 +349,7 @@ void cmGeneratorExpression::Split(const std::string& input,
break;
}
}
- const std::string::size_type traversed = (c - cStart) + 1;
+ std::string::size_type const traversed = (c - cStart) + 1;
output.push_back(preGenex + "$<" + input.substr(pos, traversed));
pos += traversed;
lastPos = pos;
@@ -359,7 +359,7 @@ void cmGeneratorExpression::Split(const std::string& input,
}
}
-std::string cmGeneratorExpression::Preprocess(const std::string& input,
+std::string cmGeneratorExpression::Preprocess(std::string const& input,
PreprocessContext context,
cm::string_view importPrefix)
{
@@ -376,9 +376,9 @@ std::string cmGeneratorExpression::Preprocess(const std::string& input,
}
cm::string_view::size_type cmGeneratorExpression::Find(
- const cm::string_view& input)
+ cm::string_view const& input)
{
- const cm::string_view::size_type openpos = input.find("$<");
+ cm::string_view::size_type const openpos = input.find("$<");
if (openpos != cm::string_view::npos &&
input.find('>', openpos) != cm::string_view::npos) {
return openpos;
@@ -386,7 +386,7 @@ cm::string_view::size_type cmGeneratorExpression::Find(
return cm::string_view::npos;
}
-bool cmGeneratorExpression::IsValidTargetName(const std::string& input)
+bool cmGeneratorExpression::IsValidTargetName(std::string const& input)
{
// The ':' is supported to allow use with IMPORTED targets. At least
// Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter.
@@ -396,7 +396,7 @@ bool cmGeneratorExpression::IsValidTargetName(const std::string& input)
}
void cmGeneratorExpression::ReplaceInstallPrefix(
- std::string& input, const std::string& replacement)
+ std::string& input, std::string const& replacement)
{
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
@@ -410,7 +410,7 @@ void cmGeneratorExpression::ReplaceInstallPrefix(
}
void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
- const cmGeneratorTarget* tgt, std::map<std::string, std::string>& mapping)
+ cmGeneratorTarget const* tgt, std::map<std::string, std::string>& mapping)
{
auto it = this->MaxLanguageStandard.find(tgt);
if (it != this->MaxLanguageStandard.end()) {
@@ -418,8 +418,8 @@ void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
}
}
-const std::string& cmGeneratorExpressionInterpreter::Evaluate(
- std::string expression, const std::string& property)
+std::string const& cmGeneratorExpressionInterpreter::Evaluate(
+ std::string expression, std::string const& property)
{
this->CompiledGeneratorExpression =
this->GeneratorExpression.Parse(std::move(expression));
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 1349308..293459c 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -46,7 +46,7 @@ public:
std::string input) const;
static std::string Evaluate(
- std::string input, cmLocalGenerator* lg, const std::string& config,
+ std::string input, cmLocalGenerator* lg, std::string const& config,
cmGeneratorTarget const* headTarget = nullptr,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
cmGeneratorTarget const* currentTarget = nullptr,
@@ -59,30 +59,30 @@ public:
InstallInterface
};
- static std::string Preprocess(const std::string& input,
+ static std::string Preprocess(std::string const& input,
PreprocessContext context,
cm::string_view importPrefix = {});
- static void Split(const std::string& input,
+ static void Split(std::string const& input,
std::vector<std::string>& output);
- static cm::string_view::size_type Find(const cm::string_view& input);
+ static cm::string_view::size_type Find(cm::string_view const& input);
- static bool IsValidTargetName(const std::string& input);
+ static bool IsValidTargetName(std::string const& input);
- static std::string StripEmptyListElements(const std::string& input);
+ static std::string StripEmptyListElements(std::string const& input);
- static inline bool StartsWithGeneratorExpression(const std::string& input)
+ static bool StartsWithGeneratorExpression(std::string const& input)
{
return input.length() >= 2 && input[0] == '$' && input[1] == '<';
}
- static inline bool StartsWithGeneratorExpression(const char* input)
+ static bool StartsWithGeneratorExpression(char const* input)
{
return input && input[0] == '$' && input[1] == '<';
}
static void ReplaceInstallPrefix(std::string& input,
- const std::string& replacement);
+ std::string const& replacement);
private:
cmake& CMakeInstance;
@@ -98,8 +98,8 @@ public:
cmCompiledGeneratorExpression& operator=(
cmCompiledGeneratorExpression const&) = delete;
- const std::string& Evaluate(
- cmLocalGenerator* lg, const std::string& config,
+ std::string const& Evaluate(
+ cmLocalGenerator* lg, std::string const& config,
cmGeneratorTarget const* headTarget = nullptr,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
cmGeneratorTarget const* currentTarget = nullptr,
@@ -160,7 +160,7 @@ private:
cmListFileBacktrace Backtrace;
std::vector<std::unique_ptr<cmGeneratorExpressionEvaluator>> Evaluators;
- const std::string Input;
+ std::string const Input;
bool NeedsEvaluation;
bool EvaluateForBuildsystem = false;
bool Quiet = false;
@@ -198,8 +198,8 @@ public:
cmGeneratorExpressionInterpreter& operator=(
cmGeneratorExpressionInterpreter const&) = delete;
- const std::string& Evaluate(std::string expression,
- const std::string& property);
+ std::string const& Evaluate(std::string expression,
+ std::string const& property);
protected:
cmGeneratorExpression GeneratorExpression;
diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx
index 8076887..a934717 100644
--- a/Source/cmGeneratorExpressionContext.cxx
+++ b/Source/cmGeneratorExpressionContext.cxx
@@ -1,12 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionContext.h"
#include <utility>
cmGeneratorExpressionContext::cmGeneratorExpressionContext(
cmLocalGenerator* lg, std::string config, bool quiet,
- cmGeneratorTarget const* headTarget, const cmGeneratorTarget* currentTarget,
+ cmGeneratorTarget const* headTarget, cmGeneratorTarget const* currentTarget,
bool evaluateForBuildsystem, cmListFileBacktrace backtrace,
std::string language)
: Backtrace(std::move(backtrace))
diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h
index 21e3961..d013477 100644
--- a/Source/cmGeneratorExpressionContext.h
+++ b/Source/cmGeneratorExpressionContext.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
@@ -14,7 +14,7 @@ class cmLocalGenerator;
struct cmGeneratorExpressionContext
{
cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string config,
- bool quiet, const cmGeneratorTarget* headTarget,
+ bool quiet, cmGeneratorTarget const* headTarget,
cmGeneratorTarget const* currentTarget,
bool evaluateForBuildsystem,
cmListFileBacktrace backtrace,
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index c275ec6..3e8e885 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionDAGChecker.h"
#include <sstream>
@@ -43,10 +43,10 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
this->CheckResult = this->CheckGraph();
if (this->CheckResult == DAG && this->EvaluatingTransitiveProperty()) {
- const auto* top = this->Top;
+ auto const* top = this->Top;
auto it = top->Seen.find(this->Target);
if (it != top->Seen.end()) {
- const std::set<std::string>& propSet = it->second;
+ std::set<std::string> const& propSet = it->second;
if (propSet.find(this->Property) != propSet.end()) {
this->CheckResult = ALREADY_SEEN;
return;
@@ -63,7 +63,7 @@ cmGeneratorExpressionDAGChecker::Check() const
}
void cmGeneratorExpressionDAGChecker::ReportError(
- cmGeneratorExpressionContext* context, const std::string& expr)
+ cmGeneratorExpressionContext* context, std::string const& expr)
{
if (this->CheckResult == DAG) {
return;
@@ -74,7 +74,7 @@ void cmGeneratorExpressionDAGChecker::ReportError(
return;
}
- const cmGeneratorExpressionDAGChecker* parent = this->Parent;
+ cmGeneratorExpressionDAGChecker const* parent = this->Parent;
if (parent && !parent->Parent) {
std::ostringstream e;
@@ -115,7 +115,7 @@ void cmGeneratorExpressionDAGChecker::ReportError(
cmGeneratorExpressionDAGChecker::Result
cmGeneratorExpressionDAGChecker::CheckGraph() const
{
- const cmGeneratorExpressionDAGChecker* parent = this->Parent;
+ cmGeneratorExpressionDAGChecker const* parent = this->Parent;
while (parent) {
if (this->Target == parent->Target && this->Property == parent->Property) {
return (parent == this->Parent) ? SELF_REFERENCE : CYCLIC_REFERENCE;
@@ -202,7 +202,7 @@ bool cmGeneratorExpressionDAGChecker::IsComputingLinkLibraries() const
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
cmGeneratorTarget const* tgt, ForGenex genex) const
{
- const auto* top = this->Top;
+ auto const* top = this->Top;
cm::string_view prop(top->Property);
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 064804f..1601afb 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,7 +42,7 @@ struct cmGeneratorExpressionDAGChecker
Result Check() const;
void ReportError(cmGeneratorExpressionContext* context,
- const std::string& expr);
+ std::string const& expr);
bool EvaluatingTransitiveProperty() const;
bool EvaluatingGenexExpression() const;
@@ -79,13 +79,13 @@ struct cmGeneratorExpressionDAGChecker
private:
Result CheckGraph() const;
- const cmGeneratorExpressionDAGChecker* const Parent;
- const cmGeneratorExpressionDAGChecker* const Top;
+ cmGeneratorExpressionDAGChecker const* const Parent;
+ cmGeneratorExpressionDAGChecker const* const Top;
cmGeneratorTarget const* Target;
- const std::string Property;
+ std::string const Property;
mutable std::map<cmGeneratorTarget const*, std::set<std::string>> Seen;
- const GeneratorExpressionContent* const Content;
- const cmListFileBacktrace Backtrace;
+ GeneratorExpressionContent const* const Content;
+ cmListFileBacktrace const Backtrace;
Result CheckResult;
bool TransitivePropertiesOnly = false;
bool CMP0131 = false;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 817437e..4664dea 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionEvaluationFile.h"
#include <memory>
@@ -35,7 +35,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
}
void cmGeneratorExpressionEvaluationFile::Generate(
- cmLocalGenerator* lg, const std::string& config, const std::string& lang,
+ cmLocalGenerator* lg, std::string const& config, std::string const& lang,
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string>& outputFiles, mode_t perm)
{
@@ -58,9 +58,9 @@ void cmGeneratorExpressionEvaluationFile::Generate(
}
}
- const std::string outputFileName =
+ std::string const outputFileName =
this->GetOutputFileName(lg, target, config, lang);
- const std::string& outputContent =
+ std::string const& outputContent =
inputExpression->Evaluate(lg, config, target, nullptr, nullptr, lang);
auto it = outputFiles.find(outputFileName);
@@ -142,7 +142,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
if (this->InputIsContent) {
inputContent = this->Input;
} else {
- const std::string inputFileName = this->GetInputFileName(lg);
+ std::string const inputFileName = this->GetInputFileName(lg);
lg->GetMakefile()->AddCMakeDependFile(inputFileName);
if (!this->Permissions) {
cmSystemTools::GetPermissions(inputFileName.c_str(), this->Permissions);
@@ -204,8 +204,8 @@ std::string cmGeneratorExpressionEvaluationFile::GetInputFileName(
}
std::string cmGeneratorExpressionEvaluationFile::GetOutputFileName(
- cmLocalGenerator* lg, cmGeneratorTarget* target, const std::string& config,
- const std::string& lang)
+ cmLocalGenerator* lg, cmGeneratorTarget* target, std::string const& config,
+ std::string const& lang)
{
std::string outputFileName =
this->OutputFileExpr->Evaluate(lg, config, target, nullptr, nullptr, lang);
@@ -253,8 +253,6 @@ std::string cmGeneratorExpressionEvaluationFile::FixRelativePath(
// which ends up being used relative to the working dir.
resultPath = relativePath;
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// NEW behavior is to interpret the relative path with respect
// to the current source or binary directory.
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index 0eb78ac..5826636 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,16 +34,16 @@ public:
void CreateOutputFile(cmLocalGenerator* lg, std::string const& config);
private:
- void Generate(cmLocalGenerator* lg, const std::string& config,
- const std::string& lang,
+ void Generate(cmLocalGenerator* lg, std::string const& config,
+ std::string const& lang,
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string>& outputFiles, mode_t perm);
std::string GetInputFileName(cmLocalGenerator* lg);
std::string GetOutputFileName(cmLocalGenerator* lg,
cmGeneratorTarget* target,
- const std::string& config,
- const std::string& lang);
+ std::string const& config,
+ std::string const& lang);
enum PathRole
{
PathForInput,
@@ -52,13 +52,13 @@ private:
std::string FixRelativePath(std::string const& filePath, PathRole role,
cmLocalGenerator* lg);
- const std::string Input;
- const std::string Target;
- const std::unique_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
- const std::unique_ptr<cmCompiledGeneratorExpression> Condition;
+ std::string const Input;
+ std::string const Target;
+ std::unique_ptr<cmCompiledGeneratorExpression> const OutputFileExpr;
+ std::unique_ptr<cmCompiledGeneratorExpression> const Condition;
std::vector<std::string> Files;
- const bool InputIsContent;
- const std::string NewLineCharacter;
+ bool const InputIsContent;
+ std::string const NewLineCharacter;
cmPolicies::PolicyStatus PolicyStatusCMP0070;
mode_t Permissions;
};
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 50334ef..47c455f 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionEvaluator.h"
#include <sstream>
@@ -14,7 +14,7 @@
#include "cmake.h"
GeneratorExpressionContent::GeneratorExpressionContent(
- const char* startContent, size_t length)
+ char const* startContent, size_t length)
: StartContent(startContent)
, ContentLength(length)
{
@@ -28,16 +28,16 @@ std::string GeneratorExpressionContent::GetOriginalExpression() const
}
std::string GeneratorExpressionContent::ProcessArbitraryContent(
- const cmGeneratorExpressionNode* node, const std::string& identifier,
+ cmGeneratorExpressionNode const* node, std::string const& identifier,
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker,
std::vector<cmGeneratorExpressionEvaluatorVector>::const_iterator pit) const
{
std::string result;
- const auto pend = this->ParamChildren.end();
+ auto const pend = this->ParamChildren.end();
for (; pit != pend; ++pit) {
- for (const auto& pExprEval : *pit) {
+ for (auto const& pExprEval : *pit) {
if (node->RequiresLiteralInput()) {
if (pExprEval->GetType() != cmGeneratorExpressionEvaluator::Text) {
reportError(context, this->GetOriginalExpression(),
@@ -75,7 +75,7 @@ std::string GeneratorExpressionContent::Evaluate(
std::string identifier;
{
- for (const auto& pExprEval : this->IdentifierChildren) {
+ for (auto const& pExprEval : this->IdentifierChildren) {
identifier += pExprEval->Evaluate(context, dagChecker);
if (context->HadError) {
return std::string();
@@ -83,7 +83,7 @@ std::string GeneratorExpressionContent::Evaluate(
}
}
- const cmGeneratorExpressionNode* node =
+ cmGeneratorExpressionNode const* node =
cmGeneratorExpressionNode::GetNode(identifier);
if (!node) {
@@ -134,16 +134,16 @@ std::string GeneratorExpressionContent::Evaluate(
}
std::string GeneratorExpressionContent::EvaluateParameters(
- const cmGeneratorExpressionNode* node, const std::string& identifier,
+ cmGeneratorExpressionNode const* node, std::string const& identifier,
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker,
std::vector<std::string>& parameters) const
{
- const int numExpected = node->NumExpectedParameters();
+ int const numExpected = node->NumExpectedParameters();
{
auto pit = this->ParamChildren.begin();
- const auto pend = this->ParamChildren.end();
- const bool acceptsArbitraryContent =
+ auto const pend = this->ParamChildren.end();
+ bool const acceptsArbitraryContent =
node->AcceptsArbitraryContentParameter();
int counter = 1;
for (; pit != pend; ++pit, ++counter) {
@@ -154,7 +154,7 @@ std::string GeneratorExpressionContent::EvaluateParameters(
}
std::string parameter;
if (node->ShouldEvaluateNextParameter(parameters, parameter)) {
- for (const auto& pExprEval : *pit) {
+ for (auto const& pExprEval : *pit) {
parameter += pExprEval->Evaluate(context, dagChecker);
if (context->HadError) {
return std::string();
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 8f47c0b..d985e63 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,7 +41,7 @@ using cmGeneratorExpressionEvaluatorVector =
struct TextContent : public cmGeneratorExpressionEvaluator
{
- TextContent(const char* start, size_t length)
+ TextContent(char const* start, size_t length)
: Content(start)
, Length(length)
{
@@ -63,13 +63,13 @@ struct TextContent : public cmGeneratorExpressionEvaluator
size_t GetLength() const { return this->Length; }
private:
- const char* Content;
+ char const* Content;
size_t Length;
};
struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
{
- GeneratorExpressionContent(const char* startContent, size_t length);
+ GeneratorExpressionContent(char const* startContent, size_t length);
void SetIdentifier(cmGeneratorExpressionEvaluatorVector&& identifier)
{
@@ -95,14 +95,14 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
~GeneratorExpressionContent() override;
private:
- std::string EvaluateParameters(const cmGeneratorExpressionNode* node,
- const std::string& identifier,
+ std::string EvaluateParameters(cmGeneratorExpressionNode const* node,
+ std::string const& identifier,
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker,
std::vector<std::string>& parameters) const;
std::string ProcessArbitraryContent(
- const cmGeneratorExpressionNode* node, const std::string& identifier,
+ cmGeneratorExpressionNode const* node, std::string const& identifier,
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker,
std::vector<cmGeneratorExpressionEvaluatorVector>::const_iterator pit)
@@ -110,6 +110,6 @@ private:
cmGeneratorExpressionEvaluatorVector IdentifierChildren;
std::vector<cmGeneratorExpressionEvaluatorVector> ParamChildren;
- const char* StartContent;
+ char const* StartContent;
size_t ContentLength;
};
diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx
index b8c38c0..0332568 100644
--- a/Source/cmGeneratorExpressionLexer.cxx
+++ b/Source/cmGeneratorExpressionLexer.cxx
@@ -1,10 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionLexer.h"
cmGeneratorExpressionLexer::cmGeneratorExpressionLexer() = default;
-static void InsertText(const char* upto, const char* c,
+static void InsertText(char const* upto, char const* c,
std::vector<cmGeneratorExpressionToken>& result)
{
if (upto != c) {
@@ -13,7 +13,7 @@ static void InsertText(const char* upto, const char* c,
}
std::vector<cmGeneratorExpressionToken> cmGeneratorExpressionLexer::Tokenize(
- const std::string& input)
+ std::string const& input)
{
std::vector<cmGeneratorExpressionToken> result;
@@ -23,8 +23,8 @@ std::vector<cmGeneratorExpressionToken> cmGeneratorExpressionLexer::Tokenize(
return result;
}
- const char* c = input.c_str();
- const char* upto = c;
+ char const* c = input.c_str();
+ char const* upto = c;
for (; *c; ++c) {
switch (*c) {
diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h
index a4321d1..2d988bb 100644
--- a/Source/cmGeneratorExpressionLexer.h
+++ b/Source/cmGeneratorExpressionLexer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,7 +10,7 @@
struct cmGeneratorExpressionToken
{
- cmGeneratorExpressionToken(unsigned type, const char* c, size_t l)
+ cmGeneratorExpressionToken(unsigned type, char const* c, size_t l)
: TokenType(type)
, Content(c)
, Length(l)
@@ -25,7 +25,7 @@ struct cmGeneratorExpressionToken
CommaSeparator
};
unsigned TokenType;
- const char* Content;
+ char const* Content;
size_t Length;
};
@@ -37,7 +37,7 @@ class cmGeneratorExpressionLexer
public:
cmGeneratorExpressionLexer();
- std::vector<cmGeneratorExpressionToken> Tokenize(const std::string& input);
+ std::vector<cmGeneratorExpressionToken> Tokenize(std::string const& input);
bool GetSawGeneratorExpression() const
{
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index f6c2d22..31923d6 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionNode.h"
#include <algorithm>
@@ -85,9 +85,9 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& /*parameters*/,
+ std::vector<std::string> const& /*parameters*/,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return std::string();
@@ -101,9 +101,9 @@ static const struct OneNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return parameters.front();
@@ -118,8 +118,8 @@ static const struct OneNode buildLocalInterfaceNode;
struct BooleanOpNode : public cmGeneratorExpressionNode
{
- BooleanOpNode(const char* op_, const char* successVal_,
- const char* failureVal_)
+ BooleanOpNode(char const* op_, char const* successVal_,
+ char const* failureVal_)
: op(op_)
, successVal(successVal_)
, failureVal(failureVal_)
@@ -128,7 +128,7 @@ struct BooleanOpNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return OneOrMoreParameters; }
- bool ShouldEvaluateNextParameter(const std::vector<std::string>& parameters,
+ bool ShouldEvaluateNextParameter(std::vector<std::string> const& parameters,
std::string& def_value) const override
{
if (!parameters.empty() && parameters.back() == failureVal) {
@@ -138,9 +138,9 @@ struct BooleanOpNode : public cmGeneratorExpressionNode
return true;
}
- std::string Evaluate(const std::vector<std::string>& parameters,
+ std::string Evaluate(std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker*) const override
{
for (std::string const& param : parameters) {
@@ -158,19 +158,19 @@ struct BooleanOpNode : public cmGeneratorExpressionNode
return this->successVal;
}
- const char *const op, *const successVal, *const failureVal;
+ char const *const op, *const successVal, *const failureVal;
};
-static const BooleanOpNode andNode("AND", "1", "0"), orNode("OR", "0", "1");
+static BooleanOpNode const andNode("AND", "1", "0"), orNode("OR", "0", "1");
static const struct NotNode : public cmGeneratorExpressionNode
{
NotNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (parameters.front() != "0" && parameters.front() != "1") {
@@ -190,9 +190,9 @@ static const struct BoolNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return !cmIsOff(parameters.front()) ? "1" : "0";
@@ -205,16 +205,16 @@ static const struct IfNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 3; }
- bool ShouldEvaluateNextParameter(const std::vector<std::string>& parameters,
+ bool ShouldEvaluateNextParameter(std::vector<std::string> const& parameters,
std::string&) const override
{
return (parameters.empty() ||
parameters[0] != cmStrCat(parameters.size() - 1, ""));
}
- std::string Evaluate(const std::vector<std::string>& parameters,
+ std::string Evaluate(std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker*) const override
{
if (parameters[0] != "1" && parameters[0] != "0") {
@@ -234,9 +234,9 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 2; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return parameters.front() == parameters[1] ? "1" : "0";
@@ -250,9 +250,9 @@ static const struct EqualNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 2; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
long numbers[2];
@@ -267,9 +267,9 @@ static const struct EqualNode : public cmGeneratorExpressionNode
return numbers[0] == numbers[1] ? "1" : "0";
}
- static bool ParameterToLong(const char* param, long* outResult)
+ static bool ParameterToLong(char const* param, long* outResult)
{
- const char isNegative = param[0] == '-';
+ char const isNegative = param[0] == '-';
int base = 0;
if (cmHasLiteralPrefix(param, "0b") || cmHasLiteralPrefix(param, "0B")) {
@@ -303,9 +303,9 @@ static const struct InListNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 2; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
cmList values;
@@ -333,8 +333,6 @@ static const struct InListNode : public cmGeneratorExpressionNode
return "0";
}
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
values.assign(parameters[1], cmList::EmptyElements::Yes);
break;
@@ -351,9 +349,9 @@ static const struct FilterNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 3; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (parameters.size() != 3) {
@@ -390,9 +388,9 @@ static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (parameters.size() != 1) {
@@ -415,9 +413,9 @@ static const struct TargetExistsNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (parameters.size() != 1) {
@@ -446,9 +444,9 @@ static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (parameters.size() != 1) {
@@ -479,9 +477,9 @@ struct GenexEvaluator : public cmGeneratorExpressionNode
protected:
std::string EvaluateExpression(
- const std::string& genexOperator, const std::string& expression,
+ std::string const& genexOperator, std::string const& expression,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagCheckerParent) const
{
if (context->HeadTarget) {
@@ -525,12 +523,12 @@ static const struct TargetGenexEvalNode : public GenexEvaluator
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagCheckerParent) const override
{
- const std::string& targetName = parameters.front();
+ std::string const& targetName = parameters.front();
if (targetName.empty() ||
!cmGeneratorExpression::IsValidTargetName(targetName)) {
reportError(context, content->GetOriginalExpression(),
@@ -539,7 +537,7 @@ static const struct TargetGenexEvalNode : public GenexEvaluator
return std::string();
}
- const auto* target = context->LG->FindGeneratorTargetToUse(targetName);
+ auto const* target = context->LG->FindGeneratorTargetToUse(targetName);
if (!target) {
std::ostringstream e;
e << "$<TARGET_GENEX_EVAL:tgt, ...> target \"" << targetName
@@ -548,7 +546,7 @@ static const struct TargetGenexEvalNode : public GenexEvaluator
return std::string();
}
- const std::string& expression = parameters[1];
+ std::string const& expression = parameters[1];
if (expression.empty()) {
return expression;
}
@@ -572,12 +570,12 @@ static const struct GenexEvalNode : public GenexEvaluator
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagCheckerParent) const override
{
- const std::string& expression = parameters[0];
+ std::string const& expression = parameters[0];
if (expression.empty()) {
return expression;
}
@@ -594,9 +592,9 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return cmSystemTools::LowerCase(parameters.front());
@@ -610,9 +608,9 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return cmSystemTools::UpperCase(parameters.front());
@@ -633,7 +631,7 @@ public:
using difference_type = typename Container::difference_type;
using const_reference = typename Container::const_reference;
- Range(const Container& container)
+ Range(Container const& container)
: Base(container.begin(), container.end())
{
}
@@ -661,7 +659,7 @@ public:
using Arguments = Range<std::vector<std::string>>;
bool CheckGenExParameters(cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
cm::string_view genex, cm::string_view option,
std::size_t count, int required = 1,
bool exactly = true)
@@ -683,7 +681,7 @@ bool CheckGenExParameters(cmGeneratorExpressionContext* ctx,
nbParameters = "four parameters";
break;
default:
- nbParameters = cmStrCat(std::to_string(required), " parameters");
+ nbParameters = cmStrCat(required, " parameters");
}
reportError(ctx, cnt->GetOriginalExpression(),
cmStrCat("$<", genex, ':', option, "> expression requires ",
@@ -695,7 +693,7 @@ bool CheckGenExParameters(cmGeneratorExpressionContext* ctx,
};
bool CheckPathParametersEx(cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
cm::string_view option, std::size_t count,
int required = 1, bool exactly = true)
{
@@ -703,8 +701,8 @@ bool CheckPathParametersEx(cmGeneratorExpressionContext* ctx,
exactly);
}
bool CheckPathParameters(cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
- cm::string_view option, const Arguments& args,
+ GeneratorExpressionContent const* cnt,
+ cm::string_view option, Arguments const& args,
int required = 1)
{
return CheckPathParametersEx(ctx, cnt, option, args.size(), required);
@@ -725,9 +723,9 @@ static const struct PathNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
static auto processList =
@@ -741,12 +739,12 @@ static const struct PathNode : public cmGeneratorExpressionNode
static std::unordered_map<
cm::string_view,
std::function<std::string(cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
+ GeneratorExpressionContent const*,
Arguments&)>>
pathCommands{
{ "GET_ROOT_NAME"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "GET_ROOT_NAME"_s, args) &&
!args.front().empty()) {
@@ -758,7 +756,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_ROOT_DIRECTORY"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "GET_ROOT_DIRECTORY"_s, args) &&
!args.front().empty()) {
@@ -770,7 +768,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_ROOT_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "GET_ROOT_PATH"_s, args) &&
!args.front().empty()) {
@@ -782,7 +780,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_FILENAME"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "GET_FILENAME"_s, args) &&
!args.front().empty()) {
@@ -794,7 +792,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_EXTENSION"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool lastOnly = args.front() == "LAST_ONLY"_s;
if (lastOnly) {
@@ -820,7 +818,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_STEM"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool lastOnly = args.front() == "LAST_ONLY"_s;
if (lastOnly) {
@@ -845,7 +843,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_RELATIVE_PART"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "GET_RELATIVE_PART"_s, args) &&
!args.front().empty()) {
@@ -857,7 +855,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "GET_PARENT_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "GET_PARENT_PATH"_s, args)) {
return processList(args.front(), [](std::string& value) {
@@ -868,7 +866,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_ROOT_NAME"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_ROOT_NAME"_s, args)
? ToString(cmCMakePath{ args.front() }.HasRootName())
@@ -876,7 +874,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_ROOT_DIRECTORY"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_ROOT_DIRECTORY"_s, args)
? ToString(cmCMakePath{ args.front() }.HasRootDirectory())
@@ -884,7 +882,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_ROOT_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_ROOT_PATH"_s, args)
? ToString(cmCMakePath{ args.front() }.HasRootPath())
@@ -892,7 +890,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_FILENAME"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_FILENAME"_s, args)
? ToString(cmCMakePath{ args.front() }.HasFileName())
@@ -900,7 +898,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_EXTENSION"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_EXTENSION"_s, args) &&
!args.front().empty()
@@ -909,7 +907,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_STEM"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_STEM"_s, args)
? ToString(cmCMakePath{ args.front() }.HasStem())
@@ -917,7 +915,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_RELATIVE_PART"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_RELATIVE_PART"_s, args)
? ToString(cmCMakePath{ args.front() }.HasRelativePath())
@@ -925,7 +923,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "HAS_PARENT_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "HAS_PARENT_PATH"_s, args)
? ToString(cmCMakePath{ args.front() }.HasParentPath())
@@ -933,7 +931,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "IS_ABSOLUTE"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "IS_ABSOLUTE"_s, args)
? ToString(cmCMakePath{ args.front() }.IsAbsolute())
@@ -941,7 +939,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "IS_RELATIVE"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
return CheckPathParameters(ctx, cnt, "IS_RELATIVE"_s, args)
? ToString(cmCMakePath{ args.front() }.IsRelative())
@@ -949,7 +947,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "IS_PREFIX"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool normalize = args.front() == "NORMALIZE"_s;
if (normalize) {
@@ -970,7 +968,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "CMAKE_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool normalize = args.front() == "NORMALIZE"_s;
if (normalize) {
@@ -989,9 +987,30 @@ static const struct PathNode : public cmGeneratorExpressionNode
}
return std::string{};
} },
+ { "NATIVE_PATH"_s,
+ [](cmGeneratorExpressionContext* ctx,
+ GeneratorExpressionContent const* cnt,
+ Arguments& args) -> std::string {
+ bool normalize = args.front() == "NORMALIZE"_s;
+ if (normalize) {
+ args.advance(1);
+ }
+ if (CheckPathParametersEx(ctx, cnt,
+ normalize ? "NATIVE_PATH,NORMALIZE"_s
+ : "NATIVE_PATH"_s,
+ args.size(), 1)) {
+ return processList(
+ args.front(), [normalize](std::string& value) {
+ auto path = cmCMakePath{ value };
+ value = normalize ? path.Normal().NativeString()
+ : path.NativeString();
+ });
+ }
+ return std::string{};
+ } },
{ "APPEND"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParametersEx(ctx, cnt, "APPEND"_s, args.size(), 1,
false)) {
@@ -1000,7 +1019,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
return processList(list, [&args](std::string& value) {
cmCMakePath path{ value };
- for (const auto& p : args) {
+ for (auto const& p : args) {
path /= p;
}
value = path.String();
@@ -1010,7 +1029,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "REMOVE_FILENAME"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "REMOVE_FILENAME"_s, args) &&
!args.front().empty()) {
@@ -1022,7 +1041,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "REPLACE_FILENAME"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "REPLACE_FILENAME"_s, args, 2)) {
return processList(args.front(), [&args](std::string& value) {
@@ -1035,7 +1054,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "REMOVE_EXTENSION"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool lastOnly = args.front() == "LAST_ONLY"_s;
if (lastOnly) {
@@ -1061,7 +1080,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "REPLACE_EXTENSION"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool lastOnly = args.front() == "LAST_ONLY"_s;
if (lastOnly) {
@@ -1089,7 +1108,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "NORMAL_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "NORMAL_PATH"_s, args) &&
!args.front().empty()) {
@@ -1101,7 +1120,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "RELATIVE_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckPathParameters(ctx, cnt, "RELATIVE_PATH"_s, args, 2)) {
return processList(args.front(), [&args](std::string& value) {
@@ -1112,7 +1131,7 @@ static const struct PathNode : public cmGeneratorExpressionNode
} },
{ "ABSOLUTE_PATH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
bool normalize = args.front() == "NORMALIZE"_s;
if (normalize) {
@@ -1150,9 +1169,9 @@ static const struct PathEqualNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 2; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return cmCMakePath{ parameters[0] } == cmCMakePath{ parameters[1] } ? "1"
@@ -1162,7 +1181,7 @@ static const struct PathEqualNode : public cmGeneratorExpressionNode
namespace {
inline bool CheckListParametersEx(cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
cm::string_view option, std::size_t count,
int required = 1, bool exactly = true)
{
@@ -1170,8 +1189,8 @@ inline bool CheckListParametersEx(cmGeneratorExpressionContext* ctx,
exactly);
}
inline bool CheckListParameters(cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
- cm::string_view option, const Arguments& args,
+ GeneratorExpressionContent const* cnt,
+ cm::string_view option, Arguments const& args,
int required = 1)
{
return CheckListParametersEx(ctx, cnt, option, args.size(), required);
@@ -1182,7 +1201,7 @@ inline cmList GetList(std::string const& list)
return list.empty() ? cmList{} : cmList{ list, cmList::EmptyElements::Yes };
}
-bool GetNumericArgument(const std::string& arg, cmList::index_type& value)
+bool GetNumericArgument(std::string const& arg, cmList::index_type& value)
{
try {
std::size_t pos;
@@ -1197,7 +1216,7 @@ bool GetNumericArgument(const std::string& arg, cmList::index_type& value)
// this is not a number
return false;
}
- } catch (const std::invalid_argument&) {
+ } catch (std::invalid_argument const&) {
return false;
}
@@ -1205,7 +1224,7 @@ bool GetNumericArgument(const std::string& arg, cmList::index_type& value)
}
bool GetNumericArguments(
- cmGeneratorExpressionContext* ctx, const GeneratorExpressionContent* cnt,
+ cmGeneratorExpressionContext* ctx, GeneratorExpressionContent const* cnt,
Arguments const& args, std::vector<cmList::index_type>& indexes,
cmList::ExpandElements expandElements = cmList::ExpandElements::No)
{
@@ -1239,20 +1258,20 @@ static const struct ListNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
static std::unordered_map<
cm::string_view,
std::function<std::string(cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
+ GeneratorExpressionContent const*,
Arguments&)>>
listCommands{
{ "LENGTH"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "LENGTH"_s, args)) {
return std::to_string(GetList(args.front()).size());
@@ -1261,7 +1280,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "GET"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "GET"_s, args.size(), 2,
false)) {
@@ -1289,7 +1308,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "JOIN"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "JOIN"_s, args, 2)) {
return GetList(args.front()).join(args[1]);
@@ -1298,7 +1317,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "SUBLIST"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "SUBLIST"_s, args, 3)) {
auto list = GetList(args.front());
@@ -1335,7 +1354,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "FIND"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "FIND"_s, args, 2)) {
auto list = GetList(args.front());
@@ -1346,7 +1365,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "APPEND"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "APPEND"_s, args.size(), 2,
false)) {
@@ -1358,7 +1377,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "PREPEND"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "PREPEND"_s, args.size(), 2,
false)) {
@@ -1370,7 +1389,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "INSERT"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "INSERT"_s, args.size(), 3,
false)) {
@@ -1397,7 +1416,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "POP_BACK"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "POP_BACK"_s, args)) {
auto list = GetList(args.front());
@@ -1410,7 +1429,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "POP_FRONT"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "POP_FRONT"_s, args)) {
auto list = GetList(args.front());
@@ -1423,7 +1442,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "REMOVE_DUPLICATES"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "REMOVE_DUPLICATES"_s, args)) {
return GetList(args.front()).remove_duplicates().to_string();
@@ -1432,7 +1451,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "REMOVE_ITEM"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "REMOVE_ITEM"_s, args.size(),
2, false)) {
@@ -1446,7 +1465,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "REMOVE_AT"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "REMOVE_AT"_s, args.size(), 2,
false)) {
@@ -1468,7 +1487,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "FILTER"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "FILTER"_s, args, 3)) {
auto const& op = args[1];
@@ -1497,7 +1516,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "TRANSFORM"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "TRANSFORM"_s, args.size(), 2,
false)) {
@@ -1517,7 +1536,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
{
}
- operator const std::string&() const { return this->Name; }
+ operator std::string const&() const { return this->Name; }
std::string Name;
cmList::TransformAction Action;
@@ -1526,7 +1545,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
static std::set<
ActionDescriptor,
- std::function<bool(const std::string&, const std::string&)>>
+ std::function<bool(std::string const&, std::string const&)>>
descriptors{
{ { "APPEND", cmList::TransformAction::APPEND, 1 },
{ "PREPEND", cmList::TransformAction::PREPEND, 1 },
@@ -1534,7 +1553,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
{ "TOLOWER", cmList::TransformAction::TOLOWER, 0 },
{ "STRIP", cmList::TransformAction::STRIP, 0 },
{ "REPLACE", cmList::TransformAction::REPLACE, 2 } },
- [](const std::string& x, const std::string& y) {
+ [](std::string const& x, std::string const& y) {
return x < y;
}
};
@@ -1563,9 +1582,9 @@ static const struct ListNode : public cmGeneratorExpressionNode
args.advance(descriptor->Arity);
}
- const std::string REGEX{ "REGEX" };
- const std::string AT{ "AT" };
- const std::string FOR{ "FOR" };
+ std::string const REGEX{ "REGEX" };
+ std::string const AT{ "AT" };
+ std::string const FOR{ "FOR" };
std::unique_ptr<cmList::TransformSelector> selector;
try {
@@ -1706,7 +1725,7 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "REVERSE"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParameters(ctx, cnt, "REVERSE"_s, args)) {
return GetList(args.front()).reverse().to_string();
@@ -1715,15 +1734,15 @@ static const struct ListNode : public cmGeneratorExpressionNode
} },
{ "SORT"_s,
[](cmGeneratorExpressionContext* ctx,
- const GeneratorExpressionContent* cnt,
+ GeneratorExpressionContent const* cnt,
Arguments& args) -> std::string {
if (CheckListParametersEx(ctx, cnt, "SORT"_s, args.size(), 1,
false)) {
auto list = GetList(args.front());
args.advance(1);
- const auto COMPARE = "COMPARE:"_s;
- const auto CASE = "CASE:"_s;
- const auto ORDER = "ORDER:"_s;
+ auto const COMPARE = "COMPARE:"_s;
+ auto const CASE = "CASE:"_s;
+ auto const ORDER = "ORDER:"_s;
using SortConfig = cmList::SortConfiguration;
SortConfig sortConfig;
for (auto const& arg : args) {
@@ -1838,9 +1857,9 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return cmSystemTools::MakeCidentifier(parameters.front());
@@ -1855,22 +1874,22 @@ struct CharacterNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 0; }
std::string Evaluate(
- const std::vector<std::string>& /*parameters*/,
+ std::vector<std::string> const& /*parameters*/,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return { C };
}
};
-static const CharacterNode<'>'> angle_rNode;
-static const CharacterNode<','> commaNode;
-static const CharacterNode<';'> semicolonNode;
-static const CharacterNode<'"'> quoteNode;
+static CharacterNode<'>'> const angle_rNode;
+static CharacterNode<','> const commaNode;
+static CharacterNode<';'> const semicolonNode;
+static CharacterNode<'"'> const quoteNode;
struct CompilerIdNode : public cmGeneratorExpressionNode
{
- CompilerIdNode(const char* compilerLang)
+ CompilerIdNode(char const* compilerLang)
: CompilerLanguage(compilerLang)
{
}
@@ -1878,9 +1897,9 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget) {
@@ -1895,11 +1914,11 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
this->CompilerLanguage);
}
- std::string EvaluateWithLanguage(const std::vector<std::string>& parameters,
+ std::string EvaluateWithLanguage(std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*unused*/,
- const std::string& lang) const
+ std::string const& lang) const
{
std::string const& compilerId =
context->LG->GetMakefile()->GetSafeDefinition("CMAKE_" + lang +
@@ -1913,7 +1932,6 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$");
for (auto const& param : parameters) {
-
if (!compilerIdValidator.find(param)) {
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
@@ -1923,39 +1941,21 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
if (strcmp(param.c_str(), compilerId.c_str()) == 0) {
return "1";
}
-
- if (cmsysString_strcasecmp(param.c_str(), compilerId.c_str()) == 0) {
- switch (context->LG->GetPolicyStatus(cmPolicies::CMP0044)) {
- case cmPolicies::WARN: {
- context->LG->GetCMakeInstance()->IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0044),
- context->Backtrace);
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD:
- return "1";
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- break;
- }
- }
}
return "0";
}
- const char* const CompilerLanguage;
+ char const* const CompilerLanguage;
};
-static const CompilerIdNode cCompilerIdNode("C"), cxxCompilerIdNode("CXX"),
+static CompilerIdNode const cCompilerIdNode("C"), cxxCompilerIdNode("CXX"),
cudaCompilerIdNode("CUDA"), objcCompilerIdNode("OBJC"),
objcxxCompilerIdNode("OBJCXX"), fortranCompilerIdNode("Fortran"),
hipCompilerIdNode("HIP"), ispcCompilerIdNode("ISPC");
struct CompilerVersionNode : public cmGeneratorExpressionNode
{
- CompilerVersionNode(const char* compilerLang)
+ CompilerVersionNode(char const* compilerLang)
: CompilerLanguage(compilerLang)
{
}
@@ -1963,9 +1963,9 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return OneOrZeroParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget) {
@@ -1980,11 +1980,11 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
this->CompilerLanguage);
}
- std::string EvaluateWithLanguage(const std::vector<std::string>& parameters,
+ std::string EvaluateWithLanguage(std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*unused*/,
- const std::string& lang) const
+ std::string const& lang) const
{
std::string const& compilerVersion =
context->LG->GetMakefile()->GetSafeDefinition("CMAKE_" + lang +
@@ -2009,10 +2009,10 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
: "0";
}
- const char* const CompilerLanguage;
+ char const* const CompilerLanguage;
};
-static const CompilerVersionNode cCompilerVersionNode("C"),
+static CompilerVersionNode const cCompilerVersionNode("C"),
cxxCompilerVersionNode("CXX"), cudaCompilerVersionNode("CUDA"),
objcCompilerVersionNode("OBJC"), objcxxCompilerVersionNode("OBJCXX"),
fortranCompilerVersionNode("Fortran"), ispcCompilerVersionNode("ISPC"),
@@ -2020,7 +2020,7 @@ static const CompilerVersionNode cCompilerVersionNode("C"),
struct CompilerFrontendVariantNode : public cmGeneratorExpressionNode
{
- CompilerFrontendVariantNode(const char* compilerLang)
+ CompilerFrontendVariantNode(char const* compilerLang)
: CompilerLanguage(compilerLang)
{
}
@@ -2028,9 +2028,9 @@ struct CompilerFrontendVariantNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget) {
@@ -2045,11 +2045,11 @@ struct CompilerFrontendVariantNode : public cmGeneratorExpressionNode
this->CompilerLanguage);
}
- std::string EvaluateWithLanguage(const std::vector<std::string>& parameters,
+ std::string EvaluateWithLanguage(std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*unused*/,
- const std::string& lang) const
+ std::string const& lang) const
{
std::string const& compilerFrontendVariant =
context->LG->GetMakefile()->GetSafeDefinition(
@@ -2076,10 +2076,10 @@ struct CompilerFrontendVariantNode : public cmGeneratorExpressionNode
return "0";
}
- const char* const CompilerLanguage;
+ char const* const CompilerLanguage;
};
-static const CompilerFrontendVariantNode cCompilerFrontendVariantNode("C"),
+static CompilerFrontendVariantNode const cCompilerFrontendVariantNode("C"),
cxxCompilerFrontendVariantNode("CXX"),
cudaCompilerFrontendVariantNode("CUDA"),
objcCompilerFrontendVariantNode("OBJC"),
@@ -2095,9 +2095,9 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::string const& platformId =
@@ -2128,9 +2128,9 @@ struct VersionNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 2; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return cmSystemTools::VersionCompare(Op, parameters.front(), parameters[1])
@@ -2139,20 +2139,20 @@ struct VersionNode : public cmGeneratorExpressionNode
}
};
-static const VersionNode<cmSystemTools::OP_GREATER> versionGreaterNode;
-static const VersionNode<cmSystemTools::OP_GREATER_EQUAL> versionGreaterEqNode;
-static const VersionNode<cmSystemTools::OP_LESS> versionLessNode;
-static const VersionNode<cmSystemTools::OP_LESS_EQUAL> versionLessEqNode;
-static const VersionNode<cmSystemTools::OP_EQUAL> versionEqualNode;
+static VersionNode<cmSystemTools::OP_GREATER> const versionGreaterNode;
+static VersionNode<cmSystemTools::OP_GREATER_EQUAL> const versionGreaterEqNode;
+static VersionNode<cmSystemTools::OP_LESS> const versionLessNode;
+static VersionNode<cmSystemTools::OP_LESS_EQUAL> const versionLessEqNode;
+static VersionNode<cmSystemTools::OP_EQUAL> const versionEqualNode;
static const struct CompileOnlyNode : public cmGeneratorExpressionNode
{
CompileOnlyNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!dagChecker) {
@@ -2172,9 +2172,9 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode
LinkOnlyNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!dagChecker) {
@@ -2196,9 +2196,9 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 0; }
std::string Evaluate(
- const std::vector<std::string>& /*parameters*/,
+ std::vector<std::string> const& /*parameters*/,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
context->HadContextSensitiveCondition = true;
@@ -2213,9 +2213,9 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (parameters.empty()) {
@@ -2301,9 +2301,9 @@ static const struct JoinNode : public cmGeneratorExpressionNode
bool AcceptsArbitraryContentParameter() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return cmList{ parameters.front() }.join(parameters[1]);
@@ -2317,9 +2317,9 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (context->Language.empty() &&
@@ -2364,9 +2364,9 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return TwoOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget ||
@@ -2396,7 +2396,7 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode
return std::string();
}
- const std::string& lang = context->Language;
+ std::string const& lang = context->Language;
if (lang == parameters.front()) {
std::vector<std::string> idParameter((parameters.cbegin() + 1),
parameters.cend());
@@ -2414,9 +2414,9 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget || !dagChecker ||
@@ -2470,10 +2470,10 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode
namespace {
struct LinkerId
{
- static std::string Evaluate(const std::vector<std::string>& parameters,
+ static std::string Evaluate(std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
- const std::string& lang)
+ GeneratorExpressionContent const* content,
+ std::string const& lang)
{
std::string const& linkerId =
context->LG->GetMakefile()->GetSafeDefinition("CMAKE_" + lang +
@@ -2509,9 +2509,9 @@ static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return TwoOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget || !dagChecker ||
@@ -2546,7 +2546,7 @@ static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode
context->HadLinkLanguageSensitiveCondition = true;
}
- const std::string& lang = context->Language;
+ std::string const& lang = context->Language;
if (lang == parameters.front()) {
std::vector<std::string> idParameter((parameters.cbegin() + 1),
parameters.cend());
@@ -2563,9 +2563,9 @@ static const struct LinkLibraryNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return OneOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
using ForGenex = cmGeneratorExpressionDAGChecker::ForGenex;
@@ -2602,17 +2602,17 @@ static const struct LinkLibraryNode : public cmGeneratorExpressionNode
return std::string();
}
- const auto LL_BEGIN = cmStrCat("<LINK_LIBRARY:", feature, '>');
- const auto LL_END = cmStrCat("</LINK_LIBRARY:", feature, '>');
+ auto const LL_BEGIN = cmStrCat("<LINK_LIBRARY:", feature, '>');
+ auto const LL_END = cmStrCat("</LINK_LIBRARY:", feature, '>');
// filter out $<LINK_LIBRARY:..> tags with same feature
// and raise an error for any different feature
- cm::erase_if(list, [&](const std::string& item) -> bool {
+ cm::erase_if(list, [&](std::string const& item) -> bool {
return item == LL_BEGIN || item == LL_END;
});
auto it =
std::find_if(list.cbegin() + 1, list.cend(),
- [&feature](const std::string& item) -> bool {
+ [&feature](std::string const& item) -> bool {
return cmHasPrefix(item, "<LINK_LIBRARY:"_s) &&
item.substr(14, item.find('>', 14) - 14) != feature;
});
@@ -2624,7 +2624,7 @@ static const struct LinkLibraryNode : public cmGeneratorExpressionNode
}
// $<LINK_GROUP:...> must not appear as part of $<LINK_LIBRARY:...>
it = std::find_if(list.cbegin() + 1, list.cend(),
- [](const std::string& item) -> bool {
+ [](std::string const& item) -> bool {
return cmHasPrefix(item, "<LINK_GROUP:"_s);
});
if (it != list.cend()) {
@@ -2648,9 +2648,9 @@ static const struct LinkGroupNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return OneOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
using ForGenex = cmGeneratorExpressionDAGChecker::ForGenex;
@@ -2675,7 +2675,7 @@ static const struct LinkGroupNode : public cmGeneratorExpressionNode
}
// $<LINK_GROUP:..> cannot be nested
if (std::find_if(list.cbegin(), list.cend(),
- [](const std::string& item) -> bool {
+ [](std::string const& item) -> bool {
return cmHasPrefix(item, "<LINK_GROUP"_s);
}) != list.cend()) {
reportError(context, content->GetOriginalExpression(),
@@ -2696,12 +2696,12 @@ static const struct LinkGroupNode : public cmGeneratorExpressionNode
return std::string();
}
- const auto LG_BEGIN = cmStrCat(
+ auto const LG_BEGIN = cmStrCat(
"<LINK_GROUP:", feature, ':',
cmJoin(cmRange<decltype(list.cbegin())>(list.cbegin() + 1, list.cend()),
"|"_s),
'>');
- const auto LG_END = cmStrCat("</LINK_GROUP:", feature, '>');
+ auto const LG_END = cmStrCat("</LINK_GROUP:", feature, '>');
list.front() = LG_BEGIN;
list.push_back(LG_END);
@@ -2717,9 +2717,9 @@ static const struct HostLinkNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget || !dagChecker ||
@@ -2742,9 +2742,9 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
if (!context->HeadTarget || !dagChecker ||
@@ -2757,9 +2757,9 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
if (context->HeadTarget->IsDeviceLink()) {
cmList list{ parameters.begin(), parameters.end() };
- const auto DL_BEGIN = "<DEVICE_LINK>"_s;
- const auto DL_END = "</DEVICE_LINK>"_s;
- cm::erase_if(list, [&](const std::string& item) {
+ auto const DL_BEGIN = "<DEVICE_LINK>"_s;
+ auto const DL_END = "</DEVICE_LINK>"_s;
+ cm::erase_if(list, [&](std::string const& item) {
return item == DL_BEGIN || item == DL_END;
});
@@ -2815,7 +2815,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
// This node handles errors on parameter count itself.
int NumExpectedParameters() const override { return OneOrMoreParameters; }
- static const char* GetErrorText(std::string const& targetName,
+ static char const* GetErrorText(std::string const& targetName,
std::string const& propertyName)
{
static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
@@ -2837,9 +2837,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagCheckerParent) const override
{
static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
@@ -2852,7 +2852,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
targetName = parameters[0];
propertyName = parameters[1];
- if (const char* e = GetErrorText(targetName, propertyName)) {
+ if (char const* e = GetErrorText(targetName, propertyName)) {
reportError(context, content->GetOriginalExpression(), e);
return std::string();
}
@@ -3049,7 +3049,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (target->IsLinkInterfaceDependentStringProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
- const char* propContent =
+ char const* propContent =
target->GetLinkInterfaceDependentStringProperty(propertyName,
context->Config);
return propContent ? propContent : "";
@@ -3059,7 +3059,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
- const char* propContent =
+ char const* propContent =
target->GetLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config);
return propContent ? propContent : "";
@@ -3067,7 +3067,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
- const char* propContent =
+ char const* propContent =
target->GetLinkInterfaceDependentNumberMaxProperty(propertyName,
context->Config);
return propContent ? propContent : "";
@@ -3100,9 +3100,9 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode
bool RequiresLiteralInput() const override { return true; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ GeneratorExpressionContent const* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
return parameters.front();
@@ -3117,9 +3117,9 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
TargetObjectsNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::string const& tgtName = parameters.front();
@@ -3203,9 +3203,9 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
struct TargetRuntimeDllsBaseNode : public cmGeneratorExpressionNode
{
std::vector<std::string> CollectDlls(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content) const
+ GeneratorExpressionContent const* content) const
{
std::string const& tgtName = parameters.front();
cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
@@ -3250,9 +3250,9 @@ static const struct TargetRuntimeDllsNode : public TargetRuntimeDllsBaseNode
TargetRuntimeDllsNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::vector<std::string> dlls = CollectDlls(parameters, context, content);
@@ -3265,14 +3265,14 @@ static const struct TargetRuntimeDllDirsNode : public TargetRuntimeDllsBaseNode
TargetRuntimeDllDirsNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::vector<std::string> dlls = CollectDlls(parameters, context, content);
std::vector<std::string> dllDirs;
- for (const std::string& dll : dlls) {
+ for (std::string const& dll : dlls) {
std::string directory = cmSystemTools::GetFilenamePath(dll);
if (std::find(dllDirs.begin(), dllDirs.end(), directory) ==
dllDirs.end()) {
@@ -3290,9 +3290,9 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return OneOrMoreParameters; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
cmGeneratorTarget const* target = context->HeadTarget;
@@ -3367,7 +3367,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
}
} compileFeaturesNode;
-static const char* targetPolicyWhitelist[] = {
+static char const* targetPolicyWhitelist[] = {
nullptr
#define TARGET_POLICY_STRING(POLICY) , #POLICY
@@ -3377,7 +3377,7 @@ static const char* targetPolicyWhitelist[] = {
};
static cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
- const char* policy)
+ char const* policy)
{
#define RETURN_POLICY(POLICY) \
if (strcmp(policy, #POLICY) == 0) { \
@@ -3392,7 +3392,7 @@ static cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
return cmPolicies::WARN;
}
-static cmPolicies::PolicyID policyForString(const char* policy_id)
+static cmPolicies::PolicyID policyForString(char const* policy_id)
{
#define RETURN_POLICY_ID(POLICY_ID) \
if (strcmp(policy_id, #POLICY_ID) == 0) { \
@@ -3404,7 +3404,7 @@ static cmPolicies::PolicyID policyForString(const char* policy_id)
#undef RETURN_POLICY_ID
assert(false && "Unreachable code. Not a valid policy");
- return cmPolicies::CMP0002;
+ return cmPolicies::CMPCOUNT;
}
static const struct TargetPolicyNode : public cmGeneratorExpressionNode
@@ -3414,9 +3414,9 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
if (!context->HeadTarget) {
@@ -3431,7 +3431,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
context->HadHeadSensitiveCondition = true;
for (size_t i = 1; i < cm::size(targetPolicyWhitelist); ++i) {
- const char* policy = targetPolicyWhitelist[i];
+ char const* policy = targetPolicyWhitelist[i];
if (parameters.front() == policy) {
cmLocalGenerator* lg = context->HeadTarget->GetLocalGenerator();
switch (statusForTarget(context->HeadTarget, policy)) {
@@ -3440,8 +3440,6 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
MessageType::AUTHOR_WARNING,
cmPolicies::GetPolicyWarning(policyForString(policy)));
CM_FALLTHROUGH;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::OLD:
return "0";
case cmPolicies::NEW:
@@ -3476,9 +3474,9 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode
int NumExpectedParameters() const override { return 0; }
std::string Evaluate(
- const std::vector<std::string>& /*parameters*/,
+ std::vector<std::string> const& /*parameters*/,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
reportError(context, content->GetOriginalExpression(),
@@ -3536,8 +3534,6 @@ struct TargetFilesystemArtifactDependencyCMP0112
case cmPolicies::OLD:
context->DependTargets.insert(target);
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
break;
}
@@ -3578,7 +3574,7 @@ struct TargetFilesystemArtifactResultCreator
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content);
+ GeneratorExpressionContent const* content);
};
template <>
@@ -3586,7 +3582,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The target soname file (.so.1).
if (target->IsDLLPlatform()) {
@@ -3618,7 +3614,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameImportTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The target soname file (.so.1).
if (target->IsDLLPlatform()) {
@@ -3656,7 +3652,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (target->IsImported()) {
::reportError(context, content->GetOriginalExpression(),
@@ -3696,7 +3692,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The file used to link to the target (.so, .lib, .a) or import file
// (.lib, .tbd).
@@ -3719,7 +3715,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerLibraryTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The file used to link to the target (.dylib, .so, .a).
if (!target->IsLinkable() ||
@@ -3744,7 +3740,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerImportTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The file used to link to the target (.lib, .tbd).
if (!target->IsLinkable()) {
@@ -3768,7 +3764,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (target->IsImported()) {
::reportError(context, content->GetOriginalExpression(),
@@ -3792,7 +3788,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirNameTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (target->IsImported()) {
::reportError(
@@ -3827,7 +3823,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactBundleContentDirTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (target->IsImported()) {
::reportError(
@@ -3853,7 +3849,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactNameTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*unused*/)
+ GeneratorExpressionContent const* /*unused*/)
{
return target->GetFullPath(context->Config,
cmStateEnums::RuntimeBinaryArtifact, true);
@@ -3865,7 +3861,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactImportTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*unused*/)
+ GeneratorExpressionContent const* /*unused*/)
{
if (target->HasImportLibrary(context->Config)) {
return target->GetFullPath(context->Config,
@@ -3878,13 +3874,13 @@ struct TargetFilesystemArtifactResultCreator<ArtifactImportTag>
template <typename ArtifactT>
struct TargetFilesystemArtifactResultGetter
{
- static std::string Get(const std::string& result);
+ static std::string Get(std::string const& result);
};
template <>
struct TargetFilesystemArtifactResultGetter<ArtifactNameTag>
{
- static std::string Get(const std::string& result)
+ static std::string Get(std::string const& result)
{
return cmSystemTools::GetFilenameName(result);
}
@@ -3893,7 +3889,7 @@ struct TargetFilesystemArtifactResultGetter<ArtifactNameTag>
template <>
struct TargetFilesystemArtifactResultGetter<ArtifactDirTag>
{
- static std::string Get(const std::string& result)
+ static std::string Get(std::string const& result)
{
return cmSystemTools::GetFilenamePath(result);
}
@@ -3902,7 +3898,7 @@ struct TargetFilesystemArtifactResultGetter<ArtifactDirTag>
template <>
struct TargetFilesystemArtifactResultGetter<ArtifactPathTag>
{
- static std::string Get(const std::string& result) { return result; }
+ static std::string Get(std::string const& result) { return result; }
};
struct TargetArtifactBase : public cmGeneratorExpressionNode
@@ -3911,9 +3907,9 @@ struct TargetArtifactBase : public cmGeneratorExpressionNode
protected:
cmGeneratorTarget* GetTarget(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
{
// Lookup the referenced target.
@@ -3959,9 +3955,9 @@ struct TargetFilesystemArtifact : public TargetArtifactBase
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
cmGeneratorTarget* target =
@@ -3997,39 +3993,38 @@ struct TargetFilesystemArtifactNodeGroup
TargetFilesystemArtifact<ArtifactT, ArtifactDirTag> FileDir;
};
-static const TargetFilesystemArtifactNodeGroup<ArtifactNameTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactNameTag> const
targetNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactImportTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactImportTag> const
targetImportNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactLinkerTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactLinkerTag> const
targetLinkerNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactLinkerLibraryTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactLinkerLibraryTag> const
targetLinkerLibraryNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactLinkerImportTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactLinkerImportTag> const
targetLinkerImportNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactSonameTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> const
targetSoNameNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactSonameImportTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactSonameImportTag> const
targetSoNameImportNodeGroup;
-static const TargetFilesystemArtifactNodeGroup<ArtifactPdbTag>
+static TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> const
targetPdbNodeGroup;
-static const TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag>
+static TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag> const
targetBundleDirNode;
-static const TargetFilesystemArtifact<ArtifactBundleDirNameTag,
- ArtifactNameTag>
- targetBundleDirNameNode;
+static TargetFilesystemArtifact<ArtifactBundleDirNameTag,
+ ArtifactNameTag> const targetBundleDirNameNode;
-static const TargetFilesystemArtifact<ArtifactBundleContentDirTag,
- ArtifactPathTag>
+static TargetFilesystemArtifact<ArtifactBundleContentDirTag,
+ ArtifactPathTag> const
targetBundleContentDirNode;
//
@@ -4040,7 +4035,7 @@ struct TargetOutputNameArtifactResultGetter
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content);
+ GeneratorExpressionContent const* content);
};
template <>
@@ -4048,7 +4043,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactNameTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*unused*/)
+ GeneratorExpressionContent const* /*unused*/)
{
return target->GetOutputName(context->Config,
cmStateEnums::RuntimeBinaryArtifact) +
@@ -4061,7 +4056,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactImportTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* /*unused*/)
+ GeneratorExpressionContent const* /*unused*/)
{
if (target->HasImportLibrary(context->Config)) {
return target->GetOutputName(context->Config,
@@ -4077,7 +4072,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The library file used to link to the target (.so, .lib, .a) or import
// file (.lin, .tbd).
@@ -4101,7 +4096,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerLibraryTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The library file used to link to the target (.so, .lib, .a).
if (!target->IsLinkable() ||
@@ -4127,7 +4122,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerImportTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
// The import file used to link to the target (.lib, .tbd).
if (!target->IsLinkable()) {
@@ -4151,7 +4146,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactPdbTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (target->IsImported()) {
::reportError(
@@ -4195,9 +4190,9 @@ struct TargetFileBaseNameArtifact : public TargetArtifactBase
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
cmGeneratorTarget* target =
@@ -4215,17 +4210,17 @@ struct TargetFileBaseNameArtifact : public TargetArtifactBase
}
};
-static const TargetFileBaseNameArtifact<ArtifactNameTag>
+static TargetFileBaseNameArtifact<ArtifactNameTag> const
targetFileBaseNameNode;
-static const TargetFileBaseNameArtifact<ArtifactImportTag>
+static TargetFileBaseNameArtifact<ArtifactImportTag> const
targetImportFileBaseNameNode;
-static const TargetFileBaseNameArtifact<ArtifactLinkerTag>
+static TargetFileBaseNameArtifact<ArtifactLinkerTag> const
targetLinkerFileBaseNameNode;
-static const TargetFileBaseNameArtifact<ArtifactLinkerLibraryTag>
+static TargetFileBaseNameArtifact<ArtifactLinkerLibraryTag> const
targetLinkerLibraryFileBaseNameNode;
-static const TargetFileBaseNameArtifact<ArtifactLinkerImportTag>
+static TargetFileBaseNameArtifact<ArtifactLinkerImportTag> const
targetLinkerImportFileBaseNameNode;
-static const TargetFileBaseNameArtifact<ArtifactPdbTag>
+static TargetFileBaseNameArtifact<ArtifactPdbTag> const
targetPdbFileBaseNameNode;
class ArtifactFilePrefixTag;
@@ -4244,7 +4239,7 @@ struct TargetFileArtifactResultGetter
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content);
+ GeneratorExpressionContent const* content);
};
template <>
@@ -4252,7 +4247,7 @@ struct TargetFileArtifactResultGetter<ArtifactFilePrefixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*)
+ GeneratorExpressionContent const*)
{
return target->GetFilePrefix(context->Config);
}
@@ -4262,7 +4257,7 @@ struct TargetFileArtifactResultGetter<ArtifactImportFilePrefixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*)
+ GeneratorExpressionContent const*)
{
if (target->HasImportLibrary(context->Config)) {
return target->GetFilePrefix(context->Config,
@@ -4276,7 +4271,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerFilePrefixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (!target->IsLinkable()) {
::reportError(
@@ -4299,7 +4294,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFilePrefixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (!target->IsLinkable() ||
target->GetType() == cmStateEnums::EXECUTABLE) {
@@ -4323,7 +4318,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerImportFilePrefixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (!target->IsLinkable()) {
::reportError(
@@ -4345,7 +4340,7 @@ struct TargetFileArtifactResultGetter<ArtifactFileSuffixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*)
+ GeneratorExpressionContent const*)
{
return target->GetFileSuffix(context->Config);
}
@@ -4355,7 +4350,7 @@ struct TargetFileArtifactResultGetter<ArtifactImportFileSuffixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*)
+ GeneratorExpressionContent const*)
{
if (target->HasImportLibrary(context->Config)) {
return target->GetFileSuffix(context->Config,
@@ -4369,7 +4364,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerFileSuffixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (!target->IsLinkable()) {
::reportError(
@@ -4392,7 +4387,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFileSuffixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (!target->IsLinkable() ||
target->GetType() == cmStateEnums::STATIC_LIBRARY) {
@@ -4415,7 +4410,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerImportFileSuffixTag>
{
static std::string Get(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content)
+ GeneratorExpressionContent const* content)
{
if (!target->IsLinkable()) {
::reportError(
@@ -4441,9 +4436,9 @@ struct TargetFileArtifact : public TargetArtifactBase
int NumExpectedParameters() const override { return 1; }
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const override
{
cmGeneratorTarget* target =
@@ -4461,23 +4456,23 @@ struct TargetFileArtifact : public TargetArtifactBase
}
};
-static const TargetFileArtifact<ArtifactFilePrefixTag> targetFilePrefixNode;
-static const TargetFileArtifact<ArtifactImportFilePrefixTag>
+static TargetFileArtifact<ArtifactFilePrefixTag> const targetFilePrefixNode;
+static TargetFileArtifact<ArtifactImportFilePrefixTag> const
targetImportFilePrefixNode;
-static const TargetFileArtifact<ArtifactLinkerFilePrefixTag>
+static TargetFileArtifact<ArtifactLinkerFilePrefixTag> const
targetLinkerFilePrefixNode;
-static const TargetFileArtifact<ArtifactLinkerLibraryFilePrefixTag>
+static TargetFileArtifact<ArtifactLinkerLibraryFilePrefixTag> const
targetLinkerLibraryFilePrefixNode;
-static const TargetFileArtifact<ArtifactLinkerImportFilePrefixTag>
+static TargetFileArtifact<ArtifactLinkerImportFilePrefixTag> const
targetLinkerImportFilePrefixNode;
-static const TargetFileArtifact<ArtifactFileSuffixTag> targetFileSuffixNode;
-static const TargetFileArtifact<ArtifactImportFileSuffixTag>
+static TargetFileArtifact<ArtifactFileSuffixTag> const targetFileSuffixNode;
+static TargetFileArtifact<ArtifactImportFileSuffixTag> const
targetImportFileSuffixNode;
-static const TargetFileArtifact<ArtifactLinkerFileSuffixTag>
+static TargetFileArtifact<ArtifactLinkerFileSuffixTag> const
targetLinkerFileSuffixNode;
-static const TargetFileArtifact<ArtifactLinkerLibraryFileSuffixTag>
+static TargetFileArtifact<ArtifactLinkerLibraryFileSuffixTag> const
targetLinkerLibraryFileSuffixNode;
-static const TargetFileArtifact<ArtifactLinkerImportFileSuffixTag>
+static TargetFileArtifact<ArtifactLinkerImportFileSuffixTag> const
targetLinkerImportFileSuffixNode;
static const struct ShellPathNode : public cmGeneratorExpressionNode
@@ -4485,9 +4480,9 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
ShellPathNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
cmList list_in{ parameters.front() };
@@ -4498,7 +4493,7 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
}
cmStateSnapshot snapshot = context->LG->GetStateSnapshot();
cmOutputConverter converter(snapshot);
- const char* separator = snapshot.GetState()->UseWindowsShell() ? ";" : ":";
+ char const* separator = snapshot.GetState()->UseWindowsShell() ? ";" : ":";
std::vector<std::string> list_out;
list_out.reserve(list_in.size());
for (auto const& in : list_in) {
@@ -4513,8 +4508,8 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
}
} shellPathNode;
-const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
- const std::string& identifier)
+cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
+ std::string const& identifier)
{
static std::map<std::string, cmGeneratorExpressionNode const*> const nodeMap{
{ "0", &zeroNode },
@@ -4659,7 +4654,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
}
void reportError(cmGeneratorExpressionContext* context,
- const std::string& expr, const std::string& result)
+ std::string const& expr, std::string const& result)
{
context->HadError = true;
if (context->Quiet) {
diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h
index 7a76289..865f71c 100644
--- a/Source/cmGeneratorExpressionNode.h
+++ b/Source/cmGeneratorExpressionNode.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,27 +33,27 @@ struct cmGeneratorExpressionNode
virtual int NumExpectedParameters() const { return 1; }
- virtual bool ShouldEvaluateNextParameter(const std::vector<std::string>&,
+ virtual bool ShouldEvaluateNextParameter(std::vector<std::string> const&,
std::string&) const
{
return true;
}
virtual std::string Evaluate(
- const std::vector<std::string>& parameters,
+ std::vector<std::string> const& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent* content,
+ GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker) const = 0;
static std::string EvaluateDependentExpression(
std::string const& prop, cmLocalGenerator* lg,
- cmGeneratorExpressionContext* context, const cmGeneratorTarget* headTarget,
+ cmGeneratorExpressionContext* context, cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
- const cmGeneratorTarget* currentTarget);
+ cmGeneratorTarget const* currentTarget);
- static const cmGeneratorExpressionNode* GetNode(
- const std::string& identifier);
+ static cmGeneratorExpressionNode const* GetNode(
+ std::string const& identifier);
};
void reportError(cmGeneratorExpressionContext* context,
- const std::string& expr, const std::string& result);
+ std::string const& expr, std::string const& result);
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index bbee4d5..c47de3b 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionParser.h"
#include <cassert>
@@ -174,7 +174,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
extendText(result, colonToken);
auto pit = parameters.begin();
- const auto pend = parameters.end();
+ auto const pend = parameters.end();
auto commaIt = commaTokens.begin();
assert(parameters.size() > commaTokens.size());
for (; pit != pend; ++pit, ++commaIt) {
diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h
index 490de0a..db95f89 100644
--- a/Source/cmGeneratorExpressionParser.h
+++ b/Source/cmGeneratorExpressionParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,6 +24,6 @@ private:
void ParseGeneratorExpression(cmGeneratorExpressionEvaluatorVector&);
std::vector<cmGeneratorExpressionToken>::const_iterator it;
- const std::vector<cmGeneratorExpressionToken> Tokens;
+ std::vector<cmGeneratorExpressionToken> const Tokens;
unsigned int NestingLevel = 0;
};
diff --git a/Source/cmGeneratorOptions.h b/Source/cmGeneratorOptions.h
new file mode 100644
index 0000000..0b2fb3f
--- /dev/null
+++ b/Source/cmGeneratorOptions.h
@@ -0,0 +1,35 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+/** Flag if byproducts shall also be considered. */
+enum class cmSourceOutputKind
+{
+ OutputOnly,
+ OutputOrByproduct
+};
+
+/** What scanner to use for dependencies lookup. */
+enum class cmDependencyScannerKind
+{
+ CMake,
+ Compiler
+};
+
+/** What to compute language flags for */
+enum class cmBuildStep
+{
+ Compile,
+ Link
+};
+
+/** What compilation mode the swift files are in */
+enum class cmSwiftCompileMode
+{
+ Wholemodule,
+ Incremental,
+ Singlefile,
+ Unknown,
+};
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 39f0b46..99ee0ec 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGeneratorTarget.h"
#include <algorithm>
@@ -30,6 +30,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorOptions.h"
#include "cmGlobalGenerator.h"
#include "cmList.h"
#include "cmLocalGenerator.h"
@@ -59,23 +60,15 @@ using UseTo = cmGeneratorTarget::UseTo;
template <>
cmValue cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
- cmGeneratorTarget const* tgt, cmMakefile const& /* mf */)
-{
- return tgt->GetSourcesProperty();
-}
-
-template <>
-const std::string&
-cmTargetPropertyComputer::ComputeLocationForBuild<cmGeneratorTarget>(
cmGeneratorTarget const* tgt)
{
- return tgt->GetLocation("");
+ return tgt->GetSourcesProperty();
}
template <>
-const std::string&
-cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>(
- cmGeneratorTarget const* tgt, const std::string& config)
+std::string const&
+cmTargetPropertyComputer::ImportedLocation<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, std::string const& config)
{
return tgt->GetLocation(config);
}
@@ -183,7 +176,7 @@ cmStateEnums::TargetType cmGeneratorTarget::GetType() const
return this->Target->GetType();
}
-const std::string& cmGeneratorTarget::GetName() const
+std::string const& cmGeneratorTarget::GetName() const
{
return this->Target->GetName();
}
@@ -229,7 +222,7 @@ std::string cmGeneratorTarget::GetFilesystemExportName() const
return fs_safe;
}
-cmValue cmGeneratorTarget::GetProperty(const std::string& prop) const
+cmValue cmGeneratorTarget::GetProperty(std::string const& prop) const
{
if (cmValue result =
cmTargetPropertyComputer::GetProperty(this, prop, *this->Makefile)) {
@@ -247,7 +240,7 @@ std::string const& cmGeneratorTarget::GetSafeProperty(
return this->GetProperty(prop);
}
-const char* cmGeneratorTarget::GetOutputTargetType(
+char const* cmGeneratorTarget::GetOutputTargetType(
cmStateEnums::ArtifactType artifact) const
{
if (this->IsFrameworkOnApple() || this->GetGlobalGenerator()->IsXcode()) {
@@ -311,7 +304,7 @@ const char* cmGeneratorTarget::GetOutputTargetType(
}
std::string cmGeneratorTarget::GetOutputName(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
// Lookup/compute/cache the output name for this configuration.
OutputNameKey key(config, artifact);
@@ -369,7 +362,7 @@ std::string cmGeneratorTarget::GetOutputName(
}
std::string cmGeneratorTarget::GetFilePrefix(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
cmValue prefix = this->GetFilePrefixInternal(config, artifact);
@@ -378,7 +371,7 @@ std::string cmGeneratorTarget::GetFilePrefix(
return this->GetFullNameInternalComponents(config, artifact).prefix;
}
std::string cmGeneratorTarget::GetFileSuffix(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
cmValue suffix = this->GetFileSuffixInternal(config, artifact);
@@ -387,7 +380,7 @@ std::string cmGeneratorTarget::GetFileSuffix(
return this->GetFullNameInternalComponents(config, artifact).suffix;
}
-std::string cmGeneratorTarget::GetFilePostfix(const std::string& config) const
+std::string cmGeneratorTarget::GetFilePostfix(std::string const& config) const
{
cmValue postfix = nullptr;
std::string frameworkPostfix;
@@ -414,7 +407,7 @@ std::string cmGeneratorTarget::GetFilePostfix(const std::string& config) const
}
std::string cmGeneratorTarget::GetFrameworkMultiConfigPostfix(
- const std::string& config) const
+ std::string const& config) const
{
cmValue postfix = nullptr;
if (!config.empty()) {
@@ -433,7 +426,7 @@ std::string cmGeneratorTarget::GetFrameworkMultiConfigPostfix(
cmValue cmGeneratorTarget::GetFilePrefixInternal(
std::string const& config, cmStateEnums::ArtifactType artifact,
- const std::string& language) const
+ std::string const& language) const
{
// no prefix for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
@@ -443,7 +436,7 @@ cmValue cmGeneratorTarget::GetFilePrefixInternal(
return nullptr;
}
- const bool isImportedLibraryArtifact =
+ bool const isImportedLibraryArtifact =
(artifact == cmStateEnums::ImportLibraryArtifact);
// Return an empty prefix for the import library if this platform
@@ -466,7 +459,7 @@ cmValue cmGeneratorTarget::GetFilePrefixInternal(
: this->GetProperty("PREFIX"));
if (!targetPrefix) {
- const char* prefixVar = this->Target->GetPrefixVariableInternal(artifact);
+ char const* prefixVar = this->Target->GetPrefixVariableInternal(artifact);
if (!language.empty() && cmNonempty(prefixVar)) {
std::string langPrefix = cmStrCat(prefixVar, "_", language);
targetPrefix = this->Makefile->GetDefinition(langPrefix);
@@ -484,7 +477,7 @@ cmValue cmGeneratorTarget::GetFilePrefixInternal(
cmValue cmGeneratorTarget::GetFileSuffixInternal(
std::string const& config, cmStateEnums::ArtifactType artifact,
- const std::string& language) const
+ std::string const& language) const
{
// no suffix for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
@@ -494,7 +487,7 @@ cmValue cmGeneratorTarget::GetFileSuffixInternal(
return nullptr;
}
- const bool isImportedLibraryArtifact =
+ bool const isImportedLibraryArtifact =
(artifact == cmStateEnums::ImportLibraryArtifact);
// Return an empty suffix for the import library if this platform
@@ -517,7 +510,7 @@ cmValue cmGeneratorTarget::GetFileSuffixInternal(
: this->GetProperty("SUFFIX"));
if (!targetSuffix) {
- const char* suffixVar = this->Target->GetSuffixVariableInternal(artifact);
+ char const* suffixVar = this->Target->GetSuffixVariableInternal(artifact);
if (!language.empty() && cmNonempty(suffixVar)) {
std::string langSuffix = cmStrCat(suffixVar, "_", language);
targetSuffix = this->Makefile->GetDefinition(langSuffix);
@@ -562,7 +555,7 @@ void cmGeneratorTarget::ClearLinkInterfaceCache()
this->LinkInterfaceUsageRequirementsOnlyMap.clear();
}
-void cmGeneratorTarget::AddSourceCommon(const std::string& src, bool before)
+void cmGeneratorTarget::AddSourceCommon(std::string const& src, bool before)
{
this->SourceEntries.insert(
before ? this->SourceEntries.begin() : this->SourceEntries.end(),
@@ -572,7 +565,7 @@ void cmGeneratorTarget::AddSourceCommon(const std::string& src, bool before)
this->ClearSourcesCache();
}
-void cmGeneratorTarget::AddSource(const std::string& src, bool before)
+void cmGeneratorTarget::AddSource(std::string const& src, bool before)
{
this->Target->AddSource(src, before);
this->AddSourceCommon(src, before);
@@ -586,7 +579,7 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
}
}
-void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
+void cmGeneratorTarget::AddIncludeDirectory(std::string const& src,
bool before)
{
this->Target->InsertInclude(
@@ -639,7 +632,7 @@ std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
namespace {
void handleSystemIncludesDep(cmLocalGenerator* lg,
cmGeneratorTarget const* depTgt,
- const std::string& config,
+ std::string const& config,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
cmList& result, bool excludeImported,
@@ -691,7 +684,7 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
/* clang-format on */
void cmGeneratorTarget::GetObjectSources(
- std::vector<cmSourceFile const*>& data, const std::string& config) const
+ std::vector<cmSourceFile const*>& data, std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindObjectSource);
@@ -722,8 +715,8 @@ void cmGeneratorTarget::ComputeObjectMapping()
}
}
-cmValue cmGeneratorTarget::GetFeature(const std::string& feature,
- const std::string& config) const
+cmValue cmGeneratorTarget::GetFeature(std::string const& feature,
+ std::string const& config) const
{
if (!config.empty()) {
std::string featureConfig =
@@ -752,9 +745,9 @@ std::string cmGeneratorTarget::GetLinkerTypeProperty(
config, this, &dagChecker, this, lang);
if (this->IsDeviceLink()) {
cmList list{ ltype };
- const auto DL_BEGIN = "<DEVICE_LINK>"_s;
- const auto DL_END = "</DEVICE_LINK>"_s;
- cm::erase_if(list, [&](const std::string& item) {
+ auto const DL_BEGIN = "<DEVICE_LINK>"_s;
+ auto const DL_END = "</DEVICE_LINK>"_s;
+ cm::erase_if(list, [&](std::string const& item) {
return item == DL_BEGIN || item == DL_END;
});
return list.to_string();
@@ -764,8 +757,8 @@ std::string cmGeneratorTarget::GetLinkerTypeProperty(
return std::string{};
}
-const char* cmGeneratorTarget::GetLinkPIEProperty(
- const std::string& config) const
+char const* cmGeneratorTarget::GetLinkPIEProperty(
+ std::string const& config) const
{
static std::string PICValue;
@@ -816,7 +809,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
// problem is already reported, no need to issue a message
return false;
}
- const bool in_try_compile =
+ bool const in_try_compile =
this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile();
if (cmp0069 == cmPolicies::WARN && !in_try_compile) {
std::ostringstream w;
@@ -832,7 +825,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
}
// Note: check consistency with messages from CheckIPOSupported
- const char* message = nullptr;
+ char const* message = nullptr;
if (!this->Makefile->IsOn("_CMAKE_" + lang + "_IPO_SUPPORTED_BY_CMAKE")) {
message = "CMake doesn't support IPO for current compiler";
} else if (!this->Makefile->IsOn("_CMAKE_" + lang +
@@ -859,13 +852,13 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
return false;
}
-const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
+std::string const& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
{
this->ComputeObjectMapping();
return this->Objects[file];
}
-const char* cmGeneratorTarget::GetCustomObjectExtension() const
+char const* cmGeneratorTarget::GetCustomObjectExtension() const
{
struct compiler_mode
{
@@ -882,8 +875,8 @@ const char* cmGeneratorTarget::GetCustomObjectExtension() const
std::string const& compiler =
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
if (!compiler.empty()) {
- for (const auto& m : modes) {
- const bool has_extension = this->GetPropertyAsBool(m.variable);
+ for (auto const& m : modes) {
+ bool const has_extension = this->GetPropertyAsBool(m.variable);
if (has_extension) {
return m.extension.c_str();
}
@@ -931,7 +924,7 @@ cmValue cmGeneratorTarget::GetLanguageStandard(std::string const& lang,
}
cmValue cmGeneratorTarget::GetPropertyWithPairedLanguageSupport(
- std::string const& lang, const char* suffix) const
+ std::string const& lang, char const* suffix) const
{
cmValue propertyValue = this->Target->GetProperty(cmStrCat(lang, suffix));
if (!propertyValue) {
@@ -959,43 +952,43 @@ bool cmGeneratorTarget::GetLanguageStandardRequired(
}
void cmGeneratorTarget::GetModuleDefinitionSources(
- std::vector<cmSourceFile const*>& data, const std::string& config) const
+ std::vector<cmSourceFile const*>& data, std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindModuleDefinition);
}
void cmGeneratorTarget::GetHeaderSources(
- std::vector<cmSourceFile const*>& data, const std::string& config) const
+ std::vector<cmSourceFile const*>& data, std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindHeader);
}
void cmGeneratorTarget::GetCxxModuleSources(
- std::vector<cmSourceFile const*>& data, const std::string& config) const
+ std::vector<cmSourceFile const*>& data, std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindCxxModuleSource);
}
void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile const*>& data,
- const std::string& config) const
+ std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindExtra);
}
void cmGeneratorTarget::GetCustomCommands(
- std::vector<cmSourceFile const*>& data, const std::string& config) const
+ std::vector<cmSourceFile const*>& data, std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindCustomCommand);
}
void cmGeneratorTarget::GetExternalObjects(
- std::vector<cmSourceFile const*>& data, const std::string& config) const
+ std::vector<cmSourceFile const*>& data, std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindExternalObject);
}
void cmGeneratorTarget::GetManifests(std::vector<cmSourceFile const*>& data,
- const std::string& config) const
+ std::string const& config) const
{
IMPLEMENT_VISIT(SourceKindManifest);
}
@@ -1019,8 +1012,8 @@ std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
return this->UtilityItems;
}
-const std::string& cmGeneratorTarget::GetLocation(
- const std::string& config) const
+std::string const& cmGeneratorTarget::GetLocation(
+ std::string const& config) const
{
static std::string location;
if (this->IsImported()) {
@@ -1084,7 +1077,7 @@ void cmGeneratorTarget::AppendCustomCommandSideEffects(
void cmGeneratorTarget::AppendLanguageSideEffects(
std::map<std::string, std::set<cmGeneratorTarget const*>>& sideEffects) const
{
- static const std::set<cm::string_view> LANGS_WITH_NO_SIDE_EFFECTS = {
+ static std::set<cm::string_view> const LANGS_WITH_NO_SIDE_EFFECTS = {
"C"_s, "CXX"_s, "OBJC"_s, "OBJCXX"_s, "ASM"_s, "CUDA"_s, "HIP"_s
};
@@ -1149,6 +1142,11 @@ bool cmGeneratorTarget::IsImportedGloballyVisible() const
return this->Target->IsImportedGloballyVisible();
}
+bool cmGeneratorTarget::IsForeign() const
+{
+ return this->Target->IsForeign();
+}
+
bool cmGeneratorTarget::CanCompileSources() const
{
return this->Target->CanCompileSources();
@@ -1167,7 +1165,7 @@ bool cmGeneratorTarget::HasKnownRuntimeArtifactLocation(
return info && !info->Location.empty();
}
-const std::string& cmGeneratorTarget::GetLocationForBuild() const
+std::string const& cmGeneratorTarget::GetLocationForBuild() const
{
static std::string location;
if (this->IsImported()) {
@@ -1198,8 +1196,8 @@ const std::string& cmGeneratorTarget::GetLocationForBuild() const
}
void cmGeneratorTarget::AddSystemIncludeCacheKey(
- const std::string& key, const std::string& config,
- const std::string& language) const
+ std::string const& key, std::string const& config,
+ std::string const& language) const
{
cmGeneratorExpressionDAGChecker dagChecker{
this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr,
@@ -1244,8 +1242,8 @@ void cmGeneratorTarget::AddSystemIncludeCacheKey(
}
bool cmGeneratorTarget::IsSystemIncludeDirectory(
- const std::string& dir, const std::string& config,
- const std::string& language) const
+ std::string const& dir, std::string const& config,
+ std::string const& language) const
{
std::string config_upper;
if (!config.empty()) {
@@ -1263,13 +1261,13 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
return std::binary_search(iter->second.begin(), iter->second.end(), dir);
}
-bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
+bool cmGeneratorTarget::GetPropertyAsBool(std::string const& prop) const
{
return this->Target->GetPropertyAsBool(prop);
}
std::string cmGeneratorTarget::GetCompilePDBName(
- const std::string& config) const
+ std::string const& config) const
{
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(config);
@@ -1292,7 +1290,7 @@ std::string cmGeneratorTarget::GetCompilePDBName(
}
std::string cmGeneratorTarget::GetCompilePDBPath(
- const std::string& config) const
+ std::string const& config) const
{
std::string dir = this->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
@@ -1305,7 +1303,7 @@ std::string cmGeneratorTarget::GetCompilePDBPath(
return dir + name;
}
-bool cmGeneratorTarget::HasSOName(const std::string& config) const
+bool cmGeneratorTarget::HasSOName(std::string const& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
@@ -1316,7 +1314,7 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const
}
bool cmGeneratorTarget::NeedRelinkBeforeInstall(
- const std::string& config) const
+ std::string const& config) const
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
@@ -1389,7 +1387,7 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
return have_rpath;
}
-bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
+bool cmGeneratorTarget::IsChrpathUsed(std::string const& config) const
{
// Only certain target types have an rpath.
if (!(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -1450,7 +1448,7 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
}
bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
- const std::string& config) const
+ std::string const& config) const
{
if (this->IsImported() && this->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (cmGeneratorTarget::ImportInfo const* info =
@@ -1462,22 +1460,22 @@ bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
}
bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
- const std::string& config) const
+ std::string const& config) const
{
TargetPtrToBoolMap& cache = this->MacOSXRpathInstallNameDirCache[config];
- const auto lookup = cache.find(this->Target);
+ auto const lookup = cache.find(this->Target);
if (lookup != cache.cend()) {
return lookup->second;
}
- const bool result = this->DetermineHasMacOSXRpathInstallNameDir(config);
+ bool const result = this->DetermineHasMacOSXRpathInstallNameDir(config);
cache[this->Target] = result;
return result;
}
bool cmGeneratorTarget::DetermineHasMacOSXRpathInstallNameDir(
- const std::string& config) const
+ std::string const& config) const
{
bool install_name_is_rpath = false;
bool macosx_rpath = false;
@@ -1549,14 +1547,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
return this->GetPropertyAsBool("MACOSX_RPATH");
}
- cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
-
- if (cmp0042 == cmPolicies::WARN) {
- this->LocalGenerator->GetGlobalGenerator()->AddCMP0042WarnTarget(
- this->GetName());
- }
-
- return cmp0042 == cmPolicies::NEW;
+ return true;
}
bool cmGeneratorTarget::MacOSXUseInstallNameDir() const
@@ -1607,7 +1598,7 @@ bool cmGeneratorTarget::CanGenerateInstallNameDir(
}
std::string cmGeneratorTarget::GetSOName(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
// Lookup the imported soname.
@@ -1652,7 +1643,7 @@ bool shouldAddContentLevel(cmGeneratorTarget::BundleDirectoryLevel level)
}
std::string cmGeneratorTarget::GetAppBundleDirectory(
- const std::string& config, BundleDirectoryLevel level) const
+ std::string const& config, BundleDirectoryLevel level) const
{
std::string fpath = cmStrCat(
this->GetFullName(config, cmStateEnums::RuntimeBinaryArtifact), '.');
@@ -1674,14 +1665,14 @@ bool cmGeneratorTarget::IsBundleOnApple() const
this->IsCFBundleOnApple();
}
-bool cmGeneratorTarget::IsWin32Executable(const std::string& config) const
+bool cmGeneratorTarget::IsWin32Executable(std::string const& config) const
{
return cmIsOn(cmGeneratorExpression::Evaluate(
this->GetSafeProperty("WIN32_EXECUTABLE"), this->LocalGenerator, config));
}
std::string cmGeneratorTarget::GetCFBundleDirectory(
- const std::string& config, BundleDirectoryLevel level) const
+ std::string const& config, BundleDirectoryLevel level) const
{
std::string fpath = cmStrCat(
this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact), '.');
@@ -1707,7 +1698,7 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(
}
std::string cmGeneratorTarget::GetFrameworkDirectory(
- const std::string& config, BundleDirectoryLevel level) const
+ std::string const& config, BundleDirectoryLevel level) const
{
std::string fpath = cmStrCat(
this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact), '.');
@@ -1722,7 +1713,7 @@ std::string cmGeneratorTarget::GetFrameworkDirectory(
}
std::string cmGeneratorTarget::GetFullName(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
return this->GetFullNameImported(config, artifact);
@@ -1731,7 +1722,7 @@ std::string cmGeneratorTarget::GetFullName(
}
std::string cmGeneratorTarget::GetInstallNameDirForBuildTree(
- const std::string& config) const
+ std::string const& config) const
{
if (this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) {
@@ -1759,7 +1750,7 @@ std::string cmGeneratorTarget::GetInstallNameDirForBuildTree(
}
std::string cmGeneratorTarget::GetInstallNameDirForInstallTree(
- const std::string& config, const std::string& installPrefix) const
+ std::string const& config, std::string const& installPrefix) const
{
if (this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) {
std::string dir;
@@ -1791,7 +1782,7 @@ cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const
return this->Target->GetBacktrace();
}
-const std::set<BT<std::pair<std::string, bool>>>&
+std::set<BT<std::pair<std::string, bool>>> const&
cmGeneratorTarget::GetUtilities() const
{
return this->Target->GetUtilities();
@@ -1806,7 +1797,7 @@ bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
this->GetType() == cmStateEnums::EXECUTABLE;
}
-const std::string* cmGeneratorTarget::GetExportMacro() const
+std::string const* cmGeneratorTarget::GetExportMacro() const
{
// Define the symbol for targets that export symbols.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -1831,7 +1822,7 @@ cmGeneratorTarget::GetFullNameComponents(
}
std::string cmGeneratorTarget::BuildBundleDirectory(
- const std::string& base, const std::string& config,
+ std::string const& base, std::string const& config,
BundleDirectoryLevel level) const
{
std::string fpath = base;
@@ -1848,7 +1839,7 @@ std::string cmGeneratorTarget::BuildBundleDirectory(
}
std::string cmGeneratorTarget::GetMacContentDirectory(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
// Start with the output directory for the target.
std::string fpath = cmStrCat(this->GetDirectory(config, artifact), '/');
@@ -1879,7 +1870,7 @@ std::string cmGeneratorTarget::GetEffectiveFolderName() const
}
cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
- const std::string& config) const
+ std::string const& config) const
{
// There is no compile information for imported targets.
if (this->IsImported()) {
@@ -1972,9 +1963,9 @@ bool cmGeneratorTarget::IsDLLPlatform() const
}
void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
- const std::string& config) const
+ std::string const& config) const
{
- const char* prop =
+ char const* prop =
this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS", config);
if (!prop) {
return;
@@ -2004,7 +1995,7 @@ void cmGeneratorTarget::TraceDependencies()
}
std::string cmGeneratorTarget::GetCompilePDBDirectory(
- const std::string& config) const
+ std::string const& config) const
{
if (CompileInfo const* info = this->GetCompileInfo(config)) {
return info->CompilePdbDir;
@@ -2043,6 +2034,14 @@ std::vector<std::string> cmGeneratorTarget::GetAppleArchs(
return std::move(archList.data());
}
+std::string const& cmGeneratorTarget::GetTargetLabelsString()
+{
+ this->targetLabelsString = this->GetSafeProperty("LABELS");
+ std::replace(this->targetLabelsString.begin(),
+ this->targetLabelsString.end(), ';', ',');
+ return this->targetLabelsString;
+}
+
namespace {
bool IsSupportedClassifiedFlagsLanguage(std::string const& lang)
@@ -2139,8 +2138,8 @@ cmGeneratorTarget::GetClassifiedFlagsForSource(cmSourceFile const* sf,
{
std::vector<std::string> pchArchs = this->GetPchArchs(config, lang);
- for (const std::string& arch : pchArchs) {
- const std::string pchSource = this->GetPchSource(config, lang, arch);
+ for (std::string const& arch : pchArchs) {
+ std::string const pchSource = this->GetPchSource(config, lang, arch);
if (pchSource == sf->GetFullPath()) {
filterArch = arch;
}
@@ -2196,8 +2195,8 @@ cmGeneratorTarget::GetClassifiedFlagsForSource(cmSourceFile const* sf,
}
}
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
cmGeneratorExpressionInterpreter genexInterpreter(lg, config, this, lang);
@@ -2307,7 +2306,9 @@ cmGeneratorTarget::GetClassifiedFlagsForSource(cmSourceFile const* sf,
cmRulePlaceholderExpander::RuleVariables vars;
vars.CMTargetName = this->GetName().c_str();
vars.CMTargetType = cmState::GetTargetTypeName(this->GetType()).c_str();
+ vars.CMTargetLabels = this->GetTargetLabelsString().c_str();
vars.Language = lang.c_str();
+
auto const sfPath = this->LocalGenerator->ConvertToOutputFormat(
sf->GetFullPath(), cmOutputConverter::SHELL);
@@ -2476,8 +2477,6 @@ void cmGeneratorTarget::AddExplicitLanguageFlags(std::string& flags,
case cmPolicies::OLD:
// The OLD behavior is to not add explicit language flags.
return;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
// The NEW behavior is to add explicit language flags.
break;
@@ -2519,8 +2518,8 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
return;
}
- return this->AddCUDAArchitectureFlagsImpl(compileOrLink, config, "CUDA",
- std::move(arch), flags);
+ this->AddCUDAArchitectureFlagsImpl(compileOrLink, config, "CUDA",
+ std::move(arch), flags);
}
void cmGeneratorTarget::AddCUDAArchitectureFlagsImpl(cmBuildStep compileOrLink,
@@ -2531,7 +2530,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlagsImpl(cmBuildStep compileOrLink,
{
std::string const& compiler = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_COMPILER_ID"));
- const bool ipoEnabled = this->IsIPOEnabled(lang, config);
+ bool const ipoEnabled = this->IsIPOEnabled(lang, config);
// Check for special modes: `all`, `all-major`.
if (arch == "all" || arch == "all-major") {
@@ -2662,7 +2661,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlagsImpl(cmBuildStep compileOrLink,
void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const
{
- const std::string& arch = this->GetSafeProperty("ISPC_INSTRUCTION_SETS");
+ std::string const& arch = this->GetSafeProperty("ISPC_INSTRUCTION_SETS");
// If ISPC_TARGET is false we don't add any architectures.
if (cmIsOff(arch)) {
@@ -2698,8 +2697,9 @@ void cmGeneratorTarget::AddHIPArchitectureFlags(cmBuildStep compileOrLink,
}
if (this->Makefile->GetSafeDefinition("CMAKE_HIP_PLATFORM") == "nvidia") {
- return this->AddCUDAArchitectureFlagsImpl(compileOrLink, config, "HIP",
- std::move(arch), flags);
+ this->AddCUDAArchitectureFlagsImpl(compileOrLink, config, "HIP",
+ std::move(arch), flags);
+ return;
}
cmList options(arch);
@@ -2779,7 +2779,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetClangTidyExportFixesDirectory(
- const std::string& lang) const
+ std::string const& lang) const
{
cmValue val =
this->GetProperty(cmStrCat(lang, "_CLANG_TIDY_EXPORT_FIXES_DIR"));
@@ -2809,9 +2809,9 @@ std::vector<std::string> cmGeneratorTarget::GetPchArchs(
return pchArchs;
}
-std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
- const std::string& language,
- const std::string& arch) const
+std::string cmGeneratorTarget::GetPchHeader(std::string const& config,
+ std::string const& language,
+ std::string const& arch) const
{
if (language != "C" && language != "CXX" && language != "OBJC" &&
language != "OBJCXX") {
@@ -2821,14 +2821,14 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
if (this->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) {
return std::string();
}
- const cmGeneratorTarget* generatorTarget = this;
+ cmGeneratorTarget const* generatorTarget = this;
cmValue pchReuseFrom =
generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
- const auto inserted =
+ auto const inserted =
this->PchHeaders.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
- const std::vector<BT<std::string>> headers =
+ std::vector<BT<std::string>> const headers =
this->GetPrecompileHeaders(config, language);
if (headers.empty() && !pchReuseFrom) {
return std::string();
@@ -2840,7 +2840,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
}
- const std::map<std::string, std::string> languageToExtension = {
+ std::map<std::string, std::string> const languageToExtension = {
{ "C", ".h" },
{ "CXX", ".hxx" },
{ "OBJC", ".objc.h" },
@@ -2857,7 +2857,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
cmStrCat(filename, "/cmake_pch", arch.empty() ? "" : cmStrCat("_", arch),
languageToExtension.at(language));
- const std::string filename_tmp = cmStrCat(filename, ".tmp");
+ std::string const filename_tmp = cmStrCat(filename, ".tmp");
if (!pchReuseFrom) {
cmValue pchPrologue =
this->Makefile->GetDefinition("CMAKE_PCH_PROLOGUE");
@@ -2915,24 +2915,24 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
return inserted.first->second;
}
-std::string cmGeneratorTarget::GetPchSource(const std::string& config,
- const std::string& language,
- const std::string& arch) const
+std::string cmGeneratorTarget::GetPchSource(std::string const& config,
+ std::string const& language,
+ std::string const& arch) const
{
if (language != "C" && language != "CXX" && language != "OBJC" &&
language != "OBJCXX") {
return std::string();
}
- const auto inserted =
+ auto const inserted =
this->PchSources.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
- const std::string pchHeader = this->GetPchHeader(config, language, arch);
+ std::string const pchHeader = this->GetPchHeader(config, language, arch);
if (pchHeader.empty()) {
return std::string();
}
std::string& filename = inserted.first->second;
- const cmGeneratorTarget* generatorTarget = this;
+ cmGeneratorTarget const* generatorTarget = this;
cmValue pchReuseFrom =
generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
if (pchReuseFrom) {
@@ -2944,7 +2944,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
// For GCC the source extension will be transformed into .h[xx].gch
if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) {
- const std::map<std::string, std::string> languageToExtension = {
+ std::map<std::string, std::string> const languageToExtension = {
{ "C", ".h.c" },
{ "CXX", ".hxx.cxx" },
{ "OBJC", ".objc.h.m" },
@@ -2954,7 +2954,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
filename = cmStrCat(filename, arch.empty() ? "" : cmStrCat("_", arch),
languageToExtension.at(language));
} else {
- const std::map<std::string, std::string> languageToExtension = {
+ std::map<std::string, std::string> const languageToExtension = {
{ "C", ".c" }, { "CXX", ".cxx" }, { "OBJC", ".m" }, { "OBJCXX", ".mm" }
};
@@ -2962,7 +2962,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
languageToExtension.at(language));
}
- const std::string filename_tmp = cmStrCat(filename, ".tmp");
+ std::string const filename_tmp = cmStrCat(filename, ".tmp");
if (!pchReuseFrom) {
{
cmGeneratedFileStream file(filename_tmp);
@@ -2975,18 +2975,18 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
return inserted.first->second;
}
-std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
- const std::string& language,
- const std::string& arch)
+std::string cmGeneratorTarget::GetPchFileObject(std::string const& config,
+ std::string const& language,
+ std::string const& arch)
{
if (language != "C" && language != "CXX" && language != "OBJC" &&
language != "OBJCXX") {
return std::string();
}
- const auto inserted =
+ auto const inserted =
this->PchObjectFiles.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
- const std::string pchSource = this->GetPchSource(config, language, arch);
+ std::string const pchSource = this->GetPchSource(config, language, arch);
if (pchSource.empty()) {
return std::string();
}
@@ -3004,21 +3004,21 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
return inserted.first->second;
}
-std::string cmGeneratorTarget::GetPchFile(const std::string& config,
- const std::string& language,
- const std::string& arch)
+std::string cmGeneratorTarget::GetPchFile(std::string const& config,
+ std::string const& language,
+ std::string const& arch)
{
- const auto inserted =
+ auto const inserted =
this->PchFiles.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
std::string& pchFile = inserted.first->second;
- const std::string pchExtension =
+ std::string const pchExtension =
this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION");
if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
- auto replaceExtension = [](const std::string& str,
- const std::string& ext) -> std::string {
+ auto replaceExtension = [](std::string const& str,
+ std::string const& ext) -> std::string {
auto dot_pos = str.rfind('.');
std::string result;
if (dot_pos != std::string::npos) {
@@ -3036,7 +3036,7 @@ std::string cmGeneratorTarget::GetPchFile(const std::string& config,
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
}
- const std::string pchFileObject =
+ std::string const pchFileObject =
generatorTarget->GetPchFileObject(config, language, arch);
if (!pchExtension.empty()) {
pchFile = replaceExtension(pchFileObject, pchExtension);
@@ -3050,10 +3050,10 @@ std::string cmGeneratorTarget::GetPchFile(const std::string& config,
}
std::string cmGeneratorTarget::GetPchCreateCompileOptions(
- const std::string& config, const std::string& language,
- const std::string& arch)
+ std::string const& config, std::string const& language,
+ std::string const& arch)
{
- const auto inserted = this->PchCreateCompileOptions.insert(
+ auto const inserted = this->PchCreateCompileOptions.insert(
std::make_pair(language + config + arch, ""));
if (inserted.second) {
std::string& createOptionList = inserted.first->second;
@@ -3073,14 +3073,14 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
}
}
- const std::string createOptVar =
+ std::string const createOptVar =
cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_CREATE_PCH");
createOptionList = cmStrCat(
createOptionList, ";", this->Makefile->GetSafeDefinition(createOptVar));
- const std::string pchHeader = this->GetPchHeader(config, language, arch);
- const std::string pchFile = this->GetPchFile(config, language, arch);
+ std::string const pchHeader = this->GetPchHeader(config, language, arch);
+ std::string const pchFile = this->GetPchFile(config, language, arch);
cmSystemTools::ReplaceString(createOptionList, "<PCH_HEADER>", pchHeader);
cmSystemTools::ReplaceString(createOptionList, "<PCH_FILE>", pchFile);
@@ -3089,10 +3089,10 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
}
std::string cmGeneratorTarget::GetPchUseCompileOptions(
- const std::string& config, const std::string& language,
- const std::string& arch)
+ std::string const& config, std::string const& language,
+ std::string const& arch)
{
- const auto inserted = this->PchUseCompileOptions.insert(
+ auto const inserted = this->PchUseCompileOptions.insert(
std::make_pair(language + config + arch, ""));
if (inserted.second) {
std::string& useOptionList = inserted.first->second;
@@ -3102,7 +3102,7 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_INVALID_PCH"));
}
- const std::string useOptVar =
+ std::string const useOptVar =
cmStrCat(language, "_COMPILE_OPTIONS_USE_PCH");
std::string const& useOptionListProperty =
@@ -3114,8 +3114,8 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
? this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_", useOptVar))
: useOptionListProperty);
- const std::string pchHeader = this->GetPchHeader(config, language, arch);
- const std::string pchFile = this->GetPchFile(config, language, arch);
+ std::string const pchHeader = this->GetPchHeader(config, language, arch);
+ std::string const pchFile = this->GetPchFile(config, language, arch);
cmSystemTools::ReplaceString(useOptionList, "<PCH_HEADER>", pchHeader);
cmSystemTools::ReplaceString(useOptionList, "<PCH_FILE>", pchFile);
@@ -3124,13 +3124,13 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
}
void cmGeneratorTarget::AddSourceFileToUnityBatch(
- const std::string& sourceFilename)
+ std::string const& sourceFilename)
{
this->UnityBatchedSourceFiles.insert(sourceFilename);
}
bool cmGeneratorTarget::IsSourceFilePartOfUnityBatch(
- const std::string& sourceFilename) const
+ std::string const& sourceFilename) const
{
if (!this->GetPropertyAsBool("UNITY_BUILD")) {
return false;
@@ -3140,7 +3140,7 @@ bool cmGeneratorTarget::IsSourceFilePartOfUnityBatch(
this->UnityBatchedSourceFiles.end();
}
-void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
+void cmGeneratorTarget::ComputeTargetManifest(std::string const& config) const
{
if (this->IsImported()) {
return;
@@ -3275,7 +3275,7 @@ bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config)
bool cmGeneratorTarget::ComputeCompileFeatures(
std::string const& config, std::set<LanguagePair> const& languagePairs)
{
- for (const auto& language : languagePairs) {
+ for (auto const& language : languagePairs) {
BTs<std::string> const* generatorTargetLanguageStandard =
this->GetLanguageStandardProperty(language.first, config);
if (!generatorTargetLanguageStandard) {
@@ -3319,7 +3319,7 @@ std::string cmGeneratorTarget::GetImportedLibName(
return std::string();
}
-std::string cmGeneratorTarget::GetFullPath(const std::string& config,
+std::string cmGeneratorTarget::GetFullPath(std::string const& config,
cmStateEnums::ArtifactType artifact,
bool realname) const
{
@@ -3330,7 +3330,7 @@ std::string cmGeneratorTarget::GetFullPath(const std::string& config,
}
std::string cmGeneratorTarget::NormalGetFullPath(
- const std::string& config, cmStateEnums::ArtifactType artifact,
+ std::string const& config, cmStateEnums::ArtifactType artifact,
bool realname) const
{
std::string fpath = cmStrCat(this->GetDirectory(config, artifact), '/');
@@ -3363,7 +3363,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(
}
std::string cmGeneratorTarget::NormalGetRealName(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@@ -3384,7 +3384,7 @@ std::string cmGeneratorTarget::NormalGetRealName(
}
cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames(
- const std::string& config) const
+ std::string const& config) const
{
cmGeneratorTarget::Names targetNames;
@@ -3493,7 +3493,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames(
}
cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames(
- const std::string& config) const
+ std::string const& config) const
{
cmGeneratorTarget::Names targetNames;
@@ -3560,7 +3560,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames(
}
std::string cmGeneratorTarget::GetFullNameInternal(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
NameComponents const& components =
this->GetFullNameInternalComponents(config, artifact);
@@ -3568,7 +3568,7 @@ std::string cmGeneratorTarget::GetFullNameInternal(
}
std::string cmGeneratorTarget::ImportedGetLocation(
- const std::string& config) const
+ std::string const& config) const
{
assert(this->IsImported());
return this->Target->ImportedGetFullPath(
@@ -3576,7 +3576,7 @@ std::string cmGeneratorTarget::ImportedGetLocation(
}
std::string cmGeneratorTarget::GetFullNameImported(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
return cmSystemTools::GetFilenameName(
this->Target->ImportedGetFullPath(config, artifact));
@@ -3605,7 +3605,7 @@ cmGeneratorTarget::GetFullNameInternalComponents(
return cache.emplace(config, std::move(components)).first->second;
}
- const bool isImportedLibraryArtifact =
+ bool const isImportedLibraryArtifact =
(artifact == cmStateEnums::ImportLibraryArtifact);
// Return an empty name for the import library if this platform
@@ -3693,24 +3693,23 @@ cmGeneratorTarget::GetFullNameInternalComponents(
}
std::string cmGeneratorTarget::GetLinkerLanguage(
- const std::string& config) const
+ std::string const& config) const
{
return this->GetLinkClosure(config)->LinkerLanguage;
}
-std::string cmGeneratorTarget::GetLinkerTool(const std::string& config) const
+std::string cmGeneratorTarget::GetLinkerTool(std::string const& config) const
{
return this->GetLinkerTool(this->GetLinkerLanguage(config), config);
}
-std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
- const std::string& config) const
+std::string cmGeneratorTarget::GetLinkerTool(std::string const& lang,
+ std::string const& config) const
{
- auto usingLinker =
- cmStrCat("CMAKE_", lang, "_USING_", this->IsDeviceLink() ? "DEVICE_" : "",
- "LINKER_");
- auto format = this->Makefile->GetDefinition(cmStrCat(usingLinker, "MODE"));
- if (!format || format != "TOOL"_s) {
+ auto linkMode = cmStrCat(
+ "CMAKE_", lang, this->IsDeviceLink() ? "_DEVICE_" : "_", "LINK_MODE");
+ auto mode = this->Makefile->GetDefinition(linkMode);
+ if (!mode || mode != "LINKER"_s) {
return this->Makefile->GetDefinition("CMAKE_LINKER");
}
@@ -3718,7 +3717,9 @@ std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
if (linkerType.empty()) {
linkerType = "DEFAULT";
}
- usingLinker = cmStrCat(usingLinker, linkerType);
+ auto usingLinker =
+ cmStrCat("CMAKE_", lang, "_USING_", this->IsDeviceLink() ? "DEVICE_" : "",
+ "LINKER_", linkerType);
auto linkerTool = this->Makefile->GetDefinition(usingLinker);
if (!linkerTool) {
@@ -3731,7 +3732,7 @@ std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
linkerTool = this->Makefile->GetDefinition("CMAKE_LINKER");
if (linkerType != "DEFAULT"_s) {
- auto isCMakeLinkerType = [](const std::string& type) -> bool {
+ auto isCMakeLinkerType = [](std::string const& type) -> bool {
return std::all_of(type.cbegin(), type.cend(),
[](char c) { return std::isupper(c); });
};
@@ -3768,7 +3769,7 @@ bool cmGeneratorTarget::LinkerEnforcesNoAllowShLibUndefined(
}
std::string cmGeneratorTarget::GetPDBOutputName(
- const std::string& config) const
+ std::string const& config) const
{
std::string base =
this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact);
@@ -3792,7 +3793,7 @@ std::string cmGeneratorTarget::GetPDBOutputName(
return base;
}
-std::string cmGeneratorTarget::GetPDBName(const std::string& config) const
+std::string cmGeneratorTarget::GetPDBName(std::string const& config) const
{
NameComponents const& parts = this->GetFullNameInternalComponents(
config, cmStateEnums::RuntimeBinaryArtifact);
@@ -3877,7 +3878,7 @@ bool cmGeneratorTarget::StrictTargetComparison::operator()(
}
struct cmGeneratorTarget::SourceFileFlags
-cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
+cmGeneratorTarget::GetTargetSourceFileFlags(cmSourceFile const* sf) const
{
struct SourceFileFlags flags;
this->ConstructSourceFileFlags();
@@ -3889,7 +3890,7 @@ cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
// were not listed in one of the other lists.
if (cmValue location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) {
flags.MacFolder = location->c_str();
- const bool stripResources =
+ bool const stripResources =
this->GlobalGenerator->ShouldStripResourcePath(this->Makefile);
if (*location == "Resources") {
flags.Type = cmGeneratorTarget::SourceFileTypeResource;
@@ -3971,7 +3972,7 @@ void cmGeneratorTarget::GetTargetVersion(int& major, int& minor) const
}
void cmGeneratorTarget::GetTargetVersionFallback(
- const std::string& property, const std::string& fallback_property,
+ std::string const& property, std::string const& fallback_property,
int& major, int& minor, int& patch) const
{
if (this->GetProperty(property)) {
@@ -3981,7 +3982,7 @@ void cmGeneratorTarget::GetTargetVersionFallback(
}
}
-void cmGeneratorTarget::GetTargetVersion(const std::string& property,
+void cmGeneratorTarget::GetTargetVersion(std::string const& property,
int& major, int& minor,
int& patch) const
{
@@ -4046,8 +4047,13 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory(
return this->FortranModuleDirectory;
}
-bool cmGeneratorTarget::IsFortranBuildingInstrinsicModules() const
+bool cmGeneratorTarget::IsFortranBuildingIntrinsicModules() const
{
+ // ATTENTION Before 4.0 the property name was misspelled.
+ // Check the correct name first and than the old name.
+ if (cmValue prop = this->GetProperty("Fortran_BUILDING_INTRINSIC_MODULES")) {
+ return prop.IsOn();
+ }
if (cmValue prop =
this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) {
return prop.IsOn();
@@ -4182,17 +4188,15 @@ std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
}
void cmGeneratorTarget::ReportPropertyOrigin(
- const std::string& p, const std::string& result, const std::string& report,
- const std::string& compatibilityType) const
+ std::string const& p, std::string const& result, std::string const& report,
+ std::string const& compatibilityType) const
{
cmList debugProperties{ this->Target->GetMakefile()->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] &&
cm::contains(debugProperties, p);
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugCompatiblePropertiesDone[p] = true;
- }
+ this->DebugCompatiblePropertiesDone[p] = true;
if (!debugOrigin) {
return;
}
@@ -4206,7 +4210,7 @@ void cmGeneratorTarget::ReportPropertyOrigin(
}
std::string cmGeneratorTarget::GetDirectory(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
auto fullPath = this->Target->ImportedGetFullPath(config, artifact);
@@ -4233,14 +4237,14 @@ std::string cmGeneratorTarget::GetDirectory(
}
bool cmGeneratorTarget::UsesDefaultOutputDir(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
std::string dir;
return this->ComputeOutputDir(config, artifact, dir);
}
cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
- const std::string& config) const
+ std::string const& config) const
{
// There is no output information for imported targets.
if (this->IsImported()) {
@@ -4296,7 +4300,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
return &i->second;
}
-bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
+bool cmGeneratorTarget::ComputeOutputDir(std::string const& config,
cmStateEnums::ArtifactType artifact,
std::string& out) const
{
@@ -4369,8 +4373,8 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
return usesDefaultOutputDir;
}
-bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
- const std::string& config,
+bool cmGeneratorTarget::ComputePDBOutputDir(std::string const& kind,
+ std::string const& config,
std::string& out) const
{
// Look for a target property defining the target output directory
@@ -4425,7 +4429,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
return true;
}
-bool cmGeneratorTarget::HaveInstallTreeRPATH(const std::string& config) const
+bool cmGeneratorTarget::HaveInstallTreeRPATH(std::string const& config) const
{
std::string install_rpath;
this->GetInstallRPATH(config, install_rpath);
@@ -4433,20 +4437,20 @@ bool cmGeneratorTarget::HaveInstallTreeRPATH(const std::string& config) const
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
}
-bool cmGeneratorTarget::GetBuildRPATH(const std::string& config,
+bool cmGeneratorTarget::GetBuildRPATH(std::string const& config,
std::string& rpath) const
{
return this->GetRPATH(config, "BUILD_RPATH", rpath);
}
-bool cmGeneratorTarget::GetInstallRPATH(const std::string& config,
+bool cmGeneratorTarget::GetInstallRPATH(std::string const& config,
std::string& rpath) const
{
return this->GetRPATH(config, "INSTALL_RPATH", rpath);
}
-bool cmGeneratorTarget::GetRPATH(const std::string& config,
- const std::string& prop,
+bool cmGeneratorTarget::GetRPATH(std::string const& config,
+ std::string const& prop,
std::string& rpath) const
{
cmValue value = this->GetProperty(prop);
@@ -4461,7 +4465,7 @@ bool cmGeneratorTarget::GetRPATH(const std::string& config,
}
cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
- const std::string& config) const
+ std::string const& config) const
{
// There is no imported information for non-imported targets.
if (!this->IsImported()) {
@@ -4656,7 +4660,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFilesForXcode(
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
auto it = configs.begin();
- const std::string& firstConfig = *it;
+ std::string const& firstConfig = *it;
this->GetSourceFilesWithoutObjectLibraries(files, firstConfig);
for (; it != configs.end(); ++it) {
@@ -4664,7 +4668,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFilesForXcode(
this->GetSourceFilesWithoutObjectLibraries(configFiles, *it);
if (configFiles != files) {
std::string firstConfigFiles;
- const char* sep = "";
+ char const* sep = "";
for (cmSourceFile* f : files) {
firstConfigFiles += sep;
firstConfigFiles += f->ResolveFullPath();
@@ -4697,14 +4701,15 @@ bool cmGeneratorTarget::GetConfigCommonSourceFilesForXcode(
return true;
}
-void cmGeneratorTarget::GetObjectLibrariesCMP0026(
+void cmGeneratorTarget::GetObjectLibrariesInSources(
std::vector<cmGeneratorTarget*>& objlibs) const
{
- // At configure-time, this method can be called as part of getting the
- // LOCATION property or to export() a file to be include()d. However
- // there is no cmGeneratorTarget at configure-time, so search the SOURCES
- // for TARGET_OBJECTS instead for backwards compatibility with OLD
- // behavior of CMP0024 and CMP0026 only.
+ // FIXME: This searches SOURCES for TARGET_OBJECTS for backwards
+ // compatibility with the OLD behavior of CMP0026 since this
+ // could be called at configure time. CMP0026 has been removed,
+ // so this should now be called only at generate time.
+ // Therefore we should be able to improve the implementation
+ // with generate-time information.
cmBTStringRange rng = this->Target->GetSourceEntries();
for (auto const& entry : rng) {
cmList files{ entry.Value };
@@ -4741,36 +4746,11 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
}
if (lib != item) {
cmake* cm = this->LocalGenerator->GetCMakeInstance();
- switch (this->GetPolicyStatusCMP0004()) {
- case cmPolicies::WARN: {
- std::ostringstream w;
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n"
- << "Target \"" << this->GetName() << "\" links to item \"" << item
- << "\" which has leading or trailing whitespace.";
- cm->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
- this->GetBacktrace());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::NEW: {
- std::ostringstream e;
- e << "Target \"" << this->GetName() << "\" links to item \"" << item
- << "\" which has leading or trailing whitespace. "
- << "This is now an error according to policy CMP0004.";
- cm->IssueMessage(MessageType::FATAL_ERROR, e.str(),
- this->GetBacktrace());
- } break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS: {
- std::ostringstream e;
- e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n"
- << "Target \"" << this->GetName() << "\" links to item \"" << item
- << "\" which has leading or trailing whitespace.";
- cm->IssueMessage(MessageType::FATAL_ERROR, e.str(),
- this->GetBacktrace());
- } break;
- }
+ std::ostringstream e;
+ e << "Target \"" << this->GetName() << "\" links to item \"" << item
+ << "\" which has leading or trailing whitespace. "
+ << "This is now an error according to policy CMP0004.";
+ cm->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->GetBacktrace());
}
return lib;
}
@@ -4791,7 +4771,7 @@ std::string cmGeneratorTarget::GetDeprecation() const
}
void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
- const std::string& config) const
+ std::string const& config) const
{
// Targets that do not compile anything have no languages.
if (!this->CanCompileSources()) {
@@ -4801,22 +4781,14 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
std::vector<cmSourceFile*> sourceFiles;
this->GetSourceFiles(sourceFiles, config);
for (cmSourceFile* src : sourceFiles) {
- const std::string& lang = src->GetOrDetermineLanguage();
+ std::string const& lang = src->GetOrDetermineLanguage();
if (!lang.empty()) {
languages.insert(lang);
}
}
- std::set<cmGeneratorTarget const*> objectLibraries;
- if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- std::vector<cmGeneratorTarget*> objectTargets;
- this->GetObjectLibrariesCMP0026(objectTargets);
- for (cmGeneratorTarget* gt : objectTargets) {
- objectLibraries.insert(gt);
- }
- } else {
- objectLibraries = this->GetSourceObjectLibraries(config);
- }
+ std::set<cmGeneratorTarget const*> objectLibraries =
+ this->GetSourceObjectLibraries(config);
for (cmGeneratorTarget const* objLib : objectLibraries) {
objLib->GetLanguages(languages, config);
}
@@ -4871,7 +4843,7 @@ bool cmGeneratorTarget::IsDotNetSdkTarget() const
}
void cmGeneratorTarget::ComputeLinkImplementationLanguages(
- const std::string& config, cmOptionalLinkImplementation& impl) const
+ std::string const& config, cmOptionalLinkImplementation& impl) const
{
// This target needs runtime libraries for its source languages.
std::set<std::string> languages;
@@ -4882,7 +4854,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLanguages(
languages.end());
}
-bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
+bool cmGeneratorTarget::HaveBuildTreeRPATH(std::string const& config) const
{
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) {
return false;
@@ -4899,7 +4871,7 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
}
bool cmGeneratorTarget::IsNullImpliedByLinkLibraries(
- const std::string& p) const
+ std::string const& p) const
{
return cm::contains(this->LinkImplicitNullProperties, p);
}
@@ -5025,7 +4997,7 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
std::vector<std::string> allConfigs =
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
cmOptionalLinkImplementation impl;
- this->ComputeLinkImplementationLibraries(config, impl, this, UseTo::Link);
+ this->ComputeLinkImplementationLibraries(config, impl, UseTo::Link);
cmCxxModuleUsageEffects usage(this);
@@ -5149,7 +5121,7 @@ std::vector<std::string> cmGeneratorTarget::GetPackageReferences() const
return std::move(packageReferences.data());
}
-std::string cmGeneratorTarget::GetPDBDirectory(const std::string& config) const
+std::string cmGeneratorTarget::GetPDBDirectory(std::string const& config) const
{
if (OutputInfo const* info = this->GetOutputInfo(config)) {
// Return the directory in which the target will be built.
@@ -5166,7 +5138,7 @@ bool cmGeneratorTarget::HasImplibGNUtoMS(std::string const& config) const
bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& config,
std::string const& gnuName,
std::string& out,
- const char* newExt) const
+ char const* newExt) const
{
if (this->HasImplibGNUtoMS(config) && gnuName.size() > 6 &&
gnuName.substr(gnuName.size() - 6) == ".dll.a") {
@@ -5265,9 +5237,9 @@ bool cmGeneratorTarget::HasLinkDependencyFile(std::string const& config) const
return false;
}
- const std::string depsUseLinker{ "CMAKE_LINK_DEPENDS_USE_LINKER" };
+ std::string const depsUseLinker{ "CMAKE_LINK_DEPENDS_USE_LINKER" };
auto linkLanguage = this->GetLinkerLanguage(config);
- const std::string langDepsUseLinker{ cmStrCat("CMAKE_", linkLanguage,
+ std::string const langDepsUseLinker{ cmStrCat("CMAKE_", linkLanguage,
"_LINK_DEPENDS_USE_LINKER") };
return (!this->Makefile->IsDefinitionSet(depsUseLinker) ||
@@ -5286,7 +5258,7 @@ bool cmGeneratorTarget::IsArchivedAIXSharedLibrary() const
}
bool cmGeneratorTarget::IsImportedFrameworkFolderOnApple(
- const std::string& config) const
+ std::string const& config) const
{
if (this->IsApple() && this->IsImported() &&
(this->GetType() == cmStateEnums::STATIC_LIBRARY ||
@@ -5346,7 +5318,7 @@ cmGeneratorTarget::ManagedType cmGeneratorTarget::CheckManagedType(
}
cmGeneratorTarget::ManagedType cmGeneratorTarget::GetManagedType(
- const std::string& config) const
+ std::string const& config) const
{
// Only libraries and executables can be managed targets.
if (this->GetType() > cmStateEnums::SHARED_LIBRARY) {
@@ -5393,7 +5365,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
}
auto verifyValue = this->GetProperty("INTERFACE_HEADER_SETS_TO_VERIFY");
- const bool all = verifyValue.IsEmpty();
+ bool const all = verifyValue.IsEmpty();
std::set<std::string> verifySet;
if (!all) {
cmList verifyList{ verifyValue };
@@ -5403,7 +5375,8 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
cmTarget* verifyTarget = nullptr;
cmTarget* allVerifyTarget =
this->GlobalGenerator->GetMakefiles().front()->FindTargetToUse(
- "all_verify_interface_header_sets", true);
+ "all_verify_interface_header_sets",
+ { cmStateEnums::TargetDomain::NATIVE });
auto interfaceFileSetEntries = this->Target->GetInterfaceHeaderSetsEntries();
@@ -5433,7 +5406,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
auto fileCges = fileSet->CompileFileEntries();
static auto const contextSensitive =
- [](const std::unique_ptr<cmCompiledGeneratorExpression>& cge) {
+ [](std::unique_ptr<cmCompiledGeneratorExpression> const& cge) {
return cge->GetHadContextSensitiveCondition();
};
bool dirCgesContextSensitive = false;
@@ -5487,11 +5460,8 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
verifyTarget->SetProperty("DISABLE_PRECOMPILE_HEADERS", "ON");
verifyTarget->SetProperty("UNITY_BUILD", "OFF");
verifyTarget->SetProperty("CXX_SCAN_FOR_MODULES", "OFF");
- cm::optional<std::map<std::string, cmValue>>
- perConfigCompileDefinitions;
verifyTarget->FinalizeTargetConfiguration(
- this->Makefile->GetCompileDefinitionsEntries(),
- perConfigCompileDefinitions);
+ this->Makefile->GetCompileDefinitionsEntries());
if (!allVerifyTarget) {
allVerifyTarget = this->GlobalGenerator->GetMakefiles()
@@ -5526,7 +5496,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
}
std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
- cmSourceFile& source, const std::string& dir,
+ cmSourceFile& source, std::string const& dir,
cm::optional<std::set<std::string>>& languages) const
{
std::string extension;
@@ -5604,7 +5574,7 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
}
std::string cmGeneratorTarget::GetImportedXcFrameworkPath(
- const std::string& config) const
+ std::string const& config) const
{
if (!(this->IsApple() && this->IsImported() &&
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -5928,8 +5898,6 @@ cmGeneratorTarget::CxxModuleSupport cmGeneratorTarget::NeedCxxDyndep(
// The OLD behavior is to not scan the source.
policyAnswer = CxxModuleSupport::Disabled;
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
// The NEW behavior is to scan the source if the compiler supports
// scanning and the generator supports it.
@@ -6025,15 +5993,27 @@ std::string cmGeneratorTarget::GetSwiftModuleFileName() const
std::string cmGeneratorTarget::GetSwiftModuleDirectory(
std::string const& config) const
{
- std::string moduleDirectory =
- this->GetPropertyOrDefault("Swift_MODULE_DIRECTORY", "");
+ // This is like the *_OUTPUT_DIRECTORY properties except that we don't have a
+ // separate per-configuration target property.
+ //
+ // The property expands generator expressions. Multi-config generators append
+ // a per-configuration subdirectory to the specified directory unless a
+ // generator expression is used.
+ bool appendConfigDir = true;
+ std::string moduleDirectory;
+ if (cmValue value = this->GetProperty("Swift_MODULE_DIRECTORY")) {
+ moduleDirectory = cmGeneratorExpression::Evaluate(
+ *value, this->LocalGenerator, config, this);
+ appendConfigDir = *value == moduleDirectory;
+ }
if (moduleDirectory.empty()) {
moduleDirectory = this->LocalGenerator->GetCurrentBinaryDirectory();
+ }
+ if (appendConfigDir) {
this->LocalGenerator->GetGlobalGenerator()->AppendDirectoryForConfig(
"/", config, "", moduleDirectory);
}
-
return moduleDirectory;
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 758fb8a..083de54 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,9 +60,10 @@ public:
bool IsSynthetic() const;
bool IsImported() const;
bool IsImportedGloballyVisible() const;
+ bool IsForeign() const;
bool CanCompileSources() const;
bool HasKnownRuntimeArtifactLocation(std::string const& config) const;
- const std::string& GetLocation(const std::string& config) const;
+ std::string const& GetLocation(std::string const& config) const;
/** Get the full path to the target's main artifact, if known. */
cm::optional<std::string> MaybeGetLocation(std::string const& config) const;
@@ -90,10 +91,10 @@ public:
/** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This
location is suitable for use as the LOCATION target property. */
- const std::string& GetLocationForBuild() const;
+ std::string const& GetLocationForBuild() const;
cmComputeLinkInformation* GetLinkInformation(
- const std::string& config) const;
+ std::string const& config) const;
// Perform validation checks on memoized link structures.
// Call this after generation is complete.
@@ -107,19 +108,19 @@ public:
};
cmStateEnums::TargetType GetType() const;
- const std::string& GetName() const;
+ std::string const& GetName() const;
std::string GetFamilyName() const;
std::string GetExportName() const;
std::string GetFilesystemExportName() const;
std::vector<std::string> GetPropertyKeys() const;
//! Might return a nullptr if the property is not set or invalid
- cmValue GetProperty(const std::string& prop) const;
+ cmValue GetProperty(std::string const& prop) const;
//! Always returns a valid pointer
std::string const& GetSafeProperty(std::string const& prop) const;
- bool GetPropertyAsBool(const std::string& prop) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files,
- const std::string& config) const;
+ std::string const& config) const;
std::vector<BT<cmSourceFile*>> GetSourceFiles(
std::string const& config) const;
@@ -179,9 +180,9 @@ public:
std::set<std::string> GetAllConfigCompileLanguages() const;
void GetObjectSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
- const std::string& GetObjectName(cmSourceFile const* file);
- const char* GetCustomObjectExtension() const;
+ std::string const& config) const;
+ std::string const& GetObjectName(cmSourceFile const* file);
+ char const* GetCustomObjectExtension() const;
bool HasExplicitObjectName(cmSourceFile const* file) const;
void AddExplicitObjectName(cmSourceFile const* sf);
@@ -197,52 +198,52 @@ public:
bool GetLanguageStandardRequired(std::string const& lang) const;
void GetModuleDefinitionSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
void GetExternalObjects(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
void GetHeaderSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
void GetCxxModuleSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
void GetExtraSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
void GetCustomCommands(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
void GetManifests(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
+ std::string const& config) const;
std::set<cmLinkItem> const& GetUtilityItems() const;
void ComputeObjectMapping();
- cmValue GetFeature(const std::string& feature,
- const std::string& config) const;
+ cmValue GetFeature(std::string const& feature,
+ std::string const& config) const;
std::string GetLinkerTypeProperty(std::string const& lang,
std::string const& config) const;
- const char* GetLinkPIEProperty(const std::string& config) const;
+ char const* GetLinkPIEProperty(std::string const& config) const;
bool IsIPOEnabled(std::string const& lang, std::string const& config) const;
- bool IsLinkInterfaceDependentBoolProperty(const std::string& p,
- const std::string& config) const;
- bool IsLinkInterfaceDependentStringProperty(const std::string& p,
- const std::string& config) const;
+ bool IsLinkInterfaceDependentBoolProperty(std::string const& p,
+ std::string const& config) const;
+ bool IsLinkInterfaceDependentStringProperty(std::string const& p,
+ std::string const& config) const;
bool IsLinkInterfaceDependentNumberMinProperty(
- const std::string& p, const std::string& config) const;
+ std::string const& p, std::string const& config) const;
bool IsLinkInterfaceDependentNumberMaxProperty(
- const std::string& p, const std::string& config) const;
+ std::string const& p, std::string const& config) const;
- bool GetLinkInterfaceDependentBoolProperty(const std::string& p,
- const std::string& config) const;
+ bool GetLinkInterfaceDependentBoolProperty(std::string const& p,
+ std::string const& config) const;
- const char* GetLinkInterfaceDependentStringProperty(
- const std::string& p, const std::string& config) const;
- const char* GetLinkInterfaceDependentNumberMinProperty(
- const std::string& p, const std::string& config) const;
- const char* GetLinkInterfaceDependentNumberMaxProperty(
- const std::string& p, const std::string& config) const;
+ char const* GetLinkInterfaceDependentStringProperty(
+ std::string const& p, std::string const& config) const;
+ char const* GetLinkInterfaceDependentNumberMinProperty(
+ std::string const& p, std::string const& config) const;
+ char const* GetLinkInterfaceDependentNumberMaxProperty(
+ std::string const& p, std::string const& config) const;
class DeviceLinkSetter
{
@@ -263,10 +264,7 @@ public:
bool IsDeviceLink() const { return this->DeviceLink; }
cmLinkInterface const* GetLinkInterface(
- const std::string& config, const cmGeneratorTarget* headTarget) const;
- void ComputeLinkInterface(const std::string& config,
- cmOptionalLinkInterface& iface,
- const cmGeneratorTarget* head) const;
+ std::string const& config, cmGeneratorTarget const* headTarget) const;
enum class UseTo
{
@@ -275,12 +273,12 @@ public:
};
cmLinkInterfaceLibraries const* GetLinkInterfaceLibraries(
- const std::string& config, const cmGeneratorTarget* headTarget,
+ std::string const& config, cmGeneratorTarget const* headTarget,
UseTo usage) const;
- void ComputeLinkInterfaceLibraries(const std::string& config,
+ void ComputeLinkInterfaceLibraries(std::string const& config,
cmOptionalLinkInterface& iface,
- const cmGeneratorTarget* head,
+ cmGeneratorTarget const* head,
UseTo usage) const;
/** Get the library name for an imported interface library. */
@@ -289,13 +287,13 @@ public:
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
std::string GetFullPath(
- const std::string& config,
+ std::string const& config,
cmStateEnums::ArtifactType artifact = cmStateEnums::RuntimeBinaryArtifact,
bool realname = false) const;
- std::string NormalGetFullPath(const std::string& config,
+ std::string NormalGetFullPath(std::string const& config,
cmStateEnums::ArtifactType artifact,
bool realname) const;
- std::string NormalGetRealName(const std::string& config,
+ std::string NormalGetRealName(std::string const& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
@@ -313,7 +311,7 @@ public:
};
/** @return the Mac App directory without the base */
- std::string GetAppBundleDirectory(const std::string& config,
+ std::string GetAppBundleDirectory(std::string const& config,
BundleDirectoryLevel level) const;
/** Return whether this target is marked as deprecated by the
@@ -328,16 +326,16 @@ public:
bool IsBundleOnApple() const;
/** Return whether this target is a Win32 executable */
- bool IsWin32Executable(const std::string& config) const;
+ bool IsWin32Executable(std::string const& config) const;
/** Get the full name of the target according to the settings in its
makefile. */
- std::string GetFullName(const std::string& config,
+ std::string GetFullName(std::string const& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
/** @return the Mac framework directory without the base. */
- std::string GetFrameworkDirectory(const std::string& config,
+ std::string GetFrameworkDirectory(std::string const& config,
BundleDirectoryLevel level) const;
/** Return the framework version string. Undefined if
@@ -345,18 +343,18 @@ public:
std::string GetFrameworkVersion() const;
/** @return the Mac CFBundle directory without the base */
- std::string GetCFBundleDirectory(const std::string& config,
+ std::string GetCFBundleDirectory(std::string const& config,
BundleDirectoryLevel level) const;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
- std::string GetInstallNameDirForBuildTree(const std::string& config) const;
+ std::string GetInstallNameDirForBuildTree(std::string const& config) const;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree(
- const std::string& config, const std::string& installPrefix) const;
+ std::string const& config, std::string const& installPrefix) const;
cmListFileBacktrace GetBacktrace() const;
@@ -369,10 +367,10 @@ public:
/** Get the macro to define when building sources in this target.
If no macro should be defined null is returned. */
- const std::string* GetExportMacro() const;
+ std::string const* GetExportMacro() const;
/** Get the soname of the target. Allowed only for a shared library. */
- std::string GetSOName(const std::string& config,
+ std::string GetSOName(std::string const& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
@@ -389,13 +387,13 @@ public:
/** Append to @a base the bundle directory hierarchy up to a certain @a level
* and return it. */
- std::string BuildBundleDirectory(const std::string& base,
- const std::string& config,
+ std::string BuildBundleDirectory(std::string const& base,
+ std::string const& config,
BundleDirectoryLevel level) const;
/** @return the mac content directory for this target. */
std::string GetMacContentDirectory(
- const std::string& config, cmStateEnums::ArtifactType artifact) const;
+ std::string const& config, cmStateEnums::ArtifactType artifact) const;
/** @return folder prefix for IDEs. */
std::string GetEffectiveFolderName() const;
@@ -405,6 +403,8 @@ public:
cmLocalGenerator* LocalGenerator;
cmGlobalGenerator const* GlobalGenerator;
+ std::string targetLabelsString;
+
struct ModuleDefinitionInfo
{
std::string DefFile;
@@ -437,20 +437,19 @@ public:
std::vector<std::string> Languages;
};
- LinkClosure const* GetLinkClosure(const std::string& config) const;
+ LinkClosure const* GetLinkClosure(std::string const& config) const;
- cmLinkImplementation const* GetLinkImplementation(const std::string& config,
+ cmLinkImplementation const* GetLinkImplementation(std::string const& config,
UseTo usage) const;
void ComputeLinkImplementationLanguages(
- const std::string& config, cmOptionalLinkImplementation& impl) const;
+ std::string const& config, cmOptionalLinkImplementation& impl) const;
cmLinkImplementationLibraries const* GetLinkImplementationLibraries(
- const std::string& config, UseTo usage) const;
+ std::string const& config, UseTo usage) const;
- void ComputeLinkImplementationLibraries(const std::string& config,
+ void ComputeLinkImplementationLibraries(std::string const& config,
cmOptionalLinkImplementation& impl,
- const cmGeneratorTarget* head,
UseTo usage) const;
struct TargetOrString
@@ -491,10 +490,10 @@ public:
bool IsDotNetSdkTarget() const;
- void GetObjectLibrariesCMP0026(
+ void GetObjectLibrariesInSources(
std::vector<cmGeneratorTarget*>& objlibs) const;
- std::string GetFullNameImported(const std::string& config,
+ std::string GetFullNameImported(std::string const& config,
cmStateEnums::ArtifactType artifact) const;
/** Get source files common to all configurations and diagnose cases
@@ -503,7 +502,7 @@ public:
bool GetConfigCommonSourceFilesForXcode(
std::vector<cmSourceFile*>& files) const;
- bool HaveBuildTreeRPATH(const std::string& config) const;
+ bool HaveBuildTreeRPATH(std::string const& config) const;
/** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build
@@ -517,6 +516,8 @@ public:
std::vector<std::string> GetAppleArchs(std::string const& config,
cm::optional<std::string> lang) const;
+ std::string const& GetTargetLabelsString();
+
// The classification of the flag.
enum class FlagClassification
{
@@ -601,7 +602,7 @@ public:
std::string GetCreateRuleVariable(std::string const& lang,
std::string const& config) const;
- std::string GetClangTidyExportFixesDirectory(const std::string& lang) const;
+ std::string GetClangTidyExportFixesDirectory(std::string const& lang) const;
/** Return the swift module name for this target. */
std::string GetSwiftModuleName() const;
@@ -637,90 +638,94 @@ private:
public:
/** Get the include directories for this target. */
std::vector<BT<std::string>> GetIncludeDirectories(
- const std::string& config, const std::string& lang) const;
+ std::string const& config, std::string const& lang) const;
void GetCompileOptions(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const;
+ std::string const& config,
+ std::string const& language) const;
std::vector<BT<std::string>> GetCompileOptions(
std::string const& config, std::string const& language) const;
void GetCompileFeatures(std::vector<std::string>& features,
- const std::string& config) const;
+ std::string const& config) const;
std::vector<BT<std::string>> GetCompileFeatures(
std::string const& config) const;
void GetCompileDefinitions(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const;
+ std::string const& config,
+ std::string const& language) const;
std::vector<BT<std::string>> GetCompileDefinitions(
std::string const& config, std::string const& language) const;
void GetLinkOptions(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const;
+ std::string const& config,
+ std::string const& language) const;
std::vector<BT<std::string>> GetLinkOptions(
std::string const& config, std::string const& language) const;
std::vector<BT<std::string>>& ResolveLinkerWrapper(
- std::vector<BT<std::string>>& result, const std::string& language,
+ std::vector<BT<std::string>>& result, std::string const& language,
bool joinItems = false) const;
void GetStaticLibraryLinkOptions(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const;
+ std::string const& config,
+ std::string const& language) const;
std::vector<BT<std::string>> GetStaticLibraryLinkOptions(
std::string const& config, std::string const& language) const;
+ std::vector<BT<std::string>>& ResolveArchiverWrapper(
+ std::vector<BT<std::string>>& result, std::string const& language,
+ bool joinItems = false) const;
+
void GetLinkDirectories(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const;
+ std::string const& config,
+ std::string const& language) const;
std::vector<BT<std::string>> GetLinkDirectories(
std::string const& config, std::string const& language) const;
void GetLinkDepends(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const;
+ std::string const& config,
+ std::string const& language) const;
std::vector<BT<std::string>> GetLinkDepends(
std::string const& config, std::string const& language) const;
std::vector<BT<std::string>> GetPrecompileHeaders(
- const std::string& config, const std::string& language) const;
+ std::string const& config, std::string const& 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;
- std::string GetPchSource(const std::string& config,
- const std::string& language,
- const std::string& arch = std::string()) const;
- std::string GetPchFileObject(const std::string& config,
- const std::string& language,
- const std::string& arch = std::string());
- std::string GetPchFile(const std::string& config,
- const std::string& language,
- const std::string& arch = std::string());
+ std::string GetPchHeader(std::string const& config,
+ std::string const& language,
+ std::string const& arch = std::string()) const;
+ std::string GetPchSource(std::string const& config,
+ std::string const& language,
+ std::string const& arch = std::string()) const;
+ std::string GetPchFileObject(std::string const& config,
+ std::string const& language,
+ std::string const& arch = std::string());
+ std::string GetPchFile(std::string const& config,
+ std::string const& language,
+ std::string const& arch = std::string());
std::string GetPchCreateCompileOptions(
- const std::string& config, const std::string& language,
- const std::string& arch = std::string());
- std::string GetPchUseCompileOptions(const std::string& config,
- const std::string& language,
- const std::string& arch = std::string());
+ std::string const& config, std::string const& language,
+ std::string const& arch = std::string());
+ std::string GetPchUseCompileOptions(std::string const& config,
+ std::string const& language,
+ std::string const& arch = std::string());
- void AddSourceFileToUnityBatch(const std::string& sourceFilename);
- bool IsSourceFilePartOfUnityBatch(const std::string& sourceFilename) const;
+ void AddSourceFileToUnityBatch(std::string const& sourceFilename);
+ bool IsSourceFilePartOfUnityBatch(std::string const& sourceFilename) const;
- bool IsSystemIncludeDirectory(const std::string& dir,
- const std::string& config,
- const std::string& language) const;
+ bool IsSystemIncludeDirectory(std::string const& dir,
+ std::string const& config,
+ std::string const& language) const;
- void AddSystemIncludeCacheKey(const std::string& key,
- const std::string& config,
- const std::string& language) const;
+ void AddSystemIncludeCacheKey(std::string const& key,
+ std::string const& config,
+ std::string const& language) const;
/** Add the target output files to the global generator manifest. */
- void ComputeTargetManifest(const std::string& config) const;
+ void ComputeTargetManifest(std::string const& config) const;
bool ComputeCompileFeatures(std::string const& config);
@@ -738,7 +743,7 @@ public:
configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
output directory is given. */
- std::string GetDirectory(const std::string& config,
+ std::string GetDirectory(std::string const& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
@@ -746,7 +751,7 @@ public:
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
compiler pdb output directory is given. */
- std::string GetCompilePDBDirectory(const std::string& config) const;
+ std::string GetCompilePDBDirectory(std::string const& config) const;
/** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* GetSourceDepends(
@@ -754,7 +759,7 @@ public:
/** Return whether this target uses the default value for its output
directory. */
- bool UsesDefaultOutputDir(const std::string& config,
+ bool UsesDefaultOutputDir(std::string const& config,
cmStateEnums::ArtifactType artifact) const;
// Cache target output paths for each configuration.
@@ -770,53 +775,53 @@ public:
}
};
- OutputInfo const* GetOutputInfo(const std::string& config) const;
+ OutputInfo const* GetOutputInfo(std::string const& config) const;
// Get the target PDB base name.
- std::string GetPDBOutputName(const std::string& config) const;
+ std::string GetPDBOutputName(std::string const& config) const;
/** Get the name of the pdb file for the target. */
- std::string GetPDBName(const std::string& config) const;
+ std::string GetPDBName(std::string const& config) const;
/** Whether this library has soname enabled and platform supports it. */
- bool HasSOName(const std::string& config) const;
+ bool HasSOName(std::string const& config) const;
struct CompileInfo
{
std::string CompilePdbDir;
};
- CompileInfo const* GetCompileInfo(const std::string& config) const;
+ CompileInfo const* GetCompileInfo(std::string const& config) const;
using CompileInfoMapType = std::map<std::string, CompileInfo>;
mutable CompileInfoMapType CompileInfoMap;
- bool IsNullImpliedByLinkLibraries(const std::string& p) const;
+ bool IsNullImpliedByLinkLibraries(std::string const& p) const;
/** Get the name of the compiler pdb file for the target. */
- std::string GetCompilePDBName(const std::string& config) const;
+ std::string GetCompilePDBName(std::string const& config) const;
/** Get the path for the MSVC /Fd option for this target. */
- std::string GetCompilePDBPath(const std::string& config) const;
+ std::string GetCompilePDBPath(std::string const& config) const;
// Get the target base name.
- std::string GetOutputName(const std::string& config,
+ std::string GetOutputName(std::string const& config,
cmStateEnums::ArtifactType artifact) const;
/** Get target file prefix */
- std::string GetFilePrefix(const std::string& config,
+ std::string GetFilePrefix(std::string const& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
/** Get target file prefix */
- std::string GetFileSuffix(const std::string& config,
+ std::string GetFileSuffix(std::string const& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
/** Get target file postfix */
- std::string GetFilePostfix(const std::string& config) const;
+ std::string GetFilePostfix(std::string const& config) const;
/** Get framework multi-config-specific postfix */
- std::string GetFrameworkMultiConfigPostfix(const std::string& config) const;
+ std::string GetFrameworkMultiConfigPostfix(std::string const& config) const;
/** Clears cached meta data for local and external source files.
* The meta data will be recomputed on demand.
@@ -829,14 +834,14 @@ public:
*/
void ClearLinkInterfaceCache();
- void AddSource(const std::string& src, bool before = false);
+ void AddSource(std::string const& src, bool before = false);
void AddTracedSources(std::vector<std::string> const& srcs);
/**
* Adds an entry to the INCLUDE_DIRECTORIES list.
* If before is true the entry is pushed at the front.
*/
- void AddIncludeDirectory(const std::string& src, bool before = false);
+ void AddIncludeDirectory(std::string const& src, bool before = false);
/**
* Flags for a given source file as used in this target. Typically assigned
@@ -856,10 +861,10 @@ public:
struct SourceFileFlags
{
SourceFileType Type = SourceFileTypeNormal;
- const char* MacFolder = nullptr; // location inside Mac content folders
+ char const* MacFolder = nullptr; // location inside Mac content folders
};
void GetAutoUicOptions(std::vector<std::string>& result,
- const std::string& config) const;
+ std::string const& config) const;
struct Names
{
@@ -876,33 +881,33 @@ public:
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
- Names GetExecutableNames(const std::string& config) const;
+ Names GetExecutableNames(std::string const& config) const;
/** Get the names of the library needed to generate a build rule
that takes into account shared library version numbers. This
should be called only on a library target. */
- Names GetLibraryNames(const std::string& config) const;
+ Names GetLibraryNames(std::string const& config) const;
/**
* Compute whether this target must be relinked before installing.
*/
- bool NeedRelinkBeforeInstall(const std::string& config) const;
+ bool NeedRelinkBeforeInstall(std::string const& config) const;
/** Return true if builtin chrpath will work for this target */
- bool IsChrpathUsed(const std::string& config) const;
+ bool IsChrpathUsed(std::string const& config) const;
/** Get the directory in which this targets .pdb files will be placed.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
pdb output directory is given. */
- std::string GetPDBDirectory(const std::string& config) const;
+ std::string GetPDBDirectory(std::string const& config) const;
//! Return the preferred linker language for this target
- std::string GetLinkerLanguage(const std::string& config) const;
+ std::string GetLinkerLanguage(std::string const& config) const;
//! Return the preferred linker tool for this target
- std::string GetLinkerTool(const std::string& config) const;
- std::string GetLinkerTool(const std::string& lang,
- const std::string& config) const;
+ std::string GetLinkerTool(std::string const& config) const;
+ std::string GetLinkerTool(std::string const& lang,
+ std::string const& config) const;
/** Is the linker known to enforce '--no-allow-shlib-undefined'? */
bool LinkerEnforcesNoAllowShLibUndefined(std::string const& config) const;
@@ -913,7 +918,7 @@ public:
/** Convert the given GNU import library name (.dll.a) to a name with a new
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
bool GetImplibGNUtoMS(std::string const& config, std::string const& gnuName,
- std::string& out, const char* newExt = nullptr) const;
+ std::string& out, char const* newExt = nullptr) const;
/** Can only ever return true if GetSourceFilePaths() was called before.
Otherwise, this is indeterminate and false will be assumed/returned! */
@@ -943,7 +948,7 @@ public:
/** Return whether this target is an IMPORTED library target on Apple
with a .framework folder as its location. */
- bool IsImportedFrameworkFolderOnApple(const std::string& config) const;
+ bool IsImportedFrameworkFolderOnApple(std::string const& config) const;
/** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const;
@@ -968,14 +973,14 @@ public:
};
/** Return the type of assembly this target compiles to. */
- ManagedType GetManagedType(const std::string& config) const;
+ ManagedType GetManagedType(std::string const& config) const;
struct SourceFileFlags GetTargetSourceFileFlags(
- const cmSourceFile* sf) const;
+ cmSourceFile const* sf) const;
- void ReportPropertyOrigin(const std::string& p, const std::string& result,
- const std::string& report,
- const std::string& compatibilityType) const;
+ void ReportPropertyOrigin(std::string const& p, std::string const& result,
+ std::string const& report,
+ std::string const& compatibilityType) const;
class TargetPropertyEntry;
@@ -996,7 +1001,7 @@ public:
UseTo Usage;
};
- static const std::map<cm::string_view, TransitiveProperty>
+ static std::map<cm::string_view, TransitiveProperty> const
BuiltinTransitiveProperties;
cm::optional<TransitiveProperty> IsTransitiveProperty(
@@ -1004,13 +1009,13 @@ public:
std::string const& config,
cmGeneratorExpressionDAGChecker const* dagChecker) const;
- bool HaveInstallTreeRPATH(const std::string& config) const;
+ bool HaveInstallTreeRPATH(std::string const& config) const;
- bool GetBuildRPATH(const std::string& config, std::string& rpath) const;
- bool GetInstallRPATH(const std::string& config, std::string& rpath) const;
+ bool GetBuildRPATH(std::string const& config, std::string& rpath) const;
+ bool GetInstallRPATH(std::string const& config, std::string& rpath) const;
/** Whether this library has \@rpath and platform supports it. */
- bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
+ bool HasMacOSXRpathInstallNameDir(std::string const& config) const;
/** Whether this library defaults to \@rpath. */
bool MacOSXRpathInstallNameDirDefault() const;
@@ -1027,9 +1032,9 @@ public:
/** Test for special case of a third-party shared library that has
no soname at all. */
- bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
+ bool IsImportedSharedLibWithoutSOName(std::string const& config) const;
- std::string ImportedGetLocation(const std::string& config) const;
+ std::string ImportedGetLocation(std::string const& config) const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
@@ -1046,15 +1051,15 @@ public:
interpreted from the given property and if empty use the
fallback property. Version 0 is returned if the property is
not set or cannot be parsed. */
- void GetTargetVersionFallback(const std::string& property,
- const std::string& fallback_property,
+ void GetTargetVersionFallback(std::string const& property,
+ std::string const& fallback_property,
int& major, int& minor, int& patch) const;
std::string GetRuntimeLinkLibrary(std::string const& lang,
std::string const& config) const;
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
- bool IsFortranBuildingInstrinsicModules() const;
+ bool IsFortranBuildingIntrinsicModules() const;
bool IsLinkLookupScope(std::string const& n,
cmLocalGenerator const*& lg) const;
@@ -1075,10 +1080,10 @@ public:
std::string const& lang);
bool AddHeaderSetVerification();
std::string GenerateHeaderSetVerificationFile(
- cmSourceFile& source, const std::string& dir,
+ cmSourceFile& source, std::string const& dir,
cm::optional<std::set<std::string>>& languages) const;
- std::string GetImportedXcFrameworkPath(const std::string& config) const;
+ std::string GetImportedXcFrameworkPath(std::string const& config) const;
bool ApplyCXXStdTargets();
bool DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
@@ -1109,7 +1114,7 @@ public:
std::string const& config, PropertyFor propertyFor) const;
private:
- void AddSourceCommon(const std::string& src, bool before = false);
+ void AddSourceCommon(std::string const& src, bool before = false);
std::string CreateFortranModuleDirectory(
std::string const& working_dir) const;
@@ -1130,7 +1135,7 @@ private:
using TargetPtrToBoolMap = std::unordered_map<cmTarget*, bool>;
mutable std::unordered_map<std::string, TargetPtrToBoolMap>
MacOSXRpathInstallNameDirCache;
- bool DetermineHasMacOSXRpathInstallNameDir(const std::string& config) const;
+ bool DetermineHasMacOSXRpathInstallNameDir(std::string const& config) const;
// "config/language" is the key
mutable std::map<std::string, std::vector<std::string>> SystemIncludesCache;
@@ -1147,12 +1152,12 @@ private:
cmValue GetFilePrefixInternal(std::string const& config,
cmStateEnums::ArtifactType artifact,
- const std::string& language = "") const;
+ std::string const& language = "") const;
cmValue GetFileSuffixInternal(std::string const& config,
cmStateEnums::ArtifactType artifact,
- const std::string& language = "") const;
+ std::string const& language = "") const;
- std::string GetFullNameInternal(const std::string& config,
+ std::string GetFullNameInternal(std::string const& config,
cmStateEnums::ArtifactType artifact) const;
using FullNameCache = std::map<std::string, NameComponents>;
@@ -1169,7 +1174,7 @@ private:
bool DeviceLink = false;
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
- const char* GetOutputTargetType(cmStateEnums::ArtifactType artifact) const;
+ char const* GetOutputTargetType(cmStateEnums::ArtifactType artifact) const;
std::string ComputeVersionedName(std::string const& prefix,
std::string const& base,
@@ -1203,10 +1208,10 @@ private:
mutable cmTargetLinkInformationMap LinkInformation;
void CheckPropertyCompatibility(cmComputeLinkInformation& info,
- const std::string& config) const;
+ std::string const& config) const;
- void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
- bool ComputeLinkClosure(const std::string& config, LinkClosure& lc,
+ void ComputeLinkClosure(std::string const& config, LinkClosure& lc) const;
+ bool ComputeLinkClosure(std::string const& config, LinkClosure& lc,
bool secondPass) const;
struct LinkImplClosure : public std::vector<cmGeneratorTarget const*>
@@ -1226,17 +1231,16 @@ private:
std::string const& config) const;
std::string GetLinkInterfaceDependentStringAsBoolProperty(
- const std::string& p, const std::string& config) const;
+ std::string const& p, std::string const& config) const;
friend class cmTargetCollectLinkLanguages;
- cmLinkInterface const* GetLinkInterface(const std::string& config,
- const cmGeneratorTarget* headTarget,
+ cmLinkInterface const* GetLinkInterface(std::string const& config,
+ cmGeneratorTarget const* headTarget,
bool secondPass) const;
- void ComputeLinkInterface(const std::string& config,
+ void ComputeLinkInterface(std::string const& config,
cmOptionalLinkInterface& iface,
- const cmGeneratorTarget* head,
bool secondPass) const;
- cmLinkImplementation const* GetLinkImplementation(const std::string& config,
+ cmLinkImplementation const* GetLinkImplementation(std::string const& config,
UseTo usage,
bool secondPass) const;
@@ -1270,14 +1274,14 @@ private:
mutable ImportInfoMapType ImportInfoMap;
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
- ImportInfo const* GetImportInfo(const std::string& config) const;
+ ImportInfo const* GetImportInfo(std::string const& config) const;
/** Strip off leading and trailing whitespace from an item named in
the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const;
- cmLinkInterface const* GetImportLinkInterface(const std::string& config,
- const cmGeneratorTarget* head,
+ cmLinkInterface const* GetImportLinkInterface(std::string const& config,
+ cmGeneratorTarget const* head,
UseTo usage,
bool secondPass = false) const;
@@ -1328,7 +1332,7 @@ private:
};
void ExpandLinkItems(std::string const& prop, cmBTStringRange entries,
std::string const& config,
- const cmGeneratorTarget* headTarget, UseTo usage,
+ cmGeneratorTarget const* headTarget, UseTo usage,
LinkInterfaceField field, cmLinkInterface& iface) const;
struct LookupLinkItemScope
@@ -1346,30 +1350,22 @@ private:
LookupLinkItemScope* scope,
LookupSelf lookupSelf) const;
+ std::vector<BT<std::string>>& ResolvePrefixWrapper(
+ std::vector<BT<std::string>>& result, cm::string_view prefix,
+ std::string const& language, bool joinItems) const;
+
std::vector<BT<std::string>> GetSourceFilePaths(
std::string const& config) const;
std::vector<BT<cmSourceFile*>> GetSourceFilesWithoutObjectLibraries(
std::string const& config) const;
void GetSourceFilesWithoutObjectLibraries(std::vector<cmSourceFile*>& files,
- const std::string& config) const;
+ std::string const& config) const;
- struct HeadToLinkImplementationMap
- : public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation>
- {
- };
- using LinkImplMapType = std::map<std::string, HeadToLinkImplementationMap>;
+ using LinkImplMapType = std::map<std::string, cmOptionalLinkImplementation>;
mutable LinkImplMapType LinkImplMap;
mutable LinkImplMapType LinkImplUsageRequirementsOnlyMap;
- HeadToLinkImplementationMap& GetHeadToLinkImplementationMap(
- std::string const& config) const;
- HeadToLinkImplementationMap& GetHeadToLinkImplementationUsageRequirementsMap(
- std::string const& config) const;
-
- cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
- const std::string& config, const cmGeneratorTarget* head,
- UseTo usage) const;
- bool ComputeOutputDir(const std::string& config,
+ bool ComputeOutputDir(std::string const& config,
cmStateEnums::ArtifactType artifact,
std::string& out) const;
@@ -1387,7 +1383,6 @@ private:
mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> UtilityItems;
cmPolicies::PolicyMap PolicyMap;
- mutable bool PolicyWarnedCMP0022 = false;
mutable bool PolicyReportedCMP0069 = false;
mutable bool DebugIncludesDone = false;
mutable bool DebugCompileOptionsDone = false;
@@ -1406,12 +1401,12 @@ private:
};
mutable Tribool SourcesAreContextDependent = Tribool::Indeterminate;
- bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
+ bool ComputePDBOutputDir(std::string const& kind, std::string const& config,
std::string& out) const;
ManagedType CheckManagedType(std::string const& propval) const;
- bool GetRPATH(const std::string& config, const std::string& prop,
+ bool GetRPATH(std::string const& config, std::string const& prop,
std::string& rpath) const;
std::map<std::string, BTs<std::string>> LanguageStandardMap;
@@ -1424,13 +1419,13 @@ private:
std::map<std::string, cmStandardLevel> ExplicitStandardLevel;
cmValue GetPropertyWithPairedLanguageSupport(std::string const& lang,
- const char* suffix) const;
+ char const* suffix) const;
void ComputeLinkImplementationRuntimeLibraries(
- const std::string& config, cmOptionalLinkImplementation& impl) const;
+ std::string const& config, cmOptionalLinkImplementation& impl) const;
void ComputeLinkInterfaceRuntimeLibraries(
- const std::string& config, cmOptionalLinkInterface& iface) const;
+ std::string const& config, cmOptionalLinkInterface& iface) const;
// If this method is made public, or call sites are added outside of
// methods computing cached members, add dedicated caching members.
@@ -1439,8 +1434,8 @@ private:
UseTo usage) const;
public:
- const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure(
- const std::string& config, UseTo usage) const;
+ std::vector<cmGeneratorTarget const*> const& GetLinkImplementationClosure(
+ std::string const& config, UseTo usage) const;
mutable std::map<std::string, std::string> MaxLanguageStandards;
std::map<std::string, std::string> const& GetMaxLanguageStandards() const
@@ -1536,10 +1531,10 @@ public:
static std::unique_ptr<TargetPropertyEntry> CreateFileSet(
std::vector<std::string> dirs, bool contextSensitiveDirs,
std::unique_ptr<cmCompiledGeneratorExpression> entryCge,
- const cmFileSet* fileSet, cmLinkImplItem const& item = NoLinkImplItem);
+ cmFileSet const* fileSet, cmLinkImplItem const& item = NoLinkImplItem);
- virtual const std::string& Evaluate(
- cmLocalGenerator* lg, const std::string& config,
+ virtual std::string const& Evaluate(
+ cmLocalGenerator* lg, std::string const& config,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
std::string const& language) const = 0;
diff --git a/Source/cmGeneratorTarget_CompatibleInterface.cxx b/Source/cmGeneratorTarget_CompatibleInterface.cxx
index d710aab..bf9970b 100644
--- a/Source/cmGeneratorTarget_CompatibleInterface.cxx
+++ b/Source/cmGeneratorTarget_CompatibleInterface.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -35,7 +35,7 @@ namespace {
using UseTo = cmGeneratorTarget::UseTo;
}
-const cmGeneratorTarget::CompatibleInterfacesBase&
+cmGeneratorTarget::CompatibleInterfacesBase const&
cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
{
cmGeneratorTarget::CompatibleInterfaces& compat =
@@ -63,7 +63,7 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
}
bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
- const std::string& p, const std::string& config) const
+ std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -73,7 +73,7 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
}
bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
- const std::string& p, const std::string& config) const
+ std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -83,7 +83,7 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
}
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
- const std::string& p, const std::string& config) const
+ std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -93,7 +93,7 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
}
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
- const std::string& p, const std::string& config) const
+ std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -112,14 +112,14 @@ enum CompatibleType
template <typename PropertyType>
PropertyType getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
- const std::string& prop,
- const std::string& config,
+ std::string const& prop,
+ std::string const& config,
CompatibleType, PropertyType*);
template <>
bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
- const std::string& prop,
- const std::string& config,
+ std::string const& prop,
+ std::string const& config,
CompatibleType /*unused*/,
bool* /*unused*/)
{
@@ -127,11 +127,11 @@ bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
}
template <>
-const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
- const std::string& prop,
- const std::string& config,
+char const* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
+ std::string const& prop,
+ std::string const& config,
CompatibleType t,
- const char** /*unused*/)
+ char const** /*unused*/)
{
switch (t) {
case BoolType:
@@ -152,9 +152,9 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
template <typename PropertyType>
void checkPropertyConsistency(cmGeneratorTarget const* depender,
cmGeneratorTarget const* dependee,
- const std::string& propName,
+ std::string const& propName,
std::set<std::string>& emitted,
- const std::string& config, CompatibleType t,
+ std::string const& config, CompatibleType t,
PropertyType* /*unused*/)
{
cmValue prop = dependee->GetProperty(propName);
@@ -192,8 +192,8 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
}
namespace {
-std::string intersect(const std::set<std::string>& s1,
- const std::set<std::string>& s2)
+std::string intersect(std::set<std::string> const& s1,
+ std::set<std::string> const& s2)
{
std::set<std::string> intersect;
std::set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(),
@@ -204,9 +204,9 @@ std::string intersect(const std::set<std::string>& s1,
return "";
}
-std::string intersect(const std::set<std::string>& s1,
- const std::set<std::string>& s2,
- const std::set<std::string>& s3)
+std::string intersect(std::set<std::string> const& s1,
+ std::set<std::string> const& s2,
+ std::set<std::string> const& s3)
{
std::string result;
result = intersect(s1, s2);
@@ -220,10 +220,10 @@ std::string intersect(const std::set<std::string>& s1,
return intersect(s2, s3);
}
-std::string intersect(const std::set<std::string>& s1,
- const std::set<std::string>& s2,
- const std::set<std::string>& s3,
- const std::set<std::string>& s4)
+std::string intersect(std::set<std::string> const& s1,
+ std::set<std::string> const& s2,
+ std::set<std::string> const& s3,
+ std::set<std::string> const& s4)
{
std::string result;
result = intersect(s1, s2);
@@ -243,18 +243,18 @@ std::string intersect(const std::set<std::string>& s1,
}
void cmGeneratorTarget::CheckPropertyCompatibility(
- cmComputeLinkInformation& info, const std::string& config) const
+ cmComputeLinkInformation& info, std::string const& config) const
{
- const cmComputeLinkInformation::ItemVector& deps = info.GetItems();
+ cmComputeLinkInformation::ItemVector const& deps = info.GetItems();
std::set<std::string> emittedBools;
- static const std::string strBool = "COMPATIBLE_INTERFACE_BOOL";
+ static std::string const strBool = "COMPATIBLE_INTERFACE_BOOL";
std::set<std::string> emittedStrings;
- static const std::string strString = "COMPATIBLE_INTERFACE_STRING";
+ static std::string const strString = "COMPATIBLE_INTERFACE_STRING";
std::set<std::string> emittedMinNumbers;
- static const std::string strNumMin = "COMPATIBLE_INTERFACE_NUMBER_MIN";
+ static std::string const strNumMin = "COMPATIBLE_INTERFACE_NUMBER_MIN";
std::set<std::string> emittedMaxNumbers;
- static const std::string strNumMax = "COMPATIBLE_INTERFACE_NUMBER_MAX";
+ static std::string const strNumMax = "COMPATIBLE_INTERFACE_NUMBER_MAX";
for (auto const& dep : deps) {
if (!dep.Target || dep.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
@@ -266,19 +266,19 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
if (cmSystemTools::GetErrorOccurredFlag()) {
return;
}
- checkPropertyConsistency<const char*>(this, dep.Target, strString,
+ checkPropertyConsistency<char const*>(this, dep.Target, strString,
emittedStrings, config, StringType,
nullptr);
if (cmSystemTools::GetErrorOccurredFlag()) {
return;
}
- checkPropertyConsistency<const char*>(this, dep.Target, strNumMin,
+ checkPropertyConsistency<char const*>(this, dep.Target, strNumMin,
emittedMinNumbers, config,
NumberMinType, nullptr);
if (cmSystemTools::GetErrorOccurredFlag()) {
return;
}
- checkPropertyConsistency<const char*>(this, dep.Target, strNumMax,
+ checkPropertyConsistency<char const*>(this, dep.Target, strNumMax,
emittedMaxNumbers, config,
NumberMaxType, nullptr);
if (cmSystemTools::GetErrorOccurredFlag()) {
@@ -333,7 +333,7 @@ std::string valueAsString<bool>(bool value)
return value ? "TRUE" : "FALSE";
}
template <>
-std::string valueAsString<const char*>(const char* value)
+std::string valueAsString<char const*>(char const* value)
{
return value ? value : "(unset)";
}
@@ -385,12 +385,12 @@ static std::string compatibilityAgree(CompatibleType t, bool dominant)
template <typename PropertyType>
PropertyType getTypedProperty(
- cmGeneratorTarget const* tgt, const std::string& prop,
+ cmGeneratorTarget const* tgt, std::string const& prop,
cmGeneratorExpressionInterpreter* genexInterpreter = nullptr);
template <>
bool getTypedProperty<bool>(cmGeneratorTarget const* tgt,
- const std::string& prop,
+ std::string const& prop,
cmGeneratorExpressionInterpreter* genexInterpreter)
{
if (!genexInterpreter) {
@@ -402,8 +402,8 @@ bool getTypedProperty<bool>(cmGeneratorTarget const* tgt,
}
template <>
-const char* getTypedProperty<const char*>(
- cmGeneratorTarget const* tgt, const std::string& prop,
+char const* getTypedProperty<char const*>(
+ cmGeneratorTarget const* tgt, std::string const& prop,
cmGeneratorExpressionInterpreter* genexInterpreter)
{
cmValue value = tgt->GetProperty(prop);
@@ -417,7 +417,7 @@ const char* getTypedProperty<const char*>(
template <>
std::string getTypedProperty<std::string>(
- cmGeneratorTarget const* tgt, const std::string& prop,
+ cmGeneratorTarget const* tgt, std::string const& prop,
cmGeneratorExpressionInterpreter* genexInterpreter)
{
cmValue value = tgt->GetProperty(prop);
@@ -437,7 +437,7 @@ bool impliedValue<bool>(bool /*unused*/)
return false;
}
template <>
-const char* impliedValue<const char*>(const char* /*unused*/)
+char const* impliedValue<char const*>(char const* /*unused*/)
{
return "";
}
@@ -459,22 +459,22 @@ std::pair<bool, bool> consistentProperty(bool lhs, bool rhs,
return { lhs == rhs, lhs };
}
-static std::pair<bool, const char*> consistentStringProperty(const char* lhs,
- const char* rhs)
+static std::pair<bool, char const*> consistentStringProperty(char const* lhs,
+ char const* rhs)
{
- const bool b = strcmp(lhs, rhs) == 0;
+ bool const b = strcmp(lhs, rhs) == 0;
return { b, b ? lhs : nullptr };
}
static std::pair<bool, std::string> consistentStringProperty(
- const std::string& lhs, const std::string& rhs)
+ std::string const& lhs, std::string const& rhs)
{
- const bool b = lhs == rhs;
+ bool const b = lhs == rhs;
return { b, b ? lhs : valueAsString(nullptr) };
}
-static std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
- const char* rhs,
+static std::pair<bool, char const*> consistentNumberProperty(char const* lhs,
+ char const* rhs,
CompatibleType t)
{
char* pEnd;
@@ -497,8 +497,8 @@ static std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
}
template <>
-std::pair<bool, const char*> consistentProperty(const char* lhs,
- const char* rhs,
+std::pair<bool, char const*> consistentProperty(char const* lhs,
+ char const* rhs,
CompatibleType t)
{
if (!lhs && !rhs) {
@@ -526,11 +526,11 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
return { false, nullptr };
}
-static std::pair<bool, std::string> consistentProperty(const std::string& lhs,
- const std::string& rhs,
+static std::pair<bool, std::string> consistentProperty(std::string const& lhs,
+ std::string const& rhs,
CompatibleType t)
{
- const std::string null_ptr = valueAsString(nullptr);
+ std::string const null_ptr = valueAsString(nullptr);
if (lhs == null_ptr && rhs == null_ptr) {
return { true, lhs };
@@ -562,18 +562,18 @@ static std::pair<bool, std::string> consistentProperty(const std::string& lhs,
template <typename PropertyType>
PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
- const std::string& p,
- const std::string& config,
- const char* defaultValue,
+ std::string const& p,
+ std::string const& config,
+ char const* defaultValue,
CompatibleType t,
PropertyType* /*unused*/)
{
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
std::vector<std::string> headPropKeys = tgt->GetPropertyKeys();
- const bool explicitlySet = cm::contains(headPropKeys, p);
+ bool const explicitlySet = cm::contains(headPropKeys, p);
- const bool impliedByUse = tgt->IsNullImpliedByLinkLibraries(p);
+ bool const impliedByUse = tgt->IsNullImpliedByLinkLibraries(p);
assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet));
std::vector<cmGeneratorTarget const*> const& deps =
@@ -612,7 +612,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
std::vector<std::string> propKeys = theTarget->GetPropertyKeys();
- const bool ifaceIsSet = cm::contains(propKeys, interfaceProperty);
+ bool const ifaceIsSet = cm::contains(propKeys, interfaceProperty);
PropertyType ifacePropContent = getTypedProperty<PropertyType>(
theTarget, interfaceProperty, genexInterpreter.get());
@@ -706,36 +706,36 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
}
bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
- const std::string& p, const std::string& config) const
+ std::string const& p, std::string const& config) const
{
return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
BoolType, nullptr);
}
std::string cmGeneratorTarget::GetLinkInterfaceDependentStringAsBoolProperty(
- const std::string& p, const std::string& config) const
+ std::string const& p, std::string const& config) const
{
return checkInterfacePropertyCompatibility<std::string>(
this, p, config, "FALSE", BoolType, nullptr);
}
-const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
- const std::string& p, const std::string& config) const
+char const* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
+ std::string const& p, std::string const& config) const
{
- return checkInterfacePropertyCompatibility<const char*>(
+ return checkInterfacePropertyCompatibility<char const*>(
this, p, config, "empty", StringType, nullptr);
}
-const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
- const std::string& p, const std::string& config) const
+char const* cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
+ std::string const& p, std::string const& config) const
{
- return checkInterfacePropertyCompatibility<const char*>(
+ return checkInterfacePropertyCompatibility<char const*>(
this, p, config, "empty", NumberMinType, nullptr);
}
-const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
- const std::string& p, const std::string& config) const
+char const* cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
+ std::string const& p, std::string const& config) const
{
- return checkInterfacePropertyCompatibility<const char*>(
+ return checkInterfacePropertyCompatibility<char const*>(
this, p, config, "empty", NumberMaxType, nullptr);
}
diff --git a/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx
index d911f10..9f4c09a 100644
--- a/Source/cmGeneratorTarget_IncludeDirectories.cxx
+++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -25,7 +25,6 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -42,9 +41,9 @@ enum class IncludeDirectoryFallBack
};
std::string AddLangSpecificInterfaceIncludeDirectories(
- const cmGeneratorTarget* root, const cmGeneratorTarget* target,
- const std::string& lang, const std::string& config,
- const std::string& propertyName, IncludeDirectoryFallBack mode,
+ cmGeneratorTarget const* root, cmGeneratorTarget const* target,
+ std::string const& lang, std::string const& config,
+ std::string const& propertyName, IncludeDirectoryFallBack mode,
cmGeneratorExpressionDAGChecker* context)
{
cmGeneratorExpressionDAGChecker dagChecker{
@@ -71,10 +70,10 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
}
std::string directories;
- if (const auto* link_interface =
+ if (auto const* link_interface =
target->GetLinkInterfaceLibraries(config, root, UseTo::Compile)) {
- for (const cmLinkItem& library : link_interface->Libraries) {
- if (const cmGeneratorTarget* dependency = library.Target) {
+ for (cmLinkItem const& library : link_interface->Libraries) {
+ if (cmGeneratorTarget const* dependency = library.Target) {
if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) {
auto* lg = dependency->GetLocalGenerator();
std::string value = dependency->GetSafeProperty(propertyName);
@@ -99,11 +98,11 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
}
void AddLangSpecificImplicitIncludeDirectories(
- const cmGeneratorTarget* target, const std::string& lang,
- const std::string& config, const std::string& propertyName,
+ cmGeneratorTarget const* target, std::string const& lang,
+ std::string const& config, std::string const& propertyName,
IncludeDirectoryFallBack mode, EvaluatedTargetPropertyEntries& entries)
{
- if (const auto* libraries =
+ if (auto const* libraries =
target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
cmGeneratorExpressionDAGChecker dagChecker{
target,
@@ -115,8 +114,8 @@ void AddLangSpecificImplicitIncludeDirectories(
target->GetBacktrace(),
};
- for (const cmLinkImplItem& library : libraries->Libraries) {
- if (const cmGeneratorTarget* dependency = library.Target) {
+ for (cmLinkImplItem const& library : libraries->Libraries) {
+ if (cmGeneratorTarget const* dependency = library.Target) {
if (!dependency->IsInBuildSystem()) {
continue;
}
@@ -159,45 +158,27 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
bool const fromImported = item.Target && item.Target->IsImported();
- bool const checkCMP0027 = item.CheckCMP0027;
std::string usedIncludes;
for (std::string& entryInclude : entry.Values) {
if (fromImported && !cmSystemTools::FileExists(entryInclude)) {
- std::ostringstream e;
- MessageType messageType = MessageType::FATAL_ERROR;
- if (checkCMP0027) {
- switch (tgt->GetPolicyStatusCMP0027()) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- messageType = MessageType::AUTHOR_WARNING;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- break;
- }
- }
- /* clang-format off */
- e << "Imported target \"" << targetName << "\" includes "
- "non-existent path\n \"" << entryInclude << "\"\nin its "
- "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
- "* The path was deleted, renamed, or moved to another "
- "location.\n"
- "* An install or uninstall procedure did not complete "
- "successfully.\n"
- "* The installation package was faulty and references files it "
- "does not provide.\n";
- /* clang-format on */
- tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ tgt->GetLocalGenerator()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Imported target \"", targetName,
+ "\" includes non-existent path\n \"", entryInclude,
+ "\"\nin its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons "
+ "include:\n"
+ "* The path was deleted, renamed, or moved to another location.\n"
+ "* An install or uninstall procedure did not complete "
+ "successfully.\n"
+ "* The installation package was faulty and references files it "
+ "does not provide.\n"));
return;
}
if (!cmSystemTools::FileIsFullPath(entryInclude)) {
std::ostringstream e;
- bool noMessage = false;
MessageType messageType = MessageType::FATAL_ERROR;
if (!targetName.empty()) {
/* clang-format off */
@@ -206,29 +187,13 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
" \"" << entryInclude << "\"";
/* clang-format on */
} else {
- switch (tgt->GetPolicyStatusCMP0021()) {
- case cmPolicies::WARN: {
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n";
- messageType = MessageType::AUTHOR_WARNING;
- } break;
- case cmPolicies::OLD:
- noMessage = true;
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
e << "Found relative path while evaluating include directories of "
"\""
<< tgt->GetName() << "\":\n \"" << entryInclude << "\"\n";
}
- if (!noMessage) {
- tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return;
- }
+ tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ if (messageType == MessageType::FATAL_ERROR) {
+ return;
}
}
@@ -255,7 +220,7 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
}
std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
- const std::string& config, const std::string& lang) const
+ std::string const& config, std::string const& lang) const
{
ConfigAndLanguage cacheKey(config, lang);
{
@@ -277,9 +242,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
bool debugIncludes = !this->DebugIncludesDone &&
cm::contains(debugProperties, "INCLUDE_DIRECTORIES");
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugIncludesDone = true;
- }
+ this->DebugIncludesDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, lang, &dagChecker, this->IncludeDirectoriesEntries);
@@ -292,7 +255,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
if (this->CanCompileSources() && (lang != "Swift" && lang != "Fortran")) {
- const std::string propertyName = "ISPC_HEADER_DIRECTORY";
+ std::string const propertyName = "ISPC_HEADER_DIRECTORY";
// If this target has ISPC sources make sure to add the header
// directory to other compilation units
diff --git a/Source/cmGeneratorTarget_Link.cxx b/Source/cmGeneratorTarget_Link.cxx
index 74e77de..f0e527c 100644
--- a/Source/cmGeneratorTarget_Link.cxx
+++ b/Source/cmGeneratorTarget_Link.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -49,10 +49,10 @@
namespace {
using UseTo = cmGeneratorTarget::UseTo;
-const std::string kINTERFACE_LINK_LIBRARIES = "INTERFACE_LINK_LIBRARIES";
-const std::string kINTERFACE_LINK_LIBRARIES_DIRECT =
+std::string const kINTERFACE_LINK_LIBRARIES = "INTERFACE_LINK_LIBRARIES";
+std::string const kINTERFACE_LINK_LIBRARIES_DIRECT =
"INTERFACE_LINK_LIBRARIES_DIRECT";
-const std::string kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE =
+std::string const kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE =
"INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE";
unsigned int CheckLinkLibrariesSuppressionRAIICount;
@@ -126,7 +126,7 @@ private:
};
cmGeneratorTarget::LinkClosure const* cmGeneratorTarget::GetLinkClosure(
- const std::string& config) const
+ std::string const& config) const
{
// There is no link implementation for targets that cannot compile sources.
if (!this->CanCompileSources()) {
@@ -158,7 +158,7 @@ public:
{
this->GG = this->Target->GetLocalGenerator()->GetGlobalGenerator();
}
- void Consider(const std::string& lang)
+ void Consider(std::string const& lang)
{
int preference = this->GG->GetLinkerPreference(lang);
if (preference > this->Preference) {
@@ -191,7 +191,7 @@ public:
}
};
-bool cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
+bool cmGeneratorTarget::ComputeLinkClosure(std::string const& config,
LinkClosure& lc,
bool secondPass) const
{
@@ -203,11 +203,12 @@ bool cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
languages.insert(impl->Languages.cbegin(), impl->Languages.cend());
// Add interface languages from linked targets.
- // cmTargetCollectLinkLanguages cll(this, config, languages, this,
+ // cmTargetCollectLinkLanguages linkLangs(this, config, languages, this,
// secondPass);
- cmTargetCollectLinkLanguages cll(this, config, languages, this, secondPass);
+ cmTargetCollectLinkLanguages linkLangs(this, config, languages, this,
+ secondPass);
for (cmLinkImplItem const& lib : impl->Libraries) {
- cll.Visit(lib);
+ linkLangs.Visit(lib);
}
// Store the transitive closure of languages.
@@ -236,10 +237,10 @@ bool cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
return impl->HadLinkLanguageSensitiveCondition ||
- cll.GetHadLinkLanguageSensitiveCondition();
+ linkLangs.GetHadLinkLanguageSensitiveCondition();
}
-void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
+void cmGeneratorTarget::ComputeLinkClosure(std::string const& config,
LinkClosure& lc) const
{
bool secondPass = false;
@@ -278,7 +279,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
}
-static void processILibs(const std::string& config,
+static void processILibs(std::string const& config,
cmGeneratorTarget const* headTarget,
cmLinkItem const& item, cmGlobalGenerator* gg,
std::vector<cmGeneratorTarget const*>& tgts,
@@ -313,13 +314,13 @@ cmGeneratorTarget::GetLinkInterfaceClosure(std::string const& config,
return tgts;
}
-const std::vector<const cmGeneratorTarget*>&
-cmGeneratorTarget::GetLinkImplementationClosure(const std::string& config,
+std::vector<cmGeneratorTarget const*> const&
+cmGeneratorTarget::GetLinkImplementationClosure(std::string const& config,
UseTo usage) const
{
// There is no link implementation for targets that cannot compile sources.
if (!this->CanCompileSources()) {
- static std::vector<const cmGeneratorTarget*> const empty;
+ static std::vector<cmGeneratorTarget const*> const empty;
return empty;
}
@@ -344,7 +345,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(const std::string& config,
}
cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
- const std::string& config) const
+ std::string const& config) const
{
// Lookup any existing information for this configuration.
std::string key(cmSystemTools::UpperCase(config));
@@ -381,16 +382,8 @@ void cmGeneratorTarget::CheckLinkLibraries() const
}
// Check link the implementation for each generated configuration.
- for (auto const& hmp : this->LinkImplMap) {
- HeadToLinkImplementationMap const& hm = hmp.second;
- // There could be several entries used when computing the pre-CMP0022
- // default link interface. Check only the entry for our own link impl.
- auto const hmi = hm.find(this);
- if (hmi == hm.end() || !hmi->second.LibrariesDone ||
- !hmi->second.CheckLinkLibraries) {
- continue;
- }
- for (cmLinkImplItem const& item : hmi->second.Libraries) {
+ for (auto const& impl : this->LinkImplMap) {
+ for (cmLinkImplItem const& item : impl.second.Libraries) {
if (!this->VerifyLinkItemColons(LinkItemRole::Implementation, item)) {
return;
}
@@ -450,22 +443,7 @@ bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
item.AsStr().find("::") == std::string::npos) {
return true;
}
- MessageType messageType = MessageType::FATAL_ERROR;
std::string e;
- switch (this->GetLocalGenerator()->GetPolicyStatus(cmPolicies::CMP0028)) {
- case cmPolicies::WARN: {
- e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0028), "\n");
- messageType = MessageType::AUTHOR_WARNING;
- } break;
- case cmPolicies::OLD:
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
-
if (role == LinkItemRole::Implementation) {
e = cmStrCat(e, "Target \"", this->GetName(), "\" links to");
} else {
@@ -479,8 +457,8 @@ bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
if (backtrace.Empty()) {
backtrace = this->GetBacktrace();
}
- this->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(messageType, e,
- backtrace);
+ this->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR, e, backtrace);
return false;
}
@@ -643,13 +621,13 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
}
cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
- const std::string& config, cmGeneratorTarget const* head) const
+ std::string const& config, cmGeneratorTarget const* head) const
{
return this->GetLinkInterface(config, head, false);
}
cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
- const std::string& config, cmGeneratorTarget const* head,
+ std::string const& config, cmGeneratorTarget const* head,
bool secondPass) const
{
// Imported targets have their own link interface.
@@ -685,7 +663,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
if (!iface.AllDone) {
iface.AllDone = true;
if (iface.Exists) {
- this->ComputeLinkInterface(config, iface, head, secondPass);
+ this->ComputeLinkInterface(config, iface, secondPass);
this->ComputeLinkInterfaceRuntimeLibraries(config, iface);
}
}
@@ -693,55 +671,38 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
return iface.Exists ? &iface : nullptr;
}
-void cmGeneratorTarget::ComputeLinkInterface(
- const std::string& config, cmOptionalLinkInterface& iface,
- cmGeneratorTarget const* headTarget) const
+void cmGeneratorTarget::ComputeLinkInterface(std::string const& config,
+ cmOptionalLinkInterface& iface,
+ bool secondPass) const
{
- this->ComputeLinkInterface(config, iface, headTarget, false);
-}
-
-void cmGeneratorTarget::ComputeLinkInterface(
- const std::string& config, cmOptionalLinkInterface& iface,
- cmGeneratorTarget const* headTarget, bool secondPass) const
-{
- if (iface.Explicit) {
- if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
- this->GetType() == cmStateEnums::STATIC_LIBRARY ||
- this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
- // Shared libraries may have runtime implementation dependencies
- // on other shared libraries that are not in the interface.
- std::set<cmLinkItem> emitted;
- for (cmLinkItem const& lib : iface.Libraries) {
- emitted.insert(lib);
- }
- if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
- cmLinkImplementation const* impl =
- this->GetLinkImplementation(config, UseTo::Link, secondPass);
- for (cmLinkImplItem const& lib : impl->Libraries) {
- if (emitted.insert(lib).second) {
- if (lib.Target) {
- // This is a runtime dependency on another shared library.
- if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
- iface.SharedDeps.push_back(lib);
- }
- } else {
- // TODO: Recognize shared library file names. Perhaps this
- // should be moved to cmComputeLinkInformation, but that
- // creates a chicken-and-egg problem since this list is needed
- // for its construction.
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ // Shared libraries may have runtime implementation dependencies
+ // on other shared libraries that are not in the interface.
+ std::set<cmLinkItem> emitted;
+ for (cmLinkItem const& lib : iface.Libraries) {
+ emitted.insert(lib);
+ }
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ cmLinkImplementation const* impl =
+ this->GetLinkImplementation(config, UseTo::Link, secondPass);
+ for (cmLinkImplItem const& lib : impl->Libraries) {
+ if (emitted.insert(lib).second) {
+ if (lib.Target) {
+ // This is a runtime dependency on another shared library.
+ if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
+ iface.SharedDeps.push_back(lib);
}
+ } else {
+ // TODO: Recognize shared library file names. Perhaps this
+ // should be moved to cmComputeLinkInformation, but that
+ // creates a chicken-and-egg problem since this list is needed
+ // for its construction.
}
}
}
}
- } else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN ||
- this->GetPolicyStatusCMP0022() == cmPolicies::OLD) {
- // The link implementation is the default link interface.
- cmLinkImplementationLibraries const* impl =
- this->GetLinkImplementationLibrariesInternal(config, headTarget,
- UseTo::Link);
- iface.ImplementationIsInterface = true;
- iface.WrongConfigLibraries = impl->WrongConfigLibraries;
}
if (this->LinkLanguagePropagatesToDependents()) {
@@ -773,8 +734,8 @@ void cmGeneratorTarget::ComputeLinkInterface(
}
}
-const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
- const std::string& config, cmGeneratorTarget const* head, UseTo usage) const
+cmLinkInterfaceLibraries const* cmGeneratorTarget::GetLinkInterfaceLibraries(
+ std::string const& config, cmGeneratorTarget const* head, UseTo usage) const
{
// Imported targets have their own link interface.
if (this->IsImported()) {
@@ -811,7 +772,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
}
void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
- const std::string& config, cmOptionalLinkInterface& iface,
+ std::string const& config, cmOptionalLinkInterface& iface,
cmGeneratorTarget const* headTarget, UseTo usage) const
{
// Construct the property name suffix for this configuration.
@@ -824,62 +785,10 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
- bool haveExplicitLibraries = false;
- cmValue explicitLibrariesCMP0022OLD;
- std::string linkIfacePropCMP0022OLD;
- bool const cmp0022NEW = (this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
- this->GetPolicyStatusCMP0022() != cmPolicies::WARN);
- if (cmp0022NEW) {
- // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
- haveExplicitLibraries = !this->Target->GetLinkInterfaceEntries().empty() ||
- !this->Target->GetLinkInterfaceDirectEntries().empty() ||
- !this->Target->GetLinkInterfaceDirectExcludeEntries().empty();
- } else {
- // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
- // shared lib or executable.
- if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
- this->IsExecutableWithExports()) {
- // Lookup the per-configuration property.
- linkIfacePropCMP0022OLD = cmStrCat("LINK_INTERFACE_LIBRARIES", suffix);
- explicitLibrariesCMP0022OLD = this->GetProperty(linkIfacePropCMP0022OLD);
-
- // If not set, try the generic property.
- if (!explicitLibrariesCMP0022OLD) {
- linkIfacePropCMP0022OLD = "LINK_INTERFACE_LIBRARIES";
- explicitLibrariesCMP0022OLD =
- this->GetProperty(linkIfacePropCMP0022OLD);
- }
- }
-
- if (explicitLibrariesCMP0022OLD &&
- this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
- !this->PolicyWarnedCMP0022) {
- // Compare the explicitly set old link interface properties to the
- // preferred new link interface property one and warn if different.
- cmValue newExplicitLibraries =
- this->GetProperty("INTERFACE_LINK_LIBRARIES");
- if (newExplicitLibraries &&
- (*newExplicitLibraries != *explicitLibrariesCMP0022OLD)) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
- "Target \"" << this->GetName() << "\" has an "
- "INTERFACE_LINK_LIBRARIES property which differs from its " <<
- linkIfacePropCMP0022OLD << " properties."
- "\n"
- "INTERFACE_LINK_LIBRARIES:\n"
- " " << *newExplicitLibraries << "\n" <<
- linkIfacePropCMP0022OLD << ":\n"
- " " << *explicitLibrariesCMP0022OLD << "\n";
- /* clang-format on */
- this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING,
- w.str());
- this->PolicyWarnedCMP0022 = true;
- }
- }
-
- haveExplicitLibraries = static_cast<bool>(explicitLibrariesCMP0022OLD);
- }
+ bool const haveExplicitLibraries =
+ !this->Target->GetLinkInterfaceEntries().empty() ||
+ !this->Target->GetLinkInterfaceDirectEntries().empty() ||
+ !this->Target->GetLinkInterfaceDirectExcludeEntries().empty();
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
@@ -890,84 +799,19 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
}
iface.Exists = true;
- // If CMP0022 is NEW then the plain tll signature sets the
- // INTERFACE_LINK_LIBRARIES property. Even if the project
- // clears it, the link interface is still explicit.
- iface.Explicit = cmp0022NEW || explicitLibrariesCMP0022OLD;
-
- if (cmp0022NEW) {
- // The interface libraries are specified by INTERFACE_LINK_LIBRARIES.
- // Use its special representation directly to get backtraces.
- this->ExpandLinkItems(
- kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(),
- config, headTarget, usage, LinkInterfaceField::Libraries, iface);
- this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT,
- this->Target->GetLinkInterfaceDirectEntries(),
- config, headTarget, usage,
- LinkInterfaceField::HeadInclude, iface);
- this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
- this->Target->GetLinkInterfaceDirectExcludeEntries(),
- config, headTarget, usage,
- LinkInterfaceField::HeadExclude, iface);
- } else if (explicitLibrariesCMP0022OLD) {
- // The interface libraries have been explicitly set in pre-CMP0022 style.
- std::vector<BT<std::string>> entries;
- entries.emplace_back(*explicitLibrariesCMP0022OLD);
- this->ExpandLinkItems(linkIfacePropCMP0022OLD, cmMakeRange(entries),
- config, headTarget, usage,
- LinkInterfaceField::Libraries, iface);
- }
-
- // If the link interface is explicit, do not fall back to the link impl.
- if (iface.Explicit) {
- return;
- }
-
- // The link implementation is the default link interface.
- if (cmLinkImplementationLibraries const* impl =
- this->GetLinkImplementationLibrariesInternal(config, headTarget,
- usage)) {
- iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(),
- impl->Libraries.end());
- if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
- !this->PolicyWarnedCMP0022 && usage == UseTo::Link) {
- // Compare the link implementation fallback link interface to the
- // preferred new link interface property and warn if different.
- cmLinkInterface ifaceNew;
- this->ExpandLinkItems(
- kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(),
- config, headTarget, usage, LinkInterfaceField::Libraries, ifaceNew);
- if (ifaceNew.Libraries != iface.Libraries) {
- std::string oldLibraries = cmJoin(impl->Libraries, ";");
- std::string newLibraries = cmJoin(ifaceNew.Libraries, ";");
- if (oldLibraries.empty()) {
- oldLibraries = "(empty)";
- }
- if (newLibraries.empty()) {
- newLibraries = "(empty)";
- }
-
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
- "Target \"" << this->GetName() << "\" has an "
- "INTERFACE_LINK_LIBRARIES property. "
- "This should be preferred as the source of the link interface "
- "for this library but because CMP0022 is not set CMake is "
- "ignoring the property and using the link implementation "
- "as the link interface instead."
- "\n"
- "INTERFACE_LINK_LIBRARIES:\n"
- " " << newLibraries << "\n"
- "Link implementation:\n"
- " " << oldLibraries << "\n";
- /* clang-format on */
- this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING,
- w.str());
- this->PolicyWarnedCMP0022 = true;
- }
- }
- }
+ // The interface libraries are specified by INTERFACE_LINK_LIBRARIES.
+ // Use its special representation directly to get backtraces.
+ this->ExpandLinkItems(
+ kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(), config,
+ headTarget, usage, LinkInterfaceField::Libraries, iface);
+ this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT,
+ this->Target->GetLinkInterfaceDirectEntries(), config,
+ headTarget, usage, LinkInterfaceField::HeadInclude,
+ iface);
+ this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
+ this->Target->GetLinkInterfaceDirectExcludeEntries(),
+ config, headTarget, usage,
+ LinkInterfaceField::HeadExclude, iface);
}
namespace {
@@ -980,7 +824,7 @@ template <>
inline cmLinkImplItem constructItem(cmGeneratorTarget* target,
cmListFileBacktrace const& bt)
{
- return cmLinkImplItem(cmLinkItem(target, false, bt), false);
+ return cmLinkImplItem(cmLinkItem(target, false, bt));
}
template <>
@@ -1020,7 +864,7 @@ std::vector<ValueType> computeImplicitLanguageTargets(
}
void cmGeneratorTarget::ComputeLinkInterfaceRuntimeLibraries(
- const std::string& config, cmOptionalLinkInterface& iface) const
+ std::string const& config, cmOptionalLinkInterface& iface) const
{
for (std::string const& lang : iface.Languages) {
if ((lang == "CUDA" || lang == "HIP") &&
@@ -1034,7 +878,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceRuntimeLibraries(
}
void cmGeneratorTarget::ComputeLinkImplementationRuntimeLibraries(
- const std::string& config, cmOptionalLinkImplementation& impl) const
+ std::string const& config, cmOptionalLinkImplementation& impl) const
{
for (std::string const& lang : impl.Languages) {
if ((lang == "CUDA" || lang == "HIP") &&
@@ -1047,8 +891,8 @@ void cmGeneratorTarget::ComputeLinkImplementationRuntimeLibraries(
}
}
-const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
- const std::string& config, cmGeneratorTarget const* headTarget, UseTo usage,
+cmLinkInterface const* cmGeneratorTarget::GetImportLinkInterface(
+ std::string const& config, cmGeneratorTarget const* headTarget, UseTo usage,
bool secondPass) const
{
cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config);
@@ -1109,45 +953,45 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
}
cmHeadToLinkInterfaceMap& cmGeneratorTarget::GetHeadToLinkInterfaceMap(
- const std::string& config) const
+ std::string const& config) const
{
return this->LinkInterfaceMap[cmSystemTools::UpperCase(config)];
}
cmHeadToLinkInterfaceMap&
cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap(
- const std::string& config) const
+ std::string const& config) const
{
return this
->LinkInterfaceUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)];
}
-const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
- const std::string& config, UseTo usage) const
+cmLinkImplementation const* cmGeneratorTarget::GetLinkImplementation(
+ std::string const& config, UseTo usage) const
{
return this->GetLinkImplementation(config, usage, false);
}
-const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
- const std::string& config, UseTo usage, bool secondPass) const
+cmLinkImplementation const* cmGeneratorTarget::GetLinkImplementation(
+ std::string const& config, UseTo usage, bool secondPass) const
{
// There is no link implementation for targets that cannot compile sources.
if (!this->CanCompileSources()) {
return nullptr;
}
- HeadToLinkImplementationMap& hm =
+ cmOptionalLinkImplementation& impl =
(usage == UseTo::Compile
- ? this->GetHeadToLinkImplementationUsageRequirementsMap(config)
- : this->GetHeadToLinkImplementationMap(config));
- cmOptionalLinkImplementation& impl = hm[this];
+ ? this
+ ->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]
+ : this->LinkImplMap[cmSystemTools::UpperCase(config)]);
if (secondPass) {
impl = cmOptionalLinkImplementation();
}
MaybeEnableCheckLinkLibraries(impl);
if (!impl.LibrariesDone) {
impl.LibrariesDone = true;
- this->ComputeLinkImplementationLibraries(config, impl, this, usage);
+ this->ComputeLinkImplementationLibraries(config, impl, usage);
}
if (!impl.LanguagesDone) {
impl.LanguagesDone = true;
@@ -1157,54 +1001,25 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
return &impl;
}
-cmGeneratorTarget::HeadToLinkImplementationMap&
-cmGeneratorTarget::GetHeadToLinkImplementationMap(
- std::string const& config) const
-{
- return this->LinkImplMap[cmSystemTools::UpperCase(config)];
-}
-
-cmGeneratorTarget::HeadToLinkImplementationMap&
-cmGeneratorTarget::GetHeadToLinkImplementationUsageRequirementsMap(
- std::string const& config) const
-{
- return this
- ->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)];
-}
-
cmLinkImplementationLibraries const*
-cmGeneratorTarget::GetLinkImplementationLibraries(const std::string& config,
+cmGeneratorTarget::GetLinkImplementationLibraries(std::string const& config,
UseTo usage) const
{
- return this->GetLinkImplementationLibrariesInternal(config, this, usage);
-}
-
-cmLinkImplementationLibraries const*
-cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
- const std::string& config, cmGeneratorTarget const* head, UseTo usage) const
-{
// There is no link implementation for targets that cannot compile sources.
if (!this->CanCompileSources()) {
return nullptr;
}
// Populate the link implementation libraries for this configuration.
- HeadToLinkImplementationMap& hm =
+ cmOptionalLinkImplementation& impl =
(usage == UseTo::Compile
- ? this->GetHeadToLinkImplementationUsageRequirementsMap(config)
- : this->GetHeadToLinkImplementationMap(config));
-
- // If the link implementation does not depend on the head target
- // then reuse the one from the head we computed first.
- if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) {
- head = hm.begin()->first;
- }
-
- cmOptionalLinkImplementation& impl = hm[head];
+ ? this
+ ->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]
+ : this->LinkImplMap[cmSystemTools::UpperCase(config)]);
MaybeEnableCheckLinkLibraries(impl);
if (!impl.LibrariesDone) {
impl.LibrariesDone = true;
- this->ComputeLinkImplementationLibraries(config, impl, head, usage);
+ this->ComputeLinkImplementationLibraries(config, impl, usage);
}
return &impl;
}
@@ -1238,9 +1053,7 @@ public:
void TransitiveLinkImpl::Follow(cmGeneratorTarget const* target)
{
- if (!target || !this->Followed.insert(target).second ||
- target->GetPolicyStatusCMP0022() == cmPolicies::OLD ||
- target->GetPolicyStatusCMP0022() == cmPolicies::WARN) {
+ if (!target || !this->Followed.insert(target).second) {
return;
}
@@ -1262,7 +1075,7 @@ void TransitiveLinkImpl::Follow(cmGeneratorTarget const* target)
// Add the item itself, but at most once.
if (this->Emitted.insert(item).second) {
- this->Impl.Libraries.emplace_back(item, /* checkCMP0027= */ false);
+ this->Impl.Libraries.emplace_back(item);
}
}
@@ -1318,8 +1131,8 @@ void ComputeLinkImplTransitive(cmGeneratorTarget const* self,
}
void cmGeneratorTarget::ComputeLinkImplementationLibraries(
- const std::string& config, cmOptionalLinkImplementation& impl,
- cmGeneratorTarget const* head, UseTo usage) const
+ std::string const& config, cmOptionalLinkImplementation& impl,
+ UseTo usage) const
{
cmLocalGenerator const* lg = this->LocalGenerator;
cmMakefile const* mf = lg->GetMakefile();
@@ -1346,8 +1159,6 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
case cmPolicies::WARN:
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
dagChecker.SetTransitivePropertiesOnlyCMP0131();
break;
@@ -1359,9 +1170,8 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
ge.Parse(entry.Value);
cge->SetEvaluateForBuildsystem(true);
std::string const& evaluated =
- cge->Evaluate(this->LocalGenerator, config, head, &dagChecker, nullptr,
+ cge->Evaluate(this->LocalGenerator, config, this, &dagChecker, nullptr,
this->LinkerLanguage);
- bool const checkCMP0027 = evaluated != entry.Value;
cmList llibs(evaluated);
if (cge->GetHadHeadSensitiveCondition()) {
impl.HadHeadSensitiveCondition = true;
@@ -1388,39 +1198,19 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
std::string name = this->CheckCMP0004(lib);
if (this->GetPolicyStatusCMP0108() == cmPolicies::NEW) {
// resolve alias name
- auto* target = this->Makefile->FindTargetToUse(name);
+ auto* target = this->Makefile->FindTargetToUse(
+ name, cmStateEnums::AllTargetDomains);
if (target) {
name = target->GetName();
}
}
if (name == this->GetName() || name.empty()) {
if (name == this->GetName()) {
- bool noMessage = false;
- MessageType messageType = MessageType::FATAL_ERROR;
- std::ostringstream e;
- switch (this->GetPolicyStatusCMP0038()) {
- case cmPolicies::WARN: {
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n";
- messageType = MessageType::AUTHOR_WARNING;
- } break;
- case cmPolicies::OLD:
- noMessage = true;
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
-
- if (!noMessage) {
- e << "Target \"" << this->GetName() << "\" links to itself.";
- this->LocalGenerator->GetCMakeInstance()->IssueMessage(
- messageType, e.str(), this->GetBacktrace());
- if (messageType == MessageType::FATAL_ERROR) {
- return;
- }
- }
+ this->LocalGenerator->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Target \"", this->GetName(), "\" links to itself."),
+ this->GetBacktrace());
+ return;
}
continue;
}
@@ -1433,7 +1223,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
if (depsForTarget != synthTargetsForConfig.end()) {
for (auto const* depForTarget : depsForTarget->second) {
cmLinkItem synthItem(depForTarget, item.Cross, item.Backtrace);
- impl.Libraries.emplace_back(std::move(synthItem), false);
+ impl.Libraries.emplace_back(std::move(synthItem));
}
}
} else {
@@ -1450,7 +1240,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
}
}
- impl.Libraries.emplace_back(std::move(item), checkCMP0027);
+ impl.Libraries.emplace_back(std::move(item));
}
std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();
@@ -1463,16 +1253,13 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
}
// Update the list of direct link dependencies from usage requirements.
- if (head == this) {
- ComputeLinkImplTransitive(this, config, usage, impl);
- }
+ ComputeLinkImplTransitive(this, config, usage, impl);
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
- cmTargetLinkLibraryType linkType =
- CMP0003_ComputeLinkType(config, debugConfigs);
+ cmTargetLinkLibraryType linkType = ComputeLinkType(config, debugConfigs);
cmTarget::LinkLibraryVectorType const& oldllibs =
this->Target->GetOriginalLinkLibraries();
@@ -1488,9 +1275,6 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
if (name == this->GetName() || name.empty()) {
continue;
}
- // Support OLD behavior for CMP0003.
- impl.WrongConfigLibraries.push_back(
- this->ResolveLinkItem(BT<std::string>(name), linkFeature));
}
}
}
diff --git a/Source/cmGeneratorTarget_LinkDirectories.cxx b/Source/cmGeneratorTarget_LinkDirectories.cxx
index 3acb2cb..4846d6f 100644
--- a/Source/cmGeneratorTarget_LinkDirectories.cxx
+++ b/Source/cmGeneratorTarget_LinkDirectories.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -15,7 +15,6 @@
#include "cmEvaluatedTargetProperty.h"
#include "cmGeneratorExpressionDAGChecker.h"
-#include "cmGlobalGenerator.h"
#include "cmLinkItem.h"
#include "cmList.h"
#include "cmListFileCache.h"
@@ -60,8 +59,6 @@ void processLinkDirectories(cmGeneratorTarget const* tgt,
case cmPolicies::OLD:
noMessage = true;
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// Issue the fatal message.
break;
@@ -100,8 +97,8 @@ void processLinkDirectories(cmGeneratorTarget const* tgt,
}
void cmGeneratorTarget::GetLinkDirectories(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const
+ std::string const& config,
+ std::string const& language) const
{
std::vector<BT<std::string>> tmp =
this->GetLinkDirectories(config, language);
@@ -134,9 +131,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
bool debugDirectories = !this->DebugLinkDirectoriesDone &&
cm::contains(debugProperties, "LINK_DIRECTORIES");
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugLinkDirectoriesDone = true;
- }
+ this->DebugLinkDirectoriesDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, language, &dagChecker, this->LinkDirectoriesEntries);
diff --git a/Source/cmGeneratorTarget_Options.cxx b/Source/cmGeneratorTarget_Options.cxx
index 5eb3760..63baa1d 100644
--- a/Source/cmGeneratorTarget_Options.cxx
+++ b/Source/cmGeneratorTarget_Options.cxx
@@ -1,11 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
-#include "cmConfigure.h"
-
#include <algorithm>
#include <iterator>
#include <map>
@@ -21,7 +19,6 @@
#include "cmEvaluatedTargetProperty.h"
#include "cmGeneratorExpressionDAGChecker.h"
-#include "cmGlobalGenerator.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -41,14 +38,14 @@ enum class OptionsParse
};
namespace {
-const auto DL_BEGIN = "<DEVICE_LINK>"_s;
-const auto DL_END = "</DEVICE_LINK>"_s;
+auto const DL_BEGIN = "<DEVICE_LINK>"_s;
+auto const DL_END = "</DEVICE_LINK>"_s;
void processOptions(cmGeneratorTarget const* tgt,
EvaluatedTargetPropertyEntries const& entries,
std::vector<BT<std::string>>& options,
std::unordered_set<std::string>& uniqueOptions,
- bool debugOptions, const char* logName, OptionsParse parse,
+ bool debugOptions, char const* logName, OptionsParse parse,
bool processDeviceOptions = false)
{
bool splitOption = !processDeviceOptions;
@@ -95,12 +92,12 @@ void processOptions(cmGeneratorTarget const* tgt,
enum class NestedLinkerFlags
{
PreserveAsSpelled,
- Normalize,
+ Normalize
};
std::vector<BT<std::string>> wrapOptions(
- std::vector<std::string>& options, const cmListFileBacktrace& bt,
- const std::vector<std::string>& wrapperFlag, const std::string& wrapperSep,
+ std::vector<std::string>& options, cmListFileBacktrace const& bt,
+ std::vector<std::string> const& wrapperFlag, std::string const& wrapperSep,
bool concatFlagAndArgs, NestedLinkerFlags nestedLinkerFlags)
{
std::vector<BT<std::string>> result;
@@ -210,8 +207,8 @@ std::vector<BT<std::string>> wrapOptions(
}
void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const
+ std::string const& config,
+ std::string const& language) const
{
std::vector<BT<std::string>> tmp = this->GetCompileOptions(config, language);
result.reserve(tmp.size());
@@ -242,9 +239,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
bool debugOptions = !this->DebugCompileOptionsDone &&
cm::contains(debugProperties, "COMPILE_OPTIONS");
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugCompileOptionsDone = true;
- }
+ this->DebugCompileOptionsDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, language, &dagChecker, this->CompileOptionsEntries);
@@ -260,7 +255,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
}
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
- const std::string& config) const
+ std::string const& config) const
{
std::vector<BT<std::string>> tmp = this->GetCompileFeatures(config);
result.reserve(tmp.size());
@@ -284,9 +279,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
bool debugFeatures = !this->DebugCompileFeaturesDone &&
cm::contains(debugProperties, "COMPILE_FEATURES");
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugCompileFeaturesDone = true;
- }
+ this->DebugCompileFeaturesDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, std::string(), &dagChecker, this->CompileFeaturesEntries);
@@ -302,8 +295,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
}
void cmGeneratorTarget::GetCompileDefinitions(
- std::vector<std::string>& result, const std::string& config,
- const std::string& language) const
+ std::vector<std::string>& result, std::string const& config,
+ std::string const& language) const
{
std::vector<BT<std::string>> tmp =
this->GetCompileDefinitions(config, language);
@@ -336,9 +329,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
bool debugDefines = !this->DebugCompileDefinitionsDone &&
cm::contains(debugProperties, "COMPILE_DEFINITIONS");
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugCompileDefinitionsDone = true;
- }
+ this->DebugCompileDefinitionsDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, language, &dagChecker, this->CompileDefinitionsEntries);
@@ -346,33 +337,6 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_DEFINITIONS", language,
&dagChecker, entries, IncludeRuntimeInterface::Yes);
- if (!config.empty()) {
- std::string configPropName =
- "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config);
- cmValue configProp = this->GetProperty(configPropName);
- if (configProp) {
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) {
- case cmPolicies::WARN: {
- this->LocalGenerator->IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0043));
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD: {
- std::unique_ptr<TargetPropertyEntry> entry =
- TargetPropertyEntry::Create(
- *this->LocalGenerator->GetCMakeInstance(), *configProp);
- entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
- this, config, language, &dagChecker, *entry));
- } break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- break;
- }
- }
- }
-
processOptions(this, entries, list, uniqueOptions, debugDefines,
"compile definitions", OptionsParse::None);
@@ -381,7 +345,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
}
std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
- const std::string& config, const std::string& language) const
+ std::string const& config, std::string const& language) const
{
ConfigAndLanguage cacheKey(config, language);
{
@@ -402,9 +366,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
std::find(debugProperties.begin(), debugProperties.end(),
"PRECOMPILE_HEADERS") != debugProperties.end();
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugPrecompileHeadersDone = true;
- }
+ this->DebugPrecompileHeadersDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, language, &dagChecker, this->PrecompileHeadersEntries);
@@ -421,8 +383,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
}
void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const
+ std::string const& config,
+ std::string const& language) const
{
if (this->IsDeviceLink() &&
this->GetPolicyStatusCMP0105() != cmPolicies::NEW) {
@@ -460,9 +422,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
bool debugOptions = !this->DebugLinkOptionsDone &&
cm::contains(debugProperties, "LINK_OPTIONS");
- if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- this->DebugLinkOptionsDone = true;
- }
+ this->DebugLinkOptionsDone = true;
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, language, &dagChecker, this->LinkOptionsEntries);
@@ -478,10 +438,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
if (this->IsDeviceLink()) {
// wrap host link options
- const std::string wrapper(this->Makefile->GetSafeDefinition(
+ std::string const wrapper(this->Makefile->GetSafeDefinition(
"CMAKE_" + language + "_DEVICE_COMPILER_WRAPPER_FLAG"));
cmList wrapperFlag{ wrapper };
- const std::string wrapperSep(this->Makefile->GetSafeDefinition(
+ std::string const wrapperSep(this->Makefile->GetSafeDefinition(
"CMAKE_" + language + "_DEVICE_COMPILER_WRAPPER_FLAG_SEP"));
bool concatFlagAndArgs = true;
if (!wrapperFlag.empty() && wrapperFlag.back() == " ") {
@@ -531,32 +491,31 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
return result;
}
-std::vector<BT<std::string>>& cmGeneratorTarget::ResolveLinkerWrapper(
- std::vector<BT<std::string>>& result, const std::string& language,
- bool joinItems) const
+std::vector<BT<std::string>>& cmGeneratorTarget::ResolvePrefixWrapper(
+ std::vector<BT<std::string>>& result, cm::string_view prefix,
+ std::string const& language, bool joinItems) const
{
- // replace "LINKER:" prefixed elements by actual linker wrapper
- const std::string wrapper(this->Makefile->GetSafeDefinition(
- "CMAKE_" + language +
- (this->IsDeviceLink() ? "_DEVICE_LINKER_WRAPPER_FLAG"
- : "_LINKER_WRAPPER_FLAG")));
+ // replace "LINKER:" or "ARCHIVER:" prefixed elements by actual linker or
+ // archiver wrapper
+ std::string const wrapper(this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", language, (this->IsDeviceLink() ? "_DEVICE_" : "_"),
+ prefix, "_WRAPPER_FLAG")));
cmList wrapperFlag{ wrapper };
- const std::string wrapperSep(this->Makefile->GetSafeDefinition(
- "CMAKE_" + language +
- (this->IsDeviceLink() ? "_DEVICE_LINKER_WRAPPER_FLAG_SEP"
- : "_LINKER_WRAPPER_FLAG_SEP")));
+ std::string const wrapperSep(this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", language, (this->IsDeviceLink() ? "_DEVICE_" : "_"),
+ prefix, "_WRAPPER_FLAG_SEP")));
bool concatFlagAndArgs = true;
if (!wrapperFlag.empty() && wrapperFlag.back() == " ") {
concatFlagAndArgs = false;
wrapperFlag.pop_back();
}
- const std::string LINKER{ "LINKER:" };
- const std::string SHELL{ "SHELL:" };
- const std::string LINKER_SHELL = LINKER + SHELL;
+ std::string const PREFIX{ cmStrCat(prefix, ':') };
+ std::string const SHELL{ "SHELL:" };
+ std::string const PREFIX_SHELL = cmStrCat(PREFIX, SHELL);
for (auto entry = result.begin(); entry != result.end();) {
- if (entry->Value.compare(0, LINKER.length(), LINKER) != 0) {
+ if (entry->Value.compare(0, PREFIX.length(), PREFIX) != 0) {
++entry;
continue;
}
@@ -565,52 +524,62 @@ std::vector<BT<std::string>>& cmGeneratorTarget::ResolveLinkerWrapper(
cmListFileBacktrace bt = std::move(entry->Backtrace);
entry = result.erase(entry);
- std::vector<std::string> linkerOptions;
- if (value.compare(0, LINKER_SHELL.length(), LINKER_SHELL) == 0) {
+ std::vector<std::string> options;
+ if (value.compare(0, PREFIX_SHELL.length(), PREFIX_SHELL) == 0) {
cmSystemTools::ParseUnixCommandLine(
- value.c_str() + LINKER_SHELL.length(), linkerOptions);
+ value.c_str() + PREFIX_SHELL.length(), options);
} else {
- linkerOptions = cmTokenize(value.substr(LINKER.length()), ",");
+ options =
+ cmTokenize(value.substr(PREFIX.length()), ',', cmTokenizerMode::New);
}
- if (linkerOptions.empty() ||
- (linkerOptions.size() == 1 && linkerOptions.front().empty())) {
+ if (options.empty()) {
continue;
}
// for now, raise an error if prefix SHELL: is part of arguments
- if (std::find_if(linkerOptions.begin(), linkerOptions.end(),
- [&SHELL](const std::string& item) -> bool {
+ if (std::find_if(options.begin(), options.end(),
+ [&SHELL](std::string const& item) -> bool {
return item.find(SHELL) != std::string::npos;
- }) != linkerOptions.end()) {
+ }) != options.end()) {
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
- "'SHELL:' prefix is not supported as part of 'LINKER:' arguments.",
+ cmStrCat("'SHELL:' prefix is not supported as part of '", prefix,
+ ":' arguments."),
this->GetBacktrace());
return result;
}
// Very old versions of the C++ standard library return void for insert, so
// can't use it to get the new iterator
- const auto index = entry - result.begin();
- std::vector<BT<std::string>> options =
- wrapOptions(linkerOptions, bt, wrapperFlag, wrapperSep,
- concatFlagAndArgs, NestedLinkerFlags::PreserveAsSpelled);
+ auto const index = entry - result.begin();
+ std::vector<BT<std::string>> processedOptions =
+ wrapOptions(options, bt, wrapperFlag, wrapperSep, concatFlagAndArgs,
+ NestedLinkerFlags::PreserveAsSpelled);
if (joinItems) {
result.insert(
- entry, cmJoin(cmMakeRange(options.begin(), options.end()), " "_s));
+ entry,
+ cmJoin(cmMakeRange(processedOptions.begin(), processedOptions.end()),
+ " "_s));
entry = std::next(result.begin(), index + 1);
} else {
- result.insert(entry, options.begin(), options.end());
- entry = std::next(result.begin(), index + options.size());
+ result.insert(entry, processedOptions.begin(), processedOptions.end());
+ entry = std::next(result.begin(), index + processedOptions.size());
}
}
return result;
}
+std::vector<BT<std::string>>& cmGeneratorTarget::ResolveLinkerWrapper(
+ std::vector<BT<std::string>>& result, std::string const& language,
+ bool joinItems) const
+{
+ return this->ResolvePrefixWrapper(result, "LINKER"_s, language, joinItems);
+}
+
void cmGeneratorTarget::GetStaticLibraryLinkOptions(
- std::vector<std::string>& result, const std::string& config,
- const std::string& language) const
+ std::vector<std::string>& result, std::string const& config,
+ std::string const& language) const
{
std::vector<BT<std::string>> tmp =
this->GetStaticLibraryLinkOptions(config, language);
@@ -641,12 +610,23 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
processOptions(this, entries, result, uniqueOptions, false,
"static library link options", OptionsParse::Shell);
+ // Last step: replace "ARCHIVER:" prefixed elements by
+ // actual archiver wrapper
+ this->ResolveArchiverWrapper(result, language);
+
return result;
}
+std::vector<BT<std::string>>& cmGeneratorTarget::ResolveArchiverWrapper(
+ std::vector<BT<std::string>>& result, std::string const& language,
+ bool joinItems) const
+{
+ return this->ResolvePrefixWrapper(result, "ARCHIVER"_s, language, joinItems);
+}
+
void cmGeneratorTarget::GetLinkDepends(std::vector<std::string>& result,
- const std::string& config,
- const std::string& language) const
+ std::string const& config,
+ std::string const& language) const
{
std::vector<BT<std::string>> tmp = this->GetLinkDepends(config, language);
result.reserve(tmp.size());
@@ -667,7 +647,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
EvaluatedTargetPropertyEntries entries;
if (cmValue linkDepends = this->GetProperty("LINK_DEPENDS")) {
cmList depends{ *linkDepends };
- for (const auto& depend : depends) {
+ for (auto const& depend : depends) {
std::unique_ptr<TargetPropertyEntry> entry = TargetPropertyEntry::Create(
*this->LocalGenerator->GetCMakeInstance(), depend);
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
diff --git a/Source/cmGeneratorTarget_Sources.cxx b/Source/cmGeneratorTarget_Sources.cxx
index 2540d81..fa27998 100644
--- a/Source/cmGeneratorTarget_Sources.cxx
+++ b/Source/cmGeneratorTarget_Sources.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -37,7 +37,6 @@
#include "cmSourceFileLocation.h"
#include "cmSourceGroup.h"
#include "cmStateTypes.h"
-#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmValue.h"
@@ -52,7 +51,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
EvaluatedTargetPropertyEntries& entries)
{
if (cmLinkImplementationLibraries const* impl =
- headTarget->GetLinkImplementationLibraries(config, UseTo::Compile)) {
+ headTarget->GetLinkImplementationLibraries(config, UseTo::Link)) {
entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target &&
@@ -234,35 +233,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
{
std::vector<BT<std::string>> files;
- if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
- // At configure-time, this method can be called as part of getting the
- // LOCATION property or to export() a file to be include()d. However
- // there is no cmGeneratorTarget at configure-time, so search the SOURCES
- // for TARGET_OBJECTS instead for backwards compatibility with OLD
- // behavior of CMP0024 and CMP0026 only.
-
- cmBTStringRange sourceEntries = this->Target->GetSourceEntries();
- for (auto const& entry : sourceEntries) {
- cmList items{ entry.Value };
- for (auto const& item : items) {
- if (cmHasLiteralPrefix(item, "$<TARGET_OBJECTS:") &&
- item.back() == '>') {
- continue;
- }
- files.emplace_back(item);
- }
- }
- return files;
- }
-
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
bool debugSources =
!this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES");
- if (this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
- this->DebugSourcesDone = true;
- }
+ this->DebugSourcesDone = true;
cmGeneratorExpressionDAGChecker dagChecker{
this, "SOURCES", nullptr, nullptr, this->LocalGenerator, config,
@@ -314,7 +290,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
}
void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files,
- const std::string& config) const
+ std::string const& config) const
{
std::vector<BT<cmSourceFile*>> tmp = this->GetSourceFiles(config);
files.reserve(tmp.size());
@@ -327,24 +303,6 @@ std::vector<BT<cmSourceFile*>> cmGeneratorTarget::GetSourceFiles(
std::string const& config) const
{
std::vector<BT<cmSourceFile*>> files;
- if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) {
- // Since we are still configuring not all sources may exist yet,
- // so we need to avoid full source classification because that
- // requires the absolute paths to all sources to be determined.
- // Since this is only for compatibility with old policies that
- // projects should not depend on anymore, just compute the files
- // without memoizing them.
- std::vector<BT<std::string>> srcs = this->GetSourceFilePaths(config);
- std::set<cmSourceFile*> emitted;
- for (BT<std::string> const& s : srcs) {
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value);
- if (emitted.insert(sf).second) {
- files.emplace_back(sf, s.Backtrace);
- }
- }
- return files;
- }
-
KindedSources const& kinded = this->GetKindedSources(config);
files.reserve(kinded.Sources.size());
for (SourceAndKind const& si : kinded.Sources) {
@@ -354,7 +312,7 @@ std::vector<BT<cmSourceFile*>> cmGeneratorTarget::GetSourceFiles(
}
void cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries(
- std::vector<cmSourceFile*>& files, const std::string& config) const
+ std::vector<cmSourceFile*>& files, std::string const& config) const
{
std::vector<BT<cmSourceFile*>> tmp =
this->GetSourceFilesWithoutObjectLibraries(config);
diff --git a/Source/cmGeneratorTarget_TargetPropertyEntry.cxx b/Source/cmGeneratorTarget_TargetPropertyEntry.cxx
index 9b70f63..90a3ca8 100644
--- a/Source/cmGeneratorTarget_TargetPropertyEntry.cxx
+++ b/Source/cmGeneratorTarget_TargetPropertyEntry.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -33,7 +33,7 @@ public:
{
}
- const std::string& Evaluate(cmLocalGenerator*, const std::string&,
+ std::string const& Evaluate(cmLocalGenerator*, std::string const&,
cmGeneratorTarget const*,
cmGeneratorExpressionDAGChecker*,
std::string const&) const override
@@ -64,7 +64,7 @@ public:
{
}
- const std::string& Evaluate(cmLocalGenerator* lg, const std::string& config,
+ std::string const& Evaluate(cmLocalGenerator* lg, std::string const& config,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
std::string const& language) const override
@@ -86,7 +86,7 @@ public:
}
private:
- const std::unique_ptr<cmCompiledGeneratorExpression> ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> const ge;
};
class TargetPropertyEntryFileSet
@@ -96,7 +96,7 @@ public:
TargetPropertyEntryFileSet(
std::vector<std::string> dirs, bool contextSensitiveDirs,
std::unique_ptr<cmCompiledGeneratorExpression> entryCge,
- const cmFileSet* fileSet, cmLinkImplItem const& item = NoLinkImplItem)
+ cmFileSet const* fileSet, cmLinkImplItem const& item = NoLinkImplItem)
: cmGeneratorTarget::TargetPropertyEntry(item)
, BaseDirs(std::move(dirs))
, ContextSensitiveDirs(contextSensitiveDirs)
@@ -105,7 +105,7 @@ public:
{
}
- const std::string& Evaluate(cmLocalGenerator* lg, const std::string& config,
+ std::string const& Evaluate(cmLocalGenerator* lg, std::string const& config,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
std::string const& /*lang*/) const override
@@ -142,10 +142,10 @@ public:
}
private:
- const std::vector<std::string> BaseDirs;
- const bool ContextSensitiveDirs;
- const std::unique_ptr<cmCompiledGeneratorExpression> EntryCge;
- const cmFileSet* FileSet;
+ std::vector<std::string> const BaseDirs;
+ bool const ContextSensitiveDirs;
+ std::unique_ptr<cmCompiledGeneratorExpression> const EntryCge;
+ cmFileSet const* FileSet;
};
std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>
@@ -170,7 +170,7 @@ std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>
cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
std::vector<std::string> dirs, bool contextSensitiveDirs,
std::unique_ptr<cmCompiledGeneratorExpression> entryCge,
- const cmFileSet* fileSet, cmLinkImplItem const& item)
+ cmFileSet const* fileSet, cmLinkImplItem const& item)
{
return cm::make_unique<TargetPropertyEntryFileSet>(
std::move(dirs), contextSensitiveDirs, std::move(entryCge), fileSet, item);
diff --git a/Source/cmGeneratorTarget_TransitiveProperty.cxx b/Source/cmGeneratorTarget_TransitiveProperty.cxx
index 7c197fc..3cc2fe4 100644
--- a/Source/cmGeneratorTarget_TransitiveProperty.cxx
+++ b/Source/cmGeneratorTarget_TransitiveProperty.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
/* clang-format off */
#include "cmGeneratorTarget.h"
/* clang-format on */
@@ -31,7 +31,7 @@ using UseTo = cmGeneratorTarget::UseTo;
using TransitiveProperty = cmGeneratorTarget::TransitiveProperty;
}
-const std::map<cm::string_view, TransitiveProperty>
+std::map<cm::string_view, TransitiveProperty> const
cmGeneratorTarget::BuiltinTransitiveProperties = {
{ "AUTOMOC_MACRO_NAMES"_s,
{ "INTERFACE_AUTOMOC_MACRO_NAMES"_s, UseTo::Compile } },
@@ -188,7 +188,7 @@ cmGeneratorTarget::IsTransitiveProperty(
cmGeneratorExpressionDAGChecker const* dagChecker) const
{
cm::optional<TransitiveProperty> result;
- static const cm::string_view kINTERFACE_ = "INTERFACE_"_s;
+ static cm::string_view const kINTERFACE_ = "INTERFACE_"_s;
PropertyFor const propertyFor = cmHasPrefix(prop, kINTERFACE_)
? PropertyFor::Interface
: PropertyFor::Build;
@@ -207,13 +207,6 @@ cmGeneratorTarget::IsTransitiveProperty(
result->Usage = cmGeneratorTarget::UseTo::Compile;
}
}
- } 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,
- UseTo::Compile };
- }
} else if (!dagChecker || !dagChecker->IsComputingLinkLibraries()) {
// Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES
// from the link closure when we are not evaluating the closure itself.
@@ -247,7 +240,7 @@ void cmGeneratorTarget::CustomTransitiveProperties::Add(cmValue props,
cmList propsList(*props);
for (std::string p : propsList) {
std::string ip;
- static const cm::string_view kINTERFACE_ = "INTERFACE_"_s;
+ static cm::string_view const kINTERFACE_ = "INTERFACE_"_s;
if (cmHasPrefix(p, kINTERFACE_)) {
ip = std::move(p);
p = ip.substr(kINTERFACE_.length());
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index d2c4fd6..7497afa 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetCMakePropertyCommand.h"
#include <set>
@@ -33,7 +33,7 @@ bool cmGetCMakePropertyCommand(std::vector<std::string> const& args,
output = *macrosProp;
}
} else if (args[1] == "COMPONENTS") {
- const std::set<std::string>* components =
+ std::set<std::string> const* components =
status.GetMakefile().GetGlobalGenerator()->GetInstallComponents();
output = cmList::to_string(*components);
} else {
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index 3a2e702..6832e92 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index d892cfa..0637149 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -1,19 +1,15 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetDirectoryPropertyCommand.h"
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmSystemTools.h"
#include "cmValue.h"
namespace {
void StoreResult(cmMakefile& makefile, std::string const& variable,
- const char* prop);
-void StoreResult(cmMakefile& makefile, std::string const& variable,
cmValue prop);
}
@@ -78,34 +74,12 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
return false;
}
- if (*i == "DEFINITIONS") {
- switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0059)) {
- case cmPolicies::WARN:
- status.GetMakefile().IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0059));
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- StoreResult(status.GetMakefile(), variable,
- status.GetMakefile().GetDefineFlagsCMP0059());
- return true;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- break;
- }
- }
StoreResult(status.GetMakefile(), variable, dir->GetProperty(*i));
return true;
}
namespace {
void StoreResult(cmMakefile& makefile, std::string const& variable,
- const char* prop)
-{
- makefile.AddDefinition(variable, prop ? prop : "");
-}
-void StoreResult(cmMakefile& makefile, std::string const& variable,
cmValue prop)
{
makefile.AddDefinition(variable, prop);
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 4b0883c..186cc82 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 1815c4d..dee5c3f 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetFilenameComponentCommand.h"
#include "cmExecutionStatus.h"
@@ -113,6 +113,7 @@ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
// Resolve symlinks if possible
result = cmSystemTools::GetRealPath(result);
}
+ result = cmSystemTools::GetActualCaseForPath(result);
} else {
std::string err = "unknown component " + args[2];
status.SetError(err);
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index 4e1addf..7c2bc25 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGetPipes.cxx b/Source/cmGetPipes.cxx
index a5b6469..66a0519 100644
--- a/Source/cmGetPipes.cxx
+++ b/Source/cmGetPipes.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetPipes.h"
#include <cm3p/uv.h>
diff --git a/Source/cmGetPipes.h b/Source/cmGetPipes.h
index 6b1b495..01961b0 100644
--- a/Source/cmGetPipes.h
+++ b/Source/cmGetPipes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
int cmGetPipes(int* fds);
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 8e21da0..c75e331 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetPropertyCommand.h"
#include <cstddef>
@@ -12,7 +12,6 @@
#include "cmGlobalGenerator.h"
#include "cmInstalledFile.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmPropertyDefinition.h"
@@ -37,33 +36,33 @@ enum OutType
};
// Implementation of each property type.
-bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName);
-bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName);
-bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName);
-bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName,
+bool HandleGlobalMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName);
+bool HandleDirectoryMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName);
+bool HandleTargetMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName);
+bool HandleSourceMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName,
cmMakefile& directory_makefile,
bool source_file_paths_should_be_absolute);
-bool HandleTestMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName,
+bool HandleTestMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName,
cmMakefile& directory_makefile);
-bool HandleVariableMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName);
-bool HandleCacheMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName);
-bool HandleInstallMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName);
+bool HandleVariableMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName);
+bool HandleCacheMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName);
+bool HandleInstallMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName);
}
bool cmGetPropertyCommand(std::vector<std::string> const& args,
@@ -273,8 +272,8 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
namespace GetPropertyCommand {
bool GetSourceFilePropertyGENERATED(
- const std::string& name, cmMakefile& mf,
- const std::function<bool(bool)>& storeResult)
+ std::string const& name, cmMakefile& mf,
+ std::function<bool(bool)> const& storeResult)
{
// Globally set as generated?
// Note: If the given "name" only contains a filename or a relative path
@@ -308,7 +307,7 @@ namespace {
// Implementation of result storage.
template <typename ValueType>
bool StoreResult(OutType infoType, cmMakefile& makefile,
- const std::string& variable, ValueType value)
+ std::string const& variable, ValueType value)
{
if (infoType == OutSet) {
makefile.AddDefinition(variable, value ? "1" : "0");
@@ -324,14 +323,14 @@ bool StoreResult(OutType infoType, cmMakefile& makefile,
}
template <>
bool StoreResult(OutType infoType, cmMakefile& makefile,
- const std::string& variable, std::nullptr_t value)
+ std::string const& variable, std::nullptr_t value)
{
return StoreResult(infoType, makefile, variable, cmValue(value));
}
-bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName)
+bool HandleGlobalMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName)
{
if (!name.empty()) {
status.SetError("given name for GLOBAL scope.");
@@ -344,9 +343,9 @@ bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
cm->GetState()->GetGlobalProperty(propertyName));
}
-bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName)
+bool HandleDirectoryMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName)
{
// Default to the current directory.
cmMakefile* mf = &status.GetMakefile();
@@ -370,30 +369,14 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
}
}
- if (propertyName == "DEFINITIONS") {
- switch (mf->GetPolicyStatus(cmPolicies::CMP0059)) {
- case cmPolicies::WARN:
- mf->IssueMessage(MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0059));
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- return StoreResult(infoType, status.GetMakefile(), variable,
- mf->GetDefineFlagsCMP0059());
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- break;
- }
- }
-
// Get the property.
return StoreResult(infoType, status.GetMakefile(), variable,
mf->GetProperty(propertyName));
}
-bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName)
+bool HandleTargetMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName)
{
if (name.empty()) {
status.SetError("not given name for TARGET scope.");
@@ -430,11 +413,11 @@ bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
return false;
}
-bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName,
+bool HandleSourceMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName,
cmMakefile& directory_makefile,
- const bool source_file_paths_should_be_absolute)
+ bool const source_file_paths_should_be_absolute)
{
if (name.empty()) {
status.SetError("not given name for SOURCE scope.");
@@ -460,7 +443,7 @@ bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
}
// Get the source file.
- const std::string source_file_absolute_path =
+ std::string const source_file_absolute_path =
SetPropertyCommand::MakeSourceFilePathAbsoluteIfNeeded(
status, name, source_file_paths_should_be_absolute);
if (cmSourceFile* sf =
@@ -476,9 +459,9 @@ bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
return false;
}
-bool HandleTestMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName, cmMakefile& test_makefile)
+bool HandleTestMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName, cmMakefile& test_makefile)
{
if (name.empty()) {
status.SetError("not given name for TEST scope.");
@@ -496,9 +479,9 @@ bool HandleTestMode(cmExecutionStatus& status, const std::string& name,
return false;
}
-bool HandleVariableMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName)
+bool HandleVariableMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName)
{
if (!name.empty()) {
status.SetError("given name for VARIABLE scope.");
@@ -509,9 +492,9 @@ bool HandleVariableMode(cmExecutionStatus& status, const std::string& name,
status.GetMakefile().GetDefinition(propertyName));
}
-bool HandleCacheMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName)
+bool HandleCacheMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName)
{
if (name.empty()) {
status.SetError("not given name for CACHE scope.");
@@ -527,9 +510,9 @@ bool HandleCacheMode(cmExecutionStatus& status, const std::string& name,
return true;
}
-bool HandleInstallMode(cmExecutionStatus& status, const std::string& name,
- OutType infoType, const std::string& variable,
- const std::string& propertyName)
+bool HandleInstallMode(cmExecutionStatus& status, std::string const& name,
+ OutType infoType, std::string const& variable,
+ std::string const& propertyName)
{
if (name.empty()) {
status.SetError("not given name for INSTALL scope.");
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index fac3202..093a231 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 209030a..fea0bb1 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetSourceFilePropertyCommand.h"
#include <functional>
@@ -16,8 +16,8 @@
namespace GetPropertyCommand {
bool GetSourceFilePropertyGENERATED(
- const std::string& name, cmMakefile& mf,
- const std::function<bool(bool)>& storeResult);
+ std::string const& name, cmMakefile& mf,
+ std::function<bool(bool)> const& storeResult);
}
bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 4f8eab2..2266e83 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index e1ae9b2..9b59bf3 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -1,14 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetTargetPropertyCommand.h"
-#include <sstream>
-
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmValue.h"
@@ -50,31 +48,11 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
}
}
} else {
- bool issueMessage = false;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (mf.GetPolicyStatus(cmPolicies::CMP0045)) {
- case cmPolicies::WARN:
- issueMessage = true;
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- issueMessage = true;
- messageType = MessageType::FATAL_ERROR;
- break;
- }
- if (issueMessage) {
- e << "get_target_property() called with non-existent target \""
- << targetName << "\".";
- mf.IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("get_target_property() called with non-existent target \"",
+ targetName, "\"."));
+ return false;
}
if (prop_exists) {
mf.AddDefinition(var, prop);
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 0fbd23d..76e8347 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index 103471b..1f987b9 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGetTestPropertyCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index f1d6010..0e0da27 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx
index da27971..60b5565 100644
--- a/Source/cmGhsMultiGpj.cxx
+++ b/Source/cmGhsMultiGpj.cxx
@@ -1,10 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGhsMultiGpj.h"
#include <ostream>
-static const char* GHS_TAG[] = { "[INTEGRITY Application]",
+static char const* GHS_TAG[] = { "[INTEGRITY Application]",
"[Library]",
"[Project]",
"[Program]",
@@ -12,11 +12,11 @@ static const char* GHS_TAG[] = { "[INTEGRITY Application]",
"[Subproject]",
"[Custom Target]" };
-const char* GhsMultiGpj::GetGpjTag(Types gpjType)
+char const* GhsMultiGpj::GetGpjTag(Types gpjType)
{
char const* tag;
switch (gpjType) {
- case INTERGRITY_APPLICATION:
+ case INTEGRITY_APPLICATION:
case LIBRARY:
case PROJECT:
case PROGRAM:
diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h
index 1cae660..d82200a 100644
--- a/Source/cmGhsMultiGpj.h
+++ b/Source/cmGhsMultiGpj.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -11,7 +11,7 @@ class GhsMultiGpj
public:
enum Types
{
- INTERGRITY_APPLICATION,
+ INTEGRITY_APPLICATION,
LIBRARY,
PROJECT,
PROGRAM,
@@ -22,5 +22,5 @@ public:
static void WriteGpjTag(Types gpjType, std::ostream& fout);
- static const char* GetGpjTag(Types gpjType);
+ static char const* GetGpjTag(Types gpjType);
};
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index a92faef..2557cf7 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGhsMultiTargetGenerator.h"
#include <algorithm>
@@ -15,6 +15,7 @@
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGhsMultiGenerator.h"
#include "cmLinkLineComputer.h" // IWYU pragma: keep
@@ -62,7 +63,7 @@ void cmGhsMultiTargetGenerator::Generate()
this->TargetNameReal =
this->GeneratorTarget->GetExecutableNames(this->ConfigName).Real;
if (this->cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()) {
- this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION;
+ this->TagType = GhsMultiGpj::INTEGRITY_APPLICATION;
} else {
this->TagType = GhsMultiGpj::PROGRAM;
}
@@ -147,7 +148,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget()
GhsMultiGpj::WriteGpjTag(this->TagType, fout);
if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) {
- const std::string language(
+ std::string const language(
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName));
this->WriteTargetSpecifics(fout, this->ConfigName);
this->SetCompilerFlags(this->ConfigName, language);
@@ -169,7 +170,7 @@ cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator()
}
void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
- const std::string& config)
+ std::string const& config)
{
std::string outpath;
@@ -195,14 +196,14 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
}
void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
- const std::string& language)
+ std::string const& language)
{
auto i = this->FlagsByLanguage.find(language);
if (i == this->FlagsByLanguage.end()) {
std::string flags;
this->LocalGenerator->AddLanguageFlags(
flags, this->GeneratorTarget, cmBuildStep::Compile, language, config);
- this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
+ this->LocalGenerator->AddFeatureFlags(flags, this->GeneratorTarget,
language, config);
this->LocalGenerator->AddVisibilityPresetFlags(
flags, this->GeneratorTarget, language);
@@ -223,7 +224,7 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
}
}
-std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
+std::string cmGhsMultiTargetGenerator::GetDefines(std::string const& language,
std::string const& config)
{
auto i = this->DefinesByLanguage.find(language);
@@ -245,14 +246,14 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
std::string const&,
- const std::string& language)
+ std::string const& language)
{
auto flagsByLangI = this->FlagsByLanguage.find(language);
if (flagsByLangI != this->FlagsByLanguage.end()) {
if (!flagsByLangI->second.empty()) {
std::vector<std::string> ghsCompFlags =
cmSystemTools::ParseArguments(flagsByLangI->second);
- for (const std::string& f : ghsCompFlags) {
+ for (std::string const& f : ghsCompFlags) {
fout << " " << f << '\n';
}
}
@@ -260,7 +261,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
}
void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
- std::ostream& fout, const std::string& config, const std::string& language)
+ std::ostream& fout, std::string const& config, std::string const& language)
{
std::vector<std::string> compileDefinitions;
this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config,
@@ -271,8 +272,8 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
}
void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout,
- const std::string& config,
- const std::string& language)
+ std::string const& config,
+ std::string const& language)
{
std::vector<std::string> includes;
this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
@@ -286,7 +287,7 @@ void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout,
void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
std::string const& config)
{
- if (this->TagType == GhsMultiGpj::INTERGRITY_APPLICATION) {
+ if (this->TagType == GhsMultiGpj::INTEGRITY_APPLICATION) {
return;
}
@@ -307,14 +308,14 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
// write out link options
std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
- for (const std::string& l : lopts) {
+ for (std::string const& l : lopts) {
fout << " " << l << '\n';
}
// write out link search paths
// must be quoted for paths that contain spaces
std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
- for (const std::string& l : lpath) {
+ for (std::string const& l : lpath) {
fout << " -L\"" << l << "\"\n";
}
@@ -324,7 +325,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
std::vector<std::string> llibs =
cmSystemTools::ParseArguments(linkLibraries);
- for (const std::string& l : llibs) {
+ for (std::string const& l : llibs) {
if (l.compare(0, 2, "-l") == 0) {
fout << " \"" << l << "\"\n";
} else {
@@ -370,7 +371,7 @@ void cmGhsMultiTargetGenerator::WriteBuildEvents(std::ostream& fout)
}
void cmGhsMultiTargetGenerator::WriteBuildEventsHelper(
- std::ostream& fout, const std::vector<cmCustomCommand>& ccv,
+ std::ostream& fout, std::vector<cmCustomCommand> const& ccv,
std::string const& name, std::string const& cmd)
{
int cmdcount = 0;
@@ -399,7 +400,7 @@ void cmGhsMultiTargetGenerator::WriteBuildEventsHelper(
} else {
fout << fname << "\n :outputName=\"" << fname << ".rule\"\n";
}
- for (const auto& byp : ccg.GetByproducts()) {
+ for (auto const& byp : ccg.GetByproducts()) {
fout << " :extraOutputFile=\"" << byp << "\"\n";
}
}
@@ -496,13 +497,13 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
}
void cmGhsMultiTargetGenerator::WriteSourceProperty(
- std::ostream& fout, const cmSourceFile* sf, std::string const& propName,
+ std::ostream& fout, cmSourceFile const* sf, std::string const& propName,
std::string const& propFlag)
{
cmValue prop = sf->GetProperty(propName);
if (prop) {
cmList list{ *prop };
- for (const std::string& p : list) {
+ for (std::string const& p : list) {
fout << " " << propFlag << p << '\n';
}
}
@@ -531,7 +532,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
}
/* list of known groups and the order they are displayed in a project file */
- const std::vector<std::string> standardGroups = {
+ std::vector<std::string> const standardGroups = {
"CMake Rules", "Header Files", "Source Files",
"Object Files", "Object Libraries", "Resources"
};
@@ -544,7 +545,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
* in the order used by std::map.
*/
int i = 0;
- for (const std::string& gn : standardGroups) {
+ for (std::string const& gn : standardGroups) {
auto n = groupNames.find(gn);
if (n != groupNames.end()) {
groupFilesList[i] = *n;
@@ -570,7 +571,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
}
}
- for (const auto& n : groupNames) {
+ for (auto const& n : groupNames) {
groupFilesList[i] = n;
i += 1;
}
@@ -629,7 +630,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
if (sg != "CMake Rules") {
/* output rule for each source file */
- for (const cmSourceFile* si : groupFiles[sg]) {
+ for (cmSourceFile const* si : groupFiles[sg]) {
bool compile = true;
// Convert filename to native system
// WORKAROUND: GHS MULTI 6.1.4 and 6.1.6 are known to need backslash on
@@ -693,7 +694,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
std::string fext = ".sh";
#endif
for (auto& sf : customCommands) {
- const cmCustomCommand* cc = sf->GetCustomCommand();
+ cmCustomCommand const* cc = sf->GetCustomCommand();
cmCustomCommandGenerator ccg(*cc, this->ConfigName,
this->LocalGenerator);
@@ -734,14 +735,14 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandLine(
* the outputs is manually deleted.
*/
bool specifyExtra = true;
- for (const auto& out : ccg.GetOutputs()) {
+ for (auto const& out : ccg.GetOutputs()) {
fout << fname << '\n';
fout << " :outputName=\"" << out << "\"\n";
if (specifyExtra) {
- for (const auto& byp : ccg.GetByproducts()) {
+ for (auto const& byp : ccg.GetByproducts()) {
fout << " :extraOutputFile=\"" << byp << "\"\n";
}
- for (const auto& dep : ccg.GetDepends()) {
+ for (auto const& dep : ccg.GetDepends()) {
fout << " :depends=\"" << dep << "\"\n";
}
specifyExtra = false;
@@ -750,7 +751,7 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandLine(
}
std::string cmGhsMultiTargetGenerator::WriteObjectLangOverride(
- const cmSourceFile* sourceFile)
+ cmSourceFile const* sourceFile)
{
std::string ret;
cmValue rawLangProp = sourceFile->GetProperty("LANGUAGE");
@@ -801,7 +802,7 @@ bool cmGhsMultiTargetGenerator::VisitCustomCommand(
if (perm.find(si) == perm.end()) {
/* set temporary mark; check if revisit*/
if (temp.insert(si).second) {
- for (const auto& di : si->GetCustomCommand()->GetDepends()) {
+ for (auto const& di : si->GetCustomCommand()->GetDepends()) {
cmSourceFile const* sf =
this->GeneratorTarget->GetLocalGenerator()->GetSourceFileWithOutput(
di);
diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h
index d3e80e6..91ca105 100644
--- a/Source/cmGhsMultiTargetGenerator.h
+++ b/Source/cmGhsMultiTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -32,25 +32,25 @@ private:
void GenerateTarget();
- void WriteTargetSpecifics(std::ostream& fout, const std::string& config);
+ void WriteTargetSpecifics(std::ostream& fout, std::string const& config);
- void WriteCompilerFlags(std::ostream& fout, const std::string& config,
- const std::string& language);
- void WriteCompilerDefinitions(std::ostream& fout, const std::string& config,
- const std::string& language);
+ void WriteCompilerFlags(std::ostream& fout, std::string const& config,
+ std::string const& language);
+ void WriteCompilerDefinitions(std::ostream& fout, std::string const& config,
+ std::string const& language);
void SetCompilerFlags(std::string const& config,
- const std::string& language);
+ std::string const& language);
- std::string GetDefines(const std::string& language,
+ std::string GetDefines(std::string const& language,
std::string const& config);
- void WriteIncludes(std::ostream& fout, const std::string& config,
- const std::string& language);
+ void WriteIncludes(std::ostream& fout, std::string const& config,
+ std::string const& language);
void WriteTargetLinkLine(std::ostream& fout, std::string const& config);
void WriteBuildEvents(std::ostream& fout);
void WriteBuildEventsHelper(std::ostream& fout,
- const std::vector<cmCustomCommand>& ccv,
+ std::vector<cmCustomCommand> const& ccv,
std::string const& name, std::string const& cmd);
void WriteCustomCommandsHelper(std::ostream& fout,
cmCustomCommandGenerator const& ccg);
@@ -62,10 +62,10 @@ private:
std::vector<cmSourceFile const*>& order,
cmSourceFile const* sf);
void WriteSources(std::ostream& fout_proj);
- void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf,
+ void WriteSourceProperty(std::ostream& fout, cmSourceFile const* sf,
std::string const& propName,
std::string const& propFlag);
- static std::string WriteObjectLangOverride(const cmSourceFile* sourceFile);
+ static std::string WriteObjectLangOverride(cmSourceFile const* sourceFile);
bool DetermineIfIntegrityApp();
cmGeneratorTarget* GeneratorTarget;
diff --git a/Source/cmGlobCacheEntry.h b/Source/cmGlobCacheEntry.h
index acc410d..566d1b3 100644
--- a/Source/cmGlobCacheEntry.h
+++ b/Source/cmGlobCacheEntry.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -9,11 +9,11 @@
struct cmGlobCacheEntry
{
- const bool Recurse;
- const bool ListDirectories;
- const bool FollowSymlinks;
- const std::string Relative;
- const std::string Expression;
+ bool const Recurse;
+ bool const ListDirectories;
+ bool const FollowSymlinks;
+ std::string const Relative;
+ std::string const Expression;
std::vector<std::string> Files;
cmGlobCacheEntry(bool recurse, bool listDirectories, bool followSymlinks,
diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx
index 73365d2..7798fc9 100644
--- a/Source/cmGlobVerificationManager.cxx
+++ b/Source/cmGlobVerificationManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobVerificationManager.h"
#include <sstream>
@@ -15,7 +15,7 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
-bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path,
+bool cmGlobVerificationManager::SaveVerificationScript(std::string const& path,
cmMessenger* messenger)
{
if (this->Cache.empty()) {
@@ -42,8 +42,6 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path,
<< cmVersion::GetMajorVersion() << "."
<< cmVersion::GetMinorVersion() << "\n";
- verifyScriptFile << "cmake_policy(SET CMP0009 NEW)\n";
-
for (auto const& i : this->Cache) {
CacheEntryKey k = std::get<0>(i);
CacheEntryValue v = std::get<1>(i);
@@ -64,7 +62,7 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path,
verifyScriptFile << "\n";
verifyScriptFile << "set(OLD_GLOB\n";
- for (const std::string& file : v.Files) {
+ for (std::string const& file : v.Files) {
verifyScriptFile << " \"" << file << "\"\n";
}
verifyScriptFile << " )\n";
@@ -95,7 +93,7 @@ bool cmGlobVerificationManager::DoWriteVerifyTarget() const
}
bool cmGlobVerificationManager::CacheEntryKey::operator<(
- const CacheEntryKey& r) const
+ CacheEntryKey const& r) const
{
if (this->Recurse < r.Recurse) {
return true;
@@ -131,7 +129,7 @@ bool cmGlobVerificationManager::CacheEntryKey::operator<(
}
void cmGlobVerificationManager::CacheEntryKey::PrintGlobCommand(
- std::ostream& out, const std::string& cmdVar)
+ std::ostream& out, std::string const& cmdVar)
{
out << "file(GLOB" << (this->Recurse ? "_RECURSE " : " ");
out << cmdVar << " ";
@@ -146,8 +144,8 @@ void cmGlobVerificationManager::CacheEntryKey::PrintGlobCommand(
}
void cmGlobVerificationManager::AddCacheEntry(
- const cmGlobCacheEntry& entry, const std::string& variable,
- const cmListFileBacktrace& backtrace, cmMessenger* messenger)
+ cmGlobCacheEntry const& entry, std::string const& variable,
+ cmListFileBacktrace const& backtrace, cmMessenger* messenger)
{
CacheEntryKey key =
CacheEntryKey(entry.Recurse, entry.ListDirectories, entry.FollowSymlinks,
diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h
index e9c519b..0a6f25c 100644
--- a/Source/cmGlobVerificationManager.h
+++ b/Source/cmGlobVerificationManager.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,12 +26,12 @@ class cmGlobVerificationManager
protected:
//! Save verification script for given makefile.
//! Saves to output <path>/<CMakeFilesDirectory>/VerifyGlobs.cmake
- bool SaveVerificationScript(const std::string& path, cmMessenger* messenger);
+ bool SaveVerificationScript(std::string const& path, cmMessenger* messenger);
//! Add an entry into the glob cache
- void AddCacheEntry(const cmGlobCacheEntry& entry,
- const std::string& variable,
- const cmListFileBacktrace& bt, cmMessenger* messenger);
+ void AddCacheEntry(cmGlobCacheEntry const& entry,
+ std::string const& variable,
+ cmListFileBacktrace const& bt, cmMessenger* messenger);
//! Get all cache entries
std::vector<cmGlobCacheEntry> GetCacheEntries() const;
@@ -49,12 +49,12 @@ protected:
private:
struct CacheEntryKey
{
- const bool Recurse;
- const bool ListDirectories;
- const bool FollowSymlinks;
- const std::string Relative;
- const std::string Expression;
- CacheEntryKey(const bool rec, const bool l, const bool s, std::string rel,
+ bool const Recurse;
+ bool const ListDirectories;
+ bool const FollowSymlinks;
+ std::string const Relative;
+ std::string const Expression;
+ CacheEntryKey(bool const rec, bool const l, bool const s, std::string rel,
std::string e)
: Recurse(rec)
, ListDirectories(l)
@@ -63,8 +63,8 @@ private:
, Expression(std::move(e))
{
}
- bool operator<(const CacheEntryKey& r) const;
- void PrintGlobCommand(std::ostream& out, const std::string& cmdVar);
+ bool operator<(CacheEntryKey const& r) const;
+ void PrintGlobCommand(std::ostream& out, std::string const& cmdVar);
};
struct CacheEntryValue
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 6eabe9c..31e8df2 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalBorlandMakefileGenerator.h"
#include <ostream>
@@ -69,10 +69,10 @@ cmDocumentationEntry cmGlobalBorlandMakefileGenerator::GetDocumentation()
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalBorlandMakefileGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int /*jobs*/, bool verbose,
- const cmBuildOptions& buildOptions,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int /*jobs*/, bool verbose,
+ cmBuildOptions const& buildOptions,
std::vector<std::string> const& makeOptions)
{
return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index a2adbd0..7fff979 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -58,10 +58,10 @@ public:
protected:
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
index b1b96d0..da882c0 100644
--- a/Source/cmGlobalCommonGenerator.cxx
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalCommonGenerator.h"
#include <algorithm>
@@ -33,7 +33,7 @@ std::map<std::string, cmGlobalCommonGenerator::DirectoryTarget>
cmGlobalCommonGenerator::ComputeDirectoryTargets() const
{
std::map<std::string, DirectoryTarget> dirTargets;
- for (const auto& lg : this->LocalGenerators) {
+ for (auto const& lg : this->LocalGenerators) {
std::string currentBinaryDir =
lg->GetStateSnapshot().GetDirectory().GetCurrentBinary();
DirectoryTarget& dirTarget = dirTargets[currentBinaryDir];
@@ -43,16 +43,16 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const
// The directory-level rule should depend on the target-level rules
// for all targets in the directory.
- for (const auto& gt : lg->GetGeneratorTargets()) {
+ for (auto const& gt : lg->GetGeneratorTargets()) {
cmStateEnums::TargetType const type = gt->GetType();
if (type == cmStateEnums::GLOBAL_TARGET || !gt->IsInBuildSystem()) {
continue;
}
DirectoryTarget::Target t;
t.GT = gt.get();
- const std::string EXCLUDE_FROM_ALL("EXCLUDE_FROM_ALL");
+ std::string const EXCLUDE_FROM_ALL("EXCLUDE_FROM_ALL");
if (cmValue exclude = gt->GetProperty(EXCLUDE_FROM_ALL)) {
- for (const std::string& config : configs) {
+ for (std::string const& config : configs) {
cmGeneratorExpressionInterpreter genexInterpreter(lg.get(), config,
gt.get());
if (cmIsOn(genexInterpreter.Evaluate(*exclude, EXCLUDE_FROM_ALL))) {
@@ -91,7 +91,7 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const
}
bool cmGlobalCommonGenerator::IsExcludedFromAllInConfig(
- const DirectoryTarget::Target& t, const std::string& config)
+ DirectoryTarget::Target const& t, std::string const& config)
{
if (this->IsMultiConfig()) {
return cm::contains(t.ExcludedFromAllInConfigs, config);
@@ -140,7 +140,7 @@ void cmGlobalCommonGenerator::RemoveUnknownClangTidyExportFixesFiles() const
if (!this->ClangTidyExportFixesFiles.count(file) &&
!std::any_of(this->ClangTidyExportFixesFiles.begin(),
this->ClangTidyExportFixesFiles.end(),
- [&file](const std::string& knownFile) -> bool {
+ [&file](std::string const& knownFile) -> bool {
return cmSystemTools::SameFile(file, knownFile);
})) {
cmSystemTools::RemoveFile(file);
diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h
index fa42674..479c109 100644
--- a/Source/cmGlobalCommonGenerator.h
+++ b/Source/cmGlobalCommonGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,20 +41,20 @@ public:
std::vector<Dir> Children;
};
std::map<std::string, DirectoryTarget> ComputeDirectoryTargets() const;
- bool IsExcludedFromAllInConfig(const DirectoryTarget::Target& t,
- const std::string& config);
- void AddClangTidyExportFixesDir(const std::string& dir)
+ bool IsExcludedFromAllInConfig(DirectoryTarget::Target const& t,
+ std::string const& config);
+ void AddClangTidyExportFixesDir(std::string const& dir)
{
this->ClangTidyExportFixesDirs.insert(dir);
}
- void AddClangTidyExportFixesFile(const std::string& file)
+ void AddClangTidyExportFixesFile(std::string const& file)
{
this->ClangTidyExportFixesFiles.insert(file);
}
protected:
virtual bool SupportsDirectConsole() const { return true; }
- const char* GetEditCacheTargetName() const override { return "edit_cache"; }
+ char const* GetEditCacheTargetName() const override { return "edit_cache"; }
std::string GetEditCacheCommand() const override;
std::set<std::string> ClangTidyExportFixesDirs;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index eced160..c020bdb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalGenerator.h"
#include <algorithm>
@@ -72,7 +72,7 @@
class cmListFileBacktrace;
-const std::string kCMAKE_PLATFORM_INFO_INITIALIZED =
+std::string const kCMAKE_PLATFORM_INFO_INITIALIZED =
"CMAKE_PLATFORM_INFO_INITIALIZED";
class cmInstalledFile;
@@ -81,7 +81,7 @@ namespace detail {
std::string GeneratedMakeCommand::QuotedPrintable() const
{
std::string output;
- const char* sep = "";
+ char const* sep = "";
int flags = 0;
#if !defined(_WIN32)
flags |= cmOutputConverter::Shell_Flag_IsUnix;
@@ -129,7 +129,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->CurrentConfigureMakefile = nullptr;
this->TryCompileOuterMakefile = nullptr;
- this->ConfigureDoneCMP0026AndCMP0024 = false;
this->FirstTimeProgress = 0.0f;
cm->GetState()->SetIsGeneratorMultiConfig(false);
@@ -227,7 +226,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, bool,
}
std::string cmGlobalGenerator::SelectMakeProgram(
- const std::string& inMakeProgram, const std::string& makeDefault) const
+ std::string const& inMakeProgram, std::string const& makeDefault) const
{
std::string makeProgram = inMakeProgram;
if (cmIsOff(makeProgram)) {
@@ -245,7 +244,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(
return makeProgram;
}
-void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
+void cmGlobalGenerator::ResolveLanguageCompiler(std::string const& lang,
cmMakefile* mf,
bool optional) const
{
@@ -315,24 +314,6 @@ void cmGlobalGenerator::AddBuildExportExportSet(
this->AddBuildExportSet(gen);
}
-bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
-{
- auto const it = this->BuildExportSets.find(file);
- if (it != this->BuildExportSets.end()) {
- bool result = it->second->GenerateImportFile();
-
- if (!this->ConfigureDoneCMP0026AndCMP0024) {
- for (const auto& m : this->Makefiles) {
- m->RemoveExportBuildFileGeneratorCMP0024(it->second);
- }
- }
-
- this->BuildExportSets.erase(it);
- return result;
- }
- return false;
-}
-
void cmGlobalGenerator::ForceLinkerLanguages()
{
}
@@ -340,8 +321,8 @@ void cmGlobalGenerator::ForceLinkerLanguages()
bool cmGlobalGenerator::CheckTargetsForMissingSources() const
{
bool failed = false;
- for (const auto& localGen : this->LocalGenerators) {
- for (const auto& target : localGen->GetGeneratorTargets()) {
+ for (auto const& localGen : this->LocalGenerators) {
+ for (auto const& target : localGen->GetGeneratorTargets()) {
if (!target->CanCompileSources() ||
target->GetProperty("ghs_integrity_app").IsOn()) {
continue;
@@ -361,11 +342,11 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
void cmGlobalGenerator::CheckTargetLinkLibraries() const
{
- for (const auto& generator : this->LocalGenerators) {
- for (const auto& gt : generator->GetGeneratorTargets()) {
+ for (auto const& generator : this->LocalGenerators) {
+ for (auto const& gt : generator->GetGeneratorTargets()) {
gt->CheckLinkLibraries();
}
- for (const auto& gt : generator->GetOwnedImportedGeneratorTargets()) {
+ for (auto const& gt : generator->GetOwnedImportedGeneratorTargets()) {
gt->CheckLinkLibraries();
}
}
@@ -377,8 +358,8 @@ bool cmGlobalGenerator::CheckTargetsForType() const
return false;
}
bool failed = false;
- for (const auto& generator : this->LocalGenerators) {
- for (const auto& target : generator->GetGeneratorTargets()) {
+ for (auto const& generator : this->LocalGenerators) {
+ for (auto const& target : generator->GetGeneratorTargets()) {
std::string systemName =
target->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME");
if (systemName.find("Windows") == std::string::npos) {
@@ -412,8 +393,8 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
return false;
}
bool failed = false;
- for (const auto& generator : this->LocalGenerators) {
- for (const auto& target : generator->GetGeneratorTargets()) {
+ for (auto const& generator : this->LocalGenerators) {
+ for (auto const& target : generator->GetGeneratorTargets()) {
if (!target->CanCompileSources() ||
target->GetProperty("ghs_integrity_app").IsOn()) {
continue;
@@ -425,7 +406,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
target->GetSafeProperty("COMPILE_PDB_NAME");
if (!reuseFrom.empty() && reuseFrom != compilePdb) {
- const std::string e = cmStrCat(
+ std::string const e = cmStrCat(
"PRECOMPILE_HEADERS_REUSE_FROM property is set on target (\"",
target->GetName(),
"\"). Reusable precompile headers requires the COMPILE_PDB_NAME"
@@ -441,7 +422,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
}
bool cmGlobalGenerator::IsExportedTargetsFile(
- const std::string& filename) const
+ std::string const& filename) const
{
auto const it = this->BuildExportSets.find(filename);
if (it == this->BuildExportSets.end()) {
@@ -468,8 +449,9 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
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 "
- << "probably need to select a different build tool.";
+ << this->GetName()
+ << "\". CMAKE_MAKE_PROGRAM is not set. You "
+ "probably need to select a different build tool.";
cmSystemTools::Error(err.str());
cmSystemTools::SetFatalErrorOccurred();
return false;
@@ -826,8 +808,8 @@ void cmGlobalGenerator::EnableLanguage(
std::string compilerName = cmStrCat("CMAKE_", lang, "_COMPILER");
std::string compilerEnv =
cmStrCat("CMAKE_", lang, "_COMPILER_ENV_VAR");
- const std::string& envVar = mf->GetRequiredDefinition(compilerEnv);
- const std::string& envVarValue =
+ std::string const& envVar = mf->GetRequiredDefinition(compilerEnv);
+ std::string const& envVarValue =
mf->GetRequiredDefinition(compilerName);
std::string env = cmStrCat(envVar, '=', envVarValue);
cmSystemTools::PutEnv(env);
@@ -848,7 +830,7 @@ void cmGlobalGenerator::EnableLanguage(
// flag
needTestLanguage[lang] = true;
} // end if(!this->GetLanguageEnabled(lang) )
- } // end loop over languages
+ } // end loop over languages
// **** Load the system specific information if not yet loaded
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) {
@@ -872,11 +854,7 @@ void cmGlobalGenerator::EnableLanguage(
std::ostringstream noCompiler;
cmValue compilerFile = mf->GetDefinition(compilerName);
if (!cmNonempty(compilerFile) || cmIsNOTFOUND(*compilerFile)) {
- /* clang-format off */
- noCompiler <<
- "No " << compilerName << " could be found.\n"
- ;
- /* clang-format on */
+ noCompiler << "No " << compilerName << " could be found.\n";
} else if ((lang != "RC") && (lang != "ASM_MARMASM") &&
(lang != "ASM_MASM")) {
if (!cmSystemTools::FileIsFullPath(*compilerFile)) {
@@ -961,7 +939,7 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::RemoveFile(compilerLangFile);
}
} // end if in try compile
- } // end need test language
+ } // end need test language
// load linker configuration, if required
if (mf->IsOn(cmStrCat("CMAKE_", lang, "_COMPILER_WORKS")) &&
@@ -996,12 +974,6 @@ void cmGlobalGenerator::EnableLanguage(
}
}
- // Store the shared library flags so that we can satisfy CMP0018
- std::string sharedLibFlagsVar =
- cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS");
- this->LanguageToOriginalSharedLibFlags[lang] =
- mf->GetSafeDefinition(sharedLibFlagsVar);
-
// Translate compiler ids for compatibility.
this->CheckCompilerIdCompatibility(mf, lang);
} // end for each language
@@ -1050,73 +1022,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
std::string compilerIdVar = cmStrCat("CMAKE_", lang, "_COMPILER_ID");
std::string const compilerId = mf->GetSafeDefinition(compilerIdVar);
- if (compilerId == "AppleClang") {
- switch (mf->GetPolicyStatus(cmPolicies::CMP0025)) {
- case cmPolicies::WARN:
- if (!this->CMakeInstance->GetIsInTryCompile() &&
- mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n"
- "Converting " << lang <<
- R"( compiler id "AppleClang" to "Clang" for compatibility.)"
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to convert AppleClang to Clang.
- mf->AddDefinition(compilerIdVar, "Clang");
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- mf->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025));
- break;
- case cmPolicies::NEW:
- // NEW behavior is to keep AppleClang.
- break;
- }
- }
-
- if (compilerId == "QCC") {
- switch (mf->GetPolicyStatus(cmPolicies::CMP0047)) {
- case cmPolicies::WARN:
- if (!this->CMakeInstance->GetIsInTryCompile() &&
- mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047")) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n"
- "Converting " << lang <<
- R"( compiler id "QCC" to "GNU" for compatibility.)"
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to convert QCC to GNU.
- mf->AddDefinition(compilerIdVar, "GNU");
- if (lang == "C") {
- mf->AddDefinition("CMAKE_COMPILER_IS_GNUCC", "1");
- } else if (lang == "CXX") {
- mf->AddDefinition("CMAKE_COMPILER_IS_GNUCXX", "1");
- }
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- mf->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047));
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior is to keep QCC.
- break;
- }
- }
-
if (compilerId == "XLClang") {
switch (mf->GetPolicyStatus(cmPolicies::CMP0089)) {
case cmPolicies::WARN:
@@ -1136,12 +1041,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
// OLD behavior is to convert XLClang to XL.
mf->AddDefinition(compilerIdVar, "XL");
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- mf->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0089));
- break;
case cmPolicies::NEW:
// NEW behavior is to keep AppleClang.
break;
@@ -1184,12 +1083,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
mf->RemoveDefinition(emulated);
}
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- mf->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0129));
- CM_FALLTHROUGH;
case cmPolicies::NEW:
// NEW behavior is to keep LCC.
break;
@@ -1200,7 +1093,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
std::string cmGlobalGenerator::GetLanguageOutputExtension(
cmSourceFile const& source) const
{
- const std::string& lang = source.GetLanguage();
+ std::string const& lang = source.GetLanguage();
if (!lang.empty()) {
return this->GetLanguageOutputExtension(lang);
}
@@ -1226,7 +1119,7 @@ std::string cmGlobalGenerator::GetLanguageOutputExtension(
return "";
}
-std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
+std::string cmGlobalGenerator::GetLanguageFromExtension(char const* ext) const
{
// if there is an extension and it starts with . then move past the
// . because the extensions are not stored with a . in the map
@@ -1255,14 +1148,14 @@ files could change the object file extension
(CMAKE_<LANG>_OUTPUT_EXTENSION) before the CMake variables were copied
to the C++ maps.
*/
-void cmGlobalGenerator::SetLanguageEnabled(const std::string& l,
+void cmGlobalGenerator::SetLanguageEnabled(std::string const& l,
cmMakefile* mf)
{
this->SetLanguageEnabledFlag(l, mf);
this->SetLanguageEnabledMaps(l, mf);
}
-void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l,
+void cmGlobalGenerator::SetLanguageEnabledFlag(std::string const& l,
cmMakefile* mf)
{
this->CMakeInstance->GetState()->SetLanguageEnabled(l);
@@ -1275,7 +1168,7 @@ void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l,
this->FillExtensionToLanguageMap(l, mf);
}
-void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
+void cmGlobalGenerator::SetLanguageEnabledMaps(std::string const& l,
cmMakefile* mf)
{
// use LanguageToLinkerPreference to detect whether this functions has
@@ -1335,11 +1228,11 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
}
}
-void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
+void cmGlobalGenerator::FillExtensionToLanguageMap(std::string const& l,
cmMakefile* mf)
{
std::string extensionsVar = cmStrCat("CMAKE_", l, "_SOURCE_FILE_EXTENSIONS");
- const std::string& exts = mf->GetSafeDefinition(extensionsVar);
+ std::string const& exts = mf->GetSafeDefinition(extensionsVar);
cmList extensionList{ exts };
for (std::string const& i : extensionList) {
this->ExtensionToLanguage[i] = l;
@@ -1365,7 +1258,7 @@ std::string cmGlobalGenerator::GetSafeGlobalSetting(
return this->Makefiles[0]->GetDefinition(name);
}
-bool cmGlobalGenerator::IgnoreFile(const char* ext) const
+bool cmGlobalGenerator::IgnoreFile(char const* ext) const
{
if (!this->GetLanguageFromExtension(ext).empty()) {
return false;
@@ -1373,7 +1266,7 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const
return (this->IgnoreExtensions.count(ext) > 0);
}
-bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const
+bool cmGlobalGenerator::GetLanguageEnabled(std::string const& l) const
{
return this->CMakeInstance->GetState()->GetLanguageEnabled(l);
}
@@ -1388,7 +1281,7 @@ void cmGlobalGenerator::CreateLocalGenerators()
this->LocalGeneratorSearchIndex.clear();
this->LocalGenerators.clear();
this->LocalGenerators.reserve(this->Makefiles.size());
- for (const auto& m : this->Makefiles) {
+ for (auto const& m : this->Makefiles) {
auto lg = this->CreateLocalGenerator(m.get());
this->IndexLocalGenerator(lg.get());
this->LocalGenerators.push_back(std::move(lg));
@@ -1428,18 +1321,15 @@ void cmGlobalGenerator::Configure()
}
// now do it
- this->ConfigureDoneCMP0026AndCMP0024 = false;
dirMf->Configure();
dirMf->EnforceDirectoryLevelRules();
- this->ConfigureDoneCMP0026AndCMP0024 = true;
-
// Put a copy of each global target in every directory.
{
std::vector<GlobalTargetInfo> globalTargets;
this->CreateDefaultGlobalTargets(globalTargets);
- for (const auto& mf : this->Makefiles) {
+ for (auto const& mf : this->Makefiles) {
for (GlobalTargetInfo const& globalTarget : globalTargets) {
this->CreateGlobalTarget(globalTarget, mf.get());
}
@@ -1459,7 +1349,7 @@ void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
{
this->CreateLocalGenerators();
// Commit side effects only if we are actually generating
- if (this->GetConfigureDoneCMP0026()) {
+ if (targetTypes == TargetTypes::AllTargets) {
this->CheckTargetProperties();
}
this->CreateGeneratorTargets(targetTypes);
@@ -1469,13 +1359,13 @@ void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
}
void cmGlobalGenerator::CreateImportedGenerationObjects(
- cmMakefile* mf, const std::vector<std::string>& targets,
- std::vector<const cmGeneratorTarget*>& exports)
+ cmMakefile* mf, std::vector<std::string> const& targets,
+ std::vector<cmGeneratorTarget const*>& exports)
{
this->CreateGenerationObjects(ImportedOnly);
auto const mfit =
std::find_if(this->Makefiles.begin(), this->Makefiles.end(),
- [mf](const std::unique_ptr<cmMakefile>& item) {
+ [mf](std::unique_ptr<cmMakefile> const& item) {
return item.get() == mf;
});
auto& lg =
@@ -1489,18 +1379,13 @@ void cmGlobalGenerator::CreateImportedGenerationObjects(
}
cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(
- const std::string& filename) const
+ std::string const& filename) const
{
auto const it = this->BuildExportSets.find(filename);
return it == this->BuildExportSets.end() ? nullptr : it->second;
}
-void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
-{
- this->CMP0042WarnTargets.insert(target);
-}
-
-void cmGlobalGenerator::AddCMP0068WarnTarget(const std::string& target)
+void cmGlobalGenerator::AddCMP0068WarnTarget(std::string const& target)
{
this->CMP0068WarnTargets.insert(target);
}
@@ -1515,12 +1400,14 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
// This generator does not support duplicate custom targets.
std::ostringstream e;
+ // clang-format off
e << "This project has enabled the ALLOW_DUPLICATE_CUSTOM_TARGETS "
- << "global property. "
- << "The \"" << this->GetName() << "\" generator does not support "
- << "duplicate custom targets. "
- << "Consider using a Makefiles generator or fix the project to not "
- << "use duplicate target names.";
+ "global property. "
+ "The \"" << this->GetName() << "\" generator does not support "
+ "duplicate custom targets. "
+ "Consider using a Makefiles generator or fix the project to not "
+ "use duplicate target names.";
+ // clang-format on
cmSystemTools::Error(e.str());
return false;
}
@@ -1536,7 +1423,7 @@ void cmGlobalGenerator::ComputeBuildFileGenerators()
}
}
-bool cmGlobalGenerator::UnsupportedVariableIsDefined(const std::string& name,
+bool cmGlobalGenerator::UnsupportedVariableIsDefined(std::string const& name,
bool supported) const
{
if (!supported && this->Makefiles.front()->GetDefinition(name)) {
@@ -1580,8 +1467,6 @@ bool cmGlobalGenerator::Compute()
// Start with an empty vector:
this->FilesReplacedDuringGenerate.clear();
- // clear targets to issue warning CMP0042 for
- this->CMP0042WarnTargets.clear();
// clear targets to issue warning CMP0068 for
this->CMP0068WarnTargets.clear();
@@ -1623,7 +1508,7 @@ bool cmGlobalGenerator::Compute()
//
// Synthetic targets performed this inside of
// `cmLocalGenerator::DiscoverSyntheticTargets`
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
if (!localGen->ComputeTargetCompileFeatures()) {
return false;
}
@@ -1661,7 +1546,7 @@ bool cmGlobalGenerator::Compute()
}
// Add generator specific helper commands
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
localGen->AddHelperCommands();
}
@@ -1673,9 +1558,9 @@ bool cmGlobalGenerator::Compute()
return false;
}
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
cmMakefile* mf = localGen->GetMakefile();
- for (const auto& g : mf->GetInstallGenerators()) {
+ for (auto const& g : mf->GetInstallGenerators()) {
if (!g->Compute(localGen.get())) {
return false;
}
@@ -1686,7 +1571,7 @@ bool cmGlobalGenerator::Compute()
// Trace the dependencies, after that no custom commands should be added
// because their dependencies might not be handled correctly
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
localGen->TraceDependencies();
}
@@ -1698,7 +1583,7 @@ bool cmGlobalGenerator::Compute()
this->ForceLinkerLanguages();
// Compute the manifest of main targets generated.
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
localGen->ComputeTargetManifest();
}
@@ -1716,7 +1601,7 @@ bool cmGlobalGenerator::Compute()
return false;
}
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
localGen->ComputeHomeRelativeOutputPath();
}
@@ -1787,18 +1672,6 @@ void cmGlobalGenerator::Generate()
// Perform validation checks on memoized link structures.
this->CheckTargetLinkLibraries();
- if (!this->CMP0042WarnTargets.empty()) {
- std::ostringstream w;
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0042) << "\n";
- w << "MACOSX_RPATH is not specified for"
- " the following targets:\n";
- for (std::string const& t : this->CMP0042WarnTargets) {
- w << " " << t << "\n";
- }
- this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
- w.str());
- }
-
if (!this->CMP0068WarnTargets.empty()) {
std::ostringstream w;
/* clang-format off */
@@ -1810,7 +1683,7 @@ void cmGlobalGenerator::Generate()
;
/* clang-format on */
for (std::string const& t : this->CMP0068WarnTargets) {
- w << " " << t << "\n";
+ w << ' ' << t << '\n';
}
this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
w.str());
@@ -1818,8 +1691,8 @@ void cmGlobalGenerator::Generate()
}
#if !defined(CMAKE_BOOTSTRAP)
-void cmGlobalGenerator::WriteJsonContent(const std::string& path,
- const Json::Value& value) const
+void cmGlobalGenerator::WriteJsonContent(std::string const& path,
+ Json::Value const& value) const
{
cmsys::ofstream ftmp(path.c_str());
this->JsonWriter->write(value, &ftmp);
@@ -1829,18 +1702,24 @@ void cmGlobalGenerator::WriteJsonContent(const std::string& path,
void cmGlobalGenerator::WriteInstallJson() const
{
- if (this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
- "INSTALL_PARALLEL")) {
- Json::Value index(Json::objectValue);
- index["InstallScripts"] = Json::arrayValue;
- for (const auto& file : this->InstallScripts) {
- index["InstallScripts"].append(file);
+ Json::Value index(Json::objectValue);
+ index["InstallScripts"] = Json::arrayValue;
+ for (auto const& file : this->InstallScripts) {
+ index["InstallScripts"].append(file);
+ }
+ index["Parallel"] =
+ this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
+ "INSTALL_PARALLEL");
+ if (this->SupportsDefaultConfigs()) {
+ index["Configs"] = Json::arrayValue;
+ for (auto const& config : this->GetDefaultConfigs()) {
+ index["Configs"].append(config);
}
- this->WriteJsonContent(
- cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(),
- "/CMakeFiles/InstallScripts.json"),
- index);
}
+ this->WriteJsonContent(
+ cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(),
+ "/CMakeFiles/InstallScripts.json"),
+ index);
}
#endif
@@ -1873,8 +1752,8 @@ void cmGlobalGenerator::ComputeTargetOrder()
size_t index = 0;
auto const& lgens = this->GetLocalGenerators();
for (auto const& lgen : lgens) {
- const auto& targets = lgen->GetGeneratorTargets();
- for (const auto& gt : targets) {
+ auto const& targets = lgen->GetGeneratorTargets();
+ for (auto const& gt : targets) {
this->ComputeTargetOrder(gt.get(), index);
}
}
@@ -1891,8 +1770,8 @@ void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
}
auto entry = insertion.first;
- const auto& deps = this->GetTargetDirectDepends(gt);
- for (const auto& d : deps) {
+ auto const& deps = this->GetTargetDirectDepends(gt);
+ for (auto const& d : deps) {
this->ComputeTargetOrder(d, index);
}
@@ -1959,7 +1838,8 @@ bool cmGlobalGenerator::AddHeaderSetVerification()
}
cmTarget* allVerifyTarget = this->Makefiles.front()->FindTargetToUse(
- "all_verify_interface_header_sets", true);
+ "all_verify_interface_header_sets",
+ { cmStateEnums::TargetDomain::NATIVE });
if (allVerifyTarget) {
this->LocalGenerators.front()->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(allVerifyTarget,
@@ -1971,15 +1851,15 @@ bool cmGlobalGenerator::AddHeaderSetVerification()
void cmGlobalGenerator::CreateFileGenerateOutputs()
{
- for (const auto& lg : this->LocalGenerators) {
+ for (auto const& lg : this->LocalGenerators) {
lg->CreateEvaluationFileOutputs();
}
}
bool cmGlobalGenerator::AddAutomaticSources()
{
- for (const auto& lg : this->LocalGenerators) {
- for (const auto& gt : lg->GetGeneratorTargets()) {
+ for (auto const& lg : this->LocalGenerators) {
+ for (auto const& gt : lg->GetGeneratorTargets()) {
if (!gt->CanCompileSources()) {
continue;
}
@@ -1992,8 +1872,8 @@ bool cmGlobalGenerator::AddAutomaticSources()
lg->AddXCConfigSources(gt.get());
}
}
- for (const auto& lg : this->LocalGenerators) {
- for (const auto& gt : lg->GetGeneratorTargets()) {
+ for (auto const& lg : this->LocalGenerators) {
+ for (auto const& gt : lg->GetGeneratorTargets()) {
if (!gt->CanCompileSources()) {
continue;
}
@@ -2011,8 +1891,8 @@ bool cmGlobalGenerator::AddAutomaticSources()
// Also clear the link interface cache to support $<TARGET_OBJECTS:objlib>
// in INTERFACE_LINK_LIBRARIES because the list of object files may have
// been changed by conversion to a unity build or addition of a PCH source.
- for (const auto& lg : this->LocalGenerators) {
- for (const auto& gt : lg->GetGeneratorTargets()) {
+ for (auto const& lg : this->LocalGenerators) {
+ for (auto const& gt : lg->GetGeneratorTargets()) {
gt->ClearSourcesCache();
gt->ClearLinkInterfaceCache();
}
@@ -2040,15 +1920,12 @@ void cmGlobalGenerator::FinalizeTargetConfiguration()
this->CMakeInstance->GetState()->GetEnabledLanguages();
// Construct per-target generator information.
- for (const auto& mf : this->Makefiles) {
- const cmBTStringRange noConfigCompileDefinitions =
+ for (auto const& mf : this->Makefiles) {
+ cmBTStringRange const compileDefinitions =
mf->GetCompileDefinitionsEntries();
- cm::optional<std::map<std::string, cmValue>> perConfigCompileDefinitions;
-
for (auto& target : mf->GetTargets()) {
cmTarget* t = &target.second;
- t->FinalizeTargetConfiguration(noConfigCompileDefinitions,
- perConfigCompileDefinitions);
+ t->FinalizeTargetConfiguration(compileDefinitions);
}
// The standard include directories for each language
@@ -2087,7 +1964,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
std::map<cmTarget*, cmGeneratorTarget*> importedMap;
for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
auto& mf = this->Makefiles[i];
- for (const auto& ownedImpTgt : mf->GetOwnedImportedTargets()) {
+ for (auto const& ownedImpTgt : mf->GetOwnedImportedTargets()) {
cmLocalGenerator* lg = this->LocalGenerators[i].get();
auto gt = cm::make_unique<cmGeneratorTarget>(ownedImpTgt.get(), lg);
importedMap[ownedImpTgt.get()] = gt.get();
@@ -2200,10 +2077,10 @@ void cmGlobalGenerator::CheckTargetProperties()
}
}
-int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir,
- const std::string& bindir,
- const std::string& projectName,
- const std::string& target, bool fast,
+int cmGlobalGenerator::TryCompile(int jobs, std::string const& srcdir,
+ std::string const& bindir,
+ std::string const& projectName,
+ std::string const& target, bool fast,
std::string& output, cmMakefile* mf)
{
// if this is not set, then this is a first time configure
@@ -2233,19 +2110,19 @@ int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir,
cmBuildOptions defaultBuildOptions(false, fast, PackageResolveMode::Disable);
std::stringstream ostr;
- auto ret =
- this->Build(jobs, srcdir, bindir, projectName, newTarget, ostr, "", config,
- defaultBuildOptions, true, this->TryCompileTimeout);
+ auto ret = this->Build(jobs, srcdir, bindir, projectName, newTarget, ostr,
+ "", config, defaultBuildOptions, true,
+ this->TryCompileTimeout, cmSystemTools::OUTPUT_NONE);
output = ostr.str();
return ret;
}
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalGenerator::GenerateBuildCommand(
- const std::string& /*unused*/, const std::string& /*unused*/,
- const std::string& /*unused*/, std::vector<std::string> const& /*unused*/,
- const std::string& /*unused*/, int /*unused*/, bool /*unused*/,
- const cmBuildOptions& /*unused*/, std::vector<std::string> const& /*unused*/)
+ std::string const& /*unused*/, std::string const& /*unused*/,
+ std::string const& /*unused*/, std::vector<std::string> const& /*unused*/,
+ std::string const& /*unused*/, int /*unused*/, bool /*unused*/,
+ cmBuildOptions const& /*unused*/, std::vector<std::string> const& /*unused*/)
{
GeneratedMakeCommand makeCommand;
makeCommand.Add("cmGlobalGenerator::GenerateBuildCommand not implemented");
@@ -2260,11 +2137,11 @@ void cmGlobalGenerator::PrintBuildCommandAdvice(std::ostream& /*os*/,
}
int cmGlobalGenerator::Build(
- int jobs, const std::string& /*unused*/, const std::string& bindir,
- const std::string& projectName, const std::vector<std::string>& targets,
- std::ostream& ostr, const std::string& makeCommandCSTR,
- const std::string& config, const cmBuildOptions& buildOptions, bool verbose,
- cmDuration timeout, cmSystemTools::OutputOption outputflag,
+ int jobs, std::string const& /*unused*/, std::string const& bindir,
+ std::string const& projectName, std::vector<std::string> const& targets,
+ std::ostream& ostr, std::string const& makeCommandCSTR,
+ std::string const& config, cmBuildOptions const& buildOptions, bool verbose,
+ cmDuration timeout, cmSystemTools::OutputOption outputMode,
std::vector<std::string> const& nativeOptions)
{
bool hideconsole = cmSystemTools::GetRunCommandHideConsole();
@@ -2276,8 +2153,7 @@ int cmGlobalGenerator::Build(
ostr << "Change Dir: '" << bindir << '\'' << std::endl;
if (workdir.Failed()) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
- std::string err = cmStrCat("Failed to change directory: ",
- std::strerror(workdir.GetLastResult()));
+ std::string const& err = workdir.GetError();
cmSystemTools::Error(err);
ostr << err << std::endl;
return 1;
@@ -2289,17 +2165,18 @@ int cmGlobalGenerator::Build(
int retVal = 0;
cmSystemTools::SetRunCommandHideConsole(true);
- std::string outputBuffer;
- std::string* outputPtr = &outputBuffer;
+
+ // Capture build command output when outputMode == OUTPUT_NONE.
+ std::string outputBuf;
std::vector<GeneratedMakeCommand> makeCommand = this->GenerateBuildCommand(
makeCommandCSTR, projectName, bindir, targets, realConfig, jobs, verbose,
buildOptions, nativeOptions);
// Workaround to convince some commands to produce output.
- if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH &&
+ if (outputMode == cmSystemTools::OUTPUT_PASSTHROUGH &&
makeCommand.back().RequiresOutputForward) {
- outputflag = cmSystemTools::OUTPUT_FORWARD;
+ outputMode = cmSystemTools::OUTPUT_FORWARD;
}
// should we do a clean first?
@@ -2318,16 +2195,16 @@ int cmGlobalGenerator::Build(
return 1;
}
if (!cmSystemTools::RunSingleCommand(cleanCommand.front().PrimaryCommand,
- outputPtr, outputPtr, &retVal,
- nullptr, outputflag, timeout)) {
+ &outputBuf, &outputBuf, &retVal,
+ nullptr, outputMode, timeout)) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error("Generator: execution of make clean failed.");
- ostr << *outputPtr << "\nGenerator: execution of make clean failed."
+ ostr << outputBuf << "\nGenerator: execution of make clean failed."
<< std::endl;
return 1;
}
- ostr << *outputPtr;
+ ostr << outputBuf;
}
// now build
@@ -2349,22 +2226,22 @@ int cmGlobalGenerator::Build(
}
ostr << outputMakeCommandStr << std::endl;
- if (!cmSystemTools::RunSingleCommand(command->PrimaryCommand, outputPtr,
- outputPtr, &retVal, nullptr,
- outputflag, timeout)) {
+ if (!cmSystemTools::RunSingleCommand(command->PrimaryCommand, &outputBuf,
+ &outputBuf, &retVal, nullptr,
+ outputMode, timeout)) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error(
- cmStrCat("Generator: execution of make failed. Make command was: ",
+ cmStrCat("Generator: build tool execution failed, command was: ",
makeCommandStr));
- ostr << *outputPtr
- << "\nGenerator: execution of make failed. Make command was: "
+ ostr << outputBuf
+ << "\nGenerator: build tool execution failed, command was: "
<< outputMakeCommandStr << std::endl;
return 1;
}
- ostr << *outputPtr << std::flush;
+ ostr << outputBuf << std::flush;
if (needBuildOutput) {
- buildOutput += *outputPtr;
+ buildOutput += outputBuf;
}
}
ostr << std::endl;
@@ -2380,8 +2257,8 @@ int cmGlobalGenerator::Build(
return retVal;
}
-bool cmGlobalGenerator::Open(const std::string& bindir,
- const std::string& projectName, bool dryRun)
+bool cmGlobalGenerator::Open(std::string const& bindir,
+ std::string const& projectName, bool dryRun)
{
if (this->ExtraGenerator) {
return this->ExtraGenerator->Open(bindir, projectName, dryRun);
@@ -2391,39 +2268,31 @@ bool cmGlobalGenerator::Open(const std::string& bindir,
}
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
- const std::string& target, const std::string& config,
- const std::string& parallel, const std::string& native, bool ignoreErrors)
+ std::string const& target, std::string const& config,
+ std::string const& parallel, std::string const& native, bool ignoreErrors)
{
std::string makeCommand = cmSystemTools::GetCMakeCommand();
makeCommand =
cmStrCat(cmSystemTools::ConvertToOutputPath(makeCommand), " --build .");
if (!config.empty()) {
- makeCommand += " --config \"";
- makeCommand += config;
- makeCommand += "\"";
+ makeCommand = cmStrCat(makeCommand, " --config \"", config, '"');
}
if (!parallel.empty()) {
- makeCommand += " --parallel \"";
- makeCommand += parallel;
- makeCommand += "\"";
+ makeCommand = cmStrCat(makeCommand, " --parallel \"", parallel, '"');
}
if (!target.empty()) {
- makeCommand += " --target \"";
- makeCommand += target;
- makeCommand += "\"";
+ makeCommand = cmStrCat(makeCommand, " --target \"", target, '"');
}
- const char* sep = " -- ";
+ char const* sep = " -- ";
if (ignoreErrors) {
- const char* iflag = this->GetBuildIgnoreErrorsFlag();
+ char const* iflag = this->GetBuildIgnoreErrorsFlag();
if (iflag && *iflag) {
- makeCommand += sep;
- makeCommand += iflag;
+ makeCommand = cmStrCat(makeCommand, sep, iflag);
sep = " ";
}
}
if (!native.empty()) {
- makeCommand += sep;
- makeCommand += native;
+ makeCommand = cmStrCat(makeCommand, sep, native);
}
return makeCommand;
}
@@ -2461,19 +2330,19 @@ void cmGlobalGenerator::AddMakefile(std::unique_ptr<cmMakefile> mf)
this->CMakeInstance->UpdateProgress("Configuring", prog);
}
-void cmGlobalGenerator::AddInstallComponent(const std::string& component)
+void cmGlobalGenerator::AddInstallComponent(std::string const& component)
{
if (!component.empty()) {
this->InstallComponents.insert(component);
}
}
-void cmGlobalGenerator::MarkAsGeneratedFile(const std::string& filepath)
+void cmGlobalGenerator::MarkAsGeneratedFile(std::string const& filepath)
{
this->GeneratedFiles.insert(filepath);
}
-bool cmGlobalGenerator::IsGeneratedFile(const std::string& filepath)
+bool cmGlobalGenerator::IsGeneratedFile(std::string const& filepath)
{
return this->GeneratedFiles.find(filepath) != this->GeneratedFiles.end();
}
@@ -2550,20 +2419,20 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
}
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
- const cmGeneratorTarget* target) const
+ cmGeneratorTarget const* target) const
{
if (!target->IsInBuildSystem()) {
return true;
}
cmMakefile* mf = root->GetMakefile();
- const std::string EXCLUDE_FROM_ALL = "EXCLUDE_FROM_ALL";
+ std::string const EXCLUDE_FROM_ALL = "EXCLUDE_FROM_ALL";
if (cmValue exclude = target->GetProperty(EXCLUDE_FROM_ALL)) {
// Expand the property value per configuration.
unsigned int trueCount = 0;
unsigned int falseCount = 0;
- const std::vector<std::string>& configs =
+ std::vector<std::string> const& configs =
mf->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
- for (const std::string& config : configs) {
+ for (std::string const& config : configs) {
cmGeneratorExpressionInterpreter genexInterpreter(root, config, target);
if (cmIsOn(genexInterpreter.Evaluate(*exclude, EXCLUDE_FROM_ALL))) {
++trueCount;
@@ -2594,7 +2463,7 @@ void cmGlobalGenerator::GetEnabledLanguages(
lang = this->CMakeInstance->GetState()->GetEnabledLanguages();
}
-int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const
+int cmGlobalGenerator::GetLinkerPreference(std::string const& lang) const
{
auto const it = this->LanguageToLinkerPreference.find(lang);
if (it != this->LanguageToLinkerPreference.end()) {
@@ -2606,7 +2475,7 @@ int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const
void cmGlobalGenerator::FillProjectMap()
{
this->ProjectMap.clear(); // make sure we start with a clean map
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
// for each local generator add all projects
cmStateSnapshot snp = localGen->GetStateSnapshot();
std::string name;
@@ -2621,7 +2490,7 @@ void cmGlobalGenerator::FillProjectMap()
}
}
-cmMakefile* cmGlobalGenerator::FindMakefile(const std::string& start_dir) const
+cmMakefile* cmGlobalGenerator::FindMakefile(std::string const& start_dir) const
{
auto const it = this->MakefileSearchIndex.find(start_dir);
if (it != this->MakefileSearchIndex.end()) {
@@ -2640,13 +2509,13 @@ cmLocalGenerator* cmGlobalGenerator::FindLocalGenerator(
return nullptr;
}
-void cmGlobalGenerator::AddAlias(const std::string& name,
+void cmGlobalGenerator::AddAlias(std::string const& name,
std::string const& tgtName)
{
this->AliasTargets[name] = tgtName;
}
-bool cmGlobalGenerator::IsAlias(const std::string& name) const
+bool cmGlobalGenerator::IsAlias(std::string const& name) const
{
return cm::contains(this->AliasTargets, name);
}
@@ -2709,11 +2578,18 @@ void cmGlobalGenerator::IndexLocalGenerator(cmLocalGenerator* lg)
this->LocalGeneratorSearchIndex[id.String] = lg;
}
-cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
+cmTarget* cmGlobalGenerator::FindTargetImpl(
+ std::string const& name, cmStateEnums::TargetDomainSet domains) const
{
+ bool const useForeign =
+ domains.contains(cmStateEnums::TargetDomain::FOREIGN);
+ bool const useNative = domains.contains(cmStateEnums::TargetDomain::NATIVE);
+
auto const it = this->TargetSearchIndex.find(name);
if (it != this->TargetSearchIndex.end()) {
- return it->second;
+ if (it->second->IsForeign() ? useForeign : useNative) {
+ return it->second;
+ }
}
return nullptr;
}
@@ -2728,20 +2604,20 @@ cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(
return nullptr;
}
-cmTarget* cmGlobalGenerator::FindTarget(const std::string& name,
- bool excludeAliases) const
+cmTarget* cmGlobalGenerator::FindTarget(
+ std::string const& name, cmStateEnums::TargetDomainSet domains) const
{
- if (!excludeAliases) {
+ if (domains.contains(cmStateEnums::TargetDomain::ALIAS)) {
auto const ai = this->AliasTargets.find(name);
if (ai != this->AliasTargets.end()) {
- return this->FindTargetImpl(ai->second);
+ return this->FindTargetImpl(ai->second, domains);
}
}
- return this->FindTargetImpl(name);
+ return this->FindTargetImpl(name, domains);
}
cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTarget(
- const std::string& name) const
+ std::string const& name) const
{
auto const ai = this->AliasTargets.find(name);
if (ai != this->AliasTargets.end()) {
@@ -2751,7 +2627,7 @@ cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTarget(
}
bool cmGlobalGenerator::NameResolvesToFramework(
- const std::string& libname) const
+ std::string const& libname) const
{
if (cmSystemTools::IsPathToFramework(libname)) {
return true;
@@ -2772,7 +2648,7 @@ bool cmGlobalGenerator::NameResolvesToFramework(
// .tbd files also can be located in SDK frameworks (they are
// placeholders for actual libraries shipped with the OS)
cm::optional<cmGlobalGenerator::FrameworkDescriptor>
-cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
+cmGlobalGenerator::SplitFrameworkPath(std::string const& path,
FrameworkFormat format) const
{
// Check for framework structure:
@@ -2817,60 +2693,38 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
return cm::nullopt;
}
-static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
- std::string const& targetNameAsWritten,
- std::string const& reason)
+namespace {
+void IssueReservedTargetNameError(cmake* cm, cmTarget* tgt,
+ std::string const& targetNameAsWritten,
+ std::string const& reason)
{
- MessageType messageType = MessageType::AUTHOR_WARNING;
- std::ostringstream e;
- bool issueMessage = false;
- switch (tgt->GetPolicyStatusCMP0037()) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n";
- issueMessage = true;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- issueMessage = true;
- messageType = MessageType::FATAL_ERROR;
- break;
- }
- if (issueMessage) {
- e << "The target name \"" << targetNameAsWritten << "\" is reserved "
- << reason << ".";
- if (messageType == MessageType::AUTHOR_WARNING) {
- e << " It may result in undefined behavior.";
- }
- cm->IssueMessage(messageType, e.str(), tgt->GetBacktrace());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
- return true;
+ cm->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("The target name \"", targetNameAsWritten,
+ "\" is reserved ", reason, '.'),
+ tgt->GetBacktrace());
+}
}
-bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
- std::string const& reason) const
+bool cmGlobalGenerator::CheckReservedTargetName(
+ std::string const& targetName, std::string const& reason) const
{
cmTarget* tgt = this->FindTarget(targetName);
if (!tgt) {
return true;
}
- return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, targetName,
- reason);
+ IssueReservedTargetNameError(this->GetCMakeInstance(), tgt, targetName,
+ reason);
+ return false;
}
-bool cmGlobalGenerator::CheckCMP0037Prefix(std::string const& targetPrefix,
- std::string const& reason) const
+bool cmGlobalGenerator::CheckReservedTargetNamePrefix(
+ std::string const& targetPrefix, std::string const& reason) const
{
bool ret = true;
for (auto const& tgtPair : this->TargetSearchIndex) {
- if (cmHasPrefix(tgtPair.first, targetPrefix) &&
- !RaiseCMP0037Message(this->GetCMakeInstance(), tgtPair.second,
- tgtPair.first, reason)) {
+ if (cmHasPrefix(tgtPair.first, targetPrefix)) {
+ IssueReservedTargetNameError(this->GetCMakeInstance(), tgtPair.second,
+ tgtPair.first, reason);
ret = false;
}
}
@@ -2898,14 +2752,15 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
return;
}
- static const auto reservedTargets = { "package", "PACKAGE" };
+ static auto const reservedTargets = { "package", "PACKAGE" };
for (auto const& target : reservedTargets) {
- if (!this->CheckCMP0037(target, "when CPack packaging is enabled")) {
+ if (!this->CheckReservedTargetName(target,
+ "when CPack packaging is enabled")) {
return;
}
}
- const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
+ char const* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
GlobalTargetInfo gti;
gti.Name = this->GetPackageTargetName();
gti.Message = "Run CPack packaging tool...";
@@ -2935,7 +2790,7 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
void cmGlobalGenerator::AddGlobalTarget_PackageSource(
std::vector<GlobalTargetInfo>& targets)
{
- const char* packageSourceTargetName = this->GetPackageSourceTargetName();
+ char const* packageSourceTargetName = this->GetPackageSourceTargetName();
if (!packageSourceTargetName) {
return;
}
@@ -2947,10 +2802,10 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource(
return;
}
- static const auto reservedTargets = { "package_source" };
+ static auto const reservedTargets = { "package_source" };
for (auto const& target : reservedTargets) {
- if (!this->CheckCMP0037(target,
- "when CPack source packaging is enabled")) {
+ if (!this->CheckReservedTargetName(
+ target, "when CPack source packaging is enabled")) {
return;
}
}
@@ -2977,14 +2832,15 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
return;
}
- static const auto reservedTargets = { "test", "RUN_TESTS" };
+ static auto const reservedTargets = { "test", "RUN_TESTS" };
for (auto const& target : reservedTargets) {
- if (!this->CheckCMP0037(target, "when CTest testing is enabled")) {
+ if (!this->CheckReservedTargetName(target,
+ "when CTest testing is enabled")) {
return;
}
}
- const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
+ char const* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
GlobalTargetInfo gti;
gti.Name = this->GetTestTargetName();
gti.Message = "Running tests...";
@@ -2999,7 +2855,6 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
}
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCTestCommand());
- singleLine.push_back("--force-new-ctest-process");
cmList args(mf->GetDefinition("CMAKE_CTEST_ARGUMENTS"));
for (auto const& arg : args) {
singleLine.push_back(arg);
@@ -3021,7 +2876,7 @@ void cmGlobalGenerator::ReserveGlobalTargetCodegen()
// Read the policy value at the end of the top-level CMakeLists.txt file
// since it's a global policy that affects the whole project.
auto& mf = this->Makefiles[0];
- const auto policyStatus = mf->GetPolicyStatus(cmPolicies::CMP0171);
+ auto const policyStatus = mf->GetPolicyStatus(cmPolicies::CMP0171);
this->AllowGlobalTargetCodegen = (policyStatus == cmPolicies::NEW);
@@ -3035,14 +2890,12 @@ void cmGlobalGenerator::ReserveGlobalTargetCodegen()
bool issueMessage = false;
switch (policyStatus) {
case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0171) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0171) << '\n';
issueMessage = true;
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
issueMessage = true;
messageType = MessageType::FATAL_ERROR;
break;
@@ -3066,7 +2919,7 @@ bool cmGlobalGenerator::CheckCMP0171() const
void cmGlobalGenerator::AddGlobalTarget_EditCache(
std::vector<GlobalTargetInfo>& targets) const
{
- const char* editCacheTargetName = this->GetEditCacheTargetName();
+ char const* editCacheTargetName = this->GetEditCacheTargetName();
if (!editCacheTargetName) {
return;
}
@@ -3079,9 +2932,12 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache(
std::string edit_cmd = this->GetEditCacheCommand();
if (!edit_cmd.empty()) {
singleLine.push_back(std::move(edit_cmd));
- if (this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
+ if (this->GetCMakeInstance()->GetIgnoreCompileWarningAsError()) {
singleLine.push_back("--compile-no-warning-as-error");
}
+ if (this->GetCMakeInstance()->GetIgnoreLinkWarningAsError()) {
+ singleLine.push_back("--link-no-warning-as-error");
+ }
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.Message = "Running CMake cache editor...";
@@ -3103,7 +2959,7 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache(
void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
std::vector<GlobalTargetInfo>& targets) const
{
- const char* rebuildCacheTargetName = this->GetRebuildCacheTargetName();
+ char const* rebuildCacheTargetName = this->GetRebuildCacheTargetName();
if (!rebuildCacheTargetName) {
return;
}
@@ -3115,9 +2971,12 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("--regenerate-during-build");
- if (this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
+ if (this->GetCMakeInstance()->GetIgnoreCompileWarningAsError()) {
singleLine.push_back("--compile-no-warning-as-error");
}
+ if (this->GetCMakeInstance()->GetIgnoreLinkWarningAsError()) {
+ singleLine.push_back("--link-no-warning-as-error");
+ }
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.CommandLines.push_back(std::move(singleLine));
@@ -3129,7 +2988,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
std::vector<GlobalTargetInfo>& targets)
{
auto& mf = this->Makefiles[0];
- const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
+ char const* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
if (this->InstallTargetEnabled && skipInstallRules) {
this->CMakeInstance->IssueMessage(
@@ -3142,8 +3001,8 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
std::set<std::string>* componentsSet = &this->InstallComponents;
std::ostringstream ostr;
if (!componentsSet->empty()) {
- ostr << "Available install components are: ";
- ostr << cmWrap('"', *componentsSet, '"', " ");
+ ostr << "Available install components are: "
+ << cmWrap('"', *componentsSet, '"', " ");
} else {
ostr << "Only default component available";
}
@@ -3159,6 +3018,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
gti.Message = "Install the project...";
gti.UsesTerminal = true;
gti.StdPipesUTF8 = true;
+ gti.Role = "install";
cmCustomCommandLine singleLine;
if (this->GetPreinstallTargetName()) {
gti.Depends.emplace_back(this->GetPreinstallTargetName());
@@ -3194,9 +3054,10 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
targets.push_back(gti);
// install_local
- if (const char* install_local = this->GetInstallLocalTargetName()) {
+ if (char const* install_local = this->GetInstallLocalTargetName()) {
gti.Name = install_local;
gti.Message = "Installing only the local directory...";
+ gti.Role = "install";
gti.UsesTerminal =
!this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
"INSTALL_PARALLEL");
@@ -3212,11 +3073,12 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
}
// install_strip
- const char* install_strip = this->GetInstallStripTargetName();
+ char const* install_strip = this->GetInstallStripTargetName();
if (install_strip && mf->IsSet("CMAKE_STRIP")) {
gti.Name = install_strip;
gti.Message = "Installing the project stripped...";
gti.UsesTerminal = true;
+ gti.Role = "install";
gti.CommandLines.clear();
cmCustomCommandLine stripCmdLine = singleLine;
@@ -3238,7 +3100,7 @@ public:
, Inputs(std::move(inputs))
{
}
- void operator()(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ void operator()(cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> cc);
private:
@@ -3247,7 +3109,7 @@ private:
};
void ModuleCompilationDatabaseCommandAction::operator()(
- cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> cc)
{
auto inputs = this->Inputs();
@@ -3288,7 +3150,7 @@ public:
, Target(target)
{
}
- void operator()(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ void operator()(cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> cc);
private:
@@ -3297,7 +3159,7 @@ private:
};
void ModuleCompilationDatabaseTargetAction::operator()(
- cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> cc)
{
cc->SetBacktrace(lfbt);
@@ -3330,16 +3192,16 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
return {};
}
- static const auto reservedTargets = { "cmake_build_database" };
+ static auto const reservedTargets = { "cmake_build_database" };
for (auto const& target : reservedTargets) {
- if (!this->CheckCMP0037(target,
- "when exporting build databases are enabled")) {
+ if (!this->CheckReservedTargetName(
+ target, "when exporting build databases are enabled")) {
return false;
}
}
- static const auto reservedPrefixes = { "cmake_build_database-" };
+ static auto const reservedPrefixes = { "cmake_build_database-" };
for (auto const& prefix : reservedPrefixes) {
- if (!this->CheckCMP0037Prefix(
+ if (!this->CheckReservedTargetNamePrefix(
prefix, "when exporting build databases are enabled")) {
return false;
}
@@ -3353,7 +3215,7 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
static cm::static_string_view TargetPrefix = "cmake_build_database"_s;
auto AddMergeTarget =
- [&mf](std::string const& name, const char* comment,
+ [&mf](std::string const& name, char const* comment,
std::string const& output,
std::function<std::vector<std::string>()> inputs) {
// Add the custom command.
@@ -3442,7 +3304,7 @@ std::string cmGlobalGenerator::GetPredefinedTargetsFolder() const
bool cmGlobalGenerator::UseFolderProperty() const
{
- const cmValue prop =
+ cmValue const prop =
this->GetCMakeInstance()->GetState()->GetGlobalProperty("USE_FOLDERS");
// If this property is defined, let the setter turn this on or off.
@@ -3477,6 +3339,7 @@ void cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
cc.SetWorkingDirectory(gti.WorkingDir.c_str());
cc.SetStdPipesUTF8(gti.StdPipesUTF8);
cc.SetUsesTerminal(gti.UsesTerminal);
+ cc.SetRole(gti.Role);
target.AddPostBuildCommand(std::move(cc));
if (!gti.Message.empty()) {
target.SetProperty("EchoString", gti.Message);
@@ -3496,7 +3359,7 @@ std::string cmGlobalGenerator::GenerateRuleFile(
std::string const& output) const
{
std::string ruleFile = cmStrCat(output, ".rule");
- const char* dir = this->GetCMakeCFGIntDir();
+ char const* dir = this->GetCMakeCFGIntDir();
if (dir && dir[0] == '$') {
cmSystemTools::ReplaceString(ruleFile, dir, "/CMakeFiles");
}
@@ -3508,19 +3371,9 @@ bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const
return mf->PlatformIsAppleEmbedded();
}
-std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
- std::string const& l) const
-{
- auto const it = this->LanguageToOriginalSharedLibFlags.find(l);
- if (it != this->LanguageToOriginalSharedLibFlags.end()) {
- return it->second;
- }
- return "";
-}
-
-void cmGlobalGenerator::AppendDirectoryForConfig(const std::string& /*unused*/,
- const std::string& /*unused*/,
- const std::string& /*unused*/,
+void cmGlobalGenerator::AppendDirectoryForConfig(std::string const& /*unused*/,
+ std::string const& /*unused*/,
+ std::string const& /*unused*/,
std::string& /*unused*/)
{
// Subclasses that support multiple configurations should implement
@@ -3528,6 +3381,12 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const std::string& /*unused*/,
// configuration.
}
+cmValue cmGlobalGenerator::GetDebuggerWorkingDirectory(
+ cmGeneratorTarget* gt) const
+{
+ return gt->GetProperty("DEBUGGER_WORKING_DIRECTORY");
+}
+
cmGlobalGenerator::TargetDependSet const&
cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
{
@@ -3546,7 +3405,7 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
// by one or more of the cmake generators.
// Adding additional targets to this list will require a policy!
- static const cm::static_string_view reservedTargets[] = {
+ static cm::static_string_view const reservedTargets[] = {
"all"_s, "ALL_BUILD"_s, "help"_s, "install"_s,
"INSTALL"_s, "preinstall"_s, "clean"_s, "edit_cache"_s,
"rebuild_cache"_s, "ZERO_CHECK"_s
@@ -3570,7 +3429,7 @@ std::string cmGlobalGenerator::GetExtraGeneratorName() const
: std::string();
}
-void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename)
+void cmGlobalGenerator::FileReplacedDuringGenerate(std::string const& filename)
{
this->FilesReplacedDuringGenerate.push_back(filename);
}
@@ -3595,7 +3454,7 @@ void cmGlobalGenerator::GetTargetSets(
continue;
}
// loop over all the generator targets in the makefile
- for (const auto& target : generator->GetGeneratorTargets()) {
+ for (auto const& target : generator->GetGeneratorTargets()) {
if (this->IsRootOnlyTarget(target.get()) &&
target->GetLocalGenerator() != root) {
continue;
@@ -3652,7 +3511,7 @@ std::set<std::string> const& cmGlobalGenerator::GetDirectoryContent(
if (d.Load(dir)) {
unsigned long n = d.GetNumberOfFiles();
for (unsigned long i = 0; i < n; ++i) {
- const char* f = d.GetFile(i);
+ char const* f = d.GetFile(i);
if (strcmp(f, ".") != 0 && strcmp(f, "..") != 0) {
dc.All.insert(f);
}
@@ -3664,7 +3523,7 @@ std::set<std::string> const& cmGlobalGenerator::GetDirectoryContent(
return dc.All;
}
-void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
+void cmGlobalGenerator::AddRuleHash(std::vector<std::string> const& outputs,
std::string const& content)
{
// Ignore if there are no outputs.
@@ -3758,7 +3617,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile)
fout << "# Hashes of file build rules.\n";
for (auto const& rh : this->RuleHashes) {
fout.write(rh.second.Data, 32);
- fout << " " << rh.first << "\n";
+ fout << ' ' << rh.first << '\n';
}
}
}
@@ -3770,13 +3629,13 @@ void cmGlobalGenerator::WriteSummary()
"/CMakeFiles/TargetDirectories.txt");
cmGeneratedFileStream fout(fname);
- for (const auto& lg : this->LocalGenerators) {
- for (const auto& tgt : lg->GetGeneratorTargets()) {
+ for (auto const& lg : this->LocalGenerators) {
+ for (auto const& tgt : lg->GetGeneratorTargets()) {
if (!tgt->IsInBuildSystem()) {
continue;
}
this->WriteSummary(tgt.get());
- fout << tgt->GetSupportDirectory() << "\n";
+ fout << tgt->GetSupportDirectory() << '\n';
}
}
}
@@ -3814,7 +3673,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
if (!labels.empty()) {
fout << "# Target labels\n";
for (std::string const& l : labels) {
- fout << " " << l << "\n";
+ fout << ' ' << l << '\n';
lj_target_labels.append(l);
}
}
@@ -3837,12 +3696,12 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
}
for (auto const& li : directoryLabelsList) {
- fout << " " << li << "\n";
+ fout << ' ' << li << '\n';
lj_target_labels.append(li);
}
for (auto const& li : cmakeDirectoryLabelsList) {
- fout << " " << li << "\n";
+ fout << ' ' << li << '\n';
lj_target_labels.append(li);
}
@@ -3859,13 +3718,13 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
for (cmSourceFile* sf : cmMakeRange(sources.cbegin(), sourcesEnd)) {
Json::Value& lj_source = lj_sources.append(Json::objectValue);
std::string const& sfp = sf->ResolveFullPath();
- fout << sfp << "\n";
+ fout << sfp << '\n';
lj_source["file"] = sfp;
if (cmValue svalue = sf->GetProperty("LABELS")) {
Json::Value& lj_source_labels = lj_source["labels"] = Json::arrayValue;
labels.assign(*svalue);
for (auto const& label : labels) {
- fout << " " << label << "\n";
+ fout << ' ' << label << '\n';
lj_source_labels.append(label);
}
}
@@ -3881,7 +3740,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
}
// static
-std::string cmGlobalGenerator::EscapeJSON(const std::string& s)
+std::string cmGlobalGenerator::EscapeJSON(std::string const& s)
{
std::string result;
result.reserve(s.size());
@@ -3917,7 +3776,7 @@ cmGlobalGenerator::GetFilenameTargetDepends(cmSourceFile* sf) const
return this->FilenameTargetDepends[sf];
}
-const std::string& cmGlobalGenerator::GetRealPath(const std::string& dir)
+std::string const& cmGlobalGenerator::GetRealPath(std::string const& dir)
{
auto i = this->RealPaths.lower_bound(dir);
if (i == this->RealPaths.end() ||
@@ -3929,7 +3788,7 @@ const std::string& cmGlobalGenerator::GetRealPath(const std::string& dir)
std::string cmGlobalGenerator::NewDeferId()
{
- return cmStrCat("__"_s, std::to_string(this->NextDeferId++));
+ return cmStrCat("__", this->NextDeferId++);
}
void cmGlobalGenerator::ProcessEvaluationFiles()
@@ -3941,7 +3800,7 @@ void cmGlobalGenerator::ProcessEvaluationFiles()
}
std::string cmGlobalGenerator::ExpandCFGIntDir(
- const std::string& str, const std::string& /*config*/) const
+ std::string const& str, std::string const& /*config*/) const
{
return str;
}
@@ -3951,7 +3810,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
cmake::InstalledFilesMap const& installedFiles =
this->CMakeInstance->GetInstalledFiles();
- const auto& lg = this->LocalGenerators[0];
+ auto const& lg = this->LocalGenerators[0];
cmMakefile* mf = lg->GetMakefile();
std::vector<std::string> configs =
@@ -3990,7 +3849,7 @@ cmGlobalGenerator::CreateAnonymousRuntimeDependencySet()
}
cmInstallRuntimeDependencySet* cmGlobalGenerator::GetNamedRuntimeDependencySet(
- const std::string& name)
+ std::string const& name)
{
auto it = this->RuntimeDependencySetsByName.find(name);
if (it == this->RuntimeDependencySetsByName.end()) {
@@ -4032,7 +3891,26 @@ cmGlobalGenerator::StripCommandStyle cmGlobalGenerator::GetStripCommandStyle(
#endif
}
+std::string cmGlobalGenerator::GetEncodedLiteral(std::string const& lit)
+{
+ std::string result = lit;
+ return this->EncodeLiteral(result);
+}
+
void cmGlobalGenerator::AddInstallScript(std::string const& file)
{
this->InstallScripts.push_back(file);
}
+
+void cmGlobalGenerator::AddTestFile(std::string const& file)
+{
+ this->TestFiles.push_back(file);
+}
+
+void cmGlobalGenerator::AddCMakeFilesToRebuild(
+ std::vector<std::string>& files) const
+{
+ files.insert(files.end(), this->InstallScripts.begin(),
+ this->InstallScripts.end());
+ files.insert(files.end(), this->TestFiles.begin(), this->TestFiles.end());
+}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a865adb..13526cc 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,6 +25,7 @@
#include "cmExportSet.h"
#include "cmLocalGenerator.h"
#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -117,7 +118,7 @@ public:
virtual std::string GetName() const { return "Generic"; }
/** Check whether the given name matches the current generator. */
- virtual bool MatchesGeneratorName(const std::string& name) const
+ virtual bool MatchesGeneratorName(std::string const& name) const
{
return this->GetName() == name;
}
@@ -146,7 +147,7 @@ public:
cmMakefile* mf);
/** Read any other cache entries needed for cmake --build. */
- virtual bool ReadCacheEntriesForBuild(const cmState& /*state*/)
+ virtual bool ReadCacheEntriesForBuild(cmState const& /*state*/)
{
return true;
}
@@ -210,8 +211,8 @@ public:
/**
* Set/Get and Clear the enabled languages.
*/
- void SetLanguageEnabled(const std::string&, cmMakefile* mf);
- bool GetLanguageEnabled(const std::string&) const;
+ void SetLanguageEnabled(std::string const&, cmMakefile* mf);
+ bool GetLanguageEnabled(std::string const&) const;
void ClearEnabledLanguages();
void GetEnabledLanguages(std::vector<std::string>& lang) const;
/**
@@ -225,7 +226,7 @@ public:
* Resolve the CMAKE_<lang>_COMPILER setting for the given language.
* Intended to be called from EnableLanguage.
*/
- void ResolveLanguageCompiler(const std::string& lang, cmMakefile* mf,
+ void ResolveLanguageCompiler(std::string const& lang, cmMakefile* mf,
bool optional) const;
/**
@@ -237,9 +238,9 @@ public:
* Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process.
*/
- int TryCompile(int jobs, const std::string& srcdir,
- const std::string& bindir, const std::string& projectName,
- const std::string& targetName, bool fast, std::string& output,
+ int TryCompile(int jobs, std::string const& srcdir,
+ std::string const& bindir, std::string const& projectName,
+ std::string const& targetName, bool fast, std::string& output,
cmMakefile* mf);
/**
@@ -248,20 +249,19 @@ public:
* empty then all is assumed. clean indicates if a "make clean" should be
* done first.
*/
- int Build(
- int jobs, const std::string& srcdir, const std::string& bindir,
- const std::string& projectName,
- std::vector<std::string> const& targetNames, std::ostream& ostr,
- const std::string& makeProgram, const std::string& config,
- const cmBuildOptions& buildOptions, bool verbose, cmDuration timeout,
- cmSystemTools::OutputOption outputflag = cmSystemTools::OUTPUT_NONE,
- std::vector<std::string> const& nativeOptions =
- std::vector<std::string>());
+ int Build(int jobs, std::string const& srcdir, std::string const& bindir,
+ std::string const& projectName,
+ std::vector<std::string> const& targetNames, std::ostream& ostr,
+ std::string const& makeProgram, std::string const& config,
+ cmBuildOptions const& buildOptions, bool verbose,
+ cmDuration timeout, cmSystemTools::OutputOption outputMode,
+ std::vector<std::string> const& nativeOptions =
+ std::vector<std::string>());
/**
* Open a generated IDE project given the following information.
*/
- virtual bool Open(const std::string& bindir, const std::string& projectName,
+ virtual bool Open(std::string const& bindir, std::string const& projectName,
bool dryRun);
struct GeneratedMakeCommand final : public detail::GeneratedMakeCommand
@@ -269,10 +269,10 @@ public:
};
virtual std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions = std::vector<std::string>());
virtual void PrintBuildCommandAdvice(std::ostream& os, int jobs) const;
@@ -281,21 +281,21 @@ public:
* Generate a "cmake --build" call for a given target, config and parallel
* level.
*/
- std::string GenerateCMakeBuildCommand(const std::string& target,
- const std::string& config,
- const std::string& parallel,
- const std::string& native,
+ std::string GenerateCMakeBuildCommand(std::string const& target,
+ std::string const& config,
+ std::string const& parallel,
+ std::string const& native,
bool ignoreErrors);
//! Get the CMake instance
cmake* GetCMakeInstance() const { return this->CMakeInstance; }
void SetConfiguredFilesPath(cmGlobalGenerator* gen);
- const std::vector<std::unique_ptr<cmMakefile>>& GetMakefiles() const
+ std::vector<std::unique_ptr<cmMakefile>> const& GetMakefiles() const
{
return this->Makefiles;
}
- const LocalGeneratorVector& GetLocalGenerators() const
+ LocalGeneratorVector const& GetLocalGenerators() const
{
return this->LocalGenerators;
}
@@ -321,14 +321,14 @@ public:
std::string GetExtraGeneratorName() const;
- void AddInstallComponent(const std::string& component);
+ void AddInstallComponent(std::string const& component);
/** Mark the (absolute path to a) file as generated. */
- void MarkAsGeneratedFile(const std::string& filepath);
+ void MarkAsGeneratedFile(std::string const& filepath);
/** Determine if the absolute filepath belongs to a generated file. */
- bool IsGeneratedFile(const std::string& filepath);
+ bool IsGeneratedFile(std::string const& filepath);
- const std::set<std::string>* GetInstallComponents() const
+ std::set<std::string> const* GetInstallComponents() const
{
return &this->InstallComponents;
}
@@ -350,22 +350,22 @@ public:
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
//! return the language for the given extension
- std::string GetLanguageFromExtension(const char* ext) const;
+ std::string GetLanguageFromExtension(char const* ext) const;
//! is an extension to be ignored
- bool IgnoreFile(const char* ext) const;
+ bool IgnoreFile(char const* ext) const;
//! What is the preference for linkers and this language (None or Preferred)
- int GetLinkerPreference(const std::string& lang) const;
+ int GetLinkerPreference(std::string const& lang) const;
//! What is the object file extension for a given source file?
std::string GetLanguageOutputExtension(cmSourceFile const&) const;
//! What is the object file extension for a given language?
std::string GetLanguageOutputExtension(std::string const& lang) const;
//! What is the configurations directory variable called?
- virtual const char* GetCMakeCFGIntDir() const { return "."; }
+ virtual char const* GetCMakeCFGIntDir() const { return "."; }
//! expand CFGIntDir for a configuration
- virtual std::string ExpandCFGIntDir(const std::string& str,
- const std::string& config) const;
+ virtual std::string ExpandCFGIntDir(std::string const& str,
+ std::string const& config) const;
/** Get whether the generator should use a script for link commands. */
bool GetUseLinkScript() const { return this->UseLinkScript; }
@@ -380,17 +380,19 @@ public:
virtual bool FindMakeProgram(cmMakefile*);
//! Find a target by name by searching the local generators.
- cmTarget* FindTarget(const std::string& name,
- bool excludeAliases = false) const;
+ cmTarget* FindTarget(std::string const& name,
+ cmStateEnums::TargetDomainSet domains = {
+ cmStateEnums::TargetDomain::NATIVE,
+ cmStateEnums::TargetDomain::ALIAS }) const;
- cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const;
+ cmGeneratorTarget* FindGeneratorTarget(std::string const& name) const;
- void AddAlias(const std::string& name, const std::string& tgtName);
- bool IsAlias(const std::string& name) const;
+ void AddAlias(std::string const& name, std::string const& tgtName);
+ bool IsAlias(std::string const& name) const;
/** Determine if a name resolves to a framework on disk or a built target
that is a framework. */
- bool NameResolvesToFramework(const std::string& libname) const;
+ bool NameResolvesToFramework(std::string const& libname) const;
/** Split a framework path to the directory and name of the framework as well
* as optional suffix.
* Returns std::nullopt if the path does not match with framework format
@@ -454,10 +456,10 @@ public:
: cmStrCat(this->Directory, '/', this->GetVersionedName());
}
- const std::string Directory;
- const std::string Version;
- const std::string Name;
- const std::string Suffix;
+ std::string const Directory;
+ std::string const Version;
+ std::string const Name;
+ std::string const Suffix;
};
enum class FrameworkFormat
{
@@ -466,18 +468,18 @@ public:
Extended
};
cm::optional<FrameworkDescriptor> SplitFrameworkPath(
- const std::string& path,
+ std::string const& path,
FrameworkFormat format = FrameworkFormat::Relaxed) const;
- cmMakefile* FindMakefile(const std::string& start_dir) const;
+ cmMakefile* FindMakefile(std::string const& start_dir) const;
cmLocalGenerator* FindLocalGenerator(cmDirectoryId const& id) const;
/** Append the subdirectory for the given configuration. If anything is
appended the given prefix and suffix will be appended around it, which
is useful for leading or trailing slashes. */
- virtual void AppendDirectoryForConfig(const std::string& prefix,
- const std::string& config,
- const std::string& suffix,
+ virtual void AppendDirectoryForConfig(std::string const& prefix,
+ std::string const& config,
+ std::string const& suffix,
std::string& dir);
/** Get the content of a directory. Directory listings are cached
@@ -496,17 +498,17 @@ public:
static bool IsReservedTarget(std::string const& name);
- virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
- virtual const char* GetInstallTargetName() const { return "INSTALL"; }
- virtual const char* GetInstallLocalTargetName() const { return nullptr; }
- virtual const char* GetInstallStripTargetName() const { return nullptr; }
- virtual const char* GetPreinstallTargetName() const { return nullptr; }
- virtual const char* GetTestTargetName() const { return "RUN_TESTS"; }
- virtual const char* GetPackageTargetName() const { return "PACKAGE"; }
- virtual const char* GetPackageSourceTargetName() const { return nullptr; }
- virtual const char* GetEditCacheTargetName() const { return nullptr; }
- virtual const char* GetRebuildCacheTargetName() const { return nullptr; }
- virtual const char* GetCleanTargetName() const { return nullptr; }
+ virtual char const* GetAllTargetName() const { return "ALL_BUILD"; }
+ virtual char const* GetInstallTargetName() const { return "INSTALL"; }
+ virtual char const* GetInstallLocalTargetName() const { return nullptr; }
+ virtual char const* GetInstallStripTargetName() const { return nullptr; }
+ virtual char const* GetPreinstallTargetName() const { return nullptr; }
+ virtual char const* GetTestTargetName() const { return "RUN_TESTS"; }
+ virtual char const* GetPackageTargetName() const { return "PACKAGE"; }
+ virtual char const* GetPackageSourceTargetName() const { return nullptr; }
+ virtual char const* GetEditCacheTargetName() const { return nullptr; }
+ virtual char const* GetRebuildCacheTargetName() const { return nullptr; }
+ virtual char const* GetCleanTargetName() const { return nullptr; }
// Lookup edit_cache target command preferred by this generator.
virtual std::string GetEditCacheCommand() const { return ""; }
@@ -514,34 +516,36 @@ public:
// Default config to use for cmake --build
virtual std::string GetDefaultBuildConfig() const { return "Debug"; }
+ virtual cmValue GetDebuggerWorkingDirectory(cmGeneratorTarget* gt) const;
+
// Class to track a set of dependencies.
using TargetDependSet = cmTargetDependSet;
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
TargetDependSet const& GetTargetDirectDepends(
- const cmGeneratorTarget* target);
+ cmGeneratorTarget const* target);
// Return true if target 'l' occurs before 'r' in a global ordering
// of targets that respects inter-target dependencies.
bool TargetOrderIndexLess(cmGeneratorTarget const* l,
cmGeneratorTarget const* r) const;
- const std::map<std::string, std::vector<cmLocalGenerator*>>& GetProjectMap()
+ std::map<std::string, std::vector<cmLocalGenerator*>> const& GetProjectMap()
const
{
return this->ProjectMap;
}
// track files replaced during a Generate
- void FileReplacedDuringGenerate(const std::string& filename);
+ void FileReplacedDuringGenerate(std::string const& filename);
void GetFilesReplacedDuringGenerate(std::vector<std::string>& filenames);
- void AddRuleHash(const std::vector<std::string>& outputs,
+ void AddRuleHash(std::vector<std::string> const& outputs,
std::string const& content);
/** Return whether the given binary directory is unused. */
- bool BinaryDirectoryIsNew(const std::string& dir)
+ bool BinaryDirectoryIsNew(std::string const& dir)
{
return this->BinaryDirectories.insert(dir).second;
}
@@ -590,8 +594,6 @@ public:
virtual bool SupportsLinkerDependencyFile() const { return false; }
- std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
-
/** Generate an <output>.rule file path for a given command output. */
virtual std::string GenerateRuleFile(std::string const& output) const;
@@ -611,7 +613,7 @@ public:
return cmStrCat('/', config);
}
- static std::string EscapeJSON(const std::string& s);
+ static std::string EscapeJSON(std::string const& s);
void ProcessEvaluationFiles();
@@ -621,12 +623,10 @@ public:
}
void AddBuildExportSet(cmExportBuildFileGenerator* gen);
void AddBuildExportExportSet(cmExportBuildFileGenerator* gen);
- bool IsExportedTargetsFile(const std::string& filename) const;
- bool GenerateImportFile(const std::string& file);
+ bool IsExportedTargetsFile(std::string const& filename) const;
cmExportBuildFileGenerator* GetExportedTargetsFile(
- const std::string& filename) const;
- void AddCMP0042WarnTarget(const std::string& target);
- void AddCMP0068WarnTarget(const std::string& target);
+ std::string const& filename) const;
+ void AddCMP0068WarnTarget(std::string const& target);
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
@@ -634,18 +634,13 @@ public:
void SetFilenameTargetDepends(
cmSourceFile* sf, std::set<cmGeneratorTarget const*> const& tgts);
- const std::set<const cmGeneratorTarget*>& GetFilenameTargetDepends(
+ std::set<cmGeneratorTarget const*> const& GetFilenameTargetDepends(
cmSourceFile* sf) const;
#if !defined(CMAKE_BOOTSTRAP)
cmFileLockPool& GetFileLockPool() { return this->FileLockPool; }
#endif
- bool GetConfigureDoneCMP0026() const
- {
- return this->ConfigureDoneCMP0026AndCMP0024;
- }
-
std::string MakeSilentFlag;
size_t RecursionDepth = 0;
@@ -662,7 +657,7 @@ public:
cmInstallRuntimeDependencySet* CreateAnonymousRuntimeDependencySet();
cmInstallRuntimeDependencySet* GetNamedRuntimeDependencySet(
- const std::string& name);
+ std::string const& name);
enum class StripCommandStyle
{
@@ -671,11 +666,20 @@ public:
};
StripCommandStyle GetStripCommandStyle(std::string const& strip);
+ std::string GetEncodedLiteral(std::string const& lit);
virtual std::string& EncodeLiteral(std::string& lit) { return lit; }
bool CheckCMP0171() const;
void AddInstallScript(std::string const& file);
+ void AddTestFile(std::string const& file);
+ void AddCMakeFilesToRebuild(std::vector<std::string>& files) const;
+
+ virtual std::set<std::string> const& GetDefaultConfigs() const
+ {
+ static std::set<std::string> configs;
+ return configs;
+ }
protected:
// for a project collect all its targets by following depend
@@ -684,11 +688,11 @@ protected:
TargetDependSet& originalTargets, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
bool IsRootOnlyTarget(cmGeneratorTarget* target) const;
- void AddTargetDepends(const cmGeneratorTarget* target,
+ void AddTargetDepends(cmGeneratorTarget const* target,
TargetDependSet& projectTargets);
- void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf);
- void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf);
- void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf);
+ void SetLanguageEnabledFlag(std::string const& l, cmMakefile* mf);
+ void SetLanguageEnabledMaps(std::string const& l, cmMakefile* mf);
+ void FillExtensionToLanguageMap(std::string const& l, cmMakefile* mf);
virtual bool CheckLanguages(std::vector<std::string> const& languages,
cmMakefile* mf) const;
virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
@@ -697,8 +701,8 @@ protected:
virtual bool ComputeTargetDepends();
#if !defined(CMAKE_BOOTSTRAP)
- void WriteJsonContent(const std::string& fname,
- const Json::Value& value) const;
+ void WriteJsonContent(std::string const& fname,
+ Json::Value const& value) const;
void WriteInstallJson() const;
#endif
@@ -712,8 +716,8 @@ protected:
void CreateFileGenerateOutputs();
bool AddAutomaticSources();
- std::string SelectMakeProgram(const std::string& makeProgram,
- const std::string& makeDefault = "") const;
+ std::string SelectMakeProgram(std::string const& makeProgram,
+ std::string const& makeDefault = "") const;
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
@@ -723,7 +727,7 @@ protected:
cmStateSnapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root,
- const cmGeneratorTarget* target) const;
+ cmGeneratorTarget const* target) const;
virtual void InitializeProgressMarks() {}
struct GlobalTargetInfo
@@ -736,6 +740,7 @@ protected:
bool UsesTerminal = false;
cmTarget::PerConfig PerConfig = cmTarget::PerConfig::Yes;
bool StdPipesUTF8 = false;
+ std::string Role;
};
void CreateDefaultGlobalTargets(std::vector<GlobalTargetInfo>& targets);
@@ -774,7 +779,8 @@ protected:
std::map<std::string, std::string> AliasTargets;
- cmTarget* FindTargetImpl(std::string const& name) const;
+ cmTarget* FindTargetImpl(std::string const& name,
+ cmStateEnums::TargetDomainSet domains) const;
cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const;
@@ -816,7 +822,6 @@ private:
std::map<std::string, std::string> LanguageToOutputExtension;
std::map<std::string, std::string> ExtensionToLanguage;
std::map<std::string, int> LanguageToLinkerPreference;
- std::map<std::string, std::string> LanguageToOriginalSharedLibFlags;
#if !defined(CMAKE_BOOTSTRAP)
std::unique_ptr<Json::StreamWriter> JsonWriter;
@@ -874,17 +879,17 @@ private:
void ClearGeneratorMembers();
- bool CheckCMP0037(std::string const& targetName,
- std::string const& reason) const;
- bool CheckCMP0037Prefix(std::string const& targetPrefix,
- std::string const& reason) const;
+ bool CheckReservedTargetName(std::string const& targetName,
+ std::string const& reason) const;
+ bool CheckReservedTargetNamePrefix(std::string const& targetPrefix,
+ std::string const& reason) const;
void IndexMakefile(cmMakefile* mf);
void IndexLocalGenerator(cmLocalGenerator* lg);
- virtual const char* GetBuildIgnoreErrorsFlag() const { return nullptr; }
+ virtual char const* GetBuildIgnoreErrorsFlag() const { return nullptr; }
- bool UnsupportedVariableIsDefined(const std::string& name,
+ bool UnsupportedVariableIsDefined(std::string const& name,
bool supported) const;
// Cache directory content and target files to be built.
@@ -899,8 +904,6 @@ private:
// Set of binary directories on disk.
std::set<std::string> BinaryDirectories;
- // track targets to issue CMP0042 warning for.
- std::set<std::string> CMP0042WarnTargets;
// track targets to issue CMP0068 warning for.
std::set<std::string> CMP0068WarnTargets;
@@ -917,6 +920,7 @@ private:
RuntimeDependencySetsByName;
std::vector<std::string> InstallScripts;
+ std::vector<std::string> TestFiles;
#if !defined(CMAKE_BOOTSTRAP)
// Pool of file locks
@@ -937,6 +941,5 @@ protected:
bool ForceUnixPaths;
bool ToolSupportsColor;
bool InstallTargetEnabled;
- bool ConfigureDoneCMP0026AndCMP0024;
bool AllowGlobalTargetCodegen;
};
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index b06da42..cd24420 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,14 +28,13 @@ public:
/** Create a GlobalGenerator */
virtual std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& n, bool allowArch, cmake* cm) const = 0;
+ std::string const& n, cmake* cm) const = 0;
/** Get the documentation entry for this factory */
virtual cmDocumentationEntry GetDocumentation() const = 0;
/** Get the names of the current registered generators */
virtual std::vector<std::string> GetGeneratorNames() const = 0;
- virtual std::vector<std::string> GetGeneratorNamesWithPlatform() const = 0;
/** Determine whether or not this generator supports toolsets */
virtual bool SupportsToolset() const = 0;
@@ -56,7 +55,7 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
public:
/** Create a GlobalGenerator */
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool /*allowArch*/, cmake* cm) const override
+ std::string const& name, cmake* cm) const override
{
if (name != T::GetActualName()) {
return std::unique_ptr<cmGlobalGenerator>();
@@ -75,10 +74,6 @@ public:
{
return { T::GetActualName() };
}
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- return {};
- }
/** Determine whether or not this generator supports toolsets */
bool SupportsToolset() const override { return T::SupportsToolset(); }
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 37bcc2c..1b52a11 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalGhsMultiGenerator.h"
#include <algorithm>
@@ -33,13 +33,13 @@
#include "cmVersion.h"
#include "cmake.h"
-const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
+char const* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
#ifdef __linux__
-const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild";
+char const* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild";
#elif defined(_WIN32)
-const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
+char const* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
#endif
-const char* cmGlobalGhsMultiGenerator::CHECK_BUILD_SYSTEM_TARGET =
+char const* cmGlobalGhsMultiGenerator::CHECK_BUILD_SYSTEM_TARGET =
"RERUN_CMAKE";
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
@@ -159,7 +159,7 @@ bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/)
}
void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsp,
- const std::string& ts)
+ std::string const& ts)
{
/* Determine tsp - full path of the toolset from ts (toolset hint via -T) */
@@ -466,10 +466,10 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject(
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalGhsMultiGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& /*config*/, int jobs, bool verbose,
- const cmBuildOptions& /*buildOptions*/,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& /*config*/, int jobs, bool verbose,
+ cmBuildOptions const& /*buildOptions*/,
std::vector<std::string> const& makeOptions)
{
GeneratedMakeCommand makeCommand;
@@ -497,7 +497,7 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand(
/* determine targets to build */
bool build_all = false;
if (!targetNames.empty()) {
- for (const auto& tname : targetNames) {
+ for (auto const& tname : targetNames) {
if (!tname.empty()) {
if (tname == "clean") {
makeCommand.Add("-clean");
@@ -604,7 +604,7 @@ bool cmGlobalGhsMultiGenerator::ComputeTargetBuildOrder(
std::set<cmGeneratorTarget const*> temp;
std::set<cmGeneratorTarget const*> perm;
- for (const auto* const ti : tgt) {
+ for (auto const* const ti : tgt) {
bool r = this->VisitTarget(temp, perm, build, ti);
if (r) {
return r;
@@ -665,7 +665,7 @@ bool cmGlobalGhsMultiGenerator::AddCheckTarget()
// Collect the input files used to generate all targets in this
// project.
std::vector<std::string> listFiles;
- for (const auto& gen : generators) {
+ for (auto const& gen : generators) {
cm::append(listFiles, gen->GetMakefile()->GetListFiles());
}
@@ -761,7 +761,7 @@ void cmGlobalGhsMultiGenerator::AddAllTarget()
// Now make all targets depend on the ALL_BUILD target
for (cmLocalGenerator const* i : gen) {
- for (const auto& tgt : i->GetGeneratorTargets()) {
+ for (auto const& tgt : i->GetGeneratorTargets()) {
// Skip global or imported targets
if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
tgt->IsImported()) {
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 4a79610..c0bc7be 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -23,7 +23,7 @@ class cmGlobalGhsMultiGenerator : public cmGlobalGenerator
{
public:
// The default filename extension of GHS MULTI's build files.
- static const char* FILE_EXTENSION;
+ static char const* FILE_EXTENSION;
cmGlobalGhsMultiGenerator(cmake* cm);
~cmGlobalGhsMultiGenerator() override;
@@ -83,16 +83,16 @@ public:
protected:
void Generate() override;
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
void AddExtraIDETargets() override;
private:
- void GetToolset(cmMakefile* mf, std::string& tsd, const std::string& ts);
+ void GetToolset(cmMakefile* mf, std::string& tsd, std::string const& ts);
/* top-level project */
void OutputTopLevelProject(cmLocalGenerator* root,
@@ -112,8 +112,8 @@ private:
std::string StampFile;
static std::string TrimQuotes(std::string str);
- static const char* DEFAULT_BUILD_PROGRAM;
- static const char* CHECK_BUILD_SYSTEM_TARGET;
+ static char const* DEFAULT_BUILD_PROGRAM;
+ static char const* CHECK_BUILD_SYSTEM_TARGET;
bool ComputeTargetBuildOrder(cmGeneratorTarget const* tgt,
std::vector<cmGeneratorTarget const*>& build);
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index 44980d6..a918ee0 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalJOMMakefileGenerator.h"
#include <ostream>
@@ -60,10 +60,10 @@ void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os,
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalJOMMakefileGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions,
std::vector<std::string> const& makeOptions)
{
std::vector<std::string> jomMakeOptions;
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index cd3ed33..b89c22f 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -51,10 +51,10 @@ public:
protected:
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 26b30fd..a7641f7 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalMSYSMakefileGenerator.h"
#include <cmext/string_view>
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index ee9a4ee..5529092 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index a0a52d3..e6687ce 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalMinGWMakefileGenerator.h"
#include "cmMakefile.h"
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
index 7dd968b..edfceb5 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.h
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 424c4bd..8209709 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalNMakeMakefileGenerator.h"
#include <ostream>
@@ -103,10 +103,10 @@ void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalNMakeMakefileGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int /*jobs*/, bool verbose,
- const cmBuildOptions& buildOptions,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int /*jobs*/, bool verbose,
+ cmBuildOptions const& buildOptions,
std::vector<std::string> const& makeOptions)
{
std::vector<std::string> nmakeMakeOptions;
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index eafab83..0589f2b 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -58,10 +58,10 @@ public:
protected:
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 2933a4f..2b37abe 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalNinjaGenerator.h"
#include <algorithm>
@@ -7,11 +7,11 @@
#include <cctype>
#include <cstdio>
#include <functional>
+#include <iterator>
#include <sstream>
#include <type_traits>
#include <utility>
-#include <cm/iterator>
#include <cm/memory>
#include <cm/optional>
#include <cm/string_view>
@@ -30,9 +30,9 @@
#include "cmDyndepCollation.h"
#include "cmFortranParser.h"
#include "cmGeneratedFileStream.h"
-#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmInstrumentation.h"
#include "cmLinkLineComputer.h"
#include "cmList.h"
#include "cmListFileCache.h"
@@ -57,10 +57,10 @@
#include "cmVersion.h"
#include "cmake.h"
-const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
-const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE =
+char const* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
+char const* cmGlobalNinjaGenerator::NINJA_RULES_FILE =
"CMakeFiles/rules.ninja";
-const char* cmGlobalNinjaGenerator::INDENT = " ";
+char const* cmGlobalNinjaGenerator::INDENT = " ";
#ifdef _WIN32
std::string const cmGlobalNinjaGenerator::SHELL_NOOP = "cd .";
#else
@@ -81,23 +81,23 @@ bool DetectGCCOnWindows(cm::string_view compilerId, cm::string_view simulateId,
}
bool operator==(
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& lhs,
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& rhs)
{
return lhs.Target == rhs.Target && lhs.Config == rhs.Config &&
lhs.GenexOutput == rhs.GenexOutput;
}
bool operator!=(
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& lhs,
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& rhs)
{
return !(lhs == rhs);
}
bool operator<(
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& lhs,
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& rhs)
{
return lhs.Target < rhs.Target ||
(lhs.Target == rhs.Target &&
@@ -106,22 +106,22 @@ bool operator<(
}
bool operator>(
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& lhs,
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& rhs)
{
return rhs < lhs;
}
bool operator<=(
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& lhs,
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& rhs)
{
return !(lhs > rhs);
}
bool operator>=(
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
- const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& lhs,
+ cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey const& rhs)
{
return rhs <= lhs;
}
@@ -140,7 +140,7 @@ void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os)
}
void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
- const std::string& comment)
+ std::string const& comment)
{
if (comment.empty()) {
return;
@@ -184,12 +184,6 @@ std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
return encoded;
}
-std::string cmGlobalNinjaGenerator::GetEncodedLiteral(const std::string& lit)
-{
- std::string result = lit;
- return this->EncodeLiteral(result);
-}
-
std::string& cmGlobalNinjaGenerator::EncodeLiteral(std::string& lit)
{
cmSystemTools::ReplaceString(lit, "$", "$$");
@@ -201,7 +195,7 @@ std::string& cmGlobalNinjaGenerator::EncodeLiteral(std::string& lit)
return lit;
}
-std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path)
+std::string cmGlobalNinjaGenerator::EncodePath(std::string const& path)
{
std::string result = path;
#ifdef _WIN32
@@ -243,9 +237,6 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
// Write explicit outputs
for (std::string const& output : build.Outputs) {
buildStr = cmStrCat(buildStr, ' ', this->EncodePath(output));
- if (this->ComputingUnknownDependencies) {
- this->CombinedBuildOutputs.insert(output);
- }
}
// Write implicit outputs
if (!build.ImplicitOuts.empty()) {
@@ -254,9 +245,6 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
buildStr = cmStrCat(buildStr, " |");
for (std::string const& implicitOut : build.ImplicitOuts) {
buildStr = cmStrCat(buildStr, ' ', this->EncodePath(implicitOut));
- if (this->ComputingUnknownDependencies) {
- this->CombinedBuildOutputs.insert(implicitOut);
- }
}
}
@@ -371,14 +359,6 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
{
this->AddCustomCommandRule();
- if (this->ComputingUnknownDependencies) {
- // we need to track every dependency that comes in, since we are trying
- // to find dependencies that are side effects of build commands
- for (std::string const& dep : explicitDeps) {
- this->CombinedCustomCommandExplicitDependencies.insert(dep);
- }
- }
-
{
std::string ninjaDepfilePath;
bool depfileIsOutput = false;
@@ -443,7 +423,7 @@ void cmGlobalNinjaGenerator::AddMacOSXContentRule()
void cmGlobalNinjaGenerator::WriteMacOSXContentBuild(std::string input,
std::string output,
- const std::string& config)
+ std::string const& config)
{
this->AddMacOSXContentRule();
{
@@ -487,7 +467,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
os << "rule " << rule.Name << '\n';
// Write rule key/value pairs
- auto writeKV = [&os](const char* key, std::string const& value) {
+ auto writeKV = [&os](char const* key, std::string const& value) {
if (!value.empty()) {
cmGlobalNinjaGenerator::Indent(os, 1);
os << key << " = " << value << '\n';
@@ -512,9 +492,9 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
}
void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os,
- const std::string& name,
- const std::string& value,
- const std::string& comment,
+ std::string const& name,
+ std::string const& value,
+ std::string const& comment,
int indent)
{
// Make sure we have a name.
@@ -547,16 +527,16 @@ void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os,
}
void cmGlobalNinjaGenerator::WriteInclude(std::ostream& os,
- const std::string& filename,
- const std::string& comment)
+ std::string const& filename,
+ std::string const& comment)
{
cmGlobalNinjaGenerator::WriteComment(os, comment);
os << "include " << filename << "\n";
}
void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
- const cmNinjaDeps& targets,
- const std::string& comment)
+ cmNinjaDeps const& targets,
+ std::string const& comment)
{
cmGlobalNinjaGenerator::WriteComment(os, comment);
os << "default";
@@ -641,19 +621,11 @@ void cmGlobalNinjaGenerator::Generate()
this->ClangTidyExportFixesDirs.clear();
this->ClangTidyExportFixesFiles.clear();
- this->PolicyCMP0058 =
- this->LocalGenerators[0]->GetMakefile()->GetPolicyStatus(
- cmPolicies::CMP0058);
- this->ComputingUnknownDependencies =
- (this->PolicyCMP0058 == cmPolicies::OLD ||
- this->PolicyCMP0058 == cmPolicies::WARN);
-
this->cmGlobalGenerator::Generate();
this->WriteAssumedSourceDependencies();
this->WriteTargetAliases(*this->GetCommonFileStream());
this->WriteFolderTargets(*this->GetCommonFileStream());
- this->WriteUnknownExplicitDependencies(*this->GetCommonFileStream());
this->WriteBuiltinTargets(*this->GetCommonFileStream());
if (cmSystemTools::GetErrorOccurredFlag()) {
@@ -685,6 +657,7 @@ void cmGlobalNinjaGenerator::Generate()
void cmGlobalNinjaGenerator::CleanMetaData()
{
+ constexpr size_t ninja_tool_arg_size = 8; // 2 `-_` flags and 4 separators
auto run_ninja_tool = [this](std::vector<char const*> const& args) {
std::vector<std::string> command;
command.push_back(this->NinjaCommand);
@@ -727,19 +700,28 @@ void cmGlobalNinjaGenerator::CleanMetaData()
run_ninja_tool({ "recompact" });
}
if (this->NinjaSupportsRestatTool && this->OutputPathPrefix.empty()) {
- // XXX(ninja): We only list `build.ninja` entry files here because CMake
- // *always* rewrites these files on a reconfigure. If CMake ever gets
- // smarter about this, all CMake-time created/edited files listed as
- // outputs for the reconfigure build statement will need to be listed here.
cmNinjaDeps outputs;
this->AddRebuildManifestOutputs(outputs);
- std::vector<const char*> args;
- args.reserve(outputs.size() + 1);
- args.push_back("restat");
- for (auto const& output : outputs) {
- args.push_back(output.c_str());
+ auto output_it = outputs.begin();
+ size_t static_arg_size = ninja_tool_arg_size + this->NinjaCommand.size() +
+ this->GetCMakeInstance()->GetHomeOutputDirectory().size();
+ // The Windows command-line length limit is 32768, but if `ninja` is
+ // wrapped by a `.bat` file, the limit is 8192. Leave plenty.
+ constexpr size_t maximum_arg_size = 8000;
+ while (output_it != outputs.end()) {
+ size_t total_arg_size = static_arg_size;
+ std::vector<char const*> args;
+ args.reserve(std::distance(output_it, outputs.end()) + 1);
+ args.push_back("restat");
+ total_arg_size += 7; // restat + 1
+ while (output_it != outputs.end() &&
+ total_arg_size + output_it->size() + 1 < maximum_arg_size) {
+ args.push_back(output_it->c_str());
+ total_arg_size += output_it->size() + 1;
+ ++output_it;
+ }
+ run_ninja_tool(args);
}
- run_ninja_tool(args);
}
}
@@ -799,7 +781,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
static std::string const k_DYNDEP_ = ".dyndep-";
std::string::size_type pos = this->NinjaVersion.find(k_DYNDEP_);
if (pos != std::string::npos) {
- const char* fv = &this->NinjaVersion[pos + k_DYNDEP_.size()];
+ char const* fv = &this->NinjaVersion[pos + k_DYNDEP_.size()];
unsigned long dyndep = 0;
cmStrToULong(fv, &dyndep);
if (dyndep == 1) {
@@ -890,7 +872,7 @@ bool cmGlobalNinjaGenerator::CheckLanguages(
return this->CheckISPC(mf);
}
if (cm::contains(languages, "Swift")) {
- const std::string architectures =
+ std::string const architectures =
mf->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
if (architectures.find_first_of(';') != std::string::npos) {
mf->IssueMessage(MessageType::FATAL_ERROR,
@@ -1008,10 +990,10 @@ void cmGlobalNinjaGenerator::EnableLanguage(
// cmGlobalGenerator::Build()
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalNinjaGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& /*projectName*/,
- const std::string& /*projectDir*/,
- std::vector<std::string> const& targetNames, const std::string& config,
- int jobs, bool verbose, const cmBuildOptions& /*buildOptions*/,
+ std::string const& makeProgram, std::string const& /*projectName*/,
+ std::string const& /*projectDir*/,
+ std::vector<std::string> const& targetNames, std::string const& config,
+ int jobs, bool verbose, cmBuildOptions const& /*buildOptions*/,
std::vector<std::string> const& makeOptions)
{
GeneratedMakeCommand makeCommand;
@@ -1029,7 +1011,7 @@ cmGlobalNinjaGenerator::GenerateBuildCommand(
this->AppendNinjaFileArgument(makeCommand, config);
makeCommand.Add(makeOptions.begin(), makeOptions.end());
- for (const auto& tname : targetNames) {
+ for (auto const& tname : targetNames) {
if (!tname.empty()) {
makeCommand.Add(tname);
}
@@ -1051,7 +1033,7 @@ void cmGlobalNinjaGenerator::AddRule(cmNinjaRule const& rule)
cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream, rule);
}
-bool cmGlobalNinjaGenerator::HasRule(const std::string& name)
+bool cmGlobalNinjaGenerator::HasRule(std::string const& name)
{
return (this->Rules.find(name) != this->Rules.end());
}
@@ -1086,7 +1068,7 @@ bool cmGlobalNinjaGenerator::OpenBuildFileStreams()
}
bool cmGlobalNinjaGenerator::OpenFileStream(
- std::unique_ptr<cmGeneratedFileStream>& stream, const std::string& name)
+ std::unique_ptr<cmGeneratedFileStream>& stream, std::string const& name)
{
// Get a stream where to generate things.
if (!stream) {
@@ -1109,8 +1091,8 @@ bool cmGlobalNinjaGenerator::OpenFileStream(
}
cm::optional<std::set<std::string>> cmGlobalNinjaGenerator::ListSubsetWithAll(
- const std::set<std::string>& all, const std::set<std::string>& defaults,
- const std::vector<std::string>& items)
+ std::set<std::string> const& all, std::set<std::string> const& defaults,
+ std::vector<std::string> const& items)
{
std::set<std::string> result;
@@ -1185,7 +1167,7 @@ static void EnsureTrailingSlash(std::string& path)
}
std::string const& cmGlobalNinjaGenerator::ConvertToNinjaPath(
- const std::string& path) const
+ std::string const& path) const
{
auto const f = this->ConvertToNinjaPathCache.find(path);
if (f != this->ConvertToNinjaPathCache.end()) {
@@ -1212,14 +1194,14 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaAbsPath(
}
void cmGlobalNinjaGenerator::AddAdditionalCleanFile(std::string fileName,
- const std::string& config)
+ std::string const& config)
{
this->Configs[config].AdditionalCleanFiles.emplace(std::move(fileName));
}
void cmGlobalNinjaGenerator::AddCXXCompileCommand(
- const std::string& commandLine, const std::string& sourceFile,
- const std::string& objPath)
+ std::string const& commandLine, std::string const& sourceFile,
+ std::string const& objPath)
{
// Compute Ninja's build file path.
std::string buildFileDir =
@@ -1227,10 +1209,6 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
if (!this->CompileCommandsStream) {
std::string buildFilePath =
cmStrCat(buildFileDir, "/compile_commands.json");
- if (this->ComputingUnknownDependencies) {
- this->CombinedBuildOutputs.insert(
- this->NinjaOutputPath("compile_commands.json"));
- }
// Get a stream where to generate things.
this->CompileCommandsStream =
@@ -1295,13 +1273,13 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
}
std::string cmGlobalNinjaGenerator::OrderDependsTargetForTarget(
- cmGeneratorTarget const* target, const std::string& /*config*/) const
+ cmGeneratorTarget const* target, std::string const& /*config*/) const
{
return cmStrCat("cmake_object_order_depends_target_", target->GetName());
}
std::string cmGlobalNinjaGenerator::OrderDependsTargetForTargetPrivate(
- cmGeneratorTarget const* target, const std::string& config) const
+ cmGeneratorTarget const* target, std::string const& config) const
{
return cmStrCat(this->OrderDependsTargetForTarget(target, config),
"_private");
@@ -1309,7 +1287,7 @@ std::string cmGlobalNinjaGenerator::OrderDependsTargetForTargetPrivate(
void cmGlobalNinjaGenerator::AppendTargetOutputs(
cmGeneratorTarget const* target, cmNinjaDeps& outputs,
- const std::string& config, cmNinjaTargetDepends depends) const
+ std::string const& config, cmNinjaTargetDepends depends) const
{
// for frameworks, we want the real name, not sample name
// frameworks always appear versioned, and the build.ninja
@@ -1364,7 +1342,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
void cmGlobalNinjaGenerator::AppendTargetDepends(
cmGeneratorTarget const* target, cmNinjaDeps& outputs,
- const std::string& config, const std::string& fileConfig,
+ std::string const& config, std::string const& fileConfig,
cmNinjaTargetDepends depends)
{
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
@@ -1382,7 +1360,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
auto computeISPCOutputs = [](cmGlobalNinjaGenerator* gg,
cmGeneratorTarget const* depTarget,
cmNinjaDeps& outputDeps,
- const std::string& targetConfig) {
+ std::string const& targetConfig) {
if (depTarget->CanCompileSources()) {
auto headers = depTarget->GetGeneratedISPCHeaders(targetConfig);
if (!headers.empty()) {
@@ -1419,7 +1397,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
cmGeneratorTarget const* target, std::unordered_set<std::string>& outputs,
- const std::string& config, const std::string& fileConfig, bool genexOutput,
+ std::string const& config, std::string const& fileConfig, bool genexOutput,
bool omit_self)
{
@@ -1478,9 +1456,9 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
outputs.insert(outs.begin(), outs.end());
}
-void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
+void cmGlobalNinjaGenerator::AddTargetAlias(std::string const& alias,
cmGeneratorTarget* target,
- const std::string& config)
+ std::string const& config)
{
std::string outputPath = this->NinjaOutputPath(alias);
std::string buildAlias = this->BuildAlias(outputPath, config);
@@ -1779,128 +1757,6 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
}
}
-void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
-{
- if (!this->ComputingUnknownDependencies) {
- return;
- }
-
- // We need to collect the set of known build outputs.
- // Start with those generated by WriteBuild calls.
- // No other method needs this so we can take ownership
- // of the set locally and throw it out when we are done.
- std::set<std::string> knownDependencies;
- knownDependencies.swap(this->CombinedBuildOutputs);
-
- // now write out the unknown explicit dependencies.
-
- // union the configured files, evaluations files and the
- // CombinedBuildOutputs,
- // and then difference with CombinedExplicitDependencies to find the explicit
- // dependencies that we have no rule for
-
- cmGlobalNinjaGenerator::WriteDivider(os);
- /* clang-format off */
- os << "# Unknown Build Time Dependencies.\n"
- << "# Tell Ninja that they may appear as side effects of build rules\n"
- << "# otherwise ordered by order-only dependencies.\n\n";
- /* clang-format on */
-
- // get the list of files that cmake itself has generated as a
- // product of configuration.
-
- for (const auto& lg : this->LocalGenerators) {
- // get the vector of files created by this makefile and convert them
- // to ninja paths, which are all relative in respect to the build directory
- for (std::string const& file : lg->GetMakefile()->GetOutputFiles()) {
- knownDependencies.insert(this->ConvertToNinjaPath(file));
- }
- if (!this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION")) {
- // get list files which are implicit dependencies as well and will be
- // phony for rebuild manifest
- for (std::string const& j : lg->GetMakefile()->GetListFiles()) {
- knownDependencies.insert(this->ConvertToNinjaPath(j));
- }
- }
- for (const auto& li : lg->GetMakefile()->GetEvaluationFiles()) {
- // get all the files created by generator expressions and convert them
- // to ninja paths
- for (std::string const& evaluationFile : li->GetFiles()) {
- knownDependencies.insert(this->ConvertToNinjaPath(evaluationFile));
- }
- }
- }
- knownDependencies.insert(this->CMakeCacheFile);
-
- for (auto const& ta : this->TargetAliases) {
- knownDependencies.insert(this->ConvertToNinjaPath(ta.first));
- }
-
- // remove all source files we know will exist.
- for (auto const& i : this->AssumedSourceDependencies) {
- knownDependencies.insert(this->ConvertToNinjaPath(i.first));
- }
-
- // now we difference with CombinedCustomCommandExplicitDependencies to find
- // the list of items we know nothing about.
- // We have encoded all the paths in CombinedCustomCommandExplicitDependencies
- // and knownDependencies so no matter if unix or windows paths they
- // should all match now.
-
- std::vector<std::string> unknownExplicitDepends;
- this->CombinedCustomCommandExplicitDependencies.erase(this->TargetAll);
-
- std::set_difference(this->CombinedCustomCommandExplicitDependencies.begin(),
- this->CombinedCustomCommandExplicitDependencies.end(),
- knownDependencies.begin(), knownDependencies.end(),
- std::back_inserter(unknownExplicitDepends));
-
- std::vector<std::string> warnExplicitDepends;
- if (!unknownExplicitDepends.empty()) {
- cmake* cmk = this->GetCMakeInstance();
- std::string const& buildRoot = cmk->GetHomeOutputDirectory();
- bool const inSource = (buildRoot == cmk->GetHomeDirectory());
- bool const warn = (!inSource && (this->PolicyCMP0058 == cmPolicies::WARN));
- cmNinjaBuild build("phony");
- build.Outputs.emplace_back("");
- for (std::string const& ued : unknownExplicitDepends) {
- // verify the file is in the build directory
- std::string const absDepPath =
- cmSystemTools::CollapseFullPath(ued, buildRoot);
- if (cmSystemTools::IsSubDirectory(absDepPath, buildRoot)) {
- // Generate phony build statement
- build.Outputs[0] = ued;
- this->WriteBuild(os, build);
- // Add to warning on demand
- if (warn && warnExplicitDepends.size() < 10) {
- warnExplicitDepends.push_back(ued);
- }
- }
- }
- }
-
- if (!warnExplicitDepends.empty()) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n"
- "This project specifies custom command DEPENDS on files "
- "in the build tree that are not specified as the OUTPUT or "
- "BYPRODUCTS of any add_custom_command or add_custom_target:\n"
- " " << cmJoin(warnExplicitDepends, "\n ") <<
- "\n"
- "For compatibility with versions of CMake that did not have "
- "the BYPRODUCTS option, CMake is generating phony rules for "
- "such files to convince 'ninja' to build."
- "\n"
- "Project authors should add the missing BYPRODUCTS or OUTPUT "
- "options to the custom commands that produce these files."
- ;
- /* clang-format on */
- this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
- w.str());
- }
-}
-
void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
{
// Write headers.
@@ -1910,6 +1766,14 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
this->WriteTargetRebuildManifest(os);
this->WriteTargetClean(os);
this->WriteTargetHelp(os);
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+ // FIXME(#26668) This does not work on Windows
+ if (this->GetCMakeInstance()
+ ->GetInstrumentation()
+ ->HasPreOrPostBuildHook()) {
+ this->WriteTargetInstrument(os);
+ }
+#endif
for (std::string const& config : this->GetConfigNames()) {
this->WriteTargetDefault(*this->GetConfigFileStream(config));
@@ -1952,13 +1816,15 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
}
cmake* cm = this->GetCMakeInstance();
- const auto& lg = this->LocalGenerators[0];
+ auto const& lg = this->LocalGenerators[0];
{
cmNinjaRule rule("RERUN_CMAKE");
rule.Command = cmStrCat(
this->CMakeCmd(), " --regenerate-during-build",
- cm->GetIgnoreWarningAsError() ? " --compile-no-warning-as-error" : "",
+ cm->GetIgnoreCompileWarningAsError() ? " --compile-no-warning-as-error"
+ : "",
+ cm->GetIgnoreLinkWarningAsError() ? " --link-no-warning-as-error" : "",
" -S",
lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
cmOutputConverter::SHELL),
@@ -1975,13 +1841,22 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
reBuild.Comment = "Re-run CMake if any of its inputs changed.";
this->AddRebuildManifestOutputs(reBuild.Outputs);
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
for (std::string const& fi : localGen->GetMakefile()->GetListFiles()) {
reBuild.ImplicitDeps.push_back(this->ConvertToNinjaPath(fi));
}
}
reBuild.ImplicitDeps.push_back(this->CMakeCacheFile);
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+ // FIXME(#26668) This does not work on Windows
+ if (this->GetCMakeInstance()
+ ->GetInstrumentation()
+ ->HasPreOrPostBuildHook()) {
+ reBuild.ExplicitDeps.push_back(this->NinjaOutputPath("start_instrument"));
+ }
+#endif
+
// Use 'console' pool to get non buffered output of the CMake re-run call
// Available since Ninja 1.5
if (this->SupportsDirectConsole()) {
@@ -2062,14 +1937,14 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
std::string cmGlobalNinjaGenerator::CMakeCmd() const
{
- const auto& lgen = this->LocalGenerators.at(0);
+ auto const& lgen = this->LocalGenerators.at(0);
return lgen->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
cmOutputConverter::SHELL);
}
std::string cmGlobalNinjaGenerator::NinjaCmd() const
{
- const auto& lgen = this->LocalGenerators[0];
+ auto const& lgen = this->LocalGenerators[0];
if (lgen) {
return lgen->ConvertToOutputFormat(this->NinjaCommand,
cmOutputConverter::SHELL);
@@ -2104,7 +1979,7 @@ bool cmGlobalNinjaGenerator::SupportsCWDDepend() const
bool cmGlobalNinjaGenerator::WriteTargetCleanAdditional(std::ostream& os)
{
- const auto& lgr = this->LocalGenerators.at(0);
+ auto const& lgr = this->LocalGenerators.at(0);
std::string cleanScriptRel = "CMakeFiles/clean_additional.cmake";
std::string cleanScriptAbs =
cmStrCat(lgr->GetBinaryDirectory(), '/', cleanScriptRel);
@@ -2327,6 +2202,43 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
}
}
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+// FIXME(#26668) This does not work on Windows
+void cmGlobalNinjaGenerator::WriteTargetInstrument(std::ostream& os)
+{
+ // Write rule
+ {
+ cmNinjaRule rule("START_INSTRUMENT");
+ rule.Command = cmStrCat(
+ "\"", cmSystemTools::GetCTestCommand(), "\" --start-instrumentation \"",
+ this->GetCMakeInstance()->GetHomeOutputDirectory(), "\"");
+ /*
+ * On Unix systems, Ninja will prefix the command with `/bin/sh -c`.
+ * Use exec so that Ninja is the parent process of the command.
+ */
+ rule.Command = cmStrCat("exec ", rule.Command);
+ rule.Description = "Collecting build metrics";
+ rule.Comment = "Rule to initialize instrumentation daemon.";
+ rule.Restat = "1";
+ WriteRule(*this->RulesFileStream, rule);
+ }
+
+ // Write build
+ {
+ cmNinjaBuild phony("phony");
+ phony.Comment = "Phony target to keep START_INSTRUMENTATION out of date.";
+ phony.Outputs.push_back(this->NinjaOutputPath("CMakeFiles/instrument"));
+ cmNinjaBuild instrument("START_INSTRUMENT");
+ instrument.Comment = "Start instrumentation daemon.";
+ instrument.Outputs.push_back(this->NinjaOutputPath("start_instrument"));
+ instrument.ExplicitDeps.push_back(
+ this->NinjaOutputPath("CMakeFiles/instrument"));
+ WriteBuild(os, phony);
+ WriteBuild(os, instrument);
+ }
+}
+#endif
+
void cmGlobalNinjaGenerator::InitOutputPathPrefix()
{
this->OutputPathPrefix =
@@ -3128,8 +3040,8 @@ bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const
}
void cmGlobalNinjaGenerator::AppendDirectoryForConfig(
- const std::string& prefix, const std::string& config,
- const std::string& suffix, std::string& dir)
+ std::string const& prefix, std::string const& config,
+ std::string const& suffix, std::string& dir)
{
if (!config.empty() && this->IsMultiConfig()) {
dir += cmStrCat(prefix, config, suffix);
@@ -3137,7 +3049,7 @@ void cmGlobalNinjaGenerator::AppendDirectoryForConfig(
}
std::set<std::string> cmGlobalNinjaGenerator::GetCrossConfigs(
- const std::string& fileConfig) const
+ std::string const& fileConfig) const
{
auto result = this->CrossConfigs;
result.insert(fileConfig);
@@ -3156,9 +3068,9 @@ std::string cmGlobalNinjaGenerator::ConvertToOutputPath(std::string path) const
return this->ConvertToNinjaPath(path);
}
-const char* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE =
+char const* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE =
"CMakeFiles/common.ninja";
-const char* cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION = ".ninja";
+char const* cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION = ".ninja";
cmGlobalNinjaMultiGenerator::cmGlobalNinjaMultiGenerator(cmake* cm)
: cmGlobalNinjaGenerator(cm)
@@ -3174,7 +3086,7 @@ cmDocumentationEntry cmGlobalNinjaMultiGenerator::GetDocumentation()
}
std::string cmGlobalNinjaMultiGenerator::ExpandCFGIntDir(
- const std::string& str, const std::string& config) const
+ std::string const& str, std::string const& config) const
{
std::string result = str;
cmSystemTools::ReplaceString(result, this->GetCMakeCFGIntDir(), config);
@@ -3263,7 +3175,7 @@ void cmGlobalNinjaMultiGenerator::CloseBuildFileStreams()
}
void cmGlobalNinjaMultiGenerator::AppendNinjaFileArgument(
- GeneratedMakeCommand& command, const std::string& config) const
+ GeneratedMakeCommand& command, std::string const& config) const
{
if (!config.empty()) {
command.Add("-f");
@@ -3272,14 +3184,14 @@ void cmGlobalNinjaMultiGenerator::AppendNinjaFileArgument(
}
std::string cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(
- const std::string& config)
+ std::string const& config)
{
return cmStrCat("CMakeFiles/impl-", config,
cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION);
}
std::string cmGlobalNinjaMultiGenerator::GetNinjaConfigFilename(
- const std::string& config)
+ std::string const& config)
{
return cmStrCat("build-", config,
cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION);
@@ -3295,6 +3207,7 @@ void cmGlobalNinjaMultiGenerator::AddRebuildManifestOutputs(
if (!this->DefaultFileConfig.empty()) {
outputs.push_back(this->NinjaOutputPath(NINJA_BUILD_FILE));
}
+ this->AddCMakeFilesToRebuild(outputs);
}
void cmGlobalNinjaMultiGenerator::GetQtAutoGenConfigs(
@@ -3379,7 +3292,7 @@ std::string cmGlobalNinjaMultiGenerator::GetDefaultBuildConfig() const
}
std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTarget(
- cmGeneratorTarget const* target, const std::string& config) const
+ cmGeneratorTarget const* target, std::string const& config) const
{
return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_',
cmSystemTools::UpperCase(config));
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 69b2361..7e02541 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,7 +23,6 @@
#include "cmGlobalCommonGenerator.h"
#include "cmGlobalGeneratorFactory.h"
#include "cmNinjaTypes.h"
-#include "cmPolicies.h"
#include "cmStringAlgorithms.h"
#include "cmTransformDepfile.h"
@@ -58,14 +57,14 @@ class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator
{
public:
/// The default name of Ninja's build file. Typically: build.ninja.
- static const char* NINJA_BUILD_FILE;
+ static char const* NINJA_BUILD_FILE;
/// The default name of Ninja's rules file. Typically: rules.ninja.
/// It is included in the main build.ninja file.
- static const char* NINJA_RULES_FILE;
+ static char const* NINJA_RULES_FILE;
/// The indentation string used when generating Ninja's build file.
- static const char* INDENT;
+ static char const* INDENT;
/// The shell command used for a no-op.
static std::string const SHELL_NOOP;
@@ -78,8 +77,7 @@ public:
static std::string EncodeRuleName(std::string const& name);
std::string& EncodeLiteral(std::string& lit) override;
- std::string GetEncodedLiteral(const std::string& lit);
- std::string EncodePath(const std::string& path);
+ std::string EncodePath(std::string const& path);
std::unique_ptr<cmLinkLineComputer> CreateLinkLineComputer(
cmOutputConverter* outputConverter,
@@ -89,7 +87,7 @@ public:
* Write the given @a comment to the output stream @a os. It
* handles new line character properly.
*/
- static void WriteComment(std::ostream& os, const std::string& comment);
+ static void WriteComment(std::ostream& os, std::string const& comment);
/**
* Utilized by the generator factory to determine if this generator
@@ -137,7 +135,7 @@ public:
cmNinjaDeps orderOnlyDeps = cmNinjaDeps());
void WriteMacOSXContentBuild(std::string input, std::string output,
- const std::string& config);
+ std::string const& config);
/**
* Write a rule statement to @a os.
@@ -150,23 +148,23 @@ public:
* optional @a comment. An @a indent level can be specified.
* @warning no escaping of any kind is done here.
*/
- static void WriteVariable(std::ostream& os, const std::string& name,
- const std::string& value,
- const std::string& comment = "", int indent = 0);
+ static void WriteVariable(std::ostream& os, std::string const& name,
+ std::string const& value,
+ std::string const& comment = "", int indent = 0);
/**
* Write an include statement including @a filename with an optional
* @a comment to the @a os stream.
*/
- static void WriteInclude(std::ostream& os, const std::string& filename,
- const std::string& comment = "");
+ static void WriteInclude(std::ostream& os, std::string const& filename,
+ std::string const& comment = "");
/**
* Write a default target statement specifying @a targets as
* the default targets.
*/
- static void WriteDefault(std::ostream& os, const cmNinjaDeps& targets,
- const std::string& comment = "");
+ static void WriteDefault(std::ostream& os, cmNinjaDeps const& targets,
+ std::string const& comment = "");
bool IsGCCOnWindows() const { return this->UsingGCCOnWindows; }
void MarkAsGCCOnWindows() { this->UsingGCCOnWindows = true; }
@@ -200,39 +198,39 @@ public:
cmMakefile* mf, bool optional) override;
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
// Setup target names
- const char* GetAllTargetName() const override { return "all"; }
- const char* GetInstallTargetName() const override { return "install"; }
- const char* GetInstallLocalTargetName() const override
+ char const* GetAllTargetName() const override { return "all"; }
+ char const* GetInstallTargetName() const override { return "install"; }
+ char const* GetInstallLocalTargetName() const override
{
return "install/local";
}
- const char* GetInstallStripTargetName() const override
+ char const* GetInstallStripTargetName() const override
{
return "install/strip";
}
- const char* GetInstallParallelTargetName() const
+ char const* GetInstallParallelTargetName() const
{
return "install/parallel";
}
- const char* GetTestTargetName() const override { return "test"; }
- const char* GetPackageTargetName() const override { return "package"; }
- const char* GetPackageSourceTargetName() const override
+ char const* GetTestTargetName() const override { return "test"; }
+ char const* GetPackageTargetName() const override { return "package"; }
+ char const* GetPackageSourceTargetName() const override
{
return "package_source";
}
- const char* GetRebuildCacheTargetName() const override
+ char const* GetRebuildCacheTargetName() const override
{
return "rebuild_cache";
}
- const char* GetCleanTargetName() const override { return "clean"; }
+ char const* GetCleanTargetName() const override { return "clean"; }
bool SupportsCustomCommandDepfile() const override { return true; }
cm::optional<cmDepfileFormat> DepfileFormat() const override
@@ -243,13 +241,13 @@ public:
bool SupportsLinkerDependencyFile() const override { return true; }
virtual cmGeneratedFileStream* GetImplFileStream(
- const std::string& /*config*/) const
+ std::string const& /*config*/) const
{
return this->BuildFileStream.get();
}
virtual cmGeneratedFileStream* GetConfigFileStream(
- const std::string& /*config*/) const
+ std::string const& /*config*/) const
{
return this->BuildFileStream.get();
}
@@ -269,7 +267,7 @@ public:
return this->RulesFileStream.get();
}
- std::string const& ConvertToNinjaPath(const std::string& path) const;
+ std::string const& ConvertToNinjaPath(std::string const& path) const;
std::string ConvertToNinjaAbsPath(std::string path) const;
struct MapToNinjaPathImpl
@@ -291,20 +289,20 @@ public:
#endif
// -- Additional clean files
- void AddAdditionalCleanFile(std::string fileName, const std::string& config);
- const char* GetAdditionalCleanTargetName() const
+ void AddAdditionalCleanFile(std::string fileName, std::string const& config);
+ char const* GetAdditionalCleanTargetName() const
{
return "CMakeFiles/clean.additional";
}
- static const char* GetByproductsForCleanTargetName()
+ static char const* GetByproductsForCleanTargetName()
{
return "CMakeFiles/cmake_byproducts_for_clean_target";
}
- void AddCXXCompileCommand(const std::string& commandLine,
- const std::string& sourceFile,
- const std::string& objPath);
+ void AddCXXCompileCommand(std::string const& commandLine,
+ std::string const& sourceFile,
+ std::string const& objPath);
/**
* Add a rule to the generated build system.
@@ -313,12 +311,12 @@ public:
*/
void AddRule(cmNinjaRule const& rule);
- bool HasRule(const std::string& name);
+ bool HasRule(std::string const& name);
void AddCustomCommandRule();
void AddMacOSXContentRule();
- bool HasCustomCommandOutput(const std::string& output)
+ bool HasCustomCommandOutput(std::string const& output)
{
return this->CustomCommandOutputs.find(output) !=
this->CustomCommandOutputs.end();
@@ -326,13 +324,13 @@ public:
/// Called when we have seen the given custom command. Returns true
/// if we has seen it before.
- bool SeenCustomCommand(cmCustomCommand const* cc, const std::string& config)
+ bool SeenCustomCommand(cmCustomCommand const* cc, std::string const& config)
{
return !this->Configs[config].CustomCommands.insert(cc).second;
}
/// Called when we have seen the given custom command output.
- void SeenCustomCommandOutput(const std::string& output)
+ void SeenCustomCommandOutput(std::string const& output)
{
this->CustomCommandOutputs.insert(output);
// We don't need the assumed dependencies anymore, because we have
@@ -340,8 +338,8 @@ public:
this->AssumedSourceDependencies.erase(output);
}
- void AddAssumedSourceDependencies(const std::string& source,
- const cmNinjaDeps& deps)
+ void AddAssumedSourceDependencies(std::string const& source,
+ cmNinjaDeps const& deps)
{
std::set<std::string>& ASD = this->AssumedSourceDependencies[source];
// Because we may see the same source file multiple times (same source
@@ -351,46 +349,47 @@ public:
}
virtual std::string OrderDependsTargetForTarget(
- cmGeneratorTarget const* target, const std::string& config) const;
+ cmGeneratorTarget const* target, std::string const& config) const;
std::string OrderDependsTargetForTargetPrivate(
- cmGeneratorTarget const* target, const std::string& config) const;
+ cmGeneratorTarget const* target, std::string const& config) const;
void AppendTargetOutputs(cmGeneratorTarget const* target,
- cmNinjaDeps& outputs, const std::string& config,
+ cmNinjaDeps& outputs, std::string const& config,
cmNinjaTargetDepends depends) const;
void AppendTargetDepends(cmGeneratorTarget const* target,
- cmNinjaDeps& outputs, const std::string& config,
- const std::string& fileConfig,
+ cmNinjaDeps& outputs, std::string const& config,
+ std::string const& fileConfig,
cmNinjaTargetDepends depends);
void AppendTargetDependsClosure(cmGeneratorTarget const* target,
std::unordered_set<std::string>& outputs,
- const std::string& config,
- const std::string& fileConfig,
+ std::string const& config,
+ std::string const& fileConfig,
bool genexOutput, bool omit_self = true);
- void AppendDirectoryForConfig(const std::string& prefix,
- const std::string& config,
- const std::string& suffix,
+ void AppendDirectoryForConfig(std::string const& prefix,
+ std::string const& config,
+ std::string const& suffix,
std::string& dir) override;
virtual void AppendNinjaFileArgument(GeneratedMakeCommand& /*command*/,
- const std::string& /*config*/) const
+ std::string const& /*config*/) const
{
}
virtual void AddRebuildManifestOutputs(cmNinjaDeps& outputs) const
{
outputs.push_back(this->NinjaOutputPath(NINJA_BUILD_FILE));
+ this->AddCMakeFilesToRebuild(outputs);
}
- int GetRuleCmdLength(const std::string& name)
+ int GetRuleCmdLength(std::string const& name)
{
return this->RuleCmdLength[name];
}
- void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target,
- const std::string& config);
+ void AddTargetAlias(std::string const& alias, cmGeneratorTarget* target,
+ std::string const& config);
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override;
@@ -440,13 +439,13 @@ public:
std::string const& arg_lang, std::string const& arg_modmapfmt,
cmCxxModuleExportInfo const& export_info);
- virtual std::string BuildAlias(const std::string& alias,
- const std::string& /*config*/) const
+ virtual std::string BuildAlias(std::string const& alias,
+ std::string const& /*config*/) const
{
return alias;
}
- virtual std::string ConfigDirectory(const std::string& /*config*/) const
+ virtual std::string ConfigDirectory(std::string const& /*config*/) const
{
return "";
}
@@ -456,26 +455,26 @@ public:
return this->ByproductsForCleanTarget;
}
- cmNinjaDeps& GetByproductsForCleanTarget(const std::string& config)
+ cmNinjaDeps& GetByproductsForCleanTarget(std::string const& config)
{
return this->Configs[config].ByproductsForCleanTarget;
}
bool EnableCrossConfigBuild() const;
- std::set<std::string> GetCrossConfigs(const std::string& config) const;
+ std::set<std::string> GetCrossConfigs(std::string const& config) const;
- const std::set<std::string>& GetDefaultConfigs() const
+ std::set<std::string> const& GetDefaultConfigs() const override
{
return this->DefaultConfigs;
}
- const std::set<std::string>& GetPerConfigUtilityTargets() const
+ std::set<std::string> const& GetPerConfigUtilityTargets() const
{
return this->PerConfigUtilityTargets;
}
- void AddPerConfigUtilityTarget(const std::string& name)
+ void AddPerConfigUtilityTarget(std::string const& name)
{
this->PerConfigUtilityTargets.insert(name);
}
@@ -498,11 +497,11 @@ protected:
virtual void CloseBuildFileStreams();
bool OpenFileStream(std::unique_ptr<cmGeneratedFileStream>& stream,
- const std::string& name);
+ std::string const& name);
static cm::optional<std::set<std::string>> ListSubsetWithAll(
- const std::set<std::string>& all, const std::set<std::string>& defaults,
- const std::vector<std::string>& items);
+ std::set<std::string> const& all, std::set<std::string> const& defaults,
+ std::vector<std::string> const& items);
std::set<std::string> CrossConfigs;
std::set<std::string> DefaultConfigs;
@@ -530,13 +529,16 @@ private:
void WriteTargetAliases(std::ostream& os);
void WriteFolderTargets(std::ostream& os);
- void WriteUnknownExplicitDependencies(std::ostream& os);
void WriteBuiltinTargets(std::ostream& os);
void WriteTargetDefault(std::ostream& os);
void WriteTargetRebuildManifest(std::ostream& os);
bool WriteTargetCleanAdditional(std::ostream& os);
void WriteTargetClean(std::ostream& os);
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+ // FIXME(#26668) This does not work on Windows
+ void WriteTargetInstrument(std::ostream& os);
+#endif
void WriteTargetHelp(std::ostream& os);
void ComputeTargetDependsClosure(
@@ -565,18 +567,6 @@ private:
/// The set of custom command outputs we have seen.
std::set<std::string> CustomCommandOutputs;
- /// Whether we are collecting known build outputs and needed
- /// dependencies to determine unknown dependencies.
- bool ComputingUnknownDependencies = false;
- cmPolicies::PolicyStatus PolicyCMP0058 = cmPolicies::WARN;
-
- /// The combined explicit dependencies of custom build commands
- std::set<std::string> CombinedCustomCommandExplicitDependencies;
-
- /// When combined with CombinedCustomCommandExplicitDependencies it allows
- /// us to detect the set of explicit dependencies that have
- std::set<std::string> CombinedBuildOutputs;
-
/// The mapping from source file to assumed dependencies.
std::map<std::string, std::set<std::string>> AssumedSourceDependencies;
@@ -650,27 +640,27 @@ private:
cmNinjaDeps ByproductsForCleanTarget;
- friend bool operator==(const ByConfig::TargetDependsClosureKey& lhs,
- const ByConfig::TargetDependsClosureKey& rhs);
- friend bool operator!=(const ByConfig::TargetDependsClosureKey& lhs,
- const ByConfig::TargetDependsClosureKey& rhs);
- friend bool operator<(const ByConfig::TargetDependsClosureKey& lhs,
- const ByConfig::TargetDependsClosureKey& rhs);
- friend bool operator>(const ByConfig::TargetDependsClosureKey& lhs,
- const ByConfig::TargetDependsClosureKey& rhs);
- friend bool operator<=(const ByConfig::TargetDependsClosureKey& lhs,
- const ByConfig::TargetDependsClosureKey& rhs);
- friend bool operator>=(const ByConfig::TargetDependsClosureKey& lhs,
- const ByConfig::TargetDependsClosureKey& rhs);
+ friend bool operator==(ByConfig::TargetDependsClosureKey const& lhs,
+ ByConfig::TargetDependsClosureKey const& rhs);
+ friend bool operator!=(ByConfig::TargetDependsClosureKey const& lhs,
+ ByConfig::TargetDependsClosureKey const& rhs);
+ friend bool operator<(ByConfig::TargetDependsClosureKey const& lhs,
+ ByConfig::TargetDependsClosureKey const& rhs);
+ friend bool operator>(ByConfig::TargetDependsClosureKey const& lhs,
+ ByConfig::TargetDependsClosureKey const& rhs);
+ friend bool operator<=(ByConfig::TargetDependsClosureKey const& lhs,
+ ByConfig::TargetDependsClosureKey const& rhs);
+ friend bool operator>=(ByConfig::TargetDependsClosureKey const& lhs,
+ ByConfig::TargetDependsClosureKey const& rhs);
};
class cmGlobalNinjaMultiGenerator : public cmGlobalNinjaGenerator
{
public:
/// The default name of Ninja's common file. Typically: common.ninja.
- static const char* NINJA_COMMON_FILE;
+ static char const* NINJA_COMMON_FILE;
/// The default file extension to use for per-config Ninja files.
- static const char* NINJA_FILE_EXTENSION;
+ static char const* NINJA_FILE_EXTENSION;
cmGlobalNinjaMultiGenerator(cmake* cm);
bool IsMultiConfig() const override { return true; }
@@ -689,8 +679,8 @@ public:
static std::string GetActualName() { return "Ninja Multi-Config"; }
- std::string BuildAlias(const std::string& alias,
- const std::string& config) const override
+ std::string BuildAlias(std::string const& alias,
+ std::string const& config) const override
{
if (config.empty()) {
return alias;
@@ -698,7 +688,7 @@ public:
return cmStrCat(alias, ":", config);
}
- std::string ConfigDirectory(const std::string& config) const override
+ std::string ConfigDirectory(std::string const& config) const override
{
if (!config.empty()) {
return cmStrCat('/', config);
@@ -706,19 +696,19 @@ public:
return "";
}
- const char* GetCMakeCFGIntDir() const override { return "${CONFIGURATION}"; }
+ char const* GetCMakeCFGIntDir() const override { return "${CONFIGURATION}"; }
- std::string ExpandCFGIntDir(const std::string& str,
- const std::string& config) const override;
+ std::string ExpandCFGIntDir(std::string const& str,
+ std::string const& config) const override;
cmGeneratedFileStream* GetImplFileStream(
- const std::string& config) const override
+ std::string const& config) const override
{
return this->ImplFileStreams.at(config).get();
}
cmGeneratedFileStream* GetConfigFileStream(
- const std::string& config) const override
+ std::string const& config) const override
{
return this->ConfigFileStreams.at(config).get();
}
@@ -734,10 +724,10 @@ public:
}
void AppendNinjaFileArgument(GeneratedMakeCommand& command,
- const std::string& config) const override;
+ std::string const& config) const override;
- static std::string GetNinjaImplFilename(const std::string& config);
- static std::string GetNinjaConfigFilename(const std::string& config);
+ static std::string GetNinjaImplFilename(std::string const& config);
+ static std::string GetNinjaConfigFilename(std::string const& config);
void AddRebuildManifestOutputs(cmNinjaDeps& outputs) const override;
@@ -752,7 +742,7 @@ public:
bool SupportsDefaultConfigs() const override { return true; }
std::string OrderDependsTargetForTarget(
- cmGeneratorTarget const* target, const std::string& config) const override;
+ cmGeneratorTarget const* target, std::string const& config) const override;
protected:
bool OpenBuildFileStreams() override;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 671dae2..db23fa6 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalUnixMakefileGenerator3.h"
#include <algorithm>
@@ -126,7 +126,7 @@ void cmGlobalUnixMakefileGenerator3::Generate()
for (auto& pmi : this->ProgressMap) {
pmi.second.WriteProgressVariables(total, current);
}
- for (const auto& lg : this->LocalGenerators) {
+ for (auto const& lg : this->LocalGenerators) {
std::string markFileName =
cmStrCat(lg->GetCurrentBinaryDirectory(), "/CMakeFiles/progress.marks");
cmGeneratedFileStream markFile(markFileName);
@@ -146,8 +146,8 @@ void cmGlobalUnixMakefileGenerator3::Generate()
}
void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
- const std::string& sourceFile, const std::string& workingDirectory,
- const std::string& compileCommand, const std::string& objPath)
+ std::string const& sourceFile, std::string const& workingDirectory,
+ std::string const& compileCommand, std::string const& objPath)
{
if (!this->CommandDatabase) {
std::string commandDatabaseName =
@@ -224,7 +224,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
}
// Write the target convenience rules
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
this->WriteConvenienceRules2(
makefileStream, rootLG,
cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(localGen));
@@ -270,7 +270,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// for each cmMakefile get its list of dependencies
std::vector<std::string> lfiles;
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
// Get the list of files contributing to this generation step.
cm::append(lfiles, localGen->GetMakefile()->GetListFiles());
}
@@ -290,7 +290,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
{
// reset lg to the first makefile
- const auto& lg = cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(
+ auto const& lg = cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(
this->LocalGenerators[0]);
// Save the list to the cmake file.
@@ -322,7 +322,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// add in any byproducts and all the directory information files
std::string tmpStr;
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
for (std::string const& outfile :
localGen->GetMakefile()->GetOutputFiles()) {
cmakefileStream << " \"" << lg.MaybeRelativeToTopBinDir(outfile)
@@ -347,11 +347,11 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
// now list all the target info files
cmakefileStream << "# Dependency information for all targets:\n";
cmakefileStream << "set(CMAKE_DEPEND_INFO_FILES\n";
- for (const auto& lGenerator : lGenerators) {
- const auto& lg =
+ for (auto const& lGenerator : lGenerators) {
+ auto const& lg =
cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(lGenerator);
// for all of out targets
- for (const auto& tgt : lg.GetGeneratorTargets()) {
+ for (auto const& tgt : lg.GetGeneratorTargets()) {
if (tgt->IsInBuildSystem() &&
tgt->GetType() != cmStateEnums::GLOBAL_TARGET) {
std::string tname = cmStrCat(lg.GetRelativeTargetDirectory(tgt.get()),
@@ -366,7 +366,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3& rootLG,
- DirectoryTarget const& dt, const char* pass, bool check_all,
+ DirectoryTarget const& dt, char const* pass, bool check_all,
bool check_relink, std::vector<std::string> const& commands)
{
auto* lg = static_cast<cmLocalUnixMakefileGenerator3*>(dt.LG);
@@ -530,10 +530,10 @@ std::string cmGlobalUnixMakefileGenerator3::ConvertToMakefilePath(
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& /*projectName*/,
- const std::string& /*projectDir*/,
- std::vector<std::string> const& targetNames, const std::string& /*config*/,
- int jobs, bool verbose, const cmBuildOptions& buildOptions,
+ std::string const& makeProgram, std::string const& /*projectName*/,
+ std::string const& /*projectDir*/,
+ std::vector<std::string> const& targetNames, std::string const& /*config*/,
+ int jobs, bool verbose, cmBuildOptions const& buildOptions,
std::vector<std::string> const& makeOptions)
{
GeneratedMakeCommand makeCommand;
@@ -556,7 +556,7 @@ cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) {
makeCommand.Add("-j");
} else {
- makeCommand.Add("-j" + std::to_string(jobs));
+ makeCommand.Add(cmStrCat("-j", jobs));
}
}
@@ -585,11 +585,11 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
}
// write the target convenience rules
- for (const auto& localGen : this->LocalGenerators) {
+ for (auto const& localGen : this->LocalGenerators) {
auto& lg =
cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(localGen);
// for each target Generate the rule files for each target.
- for (const auto& gtarget : lg.GetGeneratorTargets()) {
+ for (auto const& gtarget : lg.GetGeneratorTargets()) {
// Don't emit the same rule twice (e.g. two targets with the same
// simple name)
std::string name = gtarget->GetName();
@@ -661,7 +661,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
}
// for each target Generate the rule files for each target.
- for (const auto& gtarget : lg.GetGeneratorTargets()) {
+ for (auto const& gtarget : lg.GetGeneratorTargets()) {
std::string name = gtarget->GetName();
if (!name.empty() &&
(gtarget->IsInBuildSystem() &&
@@ -690,13 +690,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
cmLocalUnixMakefileGenerator3::EchoProgress progress;
progress.Dir = cmStrCat(lg.GetBinaryDirectory(), "/CMakeFiles");
{
- std::ostringstream progressArg;
- const char* sep = "";
- for (unsigned long progFile : this->ProgressMap[gtarget.get()].Marks) {
- progressArg << sep << progFile;
- sep = ",";
- }
- progress.Arg = progressArg.str();
+ progress.Arg = cmJoin(this->ProgressMap[gtarget.get()].Marks, ",");
}
bool targetMessages = true;
@@ -805,8 +799,8 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
{
this->DirectoryTargetsMap.clear();
// Loop over all targets in all local generators.
- for (const auto& lg : this->LocalGenerators) {
- for (const auto& gt : lg->GetGeneratorTargets()) {
+ for (auto const& lg : this->LocalGenerators) {
+ for (auto const& gt : lg->GetGeneratorTargets()) {
cmLocalGenerator* tlg = gt->GetLocalGenerator();
if (!gt->IsInBuildSystem() || this->IsExcluded(lg.get(), gt.get())) {
@@ -854,7 +848,7 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInTarget(
}
size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInAll(
- const cmLocalGenerator& lg)
+ cmLocalGenerator const& lg)
{
size_t count = 0;
std::set<cmGeneratorTarget const*> emitted;
@@ -916,7 +910,7 @@ void cmGlobalUnixMakefileGenerator3::AppendGlobalTargetDepends(
void cmGlobalUnixMakefileGenerator3::AppendCodegenTargetDepends(
std::vector<std::string>& depends, cmGeneratorTarget* target)
{
- const std::set<std::string>& codegen_depends =
+ std::set<std::string> const& codegen_depends =
target->Target->GetCodegenDeps();
for (cmTargetDepend const& i : this->GetTargetDirectDepends(target)) {
@@ -962,14 +956,14 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
std::set<std::string> project_targets;
// for each local generator
- for (const auto& localGen : this->LocalGenerators) {
- const auto& lg2 =
+ for (auto const& localGen : this->LocalGenerators) {
+ auto const& lg2 =
cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(localGen);
// for the passed in makefile or if this is the top Makefile wripte out
// the targets
if (&lg2 == lg || lg->IsRootMakefile()) {
// for each target Generate the rule files for each target.
- for (const auto& target : lg2.GetGeneratorTargets()) {
+ for (auto const& target : lg2.GetGeneratorTargets()) {
cmStateEnums::TargetType type = target->GetType();
if ((type == cmStateEnums::EXECUTABLE) ||
(type == cmStateEnums::STATIC_LIBRARY) ||
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index d4fcf88..75a4fdd 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,10 +69,10 @@ public:
~cmGlobalUnixMakefileGenerator3() override;
- cmGlobalUnixMakefileGenerator3(const cmGlobalUnixMakefileGenerator3&) =
+ cmGlobalUnixMakefileGenerator3(cmGlobalUnixMakefileGenerator3 const&) =
delete;
cmGlobalUnixMakefileGenerator3& operator=(
- const cmGlobalUnixMakefileGenerator3&) = delete;
+ cmGlobalUnixMakefileGenerator3 const&) = delete;
//! Get the name for the generator.
std::string GetName() const override
@@ -169,20 +169,20 @@ public:
// change the build command for speed
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
/** Record per-target progress information. */
void RecordTargetProgress(cmMakefileTargetGenerator* tg);
- void AddCXXCompileCommand(const std::string& sourceFile,
- const std::string& workingDirectory,
- const std::string& compileCommand,
- const std::string& objPath);
+ void AddCXXCompileCommand(std::string const& sourceFile,
+ std::string const& workingDirectory,
+ std::string const& compileCommand,
+ std::string const& objPath);
/** Does the make tool tolerate .NOTPARALLEL? */
virtual bool AllowNotParallel() const { return true; }
@@ -213,7 +213,7 @@ protected:
void WriteDirectoryRule2(std::ostream& ruleFileStream,
cmLocalUnixMakefileGenerator3& rootLG,
- DirectoryTarget const& dt, const char* pass,
+ DirectoryTarget const& dt, char const* pass,
bool check_all, bool check_relink,
std::vector<std::string> const& commands = {});
void WriteDirectoryRules2(std::ostream& ruleFileStream,
@@ -227,28 +227,28 @@ protected:
cmGeneratorTarget* target);
// Target name hooks for superclass.
- const char* GetAllTargetName() const override { return "all"; }
- const char* GetInstallTargetName() const override { return "install"; }
- const char* GetInstallLocalTargetName() const override
+ char const* GetAllTargetName() const override { return "all"; }
+ char const* GetInstallTargetName() const override { return "install"; }
+ char const* GetInstallLocalTargetName() const override
{
return "install/local";
}
- const char* GetInstallStripTargetName() const override
+ char const* GetInstallStripTargetName() const override
{
return "install/strip";
}
- const char* GetPreinstallTargetName() const override { return "preinstall"; }
- const char* GetTestTargetName() const override { return "test"; }
- const char* GetPackageTargetName() const override { return "package"; }
- const char* GetPackageSourceTargetName() const override
+ char const* GetPreinstallTargetName() const override { return "preinstall"; }
+ char const* GetTestTargetName() const override { return "test"; }
+ char const* GetPackageTargetName() const override { return "package"; }
+ char const* GetPackageSourceTargetName() const override
{
return "package_source";
}
- const char* GetRebuildCacheTargetName() const override
+ char const* GetRebuildCacheTargetName() const override
{
return "rebuild_cache";
}
- const char* GetCleanTargetName() const override { return "clean"; }
+ char const* GetCleanTargetName() const override { return "clean"; }
bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const override { return true; }
@@ -287,12 +287,12 @@ protected:
size_t CountProgressMarksInTarget(
cmGeneratorTarget const* target,
std::set<cmGeneratorTarget const*>& emitted);
- size_t CountProgressMarksInAll(const cmLocalGenerator& lg);
+ size_t CountProgressMarksInAll(cmLocalGenerator const& lg);
std::unique_ptr<cmGeneratedFileStream> CommandDatabase;
private:
- const char* GetBuildIgnoreErrorsFlag() const override { return "-i"; }
+ char const* GetBuildIgnoreErrorsFlag() const override { return "-i"; }
std::map<cmStateSnapshot, std::set<cmGeneratorTarget const*>,
cmStateSnapshot::StrictWeakOrder>
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index f9abe29..688fbd7 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio10Generator.h"
#include <algorithm>
@@ -20,6 +20,7 @@
#include "cmCryptoHash.h"
#include "cmDocumentationEntry.h"
+#include "cmExperimental.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalVisualStudio71Generator.h"
@@ -52,9 +53,8 @@ static void ConvertToWindowsSlashes(std::string& s)
}
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
- cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName)
- : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName)
+ cmake* cm, std::string const& name)
+ : cmGlobalVisualStudio8Generator(cm, name)
{
this->DefaultCudaFlagTableName = "v10";
this->DefaultCudaHostFlagTableName = "v10";
@@ -309,26 +309,26 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
}
}
- if (const char* toolset = this->GetPlatformToolset()) {
+ if (char const* toolset = this->GetPlatformToolset()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset);
}
if (!this->GeneratorToolsetVersion.empty()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VERSION",
this->GeneratorToolsetVersion);
}
- if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) {
+ if (char const* hostArch = this->GetPlatformToolsetHostArchitecture()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE", hostArch);
}
- if (const char* cuda = this->GetPlatformToolsetCuda()) {
+ if (char const* cuda = this->GetPlatformToolsetCuda()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA", cuda);
}
- if (const char* cudaDir = this->GetPlatformToolsetCudaCustomDir()) {
+ if (char const* cudaDir = this->GetPlatformToolsetCudaCustomDir()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR", cudaDir);
}
if (cm::optional<std::string> fortran = this->GetPlatformToolsetFortran()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_FORTRAN", *fortran);
}
- if (const char* vcTargetsDir = this->GetCustomVCTargetsPath()) {
+ if (char const* vcTargetsDir = this->GetCustomVCTargetsPath()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR",
vcTargetsDir);
}
@@ -339,12 +339,13 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
std::string const& ts, cmMakefile* mf)
{
- std::vector<std::string> const fields = cmTokenize(ts, ",");
- auto fi = fields.begin();
- if (fi == fields.end()) {
+ std::vector<std::string> const fields =
+ cmTokenize(ts, ',', cmTokenizerMode::New);
+ if (fields.empty()) {
return true;
}
+ auto fi = fields.begin();
// The first field may be the VS platform toolset.
if (fi->find('=') == fi->npos) {
this->GeneratorToolset = *fi;
@@ -475,14 +476,14 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
if (!this->InitializeWindowsStore(mf)) {
return false;
}
- } else if (this->SystemName == "Android"_s) {
- if (this->PlatformInGeneratorName) {
- mf->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR ",
- "specifies a platform too: '", this->GetName(), '\''));
+ } else if (this->SystemName == "WindowsKernelModeDriver"_s &&
+ cmExperimental::HasSupportEnabled(
+ *mf, cmExperimental::Feature::WindowsKernelModeDriver)) {
+ this->SystemIsWindowsKernelModeDriver = true;
+ if (!this->InitializeWindowsKernelModeDriver(mf)) {
return false;
}
+ } else if (this->SystemName == "Android"_s) {
if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") ==
"Tegra-Android"_s) {
if (!this->InitializeTegraAndroid(mf)) {
@@ -504,16 +505,8 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*)
return true;
}
-bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
+bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile*)
{
- if (this->PlatformInGeneratorName) {
- mf->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR ",
- "specifies a platform too: '", this->GetName(), '\''));
- return false;
- }
-
this->DefaultPlatformToolset = this->SelectWindowsCEToolset();
return true;
@@ -535,6 +528,13 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
return false;
}
+bool cmGlobalVisualStudio10Generator::InitializeWindowsKernelModeDriver(
+ cmMakefile*)
+{
+ this->DefaultPlatformToolset = "WindowsKernelModeDriver10.0";
+ return true;
+}
+
bool cmGlobalVisualStudio10Generator::InitializeTegraAndroid(cmMakefile* mf)
{
std::string v =
@@ -689,7 +689,7 @@ void cmGlobalVisualStudio10Generator::EnableLanguage(
cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
}
-const char* cmGlobalVisualStudio10Generator::GetCustomVCTargetsPath() const
+char const* cmGlobalVisualStudio10Generator::GetCustomVCTargetsPath() const
{
if (this->CustomVCTargetsPath.empty()) {
return nullptr;
@@ -697,7 +697,7 @@ const char* cmGlobalVisualStudio10Generator::GetCustomVCTargetsPath() const
return this->CustomVCTargetsPath.c_str();
}
-const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
+char const* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
{
std::string const& toolset = this->GetPlatformToolsetString();
if (toolset.empty()) {
@@ -731,7 +731,7 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetVersionProps() const
return this->GeneratorToolsetVersionProps;
}
-const char*
+char const*
cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitecture() const
{
std::string const& hostArch =
@@ -756,7 +756,7 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitectureString()
return empty;
}
-const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetCuda() const
+char const* cmGlobalVisualStudio10Generator::GetPlatformToolsetCuda() const
{
if (!this->GeneratorToolsetCuda.empty()) {
return this->GeneratorToolsetCuda.c_str();
@@ -770,7 +770,7 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaString() const
return this->GeneratorToolsetCuda;
}
-const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaCustomDir()
+char const* cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaCustomDir()
const
{
if (!this->GeneratorToolsetCudaCustomDir.empty()) {
@@ -967,7 +967,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
}
cmXMLElement(eprj, "Import")
.Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
- if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) {
+ if (char const* hostArch = this->GetPlatformToolsetHostArchitecture()) {
cmXMLElement epg(eprj, "PropertyGroup");
cmXMLElement(epg, "PreferredToolArchitecture").Content(hostArch);
}
@@ -975,6 +975,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
cmXMLElement epg(eprj, "PropertyGroup");
epg.Attribute("Label", "Configuration");
{
+ // noqa: spellcheck off
cmXMLElement ect(epg, "ConfigurationType");
if (this->IsNsightTegra()) {
// Tegra-Android platform does not understand "Utility".
@@ -982,6 +983,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
} else {
ect.Content("Utility");
}
+ // noqa: spellcheck on
}
cmXMLElement(epg, "CharacterSet").Content("MultiByte");
if (this->IsNsightTegra()) {
@@ -1023,11 +1025,11 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
"Failed to run MSBuild command:\n"
" " << cmd[0] << "\n"
"to get the value of VCTargetsPath:\n"
- " " << out << "\n"
+ " " << out << '\n'
;
/* clang-format on */
if (ret != 0) {
- e << "Exit code: " << ret << "\n";
+ e << "Exit code: " << ret << '\n';
}
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccurred();
@@ -1038,17 +1040,17 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
{
cmsys::ofstream fout(txt.c_str());
- fout << this->VCTargetsPath << "\n";
+ fout << this->VCTargetsPath << '\n';
}
return true;
}
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalVisualStudio10Generator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions,
std::vector<std::string> const& makeOptions)
{
std::vector<GeneratedMakeCommand> makeCommands;
@@ -1063,7 +1065,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeProgramLower.find("vcexpress") != std::string::npos);
// Workaround to convince VCExpress.exe to produce output.
- const bool requiresOutputForward =
+ bool const requiresOutputForward =
(makeProgramLower.find("vcexpress") != std::string::npos);
// MSBuild is preferred (and required for VS Express), but if the .sln has
@@ -1103,7 +1105,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
((targetNames.size() == 1) && targetNames.front().empty())) {
realTargetNames = { "ALL_BUILD" };
}
- for (const auto& tname : realTargetNames) {
+ for (auto const& tname : realTargetNames) {
// msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug
// /target:ALL_BUILD
// /m
@@ -1216,13 +1218,13 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) {
makeCommand.Add("/m");
} else {
- makeCommand.Add(cmStrCat("/m:", std::to_string(jobs)));
+ makeCommand.Add(cmStrCat("/m:", jobs));
}
}
// Respect the verbosity: 'n' normal will show build commands
// 'm' minimal only the build step's title
- makeCommand.Add(cmStrCat("/v:", ((verbose) ? "n" : "m")));
+ makeCommand.Add(cmStrCat("/v:", ((verbose) ? 'n' : 'm')));
makeCommand.Add(makeOptions.begin(), makeOptions.end());
makeCommands.emplace_back(std::move(makeCommand));
}
@@ -1263,7 +1265,7 @@ std::string cmGlobalVisualStudio10Generator::Encoding()
return "utf-8";
}
-const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const
+char const* cmGlobalVisualStudio10Generator::GetToolsVersion() const
{
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -1311,7 +1313,7 @@ std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const
return this->SystemVersion.substr(0, end2);
}
-static std::string cmLoadFlagTableString(Json::Value entry, const char* field)
+static std::string cmLoadFlagTableString(Json::Value entry, char const* field)
{
if (entry.isMember(field)) {
auto string = entry[field];
@@ -1323,7 +1325,7 @@ static std::string cmLoadFlagTableString(Json::Value entry, const char* field)
}
static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
- const char* field)
+ char const* field)
{
unsigned int value = 0;
if (entry.isMember(field)) {
@@ -1460,7 +1462,7 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
} else {
mf->IssueMessage(MessageType::FATAL_ERROR,
cmStrCat("JSON flag table for ", table,
- " not found for toolset ", genericName, " ",
+ " not found for toolset ", genericName, ' ',
defaultName));
return nullptr;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index a2b351c..5248b4d 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cstddef>
@@ -35,10 +35,10 @@ public:
cmMakefile* mf) override;
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
@@ -53,7 +53,7 @@ public:
void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
bool optional) override;
- void AddAndroidExecutableWarning(const std::string& name)
+ void AddAndroidExecutableWarning(std::string const& name)
{
this->AndroidExecutableWarnings.insert(name);
}
@@ -65,25 +65,25 @@ public:
std::string GetNsightTegraVersion() const;
/** The vctargets path for the target platform. */
- const char* GetCustomVCTargetsPath() const;
+ char const* GetCustomVCTargetsPath() const;
/** The toolset name for the target platform. */
- const char* GetPlatformToolset() const;
+ char const* GetPlatformToolset() const;
std::string const& GetPlatformToolsetString() const;
/** The toolset version props file, if any. */
std::string const& GetPlatformToolsetVersionProps() const;
/** The toolset host architecture name (e.g. x64 for 64-bit host tools). */
- const char* GetPlatformToolsetHostArchitecture() const;
+ char const* GetPlatformToolsetHostArchitecture() const;
std::string const& GetPlatformToolsetHostArchitectureString() const;
/** The cuda toolset version. */
- const char* GetPlatformToolsetCuda() const;
+ char const* GetPlatformToolsetCuda() const;
std::string const& GetPlatformToolsetCudaString() const;
/** The custom cuda install directory */
- const char* GetPlatformToolsetCudaCustomDir() const;
+ char const* GetPlatformToolsetCudaCustomDir() const;
std::string const& GetPlatformToolsetCudaCustomDirString() const;
/** The nvcc subdirectory of a custom cuda install directory */
@@ -127,10 +127,16 @@ public:
/** Return true if building for WindowsStore */
bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
+ /** Return true if building for WindowsKernelModeDriver */
+ bool TargetsWindowsKernelModeDriver() const
+ {
+ return this->SystemIsWindowsKernelModeDriver;
+ }
+
/** Return true if building for Android */
bool TargetsAndroid() const { return this->SystemIsAndroid; }
- const char* GetCMakeCFGIntDir() const override { return "$(Configuration)"; }
+ char const* GetCMakeCFGIntDir() const override { return "$(Configuration)"; }
/** Generate an <output>.rule file path for a given command output. */
std::string GenerateRuleFile(std::string const& output) const override;
@@ -139,7 +145,7 @@ public:
std::string const& sfRel);
std::string Encoding() override;
- const char* GetToolsVersion() const;
+ char const* GetToolsVersion() const;
virtual cm::optional<std::string> GetVSInstanceVersion() const { return {}; }
@@ -162,7 +168,7 @@ public:
/** Return the first two components of CMAKE_SYSTEM_VERSION. */
std::string GetApplicationTypeRevision() const;
- virtual const char* GetAndroidApplicationTypeRevision() const { return ""; }
+ virtual char const* GetAndroidApplicationTypeRevision() const { return ""; }
cmIDEFlagTable const* GetClFlagTable() const;
cmIDEFlagTable const* GetCSharpFlagTable() const;
@@ -179,8 +185,7 @@ public:
bool IsBuildInParallelSupported() const;
protected:
- cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudio10Generator(cmake* cm, std::string const& name);
void Generate() override;
virtual bool InitializeSystem(cmMakefile* mf);
@@ -188,6 +193,7 @@ protected:
virtual bool InitializeWindowsCE(cmMakefile* mf);
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
+ virtual bool InitializeWindowsKernelModeDriver(cmMakefile* mf);
virtual bool InitializeTegraAndroid(cmMakefile* mf);
virtual bool InitializeAndroid(cmMakefile* mf);
@@ -249,6 +255,7 @@ protected:
bool SystemIsWindowsCE = false;
bool SystemIsWindowsPhone = false;
bool SystemIsWindowsStore = false;
+ bool SystemIsWindowsKernelModeDriver = false;
bool SystemIsAndroid = false;
bool MSBuildCommandInitialized = false;
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 0ec5e8b..b961ae5 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio11Generator.h"
#include <cstring>
@@ -16,9 +16,8 @@
#include "cmSystemTools.h"
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
- cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName)
- : cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName)
+ cmake* cm, std::string const& name)
+ : cmGlobalVisualStudio10Generator(cm, name)
{
}
@@ -116,7 +115,7 @@ bool cmGlobalVisualStudio11Generator::UseFolderProperty() const
std::set<std::string>
cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs()
{
- const char sdksKey[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const sdksKey[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"Windows CE Tools\\SDKs";
std::vector<std::string> subkeys;
@@ -149,9 +148,9 @@ bool cmGlobalVisualStudio11Generator::TargetSystemSupportsDeployment() const
bool cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const
{
- const char desktop80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const desktop80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\11.0\\VC\\Libraries\\Extended";
- const char VS2012DesktopExpressKey[] =
+ char const VS2012DesktopExpressKey[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"WDExpress\\11.0;InstallDir";
@@ -165,7 +164,7 @@ bool cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const
bool cmGlobalVisualStudio11Generator::IsWindowsPhoneToolsetInstalled() const
{
- const char wp80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const wp80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"Microsoft SDKs\\WindowsPhone\\v8.0\\"
"Install Path;Install Path";
@@ -176,7 +175,7 @@ bool cmGlobalVisualStudio11Generator::IsWindowsPhoneToolsetInstalled() const
bool cmGlobalVisualStudio11Generator::IsWindowsStoreToolsetInstalled() const
{
- const char win80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const win80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\11.0\\VC\\Libraries\\Core\\Arm";
std::vector<std::string> subkeys;
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index ad12c1f..4b00fa2 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,8 +31,7 @@ public:
}
protected:
- cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudio11Generator(cmake* cm, std::string const& name);
bool InitializeWindowsPhone(cmMakefile* mf) override;
bool InitializeWindowsStore(cmMakefile* mf) override;
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index e5406dd..8b9383c 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio12Generator.h"
#include <cstring>
@@ -16,9 +16,8 @@
#include "cmSystemTools.h"
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
- cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName)
- : cmGlobalVisualStudio11Generator(cm, name, platformInGeneratorName)
+ cmake* cm, std::string const& name)
+ : cmGlobalVisualStudio11Generator(cm, name)
{
}
@@ -110,7 +109,7 @@ bool cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(
bool cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const
{
- const char desktop81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const desktop81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\12.0\\VC\\LibraryDesktop";
std::vector<std::string> subkeys;
@@ -120,7 +119,7 @@ bool cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const
bool cmGlobalVisualStudio12Generator::IsWindowsPhoneToolsetInstalled() const
{
- const char wp81Key[] =
+ char const wp81Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"Microsoft SDKs\\WindowsPhone\\v8.1\\Install Path;Install Path";
@@ -131,7 +130,7 @@ bool cmGlobalVisualStudio12Generator::IsWindowsPhoneToolsetInstalled() const
bool cmGlobalVisualStudio12Generator::IsWindowsStoreToolsetInstalled() const
{
- const char win81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const win81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\12.0\\VC\\Libraries\\Core\\Arm";
std::vector<std::string> subkeys;
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index edb86e2..a7f6bb5 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,8 +16,7 @@ class cmake;
class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator
{
protected:
- cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudio12Generator(cmake* cm, std::string const& name);
bool ProcessGeneratorToolsetField(std::string const& key,
std::string const& value) override;
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 35b69af..5d4ebbd 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio14Generator.h"
#include <cstring>
@@ -18,16 +18,16 @@
#include "cmSystemTools.h"
#include "cmValue.h"
-static const char vs14generatorName[] = "Visual Studio 14 2015";
+static char const vs14generatorName[] = "Visual Studio 14 2015";
// Map generator name without year to name with year.
-static const char* cmVS14GenName(const std::string& name, std::string& genName)
+static char const* cmVS14GenName(std::string const& name, std::string& genName)
{
if (strncmp(name.c_str(), vs14generatorName,
sizeof(vs14generatorName) - 6) != 0) {
return nullptr;
}
- const char* p = name.c_str() + sizeof(vs14generatorName) - 6;
+ char const* p = name.c_str() + sizeof(vs14generatorName) - 6;
if (cmHasLiteralPrefix(p, " 2015")) {
p += 5;
}
@@ -40,36 +40,25 @@ class cmGlobalVisualStudio14Generator::Factory
{
public:
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool allowArch, cmake* cm) const override
+ std::string const& name, cmake* cm) const override
{
std::string genName;
- const char* p = cmVS14GenName(name, genName);
+ char const* p = cmVS14GenName(name, genName);
if (!p) {
return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudio14Generator(cm, genName, ""));
- }
- if (!allowArch || *p++ != ' ') {
- return std::unique_ptr<cmGlobalGenerator>();
- }
- if (strcmp(p, "Win64") == 0) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudio14Generator(cm, genName, "x64"));
- }
- if (strcmp(p, "ARM") == 0) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudio14Generator(cm, genName, "ARM"));
+ new cmGlobalVisualStudio14Generator(cm, genName));
}
return std::unique_ptr<cmGlobalGenerator>();
}
cmDocumentationEntry GetDocumentation() const override
{
- return { cmStrCat(vs14generatorName, " [arch]"),
+ return { std::string(vs14generatorName),
"Generates Visual Studio 2015 project files. "
- "Optional [arch] can be \"Win64\" or \"ARM\"." };
+ "Use -A option to specify architecture." };
}
std::vector<std::string> GetGeneratorNames() const override
@@ -79,14 +68,6 @@ public:
return names;
}
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- std::vector<std::string> names;
- names.emplace_back(cmStrCat(vs14generatorName, " ARM"));
- names.emplace_back(cmStrCat(vs14generatorName, " Win64"));
- return names;
- }
-
bool SupportsToolset() const override { return true; }
bool SupportsPlatform() const override { return true; }
@@ -109,9 +90,8 @@ cmGlobalVisualStudio14Generator::NewFactory()
}
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
- cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName)
- : cmGlobalVisualStudio12Generator(cm, name, platformInGeneratorName)
+ cmake* cm, std::string const& name)
+ : cmGlobalVisualStudio12Generator(cm, name)
{
std::string vc14Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
@@ -130,7 +110,7 @@ cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
}
bool cmGlobalVisualStudio14Generator::MatchesGeneratorName(
- const std::string& name) const
+ std::string const& name) const
{
std::string genName;
if (cmVS14GenName(name, genName)) {
@@ -357,7 +337,7 @@ bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
bool cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const
{
- const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ char const desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\14.0\\VC\\Runtimes";
std::vector<std::string> vc14;
@@ -367,7 +347,7 @@ bool cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const
bool cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const
{
- const char universal10Key[] =
+ char const universal10Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;SrcPath";
@@ -541,3 +521,59 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion(
// Return an empty string
return std::string();
}
+
+void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root)
+{
+ cmValue n = root->GetMakefile()->GetProperty("VS_SOLUTION_ITEMS");
+ if (cmNonempty(n)) {
+ cmMakefile* makefile = root->GetMakefile();
+
+ std::vector<cmSourceGroup> sourceGroups = makefile->GetSourceGroups();
+
+ cmVisualStudioFolder* defaultFolder = nullptr;
+
+ std::vector<std::string> pathComponents = {
+ makefile->GetCurrentSourceDirectory(),
+ "",
+ "",
+ };
+
+ for (std::string const& relativePath : cmList(n)) {
+ pathComponents[2] = relativePath;
+
+ std::string fullPath = cmSystemTools::FileIsFullPath(relativePath)
+ ? relativePath
+ : cmSystemTools::JoinPath(pathComponents);
+
+ cmSourceGroup* sg = makefile->FindSourceGroup(fullPath, sourceGroups);
+
+ cmVisualStudioFolder* folder = nullptr;
+ if (!sg->GetFullName().empty()) {
+ std::string folderPath = sg->GetFullName();
+ // Source groups use '\' while solution folders use '/'.
+ cmSystemTools::ReplaceString(folderPath, "\\", "/");
+ folder = this->CreateSolutionFolders(folderPath);
+ } else {
+ // Lazily initialize the default solution items folder.
+ if (defaultFolder == nullptr) {
+ defaultFolder = this->CreateSolutionFolders("Solution Items");
+ }
+ folder = defaultFolder;
+ }
+
+ folder->SolutionItems.insert(fullPath);
+ }
+ }
+}
+
+void cmGlobalVisualStudio14Generator::WriteFolderSolutionItems(
+ std::ostream& fout, cmVisualStudioFolder const& folder)
+{
+ fout << "\tProjectSection(SolutionItems) = preProject\n";
+
+ for (std::string const& item : folder.SolutionItems) {
+ fout << "\t\t" << item << " = " << item << "\n";
+ }
+
+ fout << "\tEndProjectSection\n";
+}
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index e903578..aed5de6 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,16 +21,15 @@ class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator
public:
static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
- bool MatchesGeneratorName(const std::string& name) const override;
+ bool MatchesGeneratorName(std::string const& name) const override;
- const char* GetAndroidApplicationTypeRevision() const override
+ char const* GetAndroidApplicationTypeRevision() const override
{
return "2.0";
}
protected:
- cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudio14Generator(cmake* cm, std::string const& name);
bool InitializeWindowsStore(cmMakefile* mf) override;
bool InitializeAndroid(cmMakefile* mf) override;
@@ -67,6 +66,11 @@ protected:
std::string GetWindows10SDKVersion(cmMakefile* mf);
+ void AddSolutionItems(cmLocalGenerator* root) override;
+
+ void WriteFolderSolutionItems(std::ostream& fout,
+ cmVisualStudioFolder const& folder) override;
+
private:
class Factory;
friend class Factory;
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 8375b72..42a35b2 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio71Generator.h"
#include <map>
@@ -17,9 +17,8 @@
class cmake;
-cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
- cmake* cm, const std::string& platformName)
- : cmGlobalVisualStudio7Generator(cm, platformName)
+cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(cmake* cm)
+ : cmGlobalVisualStudio7Generator(cm)
{
this->ProjectConfigurationSectionName = "ProjectConfiguration";
}
@@ -48,9 +47,10 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
std::ostringstream targetsSlnString;
this->WriteTargetsToSolution(targetsSlnString, root, orderedProjectTargets);
+ this->AddSolutionItems(root);
+
// Generate folder specification.
- bool useFolderProperty = this->UseFolderProperty();
- if (useFolderProperty) {
+ if (!this->VisualStudioFolders.empty()) {
this->WriteFolders(fout);
}
@@ -67,7 +67,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
this->WriteTargetConfigurations(fout, configs, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
- if (useFolderProperty) {
+ if (!this->VisualStudioFolders.empty()) {
// Write out project folders
fout << "\tGlobalSection(NestedProjects) = preSolution\n";
this->WriteFoldersContent(fout);
@@ -95,13 +95,13 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations(
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
- const std::string& dspname,
- const std::string& dir,
+ std::string const& dspname,
+ std::string const& dir,
cmGeneratorTarget const* t)
{
// check to see if this is a fortran build
std::string ext = ".vcproj";
- const char* project =
+ char const* project =
R"(Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = ")";
if (this->TargetIsFortranOnly(t)) {
ext = ".vfproj";
@@ -128,7 +128,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
auto ui = this->UtilityDepends.find(t);
if (ui != this->UtilityDepends.end()) {
- const char* uname = ui->second.c_str();
+ char const* uname = ui->second.c_str();
/* clang-format off */
fout << R"(Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = ")"
<< uname << "\", \""
@@ -147,7 +147,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteProjectDepends(
- std::ostream& fout, const std::string&, const std::string&,
+ std::ostream& fout, std::string const&, std::string const&,
cmGeneratorTarget const* target)
{
VSDependSet const& depends = this->VSTargetDepends[target];
@@ -165,8 +165,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(
// Write a dsp file into the SLN file, Note, that dependencies from
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteExternalProject(
- std::ostream& fout, const std::string& name, const std::string& location,
- cmValue typeGuid, const std::set<BT<std::pair<std::string, bool>>>& depends)
+ std::ostream& fout, std::string const& name, std::string const& location,
+ cmValue typeGuid, std::set<BT<std::pair<std::string, bool>>> const& depends)
{
fout << "Project(\"{"
<< (typeGuid ? *typeGuid
@@ -197,17 +197,17 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject(
// Write a dsp file into the SLN file, Note, that dependencies from
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmGeneratorTarget const& target,
+ std::ostream& fout, std::string const& name, cmGeneratorTarget const& target,
std::vector<std::string> const& configs,
- const std::set<std::string>& configsPartOfDefaultBuild,
+ std::set<std::string> const& configsPartOfDefaultBuild,
std::string const& platformMapping)
{
- const std::string& platformName =
+ std::string const& platformName =
!platformMapping.empty() ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name);
for (std::string const& i : configs) {
cmList mapConfig;
- const char* dstConfig = i.c_str();
+ char const* dstConfig = i.c_str();
if (target.GetProperty("EXTERNAL_MSPROJECT")) {
if (cmValue m = target.GetProperty(
cmStrCat("MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(i)))) {
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 0e7ddd0..8b8e37e 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -25,29 +25,28 @@ class BT;
class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
{
public:
- cmGlobalVisualStudio71Generator(cmake* cm,
- const std::string& platformName = "");
+ cmGlobalVisualStudio71Generator(cmake* cm);
protected:
void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators) override;
virtual void WriteSolutionConfigurations(
std::ostream& fout, std::vector<std::string> const& configs);
- void WriteProject(std::ostream& fout, const std::string& name,
- const std::string& path,
- const cmGeneratorTarget* t) override;
- void WriteProjectDepends(std::ostream& fout, const std::string& name,
- const std::string& path,
+ void WriteProject(std::ostream& fout, std::string const& name,
+ std::string const& path,
+ cmGeneratorTarget const* t) override;
+ void WriteProjectDepends(std::ostream& fout, std::string const& name,
+ std::string const& path,
cmGeneratorTarget const* t) override;
void WriteProjectConfigurations(
- std::ostream& fout, const std::string& name,
+ std::ostream& fout, std::string const& name,
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
- const std::set<std::string>& configsPartOfDefaultBuild,
- const std::string& platformMapping = "") override;
+ std::set<std::string> const& configsPartOfDefaultBuild,
+ std::string const& platformMapping = "") override;
void WriteExternalProject(
- std::ostream& fout, const std::string& name, const std::string& path,
+ std::ostream& fout, std::string const& name, std::string const& path,
cmValue typeGuid,
- const std::set<BT<std::pair<std::string, bool>>>& depends) override;
+ std::set<BT<std::pair<std::string, bool>>> const& depends) override;
// Folders are not supported by VS 7.1.
bool UseFolderProperty() const override { return false; }
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 8c644ab..b1c7a24 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio7Generator.h"
#include <algorithm>
@@ -66,9 +66,8 @@ std::string GetSLNFile(cmLocalGenerator* root)
}
}
-cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
- cmake* cm, std::string const& platformInGeneratorName)
- : cmGlobalVisualStudioGenerator(cm, platformInGeneratorName)
+cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(cmake* cm)
+ : cmGlobalVisualStudioGenerator(cm)
{
this->DevEnvCommandInitialized = false;
this->MarmasmEnabled = false;
@@ -82,7 +81,7 @@ cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator() = default;
// Package GUID of Intel Visual Fortran plugin to VS IDE
#define CM_INTEL_PLUGIN_GUID "{B68A201D-CB9B-47AF-A52F-7EEC72E217E4}"
-const std::string& cmGlobalVisualStudio7Generator::GetIntelProjectVersion()
+std::string const& cmGlobalVisualStudio7Generator::GetIntelProjectVersion()
{
if (this->IntelProjectVersion.empty()) {
// Compute the version of the Intel plugin to the VS IDE.
@@ -185,8 +184,8 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
return vscmd;
}
-const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
- const std::string& location)
+char const* cmGlobalVisualStudio7Generator::ExternalProjectType(
+ std::string const& location)
{
std::string extension = cmSystemTools::GetFilenameLastExtension(location);
if (extension == ".vbproj"_s) {
@@ -215,10 +214,10 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalVisualStudio7Generator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& /*projectDir*/,
- std::vector<std::string> const& targetNames, const std::string& config,
- int /*jobs*/, bool /*verbose*/, const cmBuildOptions& /*buildOptions*/,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& /*projectDir*/,
+ std::vector<std::string> const& targetNames, std::string const& config,
+ int /*jobs*/, bool /*verbose*/, cmBuildOptions const& /*buildOptions*/,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else devenv.
@@ -235,7 +234,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand(
}
// Workaround to convince VCExpress.exe to produce output.
- const bool requiresOutputForward =
+ bool const requiresOutputForward =
(makeProgramLower.find("vcexpress") != std::string::npos);
std::vector<GeneratedMakeCommand> makeCommands;
@@ -244,7 +243,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand(
((targetNames.size() == 1) && targetNames.front().empty())) {
realTargetNames = { "ALL_BUILD" };
}
- for (const auto& tname : realTargetNames) {
+ for (auto const& tname : realTargetNames) {
std::string realTarget;
if (!tname.empty()) {
realTarget = tname;
@@ -356,7 +355,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
configs, allConfigurations,
mapping ? *mapping : "");
} else {
- const std::set<std::string>& configsPartOfDefaultBuild =
+ std::set<std::string> const& configsPartOfDefaultBuild =
this->IsPartOfDefaultBuild(configs, projectTargets, target);
cmValue vcprojName = target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName) {
@@ -375,6 +374,40 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
}
}
+cmVisualStudioFolder* cmGlobalVisualStudio7Generator::CreateSolutionFolders(
+ std::string const& path)
+{
+ if (path.empty()) {
+ return nullptr;
+ }
+
+ std::vector<std::string> tokens =
+ cmSystemTools::SplitString(path, '/', false);
+
+ std::string cumulativePath;
+
+ for (std::string const& iter : tokens) {
+ if (iter.empty()) {
+ continue;
+ }
+
+ if (cumulativePath.empty()) {
+ cumulativePath = cmStrCat("CMAKE_FOLDER_GUID_", iter);
+ } else {
+ this->VisualStudioFolders[cumulativePath].Projects.insert(
+ cmStrCat(cumulativePath, '/', iter));
+
+ cumulativePath = cmStrCat(cumulativePath, '/', iter);
+ }
+ }
+
+ if (cumulativePath.empty()) {
+ return nullptr;
+ }
+
+ return &this->VisualStudioFolders[cumulativePath];
+}
+
void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::ostream& fout, cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets)
@@ -421,31 +454,11 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
// Create "solution folder" information from FOLDER target property
//
if (written && this->UseFolderProperty()) {
- const std::string targetFolder = target->GetEffectiveFolderName();
- if (!targetFolder.empty()) {
- std::vector<std::string> tokens =
- cmSystemTools::SplitString(targetFolder, '/', false);
-
- std::string cumulativePath;
-
- for (std::string const& iter : tokens) {
- if (iter.empty()) {
- continue;
- }
-
- if (cumulativePath.empty()) {
- cumulativePath = cmStrCat("CMAKE_FOLDER_GUID_", iter);
- } else {
- VisualStudioFolders[cumulativePath].insert(
- cmStrCat(cumulativePath, '/', iter));
+ cmVisualStudioFolder* folder =
+ this->CreateSolutionFolders(target->GetEffectiveFolderName());
- cumulativePath = cmStrCat(cumulativePath, '/', iter);
- }
- }
-
- if (!cumulativePath.empty()) {
- VisualStudioFolders[cumulativePath].insert(target->GetName());
- }
+ if (folder != nullptr) {
+ folder->Projects.insert(target->GetName());
}
}
}
@@ -467,7 +480,13 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
fout << "Project(\"{" << guidProjectTypeFolder << "}\") = \"" << nameOnly
- << "\", \"" << fullName << "\", \"{" << guid << "}\"\nEndProject\n";
+ << "\", \"" << fullName << "\", \"{" << guid << "}\"\n";
+
+ if (!iter.second.SolutionItems.empty()) {
+ this->WriteFolderSolutionItems(fout, iter.second);
+ }
+
+ fout << "EndProject\n";
}
}
@@ -477,7 +496,7 @@ void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
std::string key(iter.first);
std::string guidParent(this->GetGUID(key));
- for (std::string const& it : iter.second) {
+ for (std::string const& it : iter.second.Projects) {
std::string const& value(it);
std::string guid(this->GetGUID(value));
@@ -487,7 +506,7 @@ void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
}
std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
- const std::string& path)
+ std::string const& path)
{
// Convert to backslashes. Do not use ConvertToOutputPath because
// we will add quoting ourselves, and we know these projects always
@@ -507,7 +526,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
this->GetGUID(cmStrCat(root->GetProjectName(), ".sln"));
bool extensibilityGlobalsOverridden = false;
bool extensibilityAddInsOverridden = false;
- const std::vector<std::string> propKeys =
+ std::vector<std::string> const propKeys =
root->GetMakefile()->GetPropertyKeys();
for (std::string const& it : propKeys) {
if (cmHasLiteralPrefix(it, "VS_GLOBAL_SECTION_")) {
@@ -536,11 +555,11 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
cmValue p = root->GetMakefile()->GetProperty(it);
cmList keyValuePairs{ *p };
for (std::string const& itPair : keyValuePairs) {
- const std::string::size_type posEqual = itPair.find('=');
+ std::string::size_type const posEqual = itPair.find('=');
if (posEqual != std::string::npos) {
- const std::string key =
+ std::string const key =
cmTrimWhitespace(itPair.substr(0, posEqual));
- const std::string value =
+ std::string const value =
cmTrimWhitespace(itPair.substr(posEqual + 1));
fout << "\t\t" << key << " = " << value << '\n';
if (key == "SolutionGuid"_s) {
@@ -653,8 +672,8 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
}
void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig(
- const std::string& prefix, const std::string& config,
- const std::string& suffix, std::string& dir)
+ std::string const& prefix, std::string const& config,
+ std::string const& suffix, std::string& dir)
{
if (!config.empty()) {
dir += cmStrCat(prefix, config, suffix);
@@ -677,7 +696,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
for (std::string const& t : targetNames) {
// check if target <t> is part of default build
if (target->GetName() == t) {
- const std::string propertyName =
+ std::string const propertyName =
cmStrCat("CMAKE_VS_INCLUDE_", t, "_TO_DEFAULT_BUILD");
// inspect CMAKE_VS_INCLUDE_<t>_TO_DEFAULT_BUILD properties
for (std::string const& i : configs) {
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 2056b2f..c4f45b6 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -25,6 +25,12 @@ class cmake;
template <typename T>
class BT;
+struct cmVisualStudioFolder
+{
+ std::set<std::string> Projects;
+ std::set<std::string> SolutionItems;
+};
+
/** \class cmGlobalVisualStudio7Generator
* \brief Write a Unix makefiles.
*
@@ -69,10 +75,10 @@ public:
* loaded commands, not as part of the usual build process.
*/
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
@@ -85,13 +91,13 @@ public:
std::string GetGUID(std::string const& name);
/** Append the subdirectory for the given configuration. */
- void AppendDirectoryForConfig(const std::string& prefix,
- const std::string& config,
- const std::string& suffix,
+ void AppendDirectoryForConfig(std::string const& prefix,
+ std::string const& config,
+ std::string const& suffix,
std::string& dir) override;
//! What is the configurations directory variable called?
- const char* GetCMakeCFGIntDir() const override
+ char const* GetCMakeCFGIntDir() const override
{
return "$(ConfigurationName)";
}
@@ -103,7 +109,7 @@ public:
return false;
}
- const std::string& GetIntelProjectVersion();
+ std::string const& GetIntelProjectVersion();
virtual cm::optional<std::string> GetPlatformToolsetFortran() const
{
return cm::nullopt;
@@ -124,35 +130,36 @@ public:
virtual bool SupportsCxxModuleDyndep() const { return false; }
protected:
- cmGlobalVisualStudio7Generator(cmake* cm,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudio7Generator(cmake* cm);
void Generate() override;
std::string const& GetDevEnvCommand();
virtual std::string FindDevEnvCommand();
- static const char* ExternalProjectType(const std::string& location);
+ static char const* ExternalProjectType(std::string const& location);
virtual void OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators) = 0;
- virtual void WriteProject(std::ostream& fout, const std::string& name,
- const std::string& path,
- const cmGeneratorTarget* t) = 0;
- virtual void WriteProjectDepends(std::ostream& fout, const std::string& name,
- const std::string& path,
+ virtual void WriteProject(std::ostream& fout, std::string const& name,
+ std::string const& path,
+ cmGeneratorTarget const* t) = 0;
+ virtual void WriteProjectDepends(std::ostream& fout, std::string const& name,
+ std::string const& path,
cmGeneratorTarget const* t) = 0;
virtual void WriteProjectConfigurations(
- std::ostream& fout, const std::string& name,
+ std::ostream& fout, std::string const& name,
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
- const std::set<std::string>& configsPartOfDefaultBuild,
- const std::string& platformMapping = "") = 0;
+ std::set<std::string> const& configsPartOfDefaultBuild,
+ std::string const& platformMapping = "") = 0;
virtual void WriteSLNGlobalSections(std::ostream& fout,
cmLocalGenerator* root);
virtual void WriteSLNFooter(std::ostream& fout);
- std::string WriteUtilityDepend(const cmGeneratorTarget* target) override;
+ std::string WriteUtilityDepend(cmGeneratorTarget const* target) override;
+
+ cmVisualStudioFolder* CreateSolutionFolders(std::string const& path);
virtual void WriteTargetsToSolution(
std::ostream& fout, cmLocalGenerator* root,
@@ -162,11 +169,11 @@ protected:
OrderedTargetDependSet const& projectTargets);
virtual void WriteExternalProject(
- std::ostream& fout, const std::string& name, const std::string& path,
+ std::ostream& fout, std::string const& name, std::string const& path,
cmValue typeGuid,
- const std::set<BT<std::pair<std::string, bool>>>& dependencies) = 0;
+ std::set<BT<std::pair<std::string, bool>>> const& dependencies) = 0;
- std::string ConvertToSolutionPath(const std::string& path);
+ std::string ConvertToSolutionPath(std::string const& path);
std::set<std::string> IsPartOfDefaultBuild(
std::vector<std::string> const& configs,
@@ -178,7 +185,12 @@ protected:
virtual void WriteFolders(std::ostream& fout);
virtual void WriteFoldersContent(std::ostream& fout);
- std::map<std::string, std::set<std::string>> VisualStudioFolders;
+
+ virtual void AddSolutionItems(cmLocalGenerator* root) = 0;
+ virtual void WriteFolderSolutionItems(
+ std::ostream& fout, cmVisualStudioFolder const& folder) = 0;
+
+ std::map<std::string, cmVisualStudioFolder> VisualStudioFolders;
// Set during OutputSLNFile with the name of the current project.
// There is one SLN file per project.
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index b1fba8f..e8edb03 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio8Generator.h"
#include <algorithm>
@@ -39,9 +39,8 @@
struct cmIDEFlagTable;
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
- cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName)
- : cmGlobalVisualStudio71Generator(cm, platformInGeneratorName)
+ cmake* cm, std::string const& name)
+ : cmGlobalVisualStudio71Generator(cm)
{
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name;
@@ -88,13 +87,6 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p,
cmMakefile* mf)
{
- if (this->PlatformInGeneratorName) {
- // This is an old-style generator name that contains the platform name.
- // No explicit platform specification is supported, so pass it through
- // to our base class implementation, which errors on non-empty platforms.
- return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform(p, mf);
- }
-
if (!this->ParseGeneratorPlatform(p, mf)) {
return false;
}
@@ -128,12 +120,13 @@ bool cmGlobalVisualStudio8Generator::ParseGeneratorPlatform(
{
this->GeneratorPlatform.clear();
- std::vector<std::string> const fields = cmTokenize(p, ",");
- auto fi = fields.begin();
- if (fi == fields.end()) {
+ std::vector<std::string> const fields =
+ cmTokenize(p, ',', cmTokenizerMode::New);
+ if (fields.empty()) {
return true;
}
+ auto fi = fields.begin();
// The first field may be the VS platform.
if (fi->find('=') == fi->npos) {
this->GeneratorPlatform = *fi;
@@ -252,7 +245,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// Collect the input files used to generate all targets in this
// project.
std::vector<std::string> listFiles;
- for (const auto& gen : generators) {
+ for (auto const& gen : generators) {
cm::append(listFiles, gen->GetMakefile()->GetListFiles());
}
// Sort the list of input files and remove duplicates.
@@ -280,7 +273,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
stampList);
std::string stampFile;
cmGeneratedFileStream fout(stampListFile);
- for (const auto& gi : generators) {
+ for (auto const& gi : generators) {
stampFile = cmStrCat(gi->GetMakefile()->GetCurrentBinaryDirectory(),
"/CMakeFiles/generate.stamp");
fout << stampFile << '\n';
@@ -324,9 +317,12 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list",
stampList, "--vs-solution-file", sln });
- if (cm->GetIgnoreWarningAsError()) {
+ if (cm->GetIgnoreCompileWarningAsError()) {
commandLines[0].emplace_back("--compile-no-warning-as-error");
}
+ if (cm->GetIgnoreLinkWarningAsError()) {
+ commandLines[0].emplace_back("--link-no-warning-as-error");
+ }
// Add the rule. Note that we cannot use the CMakeLists.txt
// file as the main dependency because it would get
@@ -355,9 +351,9 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
cmGlobalVisualStudio7Generator::AddExtraIDETargets();
if (this->AddCheckTarget()) {
for (auto& LocalGenerator : this->LocalGenerators) {
- const auto& tgts = LocalGenerator->GetGeneratorTargets();
+ auto const& tgts = LocalGenerator->GetGeneratorTargets();
// All targets depend on the build-system check target.
- for (const auto& ti : tgts) {
+ for (auto const& ti : tgts) {
if (ti->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
ti->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false);
}
@@ -378,15 +374,15 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations(
}
void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmGeneratorTarget const& target,
+ std::ostream& fout, std::string const& name, cmGeneratorTarget const& target,
std::vector<std::string> const& configs,
- const std::set<std::string>& configsPartOfDefaultBuild,
+ std::set<std::string> const& configsPartOfDefaultBuild,
std::string const& platformMapping)
{
std::string guid = this->GetGUID(name);
for (std::string const& i : configs) {
cmList mapConfig;
- const char* dstConfig = i.c_str();
+ char const* dstConfig = i.c_str();
if (target.GetProperty("EXTERNAL_MSPROJECT")) {
if (cmValue m = target.GetProperty(
cmStrCat("MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(i)))) {
@@ -420,7 +416,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
}
bool cmGlobalVisualStudio8Generator::NeedsDeploy(
- cmGeneratorTarget const& target, const char* config) const
+ cmGeneratorTarget const& target, char const* config) const
{
cmStateEnums::TargetType const type = target.GetType();
if (type != cmStateEnums::EXECUTABLE &&
@@ -463,7 +459,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
}
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
- std::ostream& fout, const std::string&, const std::string&,
+ std::ostream& fout, std::string const&, std::string const&,
cmGeneratorTarget const* gt)
{
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
@@ -522,8 +518,9 @@ static cmVS7FlagTable cmVS8ExtraFlagTable[] = {
// Exception handling mode. If no entries match, it will be FALSE.
{ "ExceptionHandling", "GX", "enable c++ exceptions", "1", 0 },
{ "ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0 },
+ // noqa: spellcheck off
{ "ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0 },
-
+ // noqa: spellcheck on
{ "EnablePREfast", "analyze", "", "true", 0 },
{ "EnablePREfast", "analyze-", "", "false", 0 },
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 931de40..52f94bf 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -51,8 +51,7 @@ public:
}
protected:
- cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudio8Generator(cmake* cm, std::string const& name);
virtual bool ProcessGeneratorPlatformField(std::string const& key,
std::string const& value);
@@ -67,7 +66,7 @@ protected:
/** Return true if the configuration needs to be deployed */
virtual bool NeedsDeploy(cmGeneratorTarget const& target,
- const char* config) const;
+ char const* config) const;
/** Returns true if the target system support debugging deployment. */
virtual bool TargetSystemSupportsDeployment() const;
@@ -76,14 +75,14 @@ protected:
void WriteSolutionConfigurations(
std::ostream& fout, std::vector<std::string> const& configs) override;
void WriteProjectConfigurations(
- std::ostream& fout, const std::string& name,
+ std::ostream& fout, std::string const& name,
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
- const std::set<std::string>& configsPartOfDefaultBuild,
- const std::string& platformMapping = "") override;
+ std::set<std::string> const& configsPartOfDefaultBuild,
+ std::string const& platformMapping = "") override;
bool ComputeTargetDepends() override;
- void WriteProjectDepends(std::ostream& fout, const std::string& name,
- const std::string& path,
- const cmGeneratorTarget* t) override;
+ void WriteProjectDepends(std::ostream& fout, std::string const& name,
+ std::string const& path,
+ cmGeneratorTarget const* t) override;
bool UseFolderProperty() const override;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 5ff9506..c66c03a 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -1,6 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioGenerator.h"
#include <cassert>
@@ -36,20 +36,13 @@
#include "cmTarget.h"
#include "cmake.h"
-cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(
- cmake* cm, std::string const& platformInGeneratorName)
+cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
: cmGlobalGenerator(cm)
{
cm->GetState()->SetIsGeneratorMultiConfig(true);
cm->GetState()->SetWindowsShell(true);
cm->GetState()->SetWindowsVSIDE(true);
-
- if (platformInGeneratorName.empty()) {
- this->DefaultPlatformName = "Win32";
- } else {
- this->DefaultPlatformName = platformInGeneratorName;
- this->PlatformInGeneratorName = true;
- }
+ this->DefaultPlatformName = "Win32";
}
cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() = default;
@@ -93,6 +86,16 @@ bool cmGlobalVisualStudioGenerator::InitializePlatform(cmMakefile*)
return true;
}
+cmValue cmGlobalVisualStudioGenerator::GetDebuggerWorkingDirectory(
+ cmGeneratorTarget* gt) const
+{
+ if (cmValue ret = gt->GetProperty("VS_DEBUGGER_WORKING_DIRECTORY")) {
+ return ret;
+ } else {
+ return cmGlobalGenerator::GetDebuggerWorkingDirectory(gt);
+ }
+}
+
std::string const& cmGlobalVisualStudioGenerator::GetPlatformName() const
{
if (!this->GeneratorPlatform.empty()) {
@@ -101,7 +104,7 @@ std::string const& cmGlobalVisualStudioGenerator::GetPlatformName() const
return this->DefaultPlatformName;
}
-const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const
+char const* cmGlobalVisualStudioGenerator::GetIDEVersion() const
{
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -167,7 +170,7 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase()
return cmGlobalVisualStudioGenerator::GetRegistryBase(this->GetIDEVersion());
}
-std::string cmGlobalVisualStudioGenerator::GetRegistryBase(const char* version)
+std::string cmGlobalVisualStudioGenerator::GetRegistryBase(char const* version)
{
return cmStrCat(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\)",
version);
@@ -201,7 +204,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
// Now make all targets depend on the ALL_BUILD target
for (cmLocalGenerator const* i : gen) {
- for (const auto& tgt : i->GetGeneratorTargets()) {
+ for (auto const& tgt : i->GetGeneratorTargets()) {
if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
tgt->IsImported()) {
continue;
@@ -229,7 +232,7 @@ void cmGlobalVisualStudioGenerator::ComputeTargetObjectDirectory(
dir += tgtDir;
dir += '/';
}
- const char* cd = this->GetCMakeCFGIntDir();
+ char const* cd = this->GetCMakeCFGIntDir();
if (cd && *cd) {
dir += cd;
dir += '/';
@@ -237,12 +240,12 @@ void cmGlobalVisualStudioGenerator::ComputeTargetObjectDirectory(
gt->ObjectDirectory = dir;
}
-bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
- const std::string& regKeyBase,
+bool IsVisualStudioMacrosFileRegistered(std::string const& macrosFile,
+ std::string const& regKeyBase,
std::string& nextAvailableSubKeyName);
-void RegisterVisualStudioMacros(const std::string& macrosFile,
- const std::string& regKeyBase);
+void RegisterVisualStudioMacros(std::string const& macrosFile,
+ std::string const& regKeyBase);
#define CMAKE_VSMACROS_FILENAME "CMakeVSMacros2.vsmacros"
@@ -281,7 +284,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
}
void cmGlobalVisualStudioGenerator::CallVisualStudioMacro(
- MacroName m, const std::string& vsSolutionFile)
+ MacroName m, std::string const& vsSolutionFile)
{
// If any solution or project files changed during the generation,
// tell Visual Studio to reload them...
@@ -329,7 +332,7 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
}
void cmGlobalVisualStudioGenerator::FillLinkClosure(
- const cmGeneratorTarget* target, TargetSet& linked)
+ cmGeneratorTarget const* target, TargetSet& linked)
{
if (linked.insert(target).second) {
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
@@ -354,7 +357,7 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target)
}
void cmGlobalVisualStudioGenerator::FollowLinkDepends(
- const cmGeneratorTarget* target, std::set<const cmGeneratorTarget*>& linked)
+ cmGeneratorTarget const* target, std::set<cmGeneratorTarget const*>& linked)
{
if (!target->IsInBuildSystem()) {
return;
@@ -378,8 +381,8 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
return false;
}
for (auto const& it : this->ProjectMap) {
- for (const cmLocalGenerator* i : it.second) {
- for (const auto& ti : i->GetGeneratorTargets()) {
+ for (cmLocalGenerator const* i : it.second) {
+ for (auto const& ti : i->GetGeneratorTargets()) {
this->ComputeVSTargetDepends(ti.get());
}
}
@@ -402,7 +405,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// VS <= 7.1 has two behaviors that affect solution dependencies.
//
// (1) Solution-level dependencies between a linkable target and a
- // library cause that library to be linked. We use an intermedite
+ // library cause that library to be linked. We use an intermediate
// empty utility target to express the dependency. (VS 8 and above
// provide a project file "LinkLibraryDependencies" setting to
// choose whether to activate this behavior. We disable it except
@@ -513,8 +516,8 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName(
return this->GetAllTargetName();
}
-bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
- const std::string& regKeyBase,
+bool IsVisualStudioMacrosFileRegistered(std::string const& macrosFile,
+ std::string const& regKeyBase,
std::string& nextAvailableSubKeyName)
{
bool macrosRegistered = false;
@@ -666,9 +669,9 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
return macrosRegistered;
}
-void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName,
- const std::string& macrosFile,
- const std::string& regKeyBase)
+void WriteVSMacrosFileRegistryEntry(std::string const& nextAvailableSubKeyName,
+ std::string const& macrosFile,
+ std::string const& regKeyBase)
{
std::string keyname = cmStrCat(regKeyBase, "\\OtherProjects7");
HKEY hkey = nullptr;
@@ -729,8 +732,8 @@ void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName,
}
}
-void RegisterVisualStudioMacros(const std::string& macrosFile,
- const std::string& regKeyBase)
+void RegisterVisualStudioMacros(std::string const& macrosFile,
+ std::string const& regKeyBase)
{
bool macrosRegistered;
std::string nextAvailableSubKeyName;
@@ -809,13 +812,13 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
}
bool cmGlobalVisualStudioGenerator::IsInSolution(
- const cmGeneratorTarget* gt) const
+ cmGeneratorTarget const* gt) const
{
return gt->IsInBuildSystem();
}
bool cmGlobalVisualStudioGenerator::IsDepInSolution(
- const std::string& targetName) const
+ std::string const& targetName) const
{
return !targetName.empty();
}
@@ -852,7 +855,7 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet::OrderedTargetDependSet(
}
std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
- const std::string& str, const std::string& config) const
+ std::string const& str, std::string const& config) const
{
std::string replace = GetCMakeCFGIntDir();
@@ -903,7 +906,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
for (cmSourceFile const* it : objectSources) {
// Find the object file name corresponding to this source file.
// It must exist because we populated the mapping just above.
- const auto& v = mapping[it];
+ auto const& v = mapping[it];
assert(!v.empty());
std::string objFile = cmStrCat(obj_dir, v);
objs.push_back(objFile);
@@ -957,8 +960,8 @@ static bool OpenSolution(std::string const& sln)
return reinterpret_cast<intptr_t>(hi) > 32;
}
-bool cmGlobalVisualStudioGenerator::Open(const std::string& bindir,
- const std::string& projectName,
+bool cmGlobalVisualStudioGenerator::Open(std::string const& bindir,
+ std::string const& projectName,
bool dryRun)
{
std::string sln = cmStrCat(bindir, '/', projectName, ".sln");
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index a53b3bd..2fce9bb 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -78,6 +78,8 @@ public:
*/
virtual std::string GetUserMacrosRegKeyBase();
+ cmValue GetDebuggerWorkingDirectory(cmGeneratorTarget* gt) const override;
+
enum MacroName
{
MacroReload,
@@ -88,22 +90,22 @@ public:
* Call the ReloadProjects macro if necessary based on
* GetFilesReplacedDuringGenerate results.
*/
- void CallVisualStudioMacro(MacroName m, const std::string& vsSolutionFile);
+ void CallVisualStudioMacro(MacroName m, std::string const& vsSolutionFile);
// return true if target is fortran only
- bool TargetIsFortranOnly(const cmGeneratorTarget* gt);
+ bool TargetIsFortranOnly(cmGeneratorTarget const* gt);
// return true if target should be included in solution.
- virtual bool IsInSolution(const cmGeneratorTarget* gt) const;
+ virtual bool IsInSolution(cmGeneratorTarget const* gt) const;
// return true if project dependency should be included in solution.
- virtual bool IsDepInSolution(const std::string& targetName) const;
+ virtual bool IsDepInSolution(std::string const& targetName) const;
/** Get the top-level registry key for this VS version. */
std::string GetRegistryBase();
/** Get the top-level registry key for the given VS version. */
- static std::string GetRegistryBase(const char* version);
+ static std::string GetRegistryBase(char const* version);
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */
@@ -140,8 +142,8 @@ public:
bool FindMakeProgram(cmMakefile*) override;
- std::string ExpandCFGIntDir(const std::string& str,
- const std::string& config) const override;
+ std::string ExpandCFGIntDir(std::string const& str,
+ std::string const& config) const override;
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override;
@@ -151,14 +153,13 @@ public:
std::vector<cmCustomCommand>& commands,
std::string const& configName);
- bool Open(const std::string& bindir, const std::string& projectName,
+ bool Open(std::string const& bindir, std::string const& projectName,
bool dryRun) override;
bool IsVisualStudio() const override { return true; }
protected:
- cmGlobalVisualStudioGenerator(cmake* cm,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudioGenerator(cmake* cm);
virtual bool InitializePlatform(cmMakefile* mf);
@@ -169,7 +170,7 @@ protected:
// below 8.
virtual bool VSLinksDependencies() const { return true; }
- const char* GetIDEVersion() const;
+ char const* GetIDEVersion() const;
void WriteSLNHeader(std::ostream& fout);
@@ -184,7 +185,7 @@ protected:
void ComputeVSTargetDepends(cmGeneratorTarget*);
virtual std::string WriteUtilityDepend(cmGeneratorTarget const*) = 0;
- std::string GetUtilityDepend(const cmGeneratorTarget* target);
+ std::string GetUtilityDepend(cmGeneratorTarget const* target);
using UtilityDependsMap = std::map<cmGeneratorTarget const*, std::string>;
UtilityDependsMap UtilityDepends;
@@ -193,7 +194,6 @@ protected:
std::string GeneratorPlatform;
std::string DefaultPlatformName;
- bool PlatformInGeneratorName = false;
private:
virtual std::string GetVSMakeProgram() = 0;
@@ -209,7 +209,7 @@ private:
{
};
TargetSetMap TargetLinkClosure;
- void FillLinkClosure(const cmGeneratorTarget* target, TargetSet& linked);
+ void FillLinkClosure(cmGeneratorTarget const* target, TargetSet& linked);
TargetSet const& GetTargetLinkClosure(cmGeneratorTarget* target);
};
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 14460fd..4ba1c5a 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioVersionedGenerator.h"
#include <cstring>
@@ -137,7 +137,7 @@ static unsigned int VSVersionToMajor(
return 0;
}
-static const char* VSVersionToToolset(
+static char const* VSVersionToToolset(
cmGlobalVisualStudioGenerator::VSVersion v)
{
switch (v) {
@@ -169,7 +169,7 @@ static std::string VSVersionToMajorString(
return "";
}
-static const char* VSVersionToAndroidToolset(
+static char const* VSVersionToAndroidToolset(
cmGlobalVisualStudioGenerator::VSVersion v)
{
switch (v) {
@@ -183,16 +183,16 @@ static const char* VSVersionToAndroidToolset(
return "";
}
-static const char vs15generatorName[] = "Visual Studio 15 2017";
+static char const vs15generatorName[] = "Visual Studio 15 2017";
// Map generator name without year to name with year.
-static const char* cmVS15GenName(const std::string& name, std::string& genName)
+static char const* cmVS15GenName(std::string const& name, std::string& genName)
{
if (strncmp(name.c_str(), vs15generatorName,
sizeof(vs15generatorName) - 6) != 0) {
return nullptr;
}
- const char* p = name.c_str() + sizeof(vs15generatorName) - 6;
+ char const* p = name.c_str() + sizeof(vs15generatorName) - 6;
if (cmHasLiteralPrefix(p, " 2017")) {
p += 5;
}
@@ -205,39 +205,26 @@ class cmGlobalVisualStudioVersionedGenerator::Factory15
{
public:
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool allowArch, cmake* cm) const override
+ std::string const& name, cmake* cm) const override
{
std::string genName;
- const char* p = cmVS15GenName(name, genName);
+ char const* p = cmVS15GenName(name, genName);
if (!p) {
return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
return std::unique_ptr<cmGlobalGenerator>(
new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, ""));
- }
- if (!allowArch || *p++ != ' ') {
- return std::unique_ptr<cmGlobalGenerator>();
- }
- if (strcmp(p, "Win64") == 0) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "x64"));
- }
- if (strcmp(p, "ARM") == 0) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "ARM"));
+ cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName));
}
return std::unique_ptr<cmGlobalGenerator>();
}
cmDocumentationEntry GetDocumentation() const override
{
- return { cmStrCat(vs15generatorName, " [arch]"),
+ return { std::string(vs15generatorName),
"Generates Visual Studio 2017 project files. "
- "Optional [arch] can be \"Win64\" or \"ARM\"." };
+ "Use -A option to specify architecture." };
}
std::vector<std::string> GetGeneratorNames() const override
@@ -247,14 +234,6 @@ public:
return names;
}
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- std::vector<std::string> names;
- names.emplace_back(cmStrCat(vs15generatorName, " ARM"));
- names.emplace_back(cmStrCat(vs15generatorName, " Win64"));
- return names;
- }
-
bool SupportsToolset() const override { return true; }
bool SupportsPlatform() const override { return true; }
@@ -277,17 +256,17 @@ cmGlobalVisualStudioVersionedGenerator::NewFactory15()
return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory15);
}
-static const char vs16generatorName[] = "Visual Studio 16 2019";
-static const char vs17generatorName[] = "Visual Studio 17 2022";
+static char const vs16generatorName[] = "Visual Studio 16 2019";
+static char const vs17generatorName[] = "Visual Studio 17 2022";
// Map generator name without year to name with year.
-static const char* cmVS16GenName(const std::string& name, std::string& genName)
+static char const* cmVS16GenName(std::string const& name, std::string& genName)
{
if (strncmp(name.c_str(), vs16generatorName,
sizeof(vs16generatorName) - 6) != 0) {
return nullptr;
}
- const char* p = name.c_str() + sizeof(vs16generatorName) - 6;
+ char const* p = name.c_str() + sizeof(vs16generatorName) - 6;
if (cmHasLiteralPrefix(p, " 2019")) {
p += 5;
}
@@ -295,13 +274,13 @@ static const char* cmVS16GenName(const std::string& name, std::string& genName)
return p;
}
-static const char* cmVS17GenName(const std::string& name, std::string& genName)
+static char const* cmVS17GenName(std::string const& name, std::string& genName)
{
if (strncmp(name.c_str(), vs17generatorName,
sizeof(vs17generatorName) - 6) != 0) {
return nullptr;
}
- const char* p = name.c_str() + sizeof(vs17generatorName) - 6;
+ char const* p = name.c_str() + sizeof(vs17generatorName) - 6;
if (cmHasLiteralPrefix(p, " 2022")) {
p += 5;
}
@@ -314,17 +293,17 @@ class cmGlobalVisualStudioVersionedGenerator::Factory16
{
public:
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool /*allowArch*/, cmake* cm) const override
+ std::string const& name, cmake* cm) const override
{
std::string genName;
- const char* p = cmVS16GenName(name, genName);
+ char const* p = cmVS16GenName(name, genName);
if (!p) {
return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
return std::unique_ptr<cmGlobalGenerator>(
new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VSVersion::VS16, cm, genName, ""));
+ cmGlobalVisualStudioGenerator::VSVersion::VS16, cm, genName));
}
return std::unique_ptr<cmGlobalGenerator>();
}
@@ -343,11 +322,6 @@ public:
return names;
}
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- return std::vector<std::string>();
- }
-
bool SupportsToolset() const override { return true; }
bool SupportsPlatform() const override { return true; }
@@ -379,17 +353,17 @@ class cmGlobalVisualStudioVersionedGenerator::Factory17
{
public:
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool /*allowArch*/, cmake* cm) const override
+ std::string const& name, cmake* cm) const override
{
std::string genName;
- const char* p = cmVS17GenName(name, genName);
+ char const* p = cmVS17GenName(name, genName);
if (!p) {
return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
return std::unique_ptr<cmGlobalGenerator>(
new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VSVersion::VS17, cm, genName, ""));
+ cmGlobalVisualStudioGenerator::VSVersion::VS17, cm, genName));
}
return std::unique_ptr<cmGlobalGenerator>();
}
@@ -408,11 +382,6 @@ public:
return names;
}
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- return std::vector<std::string>();
- }
-
bool SupportsToolset() const override { return true; }
bool SupportsPlatform() const override { return true; }
@@ -440,9 +409,8 @@ cmGlobalVisualStudioVersionedGenerator::NewFactory17()
}
cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
- VSVersion version, cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName)
- : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName)
+ VSVersion version, cmake* cm, std::string const& name)
+ : cmGlobalVisualStudio14Generator(cm, name)
, vsSetupAPIHelper(VSVersionToMajor(version))
{
this->Version = version;
@@ -466,7 +434,7 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
}
bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName(
- const std::string& name) const
+ std::string const& name) const
{
std::string genName;
switch (this->Version) {
@@ -584,12 +552,13 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
this->GeneratorInstance.clear();
this->GeneratorInstanceVersion.clear();
- std::vector<std::string> const fields = cmTokenize(is, ",");
- auto fi = fields.begin();
- if (fi == fields.end()) {
+ std::vector<std::string> const fields =
+ cmTokenize(is, ',', cmTokenizerMode::New);
+ if (fields.empty()) {
return true;
}
+ auto fi = fields.begin();
// The first field may be the VS instance.
if (fi->find('=') == fi->npos) {
this->GeneratorInstance = *fi;
@@ -730,7 +699,7 @@ bool cmGlobalVisualStudioVersionedGenerator::IsScanDependenciesSupported()
cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer17_6_P7));
}
-const char*
+char const*
cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision()
const
{
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index 49643ea..b597965 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,7 +27,7 @@ public:
static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory16();
static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory17();
- bool MatchesGeneratorName(const std::string& name) const override;
+ bool MatchesGeneratorName(std::string const& name) const override;
bool SetGeneratorInstance(std::string const& i, cmMakefile* mf) override;
@@ -46,7 +46,7 @@ public:
bool IsScanDependenciesSupported() const override;
- const char* GetAndroidApplicationTypeRevision() const override;
+ char const* GetAndroidApplicationTypeRevision() const override;
bool CheckCxxModuleSupport(CxxModuleSupportQuery /*query*/) override
{
@@ -58,9 +58,8 @@ public:
}
protected:
- cmGlobalVisualStudioVersionedGenerator(
- VSVersion version, cmake* cm, const std::string& name,
- std::string const& platformInGeneratorName);
+ cmGlobalVisualStudioVersionedGenerator(VSVersion version, cmake* cm,
+ std::string const& name);
bool SelectWindowsStoreToolset(std::string& toolset) const override;
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index ca7a1b9..1036747 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalWatcomWMakeGenerator.h"
#include <ostream>
@@ -64,10 +64,10 @@ cmDocumentationEntry cmGlobalWatcomWMakeGenerator::GetDocumentation()
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalWatcomWMakeGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int /*jobs*/, bool verbose,
- const cmBuildOptions& buildOptions,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int /*jobs*/, bool verbose,
+ cmBuildOptions const& buildOptions,
std::vector<std::string> const& makeOptions)
{
return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index 8b24679..d0fb653 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -57,10 +57,10 @@ public:
protected:
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e691b1e..2e0dcca 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGlobalXCodeGenerator.h"
#include <algorithm>
@@ -27,6 +27,7 @@
#include "cmCustomCommandTypes.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGeneratorFactory.h"
#include "cmLinkItem.h"
@@ -79,11 +80,11 @@ public:
: Version("1.5")
{
}
- void StartElement(const std::string&, const char**) override
+ void StartElement(std::string const&, char const**) override
{
this->Data = "";
}
- void EndElement(const std::string& name) override
+ void EndElement(std::string const& name) override
{
if (name == "key"_s) {
this->Key = this->Data;
@@ -93,7 +94,7 @@ public:
}
}
}
- void CharacterDataHandler(const char* data, int length) override
+ void CharacterDataHandler(char const* data, int length) override
{
this->Data.append(data, length);
}
@@ -123,7 +124,7 @@ public:
bool IsEmpty() const { return this->Empty; }
- void Add(const std::string& newString)
+ void Add(std::string const& newString)
{
this->Empty = false;
@@ -135,7 +136,7 @@ public:
}
}
- const std::string& GetString() const { return this->String; }
+ std::string const& GetString() const { return this->String; }
cmXCodeObject* CreateList()
{
@@ -150,7 +151,7 @@ class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
{
public:
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool allowArch, cmake* cm) const override;
+ std::string const& name, cmake* cm) const override;
cmDocumentationEntry GetDocumentation() const override
{
@@ -164,11 +165,6 @@ public:
return names;
}
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- return std::vector<std::string>();
- }
-
bool SupportsToolset() const override { return true; }
bool SupportsPlatform() const override { return false; }
@@ -211,8 +207,7 @@ std::unique_ptr<cmGlobalGeneratorFactory> cmGlobalXCodeGenerator::NewFactory()
}
std::unique_ptr<cmGlobalGenerator>
-cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
- bool /*allowArch*/,
+cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(std::string const& name,
cmake* cm) const
{
if (name != GetActualName()) {
@@ -357,12 +352,13 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
bool cmGlobalXCodeGenerator::ParseGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
- std::vector<std::string> const fields = cmTokenize(ts, ",");
- auto fi = fields.cbegin();
- if (fi == fields.cend()) {
+ std::vector<std::string> const fields =
+ cmTokenize(ts, ',', cmTokenizerMode::New);
+ if (fields.empty()) {
return true;
}
+ auto fi = fields.cbegin();
// The first field may be the Xcode GCC_VERSION.
if (fi->find('=') == fi->npos) {
this->GeneratorToolset = *fi;
@@ -471,8 +467,8 @@ void cmGlobalXCodeGenerator::EnableLanguage(
this->ComputeArchitectures(mf);
}
-bool cmGlobalXCodeGenerator::Open(const std::string& bindir,
- const std::string& projectName, bool dryRun)
+bool cmGlobalXCodeGenerator::Open(std::string const& bindir,
+ std::string const& projectName, bool dryRun)
{
bool ret = false;
@@ -506,10 +502,10 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir,
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
cmGlobalXCodeGenerator::GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& /*projectDir*/,
- std::vector<std::string> const& targetNames, const std::string& config,
- int jobs, bool /*verbose*/, const cmBuildOptions& /*buildOptions*/,
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& /*projectDir*/,
+ std::vector<std::string> const& targetNames, std::string const& config,
+ int jobs, bool /*verbose*/, cmBuildOptions const& /*buildOptions*/,
std::vector<std::string> const& makeOptions)
{
GeneratedMakeCommand makeCommand;
@@ -531,7 +527,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
((targetNames.size() == 1) && targetNames.front().empty())) {
makeCommand.Add("-target", "ALL_BUILD");
} else {
- for (const auto& tname : targetNames) {
+ for (auto const& tname : targetNames) {
if (!tname.empty()) {
makeCommand.Add("-target", tname);
}
@@ -690,7 +686,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// now make the allbuild depend on all the non-utility targets
// in the project
for (auto& gen : gens) {
- for (const auto& target : gen->GetGeneratorTargets()) {
+ for (auto const& target : gen->GetGeneratorTargets()) {
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
@@ -754,7 +750,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
"space:= $(empty) $(empty)\n"
"spaceplus:= $(empty)\\ $(empty)\n\n";
- for (const auto& lfile : lfiles) {
+ for (auto const& lfile : lfiles) {
makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard "
<< ConvertToMakefilePath(lfile) << "))\n";
}
@@ -778,18 +774,18 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
}
makefileStream << ConvertToMakefilePath(checkCache) << ": $(TARGETS)\n";
- makefileStream << '\t'
- << ConvertToMakefilePath(cmSystemTools::GetCMakeCommand())
- << " -S" << ConvertToMakefilePath(root->GetSourceDirectory())
- << " -B" << ConvertToMakefilePath(root->GetBinaryDirectory())
- << (cm->GetIgnoreWarningAsError()
- ? " --compile-no-warning-as-error"
- : "")
- << '\n';
+ makefileStream
+ << '\t' << ConvertToMakefilePath(cmSystemTools::GetCMakeCommand()) << " -S"
+ << ConvertToMakefilePath(root->GetSourceDirectory()) << " -B"
+ << ConvertToMakefilePath(root->GetBinaryDirectory())
+ << (cm->GetIgnoreCompileWarningAsError() ? " --compile-no-warning-as-error"
+ : "")
+ << (cm->GetIgnoreLinkWarningAsError() ? " --link-no-warning-as-error" : "")
+ << '\n';
}
-static bool objectIdLessThan(const std::unique_ptr<cmXCodeObject>& l,
- const std::unique_ptr<cmXCodeObject>& r)
+static bool objectIdLessThan(std::unique_ptr<cmXCodeObject> const& l,
+ std::unique_ptr<cmXCodeObject> const& r)
{
return l->GetId() < r->GetId();
}
@@ -811,7 +807,6 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
this->TargetGroup.clear();
this->FileRefs.clear();
this->ExternalLibRefs.clear();
- this->EmbeddedLibRefs.clear();
this->FileRefToBuildFileMap.clear();
this->FileRefToEmbedBuildFileMap.clear();
this->CommandsVisited.clear();
@@ -820,7 +815,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
void cmGlobalXCodeGenerator::addObject(std::unique_ptr<cmXCodeObject> obj)
{
if (obj->GetType() == cmXCodeObject::OBJECT) {
- const std::string& id = obj->GetId();
+ std::string const& id = obj->GetId();
// If this is a duplicate id, it's an error:
//
@@ -855,7 +850,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type)
return ptr;
}
-cmXCodeObject* cmGlobalXCodeGenerator::CreateString(const std::string& s)
+cmXCodeObject* cmGlobalXCodeGenerator::CreateString(std::string const& s)
{
cmXCodeObject* obj = this->CreateObject(cmXCodeObject::STRING);
obj->SetString(s);
@@ -878,14 +873,14 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig)
}
static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target,
- const std::string& fullpath)
+ std::string const& fullpath)
{
return cmStrCat(target->GetName(), '-', fullpath);
}
cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath(
- const std::string& fullpath, cmGeneratorTarget* target,
- const std::string& lang, cmSourceFile* sf)
+ std::string const& fullpath, cmGeneratorTarget* target,
+ std::string const& lang, cmSourceFile* sf)
{
// Using a map and the full path guarantees that we will always get the same
// fileRef object for any given full path. Same goes for the buildFile
@@ -914,7 +909,7 @@ public:
XCodeGeneratorExpressionInterpreter(cmSourceFile* sourceFile,
cmLocalGenerator* localGenerator,
cmGeneratorTarget* headTarget,
- const std::string& lang)
+ std::string const& lang)
: cmGeneratorExpressionInterpreter(
localGenerator, "NO-PER-CONFIG-SUPPORT-IN-XCODE", headTarget, lang)
, SourceFile(sourceFile)
@@ -926,16 +921,16 @@ public:
XCodeGeneratorExpressionInterpreter& operator=(
XCodeGeneratorExpressionInterpreter const&) = delete;
- const std::string& Evaluate(const char* expression,
- const std::string& property)
+ std::string const& Evaluate(char const* expression,
+ std::string const& property)
{
return this->Evaluate(std::string(expression ? expression : ""), property);
}
- const std::string& Evaluate(const std::string& expression,
- const std::string& property)
+ std::string const& Evaluate(std::string const& expression,
+ std::string const& property)
{
- const std::string& processed =
+ std::string const& processed =
this->cmGeneratorExpressionInterpreter::Evaluate(expression, property);
if (this->CompiledGeneratorExpression->GetHadContextSensitiveCondition()) {
std::ostringstream e;
@@ -981,11 +976,11 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// so user flags can override it.
gtgt->AddExplicitLanguageFlags(flags, *sf);
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
if (cmValue cflags = sf->GetProperty(COMPILE_FLAGS)) {
lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
}
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
if (cmValue coptions = sf->GetProperty(COMPILE_OPTIONS)) {
lg->AppendCompileOptions(
flags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS));
@@ -993,7 +988,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add per-source definitions.
BuildObjectListOrString flagsBuild(this, false);
- const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (cmValue compile_defs = sf->GetProperty(COMPILE_DEFINITIONS)) {
this->AppendDefines(
flagsBuild,
@@ -1014,7 +1009,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add per-source include directories.
std::vector<std::string> includes;
- const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (cmValue cincludes = sf->GetProperty(INCLUDE_DIRECTORIES)) {
lg->AppendIncludeDirectories(
includes, genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES),
@@ -1053,7 +1048,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
cmList attributes{ *extraFileAttributes };
// Store the attributes.
- for (const auto& attribute : attributes) {
+ for (auto const& attribute : attributes) {
attrs->AddObject(this->CreateString(attribute));
}
}
@@ -1069,9 +1064,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
void cmGlobalXCodeGenerator::AddXCodeProjBuildRule(
cmGeneratorTarget* target, std::vector<cmSourceFile*>& sources) const
{
- std::string listfile =
- cmStrCat(target->GetLocalGenerator()->GetCurrentSourceDirectory(),
- "/CMakeLists.txt");
+ std::string listfile = this->GetCMakeInstance()->GetCMakeListFile(
+ target->GetLocalGenerator()->GetCurrentSourceDirectory());
cmSourceFile* srcCMakeLists = target->Makefile->GetOrCreateSource(
listfile, false, cmSourceFileLocationKind::Known);
if (!cm::contains(sources, srcCMakeLists)) {
@@ -1081,7 +1075,7 @@ void cmGlobalXCodeGenerator::AddXCodeProjBuildRule(
namespace {
-bool IsLinkPhaseLibraryExtension(const std::string& fileExt)
+bool IsLinkPhaseLibraryExtension(std::string const& fileExt)
{
// Empty file extension is a special case for paths to framework's
// internal binary which could be MyFw.framework/Versions/*/MyFw
@@ -1089,7 +1083,7 @@ bool IsLinkPhaseLibraryExtension(const std::string& fileExt)
fileExt == ".a"_s || fileExt == ".o"_s || fileExt == ".dylib"_s ||
fileExt == ".tbd"_s || fileExt.empty());
}
-bool IsLibraryType(const std::string& fileType)
+bool IsLibraryType(std::string const& fileType)
{
return (fileType == "wrapper.framework"_s ||
fileType == "wrapper.xcframework"_s || fileType == "archive.ar"_s ||
@@ -1099,7 +1093,7 @@ bool IsLibraryType(const std::string& fileType)
fileType == "sourcecode.text-based-dylib-definition"_s);
}
-std::string GetDirectoryValueFromFileExtension(const std::string& dirExt)
+std::string GetDirectoryValueFromFileExtension(std::string const& dirExt)
{
std::string ext = cmSystemTools::LowerCase(dirExt);
if (ext == "framework"_s) {
@@ -1115,8 +1109,8 @@ std::string GetDirectoryValueFromFileExtension(const std::string& dirExt)
}
std::string GetSourcecodeValueFromFileExtension(
- const std::string& _ext, const std::string& lang,
- bool& keepLastKnownFileType, const std::vector<std::string>& enabled_langs)
+ std::string const& _ext, std::string const& lang,
+ bool& keepLastKnownFileType, std::vector<std::string> const& enabled_langs)
{
std::string ext = cmSystemTools::LowerCase(_ext);
std::string sourcecode = "default";
@@ -1199,7 +1193,7 @@ std::string GetSourcecodeValueFromFileExtension(
template <class T>
std::string GetTargetObjectDirArch(T const& target,
- const std::string& defaultVal)
+ std::string const& defaultVal)
{
cmList archs{ target.GetSafeProperty("OSX_ARCHITECTURES") };
if (archs.size() > 1) {
@@ -1216,7 +1210,7 @@ std::string GetTargetObjectDirArch(T const& target,
// Extracts the framework directory, if path matches the framework syntax
// otherwise returns the path untouched
std::string cmGlobalXCodeGenerator::GetLibraryOrFrameworkPath(
- const std::string& path) const
+ std::string const& path) const
{
auto fwDescriptor = this->SplitFrameworkPath(path);
if (fwDescriptor) {
@@ -1227,8 +1221,8 @@ std::string cmGlobalXCodeGenerator::GetLibraryOrFrameworkPath(
}
cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
- const std::string& fullpath, cmGeneratorTarget* target,
- const std::string& lang, cmSourceFile* sf)
+ std::string const& fullpath, cmGeneratorTarget* target,
+ std::string const& lang, cmSourceFile* sf)
{
bool useLastKnownFileType = false;
std::string fileType;
@@ -1291,7 +1285,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
path = this->RelativeToSource(path);
}
std::string name = cmSystemTools::GetFilenameName(path);
- const char* sourceTree =
+ char const* sourceTree =
cmSystemTools::FileIsFullPath(path) ? "<absolute>" : "SOURCE_ROOT";
fileRef->AddAttribute("name", this->CreateString(name));
fileRef->AddAttribute("path", this->CreateString(path));
@@ -1365,12 +1359,20 @@ struct cmCompareTargets
{
std::string const& a = l->GetTarget()->GetName();
std::string const& b = r->GetTarget()->GetName();
+ if (a == b) {
+ return false;
+ }
if (a == "ALL_BUILD"_s) {
return true;
}
if (b == "ALL_BUILD"_s) {
return false;
}
+ std::string a_low = cmSystemTools::LowerCase(l->GetTarget()->GetName());
+ std::string b_low = cmSystemTools::LowerCase(r->GetTarget()->GetName());
+ if (a_low != b_low) {
+ return a_low < b_low;
+ }
return a < b;
}
};
@@ -1665,9 +1667,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
{
- for (const auto& localGenerator : this->LocalGenerators) {
+ for (auto const& localGenerator : this->LocalGenerators) {
// All targets depend on the build-system check target.
- for (const auto& tgt : localGenerator->GetGeneratorTargets()) {
+ for (auto const& tgt : localGenerator->GetGeneratorTargets()) {
// This makes sure all targets link using the proper language.
this->ForceLinkerLanguage(tgt.get());
}
@@ -1698,7 +1700,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
}
// Allow empty source file list for iOS Sticker packs
- if (const char* productType = GetTargetProductType(gtgt)) {
+ if (char const* productType = GetTargetProductType(gtgt)) {
if (strcmp(productType,
"com.apple.product-type.app-extension.messages-sticker-pack") ==
0) {
@@ -1731,8 +1733,8 @@ bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf)
}
cmXCodeObject* cmGlobalXCodeGenerator::CreateLegacyRunScriptBuildPhase(
- const char* name, const char* name2, cmGeneratorTarget* target,
- const std::vector<cmCustomCommand>& commands)
+ char const* name, char const* name2, cmGeneratorTarget* target,
+ std::vector<cmCustomCommand> const& commands)
{
if (commands.empty() && strcmp(name, "CMake ReRun") != 0) {
return nullptr;
@@ -1935,7 +1937,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase(
for (std::string const& configName : this->CurrentConfigurationTypes) {
cmCustomCommandGenerator ccg(
cc, configName, this->CurrentLocalGenerator, true, {},
- [&depfilesPrefix](const std::string& config, const std::string&)
+ [&depfilesPrefix](std::string const& config, std::string const&)
-> std::string { return cmStrCat(depfilesPrefix, config, ".d"); });
std::vector<std::string> realDepends;
realDepends.reserve(ccg.GetDepends().size());
@@ -2116,16 +2118,16 @@ std::string cmGlobalXCodeGenerator::ConstructScript(
// This function removes each occurrence of the flag and returns the last one
// (i.e., the dominant flag in GCC)
-std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
+std::string cmGlobalXCodeGenerator::ExtractFlag(char const* flag,
std::string& flags)
{
std::string retFlag;
- std::string::size_type lastOccurancePos = flags.rfind(flag);
+ std::string::size_type lastOccurrencePos = flags.rfind(flag);
bool saved = false;
- while (lastOccurancePos != std::string::npos) {
- // increment pos, we use lastOccurancePos to reduce search space on next
+ while (lastOccurrencePos != std::string::npos) {
+ // increment pos, we use lastOccurrencePos to reduce search space on next
// inc
- std::string::size_type pos = lastOccurancePos;
+ std::string::size_type pos = lastOccurrencePos;
if (pos == 0 || flags[pos - 1] == ' ') {
while (pos < flags.size() && flags[pos] != ' ') {
if (!saved) {
@@ -2136,17 +2138,17 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
}
saved = true;
}
- // decrement lastOccurancePos while making sure we don't loop around
+ // decrement lastOccurrencePos while making sure we don't loop around
// and become a very large positive number since size_type is unsigned
- lastOccurancePos = lastOccurancePos == 0 ? 0 : lastOccurancePos - 1;
- lastOccurancePos = flags.rfind(flag, lastOccurancePos);
+ lastOccurrencePos = lastOccurrencePos == 0 ? 0 : lastOccurrencePos - 1;
+ lastOccurrencePos = flags.rfind(flag, lastOccurrencePos);
}
return retFlag;
}
// This function removes each matching occurrence of the expression and
// returns the last one (i.e., the dominant flag in GCC)
-std::string cmGlobalXCodeGenerator::ExtractFlagRegex(const char* exp,
+std::string cmGlobalXCodeGenerator::ExtractFlagRegex(char const* exp,
int matchIndex,
std::string& flags)
{
@@ -2161,9 +2163,9 @@ std::string cmGlobalXCodeGenerator::ExtractFlagRegex(const char* exp,
std::string::size_type offset = 0;
while (regex.find(&flags[offset])) {
- const std::string::size_type startPos = offset + regex.start(matchIndex);
- const std::string::size_type endPos = offset + regex.end(matchIndex);
- const std::string::size_type size = endPos - startPos;
+ std::string::size_type const startPos = offset + regex.start(matchIndex);
+ std::string::size_type const endPos = offset + regex.end(matchIndex);
+ std::string::size_type const size = endPos - startPos;
offset = startPos + 1;
@@ -2209,7 +2211,7 @@ void cmGlobalXCodeGenerator::FilterConfigurationAttribute(
void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
cmXCodeObject* buildphase, cmGeneratorTarget* target,
- std::vector<cmCustomCommand> const& commands, const char* name)
+ std::vector<cmCustomCommand> const& commands, char const* name)
{
std::string dir = cmStrCat(
this->CurrentLocalGenerator->GetCurrentBinaryDirectory(), "/CMakeScripts");
@@ -2217,7 +2219,7 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
std::string makefile =
cmStrCat(dir, '/', target->GetName(), '_', name, ".make");
- for (const auto& currentConfig : this->CurrentConfigurationTypes) {
+ for (auto const& currentConfig : this->CurrentConfigurationTypes) {
this->CreateCustomRulesMakefile(makefile.c_str(), target, commands,
currentConfig);
}
@@ -2232,8 +2234,8 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
}
void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
- const char* makefileBasename, cmGeneratorTarget* target,
- std::vector<cmCustomCommand> const& commands, const std::string& configName)
+ char const* makefileBasename, cmGeneratorTarget* target,
+ std::vector<cmCustomCommand> const& commands, std::string const& configName)
{
std::string makefileName = cmStrCat(makefileBasename, configName);
cmGeneratedFileStream makefileStream(makefileName);
@@ -2251,13 +2253,13 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
// have all depend on all outputs
makefileStream << "all: ";
- std::map<const cmCustomCommand*, std::string> tname;
+ std::map<cmCustomCommand const*, std::string> tname;
int count = 0;
for (auto const& command : commands) {
cmCustomCommandGenerator ccg(command, configName,
this->CurrentLocalGenerator);
if (ccg.GetNumberOfCommands() > 0) {
- const std::vector<std::string>& outputs = ccg.GetOutputs();
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
for (auto const& output : outputs) {
makefileStream << "\\\n\t" << ConvertToMakefilePath(output);
@@ -2279,8 +2281,8 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
for (auto const& command : commands) {
cmCustomCommandGenerator ccg(
command, configName, this->CurrentLocalGenerator, true, {},
- [this, &depfilesDirectory](const std::string& config,
- const std::string& file) -> std::string {
+ [this, &depfilesDirectory](std::string const& config,
+ std::string const& file) -> std::string {
return cmStrCat(
depfilesDirectory,
this->GetObjectId(cmXCodeObject::PBXShellScriptBuildPhase, file),
@@ -2309,10 +2311,10 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
if (ccg.GetNumberOfCommands() > 0) {
makefileStream << '\n';
- const std::vector<std::string>& outputs = ccg.GetOutputs();
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
// There is at least one output, start the rule for it
- const char* sep = "";
+ char const* sep = "";
for (auto const& output : outputs) {
makefileStream << sep << ConvertToMakefilePath(output);
sep = " ";
@@ -2369,14 +2371,14 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
void cmGlobalXCodeGenerator::AddPositionIndependentLinkAttribute(
cmGeneratorTarget* target, cmXCodeObject* buildSettings,
- const std::string& configName)
+ std::string const& configName)
{
// For now, only EXECUTABLE is concerned
if (target->GetType() != cmStateEnums::EXECUTABLE) {
return;
}
- const char* PICValue = target->GetLinkPIEProperty(configName);
+ char const* PICValue = target->GetLinkPIEProperty(configName);
if (PICValue == nullptr) {
// POSITION_INDEPENDENT_CODE is not set
return;
@@ -2388,7 +2390,7 @@ void cmGlobalXCodeGenerator::AddPositionIndependentLinkAttribute(
void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
cmXCodeObject* buildSettings,
- const std::string& configName)
+ std::string const& configName)
{
if (!gtgt->IsInBuildSystem()) {
return;
@@ -2416,8 +2418,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
}
- // Add shared-library flags if needed.
- this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang,
+ this->CurrentLocalGenerator->AddFeatureFlags(flags, gtgt, lang,
configName);
this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt, lang);
@@ -2435,12 +2436,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
// Choose a language to use for target-wide preprocessor definitions.
- static const char* ppLangs[] = { "CXX", "C", "OBJCXX", "OBJC" };
+ static char const* ppLangs[] = { "CXX", "C", "OBJCXX", "OBJC" };
std::string langForPreprocessorDefinitions;
if (cm::contains(ppLangs, llang)) {
langForPreprocessorDefinitions = llang;
} else {
- for (const char* l : ppLangs) {
+ for (char const* l : ppLangs) {
if (languages.count(l)) {
langForPreprocessorDefinitions = l;
break;
@@ -2449,7 +2450,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
if (gtgt->IsIPOEnabled(llang, configName)) {
- const char* ltoValue =
+ char const* ltoValue =
this->CurrentMakefile->IsOn("_CMAKE_LTO_THIN") ? "YES_THIN" : "YES";
buildSettings->AddAttribute("LLVM_LTO", this->CreateString(ltoValue));
}
@@ -2465,7 +2466,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
BuildObjectListOrString ppDefs(this, true);
this->AppendDefines(
ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
- if (const std::string* exportMacro = gtgt->GetExportMacro()) {
+ if (std::string const* exportMacro = gtgt->GetExportMacro()) {
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro->c_str());
}
@@ -2533,7 +2534,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
if (!extraLinkOptionsVar.empty()) {
this->CurrentLocalGenerator->AddConfigVariableFlags(
- extraLinkOptions, extraLinkOptionsVar, configName);
+ extraLinkOptions, extraLinkOptionsVar, gtgt, cmBuildStep::Link, llang,
+ configName);
}
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
@@ -2543,6 +2545,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
} else {
this->CurrentLocalGenerator->AppendLinkerTypeFlags(extraLinkOptions, gtgt,
configName, llang);
+ this->CurrentLocalGenerator->AppendWarningAsErrorLinkerFlags(
+ extraLinkOptions, gtgt, llang);
cmValue targetLinkFlags = gtgt->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
@@ -2688,7 +2692,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// in many ways as an application bundle, as far as
// link flags go
std::string createFlags = this->LookupFlags(
- "CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle");
+ "CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", gtgt, "-bundle");
if (!createFlags.empty()) {
extraLinkOptions += ' ';
extraLinkOptions += createFlags;
@@ -2714,7 +2718,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString("NO"));
// Add the flags to create an executable.
std::string createFlags =
- this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
+ this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", gtgt, "");
if (!createFlags.empty()) {
extraLinkOptions += ' ';
extraLinkOptions += createFlags;
@@ -2743,8 +2747,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString(plist));
} else {
// Add the flags to create a shared library.
- std::string createFlags = this->LookupFlags(
- "CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS", "-dynamiclib");
+ std::string createFlags =
+ this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS",
+ gtgt, "-dynamiclib");
if (!createFlags.empty()) {
extraLinkOptions += ' ';
extraLinkOptions += createFlags;
@@ -2764,7 +2769,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
case cmStateEnums::EXECUTABLE: {
// Add the flags to create an executable.
std::string createFlags =
- this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
+ this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", gtgt, "");
if (!createFlags.empty()) {
extraLinkOptions += ' ';
extraLinkOptions += createFlags;
@@ -2795,7 +2800,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
BuildObjectListOrString fdirs(this, true);
BuildObjectListOrString sysdirs(this, true);
BuildObjectListOrString sysfdirs(this, true);
- const bool emitSystemIncludes = this->XcodeVersion >= 83;
+ bool const emitSystemIncludes = this->XcodeVersion >= 83;
// Choose a language to use for target-wide include directories.
std::string const& langForIncludes = llang;
@@ -2909,7 +2914,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
last_gflag = &gflag;
}
- const char* debugStr = "YES";
+ char const* debugStr = "YES";
if (!same_gflags) {
// We can't set the Xcode flag differently depending on the language,
// so put them back in this case.
@@ -2932,7 +2937,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
auto stdlib =
this->ExtractFlagRegex("(^| )(-stdlib=[^ ]+)( |$)", 2, flags);
if (stdlib.size() > 8) {
- const auto cxxLibrary = stdlib.substr(8);
+ auto const cxxLibrary = stdlib.substr(8);
if (language == "CXX"_s ||
!buildSettings->GetAttribute("CLANG_CXX_LIBRARY")) {
buildSettings->AddAttribute("CLANG_CXX_LIBRARY",
@@ -2974,7 +2979,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
// Add Fortran source format attribute if property is set.
- const char* format = nullptr;
+ char const* format = nullptr;
std::string const& tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT");
switch (cmOutputConverter::GetFortranFormat(tgtfmt)) {
case cmOutputConverter::FortranFormatFixed:
@@ -3219,7 +3224,7 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
}
void cmGlobalXCodeGenerator::CreateGlobalXCConfigSettings(
- cmLocalGenerator* root, cmXCodeObject* config, const std::string& configName)
+ cmLocalGenerator* root, cmXCodeObject* config, std::string const& configName)
{
auto xcconfig = cmGeneratorExpression::Evaluate(
this->CurrentMakefile->GetSafeDefinition("CMAKE_XCODE_XCCONFIG"),
@@ -3251,7 +3256,7 @@ void cmGlobalXCodeGenerator::CreateGlobalXCConfigSettings(
void cmGlobalXCodeGenerator::CreateTargetXCConfigSettings(
cmGeneratorTarget* target, cmXCodeObject* config,
- const std::string& configName)
+ std::string const& configName)
{
auto xcconfig =
cmGeneratorExpression::Evaluate(target->GetSafeProperty("XCODE_XCCONFIG"),
@@ -3279,7 +3284,7 @@ void cmGlobalXCodeGenerator::CreateTargetXCConfigSettings(
this->CreateObjectReference(fileRef));
}
-const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
+char const* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
cmGeneratorTarget const* target) const
{
if (this->XcodeVersion >= 60 &&
@@ -3290,7 +3295,7 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
return "OTHER_LDFLAGS";
}
-const char* cmGlobalXCodeGenerator::GetTargetFileType(
+char const* cmGlobalXCodeGenerator::GetTargetFileType(
cmGeneratorTarget* target)
{
if (cmValue e = target->GetProperty("XCODE_EXPLICIT_FILE_TYPE")) {
@@ -3323,7 +3328,7 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
return nullptr;
}
-const char* cmGlobalXCodeGenerator::GetTargetProductType(
+char const* cmGlobalXCodeGenerator::GetTargetProductType(
cmGeneratorTarget* target)
{
if (cmValue e = target->GetProperty("XCODE_PRODUCT_TYPE")) {
@@ -3384,7 +3389,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
target->AddAttribute("productName", this->CreateString(gtgt->GetName()));
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
- if (const char* fileType = this->GetTargetFileType(gtgt)) {
+ if (char const* fileType = this->GetTargetFileType(gtgt)) {
fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
}
std::string fullName;
@@ -3399,7 +3404,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
fileRef->SetComment(gtgt->GetName());
target->AddAttribute("productReference",
this->CreateObjectReference(fileRef));
- if (const char* productType = this->GetTargetProductType(gtgt)) {
+ if (char const* productType = this->GetTargetProductType(gtgt)) {
target->AddAttribute("productType", this->CreateString(productType));
}
target->SetTarget(gtgt);
@@ -3448,8 +3453,8 @@ std::string cmGlobalXCodeGenerator::GetObjectId(cmXCodeObject::PBXType ptype,
return objectId;
}
-std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
- const std::string& id)
+std::string cmGlobalXCodeGenerator::GetOrCreateId(std::string const& name,
+ std::string const& id)
{
std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE");
cmValue storedGUID = this->CMakeInstance->GetCacheDefinition(guidStoreName);
@@ -3496,7 +3501,7 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
}
void cmGlobalXCodeGenerator::AppendOrAddBuildSetting(cmXCodeObject* settings,
- const char* attribute,
+ char const* attribute,
cmXCodeObject* value)
{
if (settings) {
@@ -3510,7 +3515,7 @@ void cmGlobalXCodeGenerator::AppendOrAddBuildSetting(cmXCodeObject* settings,
}
void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
- cmXCodeObject* settings, const char* attribute, cmXCodeObject* attr,
+ cmXCodeObject* settings, char const* attribute, cmXCodeObject* attr,
cmXCodeObject* value)
{
if (value->GetType() != cmXCodeObject::OBJECT_LIST &&
@@ -3545,8 +3550,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
}
void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
- cmXCodeObject* target, const char* attribute, cmXCodeObject* value,
- const std::string& configName)
+ cmXCodeObject* target, char const* attribute, cmXCodeObject* value,
+ std::string const& configName)
{
// There are multiple configurations. Add the setting to the
// buildSettings of the configuration name given.
@@ -3564,7 +3569,7 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
}
void cmGlobalXCodeGenerator::InheritBuildSettingAttribute(
- cmXCodeObject* target, const char* attribute)
+ cmXCodeObject* target, char const* attribute)
{
cmXCodeObject* configurationList =
target->GetAttribute("buildConfigurationList")->GetObject();
@@ -3593,7 +3598,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
// Add dependencies on other CMake targets.
- for (const auto& dep : this->GetTargetDirectDepends(gt)) {
+ for (auto const& dep : this->GetTargetDirectDepends(gt)) {
if (cmXCodeObject* dptarget = this->FindXCodeTarget(dep)) {
this->AddDependTarget(target, dptarget);
}
@@ -3610,7 +3615,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
std::map<std::string, std::vector<cmComputeLinkInformation::Item const*>>
configItemMap;
auto addToLinkerArguments =
- [&configItemMap](const std::string& configName,
+ [&configItemMap](std::string const& configName,
cmComputeLinkInformation::Item const* libItemPtr) {
auto& linkVector = configItemMap[configName];
if (std::find_if(linkVector.begin(), linkVector.end(),
@@ -3702,7 +3707,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
libName = cmSystemTools::GetFilenameName(libItem.Value.Value);
// We don't want all the possible files here, just standard
// libraries
- const auto libExt = cmSystemTools::GetFilenameExtension(libName);
+ auto const libExt = cmSystemTools::GetFilenameExtension(libName);
if (!IsLinkPhaseLibraryExtension(libExt)) {
canUseLinkPhase = false;
}
@@ -3812,7 +3817,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
buildFile = CreateXCodeBuildFileFromPath(cleanPath, gt, "", nullptr);
if (!buildFile) {
// Add this library item back to a regular linker flag list
- for (const auto& conf : configItemMap) {
+ for (auto const& conf : configItemMap) {
addToLinkerArguments(conf.first, libItem);
}
continue;
@@ -3823,7 +3828,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
} else {
// Add this library item back to a regular linker flag list
- for (const auto& conf : configItemMap) {
+ for (auto const& conf : configItemMap) {
addToLinkerArguments(conf.first, libItem);
}
continue;
@@ -3834,7 +3839,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
auto* fileRefObject = libTarget->GetAttribute("productReference");
if (!fileRefObject) {
// Add this library item back to a regular linker flag list
- for (const auto& conf : configItemMap) {
+ for (auto const& conf : configItemMap) {
addToLinkerArguments(conf.first, libItem);
}
continue;
@@ -4020,7 +4025,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
this->Makefiles.front()->GetSafeDefinition(cmStrCat(
"CMAKE_", cli->GetLinkLanguage(), "_STANDARD_LINK_DIRECTORIES"));
- for (const auto& libDir : cmList(linkDirsString)) {
+ for (auto const& libDir : cmList(linkDirsString)) {
libSearchPaths.Add(this->XCodeEscapePath(libDir));
}
@@ -4069,7 +4074,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
bool isFramework = !isXcFramework &&
cmHasSuffix(libName.GetFeatureName(), "FRAMEWORK"_s);
if (isFramework) {
- const auto fwDescriptor = this->SplitFrameworkPath(
+ auto const fwDescriptor = this->SplitFrameworkPath(
cleanPath, cmGlobalGenerator::FrameworkFormat::Extended);
if (isFramework && !fwDescriptor->Directory.empty() &&
emitted.insert(fwDescriptor->Directory).second) {
@@ -4156,9 +4161,9 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
void cmGlobalXCodeGenerator::AddEmbeddedObjects(
- cmXCodeObject* target, const std::string& copyFilesBuildPhaseName,
- const std::string& embedPropertyName, const std::string& dstSubfolderSpec,
- int actionsOnByDefault, const std::string& defaultDstPath)
+ cmXCodeObject* target, std::string const& copyFilesBuildPhaseName,
+ std::string const& embedPropertyName, std::string const& dstSubfolderSpec,
+ int actionsOnByDefault, std::string const& defaultDstPath)
{
cmGeneratorTarget* gt = target->GetTarget();
if (!gt) {
@@ -4234,24 +4239,18 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects(
cmSystemTools::IsPathToMacOSSharedLibrary(relFile) ||
cmSystemTools::FileIsDirectory(filePath)) {
// This is a regular string path - create file reference
- auto it = this->EmbeddedLibRefs.find(relFile);
- if (it == this->EmbeddedLibRefs.end()) {
- cmXCodeObject* fileRef =
- this->CreateXCodeFileReferenceFromPath(relFile, gt, "", nullptr);
- if (fileRef) {
- buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
- buildFile->SetComment(fileRef->GetComment());
- buildFile->AddAttribute("fileRef",
- this->CreateObjectReference(fileRef));
- }
- if (!buildFile) {
- cmSystemTools::Error(
- cmStrCat("Can't create build file for ", relFile));
- continue;
- }
- this->EmbeddedLibRefs.emplace(filePath, buildFile);
- } else {
- buildFile = it->second;
+ cmXCodeObject* fileRef =
+ this->CreateXCodeFileReferenceFromPath(relFile, gt, "", nullptr);
+ if (fileRef) {
+ buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
+ buildFile->SetComment(fileRef->GetComment());
+ buildFile->AddAttribute("fileRef",
+ this->CreateObjectReference(fileRef));
+ }
+ if (!buildFile) {
+ cmSystemTools::Error(
+ cmStrCat("Can't create build file for ", relFile));
+ continue;
}
}
if (!buildFile) {
@@ -4336,7 +4335,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedExtensionKitExtensions(
void cmGlobalXCodeGenerator::AddEmbeddedResources(cmXCodeObject* target)
{
- static const auto dstSubfolderSpec = "7";
+ static auto const dstSubfolderSpec = "7";
this->AddEmbeddedObjects(target, "Embed Resources", "XCODE_EMBED_RESOURCES",
dstSubfolderSpec, NoActionOnCopyByDefault);
@@ -4344,7 +4343,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedResources(cmXCodeObject* target)
void cmGlobalXCodeGenerator::AddEmbeddedXPCServices(cmXCodeObject* target)
{
- static const auto dstSubfolderSpec = "16";
+ static auto const dstSubfolderSpec = "16";
this->AddEmbeddedObjects(
target, "Embed XPC Services", "XCODE_EMBED_XPC_SERVICES", dstSubfolderSpec,
@@ -4357,7 +4356,7 @@ bool cmGlobalXCodeGenerator::CreateGroups(
for (auto& generator : generators) {
cmMakefile* mf = generator->GetMakefile();
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
- for (const auto& gtgt : generator->GetGeneratorTargets()) {
+ for (auto const& gtgt : generator->GetGeneratorTargets()) {
// Same skipping logic here as in CreateXCodeTargets so that we do not
// end up with (empty anyhow) ZERO_CHECK, install, or test source
// groups:
@@ -4389,9 +4388,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(
// Add CMakeLists.txt file for user convenience.
{
- std::string listfile =
- cmStrCat(gtgt->GetLocalGenerator()->GetCurrentSourceDirectory(),
- "/CMakeLists.txt");
+ std::string listfile = this->GetCMakeInstance()->GetCMakeListFile(
+ gtgt->GetLocalGenerator()->GetCurrentSourceDirectory());
cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(
listfile, false, cmSourceFileLocationKind::Known);
addSourceToGroup(sf->ResolveFullPath());
@@ -4410,7 +4408,7 @@ bool cmGlobalXCodeGenerator::CreateGroups(
}
cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent,
- const std::string& name)
+ std::string const& name)
{
cmXCodeObject* parentChildren = nullptr;
if (parent) {
@@ -4433,7 +4431,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
{
std::string s;
std::string target;
- const std::string targetFolder = gtgt->GetEffectiveFolderName();
+ std::string const targetFolder = gtgt->GetEffectiveFolderName();
if (!targetFolder.empty()) {
target = cmStrCat(targetFolder, '/');
}
@@ -4449,7 +4447,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
if (it != this->TargetGroup.end()) {
tgroup = it->second;
} else {
- std::vector<std::string> tgt_folders = cmTokenize(target, "/");
+ std::vector<std::string> const tgt_folders = cmTokenize(target, '/');
std::string curr_tgt_folder;
for (std::vector<std::string>::size_type i = 0; i < tgt_folders.size();
i++) {
@@ -4482,7 +4480,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
// It's a recursive folder structure, let's find the real parent group
if (sg->GetFullName() != sg->GetName()) {
std::string curr_folder = cmStrCat(target, '/');
- for (auto const& folder : cmTokenize(sg->GetFullName(), "\\")) {
+ for (auto const& folder : cmTokenize(sg->GetFullName(), '\\')) {
curr_folder += folder;
auto const i_folder = this->GroupNameMap.find(curr_folder);
// Create new folder
@@ -4512,11 +4510,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (const std::string& CurrentConfigurationType :
+ for (std::string const& CurrentConfigurationType :
this->CurrentConfigurationTypes) {
cmXCodeObject* buildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle);
- const std::string& name = CurrentConfigurationType;
+ std::string const& name = CurrentConfigurationType;
buildStyle->AddAttribute("name", this->CreateString(name));
buildStyle->SetComment(name);
cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
@@ -4598,7 +4596,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
using Configs = std::vector<std::pair<std::string, cmXCodeObject*>>;
Configs configs;
std::string defaultConfigName;
- for (const auto& name : this->CurrentConfigurationTypes) {
+ for (auto const& name : this->CurrentConfigurationTypes) {
if (defaultConfigName.empty()) {
defaultConfigName = name;
}
@@ -4707,7 +4705,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
// Put this last so it can override existing settings
// Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly.
- for (const auto& var : this->CurrentMakefile->GetDefinitions()) {
+ for (auto const& var : this->CurrentMakefile->GetDefinitions()) {
if (cmHasLiteralPrefix(var, "CMAKE_XCODE_ATTRIBUTE_")) {
std::string attribute = var.substr(22);
this->FilterConfigurationAttribute(config.first, attribute);
@@ -4878,7 +4876,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
"# link. This forces Xcode to relink the targets from scratch. It\n"
"# does not seem to check these dependencies itself.\n";
/* clang-format on */
- for (const auto& configName : this->CurrentConfigurationTypes) {
+ for (auto const& configName : this->CurrentConfigurationTypes) {
for (auto* target : targets) {
cmGeneratorTarget* gt = target->GetTarget();
@@ -4909,7 +4907,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
}
std::vector<cmGeneratorTarget*> objlibs;
- gt->GetObjectLibrariesCMP0026(objlibs);
+ gt->GetObjectLibrariesInSources(objlibs);
for (auto* objLib : objlibs) {
makefileStream << this->PostBuildMakeTarget(objLib->GetName(),
configName)
@@ -4931,7 +4929,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
for (auto* objLib : objlibs) {
- const std::string objLibName = objLib->GetName();
+ std::string const objLibName = objLib->GetName();
std::string d = cmStrCat(this->GetTargetTempDir(gt, configName),
"/lib", objLibName, ".a");
@@ -4949,7 +4947,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
if (this->Architectures.size() > 1) {
std::string universal =
cmStrCat(this->GetTargetTempDir(gt, configName), "/$(OBJDIR)/");
- for (const auto& architecture : this->Architectures) {
+ for (auto const& architecture : this->Architectures) {
std::string universalFile = cmStrCat(universal, architecture, '/',
gt->GetFullName(configName));
makefileStream << "\t/bin/rm -f "
@@ -5001,12 +4999,12 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
}
bool cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
- const std::string& xcProjDir, cmLocalGenerator* root)
+ std::string const& xcProjDir, cmLocalGenerator* root)
{
// collect all tests for the targets
std::map<std::string, cmXCodeScheme::TestObjects> testables;
- for (const auto& obj : this->XCodeObjects) {
+ for (auto const& obj : this->XCodeObjects) {
if (obj->GetType() != cmXCodeObject::OBJECT ||
obj->GetIsA() != cmXCodeObject::PBXNativeTarget) {
continue;
@@ -5030,13 +5028,13 @@ bool cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
// Since the lowest available Xcode version for testing was 6.4,
// I'm setting this as a limit then
if (this->XcodeVersion >= 64) {
- for (const auto& obj : this->XCodeObjects) {
+ for (auto const& obj : this->XCodeObjects) {
if (obj->GetType() == cmXCodeObject::OBJECT &&
(obj->GetIsA() == cmXCodeObject::PBXNativeTarget ||
obj->GetIsA() == cmXCodeObject::PBXAggregateTarget) &&
(root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() ||
obj->GetTarget()->GetPropertyAsBool("XCODE_GENERATE_SCHEME"))) {
- const std::string& targetName = obj->GetTarget()->GetName();
+ std::string const& targetName = obj->GetTarget()->GetName();
cmXCodeScheme schm(root, obj.get(), testables[targetName],
this->CurrentConfigurationTypes,
this->XcodeVersion);
@@ -5051,7 +5049,7 @@ bool cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
}
void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings(
- const std::string& xcProjDir, bool hasGeneratedSchemes)
+ std::string const& xcProjDir, bool hasGeneratedSchemes)
{
std::string xcodeSharedDataDir =
cmStrCat(xcProjDir, "/project.xcworkspace/xcshareddata");
@@ -5123,13 +5121,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
"}\n";
}
-const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const
+char const* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const
{
return "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
}
std::string cmGlobalXCodeGenerator::ExpandCFGIntDir(
- const std::string& str, const std::string& config) const
+ std::string const& str, std::string const& config) const
{
std::string replace1 = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
std::string replace2 = "$(CONFIGURATION)";
@@ -5154,7 +5152,7 @@ cmDocumentationEntry cmGlobalXCodeGenerator::GetDocumentation()
"Generate Xcode project files." };
}
-std::string cmGlobalXCodeGenerator::RelativeToSource(const std::string& p)
+std::string cmGlobalXCodeGenerator::RelativeToSource(std::string const& p)
{
std::string const& rootSrc =
this->CurrentRootGenerator->GetCurrentSourceDirectory();
@@ -5164,7 +5162,7 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const std::string& p)
return p;
}
-std::string cmGlobalXCodeGenerator::RelativeToRootBinary(const std::string& p)
+std::string cmGlobalXCodeGenerator::RelativeToRootBinary(std::string const& p)
{
std::string binaryDirectory =
this->CurrentRootGenerator->GetCurrentBinaryDirectory();
@@ -5175,12 +5173,12 @@ std::string cmGlobalXCodeGenerator::RelativeToRootBinary(const std::string& p)
return binaryDirectory;
}
-std::string cmGlobalXCodeGenerator::RelativeToBinary(const std::string& p)
+std::string cmGlobalXCodeGenerator::RelativeToBinary(std::string const& p)
{
return this->CurrentRootGenerator->MaybeRelativeToCurBinDir(p);
}
-std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
+std::string cmGlobalXCodeGenerator::XCodeEscapePath(std::string const& p)
{
if (p.find_first_of(" []") != std::string::npos) {
std::string t = cmStrCat('"', p, '"');
@@ -5190,8 +5188,8 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
}
void cmGlobalXCodeGenerator::AppendDirectoryForConfig(
- const std::string& prefix, const std::string& config,
- const std::string& suffix, std::string& dir)
+ std::string const& prefix, std::string const& config,
+ std::string const& suffix, std::string& dir)
{
if (!config.empty()) {
dir += prefix;
@@ -5201,14 +5199,18 @@ void cmGlobalXCodeGenerator::AppendDirectoryForConfig(
}
std::string cmGlobalXCodeGenerator::LookupFlags(
- const std::string& varNamePrefix, const std::string& varNameLang,
- const std::string& varNameSuffix, const std::string& default_flags)
+ std::string const& varNamePrefix, std::string const& varNameLang,
+ std::string const& varNameSuffix, cmGeneratorTarget const* gt,
+ std::string const& default_flags)
{
if (!varNameLang.empty()) {
std::string varName = cmStrCat(varNamePrefix, varNameLang, varNameSuffix);
if (cmValue varValue = this->CurrentMakefile->GetDefinition(varName)) {
if (!varValue->empty()) {
- return *varValue;
+ std::string flags;
+ this->CurrentLocalGenerator->AppendFlags(
+ flags, *varValue, varName, gt, cmBuildStep::Link, varNameLang);
+ return flags;
}
}
}
@@ -5216,7 +5218,7 @@ std::string cmGlobalXCodeGenerator::LookupFlags(
}
void cmGlobalXCodeGenerator::AppendDefines(BuildObjectListOrString& defs,
- const char* defines_list,
+ char const* defines_list,
bool dflag)
{
// Skip this if there are no definitions.
@@ -5361,7 +5363,7 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
"/$(OBJECT_FILE_DIR_normal:base)/", objectDirArch, '/');
}
-std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf)
+std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(cmMakefile const* mf)
{
switch (mf->GetAppleSDKType()) {
case cmMakefile::AppleSDK::AppleTVOS:
@@ -5385,3 +5387,12 @@ std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf)
return "MACOSX_DEPLOYMENT_TARGET";
}
}
+
+cmValue cmGlobalXCodeGenerator::GetDebuggerWorkingDirectory(
+ cmGeneratorTarget* gt) const
+{
+ if (cmValue ret = gt->GetProperty("XCODE_SCHEME_WORKING_DIRECTORY")) {
+ return ret;
+ }
+ return cmGlobalGenerator::GetDebuggerWorkingDirectory(gt);
+}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 14e9308..f4451b3 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,8 +42,8 @@ public:
unsigned int version_number);
static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
- cmGlobalXCodeGenerator(const cmGlobalXCodeGenerator&) = delete;
- const cmGlobalXCodeGenerator& operator=(const cmGlobalXCodeGenerator&) =
+ cmGlobalXCodeGenerator(cmGlobalXCodeGenerator const&) = delete;
+ cmGlobalXCodeGenerator const& operator=(cmGlobalXCodeGenerator const&) =
delete;
//! Get the name for the generator.
@@ -70,7 +70,7 @@ public:
/**
* Open a generated IDE project given the following information.
*/
- bool Open(const std::string& bindir, const std::string& projectName,
+ bool Open(std::string const& bindir, std::string const& projectName,
bool dryRun) override;
/**
@@ -78,26 +78,26 @@ public:
* loaded commands, not as part of the usual build process.
*/
std::vector<GeneratedMakeCommand> GenerateBuildCommand(
- const std::string& makeProgram, const std::string& projectName,
- const std::string& projectDir, std::vector<std::string> const& targetNames,
- const std::string& config, int jobs, bool verbose,
- const cmBuildOptions& buildOptions = cmBuildOptions(),
+ std::string const& makeProgram, std::string const& projectName,
+ std::string const& projectDir, std::vector<std::string> const& targetNames,
+ std::string const& config, int jobs, bool verbose,
+ cmBuildOptions const& buildOptions = cmBuildOptions(),
std::vector<std::string> const& makeOptions =
std::vector<std::string>()) override;
/** Append the subdirectory for the given configuration. */
- void AppendDirectoryForConfig(const std::string& prefix,
- const std::string& config,
- const std::string& suffix,
+ void AppendDirectoryForConfig(std::string const& prefix,
+ std::string const& config,
+ std::string const& suffix,
std::string& dir) override;
bool FindMakeProgram(cmMakefile*) override;
//! What is the configurations directory variable called?
- const char* GetCMakeCFGIntDir() const override;
+ char const* GetCMakeCFGIntDir() const override;
//! expand CFGIntDir
- std::string ExpandCFGIntDir(const std::string& str,
- const std::string& config) const override;
+ std::string ExpandCFGIntDir(std::string const& str,
+ std::string const& config) const override;
void SetCurrentLocalGenerator(cmLocalGenerator*);
@@ -132,6 +132,8 @@ public:
cmMakefile* mf) override;
void AppendFlag(std::string& flags, std::string const& flag) const;
+ cmValue GetDebuggerWorkingDirectory(cmGeneratorTarget* gt) const override;
+
enum class BuildSystem
{
One = 1,
@@ -157,12 +159,12 @@ private:
cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt,
cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent,
- const std::string& name);
+ std::string const& name);
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 XCodeEscapePath(std::string const& p);
+ std::string RelativeToSource(std::string const& p);
+ std::string RelativeToRootBinary(std::string const& p);
+ std::string RelativeToBinary(std::string const& p);
void CreateCustomCommands(
cmXCodeObject* buildPhases, cmXCodeObject* sourceBuildPhase,
cmXCodeObject* headerBuildPhase, cmXCodeObject* resourceBuildPhase,
@@ -174,52 +176,52 @@ private:
void AddCommandsToBuildPhase(cmXCodeObject* buildphase,
cmGeneratorTarget* target,
std::vector<cmCustomCommand> const& commands,
- const char* commandFileName);
+ char const* commandFileName);
- void CreateCustomRulesMakefile(const char* makefileBasename,
+ void CreateCustomRulesMakefile(char const* makefileBasename,
cmGeneratorTarget* target,
std::vector<cmCustomCommand> const& commands,
- const std::string& configName);
+ std::string const& configName);
- cmXCodeObject* FindXCodeTarget(const cmGeneratorTarget*);
+ cmXCodeObject* FindXCodeTarget(cmGeneratorTarget const*);
std::string GetObjectId(cmXCodeObject::PBXType ptype, cm::string_view key);
- std::string GetOrCreateId(const std::string& name, const std::string& id);
+ std::string GetOrCreateId(std::string const& name, std::string const& id);
// create cmXCodeObject from these functions so that memory can be managed
// correctly. All objects created are stored in this->XCodeObjects.
cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype,
cm::string_view key = {});
cmXCodeObject* CreateObject(cmXCodeObject::Type type);
- cmXCodeObject* CreateString(const std::string& s);
+ cmXCodeObject* CreateString(std::string const& s);
cmXCodeObject* CreateObjectReference(cmXCodeObject*);
cmXCodeObject* CreateFlatClone(cmXCodeObject*);
cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget* gtgt,
cmXCodeObject* buildPhases);
void ForceLinkerLanguages() override;
void ForceLinkerLanguage(cmGeneratorTarget* gtgt);
- const char* GetTargetLinkFlagsVar(const cmGeneratorTarget* target) const;
- const char* GetTargetFileType(cmGeneratorTarget* target);
- const char* GetTargetProductType(cmGeneratorTarget* target);
+ char const* GetTargetLinkFlagsVar(cmGeneratorTarget const* target) const;
+ char const* GetTargetFileType(cmGeneratorTarget* target);
+ char const* GetTargetProductType(cmGeneratorTarget* target);
std::string AddConfigurations(cmXCodeObject* target,
cmGeneratorTarget* gtgt);
- void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
+ void AppendOrAddBuildSetting(cmXCodeObject* settings, char const* attr,
cmXCodeObject* value);
void AppendBuildSettingAttribute(cmXCodeObject* settings,
- const char* attribute, cmXCodeObject* attr,
+ char const* attribute, cmXCodeObject* attr,
cmXCodeObject* value);
- void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr,
+ void AppendBuildSettingAttribute(cmXCodeObject* target, char const* attr,
cmXCodeObject* value,
- const std::string& configName);
+ std::string const& configName);
void InheritBuildSettingAttribute(cmXCodeObject* target,
- const char* attribute);
+ char const* attribute);
cmXCodeObject* CreateUtilityTarget(cmGeneratorTarget* gtgt);
void AddDependAndLinkInformation(cmXCodeObject* target);
void AddEmbeddedObjects(cmXCodeObject* target,
- const std::string& copyFilesBuildPhaseName,
- const std::string& embedPropertyName,
- const std::string& dstSubfolderSpec,
+ std::string const& copyFilesBuildPhaseName,
+ std::string const& embedPropertyName,
+ std::string const& dstSubfolderSpec,
int actionsOnByDefault,
- const std::string& defaultDstPath = "");
+ std::string const& defaultDstPath = "");
void AddEmbeddedFrameworks(cmXCodeObject* target);
void AddEmbeddedPlugIns(cmXCodeObject* target);
void AddEmbeddedAppExtensions(cmXCodeObject* target);
@@ -228,18 +230,18 @@ private:
void AddEmbeddedXPCServices(cmXCodeObject* target);
void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target,
cmXCodeObject* buildSettings,
- const std::string& configName);
+ std::string const& configName);
void CreateGlobalXCConfigSettings(cmLocalGenerator* root,
cmXCodeObject* config,
- const std::string& configName);
+ std::string const& configName);
void CreateTargetXCConfigSettings(cmGeneratorTarget* target,
cmXCodeObject* config,
- const std::string& configName);
+ std::string const& configName);
void CreateBuildSettings(cmGeneratorTarget* gtgt,
cmXCodeObject* buildSettings,
- const std::string& buildType);
- std::string ExtractFlag(const char* flag, std::string& flags);
- std::string ExtractFlagRegex(const char* exp, int matchIndex,
+ std::string const& buildType);
+ std::string ExtractFlag(char const* flag, std::string& flags);
+ std::string ExtractFlagRegex(char const* exp, int matchIndex,
std::string& flags);
void FilterConfigurationAttribute(std::string const& configName,
std::string& attribute);
@@ -252,19 +254,19 @@ private:
std::vector<cmLocalGenerator*>& generators);
// Write shared scheme files for all the native targets
// return true if any were written
- bool OutputXCodeSharedSchemes(const std::string& xcProjDir,
+ bool OutputXCodeSharedSchemes(std::string const& xcProjDir,
cmLocalGenerator* root);
- void OutputXCodeWorkspaceSettings(const std::string& xcProjDir,
+ void OutputXCodeWorkspaceSettings(std::string const& xcProjDir,
bool hasGeneratedSchemes);
void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
- cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string& fullpath,
+ cmXCodeObject* CreateXCodeFileReferenceFromPath(std::string const& fullpath,
cmGeneratorTarget* target,
- const std::string& lang,
+ std::string const& lang,
cmSourceFile* sf);
- cmXCodeObject* CreateXCodeBuildFileFromPath(const std::string& fullpath,
+ cmXCodeObject* CreateXCodeBuildFileFromPath(std::string const& fullpath,
cmGeneratorTarget* target,
- const std::string& lang,
+ std::string const& lang,
cmSourceFile* sf);
cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf,
cmGeneratorTarget* target);
@@ -283,8 +285,8 @@ private:
void AddExtraTargets(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& gens);
cmXCodeObject* CreateLegacyRunScriptBuildPhase(
- const char* name, const char* name2, cmGeneratorTarget* target,
- const std::vector<cmCustomCommand>&);
+ char const* name, char const* name2, cmGeneratorTarget* target,
+ std::vector<cmCustomCommand> const&);
void CreateRunScriptBuildPhases(cmXCodeObject* buildPhases,
cmGeneratorTarget const* gt);
void CreateRunScriptBuildPhases(cmXCodeObject* buildPhases,
@@ -301,16 +303,17 @@ private:
void CreateReRunCMakeFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*> const& gens);
- std::string LookupFlags(const std::string& varNamePrefix,
- const std::string& varNameLang,
- const std::string& varNameSuffix,
- const std::string& default_flags);
+ std::string LookupFlags(std::string const& varNamePrefix,
+ std::string const& varNameLang,
+ std::string const& varNameSuffix,
+ cmGeneratorTarget const* gt,
+ std::string const& default_flags);
class Factory;
class BuildObjectListOrString;
friend class BuildObjectListOrString;
- void AppendDefines(BuildObjectListOrString& defs, const char* defines_list,
+ void AppendDefines(BuildObjectListOrString& defs, char const* defines_list,
bool dflag = false);
void AppendDefines(BuildObjectListOrString& defs,
std::vector<std::string> const& defines,
@@ -319,8 +322,8 @@ private:
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override;
protected:
- const char* GetInstallTargetName() const override { return "install"; }
- const char* GetPackageTargetName() const override { return "package"; }
+ char const* GetInstallTargetName() const override { return "install"; }
+ char const* GetPackageTargetName() const override { return "package"; }
unsigned int XcodeVersion;
std::string VersionString;
@@ -341,13 +344,13 @@ private:
{
}
- std::string GetLibraryOrFrameworkPath(const std::string& path) const;
+ std::string GetLibraryOrFrameworkPath(std::string const& path) const;
std::string GetSymrootDir() const;
std::string GetTargetTempDir(cmGeneratorTarget const* gt,
std::string const& configName) const;
- static std::string GetDeploymentPlatform(const cmMakefile* mf);
+ static std::string GetDeploymentPlatform(cmMakefile const* mf);
void ComputeArchitectures(cmMakefile* mf);
void ComputeObjectDirArch(cmMakefile* mf);
@@ -371,7 +374,6 @@ private:
std::map<std::string, cmXCodeObject*> TargetGroup;
std::map<std::string, cmXCodeObject*> FileRefs;
std::map<std::string, cmXCodeObject*> ExternalLibRefs;
- std::map<std::string, cmXCodeObject*> EmbeddedLibRefs;
std::map<cmGeneratorTarget const*, cmXCodeObject*> XCodeObjectMap;
std::map<cmXCodeObject*, cmXCodeObject*> FileRefToBuildFileMap;
std::map<cmXCodeObject*, cmXCodeObject*> FileRefToEmbedBuildFileMap;
diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h
index 01fc5f9..673d219 100644
--- a/Source/cmGraphAdjacencyList.h
+++ b/Source/cmGraphAdjacencyList.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 55cc815..45461c6 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmGraphVizWriter.h"
#include <algorithm>
@@ -44,7 +44,7 @@ char const* const GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN = "septagon";
char const* const GRAPHVIZ_NODE_SHAPE_UTILITY = "box";
-const char* getShapeForTarget(const cmLinkItem& item)
+char const* getShapeForTarget(cmLinkItem const& item)
{
if (!item.Target) {
return GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN;
@@ -74,13 +74,13 @@ const char* getShapeForTarget(const cmLinkItem& item)
struct DependeesDir
{
template <typename T>
- static const cmLinkItem& src(const T& con)
+ static cmLinkItem const& src(T const& con)
{
return con.src;
}
template <typename T>
- static const cmLinkItem& dst(const T& con)
+ static cmLinkItem const& dst(T const& con)
{
return con.dst;
}
@@ -89,13 +89,13 @@ struct DependeesDir
struct DependersDir
{
template <typename T>
- static const cmLinkItem& src(const T& con)
+ static cmLinkItem const& src(T const& con)
{
return con.dst;
}
template <typename T>
- static const cmLinkItem& dst(const T& con)
+ static cmLinkItem const& dst(T const& con)
{
return con.src;
}
@@ -103,7 +103,7 @@ struct DependersDir
}
cmGraphVizWriter::cmGraphVizWriter(std::string const& fileName,
- const cmGlobalGenerator* globalGenerator)
+ cmGlobalGenerator const* globalGenerator)
: FileName(fileName)
, GlobalFileStream(fileName)
, GraphName(globalGenerator->GetSafeGlobalSetting("CMAKE_PROJECT_NAME"))
@@ -192,8 +192,8 @@ void cmGraphVizWriter::VisitLink(cmLinkItem const& depender,
}
void cmGraphVizWriter::ReadSettings(
- const std::string& settingsFileName,
- const std::string& fallbackSettingsFileName)
+ std::string const& settingsFileName,
+ std::string const& fallbackSettingsFileName)
{
cmake cm(cmake::RoleScript, cmState::Unknown);
cm.SetHomeDirectory("");
@@ -270,7 +270,7 @@ void cmGraphVizWriter::ReadSettings(
void cmGraphVizWriter::Write()
{
- const auto* gg = this->GlobalGenerator;
+ auto const* gg = this->GlobalGenerator;
this->VisitGraph(gg->GetName());
@@ -279,8 +279,8 @@ void cmGraphVizWriter::Write()
std::set<cmGeneratorTarget const*, cmGeneratorTarget::StrictTargetComparison>
sortedGeneratorTargets;
- for (const auto& lg : gg->GetLocalGenerators()) {
- for (const auto& gt : lg->GetGeneratorTargets()) {
+ for (auto const& lg : gg->GetLocalGenerators()) {
+ for (auto const& gt : lg->GetGeneratorTargets()) {
// 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.
@@ -292,7 +292,7 @@ void cmGraphVizWriter::Write()
}
// write global data and collect all connection data for per target graphs
- for (const auto* const gt : sortedGeneratorTargets) {
+ for (auto const* const gt : sortedGeneratorTargets) {
auto item = cmLinkItem(gt, false, gt->GetBacktrace());
this->VisitItem(item);
}
@@ -307,8 +307,8 @@ void cmGraphVizWriter::Write()
}
}
-void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
- const cmLinkItem& rootItem,
+void cmGraphVizWriter::FindAllConnections(ConnectionsMap const& connectionMap,
+ cmLinkItem const& rootItem,
Connections& extendedCons,
std::set<cmLinkItem>& visitedItems)
{
@@ -319,11 +319,11 @@ void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
return;
}
- const Connections& origCons = connectionMap.at(rootItem);
+ Connections const& origCons = connectionMap.at(rootItem);
- for (const Connection& con : origCons) {
+ for (Connection const& con : origCons) {
extendedCons.emplace_back(con);
- const cmLinkItem& dstItem = con.dst;
+ cmLinkItem const& dstItem = con.dst;
bool const visited = visitedItems.find(dstItem) != visitedItems.cend();
if (!visited) {
visitedItems.insert(dstItem);
@@ -333,8 +333,8 @@ void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
}
}
-void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
- const cmLinkItem& rootItem,
+void cmGraphVizWriter::FindAllConnections(ConnectionsMap const& connectionMap,
+ cmLinkItem const& rootItem,
Connections& extendedCons)
{
std::set<cmLinkItem> visitedItems = { rootItem };
@@ -344,32 +344,32 @@ void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
template <typename DirFunc>
void cmGraphVizWriter::WritePerTargetConnections(
- const ConnectionsMap& connections, const std::string& fileNameSuffix)
+ ConnectionsMap const& connections, std::string const& fileNameSuffix)
{
// the per target connections must be extended by indirect dependencies
ConnectionsMap extendedConnections;
for (auto const& conPerTarget : connections) {
- const cmLinkItem& rootItem = conPerTarget.first;
+ cmLinkItem const& rootItem = conPerTarget.first;
Connections& extendedCons = extendedConnections[conPerTarget.first];
this->FindAllConnections(connections, rootItem, extendedCons);
}
for (auto const& conPerTarget : extendedConnections) {
- const cmLinkItem& rootItem = conPerTarget.first;
+ cmLinkItem const& rootItem = conPerTarget.first;
// some of the nodes are excluded completely and are not written
if (this->ItemExcluded(rootItem)) {
continue;
}
- const Connections& cons = conPerTarget.second;
+ Connections const& cons = conPerTarget.second;
std::unique_ptr<cmGeneratedFileStream> fileStream =
this->CreateTargetFile(rootItem, fileNameSuffix);
- for (const Connection& con : cons) {
- const cmLinkItem& src = DirFunc::src(con);
- const cmLinkItem& dst = DirFunc::dst(con);
+ for (Connection const& con : cons) {
+ cmLinkItem const& src = DirFunc::src(con);
+ cmLinkItem const& dst = DirFunc::dst(con);
this->WriteNode(*fileStream, con.dst);
this->WriteConnection(*fileStream, src, dst, con.scopeType);
}
@@ -379,7 +379,7 @@ void cmGraphVizWriter::WritePerTargetConnections(
}
void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs,
- const std::string& name)
+ std::string const& name)
{
auto const escapedGraphName = EscapeForDotFile(name);
fs << "digraph \"" << escapedGraphName << "\" {\n"
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index 24dbe52..7346c43 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,7 +26,7 @@ class cmGraphVizWriter : public cmLinkItemGraphVisitor
{
public:
cmGraphVizWriter(std::string const& fileName,
- const cmGlobalGenerator* globalGenerator);
+ cmGlobalGenerator const* globalGenerator);
~cmGraphVizWriter() override;
void VisitGraph(std::string const& name) override;
@@ -39,8 +39,8 @@ public:
void OnIndirectLink(cmLinkItem const& depender,
cmLinkItem const& dependee) override;
- void ReadSettings(const std::string& settingsFileName,
- const std::string& fallbackSettingsFileName);
+ void ReadSettings(std::string const& settingsFileName,
+ std::string const& fallbackSettingsFileName);
void Write();
@@ -80,18 +80,18 @@ private:
cmLinkItem const& dependeeTargetName,
std::string const& edgeStyle);
- void FindAllConnections(const ConnectionsMap& connectionMap,
- const cmLinkItem& rootItem,
+ void FindAllConnections(ConnectionsMap const& connectionMap,
+ cmLinkItem const& rootItem,
Connections& extendedCons,
std::set<cmLinkItem>& visitedItems);
- void FindAllConnections(const ConnectionsMap& connectionMap,
- const cmLinkItem& rootItem,
+ void FindAllConnections(ConnectionsMap const& connectionMap,
+ cmLinkItem const& rootItem,
Connections& extendedCons);
template <typename DirFunc>
- void WritePerTargetConnections(const ConnectionsMap& connections,
- const std::string& fileNameSuffix = "");
+ void WritePerTargetConnections(ConnectionsMap const& connections,
+ std::string const& fileNameSuffix = "");
bool ItemExcluded(cmLinkItem const& item);
bool ItemNameFilteredOut(std::string const& itemName);
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index 54dfc92..a028bb4 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmHexFileConverter.h"
#include <cctype>
@@ -13,7 +13,7 @@
#define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2)
#define MOTOROLA_SREC_MAX_LINE_LENGTH (2 + 2 + 8 + (256 * 2) + 2)
-static unsigned int ChompStrlen(const char* line)
+static unsigned int ChompStrlen(char const* line)
{
if (!line) {
return 0;
@@ -28,7 +28,7 @@ static unsigned int ChompStrlen(const char* line)
return length;
}
-static bool OutputBin(FILE* file, const char* buf, unsigned int startIndex,
+static bool OutputBin(FILE* file, char const* buf, unsigned int startIndex,
unsigned int stopIndex)
{
bool success = true;
@@ -54,7 +54,7 @@ static bool OutputBin(FILE* file, const char* buf, unsigned int startIndex,
}
// see http://www.die.net/doc/linux/man/man5/srec.5.html
-static bool ConvertMotorolaSrecLine(const char* buf, FILE* outFile)
+static bool ConvertMotorolaSrecLine(char const* buf, FILE* outFile)
{
unsigned int slen = ChompStrlen(buf);
if ((slen < MOTOROLA_SREC_MIN_LINE_LENGTH) ||
@@ -93,7 +93,7 @@ static bool ConvertMotorolaSrecLine(const char* buf, FILE* outFile)
}
// see http://en.wikipedia.org/wiki/Intel_hex
-static bool ConvertIntelHexLine(const char* buf, FILE* outFile)
+static bool ConvertIntelHexLine(char const* buf, FILE* outFile)
{
unsigned int slen = ChompStrlen(buf);
if ((slen < INTEL_HEX_MIN_LINE_LENGTH) ||
@@ -128,7 +128,7 @@ static bool ConvertIntelHexLine(const char* buf, FILE* outFile)
}
cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
- const std::string& inFileName)
+ std::string const& inFileName)
{
char buf[1024];
FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
@@ -170,8 +170,8 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
return type;
}
-bool cmHexFileConverter::TryConvert(const std::string& inFileName,
- const std::string& outFileName)
+bool cmHexFileConverter::TryConvert(std::string const& inFileName,
+ std::string const& outFileName)
{
FileType type = DetermineFileType(inFileName);
if (type == Binary) {
diff --git a/Source/cmHexFileConverter.h b/Source/cmHexFileConverter.h
index 35a91ed..df04230 100644
--- a/Source/cmHexFileConverter.h
+++ b/Source/cmHexFileConverter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,7 +20,7 @@ public:
IntelHex,
MotorolaSrec
};
- static FileType DetermineFileType(const std::string& inFileName);
- static bool TryConvert(const std::string& inFileName,
- const std::string& outFileName);
+ static FileType DetermineFileType(std::string const& inFileName);
+ static bool TryConvert(std::string const& inFileName,
+ std::string const& outFileName);
};
diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h
index 5901771..c4b2604 100644
--- a/Source/cmIDEFlagTable.h
+++ b/Source/cmIDEFlagTable.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index f94faf8..9e48546 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIDEOptions.h"
#include <algorithm>
@@ -99,7 +99,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag)
bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
std::string const& flag, bool& flag_handled)
{
- const char* pf = flag.c_str() + 1;
+ char const* pf = flag.c_str() + 1;
// Look for an entry in the flag table matching this flag.
for (cmIDEFlagTable const* entry = table; !entry->IDEName.empty(); ++entry) {
bool entry_found = false;
@@ -160,7 +160,7 @@ void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry,
}
}
-void cmIDEOptions::AddDefine(const std::string& def)
+void cmIDEOptions::AddDefine(std::string const& def)
{
this->Defines.push_back(def);
}
@@ -172,7 +172,7 @@ void cmIDEOptions::AddDefines(std::string const& defines)
cmExpandList(defines, this->Defines);
}
}
-void cmIDEOptions::AddDefines(const std::vector<std::string>& defines)
+void cmIDEOptions::AddDefines(std::vector<std::string> const& defines)
{
cm::append(this->Defines, defines);
}
@@ -182,7 +182,7 @@ std::vector<std::string> const& cmIDEOptions::GetDefines() const
return this->Defines;
}
-void cmIDEOptions::AddInclude(const std::string& include)
+void cmIDEOptions::AddInclude(std::string const& include)
{
this->Includes.push_back(include);
}
@@ -194,7 +194,7 @@ void cmIDEOptions::AddIncludes(std::string const& includes)
cmExpandList(includes, this->Includes);
}
}
-void cmIDEOptions::AddIncludes(const std::vector<std::string>& includes)
+void cmIDEOptions::AddIncludes(std::vector<std::string> const& includes)
{
cm::append(this->Includes, includes);
}
@@ -244,7 +244,7 @@ bool cmIDEOptions::HasFlag(std::string const& flag) const
return this->FlagMap.find(flag) != this->FlagMap.end();
}
-const char* cmIDEOptions::GetFlag(std::string const& flag) const
+char const* cmIDEOptions::GetFlag(std::string const& flag) const
{
// This method works only for single-valued flags!
auto i = this->FlagMap.find(flag);
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index fbe9c37..3886e06 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,14 +20,14 @@ public:
virtual ~cmIDEOptions();
// Store definitions, includes and flags.
- void AddDefine(const std::string& define);
+ void AddDefine(std::string const& define);
void AddDefines(std::string const& defines);
- void AddDefines(const std::vector<std::string>& defines);
+ void AddDefines(std::vector<std::string> const& defines);
std::vector<std::string> const& GetDefines() const;
- void AddInclude(const std::string& includes);
+ void AddInclude(std::string const& includes);
void AddIncludes(std::string const& includes);
- void AddIncludes(const std::vector<std::string>& includes);
+ void AddIncludes(std::vector<std::string> const& includes);
std::vector<std::string> const& GetIncludes() const;
void AddFlag(std::string const& flag, std::string const& value);
@@ -38,7 +38,7 @@ public:
void AppendFlagString(std::string const& flag, std::string const& value);
void RemoveFlag(std::string const& flag);
bool HasFlag(std::string const& flag) const;
- const char* GetFlag(std::string const& flag) const;
+ char const* GetFlag(std::string const& flag) const;
protected:
// create a map of xml tags to the values they should have in the output
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 0b80aaa..ab27a92 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIfCommand.h"
#include <string>
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index f056587..5b1786c 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmImportedCxxModuleInfo.cxx b/Source/cmImportedCxxModuleInfo.cxx
index ad49a8d..26c1566 100644
--- a/Source/cmImportedCxxModuleInfo.cxx
+++ b/Source/cmImportedCxxModuleInfo.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmImportedCxxModuleInfo.h"
diff --git a/Source/cmImportedCxxModuleInfo.h b/Source/cmImportedCxxModuleInfo.h
index 1b29a06..a15752b 100644
--- a/Source/cmImportedCxxModuleInfo.h
+++ b/Source/cmImportedCxxModuleInfo.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 5ac2bd3..d4759da 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -1,9 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIncludeCommand.h"
#include <map>
-#include <sstream>
#include <utility>
#include "cmExecutionStatus.h"
@@ -100,8 +99,6 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
}
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
mfile = "";
break;
@@ -119,45 +116,22 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
cmGlobalGenerator* gg = status.GetMakefile().GetGlobalGenerator();
if (gg->IsExportedTargetsFile(fname_abs)) {
- const char* modal = nullptr;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
-
- switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0024)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n";
- modal = "should";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- modal = "may";
- messageType = MessageType::FATAL_ERROR;
- }
- if (modal) {
- e << "The file\n " << fname_abs
- << "\nwas generated by the export() "
- "command. It "
- << modal
- << " not be used as the argument to the "
- "include() command. Use ALIAS targets instead to refer to targets "
- "by alternative names.\n";
- status.GetMakefile().IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
- gg->CreateGenerationObjects();
- gg->GenerateImportFile(fname_abs);
+ status.GetMakefile().IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "The file\n ", fname_abs,
+ "\nwas generated by the export() "
+ "command. It may not be used as the argument to the "
+ "include() command. Use ALIAS targets instead to refer to targets "
+ "by alternative names.\n"));
+ return false;
}
std::string listFile = cmSystemTools::CollapseFullPath(
fname, status.GetMakefile().GetCurrentSourceDirectory());
- const bool fileDoesnotExist = !cmSystemTools::FileExists(listFile);
- const bool fileIsDirectory = cmSystemTools::FileIsDirectory(listFile);
+ bool const fileDoesnotExist = !cmSystemTools::FileExists(listFile);
+ bool const fileIsDirectory = cmSystemTools::FileIsDirectory(listFile);
if (fileDoesnotExist || fileIsDirectory) {
if (!resultVarName.empty()) {
status.GetMakefile().AddDefinition(resultVarName, "NOTFOUND");
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index af26163..0f71647 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index 23427a1..c08d15e 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIncludeDirectoryCommand.h"
#include <algorithm>
@@ -15,7 +15,7 @@
#include "cmSystemTools.h"
#include "cmValue.h"
-static void GetIncludes(cmMakefile& mf, const std::string& arg,
+static void GetIncludes(cmMakefile& mf, std::string const& arg,
std::vector<std::string>& incs);
static void NormalizeInclude(cmMakefile& mf, std::string& inc);
@@ -89,7 +89,7 @@ bool cmIncludeDirectoryCommand(std::vector<std::string> const& args,
// output from a program and passing it into a command the cleanup doesn't
// always happen
//
-static void GetIncludes(cmMakefile& mf, const std::string& arg,
+static void GetIncludes(cmMakefile& mf, std::string const& arg,
std::vector<std::string>& incs)
{
// break apart any line feed arguments
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index d830dbf..92e7bfa 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index c8b4a39..d6e84fa 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIncludeExternalMSProjectCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index fd77407..2b5c1a5 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmIncludeGuardCommand.cxx b/Source/cmIncludeGuardCommand.cxx
index 2b0e03c..665517d 100644
--- a/Source/cmIncludeGuardCommand.cxx
+++ b/Source/cmIncludeGuardCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIncludeGuardCommand.h"
#include "cmCryptoHash.h"
diff --git a/Source/cmIncludeGuardCommand.h b/Source/cmIncludeGuardCommand.h
index c4de3d4..7b8c563 100644
--- a/Source/cmIncludeGuardCommand.h
+++ b/Source/cmIncludeGuardCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx
index cdcc7df..8bf24a5 100644
--- a/Source/cmIncludeRegularExpressionCommand.cxx
+++ b/Source/cmIncludeRegularExpressionCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmIncludeRegularExpressionCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index a402f97..7532a64 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmInstallAndroidMKExportGenerator.cxx b/Source/cmInstallAndroidMKExportGenerator.cxx
index b038ac1..12b212f 100644
--- a/Source/cmInstallAndroidMKExportGenerator.cxx
+++ b/Source/cmInstallAndroidMKExportGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallAndroidMKExportGenerator.h"
#include <utility>
diff --git a/Source/cmInstallAndroidMKExportGenerator.h b/Source/cmInstallAndroidMKExportGenerator.h
index 4ee80d4..1167a8a 100644
--- a/Source/cmInstallAndroidMKExportGenerator.h
+++ b/Source/cmInstallAndroidMKExportGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/cmInstallCMakeConfigExportGenerator.cxx b/Source/cmInstallCMakeConfigExportGenerator.cxx
index e247e5b..4f5b82e 100644
--- a/Source/cmInstallCMakeConfigExportGenerator.cxx
+++ b/Source/cmInstallCMakeConfigExportGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallCMakeConfigExportGenerator.h"
#include <utility>
diff --git a/Source/cmInstallCMakeConfigExportGenerator.h b/Source/cmInstallCMakeConfigExportGenerator.h
index 03296de..6ca5c9a 100644
--- a/Source/cmInstallCMakeConfigExportGenerator.h
+++ b/Source/cmInstallCMakeConfigExportGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 9a797a7..e0044c6 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallCommand.h"
#include <algorithm>
@@ -99,48 +99,47 @@ public:
void SetError(std::string const& err) { this->Status.SetError(err); }
- bool MakeFilesFullPath(const char* modeName,
- const std::vector<std::string>& relFiles,
+ bool MakeFilesFullPath(char const* modeName,
+ std::vector<std::string> const& relFiles,
std::vector<std::string>& absFiles);
- bool MakeFilesFullPath(const char* modeName, const std::string& basePath,
- const std::vector<std::string>& relFiles,
+ bool MakeFilesFullPath(char const* modeName, std::string const& basePath,
+ std::vector<std::string> const& relFiles,
std::vector<std::string>& absFiles);
- bool CheckCMP0006(bool& failure) const;
- std::string GetDestination(const cmInstallCommandArguments* args,
- const std::string& varName,
- const std::string& guess) const;
+ std::string GetDestination(cmInstallCommandArguments const* args,
+ std::string const& varName,
+ std::string const& guess) const;
std::string GetRuntimeDestination(
- const cmInstallCommandArguments* args) const;
- std::string GetSbinDestination(const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
+ std::string GetSbinDestination(cmInstallCommandArguments const* args) const;
std::string GetArchiveDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetLibraryDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetCxxModulesBmiDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetIncludeDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetSysconfDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetSharedStateDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetLocalStateDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetRunStateDestination(
- const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
std::string GetDataRootDestination(
- const cmInstallCommandArguments* args) const;
- std::string GetDataDestination(const cmInstallCommandArguments* args) const;
- std::string GetInfoDestination(const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
+ std::string GetDataDestination(cmInstallCommandArguments const* args) const;
+ std::string GetInfoDestination(cmInstallCommandArguments const* args) const;
std::string GetLocaleDestination(
- const cmInstallCommandArguments* args) const;
- std::string GetManDestination(const cmInstallCommandArguments* args) const;
- std::string GetDocDestination(const cmInstallCommandArguments* args) const;
+ cmInstallCommandArguments const* args) const;
+ std::string GetManDestination(cmInstallCommandArguments const* args) const;
+ std::string GetDocDestination(cmInstallCommandArguments const* args) const;
std::string GetProgramExecutablesDestination(
- const cmInstallCommandArguments* args) const;
- std::string GetDestinationForType(const cmInstallCommandArguments* args,
- const std::string& type) const;
+ cmInstallCommandArguments const* args) const;
+ std::string GetDestinationForType(cmInstallCommandArguments const* args,
+ std::string const& type) const;
cmExecutionStatus& Status;
cmMakefile* Makefile;
@@ -148,14 +147,14 @@ public:
};
std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
- cmTarget& target, const cmInstallCommandArguments& args, bool impLib,
- cmListFileBacktrace const& backtrace, const std::string& destination,
+ cmTarget& target, cmInstallCommandArguments const& args, bool impLib,
+ cmListFileBacktrace const& backtrace, std::string const& destination,
bool forceOpt = false, bool namelink = false)
{
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(target.GetMakefile());
target.SetHaveInstallRule(true);
- const std::string& component =
+ std::string const& component =
namelink ? args.GetNamelinkComponent() : args.GetComponent();
auto g = cm::make_unique<cmInstallTargetGenerator>(
target.GetName(), destination, impLib, args.GetPermissions(),
@@ -166,7 +165,7 @@ std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
}
std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
- cmTarget& target, const cmInstallCommandArguments& args, bool impLib,
+ cmTarget& target, cmInstallCommandArguments const& args, bool impLib,
cmListFileBacktrace const& backtrace, bool forceOpt = false,
bool namelink = false)
{
@@ -176,9 +175,9 @@ std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
}
std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
- cmMakefile* mf, const std::vector<std::string>& absFiles,
- const cmInstallCommandArguments& args, bool programs,
- const std::string& destination)
+ cmMakefile* mf, std::vector<std::string> const& absFiles,
+ cmInstallCommandArguments const& args, bool programs,
+ std::string const& destination)
{
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(mf);
@@ -190,8 +189,8 @@ std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
}
std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
- cmMakefile* mf, const std::vector<std::string>& absFiles,
- const cmInstallCommandArguments& args, bool programs)
+ cmMakefile* mf, std::vector<std::string> const& absFiles,
+ cmInstallCommandArguments const& args, bool programs)
{
return CreateInstallFilesGenerator(mf, absFiles, args, programs,
args.GetDestination());
@@ -199,7 +198,7 @@ std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
std::unique_ptr<cmInstallFileSetGenerator> CreateInstallFileSetGenerator(
Helper& helper, cmTarget& target, cmFileSet* fileSet,
- const std::string& destination, const cmInstallCommandArguments& args)
+ std::string const& destination, cmInstallCommandArguments const& args)
{
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(helper.Makefile);
@@ -212,9 +211,9 @@ std::unique_ptr<cmInstallFileSetGenerator> CreateInstallFileSetGenerator(
void AddInstallRuntimeDependenciesGenerator(
Helper& helper, cmInstallRuntimeDependencySet* runtimeDependencySet,
- const cmInstallCommandArguments& runtimeArgs,
- const cmInstallCommandArguments& libraryArgs,
- const cmInstallCommandArguments& frameworkArgs,
+ cmInstallCommandArguments const& runtimeArgs,
+ cmInstallCommandArguments const& libraryArgs,
+ cmInstallCommandArguments const& frameworkArgs,
RuntimeDependenciesArgs runtimeDependenciesArgs, bool& installsRuntime,
bool& installsLibrary, bool& installsFramework)
{
@@ -568,7 +567,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
privateHeaderArgs.GetNamelinkOnly() ||
publicHeaderArgs.GetNamelinkOnly() || resourceArgs.GetNamelinkOnly() ||
std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
- [](const cmInstallCommandFileSetArguments& fileSetArg)
+ [](cmInstallCommandFileSetArguments const& fileSetArg)
-> bool { return fileSetArg.GetNamelinkOnly(); }) ||
cxxModuleBmiArgs.GetNamelinkOnly()) {
status.SetError(
@@ -582,7 +581,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
privateHeaderArgs.GetNamelinkSkip() ||
publicHeaderArgs.GetNamelinkSkip() || resourceArgs.GetNamelinkSkip() ||
std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
- [](const cmInstallCommandFileSetArguments& fileSetArg)
+ [](cmInstallCommandFileSetArguments const& fileSetArg)
-> bool { return fileSetArg.GetNamelinkSkip(); }) ||
cxxModuleBmiArgs.GetNamelinkSkip()) {
status.SetError(
@@ -599,7 +598,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
publicHeaderArgs.HasNamelinkComponent() ||
resourceArgs.HasNamelinkComponent() ||
std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
- [](const cmInstallCommandFileSetArguments& fileSetArg)
+ [](cmInstallCommandFileSetArguments const& fileSetArg)
-> bool { return fileSetArg.HasNamelinkComponent(); }) ||
cxxModuleBmiArgs.HasNamelinkComponent()) {
status.SetError(
@@ -619,7 +618,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
!bundleArgs.GetType().empty() || !privateHeaderArgs.GetType().empty() ||
!publicHeaderArgs.GetType().empty() || !resourceArgs.GetType().empty() ||
std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
- [](const cmInstallCommandFileSetArguments& fileSetArg)
+ [](cmInstallCommandFileSetArguments const& fileSetArg)
-> bool { return !fileSetArg.GetType().empty(); }) ||
!cxxModuleBmiArgs.GetType().empty()) {
status.SetError(
@@ -628,7 +627,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
return false;
}
if (std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
- [](const cmInstallCommandFileSetArguments& fileSetArg)
+ [](cmInstallCommandFileSetArguments const& fileSetArg)
-> bool { return fileSetArg.GetFileSet().empty(); })) {
status.SetError("TARGETS given FILE_SET option without file set name.");
return false;
@@ -711,7 +710,8 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (!target) {
// If no local target has been found, find it in the global scope.
cmTarget* const global_target =
- helper.Makefile->GetGlobalGenerator()->FindTarget(tgt, true);
+ helper.Makefile->GetGlobalGenerator()->FindTarget(
+ tgt, { cmStateEnums::TargetDomain::NATIVE });
if (global_target && !global_target->IsImported()) {
target = global_target;
}
@@ -786,10 +786,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
auto interfaceFileSets = target.GetAllInterfaceFileSets();
if (std::any_of(
interfaceFileSets.begin(), interfaceFileSets.end(),
- [=](const std::string& name) -> bool {
+ [=](std::string const& name) -> bool {
return !std::any_of(
fileSetArgs.begin(), fileSetArgs.end(),
- [=](const cmInstallCommandFileSetArguments& fileSetArg)
+ [=](cmInstallCommandFileSetArguments const& fileSetArg)
-> bool { return fileSetArg.GetFileSet() == name; });
})) {
status.SetError(cmStrCat("TARGETS target ", target.GetName(),
@@ -1017,16 +1017,6 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (!bundleArgs.GetDestination().empty()) {
bundleGenerator = CreateInstallTargetGenerator(
target, bundleArgs, false, helper.Makefile->GetBacktrace());
- } else if (!runtimeArgs.GetDestination().empty()) {
- bool failure = false;
- if (helper.CheckCMP0006(failure)) {
- // For CMake 2.4 compatibility fallback to the RUNTIME
- // properties.
- bundleGenerator = CreateInstallTargetGenerator(
- target, runtimeArgs, false, helper.Makefile->GetBacktrace());
- } else if (failure) {
- return false;
- }
}
if (!bundleGenerator) {
status.SetError(cmStrCat("TARGETS given no BUNDLE DESTINATION for "
@@ -1405,7 +1395,8 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
if (!target || !target->IsImported()) {
// If no local target has been found, find it in the global scope.
cmTarget* const global_target =
- helper.Makefile->GetGlobalGenerator()->FindTarget(tgt, true);
+ helper.Makefile->GetGlobalGenerator()->FindTarget(
+ tgt, { cmStateEnums::TargetDomain::NATIVE });
if (global_target && global_target->IsImported()) {
target = global_target;
}
@@ -1438,8 +1429,8 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
bool installsBundle = false;
auto const createInstallGenerator =
- [helper](cmTarget& target, const cmInstallCommandArguments& typeArgs,
- const std::string& destination)
+ [helper](cmTarget& target, cmInstallCommandArguments const& typeArgs,
+ std::string const& destination)
-> std::unique_ptr<cmInstallImportedRuntimeArtifactsGenerator> {
return cm::make_unique<cmInstallImportedRuntimeArtifactsGenerator>(
target.GetName(), destination, typeArgs.GetPermissions(),
@@ -1589,7 +1580,7 @@ bool HandleFilesMode(std::vector<std::string> const& args,
return false;
}
- const std::vector<std::string>& filesVector = files;
+ std::vector<std::string> const& filesVector = files;
// Check if there is something to do.
if (filesVector.empty()) {
@@ -1608,43 +1599,17 @@ bool HandleFilesMode(std::vector<std::string> const& args,
return false;
}
- cmPolicies::PolicyStatus policyStatus =
- helper.Makefile->GetPolicyStatus(cmPolicies::CMP0062);
-
cmGlobalGenerator* gg = helper.Makefile->GetGlobalGenerator();
for (std::string const& file : filesVector) {
if (gg->IsExportedTargetsFile(file)) {
- const char* modal = nullptr;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
-
- switch (policyStatus) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n";
- modal = "should";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- modal = "may";
- messageType = MessageType::FATAL_ERROR;
- break;
- }
- if (modal) {
- e << "The file\n " << file
- << "\nwas generated by the export() "
- "command. It "
- << modal
- << " not be installed with the "
- "install() command. Use the install(EXPORT) mechanism "
- "instead. See the cmake-packages(7) manual for more.\n";
- helper.Makefile->IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
+ helper.Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("The file\n ", file, '\n',
+ "was generated by the export() command. "
+ "It may not be installed with the install() command. "
+ "Use the install(EXPORT) mechanism instead. "
+ "See the cmake-packages(7) manual for more."));
+ return false;
}
}
@@ -1880,13 +1845,6 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
case cmPolicies::OLD:
destination = args[i];
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- // We should never get here, only OLD, WARN, and NEW are used
- status.GetMakefile().IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0177));
- return false;
}
doing = DoingNone;
} else if (doing == DoingType) {
@@ -2176,23 +2134,6 @@ bool HandleExportMode(std::vector<std::string> const& args,
cmExportSet& exportSet =
helper.Makefile->GetGlobalGenerator()->GetExportSets()[exp];
- if (exportOld) {
- for (auto const& te : exportSet.GetTargetExports()) {
- cmTarget* tgt =
- helper.Makefile->GetGlobalGenerator()->FindTarget(te->TargetName);
- const bool newCMP0022Behavior =
- (tgt && tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
- tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD);
-
- if (!newCMP0022Behavior) {
- status.SetError(cmStrCat(
- "INSTALL(EXPORT) given keyword \""
- "EXPORT_LINK_INTERFACE_LIBRARIES\", but target \"",
- te->TargetName, "\" does not have policy CMP0022 set to NEW."));
- return false;
- }
- }
- }
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(helper.Makefile);
@@ -2461,17 +2402,17 @@ bool HandleRuntimeDependencySetMode(std::vector<std::string> const& args,
return true;
}
-bool Helper::MakeFilesFullPath(const char* modeName,
- const std::vector<std::string>& relFiles,
+bool Helper::MakeFilesFullPath(char const* modeName,
+ std::vector<std::string> const& relFiles,
std::vector<std::string>& absFiles)
{
return this->MakeFilesFullPath(
modeName, this->Makefile->GetCurrentSourceDirectory(), relFiles, absFiles);
}
-bool Helper::MakeFilesFullPath(const char* modeName,
- const std::string& basePath,
- const std::vector<std::string>& relFiles,
+bool Helper::MakeFilesFullPath(char const* modeName,
+ std::string const& basePath,
+ std::vector<std::string> const& relFiles,
std::vector<std::string>& absFiles)
{
for (std::string const& relFile : relFiles) {
@@ -2494,34 +2435,9 @@ bool Helper::MakeFilesFullPath(const char* modeName,
return true;
}
-bool Helper::CheckCMP0006(bool& failure) const
-{
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) {
- case cmPolicies::WARN:
- this->Makefile->IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0006));
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to allow compatibility
- return true;
- case cmPolicies::NEW:
- // NEW behavior is to disallow compatibility
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- failure = true;
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0006));
- break;
- }
- return false;
-}
-
-std::string Helper::GetDestination(const cmInstallCommandArguments* args,
- const std::string& varName,
- const std::string& guess) const
+std::string Helper::GetDestination(cmInstallCommandArguments const* args,
+ std::string const& varName,
+ std::string const& guess) const
{
if (args && !args->GetDestination().empty()) {
return args->GetDestination();
@@ -2534,31 +2450,31 @@ std::string Helper::GetDestination(const cmInstallCommandArguments* args,
}
std::string Helper::GetRuntimeDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_BINDIR", "bin");
}
std::string Helper::GetSbinDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_SBINDIR", "sbin");
}
std::string Helper::GetArchiveDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib");
}
std::string Helper::GetLibraryDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib");
}
std::string Helper::GetCxxModulesBmiDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
if (args) {
return args->GetDestination();
@@ -2567,31 +2483,31 @@ std::string Helper::GetCxxModulesBmiDestination(
}
std::string Helper::GetIncludeDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_INCLUDEDIR", "include");
}
std::string Helper::GetSysconfDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_SYSCONFDIR", "etc");
}
std::string Helper::GetSharedStateDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_SHAREDSTATEDIR", "com");
}
std::string Helper::GetLocalStateDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_LOCALSTATEDIR", "var");
}
std::string Helper::GetRunStateDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_RUNSTATEDIR",
this->GetLocalStateDestination(nullptr) +
@@ -2599,27 +2515,27 @@ std::string Helper::GetRunStateDestination(
}
std::string Helper::GetDataRootDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_DATAROOTDIR", "share");
}
std::string Helper::GetDataDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_DATADIR",
this->GetDataRootDestination(nullptr));
}
std::string Helper::GetInfoDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_INFODIR",
this->GetDataRootDestination(nullptr) + "/info");
}
std::string Helper::GetLocaleDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_LOCALEDIR",
this->GetDataRootDestination(nullptr) +
@@ -2627,27 +2543,27 @@ std::string Helper::GetLocaleDestination(
}
std::string Helper::GetManDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_MANDIR",
this->GetDataRootDestination(nullptr) + "/man");
}
std::string Helper::GetDocDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_DOCDIR",
this->GetDataRootDestination(nullptr) + "/doc");
}
std::string Helper::GetProgramExecutablesDestination(
- const cmInstallCommandArguments* args) const
+ cmInstallCommandArguments const* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_LIBEXECDIR", "libexec");
}
std::string Helper::GetDestinationForType(
- const cmInstallCommandArguments* args, const std::string& type) const
+ cmInstallCommandArguments const* args, std::string const& type) const
{
if (args && !args->GetDestination().empty()) {
return args->GetDestination();
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index f0ba44e..1d3f79e 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 8e12cfe..23b38f6 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallCommandArguments.h"
#include <algorithm>
@@ -19,13 +19,13 @@
#include "cmSystemTools.h"
// Table of valid permissions.
-const char* cmInstallCommandArguments::PermissionsTable[] = {
+char const* cmInstallCommandArguments::PermissionsTable[] = {
"OWNER_READ", "OWNER_WRITE", "OWNER_EXECUTE", "GROUP_READ",
"GROUP_WRITE", "GROUP_EXECUTE", "WORLD_READ", "WORLD_WRITE",
"WORLD_EXECUTE", "SETUID", "SETGID", nullptr
};
-const std::string cmInstallCommandArguments::EmptyString;
+std::string const cmInstallCommandArguments::EmptyString;
cmInstallCommandArguments::cmInstallCommandArguments(
std::string defaultComponent, cmMakefile& makefile)
@@ -66,12 +66,6 @@ cmInstallCommandArguments::cmInstallCommandArguments(
return ArgumentParser::Continue::No;
};
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- // We should never get here, only OLD, WARN, and NEW are used
- makefile.IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0177));
}
this->Bind("DESTINATION"_s, normalizeDest);
@@ -87,7 +81,7 @@ cmInstallCommandArguments::cmInstallCommandArguments(
this->Bind("TYPE"_s, this->Type);
}
-const std::string& cmInstallCommandArguments::GetDestination() const
+std::string const& cmInstallCommandArguments::GetDestination() const
{
if (!this->DestinationString.empty()) {
return this->DestinationString;
@@ -98,7 +92,7 @@ const std::string& cmInstallCommandArguments::GetDestination() const
return EmptyString;
}
-const std::string& cmInstallCommandArguments::GetComponent() const
+std::string const& cmInstallCommandArguments::GetComponent() const
{
if (!this->Component.empty()) {
return this->Component;
@@ -113,7 +107,7 @@ const std::string& cmInstallCommandArguments::GetComponent() const
return unspecifiedComponent;
}
-const std::string& cmInstallCommandArguments::GetNamelinkComponent() const
+std::string const& cmInstallCommandArguments::GetNamelinkComponent() const
{
if (!this->NamelinkComponent.empty()) {
return this->NamelinkComponent;
@@ -121,7 +115,7 @@ const std::string& cmInstallCommandArguments::GetNamelinkComponent() const
return this->GetComponent();
}
-const std::string& cmInstallCommandArguments::GetRename() const
+std::string const& cmInstallCommandArguments::GetRename() const
{
if (!this->Rename.empty()) {
return this->Rename;
@@ -132,7 +126,7 @@ const std::string& cmInstallCommandArguments::GetRename() const
return EmptyString;
}
-const std::string& cmInstallCommandArguments::GetPermissions() const
+std::string const& cmInstallCommandArguments::GetPermissions() const
{
if (!this->PermissionsString.empty()) {
return this->PermissionsString;
@@ -198,17 +192,17 @@ bool cmInstallCommandArguments::HasNamelinkComponent() const
return false;
}
-const std::string& cmInstallCommandArguments::GetType() const
+std::string const& cmInstallCommandArguments::GetType() const
{
return this->Type;
}
-const std::string& cmInstallCommandArguments::GetDefaultComponent() const
+std::string const& cmInstallCommandArguments::GetDefaultComponent() const
{
return this->DefaultComponentName;
}
-const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations()
+std::vector<std::string> const& cmInstallCommandArguments::GetConfigurations()
const
{
if (!this->Configurations.empty()) {
@@ -241,10 +235,10 @@ bool cmInstallCommandArguments::CheckPermissions()
}
bool cmInstallCommandArguments::CheckPermissions(
- const std::string& onePermission, std::string& permissions)
+ std::string const& onePermission, std::string& permissions)
{
// Check the permission against the table.
- for (const char** valid = cmInstallCommandArguments::PermissionsTable;
+ for (char const** valid = cmInstallCommandArguments::PermissionsTable;
*valid; ++valid) {
if (onePermission == *valid) {
// This is a valid permission.
@@ -259,14 +253,14 @@ bool cmInstallCommandArguments::CheckPermissions(
cmInstallCommandIncludesArgument::cmInstallCommandIncludesArgument() = default;
-const std::vector<std::string>&
+std::vector<std::string> const&
cmInstallCommandIncludesArgument::GetIncludeDirs() const
{
return this->IncludeDirs;
}
void cmInstallCommandIncludesArgument::Parse(
- const std::vector<std::string>* args, std::vector<std::string>*)
+ std::vector<std::string> const* args, std::vector<std::string>*)
{
if (args->empty()) {
return;
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index cb3917e..7bf861e 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,22 +25,22 @@ public:
// Compute destination path.and check permissions
bool Finalize();
- const std::string& GetDestination() const;
- const std::string& GetComponent() const;
- const std::string& GetNamelinkComponent() const;
+ std::string const& GetDestination() const;
+ std::string const& GetComponent() const;
+ std::string const& GetNamelinkComponent() const;
bool GetExcludeFromAll() const;
- const std::string& GetRename() const;
- const std::string& GetPermissions() const;
- const std::vector<std::string>& GetConfigurations() const;
+ std::string const& GetRename() const;
+ std::string const& GetPermissions() const;
+ std::vector<std::string> const& GetConfigurations() const;
bool GetOptional() const;
bool GetNamelinkOnly() const;
bool GetNamelinkSkip() const;
bool HasNamelinkComponent() const;
- const std::string& GetType() const;
+ std::string const& GetType() const;
- const std::string& GetDefaultComponent() const;
+ std::string const& GetDefaultComponent() const;
- static bool CheckPermissions(const std::string& onePerm, std::string& perm);
+ static bool CheckPermissions(std::string const& onePerm, std::string& perm);
private:
std::string Destination;
@@ -59,8 +59,8 @@ private:
std::string PermissionsString;
cmInstallCommandArguments* GenericArguments = nullptr;
- static const char* PermissionsTable[];
- static const std::string EmptyString;
+ static char const* PermissionsTable[];
+ static std::string const EmptyString;
std::string DefaultComponentName;
bool CheckPermissions();
};
@@ -69,10 +69,10 @@ class cmInstallCommandIncludesArgument
{
public:
cmInstallCommandIncludesArgument();
- void Parse(const std::vector<std::string>* args,
+ void Parse(std::vector<std::string> const* args,
std::vector<std::string>* unconsumedArgs);
- const std::vector<std::string>& GetIncludeDirs() const;
+ std::vector<std::string> const& GetIncludeDirs() const;
private:
std::vector<std::string> IncludeDirs;
@@ -87,7 +87,7 @@ public:
void Parse(std::vector<std::string> args,
std::vector<std::string>* unconsumedArgs);
- const std::string& GetFileSet() const { return this->FileSet; }
+ std::string const& GetFileSet() const { return this->FileSet; }
private:
std::string FileSet;
diff --git a/Source/cmInstallCxxModuleBmiGenerator.cxx b/Source/cmInstallCxxModuleBmiGenerator.cxx
index 111691e..37d9ce5 100644
--- a/Source/cmInstallCxxModuleBmiGenerator.cxx
+++ b/Source/cmInstallCxxModuleBmiGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallCxxModuleBmiGenerator.h"
#include <ostream>
@@ -63,7 +63,7 @@ std::string cmInstallCxxModuleBmiGenerator::GetDestination(
}
void cmInstallCxxModuleBmiGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
auto const& loc = this->GetScriptLocation(config);
if (loc.empty()) {
diff --git a/Source/cmInstallCxxModuleBmiGenerator.h b/Source/cmInstallCxxModuleBmiGenerator.h
index 23ed02e..b3b5d37 100644
--- a/Source/cmInstallCxxModuleBmiGenerator.h
+++ b/Source/cmInstallCxxModuleBmiGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -40,7 +40,7 @@ public:
MessageLevel GetMessageLevel() const { return this->Message; }
protected:
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
std::string const TargetName;
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 6aa9910..0eeebcf 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallDirectoryGenerator.h"
#include <utility>
@@ -77,7 +77,7 @@ void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
}
void cmInstallDirectoryGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
std::vector<std::string> dirs = this->GetDirectories(config);
@@ -93,11 +93,11 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
}
void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
- std::ostream& os, const std::string& config, Indent indent,
+ std::ostream& os, std::string const& config, Indent indent,
std::vector<std::string> const& dirs)
{
// Write code to install the directories.
- const char* no_rename = nullptr;
+ char const* no_rename = nullptr;
this->AddInstallRule(os, this->GetDestination(config),
cmInstallType_DIRECTORY, dirs, this->Optional,
this->FilePermissions.c_str(),
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 96a924f..b02824a 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -36,9 +36,9 @@ public:
protected:
void GenerateScriptActions(std::ostream& os, Indent indent) override;
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
- void AddDirectoryInstallRule(std::ostream& os, const std::string& config,
+ void AddDirectoryInstallRule(std::ostream& os, std::string const& config,
Indent indent,
std::vector<std::string> const& dirs);
cmLocalGenerator* LocalGenerator = nullptr;
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 9828bf2..4ba3f01 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallExportGenerator.h"
#include <map>
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 6100610..eb2d5dd 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,10 +30,10 @@ public:
std::string targetNamespace,
std::string cxxModulesDirectory,
cmListFileBacktrace backtrace);
- cmInstallExportGenerator(const cmInstallExportGenerator&) = delete;
+ cmInstallExportGenerator(cmInstallExportGenerator const&) = delete;
~cmInstallExportGenerator() override;
- cmInstallExportGenerator& operator=(const cmInstallExportGenerator&) =
+ cmInstallExportGenerator& operator=(cmInstallExportGenerator const&) =
delete;
virtual char const* InstallSubcommand() const = 0;
@@ -44,7 +44,7 @@ public:
cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; }
- const std::string& GetNamespace() const { return this->Namespace; }
+ std::string const& GetNamespace() const { return this->Namespace; }
std::string const& GetMainImportFile() const { return this->MainImportFile; }
diff --git a/Source/cmInstallFileSetGenerator.cxx b/Source/cmInstallFileSetGenerator.cxx
index 8c37312..d40d262 100644
--- a/Source/cmInstallFileSetGenerator.cxx
+++ b/Source/cmInstallFileSetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallFileSetGenerator.h"
#include <map>
@@ -55,7 +55,7 @@ std::string cmInstallFileSetGenerator::GetDestination(
}
void cmInstallFileSetGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
for (auto const& dirEntry : this->CalculateFilesPerDir(config)) {
std::string destSub;
@@ -71,7 +71,7 @@ void cmInstallFileSetGenerator::GenerateScriptForConfig(
std::map<std::string, std::vector<std::string>>
cmInstallFileSetGenerator::CalculateFilesPerDir(
- const std::string& config) const
+ std::string const& config) const
{
std::map<std::string, std::vector<std::string>> result;
diff --git a/Source/cmInstallFileSetGenerator.h b/Source/cmInstallFileSetGenerator.h
index 708cee6..b13a5e0 100644
--- a/Source/cmInstallFileSetGenerator.h
+++ b/Source/cmInstallFileSetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -35,7 +35,7 @@ public:
cmGeneratorTarget* GetTarget() const { return this->Target; }
protected:
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
private:
@@ -47,5 +47,5 @@ private:
cmGeneratorTarget* Target;
std::map<std::string, std::vector<std::string>> CalculateFilesPerDir(
- const std::string& config) const;
+ std::string const& config) const;
};
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index e65cb24..8490f69 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
#include <cm/memory>
@@ -17,7 +17,7 @@
class cmListFileBacktrace;
-static std::string FindInstallSource(cmMakefile& makefile, const char* name);
+static std::string FindInstallSource(cmMakefile& makefile, char const* name);
static void CreateInstallGenerator(cmMakefile& makefile,
std::string const& dest,
std::vector<std::string> const& files);
@@ -49,7 +49,7 @@ bool cmInstallFilesCommand(std::vector<std::string> const& args,
} else {
std::vector<std::string> finalArgs(args.begin() + 1, args.end());
mf.AddGeneratorAction(
- [dest, finalArgs](cmLocalGenerator& lg, const cmListFileBacktrace&) {
+ [dest, finalArgs](cmLocalGenerator& lg, cmListFileBacktrace const&) {
FinalAction(*lg.GetMakefile(), dest, finalArgs);
});
}
@@ -115,8 +115,8 @@ static void CreateInstallGenerator(cmMakefile& makefile,
}
// Use a file install generator.
- const std::string no_permissions;
- const std::string no_rename;
+ std::string const no_permissions;
+ std::string const no_rename;
bool no_exclude_from_all = false;
std::string no_component =
makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
@@ -134,7 +134,7 @@ static void CreateInstallGenerator(cmMakefile& makefile,
* present in the build tree. If a full path is given, it is just
* returned.
*/
-static std::string FindInstallSource(cmMakefile& makefile, const char* name)
+static std::string FindInstallSource(cmMakefile& makefile, char const* name)
{
if (cmSystemTools::FileIsFullPath(name) ||
cmGeneratorExpression::Find(name) == 0) {
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index 219bb97..c2ba0fd 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 43dc656..febeb52 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallFilesGenerator.h"
#include <utility>
@@ -85,7 +85,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
std::vector<std::string> const& files)
{
// Write code to install the files.
- const char* no_dir_permissions = nullptr;
+ char const* no_dir_permissions = nullptr;
this->AddInstallRule(
os, this->GetDestination(config),
(this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), files,
@@ -104,7 +104,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
}
void cmInstallFilesGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
std::vector<std::string> files = this->GetFiles(config);
this->AddFilesInstallRule(os, config, indent, files);
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 874bde1..5ab2f50 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -37,7 +37,7 @@ public:
protected:
void GenerateScriptActions(std::ostream& os, Indent indent) override;
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
void AddFilesInstallRule(std::ostream& os, std::string const& config,
Indent indent,
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 93abd45..b49b0ea 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallGenerator.h"
#include <sstream>
@@ -41,10 +41,10 @@ void cmInstallGenerator::CheckCMP0082(bool& haveSubdirectoryInstall,
void cmInstallGenerator::AddInstallRule(
std::ostream& os, std::string const& dest, cmInstallType type,
std::vector<std::string> const& files, bool optional /* = false */,
- const char* permissions_file /* = nullptr */,
- const char* permissions_dir /* = nullptr */,
- const char* rename /* = nullptr */, const char* literal_args /* = nullptr */,
- Indent indent, const char* files_var /* = nullptr */)
+ char const* permissions_file /* = nullptr */,
+ char const* permissions_dir /* = nullptr */,
+ char const* rename /* = nullptr */, char const* literal_args /* = nullptr */,
+ Indent indent, char const* files_var /* = nullptr */)
{
// Use the FILE command to install the file.
std::string stype;
@@ -165,7 +165,7 @@ void cmInstallGenerator::AddInstallRule(
}
std::string cmInstallGenerator::CreateComponentTest(
- const std::string& component, bool exclude_from_all, bool all_components)
+ std::string const& component, bool exclude_from_all, bool all_components)
{
if (all_components) {
if (exclude_from_all) {
@@ -207,7 +207,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
}
}
-bool cmInstallGenerator::InstallsForConfig(const std::string& config)
+bool cmInstallGenerator::InstallsForConfig(std::string const& config)
{
return this->GeneratesForConfig(config);
}
@@ -255,9 +255,9 @@ std::string cmInstallGenerator::GetDestDirPath(std::string const& file)
}
void cmInstallGenerator::AddTweak(std::ostream& os, Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& file,
- const TweakMethod& tweak)
+ TweakMethod const& tweak)
{
std::ostringstream tw;
tweak(tw, indent.Next(), config, file);
@@ -271,10 +271,10 @@ void cmInstallGenerator::AddTweak(std::ostream& os, Indent indent,
}
void cmInstallGenerator::AddTweak(std::ostream& os, Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& dir,
std::vector<std::string> const& files,
- const TweakMethod& tweak)
+ TweakMethod const& tweak)
{
if (files.size() == 1) {
// Tweak a single file.
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 9fcd284..27f4b4f 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,17 +48,17 @@ public:
void AddInstallRule(
std::ostream& os, std::string const& dest, cmInstallType type,
std::vector<std::string> const& files, bool optional = false,
- const char* permissions_file = nullptr,
- const char* permissions_dir = nullptr, const char* rename = nullptr,
- const char* literal_args = nullptr, Indent indent = Indent(),
- const char* files_var = nullptr);
+ char const* permissions_file = nullptr,
+ char const* permissions_dir = nullptr, char const* rename = nullptr,
+ char const* literal_args = nullptr, Indent indent = Indent(),
+ char const* files_var = nullptr);
/** Get the install destination as it should appear in the
installation script. */
static std::string ConvertToAbsoluteDestination(std::string const& dest);
/** Test if this generator installs something for a given configuration. */
- bool InstallsForConfig(const std::string& config);
+ bool InstallsForConfig(std::string const& config);
/** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */
static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false);
@@ -77,20 +77,20 @@ public:
protected:
void GenerateScript(std::ostream& os) override;
- std::string CreateComponentTest(const std::string& component,
+ std::string CreateComponentTest(std::string const& component,
bool exclude_from_all,
bool all_components = false);
using TweakMethod =
std::function<void(std::ostream& os, Indent indent,
- const std::string& config, const std::string& file)>;
+ std::string const& config, std::string const& file)>;
static void AddTweak(std::ostream& os, Indent indent,
- const std::string& config, std::string const& file,
- const TweakMethod& tweak);
+ std::string const& config, std::string const& file,
+ TweakMethod const& tweak);
static void AddTweak(std::ostream& os, Indent indent,
- const std::string& config, std::string const& dir,
+ std::string const& config, std::string const& dir,
std::vector<std::string> const& files,
- const TweakMethod& tweak);
+ TweakMethod const& tweak);
// Information shared by most generator types.
std::string const Destination;
diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx
index 3f8a103..9e1ecc1 100644
--- a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx
+++ b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallGetRuntimeDependenciesGenerator.h"
#include <memory>
@@ -24,8 +24,8 @@
namespace {
template <typename T, typename F>
-void WriteMultiArgument(std::ostream& os, const cm::string_view& keyword,
- const std::vector<T>& list,
+void WriteMultiArgument(std::ostream& os, cm::string_view const& keyword,
+ std::vector<T> const& list,
cmScriptGeneratorIndent indent, F transform)
{
bool first = true;
@@ -42,27 +42,27 @@ void WriteMultiArgument(std::ostream& os, const cm::string_view& keyword,
}
void WriteFilesArgument(
- std::ostream& os, const cm::string_view& keyword,
- const std::vector<std::unique_ptr<cmInstallRuntimeDependencySet::Item>>&
+ std::ostream& os, cm::string_view const& keyword,
+ std::vector<std::unique_ptr<cmInstallRuntimeDependencySet::Item>> const&
items,
- const std::string& config, cmScriptGeneratorIndent indent)
+ std::string const& config, cmScriptGeneratorIndent indent)
{
WriteMultiArgument(
os, keyword, items, indent,
- [config](const std::unique_ptr<cmInstallRuntimeDependencySet::Item>& i)
+ [config](std::unique_ptr<cmInstallRuntimeDependencySet::Item> const& i)
-> std::string { return cmStrCat('"', i->GetItemPath(config), '"'); });
}
void WriteGenexEvaluatorArgument(std::ostream& os,
- const cm::string_view& keyword,
- const std::vector<std::string>& genexes,
- const std::string& config,
+ cm::string_view const& keyword,
+ std::vector<std::string> const& genexes,
+ std::string const& config,
cmLocalGenerator* lg,
cmScriptGeneratorIndent indent)
{
WriteMultiArgument(
os, keyword, genexes, indent,
- [config, lg](const std::string& genex) -> cm::optional<std::string> {
+ [config, lg](std::string const& genex) -> cm::optional<std::string> {
std::string result = cmGeneratorExpression::Evaluate(genex, lg, config);
if (result.empty()) {
return cm::nullopt;
@@ -82,8 +82,8 @@ cmInstallGetRuntimeDependenciesGenerator::
std::vector<std::string> postExcludeRegexes,
std::vector<std::string> postIncludeFiles,
std::vector<std::string> postExcludeFiles, std::string libraryComponent,
- std::string frameworkComponent, bool noInstallRPath, const char* depsVar,
- const char* rpathPrefix, std::vector<std::string> const& configurations,
+ std::string frameworkComponent, bool noInstallRPath, char const* depsVar,
+ char const* rpathPrefix, std::vector<std::string> const& configurations,
MessageLevel message, bool exclude_from_all, cmListFileBacktrace backtrace)
: cmInstallGenerator("", configurations, "", message, exclude_from_all,
false, std::move(backtrace))
@@ -136,7 +136,7 @@ void cmInstallGetRuntimeDependenciesGenerator::GenerateScript(std::ostream& os)
}
void cmInstallGetRuntimeDependenciesGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
std::string installNameTool =
this->LocalGenerator->GetMakefile()->GetSafeDefinition(
@@ -182,7 +182,7 @@ void cmInstallGetRuntimeDependenciesGenerator::GenerateScriptForConfig(
std::set<std::string> postExcludeFiles;
auto const addPostExclude =
[config, &postExcludeFiles, this](
- const std::vector<std::unique_ptr<cmInstallRuntimeDependencySet::Item>>&
+ std::vector<std::unique_ptr<cmInstallRuntimeDependencySet::Item>> const&
tgts) {
for (auto const& item : tgts) {
item->AddPostExcludeFiles(config, postExcludeFiles,
diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.h b/Source/cmInstallGetRuntimeDependenciesGenerator.h
index 8e4e8cb..11b6d87 100644
--- a/Source/cmInstallGetRuntimeDependenciesGenerator.h
+++ b/Source/cmInstallGetRuntimeDependenciesGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -24,8 +24,8 @@ public:
std::vector<std::string> postExcludeRegexes,
std::vector<std::string> postIncludeFiles,
std::vector<std::string> postExcludeFiles, std::string libraryComponent,
- std::string frameworkComponent, bool noInstallRPath, const char* depsVar,
- const char* rpathPrefix, std::vector<std::string> const& configurations,
+ std::string frameworkComponent, bool noInstallRPath, char const* depsVar,
+ char const* rpathPrefix, std::vector<std::string> const& configurations,
MessageLevel message, bool exclude_from_all,
cmListFileBacktrace backtrace);
@@ -34,7 +34,7 @@ public:
protected:
void GenerateScript(std::ostream& os) override;
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
private:
@@ -49,7 +49,7 @@ private:
std::string LibraryComponent;
std::string FrameworkComponent;
bool NoInstallRPath;
- const char* DepsVar;
- const char* RPathPrefix;
+ char const* DepsVar;
+ char const* RPathPrefix;
cmLocalGenerator* LocalGenerator = nullptr;
};
diff --git a/Source/cmInstallImportedRuntimeArtifactsGenerator.cxx b/Source/cmInstallImportedRuntimeArtifactsGenerator.cxx
index 79b18e5..9552748 100644
--- a/Source/cmInstallImportedRuntimeArtifactsGenerator.cxx
+++ b/Source/cmInstallImportedRuntimeArtifactsGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallImportedRuntimeArtifactsGenerator.h"
#include <cassert>
@@ -19,13 +19,13 @@
#include "cmStringAlgorithms.h"
namespace {
-const cmsys::RegularExpression FrameworkRegularExpression(
+cmsys::RegularExpression const FrameworkRegularExpression(
"^(.*/)?([^/]*)\\.framework/(.*)$");
-const cmsys::RegularExpression BundleRegularExpression(
+cmsys::RegularExpression const BundleRegularExpression(
"^(.*/)?([^/]*)\\.app/(.*)$");
-const cmsys::RegularExpression CFBundleRegularExpression(
+cmsys::RegularExpression const CFBundleRegularExpression(
"^(.*/)?([^/]*)\\.bundle/(.*)$");
}
@@ -66,7 +66,7 @@ std::string cmInstallImportedRuntimeArtifactsGenerator::GetDestination(
}
void cmInstallImportedRuntimeArtifactsGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
auto location = this->Target->GetFullPath(config);
diff --git a/Source/cmInstallImportedRuntimeArtifactsGenerator.h b/Source/cmInstallImportedRuntimeArtifactsGenerator.h
index 84d3fee..ec68587 100644
--- a/Source/cmInstallImportedRuntimeArtifactsGenerator.h
+++ b/Source/cmInstallImportedRuntimeArtifactsGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -32,7 +32,7 @@ public:
std::string GetDestination(std::string const& config) const;
protected:
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
private:
diff --git a/Source/cmInstallMode.h b/Source/cmInstallMode.h
index 5343d34..64a90bd 100644
--- a/Source/cmInstallMode.h
+++ b/Source/cmInstallMode.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
/**
diff --git a/Source/cmInstallPackageInfoExportGenerator.cxx b/Source/cmInstallPackageInfoExportGenerator.cxx
index 4ff045b..756ef6a 100644
--- a/Source/cmInstallPackageInfoExportGenerator.cxx
+++ b/Source/cmInstallPackageInfoExportGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallPackageInfoExportGenerator.h"
#include <utility>
diff --git a/Source/cmInstallPackageInfoExportGenerator.h b/Source/cmInstallPackageInfoExportGenerator.h
index c79df84..a5413d9 100644
--- a/Source/cmInstallPackageInfoExportGenerator.h
+++ b/Source/cmInstallPackageInfoExportGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 65b8d89..63f40e2 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallProgramsCommand.h"
#include <cm/memory>
@@ -18,7 +18,7 @@ class cmListFileBacktrace;
static void FinalAction(cmMakefile& makefile, std::string const& dest,
std::vector<std::string> const& args);
-static std::string FindInstallSource(cmMakefile& makefile, const char* name);
+static std::string FindInstallSource(cmMakefile& makefile, char const* name);
bool cmInstallProgramsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -39,7 +39,7 @@ bool cmInstallProgramsCommand(std::vector<std::string> const& args,
std::string const& dest = args[0];
std::vector<std::string> const finalArgs(args.begin() + 1, args.end());
mf.AddGeneratorAction(
- [dest, finalArgs](cmLocalGenerator& lg, const cmListFileBacktrace&) {
+ [dest, finalArgs](cmLocalGenerator& lg, cmListFileBacktrace const&) {
FinalAction(*lg.GetMakefile(), dest, finalArgs);
});
return true;
@@ -89,8 +89,8 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
}
// Use a file install generator.
- const std::string no_permissions;
- const std::string no_rename;
+ std::string const no_permissions;
+ std::string const no_rename;
bool no_exclude_from_all = false;
std::string no_component =
makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
@@ -108,7 +108,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
* present in the build tree. If a full path is given, it is just
* returned.
*/
-static std::string FindInstallSource(cmMakefile& makefile, const char* name)
+static std::string FindInstallSource(cmMakefile& makefile, char const* name)
{
if (cmSystemTools::FileIsFullPath(name) ||
cmGeneratorExpression::Find(name) == 0) {
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index e3c3e81..584ee8e 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmInstallRuntimeDependencySet.cxx b/Source/cmInstallRuntimeDependencySet.cxx
index 0cef49a..c4933a0 100644
--- a/Source/cmInstallRuntimeDependencySet.cxx
+++ b/Source/cmInstallRuntimeDependencySet.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallRuntimeDependencySet.h"
#include <set>
@@ -46,16 +46,16 @@ bool cmInstallRuntimeDependencySet::AddBundleExecutable(
}
std::string cmInstallRuntimeDependencySet::TargetItem::GetItemPath(
- const std::string& config) const
+ std::string const& config) const
{
return this->Target->GetTarget()->GetFullPath(config);
}
namespace {
-const std::set<const cmGeneratorTarget*>& GetTargetDependsClosure(
- std::map<const cmGeneratorTarget*, std::set<const cmGeneratorTarget*>>&
+std::set<cmGeneratorTarget const*> const& GetTargetDependsClosure(
+ std::map<cmGeneratorTarget const*, std::set<cmGeneratorTarget const*>>&
targetDepends,
- const cmGeneratorTarget* tgt)
+ cmGeneratorTarget const* tgt)
{
auto it = targetDepends.insert({ tgt, {} });
auto& retval = it.first->second;
@@ -79,7 +79,7 @@ const std::set<const cmGeneratorTarget*>& GetTargetDependsClosure(
}
void cmInstallRuntimeDependencySet::TargetItem::AddPostExcludeFiles(
- const std::string& config, std::set<std::string>& files,
+ std::string const& config, std::set<std::string>& files,
cmInstallRuntimeDependencySet* set) const
{
for (auto const* dep : GetTargetDependsClosure(set->TargetDepends,
@@ -89,7 +89,7 @@ void cmInstallRuntimeDependencySet::TargetItem::AddPostExcludeFiles(
}
std::string cmInstallRuntimeDependencySet::ImportedTargetItem::GetItemPath(
- const std::string& config) const
+ std::string const& config) const
{
return this->Target->GetTarget()->GetFullPath(config);
}
diff --git a/Source/cmInstallRuntimeDependencySet.h b/Source/cmInstallRuntimeDependencySet.h
index 7f51624..1b20ce1 100644
--- a/Source/cmInstallRuntimeDependencySet.h
+++ b/Source/cmInstallRuntimeDependencySet.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
@@ -20,9 +20,9 @@ class cmInstallRuntimeDependencySet
public:
cmInstallRuntimeDependencySet(std::string name = "");
- cmInstallRuntimeDependencySet(const cmInstallRuntimeDependencySet&) = delete;
+ cmInstallRuntimeDependencySet(cmInstallRuntimeDependencySet const&) = delete;
cmInstallRuntimeDependencySet& operator=(
- const cmInstallRuntimeDependencySet&) = delete;
+ cmInstallRuntimeDependencySet const&) = delete;
cm::string_view GetName() const { return this->Name; }
@@ -39,10 +39,10 @@ public:
public:
virtual ~Item() = default;
- virtual std::string GetItemPath(const std::string& config) const = 0;
+ virtual std::string GetItemPath(std::string const& config) const = 0;
virtual void AddPostExcludeFiles(
- const std::string& /*config*/, std::set<std::string>& /*files*/,
+ std::string const& /*config*/, std::set<std::string>& /*files*/,
cmInstallRuntimeDependencySet* /*set*/) const
{
}
@@ -56,10 +56,10 @@ public:
{
}
- std::string GetItemPath(const std::string& config) const override;
+ std::string GetItemPath(std::string const& config) const override;
void AddPostExcludeFiles(
- const std::string& config, std::set<std::string>& files,
+ std::string const& config, std::set<std::string>& files,
cmInstallRuntimeDependencySet* set) const override;
private:
@@ -74,7 +74,7 @@ public:
{
}
- std::string GetItemPath(const std::string& config) const override;
+ std::string GetItemPath(std::string const& config) const override;
private:
cmInstallImportedRuntimeArtifactsGenerator* Target;
@@ -128,17 +128,17 @@ public:
cm::make_unique<ImportedTargetItem>(bundleExecutable));
}
- const std::vector<std::unique_ptr<Item>>& GetExecutables() const
+ std::vector<std::unique_ptr<Item>> const& GetExecutables() const
{
return this->Executables;
}
- const std::vector<std::unique_ptr<Item>>& GetLibraries() const
+ std::vector<std::unique_ptr<Item>> const& GetLibraries() const
{
return this->Libraries;
}
- const std::vector<std::unique_ptr<Item>>& GetModules() const
+ std::vector<std::unique_ptr<Item>> const& GetModules() const
{
return this->Modules;
}
@@ -158,6 +158,6 @@ private:
std::vector<std::unique_ptr<Item>> Modules;
Item* BundleExecutable = nullptr;
- std::map<const cmGeneratorTarget*, std::set<const cmGeneratorTarget*>>
+ std::map<cmGeneratorTarget const*, std::set<cmGeneratorTarget const*>>
TargetDepends;
};
diff --git a/Source/cmInstallRuntimeDependencySetGenerator.cxx b/Source/cmInstallRuntimeDependencySetGenerator.cxx
index 1e2e663..0f9197a 100644
--- a/Source/cmInstallRuntimeDependencySetGenerator.cxx
+++ b/Source/cmInstallRuntimeDependencySetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallRuntimeDependencySetGenerator.h"
#include <ostream>
@@ -22,8 +22,8 @@
cmInstallRuntimeDependencySetGenerator::cmInstallRuntimeDependencySetGenerator(
DependencyType type, cmInstallRuntimeDependencySet* dependencySet,
std::vector<std::string> installRPaths, bool noInstallRPath,
- std::string installNameDir, bool noInstallName, const char* depsVar,
- const char* rpathPrefix, const char* tmpVarPrefix, std::string destination,
+ std::string installNameDir, bool noInstallName, char const* depsVar,
+ char const* rpathPrefix, char const* tmpVarPrefix, std::string destination,
std::vector<std::string> const& configurations, std::string component,
std::string permissions, MessageLevel message, bool exclude_from_all,
cmListFileBacktrace backtrace)
@@ -51,7 +51,7 @@ bool cmInstallRuntimeDependencySetGenerator::Compute(cmLocalGenerator* lg)
}
void cmInstallRuntimeDependencySetGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
if (!this->LocalGenerator->GetMakefile()
->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL")
@@ -151,8 +151,8 @@ void cmInstallRuntimeDependencySetGenerator::GenerateScriptForConfig(
}
void cmInstallRuntimeDependencySetGenerator::GenerateAppleLibraryScript(
- std::ostream& os, const std::string& config,
- const std::vector<std::string>& evaluatedRPaths, Indent indent)
+ std::ostream& os, std::string const& config,
+ std::vector<std::string> const& evaluatedRPaths, Indent indent)
{
os << indent << "if(NOT " << this->TmpVarPrefix
<< "_dep MATCHES \"\\\\.framework/\")\n";
@@ -174,8 +174,8 @@ void cmInstallRuntimeDependencySetGenerator::GenerateAppleLibraryScript(
}
void cmInstallRuntimeDependencySetGenerator::GenerateAppleFrameworkScript(
- std::ostream& os, const std::string& config,
- const std::vector<std::string>& evaluatedRPaths, Indent indent)
+ std::ostream& os, std::string const& config,
+ std::vector<std::string> const& evaluatedRPaths, Indent indent)
{
os << indent << "if(" << this->TmpVarPrefix
<< "_dep MATCHES \"^(.*/)?([^/]*\\\\.framework)/(.*)$\")\n"
@@ -204,9 +204,9 @@ void cmInstallRuntimeDependencySetGenerator::GenerateAppleFrameworkScript(
}
void cmInstallRuntimeDependencySetGenerator::GenerateInstallNameFixup(
- std::ostream& os, const std::string& config,
- const std::vector<std::string>& evaluatedRPaths, const std::string& filename,
- const std::string& depName, Indent indent)
+ std::ostream& os, std::string const& config,
+ std::vector<std::string> const& evaluatedRPaths, std::string const& filename,
+ std::string const& depName, Indent indent)
{
if (!(this->NoInstallRPath && this->NoInstallName)) {
auto indent2 = indent;
@@ -248,7 +248,7 @@ void cmInstallRuntimeDependencySetGenerator::GenerateInstallNameFixup(
}
void cmInstallRuntimeDependencySetGenerator::GenerateStripFixup(
- std::ostream& os, const std::string& config, const std::string& depName,
+ std::ostream& os, std::string const& config, std::string const& depName,
Indent indent)
{
std::string strip =
diff --git a/Source/cmInstallRuntimeDependencySetGenerator.h b/Source/cmInstallRuntimeDependencySetGenerator.h
index 1a3c1e4..f8a7a4f 100644
--- a/Source/cmInstallRuntimeDependencySetGenerator.h
+++ b/Source/cmInstallRuntimeDependencySetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <iosfwd>
@@ -24,8 +24,8 @@ public:
cmInstallRuntimeDependencySetGenerator(
DependencyType type, cmInstallRuntimeDependencySet* dependencySet,
std::vector<std::string> installRPaths, bool noInstallRPath,
- std::string installNameDir, bool noInstallName, const char* depsVar,
- const char* rpathPrefix, const char* tmpVarPrefix, std::string destination,
+ std::string installNameDir, bool noInstallName, char const* depsVar,
+ char const* rpathPrefix, char const* tmpVarPrefix, std::string destination,
std::vector<std::string> const& configurations, std::string component,
std::string permissions, MessageLevel message, bool exclude_from_all,
cmListFileBacktrace backtrace);
@@ -42,7 +42,7 @@ public:
std::string GetDestination(std::string const& config) const;
protected:
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
private:
@@ -53,21 +53,21 @@ private:
std::string InstallNameDir;
bool NoInstallName;
std::string Permissions;
- const char* DepsVar;
- const char* RPathPrefix;
- const char* TmpVarPrefix;
+ char const* DepsVar;
+ char const* RPathPrefix;
+ char const* TmpVarPrefix;
cmLocalGenerator* LocalGenerator = nullptr;
void GenerateAppleLibraryScript(
- std::ostream& os, const std::string& config,
- const std::vector<std::string>& evaluatedRPaths, Indent indent);
+ std::ostream& os, std::string const& config,
+ std::vector<std::string> const& evaluatedRPaths, Indent indent);
void GenerateAppleFrameworkScript(
- std::ostream& os, const std::string& config,
- const std::vector<std::string>& evaluatedRPaths, Indent indent);
+ std::ostream& os, std::string const& config,
+ std::vector<std::string> const& evaluatedRPaths, Indent indent);
void GenerateInstallNameFixup(
- std::ostream& os, const std::string& config,
- const std::vector<std::string>& evaluatedRPaths,
- const std::string& filename, const std::string& depName, Indent indent);
- void GenerateStripFixup(std::ostream& os, const std::string& config,
- const std::string& depName, Indent indent);
+ std::ostream& os, std::string const& config,
+ std::vector<std::string> const& evaluatedRPaths,
+ std::string const& filename, std::string const& depName, Indent indent);
+ void GenerateStripFixup(std::ostream& os, std::string const& config,
+ std::string const& depName, Indent indent);
};
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index af531f2..7173305 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallScriptGenerator.h"
#include <ostream>
@@ -43,8 +43,6 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
case cmPolicies::OLD:
break;
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
this->AllowGenex = true;
break;
}
@@ -87,7 +85,7 @@ void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os,
}
void cmInstallScriptGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
this->AddScriptInstallRule(os, indent, this->GetScript(config));
}
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index 012a4a3..104d432 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -32,7 +32,7 @@ public:
protected:
void GenerateScriptActions(std::ostream& os, Indent indent) override;
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
void AddScriptInstallRule(std::ostream& os, Indent indent,
std::string const& script) const;
diff --git a/Source/cmInstallScriptHandler.cxx b/Source/cmInstallScriptHandler.cxx
index 9a4e70f..03fada0 100644
--- a/Source/cmInstallScriptHandler.cxx
+++ b/Source/cmInstallScriptHandler.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallScriptHandler.h"
@@ -21,6 +21,7 @@
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
+#include "cmInstrumentation.h"
#include "cmJSONState.h"
#include "cmProcessOutput.h"
#include "cmStringAlgorithms.h"
@@ -33,47 +34,96 @@ using InstallScript = cmInstallScriptHandler::InstallScript;
cmInstallScriptHandler::cmInstallScriptHandler(std::string _binaryDir,
std::string _component,
+ std::string _config,
std::vector<std::string>& args)
: binaryDir(std::move(_binaryDir))
, component(std::move(_component))
{
- const std::string& file =
+ std::string const& file =
cmStrCat(this->binaryDir, "/CMakeFiles/InstallScripts.json");
+ this->parallel = false;
+
+ auto addScript = [this, &args](std::string script,
+ std::string config) -> void {
+ this->commands.push_back(args);
+ if (!config.empty()) {
+ this->commands.back().insert(
+ this->commands.back().end() - 1,
+ cmStrCat("-DCMAKE_INSTALL_CONFIG_NAME=", config));
+ }
+ this->commands.back().emplace_back(script);
+ this->directories.push_back(cmSystemTools::GetFilenamePath(script));
+ };
+
+ int compare = 1;
if (cmSystemTools::FileExists(file)) {
- int compare;
cmSystemTools::FileTimeCompare(
cmStrCat(this->binaryDir, "/CMakeFiles/cmake.check_cache"), file,
&compare);
- if (compare < 1) {
+ }
+ if (compare < 1) {
+ Json::CharReaderBuilder rbuilder;
+ auto JsonReader =
+ std::unique_ptr<Json::CharReader>(rbuilder.newCharReader());
+ std::vector<char> content;
+ Json::Value value;
+ cmJSONState state(file, &value);
+ this->parallel = value["Parallel"].asBool();
+ if (this->parallel) {
args.insert(args.end() - 1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
- Json::CharReaderBuilder rbuilder;
- auto JsonReader =
- std::unique_ptr<Json::CharReader>(rbuilder.newCharReader());
- std::vector<char> content;
- Json::Value value;
- cmJSONState state(file, &value);
- for (auto const& script : value["InstallScripts"]) {
- this->commands.push_back(args);
- this->commands.back().emplace_back(script.asCString());
- this->directories.push_back(
- cmSystemTools::GetFilenamePath(script.asCString()));
+ }
+ if (_config.empty() && value.isMember("Configs")) {
+ for (auto const& config : value["Configs"]) {
+ this->configs.push_back(config.asCString());
}
+ } else {
+ this->configs.push_back(_config);
}
+ for (auto const& script : value["InstallScripts"]) {
+ for (auto const& config : configs) {
+ addScript(script.asCString(), config);
+ }
+ if (!this->parallel) {
+ break;
+ }
+ }
+ } else {
+ addScript(cmStrCat(this->binaryDir, "/cmake_install.cmake"), _config);
}
}
-bool cmInstallScriptHandler::isParallel()
+bool cmInstallScriptHandler::IsParallel()
+{
+ return this->parallel;
+}
+
+std::vector<std::vector<std::string>> cmInstallScriptHandler::GetCommands()
+ const
{
- return !this->commands.empty();
+ return this->commands;
}
-int cmInstallScriptHandler::install(unsigned int j)
+int cmInstallScriptHandler::Install(unsigned int j,
+ cmInstrumentation& instrumentation)
{
cm::uv_loop_ptr loop;
loop.init();
std::vector<InstallScript> scripts;
scripts.reserve(this->commands.size());
- for (auto const& cmd : this->commands) {
+
+ std::vector<std::string> instrument_arg;
+ if (instrumentation.HasQuery()) {
+ instrument_arg = { cmSystemTools::GetCTestCommand(),
+ "--instrument",
+ "--command-type",
+ "install",
+ "--build-dir",
+ this->binaryDir,
+ "--" };
+ }
+
+ for (auto& cmd : this->commands) {
+ cmd.insert(cmd.begin(), instrument_arg.begin(), instrument_arg.end());
scripts.emplace_back(cmd);
}
std::size_t working = 0;
@@ -130,10 +180,10 @@ int cmInstallScriptHandler::install(unsigned int j)
return 0;
}
-InstallScript::InstallScript(const std::vector<std::string>& cmd)
+InstallScript::InstallScript(std::vector<std::string> const& cmd)
{
this->name = cmSystemTools::RelativePath(
- cmSystemTools::GetCurrentWorkingDirectory(), cmd.back());
+ cmSystemTools::GetLogicalWorkingDirectory(), cmd.back());
this->command = cmd;
}
diff --git a/Source/cmInstallScriptHandler.h b/Source/cmInstallScriptHandler.h
index 4143044..4323c6a 100644
--- a/Source/cmInstallScriptHandler.h
+++ b/Source/cmInstallScriptHandler.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cstddef>
@@ -12,17 +12,21 @@
#include "cmUVProcessChain.h"
#include "cmUVStream.h"
+class cmInstrumentation;
+
class cmInstallScriptHandler
{
public:
cmInstallScriptHandler() = default;
- cmInstallScriptHandler(std::string, std::string, std::vector<std::string>&);
- bool isParallel();
- int install(unsigned int j);
+ cmInstallScriptHandler(std::string, std::string, std::string,
+ std::vector<std::string>&);
+ bool IsParallel();
+ int Install(unsigned int j, cmInstrumentation& instrumentation);
+ std::vector<std::vector<std::string>> GetCommands() const;
class InstallScript
{
public:
- InstallScript(const std::vector<std::string>&);
+ InstallScript(std::vector<std::string> const&);
void start(cm::uv_loop_ptr&, std::function<void()>);
void printResult(std::size_t n, std::size_t total);
@@ -38,6 +42,8 @@ public:
private:
std::vector<std::vector<std::string>> commands;
std::vector<std::string> directories;
+ std::vector<std::string> configs;
std::string binaryDir;
std::string component;
+ bool parallel;
};
diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx
index dd71332..34de2f6 100644
--- a/Source/cmInstallSubdirectoryGenerator.cxx
+++ b/Source/cmInstallSubdirectoryGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallSubdirectoryGenerator.h"
#include <memory>
@@ -28,7 +28,7 @@ cmInstallSubdirectoryGenerator::~cmInstallSubdirectoryGenerator() = default;
bool cmInstallSubdirectoryGenerator::HaveInstall()
{
- for (const auto& generator : this->Makefile->GetInstallGenerators()) {
+ for (auto const& generator : this->Makefile->GetInstallGenerators()) {
if (generator->HaveInstall()) {
return true;
}
@@ -63,9 +63,7 @@ void cmInstallSubdirectoryGenerator::GenerateScript(std::ostream& os)
// OLD behavior is handled in cmLocalGenerator::GenerateInstallRules()
break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS: {
+ case cmPolicies::NEW: {
Indent indent;
std::string odir = this->BinaryDirectory;
cmSystemTools::ConvertToUnixSlashes(odir);
diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h
index 7a472ed..4745ff8 100644
--- a/Source/cmInstallSubdirectoryGenerator.h
+++ b/Source/cmInstallSubdirectoryGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 526eed6..bd3b700 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallTargetGenerator.h"
#include <algorithm>
@@ -144,7 +144,7 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
cmInstallTargetGenerator::~cmInstallTargetGenerator() = default;
void cmInstallTargetGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent indent)
+ std::ostream& os, std::string const& config, Indent indent)
{
// Compute the list of files to install for this target.
Files files = this->GetFiles(config);
@@ -166,15 +166,15 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
// Add pre-installation tweaks.
if (!files.NoTweak) {
AddTweak(os, indent, config, toDir, files.To,
- [this](std::ostream& o, Indent i, const std::string& c,
- const std::string& f) {
+ [this](std::ostream& o, Indent i, std::string const& c,
+ std::string const& f) {
this->PreReplacementTweaks(o, i, c, f);
});
}
// Write code to install the target file.
- const char* no_dir_permissions = nullptr;
- const char* no_rename = nullptr;
+ char const* no_dir_permissions = nullptr;
+ char const* no_rename = nullptr;
bool optional = this->Optional || this->ImportLibrary;
std::string literal_args;
if (!files.FromDir.empty()) {
@@ -190,8 +190,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
// Add post-installation tweaks.
if (!files.NoTweak) {
AddTweak(os, indent, config, toDir, files.To,
- [this](std::ostream& o, Indent i, const std::string& c,
- const std::string& f) {
+ [this](std::ostream& o, Indent i, std::string const& c,
+ std::string const& f) {
this->PostReplacementTweaks(o, i, c, f);
});
}
@@ -334,7 +334,7 @@ cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles(
this->ImportlinkMode == NamelinkModeNone);
auto GNUToMS = [this, &config, &files,
- &fromDirConfig](const std::string& lib) {
+ &fromDirConfig](std::string const& lib) {
std::string importLib;
if (this->Target->GetImplibGNUtoMS(config, lib, importLib)) {
files.From.emplace_back(fromDirConfig + importLib);
@@ -437,7 +437,7 @@ std::string cmInstallTargetGenerator::GetDestination(
}
std::string cmInstallTargetGenerator::GetInstallFilename(
- const std::string& config) const
+ std::string const& config) const
{
NameType nameType = this->ImportLibrary ? NameImplib : NameNormal;
return cmInstallTargetGenerator::GetInstallFilename(this->Target, config,
@@ -445,7 +445,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename(
}
std::string cmInstallTargetGenerator::GetInstallFilename(
- cmGeneratorTarget const* target, const std::string& config,
+ cmGeneratorTarget const* target, std::string const& config,
NameType nameType)
{
std::string fname;
@@ -474,7 +474,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename(
} else {
cmGeneratorTarget::Names targetNames = target->GetLibraryNames(config);
if (nameType == NameImplib || nameType == NameImplibReal) {
- const auto& importName = nameType == NameImplib
+ auto const& importName = nameType == NameImplib
? targetNames.ImportLibrary
: targetNames.ImportReal;
// Use the import library name.
@@ -512,7 +512,7 @@ bool cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& file)
{
this->AddRPathCheckRule(os, indent, config, file);
@@ -520,7 +520,7 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& file)
{
this->AddInstallNamePatchRule(os, indent, config, file);
@@ -531,7 +531,7 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
}
void cmInstallTargetGenerator::AddInstallNamePatchRule(
- std::ostream& os, Indent indent, const std::string& config,
+ std::ostream& os, Indent indent, std::string const& config,
std::string const& toDestDirPath)
{
if (this->ImportLibrary || this->NamelinkMode == NamelinkModeOnly ||
@@ -627,7 +627,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
}
void cmInstallTargetGenerator::AddRPathCheckRule(
- std::ostream& os, Indent indent, const std::string& config,
+ std::ostream& os, Indent indent, std::string const& config,
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
@@ -679,7 +679,7 @@ void cmInstallTargetGenerator::AddRPathCheckRule(
}
void cmInstallTargetGenerator::AddChrpathPatchRule(
- std::ostream& os, Indent indent, const std::string& config,
+ std::ostream& os, Indent indent, std::string const& config,
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
@@ -757,7 +757,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
// Remove rpaths that are unchanged (value was set to empty)
ordered.erase(
std::remove_if(ordered.begin(), ordered.end(),
- [&runpath_change](const std::string& runpath) {
+ [&runpath_change](std::string const& runpath) {
return runpath_change.find(runpath)->second.empty();
}),
ordered.end());
@@ -817,7 +817,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
}
void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
- const std::string& toDestDirPath)
+ std::string const& toDestDirPath)
{
// don't strip static and import libraries, because it removes the only
@@ -860,7 +860,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
}
void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent,
- const std::string& toDestDirPath)
+ std::string const& toDestDirPath)
{
// Static libraries need ranlib on this platform.
if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
@@ -873,7 +873,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent,
return;
}
- const std::string& ranlib =
+ std::string const& ranlib =
this->Target->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
if (ranlib.empty()) {
return;
@@ -884,7 +884,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent,
}
void cmInstallTargetGenerator::AddUniversalInstallRule(
- std::ostream& os, Indent indent, const std::string& toDestDirPath)
+ std::ostream& os, Indent indent, std::string const& toDestDirPath)
{
cmMakefile const* mf = this->Target->Target->GetMakefile();
@@ -920,7 +920,7 @@ void cmInstallTargetGenerator::AddUniversalInstallRule(
}
void cmInstallTargetGenerator::IssueCMP0095Warning(
- const std::string& unescapedRpath)
+ std::string const& unescapedRpath)
{
// Reduce warning noise to cases where used RPATHs may actually be affected
// by CMP0095. This filter is meant to skip warnings in cases when
@@ -928,7 +928,7 @@ void cmInstallTargetGenerator::IssueCMP0095Warning(
// worked already before CMP0095. We intend to issue a warning in all cases
// with curly-braces syntax, even if the workaround of double-escaping is in
// place, since we deprecate the need for it with CMP0095.
- const bool potentially_affected(unescapedRpath.find("${") !=
+ bool const potentially_affected(unescapedRpath.find("${") !=
std::string::npos);
if (potentially_affected) {
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 11a3264..da51a81 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,7 +43,7 @@ public:
this->ImportlinkMode = mode;
}
- std::string GetInstallFilename(const std::string& config) const;
+ std::string GetInstallFilename(std::string const& config) const;
void GetInstallObjectNames(std::string const& config,
std::vector<std::string>& objects) const;
@@ -57,8 +57,8 @@ public:
NameImplibReal
};
- static std::string GetInstallFilename(const cmGeneratorTarget* target,
- const std::string& config,
+ static std::string GetInstallFilename(cmGeneratorTarget const* target,
+ std::string const& config,
NameType nameType = NameNormal);
bool Compute(cmLocalGenerator* lg) override;
@@ -95,31 +95,31 @@ public:
bool GetOptional() const { return this->Optional; }
protected:
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
void PreReplacementTweaks(std::ostream& os, Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& file);
void PostReplacementTweaks(std::ostream& os, Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& file);
void AddInstallNamePatchRule(std::ostream& os, Indent indent,
- const std::string& config,
- const std::string& toDestDirPath);
+ std::string const& config,
+ std::string const& toDestDirPath);
void AddChrpathPatchRule(std::ostream& os, Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& toDestDirPath);
void AddRPathCheckRule(std::ostream& os, Indent indent,
- const std::string& config,
+ std::string const& config,
std::string const& toDestDirPath);
void AddStripRule(std::ostream& os, Indent indent,
- const std::string& toDestDirPath);
+ std::string const& toDestDirPath);
void AddRanlibRule(std::ostream& os, Indent indent,
- const std::string& toDestDirPath);
+ std::string const& toDestDirPath);
void AddUniversalInstallRule(std::ostream& os, Indent indent,
- const std::string& toDestDirPath);
- void IssueCMP0095Warning(const std::string& unescapedRpath);
+ std::string const& toDestDirPath);
+ void IssueCMP0095Warning(std::string const& unescapedRpath);
std::string const TargetName;
cmGeneratorTarget* Target = nullptr;
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 44f23a5..66d40b0 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstallTargetsCommand.h"
#include <unordered_map>
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 716e7ce..ec48624 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h
index 33fa7a9..fe7c6de 100644
--- a/Source/cmInstallType.h
+++ b/Source/cmInstallType.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
/**
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 381c91b..b582b83 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmInstalledFile.h"
#include <utility>
@@ -18,7 +18,7 @@ cmInstalledFile::Property::Property() = default;
cmInstalledFile::Property::~Property() = default;
-void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name)
+void cmInstalledFile::SetName(cmMakefile* mf, std::string const& name)
{
cmListFileBacktrace backtrace = mf->GetBacktrace();
cmGeneratorExpression ge(*mf->GetCMakeInstance(), backtrace);
@@ -37,22 +37,22 @@ cmCompiledGeneratorExpression const& cmInstalledFile::GetNameExpression() const
return *(this->NameExpression);
}
-void cmInstalledFile::RemoveProperty(const std::string& prop)
+void cmInstalledFile::RemoveProperty(std::string const& prop)
{
this->Properties.erase(prop);
}
void cmInstalledFile::SetProperty(cmMakefile const* mf,
- const std::string& prop,
- const std::string& value)
+ std::string const& prop,
+ std::string const& value)
{
this->RemoveProperty(prop);
this->AppendProperty(mf, prop, value);
}
void cmInstalledFile::AppendProperty(cmMakefile const* mf,
- const std::string& prop,
- const std::string& value,
+ std::string const& prop,
+ std::string const& value,
bool /*asString*/)
{
cmListFileBacktrace backtrace = mf->GetBacktrace();
@@ -62,12 +62,12 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf,
property.ValueExpressions.push_back(ge.Parse(value));
}
-bool cmInstalledFile::HasProperty(const std::string& prop) const
+bool cmInstalledFile::HasProperty(std::string const& prop) const
{
return this->Properties.find(prop) != this->Properties.end();
}
-bool cmInstalledFile::GetProperty(const std::string& prop,
+bool cmInstalledFile::GetProperty(std::string const& prop,
std::string& value) const
{
auto i = this->Properties.find(prop);
@@ -80,7 +80,7 @@ bool cmInstalledFile::GetProperty(const std::string& prop,
std::string output;
std::string separator;
- for (const auto& ve : property.ValueExpressions) {
+ for (auto const& ve : property.ValueExpressions) {
output += separator;
output += ve->GetInput();
separator = ";";
@@ -90,7 +90,7 @@ bool cmInstalledFile::GetProperty(const std::string& prop,
return true;
}
-bool cmInstalledFile::GetPropertyAsBool(const std::string& prop) const
+bool cmInstalledFile::GetPropertyAsBool(std::string const& prop) const
{
std::string value;
bool isSet = this->GetProperty(prop, value);
@@ -98,7 +98,7 @@ bool cmInstalledFile::GetPropertyAsBool(const std::string& prop) const
}
std::vector<std::string> cmInstalledFile::GetPropertyAsList(
- const std::string& prop) const
+ std::string const& prop) const
{
std::string value;
this->GetProperty(prop, value);
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index e0d7647..b8021c0 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,8 +31,8 @@ public:
Property();
~Property();
- Property(const Property&) = delete;
- Property& operator=(const Property&) = delete;
+ Property(Property const&) = delete;
+ Property& operator=(Property const&) = delete;
ExpressionVectorType ValueExpressions;
};
@@ -43,26 +43,26 @@ public:
~cmInstalledFile();
- cmInstalledFile(const cmInstalledFile&) = delete;
- cmInstalledFile& operator=(const cmInstalledFile&) = delete;
+ cmInstalledFile(cmInstalledFile const&) = delete;
+ cmInstalledFile& operator=(cmInstalledFile const&) = delete;
- void RemoveProperty(const std::string& prop);
+ void RemoveProperty(std::string const& prop);
- void SetProperty(cmMakefile const* mf, const std::string& prop,
- const std::string& value);
+ void SetProperty(cmMakefile const* mf, std::string const& prop,
+ std::string const& value);
- void AppendProperty(cmMakefile const* mf, const std::string& prop,
- const std::string& value, bool asString = false);
+ void AppendProperty(cmMakefile const* mf, std::string const& prop,
+ std::string const& value, bool asString = false);
- bool HasProperty(const std::string& prop) const;
+ bool HasProperty(std::string const& prop) const;
- bool GetProperty(const std::string& prop, std::string& value) const;
+ bool GetProperty(std::string const& prop, std::string& value) const;
- bool GetPropertyAsBool(const std::string& prop) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
- std::vector<std::string> GetPropertyAsList(const std::string& prop) const;
+ std::vector<std::string> GetPropertyAsList(std::string const& prop) const;
- void SetName(cmMakefile* mf, const std::string& name);
+ void SetName(cmMakefile* mf, std::string const& name);
std::string const& GetName() const;
diff --git a/Source/cmInstrumentation.cxx b/Source/cmInstrumentation.cxx
new file mode 100644
index 0000000..aba09d4
--- /dev/null
+++ b/Source/cmInstrumentation.cxx
@@ -0,0 +1,749 @@
+#include "cmInstrumentation.h"
+
+#include <chrono>
+#include <ctime>
+#include <iomanip>
+#include <set>
+#include <sstream>
+#include <utility>
+
+#include <cm/memory>
+#include <cm/optional>
+
+#include <cm3p/json/writer.h>
+#include <cm3p/uv.h>
+
+#include "cmsys/Directory.hxx"
+#include "cmsys/FStream.hxx"
+#include <cmsys/SystemInformation.hxx>
+
+#include "cmCryptoHash.h"
+#include "cmExperimental.h"
+#include "cmInstrumentationQuery.h"
+#include "cmJSONState.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmTimestamp.h"
+#include "cmUVProcessChain.h"
+#include "cmValue.h"
+
+using LoadQueriesAfter = cmInstrumentation::LoadQueriesAfter;
+
+cmInstrumentation::cmInstrumentation(std::string const& binary_dir,
+ LoadQueriesAfter loadQueries)
+{
+ std::string const uuid =
+ cmExperimental::DataForFeature(cmExperimental::Feature::Instrumentation)
+ .Uuid;
+ this->binaryDir = binary_dir;
+ this->timingDirv1 =
+ cmStrCat(this->binaryDir, "/.cmake/instrumentation-", uuid, "/v1");
+ if (cm::optional<std::string> configDir =
+ cmSystemTools::GetCMakeConfigDirectory()) {
+ this->userTimingDirv1 =
+ cmStrCat(configDir.value(), "/instrumentation-", uuid, "/v1");
+ }
+ if (loadQueries == LoadQueriesAfter::Yes) {
+ this->LoadQueries();
+ }
+}
+
+void cmInstrumentation::LoadQueries()
+{
+ if (cmSystemTools::FileExists(cmStrCat(this->timingDirv1, "/query"))) {
+ this->hasQuery =
+ this->ReadJSONQueries(cmStrCat(this->timingDirv1, "/query")) ||
+ this->ReadJSONQueries(cmStrCat(this->timingDirv1, "/query/generated"));
+ }
+ if (!this->userTimingDirv1.empty() &&
+ cmSystemTools::FileExists(cmStrCat(this->userTimingDirv1, "/query"))) {
+ this->hasQuery = this->hasQuery ||
+ this->ReadJSONQueries(cmStrCat(this->userTimingDirv1, "/query"));
+ }
+
+ std::string envVal;
+ if (cmSystemTools::GetEnv("CTEST_USE_INSTRUMENTATION", envVal) &&
+ !cmIsOff(envVal)) {
+ if (cmSystemTools::GetEnv("CTEST_EXPERIMENTAL_INSTRUMENTATION", envVal)) {
+ std::string const uuid = cmExperimental::DataForFeature(
+ cmExperimental::Feature::Instrumentation)
+ .Uuid;
+ if (envVal == uuid) {
+ this->AddHook(cmInstrumentationQuery::Hook::PrepareForCDash);
+ this->AddQuery(
+ cmInstrumentationQuery::Query::DynamicSystemInformation);
+ this->cdashDir = cmStrCat(this->timingDirv1, "/cdash");
+ cmSystemTools::MakeDirectory(this->cdashDir);
+ cmSystemTools::MakeDirectory(cmStrCat(this->cdashDir, "/configure"));
+ cmSystemTools::MakeDirectory(cmStrCat(this->cdashDir, "/build"));
+ cmSystemTools::MakeDirectory(
+ cmStrCat(this->cdashDir, "/build/commands"));
+ cmSystemTools::MakeDirectory(
+ cmStrCat(this->cdashDir, "/build/targets"));
+ cmSystemTools::MakeDirectory(cmStrCat(this->cdashDir, "/test"));
+ this->cdashSnippetsMap = { {
+ "configure",
+ "configure",
+ },
+ {
+ "generate",
+ "configure",
+ },
+ {
+ "compile",
+ "build",
+ },
+ {
+ "link",
+ "build",
+ },
+ {
+ "custom",
+ "build",
+ },
+ {
+ "build",
+ "skip",
+ },
+ {
+ "cmakeBuild",
+ "build",
+ },
+ {
+ "cmakeInstall",
+ "build",
+ },
+ {
+ "install",
+ "build",
+ },
+ {
+ "ctest",
+ "build",
+ },
+ {
+ "test",
+ "test",
+ } };
+ this->hasQuery = true;
+ }
+ }
+ }
+}
+
+cmsys::SystemInformation& cmInstrumentation::GetSystemInformation()
+{
+ if (!this->systemInformation) {
+ this->systemInformation = cm::make_unique<cmsys::SystemInformation>();
+ }
+ return *this->systemInformation;
+}
+
+bool cmInstrumentation::ReadJSONQueries(std::string const& directory)
+{
+ cmsys::Directory d;
+ std::string json = ".json";
+ bool result = false;
+ if (d.Load(directory)) {
+ for (unsigned int i = 0; i < d.GetNumberOfFiles(); i++) {
+ std::string fpath = d.GetFilePath(i);
+ if (fpath.rfind(json) == (fpath.size() - json.size())) {
+ result = true;
+ this->ReadJSONQuery(fpath);
+ }
+ }
+ }
+ return result;
+}
+
+void cmInstrumentation::ReadJSONQuery(std::string const& file)
+{
+ auto query = cmInstrumentationQuery();
+ query.ReadJSON(file, this->errorMsg, this->queries, this->hooks,
+ this->callbacks);
+}
+
+void cmInstrumentation::WriteJSONQuery(
+ std::set<cmInstrumentationQuery::Query> const& queries_,
+ std::set<cmInstrumentationQuery::Hook> const& hooks_,
+ std::vector<std::vector<std::string>> const& callbacks_)
+{
+ Json::Value root;
+ root["version"] = 1;
+ root["queries"] = Json::arrayValue;
+ for (auto const& query : queries_) {
+ root["queries"].append(cmInstrumentationQuery::QueryString[query]);
+ }
+ root["hooks"] = Json::arrayValue;
+ for (auto const& hook : hooks_) {
+ root["hooks"].append(cmInstrumentationQuery::HookString[hook]);
+ }
+ root["callbacks"] = Json::arrayValue;
+ for (auto const& callback : callbacks_) {
+ root["callbacks"].append(cmInstrumentation::GetCommandStr(callback));
+ }
+ cmsys::Directory d;
+ int n = 0;
+ if (d.Load(cmStrCat(this->timingDirv1, "/query/generated"))) {
+ n = (int)d.GetNumberOfFiles() - 2; // Don't count '.' or '..'
+ }
+ this->WriteInstrumentationJson(root, "query/generated",
+ cmStrCat("query-", n, ".json"));
+}
+
+void cmInstrumentation::ClearGeneratedQueries()
+{
+ std::string dir = cmStrCat(this->timingDirv1, "/query/generated");
+ if (cmSystemTools::FileIsDirectory(dir)) {
+ cmSystemTools::RemoveADirectory(dir);
+ }
+}
+
+bool cmInstrumentation::HasQuery() const
+{
+ return this->hasQuery;
+}
+
+bool cmInstrumentation::HasQuery(cmInstrumentationQuery::Query query) const
+{
+ return (this->queries.find(query) != this->queries.end());
+}
+
+bool cmInstrumentation::HasHook(cmInstrumentationQuery::Hook hook) const
+{
+ return (this->hooks.find(hook) != this->hooks.end());
+}
+
+bool cmInstrumentation::HasPreOrPostBuildHook() const
+{
+ return (this->HasHook(cmInstrumentationQuery::Hook::PreBuild) ||
+ this->HasHook(cmInstrumentationQuery::Hook::PostBuild));
+}
+
+int cmInstrumentation::CollectTimingData(cmInstrumentationQuery::Hook hook)
+{
+ // Don't run collection if hook is disabled
+ if (hook != cmInstrumentationQuery::Hook::Manual && !this->HasHook(hook)) {
+ return 0;
+ }
+
+ // Touch index file immediately to claim snippets
+ std::string const& directory = cmStrCat(this->timingDirv1, "/data");
+ std::string const& file_name =
+ cmStrCat("index-", ComputeSuffixTime(), ".json");
+ std::string index_path = cmStrCat(directory, "/", file_name);
+ cmSystemTools::Touch(index_path, true);
+
+ // Gather Snippets
+ using snippet = std::pair<std::string, std::string>;
+ std::vector<snippet> files;
+ cmsys::Directory d;
+ std::string last_index;
+ if (d.Load(directory)) {
+ for (unsigned int i = 0; i < d.GetNumberOfFiles(); i++) {
+ std::string fpath = d.GetFilePath(i);
+ std::string fname = d.GetFile(i);
+ if (fname.rfind('.', 0) == 0) {
+ continue;
+ }
+ if (fname == file_name) {
+ continue;
+ }
+ if (fname.rfind("index-", 0) == 0) {
+ if (last_index.empty()) {
+ last_index = fpath;
+ } else {
+ int compare;
+ cmSystemTools::FileTimeCompare(fpath, last_index, &compare);
+ if (compare == 1) {
+ last_index = fpath;
+ }
+ }
+ }
+ files.push_back(snippet(std::move(fname), std::move(fpath)));
+ }
+ }
+
+ // Build Json Object
+ Json::Value index(Json::objectValue);
+ index["snippets"] = Json::arrayValue;
+ index["hook"] = cmInstrumentationQuery::HookString[hook];
+ index["dataDir"] = directory;
+ index["buildDir"] = this->binaryDir;
+ index["version"] = 1;
+ if (this->HasQuery(cmInstrumentationQuery::Query::StaticSystemInformation)) {
+ this->InsertStaticSystemInformation(index);
+ }
+ for (auto const& file : files) {
+ if (last_index.empty()) {
+ index["snippets"].append(file.first);
+ } else {
+ int compare;
+ cmSystemTools::FileTimeCompare(file.second, last_index, &compare);
+ if (compare == 1) {
+ index["snippets"].append(file.first);
+ }
+ }
+ }
+ this->WriteInstrumentationJson(index, "data", file_name);
+
+ // Execute callbacks
+ for (auto& cb : this->callbacks) {
+ cmSystemTools::RunSingleCommand(cmStrCat(cb, " \"", index_path, "\""),
+ nullptr, nullptr, nullptr, nullptr,
+ cmSystemTools::OUTPUT_PASSTHROUGH);
+ }
+
+ // Special case for CDash collation
+ if (this->HasHook(cmInstrumentationQuery::Hook::PrepareForCDash)) {
+ this->PrepareDataForCDash(directory, index_path);
+ }
+
+ // Delete files
+ for (auto const& f : index["snippets"]) {
+ cmSystemTools::RemoveFile(cmStrCat(directory, "/", f.asString()));
+ }
+ cmSystemTools::RemoveFile(index_path);
+
+ return 0;
+}
+
+void cmInstrumentation::InsertDynamicSystemInformation(
+ Json::Value& root, std::string const& prefix)
+{
+ Json::Value data;
+ double memory;
+ double load;
+ this->GetDynamicSystemInformation(memory, load);
+ if (!root.isMember("dynamicSystemInformation")) {
+ root["dynamicSystemInformation"] = Json::objectValue;
+ }
+ root["dynamicSystemInformation"][cmStrCat(prefix, "HostMemoryUsed")] =
+ memory;
+ root["dynamicSystemInformation"][cmStrCat(prefix, "CPULoadAverage")] = load;
+}
+
+void cmInstrumentation::GetDynamicSystemInformation(double& memory,
+ double& load)
+{
+ cmsys::SystemInformation& info = this->GetSystemInformation();
+ if (!this->ranSystemChecks) {
+ info.RunCPUCheck();
+ info.RunMemoryCheck();
+ this->ranSystemChecks = true;
+ }
+ memory = (double)info.GetHostMemoryUsed();
+ load = info.GetLoadAverage();
+}
+
+void cmInstrumentation::InsertStaticSystemInformation(Json::Value& root)
+{
+ cmsys::SystemInformation& info = this->GetSystemInformation();
+ if (!this->ranOSCheck) {
+ info.RunOSCheck();
+ this->ranOSCheck = true;
+ }
+ Json::Value infoRoot;
+ infoRoot["familyId"] = info.GetFamilyID();
+ infoRoot["hostname"] = info.GetHostname();
+ infoRoot["is64Bits"] = info.Is64Bits();
+ infoRoot["modelId"] = info.GetModelID();
+ infoRoot["numberOfLogicalCPU"] = info.GetNumberOfLogicalCPU();
+ infoRoot["numberOfPhysicalCPU"] = info.GetNumberOfPhysicalCPU();
+ infoRoot["OSName"] = info.GetOSName();
+ infoRoot["OSPlatform"] = info.GetOSPlatform();
+ infoRoot["OSRelease"] = info.GetOSRelease();
+ infoRoot["OSVersion"] = info.GetOSVersion();
+ infoRoot["processorAPICID"] = info.GetProcessorAPICID();
+ infoRoot["processorCacheSize"] = info.GetProcessorCacheSize();
+ infoRoot["processorClockFrequency"] =
+ (double)info.GetProcessorClockFrequency();
+ infoRoot["processorName"] = info.GetExtendedProcessorName();
+ infoRoot["totalPhysicalMemory"] =
+ static_cast<Json::Value::UInt64>(info.GetTotalPhysicalMemory());
+ infoRoot["totalVirtualMemory"] =
+ static_cast<Json::Value::UInt64>(info.GetTotalVirtualMemory());
+ infoRoot["vendorID"] = info.GetVendorID();
+ infoRoot["vendorString"] = info.GetVendorString();
+ root["staticSystemInformation"] = infoRoot;
+}
+
+void cmInstrumentation::InsertTimingData(
+ Json::Value& root, std::chrono::steady_clock::time_point steadyStart,
+ std::chrono::system_clock::time_point systemStart)
+{
+ uint64_t timeStart = std::chrono::duration_cast<std::chrono::milliseconds>(
+ systemStart.time_since_epoch())
+ .count();
+ uint64_t duration = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - steadyStart)
+ .count();
+ root["timeStart"] = static_cast<Json::Value::UInt64>(timeStart);
+ root["duration"] = static_cast<Json::Value::UInt64>(duration);
+}
+
+void cmInstrumentation::WriteInstrumentationJson(Json::Value& root,
+ std::string const& subdir,
+ std::string const& file_name)
+{
+ Json::StreamWriterBuilder wbuilder;
+ wbuilder["indentation"] = "\t";
+ std::unique_ptr<Json::StreamWriter> JsonWriter =
+ std::unique_ptr<Json::StreamWriter>(wbuilder.newStreamWriter());
+ std::string const& directory = cmStrCat(this->timingDirv1, "/", subdir);
+ cmSystemTools::MakeDirectory(directory);
+ cmsys::ofstream ftmp(cmStrCat(directory, "/", file_name).c_str());
+ JsonWriter->write(root, &ftmp);
+ ftmp << "\n";
+ ftmp.close();
+}
+
+std::string cmInstrumentation::InstrumentTest(
+ std::string const& name, std::string const& command,
+ std::vector<std::string> const& args, int64_t result,
+ std::chrono::steady_clock::time_point steadyStart,
+ std::chrono::system_clock::time_point systemStart, std::string config)
+{
+ // Store command info
+ Json::Value root(this->preTestStats);
+ std::string command_str = cmStrCat(command, ' ', GetCommandStr(args));
+ root["version"] = 1;
+ root["command"] = command_str;
+ root["role"] = "test";
+ root["testName"] = name;
+ root["result"] = static_cast<Json::Value::Int64>(result);
+ root["config"] = config;
+ root["workingDir"] = cmSystemTools::GetLogicalWorkingDirectory();
+
+ // Post-Command
+ this->InsertTimingData(root, steadyStart, systemStart);
+ if (this->HasQuery(
+ cmInstrumentationQuery::Query::DynamicSystemInformation)) {
+ this->InsertDynamicSystemInformation(root, "after");
+ }
+
+ cmsys::SystemInformation& info = this->GetSystemInformation();
+ std::string file_name = cmStrCat(
+ "test-",
+ this->ComputeSuffixHash(cmStrCat(command_str, info.GetProcessId())),
+ this->ComputeSuffixTime(), ".json");
+ this->WriteInstrumentationJson(root, "data", file_name);
+ return file_name;
+}
+
+void cmInstrumentation::GetPreTestStats()
+{
+ if (this->HasQuery(
+ cmInstrumentationQuery::Query::DynamicSystemInformation)) {
+ this->InsertDynamicSystemInformation(this->preTestStats, "before");
+ }
+}
+
+int cmInstrumentation::InstrumentCommand(
+ std::string command_type, std::vector<std::string> const& command,
+ std::function<int()> const& callback,
+ cm::optional<std::map<std::string, std::string>> options,
+ cm::optional<std::map<std::string, std::string>> arrayOptions,
+ LoadQueriesAfter reloadQueriesAfterCommand)
+{
+
+ // Always begin gathering data for configure in case cmake_instrumentation
+ // command creates a query
+ if (!this->hasQuery && reloadQueriesAfterCommand == LoadQueriesAfter::No) {
+ return callback();
+ }
+
+ // Store command info
+ Json::Value root(Json::objectValue);
+ Json::Value commandInfo(Json::objectValue);
+ std::string command_str = GetCommandStr(command);
+
+ if (!command_str.empty()) {
+ root["command"] = command_str;
+ }
+ root["version"] = 1;
+
+ // Pre-Command
+ auto steady_start = std::chrono::steady_clock::now();
+ auto system_start = std::chrono::system_clock::now();
+ double preConfigureMemory = 0;
+ double preConfigureLoad = 0;
+ if (this->HasQuery(
+ cmInstrumentationQuery::Query::DynamicSystemInformation)) {
+ this->InsertDynamicSystemInformation(root, "before");
+ } else if (reloadQueriesAfterCommand == LoadQueriesAfter::Yes) {
+ this->GetDynamicSystemInformation(preConfigureMemory, preConfigureLoad);
+ }
+
+ // Execute Command
+ int ret = callback();
+ root["result"] = ret;
+
+ // Exit early if configure didn't generate a query
+ if (reloadQueriesAfterCommand == LoadQueriesAfter::Yes) {
+ this->LoadQueries();
+ if (!this->HasQuery()) {
+ return ret;
+ }
+ if (this->HasQuery(
+ cmInstrumentationQuery::Query::DynamicSystemInformation)) {
+ root["dynamicSystemInformation"] = Json::objectValue;
+ root["dynamicSystemInformation"]["beforeHostMemoryUsed"] =
+ preConfigureMemory;
+ root["dynamicSystemInformation"]["beforeCPULoadAverage"] =
+ preConfigureLoad;
+ }
+ }
+
+ // Post-Command
+ this->InsertTimingData(root, steady_start, system_start);
+ if (this->HasQuery(
+ cmInstrumentationQuery::Query::DynamicSystemInformation)) {
+ this->InsertDynamicSystemInformation(root, "after");
+ }
+
+ // Gather additional data
+ if (options.has_value()) {
+ for (auto const& item : options.value()) {
+ if (item.first == "role" && !item.second.empty()) {
+ command_type = item.second;
+ } else if (!item.second.empty()) {
+ root[item.first] = item.second;
+ }
+ }
+ }
+
+ // Create empty config entry if config not found
+ if (!root.isMember("config") &&
+ (command_type == "compile" || command_type == "link")) {
+ root["config"] = "";
+ }
+
+ if (arrayOptions.has_value()) {
+ for (auto const& item : arrayOptions.value()) {
+ if (item.first == "targetLabels" && command_type != "link") {
+ continue;
+ }
+ root[item.first] = Json::arrayValue;
+ std::stringstream ss(item.second);
+ std::string element;
+ while (getline(ss, element, ',')) {
+ root[item.first].append(element);
+ }
+ if (item.first == "outputs") {
+ root["outputSizes"] = Json::arrayValue;
+ for (auto const& output : root["outputs"]) {
+ root["outputSizes"].append(
+ static_cast<Json::Value::UInt64>(cmSystemTools::FileLength(
+ cmStrCat(this->binaryDir, "/", output.asCString()))));
+ }
+ }
+ }
+ }
+ root["role"] = command_type;
+ root["workingDir"] = cmSystemTools::GetLogicalWorkingDirectory();
+
+ // Write Json
+ cmsys::SystemInformation& info = this->GetSystemInformation();
+ std::string const& file_name = cmStrCat(
+ command_type, "-",
+ this->ComputeSuffixHash(cmStrCat(command_str, info.GetProcessId())),
+ this->ComputeSuffixTime(), ".json");
+ this->WriteInstrumentationJson(root, "data", file_name);
+ return ret;
+}
+
+std::string cmInstrumentation::GetCommandStr(
+ std::vector<std::string> const& args)
+{
+ std::string command_str;
+ for (size_t i = 0; i < args.size(); ++i) {
+ command_str = cmStrCat(command_str, '"', args[i], '"');
+ if (i < args.size() - 1) {
+ command_str = cmStrCat(command_str, ' ');
+ }
+ }
+ return command_str;
+}
+
+std::string cmInstrumentation::ComputeSuffixHash(
+ std::string const& command_str)
+{
+ cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_256);
+ std::string hash = hasher.HashString(command_str);
+ hash.resize(20, '0');
+ return hash;
+}
+
+std::string cmInstrumentation::ComputeSuffixTime()
+{
+ std::chrono::milliseconds ms =
+ std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch());
+ std::chrono::seconds s =
+ std::chrono::duration_cast<std::chrono::seconds>(ms);
+
+ std::time_t ts = s.count();
+ std::size_t tms = ms.count() % 1000;
+
+ cmTimestamp cmts;
+ std::ostringstream ss;
+ ss << cmts.CreateTimestampFromTimeT(ts, "%Y-%m-%dT%H-%M-%S", true) << '-'
+ << std::setfill('0') << std::setw(4) << tms;
+ return ss.str();
+}
+
+/*
+ * Called by ctest --start-instrumentation as part of the START_INSTRUMENTATION
+ * rule when using the Ninja generator.
+ * This creates a detached process which waits for the Ninja process to die
+ * before running the postBuild hook. In this way, the postBuild hook triggers
+ * after every ninja invocation, regardless of whether the build passed or
+ * failed.
+ */
+int cmInstrumentation::SpawnBuildDaemon()
+{
+ // preBuild Hook
+ this->CollectTimingData(cmInstrumentationQuery::Hook::PreBuild);
+
+ // postBuild Hook
+ if (this->HasHook(cmInstrumentationQuery::Hook::PostBuild)) {
+ auto ninja_pid = uv_os_getppid();
+ if (ninja_pid) {
+ std::vector<std::string> args;
+ args.push_back(cmSystemTools::GetCTestCommand());
+ args.push_back("--wait-and-collect-instrumentation");
+ args.push_back(this->binaryDir);
+ args.push_back(std::to_string(ninja_pid));
+ auto builder = cmUVProcessChainBuilder().SetDetached().AddCommand(args);
+ auto chain = builder.Start();
+ uv_run(&chain.GetLoop(), UV_RUN_DEFAULT);
+ }
+ }
+ return 0;
+}
+
+/*
+ * Always called by ctest --wait-and-collect-instrumentation in a detached
+ * process. Waits for the given PID to end before running the postBuild hook.
+ *
+ * See SpawnBuildDaemon()
+ */
+int cmInstrumentation::CollectTimingAfterBuild(int ppid)
+{
+ std::function<int()> waitForBuild = [ppid]() -> int {
+ while (0 == uv_kill(ppid, 0)) {
+ cmSystemTools::Delay(100);
+ };
+ return 0;
+ };
+ int ret = this->InstrumentCommand(
+ "build", {}, [waitForBuild]() { return waitForBuild(); }, cm::nullopt,
+ cm::nullopt, LoadQueriesAfter::No);
+ this->CollectTimingData(cmInstrumentationQuery::Hook::PostBuild);
+ return ret;
+}
+
+void cmInstrumentation::AddHook(cmInstrumentationQuery::Hook hook)
+{
+ this->hooks.insert(hook);
+}
+
+void cmInstrumentation::AddQuery(cmInstrumentationQuery::Query query)
+{
+ this->queries.insert(query);
+}
+
+std::string const& cmInstrumentation::GetCDashDir()
+{
+ return this->cdashDir;
+}
+
+/** Copy the snippets referred to by an index file to a separate
+ * directory where they will be parsed for submission to CDash.
+ **/
+void cmInstrumentation::PrepareDataForCDash(std::string const& data_dir,
+ std::string const& index_path)
+{
+ Json::Value root;
+ std::string error_msg;
+ cmJSONState parseState = cmJSONState(index_path, &root);
+ if (!parseState.errors.empty()) {
+ cmSystemTools::Error(parseState.GetErrorMessage(true));
+ return;
+ }
+
+ if (!root.isObject()) {
+ error_msg =
+ cmStrCat("Expected index file ", index_path, " to contain an object");
+ cmSystemTools::Error(error_msg);
+ return;
+ }
+
+ if (!root.isMember("snippets")) {
+ error_msg = cmStrCat("Expected index file ", index_path,
+ " to have a key 'snippets'");
+ cmSystemTools::Error(error_msg);
+ return;
+ }
+
+ std::string dst_dir;
+ Json::Value snippets = root["snippets"];
+ for (auto const& snippet : snippets) {
+ // Parse the role of this snippet.
+ std::string snippet_str = snippet.asString();
+ std::string snippet_path = cmStrCat(data_dir, '/', snippet_str);
+ Json::Value snippet_root;
+ parseState = cmJSONState(snippet_path, &snippet_root);
+ if (!parseState.errors.empty()) {
+ cmSystemTools::Error(parseState.GetErrorMessage(true));
+ continue;
+ }
+ if (!snippet_root.isObject()) {
+ error_msg = cmStrCat("Expected snippet file ", snippet_path,
+ " to contain an object");
+ cmSystemTools::Error(error_msg);
+ continue;
+ }
+ if (!snippet_root.isMember("role")) {
+ error_msg = cmStrCat("Expected snippet file ", snippet_path,
+ " to have a key 'role'");
+ cmSystemTools::Error(error_msg);
+ continue;
+ }
+
+ std::string snippet_role = snippet_root["role"].asString();
+ auto map_element = this->cdashSnippetsMap.find(snippet_role);
+ if (map_element == this->cdashSnippetsMap.end()) {
+ std::string message =
+ "Unexpected snippet type encountered: " + snippet_role;
+ cmSystemTools::Message(message, "Warning");
+ continue;
+ }
+
+ if (map_element->second == "skip") {
+ continue;
+ }
+
+ if (map_element->second == "build") {
+ // We organize snippets on a per-target basis (when possible)
+ // for Build.xml.
+ if (snippet_root.isMember("target")) {
+ dst_dir = cmStrCat(this->cdashDir, "/build/targets/",
+ snippet_root["target"].asString());
+ cmSystemTools::MakeDirectory(dst_dir);
+ } else {
+ dst_dir = cmStrCat(this->cdashDir, "/build/commands");
+ }
+ } else {
+ dst_dir = cmStrCat(this->cdashDir, '/', map_element->second);
+ }
+
+ std::string dst = cmStrCat(dst_dir, '/', snippet_str);
+ cmsys::Status copied = cmSystemTools::CopyFileAlways(snippet_path, dst);
+ if (!copied) {
+ error_msg = cmStrCat("Failed to copy ", snippet_path, " to ", dst);
+ cmSystemTools::Error(error_msg);
+ }
+ }
+}
diff --git a/Source/cmInstrumentation.h b/Source/cmInstrumentation.h
new file mode 100644
index 0000000..602ce06
--- /dev/null
+++ b/Source/cmInstrumentation.h
@@ -0,0 +1,103 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <chrono>
+#include <functional>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include <cm/memory>
+#include <cm/optional>
+
+#include <cm3p/json/value.h>
+#ifndef CMAKE_BOOTSTRAP
+# include <cmsys/SystemInformation.hxx>
+#endif
+#include <stdint.h>
+
+#include "cmInstrumentationQuery.h"
+
+class cmInstrumentation
+{
+public:
+ enum class LoadQueriesAfter
+ {
+ Yes,
+ No
+ };
+ cmInstrumentation(std::string const& binary_dir,
+ LoadQueriesAfter loadQueries = LoadQueriesAfter::Yes);
+ void LoadQueries();
+ int InstrumentCommand(
+ std::string command_type, std::vector<std::string> const& command,
+ std::function<int()> const& callback,
+ cm::optional<std::map<std::string, std::string>> options = cm::nullopt,
+ cm::optional<std::map<std::string, std::string>> arrayOptions =
+ cm::nullopt,
+ LoadQueriesAfter reloadQueriesAfterCommand = LoadQueriesAfter::No);
+ std::string InstrumentTest(std::string const& name,
+ std::string const& command,
+ std::vector<std::string> const& args,
+ int64_t result,
+ std::chrono::steady_clock::time_point steadyStart,
+ std::chrono::system_clock::time_point systemStart,
+ std::string config);
+ void GetPreTestStats();
+ bool HasQuery() const;
+ bool HasQuery(cmInstrumentationQuery::Query) const;
+ bool HasHook(cmInstrumentationQuery::Hook) const;
+ bool HasPreOrPostBuildHook() const;
+ bool ReadJSONQueries(std::string const& directory);
+ void ReadJSONQuery(std::string const& file);
+ void WriteJSONQuery(std::set<cmInstrumentationQuery::Query> const& queries,
+ std::set<cmInstrumentationQuery::Hook> const& hooks,
+ std::vector<std::vector<std::string>> const& callback);
+ void ClearGeneratedQueries();
+ int CollectTimingData(cmInstrumentationQuery::Hook hook);
+ int SpawnBuildDaemon();
+ int CollectTimingAfterBuild(int ppid);
+ void AddHook(cmInstrumentationQuery::Hook hook);
+ void AddQuery(cmInstrumentationQuery::Query query);
+ std::string errorMsg;
+ std::string const& GetCDashDir();
+
+private:
+ void WriteInstrumentationJson(Json::Value& index,
+ std::string const& directory,
+ std::string const& file_name);
+ void InsertStaticSystemInformation(Json::Value& index);
+ void GetDynamicSystemInformation(double& memory, double& load);
+ void InsertDynamicSystemInformation(Json::Value& index,
+ std::string const& instant);
+ void InsertTimingData(Json::Value& root,
+ std::chrono::steady_clock::time_point steadyStart,
+ std::chrono::system_clock::time_point systemStart);
+ bool HasQueryFile(std::string const& file);
+ static std::string GetCommandStr(std::vector<std::string> const& args);
+ static std::string ComputeSuffixHash(std::string const& command_str);
+ static std::string ComputeSuffixTime();
+ void PrepareDataForCDash(std::string const& data_dir,
+ std::string const& index_path);
+ std::string binaryDir;
+ std::string timingDirv1;
+ std::string userTimingDirv1;
+ std::string cdashDir;
+ std::set<cmInstrumentationQuery::Query> queries;
+ std::set<cmInstrumentationQuery::Hook> hooks;
+ std::vector<std::string> callbacks;
+ std::vector<std::string> queryFiles;
+ std::map<std::string, std::string> cdashSnippetsMap;
+ Json::Value preTestStats;
+ bool hasQuery = false;
+ bool ranSystemChecks = false;
+ bool ranOSCheck = false;
+#ifndef CMAKE_BOOTSTRAP
+ std::unique_ptr<cmsys::SystemInformation> systemInformation;
+ cmsys::SystemInformation& GetSystemInformation();
+#endif
+};
diff --git a/Source/cmInstrumentationCommand.cxx b/Source/cmInstrumentationCommand.cxx
new file mode 100644
index 0000000..d638f30
--- /dev/null
+++ b/Source/cmInstrumentationCommand.cxx
@@ -0,0 +1,146 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+file LICENSE.rst or https://cmake.org/licensing for details. */
+#include "cmInstrumentationCommand.h"
+
+#include <algorithm>
+#include <cctype>
+#include <cstdlib>
+#include <functional>
+#include <set>
+
+#include <cmext/string_view>
+
+#include "cmArgumentParser.h"
+#include "cmArgumentParserTypes.h"
+#include "cmExecutionStatus.h"
+#include "cmExperimental.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
+#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
+#include "cmake.h"
+
+namespace {
+
+bool isCharDigit(char ch)
+{
+ return std::isdigit(static_cast<unsigned char>(ch));
+}
+bool validateVersion(std::string const& key, std::string const& versionString,
+ int& version, cmExecutionStatus& status)
+{
+ if (!std::all_of(versionString.begin(), versionString.end(), isCharDigit)) {
+ status.SetError(cmStrCat("given a non-integer ", key, "."));
+ return false;
+ }
+ version = std::atoi(versionString.c_str());
+ if (version != 1) {
+ status.SetError(cmStrCat(
+ "QUERY subcommand given an unsupported ", key, " \"", versionString,
+ "\" (the only currently supported version is 1)."));
+ return false;
+ }
+ return true;
+}
+
+template <typename E>
+std::function<bool(std::string const&, E&)> EnumParser(
+ std::vector<std::string> const toString)
+{
+ return [toString](std::string const& value, E& out) -> bool {
+ for (size_t i = 0; i < toString.size(); ++i) {
+ if (value == toString[i]) {
+ out = (E)i;
+ return true;
+ }
+ }
+ return false;
+ };
+}
+}
+
+bool cmInstrumentationCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ // if (status->GetMakefile().GetPropertyKeys) {
+ if (!cmExperimental::HasSupportEnabled(
+ status.GetMakefile(), cmExperimental::Feature::Instrumentation)) {
+ status.SetError(
+ "requires the experimental Instrumentation flag to be enabled");
+ return false;
+ }
+
+ if (args.empty()) {
+ status.SetError("must be called with arguments.");
+ return false;
+ }
+
+ struct Arguments : public ArgumentParser::ParseResult
+ {
+ ArgumentParser::NonEmpty<std::string> ApiVersion;
+ ArgumentParser::NonEmpty<std::string> DataVersion;
+ ArgumentParser::NonEmpty<std::vector<std::string>> Queries;
+ ArgumentParser::NonEmpty<std::vector<std::string>> Hooks;
+ ArgumentParser::NonEmpty<std::vector<std::vector<std::string>>> Callbacks;
+ };
+
+ static auto const parser = cmArgumentParser<Arguments>{}
+ .Bind("API_VERSION"_s, &Arguments::ApiVersion)
+ .Bind("DATA_VERSION"_s, &Arguments::DataVersion)
+ .Bind("QUERIES"_s, &Arguments::Queries)
+ .Bind("HOOKS"_s, &Arguments::Hooks)
+ .Bind("CALLBACK"_s, &Arguments::Callbacks);
+
+ std::vector<std::string> unparsedArguments;
+ Arguments const arguments = parser.Parse(args, &unparsedArguments);
+
+ if (arguments.MaybeReportError(status.GetMakefile())) {
+ return true;
+ }
+ if (!unparsedArguments.empty()) {
+ status.SetError("given unknown argument \"" + unparsedArguments.front() +
+ "\".");
+ return false;
+ }
+ int apiVersion;
+ int dataVersion;
+ if (!validateVersion("API_VERSION", arguments.ApiVersion, apiVersion,
+ status) ||
+ !validateVersion("DATA_VERSION", arguments.DataVersion, dataVersion,
+ status)) {
+ return false;
+ }
+
+ std::set<cmInstrumentationQuery::Query> queries;
+ auto queryParser = EnumParser<cmInstrumentationQuery::Query>(
+ cmInstrumentationQuery::QueryString);
+ for (auto const& arg : arguments.Queries) {
+ cmInstrumentationQuery::Query query;
+ if (!queryParser(arg, query)) {
+ status.SetError(
+ cmStrCat("given invalid argument to QUERIES \"", arg, "\""));
+ return false;
+ }
+ queries.insert(query);
+ }
+
+ std::set<cmInstrumentationQuery::Hook> hooks;
+ auto hookParser = EnumParser<cmInstrumentationQuery::Hook>(
+ cmInstrumentationQuery::HookString);
+ for (auto const& arg : arguments.Hooks) {
+ cmInstrumentationQuery::Hook hook;
+ if (!hookParser(arg, hook)) {
+ status.SetError(
+ cmStrCat("given invalid argument to HOOKS \"", arg, "\""));
+ return false;
+ }
+ hooks.insert(hook);
+ }
+
+ status.GetMakefile()
+ .GetCMakeInstance()
+ ->GetInstrumentation()
+ ->WriteJSONQuery(queries, hooks, arguments.Callbacks);
+
+ return true;
+}
diff --git a/Source/cmInstrumentationCommand.h b/Source/cmInstrumentationCommand.h
new file mode 100644
index 0000000..ffd4d63
--- /dev/null
+++ b/Source/cmInstrumentationCommand.h
@@ -0,0 +1,13 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+class cmExecutionStatus;
+
+bool cmInstrumentationCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
diff --git a/Source/cmInstrumentationQuery.cxx b/Source/cmInstrumentationQuery.cxx
new file mode 100644
index 0000000..88872f6
--- /dev/null
+++ b/Source/cmInstrumentationQuery.cxx
@@ -0,0 +1,115 @@
+#include "cmInstrumentationQuery.h"
+
+#include <algorithm>
+#include <ctime>
+#include <functional>
+#include <iostream>
+#include <iterator>
+#include <set>
+#include <vector>
+
+#include <cmext/string_view>
+
+#include <cm3p/json/value.h>
+
+#include "cmJSONHelpers.h"
+#include "cmStringAlgorithms.h"
+
+std::vector<std::string> const cmInstrumentationQuery::QueryString{
+ "staticSystemInformation", "dynamicSystemInformation"
+};
+std::vector<std::string> const cmInstrumentationQuery::HookString{
+ "postGenerate", "preBuild", "postBuild",
+ "preCMakeBuild", "postCMakeBuild", "postTest",
+ "postInstall", "prepareForCDash", "manual"
+};
+
+namespace ErrorMessages {
+using ErrorGenerator =
+ std::function<void(Json::Value const*, cmJSONState* state)>;
+ErrorGenerator ErrorGeneratorBuilder(std::string const& errorMessage)
+{
+ return [errorMessage](Json::Value const* value, cmJSONState* state) -> void {
+ state->AddErrorAtValue(errorMessage, value);
+ };
+};
+
+static ErrorGenerator InvalidArray = ErrorGeneratorBuilder("Invalid Array");
+JsonErrors::ErrorGenerator InvalidRootQueryObject(
+ JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields)
+{
+ return JsonErrors::INVALID_NAMED_OBJECT(
+ [](Json::Value const*, cmJSONState*) -> std::string {
+ return "root object";
+ })(errorType, extraFields);
+}
+};
+
+using JSONHelperBuilder = cmJSONHelperBuilder;
+
+template <typename E>
+static std::function<bool(E&, Json::Value const*, cmJSONState*)> EnumHelper(
+ std::vector<std::string> const toString, std::string const& type)
+{
+ return [toString, type](E& out, Json::Value const* value,
+ cmJSONState* state) -> bool {
+ for (size_t i = 0; i < toString.size(); ++i) {
+ if (value->asString() == toString[i]) {
+ out = (E)i;
+ return true;
+ }
+ }
+ state->AddErrorAtValue(
+ cmStrCat("Not a valid ", type, ": \"", value->asString(), "\""), value);
+ return false;
+ };
+}
+static auto const QueryHelper = EnumHelper<cmInstrumentationQuery::Query>(
+ cmInstrumentationQuery::QueryString, "query");
+static auto const QueryListHelper =
+ JSONHelperBuilder::Vector<cmInstrumentationQuery::Query>(
+ ErrorMessages::InvalidArray, QueryHelper);
+static auto const HookHelper = EnumHelper<cmInstrumentationQuery::Hook>(
+ cmInstrumentationQuery::HookString, "hook");
+static auto const HookListHelper =
+ JSONHelperBuilder::Vector<cmInstrumentationQuery::Hook>(
+ ErrorMessages::InvalidArray, HookHelper);
+static auto const CallbackHelper = JSONHelperBuilder::String();
+static auto const CallbackListHelper = JSONHelperBuilder::Vector<std::string>(
+ ErrorMessages::InvalidArray, CallbackHelper);
+static auto const VersionHelper = JSONHelperBuilder::Int();
+
+using QueryRoot = cmInstrumentationQuery::QueryJSONRoot;
+
+static auto const QueryRootHelper =
+ JSONHelperBuilder::Object<QueryRoot>(ErrorMessages::InvalidRootQueryObject,
+ false)
+ .Bind("version"_s, &QueryRoot::version, VersionHelper, true)
+ .Bind("queries"_s, &QueryRoot::queries, QueryListHelper, false)
+ .Bind("hooks"_s, &QueryRoot::hooks, HookListHelper, false)
+ .Bind("callbacks"_s, &QueryRoot::callbacks, CallbackListHelper, false);
+
+bool cmInstrumentationQuery::ReadJSON(std::string const& filename,
+ std::string& errorMessage,
+ std::set<Query>& queries,
+ std::set<Hook>& hooks,
+ std::vector<std::string>& callbacks)
+{
+ Json::Value root;
+ this->parseState = cmJSONState(filename, &root);
+ if (!this->parseState.errors.empty()) {
+ std::cerr << this->parseState.GetErrorMessage(true) << std::endl;
+ return false;
+ }
+ if (!QueryRootHelper(this->queryRoot, &root, &this->parseState)) {
+ errorMessage = this->parseState.GetErrorMessage(true);
+ return false;
+ }
+ std::move(this->queryRoot.queries.begin(), this->queryRoot.queries.end(),
+ std::inserter(queries, queries.end()));
+ std::move(this->queryRoot.hooks.begin(), this->queryRoot.hooks.end(),
+ std::inserter(hooks, hooks.end()));
+ std::move(this->queryRoot.callbacks.begin(), this->queryRoot.callbacks.end(),
+ std::back_inserter(callbacks));
+ return true;
+}
diff --git a/Source/cmInstrumentationQuery.h b/Source/cmInstrumentationQuery.h
new file mode 100644
index 0000000..3d5fdac
--- /dev/null
+++ b/Source/cmInstrumentationQuery.h
@@ -0,0 +1,50 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "cmJSONState.h"
+
+class cmInstrumentationQuery
+{
+
+public:
+ enum Query
+ {
+ StaticSystemInformation,
+ DynamicSystemInformation
+ };
+ static std::vector<std::string> const QueryString;
+
+ enum Hook
+ {
+ PostGenerate,
+ PreBuild,
+ PostBuild,
+ PreCMakeBuild,
+ PostCMakeBuild,
+ PostTest,
+ PostInstall,
+ PrepareForCDash,
+ Manual
+ };
+ static std::vector<std::string> const HookString;
+
+ struct QueryJSONRoot
+ {
+ std::vector<cmInstrumentationQuery::Query> queries;
+ std::vector<cmInstrumentationQuery::Hook> hooks;
+ std::vector<std::string> callbacks;
+ int version;
+ };
+
+ cmInstrumentationQuery() = default;
+ bool ReadJSON(std::string const& file, std::string& errorMessage,
+ std::set<Query>& queries, std::set<Hook>& hooks,
+ std::vector<std::string>& callbacks);
+ QueryJSONRoot queryRoot;
+ cmJSONState parseState;
+};
diff --git a/Source/cmJSONHelpers.cxx b/Source/cmJSONHelpers.cxx
index c36b56d..a79e3ab 100644
--- a/Source/cmJSONHelpers.cxx
+++ b/Source/cmJSONHelpers.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmJSONHelpers.h"
@@ -13,9 +13,9 @@
#include "cmJSONState.h"
namespace JsonErrors {
-ErrorGenerator EXPECTED_TYPE(const std::string& type)
+ErrorGenerator EXPECTED_TYPE(std::string const& type)
{
- return [type](const Json::Value* value, cmJSONState* state) -> void {
+ return [type](Json::Value const* value, cmJSONState* state) -> void {
if (state->key().empty()) {
state->AddErrorAtValue(cmStrCat("Expected ", type), value);
return;
@@ -28,35 +28,35 @@ ErrorGenerator EXPECTED_TYPE(const std::string& type)
};
}
-void INVALID_STRING(const Json::Value* value, cmJSONState* state)
+void INVALID_STRING(Json::Value const* value, cmJSONState* state)
{
JsonErrors::EXPECTED_TYPE("a string")(value, state);
}
-void INVALID_BOOL(const Json::Value* value, cmJSONState* state)
+void INVALID_BOOL(Json::Value const* value, cmJSONState* state)
{
JsonErrors::EXPECTED_TYPE("a bool")(value, state);
}
-void INVALID_INT(const Json::Value* value, cmJSONState* state)
+void INVALID_INT(Json::Value const* value, cmJSONState* state)
{
JsonErrors::EXPECTED_TYPE("an integer")(value, state);
}
-void INVALID_UINT(const Json::Value* value, cmJSONState* state)
+void INVALID_UINT(Json::Value const* value, cmJSONState* state)
{
JsonErrors::EXPECTED_TYPE("an unsigned integer")(value, state);
}
ObjectErrorGenerator INVALID_NAMED_OBJECT(
- const std::function<std::string(const Json::Value*, cmJSONState*)>&
+ std::function<std::string(Json::Value const*, cmJSONState*)> const&
nameGenerator)
{
return [nameGenerator](
ObjectError errorType,
- const Json::Value::Members& extraFields) -> ErrorGenerator {
+ Json::Value::Members const& extraFields) -> ErrorGenerator {
return [nameGenerator, errorType, extraFields](
- const Json::Value* value, cmJSONState* state) -> void {
+ Json::Value const* value, cmJSONState* state) -> void {
std::string name = nameGenerator(value, state);
switch (errorType) {
case ObjectError::RequiredMissing:
@@ -88,18 +88,18 @@ ObjectErrorGenerator INVALID_NAMED_OBJECT(
}
ErrorGenerator INVALID_OBJECT(ObjectError errorType,
- const Json::Value::Members& extraFields)
+ Json::Value::Members const& extraFields)
{
return INVALID_NAMED_OBJECT(
- [](const Json::Value*, cmJSONState*) -> std::string { return "Object"; })(
+ [](Json::Value const*, cmJSONState*) -> std::string { return "Object"; })(
errorType, extraFields);
}
ErrorGenerator INVALID_NAMED_OBJECT_KEY(
- ObjectError errorType, const Json::Value::Members& extraFields)
+ ObjectError errorType, Json::Value::Members const& extraFields)
{
return INVALID_NAMED_OBJECT(
- [](const Json::Value*, cmJSONState* state) -> std::string {
+ [](Json::Value const*, cmJSONState* state) -> std::string {
for (auto it = state->parseStack.rbegin();
it != state->parseStack.rend(); ++it) {
if (it->first.rfind("$vector_item_", 0) == 0) {
diff --git a/Source/cmJSONHelpers.h b/Source/cmJSONHelpers.h
index 369c0b7..a5f71dd 100644
--- a/Source/cmJSONHelpers.h
+++ b/Source/cmJSONHelpers.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,9 +24,9 @@
template <typename T>
using cmJSONHelper =
- std::function<bool(T& out, const Json::Value* value, cmJSONState* state)>;
+ std::function<bool(T& out, Json::Value const* value, cmJSONState* state)>;
-using ErrorGenerator = std::function<void(const Json::Value*, cmJSONState*)>;
+using ErrorGenerator = std::function<void(Json::Value const*, cmJSONState*)>;
namespace JsonErrors {
enum ObjectError
@@ -37,29 +37,29 @@ enum ObjectError
MissingRequired
};
-using ErrorGenerator = std::function<void(const Json::Value*, cmJSONState*)>;
+using ErrorGenerator = std::function<void(Json::Value const*, cmJSONState*)>;
using ObjectErrorGenerator =
- std::function<ErrorGenerator(ObjectError, const Json::Value::Members&)>;
+ std::function<ErrorGenerator(ObjectError, Json::Value::Members const&)>;
-ErrorGenerator EXPECTED_TYPE(const std::string& type);
+ErrorGenerator EXPECTED_TYPE(std::string const& type);
-void INVALID_STRING(const Json::Value* value, cmJSONState* state);
+void INVALID_STRING(Json::Value const* value, cmJSONState* state);
-void INVALID_BOOL(const Json::Value* value, cmJSONState* state);
+void INVALID_BOOL(Json::Value const* value, cmJSONState* state);
-void INVALID_INT(const Json::Value* value, cmJSONState* state);
+void INVALID_INT(Json::Value const* value, cmJSONState* state);
-void INVALID_UINT(const Json::Value* value, cmJSONState* state);
+void INVALID_UINT(Json::Value const* value, cmJSONState* state);
ObjectErrorGenerator INVALID_NAMED_OBJECT(
- const std::function<std::string(const Json::Value*, cmJSONState*)>&
+ std::function<std::string(Json::Value const*, cmJSONState*)> const&
nameGenerator);
ErrorGenerator INVALID_OBJECT(ObjectError errorType,
- const Json::Value::Members& extraFields);
+ Json::Value::Members const& extraFields);
ErrorGenerator INVALID_NAMED_OBJECT_KEY(
- ObjectError errorType, const Json::Value::Members& extraFields);
+ ObjectError errorType, Json::Value::Members const& extraFields);
}
#if __cplusplus >= 201703L
@@ -75,7 +75,7 @@ struct is_bool_filter
template <typename F>
struct is_bool_filter<F,
std::enable_if_t<std::is_same_v<
- std::invoke_result_t<F, const std::string&>, bool>>>
+ std::invoke_result_t<F, std::string const&>, bool>>>
{
static constexpr bool value = true;
};
@@ -96,22 +96,22 @@ struct cmJSONHelperBuilder
}
template <typename U, typename M, typename F>
- Object& Bind(const cm::string_view& name, M U::*member, F func,
+ Object& Bind(cm::string_view const& name, M U::*member, F func,
bool required = true)
{
return this->BindPrivate(
name,
- [func, member](T& out, const Json::Value* value, cmJSONState* state)
+ [func, member](T& out, Json::Value const* value, cmJSONState* state)
-> bool { return func(out.*member, value, state); },
required);
}
template <typename M, typename F>
- Object& Bind(const cm::string_view& name, std::nullptr_t, F func,
+ Object& Bind(cm::string_view const& name, std::nullptr_t, F func,
bool required = true)
{
return this->BindPrivate(
name,
- [func](T& /*out*/, const Json::Value* value,
+ [func](T& /*out*/, Json::Value const* value,
cmJSONState* state) -> bool {
M dummy;
return func(dummy, value, state);
@@ -119,12 +119,12 @@ struct cmJSONHelperBuilder
required);
}
template <typename F>
- Object& Bind(const cm::string_view& name, F func, bool required = true)
+ Object& Bind(cm::string_view const& name, F func, bool required = true)
{
return this->BindPrivate(name, MemberFunction(func), required);
}
- bool operator()(T& out, const Json::Value* value, cmJSONState* state) const
+ bool operator()(T& out, Json::Value const* value, cmJSONState* state) const
{
Json::Value::Members extraFields;
if (!value && this->AnyRequired) {
@@ -178,7 +178,7 @@ struct cmJSONHelperBuilder
private:
// Not a true cmJSONHelper, it just happens to match the signature
- using MemberFunction = std::function<bool(T& out, const Json::Value* value,
+ using MemberFunction = std::function<bool(T& out, Json::Value const* value,
cmJSONState* state)>;
struct Member
{
@@ -197,7 +197,7 @@ struct cmJSONHelperBuilder
JsonErrors::ObjectErrorGenerator Error;
bool AllowExtra;
- Object& BindPrivate(const cm::string_view& name, MemberFunction&& func,
+ Object& BindPrivate(cm::string_view const& name, MemberFunction&& func,
bool required)
{
this->Members.emplace_back(name, std::move(func), required);
@@ -207,10 +207,10 @@ struct cmJSONHelperBuilder
};
static cmJSONHelper<std::string> String(
- const JsonErrors::ErrorGenerator& error = JsonErrors::INVALID_STRING,
- const std::string& defval = "")
+ JsonErrors::ErrorGenerator const& error = JsonErrors::INVALID_STRING,
+ std::string const& defval = "")
{
- return [error, defval](std::string& out, const Json::Value* value,
+ return [error, defval](std::string& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
out = defval;
@@ -225,16 +225,16 @@ struct cmJSONHelperBuilder
};
};
- static cmJSONHelper<std::string> String(const std::string& defval)
+ static cmJSONHelper<std::string> String(std::string const& defval)
{
return String(JsonErrors::INVALID_STRING, defval);
};
static cmJSONHelper<int> Int(
- const JsonErrors::ErrorGenerator& error = JsonErrors::INVALID_INT,
+ JsonErrors::ErrorGenerator const& error = JsonErrors::INVALID_INT,
int defval = 0)
{
- return [error, defval](int& out, const Json::Value* value,
+ return [error, defval](int& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
out = defval;
@@ -255,10 +255,10 @@ struct cmJSONHelperBuilder
};
static cmJSONHelper<unsigned int> UInt(
- const JsonErrors::ErrorGenerator& error = JsonErrors::INVALID_UINT,
+ JsonErrors::ErrorGenerator const& error = JsonErrors::INVALID_UINT,
unsigned int defval = 0)
{
- return [error, defval](unsigned int& out, const Json::Value* value,
+ return [error, defval](unsigned int& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
out = defval;
@@ -279,10 +279,10 @@ struct cmJSONHelperBuilder
}
static cmJSONHelper<bool> Bool(
- const JsonErrors::ErrorGenerator& error = JsonErrors::INVALID_BOOL,
+ JsonErrors::ErrorGenerator const& error = JsonErrors::INVALID_BOOL,
bool defval = false)
{
- return [error, defval](bool& out, const Json::Value* value,
+ return [error, defval](bool& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
out = defval;
@@ -304,9 +304,9 @@ struct cmJSONHelperBuilder
template <typename T, typename F, typename Filter>
static cmJSONHelper<std::vector<T>> VectorFilter(
- const JsonErrors::ErrorGenerator& error, F func, Filter filter)
+ JsonErrors::ErrorGenerator const& error, F func, Filter filter)
{
- return [error, func, filter](std::vector<T>& out, const Json::Value* value,
+ return [error, func, filter](std::vector<T>& out, Json::Value const* value,
cmJSONState* state) -> bool {
bool success = true;
if (!value) {
@@ -341,7 +341,7 @@ struct cmJSONHelperBuilder
F func)
{
return VectorFilter<T, F>(std::move(error), func,
- [](const T&) { return true; });
+ [](T const&) { return true; });
}
enum class FilterResult
@@ -358,9 +358,9 @@ struct cmJSONHelperBuilder
/// container of pairs (key, value).
template <typename Container, typename F, typename Filter>
static cmJSONHelper<Container> FilteredObject(
- const JsonErrors::ErrorGenerator& error, F func, Filter filter)
+ JsonErrors::ErrorGenerator const& error, F func, Filter filter)
{
- return [error, func, filter](Container& out, const Json::Value* value,
+ return [error, func, filter](Container& out, Json::Value const* value,
cmJSONState* state) -> bool {
// NOTE Some compile-time code path don't use `filter` at all.
// So, suppress "unused lambda capture" warning is needed.
@@ -417,7 +417,7 @@ struct cmJSONHelperBuilder
template <typename T, typename F, typename Filter>
static cmJSONHelper<std::map<std::string, T>> MapFilter(
- const JsonErrors::ErrorGenerator& error, F func, Filter filter)
+ JsonErrors::ErrorGenerator const& error, F func, Filter filter)
{
// clang-format off
return FilteredObject<std::map<std::string, T>>(
@@ -445,7 +445,7 @@ struct cmJSONHelperBuilder
template <typename T, typename F>
static cmJSONHelper<std::map<std::string, T>> Map(
- const JsonErrors::ErrorGenerator& error, F func)
+ JsonErrors::ErrorGenerator const& error, F func)
{
// clang-format off
return FilteredObject<std::map<std::string, T>>(
@@ -468,7 +468,7 @@ struct cmJSONHelperBuilder
template <typename T, typename F>
static cmJSONHelper<cm::optional<T>> Optional(F func)
{
- return [func](cm::optional<T>& out, const Json::Value* value,
+ return [func](cm::optional<T>& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
out.reset();
@@ -480,10 +480,10 @@ struct cmJSONHelperBuilder
}
template <typename T, typename F>
- static cmJSONHelper<T> Required(const JsonErrors::ErrorGenerator& error,
+ static cmJSONHelper<T> Required(JsonErrors::ErrorGenerator const& error,
F func)
{
- return [error, func](T& out, const Json::Value* value,
+ return [error, func](T& out, Json::Value const* value,
cmJSONState* state) -> bool {
if (!value) {
error(value, state);
@@ -494,10 +494,10 @@ struct cmJSONHelperBuilder
}
template <typename T, typename F, typename P>
- static cmJSONHelper<T> Checked(const JsonErrors::ErrorGenerator& error,
+ static cmJSONHelper<T> Checked(JsonErrors::ErrorGenerator const& error,
F func, P predicate)
{
- return [error, func, predicate](T& out, const Json::Value* value,
+ return [error, func, predicate](T& out, Json::Value const* value,
cmJSONState* state) -> bool {
bool result = func(out, value, state);
if (result && !predicate(out)) {
diff --git a/Source/cmJSONState.cxx b/Source/cmJSONState.cxx
index 5c44fba..d9ba87e 100644
--- a/Source/cmJSONState.cxx
+++ b/Source/cmJSONState.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmJSONState.h"
@@ -13,7 +13,7 @@
#include "cmStringAlgorithms.h"
-cmJSONState::cmJSONState(const std::string& filename, Json::Value* root)
+cmJSONState::cmJSONState(std::string const& filename, Json::Value* root)
{
cmsys::ifstream fin(filename.c_str(), std::ios::in | std::ios::binary);
if (!fin) {
@@ -49,7 +49,7 @@ void cmJSONState::AddError(std::string const& errMsg)
}
void cmJSONState::AddErrorAtValue(std::string const& errMsg,
- const Json::Value* value)
+ Json::Value const* value)
{
if (value && !value->isNull()) {
this->AddErrorAtOffset(errMsg, value->getOffsetStart());
@@ -105,7 +105,7 @@ std::string cmJSONState::key_after(std::string const& k)
return "";
}
-const Json::Value* cmJSONState::value_after(std::string const& k)
+Json::Value const* cmJSONState::value_after(std::string const& k)
{
for (auto it = this->parseStack.begin(); it != this->parseStack.end();
++it) {
@@ -116,7 +116,7 @@ const Json::Value* cmJSONState::value_after(std::string const& k)
return nullptr;
}
-void cmJSONState::push_stack(std::string const& k, const Json::Value* value)
+void cmJSONState::push_stack(std::string const& k, Json::Value const* value)
{
this->parseStack.emplace_back(k, value);
}
@@ -140,8 +140,8 @@ cmJSONState::Location cmJSONState::LocateInDocument(ptrdiff_t offset)
{
int line = 1;
int col = 1;
- const char* beginDoc = doc.data();
- const char* last = beginDoc + offset;
+ char const* beginDoc = doc.data();
+ char const* last = beginDoc + offset;
for (; beginDoc != last; ++beginDoc) {
switch (*beginDoc) {
case '\r':
diff --git a/Source/cmJSONState.h b/Source/cmJSONState.h
index 3223453..6bb9a46 100644
--- a/Source/cmJSONState.h
+++ b/Source/cmJSONState.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,17 +24,17 @@ class cmJSONState
};
public:
- using JsonPair = std::pair<const std::string, const Json::Value*>;
+ using JsonPair = std::pair<std::string const, Json::Value const*>;
cmJSONState() = default;
- cmJSONState(const std::string& filename, Json::Value* root);
+ cmJSONState(std::string const& filename, Json::Value* root);
void AddError(std::string const& errMsg);
- void AddErrorAtValue(std::string const& errMsg, const Json::Value* value);
+ void AddErrorAtValue(std::string const& errMsg, Json::Value const* value);
void AddErrorAtOffset(std::string const& errMsg, std::ptrdiff_t offset);
std::string GetErrorMessage(bool showContext = true);
std::string key();
std::string key_after(std::string const& key);
- const Json::Value* value_after(std::string const& key);
- void push_stack(std::string const& key, const Json::Value* value);
+ Json::Value const* value_after(std::string const& key);
+ void push_stack(std::string const& key, Json::Value const* value);
void pop_stack();
class Error
@@ -42,10 +42,10 @@ public:
public:
Error(Location loc, std::string errMsg)
: location(loc)
- , message(std::move(errMsg)){};
+ , message(std::move(errMsg)) {};
Error(std::string errMsg)
: location({ -1, -1 })
- , message(std::move(errMsg)){};
+ , message(std::move(errMsg)) {};
std::string GetErrorMessage() const
{
std::string output = message;
diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx
index 154aa27..dcc17e3 100644
--- a/Source/cmLDConfigLDConfigTool.cxx
+++ b/Source/cmLDConfigLDConfigTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLDConfigLDConfigTool.h"
@@ -50,7 +50,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
}
std::string line;
- static const cmsys::RegularExpression regex("^([^\t:]*):");
+ static cmsys::RegularExpression const regex("^([^\t:]*):");
cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
while (std::getline(output, line)) {
cmsys::RegularExpressionMatch match;
diff --git a/Source/cmLDConfigLDConfigTool.h b/Source/cmLDConfigLDConfigTool.h
index eeb86dd..08bd044 100644
--- a/Source/cmLDConfigLDConfigTool.h
+++ b/Source/cmLDConfigLDConfigTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmLDConfigTool.cxx b/Source/cmLDConfigTool.cxx
index 8d5d563..7323a5b 100644
--- a/Source/cmLDConfigTool.cxx
+++ b/Source/cmLDConfigTool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLDConfigTool.h"
diff --git a/Source/cmLDConfigTool.h b/Source/cmLDConfigTool.h
index 3116f80..76617e5 100644
--- a/Source/cmLDConfigTool.h
+++ b/Source/cmLDConfigTool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index 6775a60..a081186 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -1,15 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLinkDirectoriesCommand.h"
-#include <sstream>
-
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmList.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -52,34 +48,7 @@ static void AddLinkDir(cmMakefile& mf, std::string const& dir,
cmSystemTools::ConvertToUnixSlashes(unixPath);
if (!cmSystemTools::FileIsFullPath(unixPath) &&
!cmGeneratorExpression::StartsWithGeneratorExpression(unixPath)) {
- bool convertToAbsolute = false;
- std::ostringstream e;
- /* clang-format off */
- e << "This command specifies the relative path\n"
- << " " << unixPath << "\n"
- << "as a link directory.\n";
- /* clang-format on */
- switch (mf.GetPolicyStatus(cmPolicies::CMP0015)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015);
- mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior does not convert
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015);
- mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior converts
- convertToAbsolute = true;
- break;
- }
- if (convertToAbsolute) {
- unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath);
- }
+ unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath);
}
directories.push_back(unixPath);
}
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index 2a3499d..1eada4f 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx
index 3654176..7f21fbe 100644
--- a/Source/cmLinkItem.cxx
+++ b/Source/cmLinkItem.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLinkItem.h"
#include <utility> // IWYU pragma: keep
@@ -11,9 +11,7 @@
#include "cmGeneratorTarget.h"
#include "cmStringAlgorithms.h"
-const std::string cmLinkItem::DEFAULT = "DEFAULT";
-
-cmLinkItem::cmLinkItem() = default;
+std::string const cmLinkItem::DEFAULT = "DEFAULT";
cmLinkItem::cmLinkItem(std::string n, bool c, cmListFileBacktrace bt,
std::string feature)
@@ -73,20 +71,14 @@ std::ostream& operator<<(std::ostream& os, cmLinkItem const& item)
return os << item.AsStr();
}
-cmLinkImplItem::cmLinkImplItem()
- : cmLinkItem()
-{
-}
-
-cmLinkImplItem::cmLinkImplItem(cmLinkItem item, bool checkCMP0027)
+cmLinkImplItem::cmLinkImplItem(cmLinkItem item)
: cmLinkItem(std::move(item))
- , CheckCMP0027(checkCMP0027)
{
}
namespace {
-const cm::string_view LL_BEGIN = "<LINK_LIBRARY:"_s;
-const cm::string_view LL_END = "</LINK_LIBRARY:"_s;
+cm::string_view const LL_BEGIN = "<LINK_LIBRARY:"_s;
+cm::string_view const LL_END = "</LINK_LIBRARY:"_s;
}
cm::optional<std::string> ParseLinkFeature(std::string const& item)
{
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 4e356b7..bc2717c 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,9 +27,9 @@ class cmLinkItem
public:
// default feature: link library without decoration
- static const std::string DEFAULT;
+ static std::string const DEFAULT;
- cmLinkItem();
+ cmLinkItem() = default;
cmLinkItem(std::string s, bool c, cmListFileBacktrace bt,
std::string feature = DEFAULT);
cmLinkItem(cmGeneratorTarget const* t, bool c, cmListFileBacktrace bt,
@@ -50,9 +50,8 @@ public:
class cmLinkImplItem : public cmLinkItem
{
public:
- cmLinkImplItem();
- cmLinkImplItem(cmLinkItem item, bool checkCMP0027);
- bool CheckCMP0027 = false;
+ cmLinkImplItem() = default;
+ cmLinkImplItem(cmLinkItem item);
};
/** The link implementation specifies the direct library
@@ -65,10 +64,6 @@ struct cmLinkImplementationLibraries
// Object files linked directly in this configuration.
std::vector<cmLinkItem> Objects;
- // Libraries linked directly in other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<cmLinkItem> WrongConfigLibraries;
-
// Whether the list depends on a genex referencing the configuration.
bool HadContextSensitiveCondition = false;
};
@@ -108,12 +103,6 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries
// or more static libraries.
unsigned int Multiplicity = 0;
- // Libraries listed for other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<cmLinkItem> WrongConfigLibraries;
-
- bool ImplementationIsInterface = false;
-
// Whether the list depends on a link language genex.
bool HadLinkLanguageSensitiveCondition = false;
};
@@ -123,7 +112,6 @@ struct cmOptionalLinkInterface : public cmLinkInterface
bool LibrariesDone = false;
bool AllDone = false;
bool Exists = false;
- bool Explicit = false;
bool CheckLinkLibraries = false;
};
@@ -153,8 +141,8 @@ struct cmOptionalLinkImplementation : public cmLinkImplementation
};
/** Compute the link type to use for the given configuration. */
-inline cmTargetLinkLibraryType CMP0003_ComputeLinkType(
- const std::string& config, std::vector<std::string> const& debugConfigs)
+inline cmTargetLinkLibraryType ComputeLinkType(
+ std::string const& config, std::vector<std::string> const& debugConfigs)
{
// No configuration is always optimized.
if (config.empty()) {
diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx
index ca574d4..65a1be0 100644
--- a/Source/cmLinkItemGraphVisitor.cxx
+++ b/Source/cmLinkItemGraphVisitor.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLinkItemGraphVisitor.h"
#include <map>
@@ -98,7 +98,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
std::string const& config,
DependencyMap& dependencies)
{
- const auto* implementationLibraries = target.GetLinkImplementationLibraries(
+ auto const* implementationLibraries = target.GetLinkImplementationLibraries(
config, cmGeneratorTarget::UseTo::Link);
if (implementationLibraries) {
for (auto const& lib : implementationLibraries->Libraries) {
@@ -107,7 +107,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
}
}
- const auto* interfaceLibraries = target.GetLinkInterfaceLibraries(
+ auto const* interfaceLibraries = target.GetLinkInterfaceLibraries(
config, &target, cmGeneratorTarget::UseTo::Compile);
if (interfaceLibraries) {
for (auto const& lib : interfaceLibraries->Libraries) {
@@ -121,7 +121,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
}
std::vector<cmGeneratorTarget*> objectLibraries;
- target.GetObjectLibrariesCMP0026(objectLibraries);
+ target.GetObjectLibrariesInSources(objectLibraries);
for (auto const& lib : objectLibraries) {
auto const& name = lib->GetName();
if (dependencies.find(name) == dependencies.cend()) {
diff --git a/Source/cmLinkItemGraphVisitor.h b/Source/cmLinkItemGraphVisitor.h
index 0d6676a..1ad12a4 100644
--- a/Source/cmLinkItemGraphVisitor.h
+++ b/Source/cmLinkItemGraphVisitor.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index 2b8f836..74fe393 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLinkLibrariesCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 27c410f..7c5af0d 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index e823337..032e84d 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLinkLineComputer.h"
@@ -131,8 +131,8 @@ void cmLinkLineComputer::ComputeLinkPath(
if (cli.GetLinkLanguage() == "Swift") {
std::string linkPathNoBT;
- for (const cmComputeLinkInformation::Item& item : cli.GetItems()) {
- const cmGeneratorTarget* target = item.Target;
+ for (cmComputeLinkInformation::Item const& item : cli.GetItems()) {
+ cmGeneratorTarget const* target = item.Target;
if (!target) {
continue;
}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index 63cbeb2..a86a3ad 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 3963eb8..421aa54 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLinkLineDeviceComputer.h"
@@ -155,11 +155,11 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
if (emitted.insert(linkLib.Value).second) {
linkLib.Value += " ";
- const cmLinkImplementation* linkImpl =
+ cmLinkImplementation const* linkImpl =
cli.GetTarget()->GetLinkImplementation(cli.GetConfig(),
cmGeneratorTarget::UseTo::Link);
- for (const cmLinkImplItem& iter : linkImpl->Libraries) {
+ for (cmLinkImplItem const& iter : linkImpl->Libraries) {
if (iter.Target &&
iter.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
std::string libPath = iter.Target->GetLocation(cli.GetConfig());
@@ -186,7 +186,7 @@ std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
}
bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
- const std::string& config)
+ std::string const& config)
{
if (!target.GetGlobalGenerator()->GetLanguageEnabled("CUDA")) {
return false;
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
index 0916307..965a821 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -41,4 +41,4 @@ public:
};
bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
- const std::string& config);
+ std::string const& config);
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 616bf7e..dd0197a 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmList.cxx b/Source/cmList.cxx
index cf65bb2..9b3827b 100644
--- a/Source/cmList.cxx
+++ b/Source/cmList.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,14 +68,14 @@ public:
{
}
- bool operator()(const std::string& target)
+ bool operator()(std::string const& target)
{
return this->Regex.find(target) ^ this->IncludeMatches;
}
private:
cmsys::RegularExpression& Regex;
- const bool IncludeMatches;
+ bool const IncludeMatches;
};
}
@@ -99,7 +99,7 @@ namespace {
class StringSorter
{
protected:
- using StringFilter = std::function<std::string(const std::string&)>;
+ using StringFilter = std::function<std::string(std::string const&)>;
using OrderMode = cmList::SortConfiguration::OrderMode;
using CompareMethod = cmList::SortConfiguration::CompareMethod;
@@ -114,23 +114,23 @@ protected:
StringFilter GetCaseFilter(CaseSensitivity sensitivity)
{
- return (sensitivity == CaseSensitivity::INSENSITIVE)
- ? cmSystemTools::LowerCase
- : nullptr;
+ constexpr std::string (*filter)(std::string const&) =
+ cmSystemTools::LowerCase;
+ return (sensitivity == CaseSensitivity::INSENSITIVE) ? filter : nullptr;
}
using ComparisonFunction =
- std::function<bool(const std::string&, const std::string&)>;
+ std::function<bool(std::string const&, std::string const&)>;
ComparisonFunction GetComparisonFunction(CompareMethod compare)
{
if (compare == CompareMethod::NATURAL) {
- return std::function<bool(const std::string&, const std::string&)>(
- [](const std::string& x, const std::string& y) {
+ return std::function<bool(std::string const&, std::string const&)>(
+ [](std::string const& x, std::string const& y) {
return cmSystemTools::strverscmp(x, y) < 0;
});
}
- return std::function<bool(const std::string&, const std::string&)>(
- [](const std::string& x, const std::string& y) { return x < y; });
+ return std::function<bool(std::string const&, std::string const&)>(
+ [](std::string const& x, std::string const& y) { return x < y; });
}
public:
@@ -142,7 +142,7 @@ public:
{
}
- std::string ApplyFilter(const std::string& argument)
+ std::string ApplyFilter(std::string const& argument)
{
std::string result = argument;
for (auto const& filter : this->Filters) {
@@ -153,7 +153,7 @@ public:
return result;
}
- bool operator()(const std::string& a, const std::string& b)
+ bool operator()(std::string const& a, std::string const& b)
{
std::string af = this->ApplyFilter(a);
std::string bf = this->ApplyFilter(b);
@@ -175,7 +175,7 @@ private:
cmList::SortConfiguration::SortConfiguration() = default;
-cmList& cmList::sort(const SortConfiguration& cfg)
+cmList& cmList::sort(SortConfiguration const& cfg)
{
SortConfiguration config{ cfg };
@@ -202,7 +202,7 @@ cmList& cmList::sort(const SortConfiguration& cfg)
}
namespace {
-using transform_type = std::function<std::string(const std::string&)>;
+using transform_type = std::function<std::string(std::string const&)>;
using transform_error = cmList::transform_error;
class TransformSelector : public cmList::TransformSelector
@@ -212,14 +212,14 @@ public:
std::string Tag;
- const std::string& GetTag() override { return this->Tag; }
+ std::string const& GetTag() override { return this->Tag; }
virtual bool Validate(std::size_t count = 0) = 0;
- virtual bool InSelection(const std::string&) = 0;
+ virtual bool InSelection(std::string const&) = 0;
virtual void Transform(cmList::container_type& list,
- const transform_type& transform)
+ transform_type const& transform)
{
std::transform(list.begin(), list.end(), list.begin(), transform);
}
@@ -241,12 +241,12 @@ public:
bool Validate(std::size_t) override { return true; }
- bool InSelection(const std::string&) override { return true; }
+ bool InSelection(std::string const&) override { return true; }
};
class TransformSelectorRegex : public TransformSelector
{
public:
- TransformSelectorRegex(const std::string& regex)
+ TransformSelectorRegex(std::string const& regex)
: TransformSelector("REGEX")
, Regex(regex)
{
@@ -259,7 +259,7 @@ public:
bool Validate(std::size_t) override { return this->Regex.is_valid(); }
- bool InSelection(const std::string& value) override
+ bool InSelection(std::string const& value) override
{
return this->Regex.find(value);
}
@@ -271,10 +271,10 @@ class TransformSelectorIndexes : public TransformSelector
public:
std::vector<index_type> Indexes;
- bool InSelection(const std::string&) override { return true; }
+ bool InSelection(std::string const&) override { return true; }
void Transform(std::vector<std::string>& list,
- const transform_type& transform) override
+ transform_type const& transform) override
{
this->Validate(list.size());
@@ -391,18 +391,18 @@ public:
virtual ~TransformAction() = default;
void Initialize(TransformSelector* selector) { this->Selector = selector; }
- virtual void Initialize(TransformSelector*, const std::string&) {}
- virtual void Initialize(TransformSelector*, const std::string&,
- const std::string&)
+ virtual void Initialize(TransformSelector*, std::string const&) {}
+ virtual void Initialize(TransformSelector*, std::string const&,
+ std::string const&)
{
}
virtual void Initialize(TransformSelector* selector,
- const std::vector<std::string>&)
+ std::vector<std::string> const&)
{
this->Initialize(selector);
}
- virtual std::string operator()(const std::string& s) = 0;
+ virtual std::string operator()(std::string const& s) = 0;
protected:
TransformSelector* Selector;
@@ -413,18 +413,18 @@ public:
using TransformAction::Initialize;
void Initialize(TransformSelector* selector,
- const std::string& append) override
+ std::string const& append) override
{
TransformAction::Initialize(selector);
this->Append = append;
}
void Initialize(TransformSelector* selector,
- const std::vector<std::string>& append) override
+ std::vector<std::string> const& append) override
{
this->Initialize(selector, append.front());
}
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
return cmStrCat(s, this->Append);
@@ -442,18 +442,18 @@ public:
using TransformAction::Initialize;
void Initialize(TransformSelector* selector,
- const std::string& prepend) override
+ std::string const& prepend) override
{
TransformAction::Initialize(selector);
this->Prepend = prepend;
}
void Initialize(TransformSelector* selector,
- const std::vector<std::string>& prepend) override
+ std::vector<std::string> const& prepend) override
{
this->Initialize(selector, prepend.front());
}
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
return cmStrCat(this->Prepend, s);
@@ -468,7 +468,7 @@ private:
class TransformActionToUpper : public TransformAction
{
public:
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
return cmSystemTools::UpperCase(s);
@@ -480,7 +480,7 @@ public:
class TransformActionToLower : public TransformAction
{
public:
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
return cmSystemTools::LowerCase(s);
@@ -492,7 +492,7 @@ public:
class TransformActionStrip : public TransformAction
{
public:
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
return cmTrimWhitespace(s);
@@ -504,7 +504,7 @@ public:
class TransformActionGenexStrip : public TransformAction
{
public:
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
return cmGeneratorExpression::Preprocess(
@@ -519,8 +519,8 @@ class TransformActionReplace : public TransformAction
public:
using TransformAction::Initialize;
- void Initialize(TransformSelector* selector, const std::string& regex,
- const std::string& replace) override
+ void Initialize(TransformSelector* selector, std::string const& regex,
+ std::string const& replace) override
{
TransformAction::Initialize(selector);
this->ReplaceHelper =
@@ -538,12 +538,12 @@ public:
}
}
void Initialize(TransformSelector* selector,
- const std::vector<std::string>& args) override
+ std::vector<std::string> const& args) override
{
this->Initialize(selector, args[0], args[1]);
}
- std::string operator()(const std::string& s) override
+ std::string operator()(std::string const& s) override
{
if (this->Selector->InSelection(s)) {
// Scan through the input for all matches.
@@ -626,7 +626,7 @@ ActionDescriptorSet::iterator TransformConfigure(
auto descriptor = Descriptors.find(action);
if (descriptor == Descriptors.end()) {
throw transform_error(cmStrCat(" sub-command TRANSFORM, ",
- std::to_string(static_cast<int>(action)),
+ static_cast<int>(action),
" invalid action."));
}
@@ -746,7 +746,7 @@ cmList& cmList::transform(TransformAction action,
static_cast<::TransformSelector*>(selector.get()));
static_cast<::TransformSelector&>(*selector).Transform(
- this->Values, [&descriptor](const std::string& s) -> std::string {
+ this->Values, [&descriptor](std::string const& s) -> std::string {
return (*descriptor->Transform)(s);
});
@@ -762,7 +762,7 @@ cmList& cmList::transform(TransformAction action, std::string const& arg,
static_cast<::TransformSelector*>(selector.get()), arg);
static_cast<::TransformSelector&>(*selector).Transform(
- this->Values, [&descriptor](const std::string& s) -> std::string {
+ this->Values, [&descriptor](std::string const& s) -> std::string {
return (*descriptor->Transform)(s);
});
@@ -779,7 +779,7 @@ cmList& cmList::transform(TransformAction action, std::string const& arg1,
static_cast<::TransformSelector*>(selector.get()), arg1, arg2);
static_cast<::TransformSelector&>(*selector).Transform(
- this->Values, [&descriptor](const std::string& s) -> std::string {
+ this->Values, [&descriptor](std::string const& s) -> std::string {
return (*descriptor->Transform)(s);
});
@@ -796,7 +796,7 @@ cmList& cmList::transform(TransformAction action,
static_cast<::TransformSelector*>(selector.get()), args);
static_cast<::TransformSelector&>(*selector).Transform(
- this->Values, [&descriptor](const std::string& s) -> std::string {
+ this->Values, [&descriptor](std::string const& s) -> std::string {
return (*descriptor->Transform)(s);
});
@@ -905,7 +905,7 @@ cmList& cmList::RemoveItems(std::vector<index_type>&& indexes)
// compute all indexes
std::vector<size_type> idx(indexes.size());
std::transform(indexes.cbegin(), indexes.cend(), idx.begin(),
- [this](const index_type& index) -> size_type {
+ [this](index_type const& index) -> size_type {
return this->ComputeIndex(index);
});
diff --git a/Source/cmList.h b/Source/cmList.h
index e107096..2dbeadf 100644
--- a/Source/cmList.h
+++ b/Source/cmList.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -57,7 +57,7 @@ public:
using reverse_iterator = container_type::reverse_iterator;
using const_reverse_iterator = container_type::const_reverse_iterator;
- static const size_type npos = static_cast<size_type>(-1);
+ static size_type const npos = static_cast<size_type>(-1);
static cm::string_view element_separator;
@@ -73,7 +73,7 @@ public:
};
cmList() = default;
- cmList(const cmList&) = default;
+ cmList(cmList const&) = default;
cmList(cmList&&) = default;
cmList(cm::string_view value,
@@ -119,13 +119,13 @@ public:
: cmList(first, last, ExpandElements::Yes, emptyElements)
{
}
- cmList(const container_type& init,
+ cmList(container_type const& init,
ExpandElements expandElements = ExpandElements::Yes,
EmptyElements emptyElements = EmptyElements::No)
: cmList(init.begin(), init.end(), expandElements, emptyElements)
{
}
- cmList(const container_type& init, EmptyElements emptyElements)
+ cmList(container_type const& init, EmptyElements emptyElements)
: cmList(init, ExpandElements::Yes, emptyElements)
{
}
@@ -146,7 +146,7 @@ public:
~cmList() = default;
- cmList& operator=(const cmList&) = default;
+ cmList& operator=(cmList const&) = default;
cmList& operator=(cmList&&) = default;
cmList& operator=(cm::string_view value)
@@ -170,7 +170,7 @@ public:
return *this;
}
- cmList& operator=(const container_type& init)
+ cmList& operator=(container_type const& init)
{
this->assign(init);
return *this;
@@ -238,13 +238,13 @@ public:
{
this->assign(first, last, ExpandElements::Yes, emptyElements);
}
- void assign(const cmList& init,
+ void assign(cmList const& init,
ExpandElements expandElements = ExpandElements::No,
EmptyElements emptyElements = EmptyElements::No)
{
this->assign(init.begin(), init.end(), expandElements, emptyElements);
}
- void assign(const cmList& init, EmptyElements emptyElements)
+ void assign(cmList const& init, EmptyElements emptyElements)
{
this->assign(init, ExpandElements::No, emptyElements);
}
@@ -261,13 +261,13 @@ public:
{
this->assign(std::move(init), ExpandElements::No, emptyElements);
}
- void assign(const container_type& init,
+ void assign(container_type const& init,
ExpandElements expandElements = ExpandElements::Yes,
EmptyElements emptyElements = EmptyElements::No)
{
this->assign(init.begin(), init.end(), expandElements, emptyElements);
}
- void assign(const container_type& init, EmptyElements emptyElements)
+ void assign(container_type const& init, EmptyElements emptyElements)
{
this->assign(init, ExpandElements::Yes, emptyElements);
}
@@ -296,7 +296,7 @@ public:
}
operator container_type&() & noexcept { return this->Values; }
- operator const container_type&() const& noexcept { return this->Values; }
+ operator container_type const&() const& noexcept { return this->Values; }
operator container_type&&() && noexcept { return std::move(this->Values); }
// Element access
@@ -354,7 +354,7 @@ public:
}
container_type& data() noexcept { return this->Values; }
- const container_type& data() const noexcept { return this->Values; }
+ container_type const& data() const noexcept { return this->Values; }
// Iterators
iterator begin() noexcept { return this->Values.begin(); }
@@ -443,14 +443,14 @@ public:
{
return this->insert(pos, first, last, ExpandElements::Yes, emptyElements);
}
- iterator insert(const_iterator pos, const cmList& values,
+ iterator insert(const_iterator pos, cmList const& values,
ExpandElements expandElements = ExpandElements::No,
EmptyElements emptyElements = EmptyElements::No)
{
return this->insert(pos, values.begin(), values.end(), expandElements,
emptyElements);
}
- iterator insert(const_iterator pos, const cmList& values,
+ iterator insert(const_iterator pos, cmList const& values,
EmptyElements emptyElements)
{
return this->insert(pos, values, ExpandElements::No, emptyElements);
@@ -472,14 +472,14 @@ public:
return this->insert(pos, std::move(values), ExpandElements::No,
emptyElements);
}
- iterator insert(const_iterator pos, const container_type& values,
+ iterator insert(const_iterator pos, container_type const& values,
ExpandElements expandElements = ExpandElements::Yes,
EmptyElements emptyElements = EmptyElements::No)
{
return this->insert(pos, values.begin(), values.end(), expandElements,
emptyElements);
}
- iterator insert(const_iterator pos, const container_type& values,
+ iterator insert(const_iterator pos, container_type const& values,
EmptyElements emptyElements)
{
return this->insert(pos, values, ExpandElements::Yes, emptyElements);
@@ -554,14 +554,14 @@ public:
{
return this->append(first, last, ExpandElements::Yes, emptyElements);
}
- iterator append(const cmList& values,
+ iterator append(cmList const& values,
ExpandElements expandElements = ExpandElements::No,
EmptyElements emptyElements = EmptyElements::No)
{
return this->append(values.begin(), values.end(), expandElements,
emptyElements);
}
- iterator append(const cmList& values, EmptyElements emptyElements)
+ iterator append(cmList const& values, EmptyElements emptyElements)
{
return this->append(values, ExpandElements::No, emptyElements);
}
@@ -580,14 +580,14 @@ public:
{
return this->append(std::move(values), ExpandElements::No, emptyElements);
}
- iterator append(const container_type& values,
+ iterator append(container_type const& values,
ExpandElements expandElements = ExpandElements::Yes,
EmptyElements emptyElements = EmptyElements::No)
{
return this->append(values.begin(), values.end(), expandElements,
emptyElements);
}
- iterator append(const container_type& values, EmptyElements emptyElements)
+ iterator append(container_type const& values, EmptyElements emptyElements)
{
return this->append(values, ExpandElements::Yes, emptyElements);
}
@@ -659,14 +659,14 @@ public:
{
return this->prepend(first, last, ExpandElements::Yes, emptyElements);
}
- iterator prepend(const cmList& values,
+ iterator prepend(cmList const& values,
ExpandElements expandElements = ExpandElements::No,
EmptyElements emptyElements = EmptyElements::No)
{
return this->prepend(values.begin(), values.end(), expandElements,
emptyElements);
}
- iterator prepend(const cmList& values, EmptyElements emptyElements)
+ iterator prepend(cmList const& values, EmptyElements emptyElements)
{
return this->prepend(values, ExpandElements::No, emptyElements);
}
@@ -685,14 +685,14 @@ public:
{
return this->prepend(std::move(values), ExpandElements::No, emptyElements);
}
- iterator prepend(const container_type& values,
+ iterator prepend(container_type const& values,
ExpandElements expandElements = ExpandElements::Yes,
EmptyElements emptyElements = EmptyElements::No)
{
return this->prepend(values.begin(), values.end(), expandElements,
emptyElements);
}
- iterator prepend(const container_type& values, EmptyElements emptyElements)
+ iterator prepend(container_type const& values, EmptyElements emptyElements)
{
return this->prepend(values, ExpandElements::Yes, emptyElements);
}
@@ -862,13 +862,13 @@ public:
{
}
};
- cmList& sort(const SortConfiguration& config = SortConfiguration{});
+ cmList& sort(SortConfiguration const& config = SortConfiguration{});
// exception raised on error during transform operations
class transform_error : public std::runtime_error
{
public:
- transform_error(const std::string& error)
+ transform_error(std::string const& error)
: std::runtime_error(error)
{
}
@@ -886,7 +886,7 @@ public:
virtual ~TransformSelector() = default;
- virtual const std::string& GetTag() = 0;
+ virtual std::string const& GetTag() = 0;
// method NEW is used to allocate a selector of the needed type.
// For example:
@@ -1135,11 +1135,11 @@ public:
// Non-members
// ===========
- friend inline bool operator==(const cmList& lhs, const cmList& rhs) noexcept
+ friend bool operator==(cmList const& lhs, cmList const& rhs) noexcept
{
return lhs.Values == rhs.Values;
}
- friend inline bool operator!=(const cmList& lhs, const cmList& rhs) noexcept
+ friend bool operator!=(cmList const& lhs, cmList const& rhs) noexcept
{
return lhs.Values != rhs.Values;
}
@@ -1160,7 +1160,7 @@ private:
EmptyElements emptyElements);
static container_type::iterator Insert(container_type& container,
container_type::const_iterator pos,
- const std::string& value,
+ std::string const& value,
ExpandElements expandElements,
EmptyElements emptyElements)
{
@@ -1223,7 +1223,7 @@ private:
return std::string{};
}
- const auto sep = std::string{ glue };
+ auto const sep = std::string{ glue };
std::string joined = cmList::ToString(*first);
for (auto it = std::next(first); it != last; ++it) {
@@ -1301,7 +1301,7 @@ cmList::TransformSelector::New<cmList::TransformSelector::REGEX>(
// Non-member functions
// ====================
inline std::vector<std::string>& operator+=(std::vector<std::string>& l,
- const cmList& r)
+ cmList const& r)
{
l.insert(l.end(), r.begin(), r.end());
return l;
@@ -1323,7 +1323,7 @@ inline void swap(cmList& lhs, cmList& rhs) noexcept
} // namespace std
namespace cm {
-inline void erase(cmList& list, const std::string& value)
+inline void erase(cmList& list, std::string const& value)
{
list.erase(std::remove(list.begin(), list.end(), value), list.end());
}
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index ebf5841..47b6c39 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmListCommand.h"
#include <cassert>
@@ -28,7 +28,7 @@
namespace {
-bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf)
+bool GetIndexArg(std::string const& arg, int* idx, cmMakefile& mf)
{
long value;
if (!cmStrToLong(arg, &value)) {
@@ -48,13 +48,6 @@ bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf)
break;
case cmPolicies::NEW:
return false;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- std::string msg =
- cmStrCat(cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0121),
- " Invalid list index \"", arg, "\".");
- mf.IssueMessage(MessageType::FATAL_ERROR, msg);
- break;
}
}
@@ -64,8 +57,8 @@ bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf)
return true;
}
-bool GetListString(std::string& listString, const std::string& var,
- const cmMakefile& makefile)
+bool GetListString(std::string& listString, std::string const& var,
+ cmMakefile const& makefile)
{
// get the old value
cmValue cacheValue = makefile.GetDefinition(var);
@@ -76,8 +69,8 @@ bool GetListString(std::string& listString, const std::string& var,
return true;
}
-cm::optional<cmList> GetList(const std::string& var,
- const cmMakefile& makefile)
+cm::optional<cmList> GetList(std::string const& var,
+ cmMakefile const& makefile)
{
cm::optional<cmList> list;
@@ -96,35 +89,6 @@ cm::optional<cmList> GetList(const std::string& var,
if (!cm::contains(*list, std::string())) {
return list;
}
- // if we have empty elements we need to check policy CMP0007
- switch (makefile.GetPolicyStatus(cmPolicies::CMP0007)) {
- case cmPolicies::WARN: {
- // Default is to warn and use old behavior
- // OLD behavior is to allow compatibility, so recall
- // ExpandListArgument without the true which will remove
- // empty values
- list->assign(listString);
- std::string warn =
- cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0007),
- " List has value = [", listString, "].");
- makefile.IssueMessage(MessageType::AUTHOR_WARNING, warn);
- return list;
- }
- case cmPolicies::OLD:
- // OLD behavior is to allow compatibility, so recall
- // ExpandListArgument without the true which will remove
- // empty values
- list->assign(listString);
- return list;
- case cmPolicies::NEW:
- return list;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- makefile.IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0007));
- return {};
- }
return list;
}
@@ -136,8 +100,8 @@ bool HandleLengthCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
- const std::string& variableName = args.back();
+ std::string const& listName = args[1];
+ std::string const& variableName = args.back();
auto list = GetList(listName, status.GetMakefile());
status.GetMakefile().AddDefinition(variableName,
@@ -154,8 +118,8 @@ bool HandleGetCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
- const std::string& variableName = args.back();
+ std::string const& listName = args[1];
+ std::string const& variableName = args.back();
// expand the variable
auto list = GetList(listName, status.GetMakefile());
if (!list) {
@@ -337,8 +301,8 @@ bool HandleFindCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
- const std::string& variableName = args.back();
+ std::string const& listName = args[1];
+ std::string const& variableName = args.back();
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -361,7 +325,7 @@ bool HandleInsertCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
int index;
@@ -394,9 +358,9 @@ bool HandleJoinCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
- const std::string& glue = args[2];
- const std::string& variableName = args[3];
+ std::string const& listName = args[1];
+ std::string const& glue = args[2];
+ std::string const& variableName = args[3];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -419,7 +383,7 @@ bool HandleRemoveItemCommand(std::vector<std::string> const& args,
return true;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -441,7 +405,7 @@ bool HandleReverseCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -462,7 +426,7 @@ bool HandleRemoveDuplicatesCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -501,7 +465,7 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
{
}
- operator const std::string&() const { return this->Name; }
+ operator std::string const&() const { return this->Name; }
std::string Name;
cmList::TransformAction Action;
@@ -510,7 +474,7 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
// Build a set of supported actions.
std::set<ActionDescriptor,
- std::function<bool(const std::string&, const std::string&)>>
+ std::function<bool(std::string const&, std::string const&)>>
descriptors{ { { "APPEND", cmList::TransformAction::APPEND, 1 },
{ "PREPEND", cmList::TransformAction::PREPEND, 1 },
{ "TOUPPER", cmList::TransformAction::TOUPPER, 0 },
@@ -518,11 +482,11 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
{ "STRIP", cmList::TransformAction::STRIP, 0 },
{ "GENEX_STRIP", cmList::TransformAction::GENEX_STRIP, 0 },
{ "REPLACE", cmList::TransformAction::REPLACE, 2 } },
- [](const std::string& x, const std::string& y) {
+ [](std::string const& x, std::string const& y) {
return x < y;
} };
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// Parse all possible function parameters
using size_type = std::vector<std::string>::size_type;
@@ -552,10 +516,10 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
std::vector<std::string>(args.begin() + 3, args.begin() + index);
}
- const std::string REGEX{ "REGEX" };
- const std::string AT{ "AT" };
- const std::string FOR{ "FOR" };
- const std::string OUTPUT_VARIABLE{ "OUTPUT_VARIABLE" };
+ std::string const REGEX{ "REGEX" };
+ std::string const AT{ "AT" };
+ std::string const FOR{ "FOR" };
+ std::string const OUTPUT_VARIABLE{ "OUTPUT_VARIABLE" };
std::unique_ptr<cmList::TransformSelector> selector;
std::string outputName = listName;
@@ -602,7 +566,7 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
break;
}
indexes.push_back(value);
- } catch (const std::invalid_argument&) {
+ } catch (std::invalid_argument const&) {
// this is not a number, stop processing
break;
}
@@ -649,7 +613,7 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
valid = false;
}
}
- } catch (const std::invalid_argument&) {
+ } catch (std::invalid_argument const&) {
// this is not numbers
valid = false;
}
@@ -670,7 +634,7 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
} else {
index += 1;
}
- } catch (const std::invalid_argument&) {
+ } catch (std::invalid_argument const&) {
// this is not number, ignore exception
}
}
@@ -736,7 +700,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
SortConfig sortConfig;
size_t argumentIndex = 2;
- const std::string messageHint = "sub-command SORT ";
+ std::string const messageHint = "sub-command SORT ";
while (argumentIndex < args.size()) {
std::string const& option = args[argumentIndex++];
@@ -821,7 +785,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
}
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -843,8 +807,8 @@ bool HandleSublistCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
- const std::string& variableName = args.back();
+ std::string const& listName = args[1];
+ std::string const& variableName = args.back();
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -897,7 +861,7 @@ bool HandleRemoveAtCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -956,7 +920,7 @@ bool HandleFilterCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& op = args[2];
+ std::string const& op = args[2];
cmList::FilterMode filterMode;
if (op == "INCLUDE") {
filterMode = cmList::FilterMode::INCLUDE;
@@ -967,7 +931,7 @@ bool HandleFilterCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
auto list = GetList(listName, status.GetMakefile());
@@ -975,7 +939,7 @@ bool HandleFilterCommand(std::vector<std::string> const& args,
return true;
}
- const std::string& mode = args[3];
+ std::string const& mode = args[3];
if (mode != "REGEX") {
status.SetError("sub-command FILTER does not recognize mode " + mode);
return false;
@@ -985,7 +949,7 @@ bool HandleFilterCommand(std::vector<std::string> const& args,
"requires five arguments.");
return false;
}
- const std::string& pattern = args[4];
+ std::string const& pattern = args[4];
try {
status.GetMakefile().AddDefinition(
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 6efab16..6025a68 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index cf869c8..9aa5b20 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#define cmListFileCache_cxx
#include "cmListFileCache.h"
@@ -47,15 +47,15 @@ class cmListFileParser
public:
cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
cmMessenger* messenger);
- cmListFileParser(const cmListFileParser&) = delete;
- cmListFileParser& operator=(const cmListFileParser&) = delete;
+ cmListFileParser(cmListFileParser const&) = delete;
+ cmListFileParser& operator=(cmListFileParser const&) = delete;
- bool ParseFile(const char* filename);
- bool ParseString(const char* str, const char* virtual_filename);
+ bool ParseFile(char const* filename);
+ bool ParseString(char const* str, char const* virtual_filename);
private:
bool Parse();
- bool ParseFunction(const char* name, long line);
+ bool ParseFunction(char const* name, long line);
bool AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim);
void IssueFileOpenError(std::string const& text) const;
@@ -73,7 +73,7 @@ private:
cmListFile* ListFile;
cmListFileBacktrace Backtrace;
cmMessenger* Messenger;
- const char* FileName = nullptr;
+ char const* FileName = nullptr;
std::unique_ptr<cmListFileLexer, void (*)(cmListFileLexer*)> Lexer;
std::string FunctionName;
long FunctionLine;
@@ -90,13 +90,13 @@ cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
{
}
-void cmListFileParser::IssueFileOpenError(const std::string& text) const
+void cmListFileParser::IssueFileOpenError(std::string const& text) const
{
this->Messenger->IssueMessage(MessageType::FATAL_ERROR, text,
this->Backtrace);
}
-void cmListFileParser::IssueError(const std::string& text) const
+void cmListFileParser::IssueError(std::string const& text) const
{
cmListFileContext lfc;
lfc.FilePath = this->FileName;
@@ -107,7 +107,7 @@ void cmListFileParser::IssueError(const std::string& text) const
cmSystemTools::SetFatalErrorOccurred();
}
-bool cmListFileParser::ParseFile(const char* filename)
+bool cmListFileParser::ParseFile(char const* filename)
{
this->FileName = filename;
@@ -142,8 +142,8 @@ bool cmListFileParser::ParseFile(const char* filename)
return this->Parse();
}
-bool cmListFileParser::ParseString(const char* str,
- const char* virtual_filename)
+bool cmListFileParser::ParseString(char const* str,
+ char const* virtual_filename)
{
this->FileName = virtual_filename;
@@ -208,7 +208,7 @@ bool cmListFileParser::Parse()
return true;
}
-bool cmListFileParser::ParseFunction(const char* name, long line)
+bool cmListFileParser::ParseFunction(char const* name, long line)
{
// Ininitialize a new function call.
this->FunctionName = name;
@@ -424,7 +424,7 @@ cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const
} // anonymous namespace
-bool cmListFile::ParseFile(const char* filename, cmMessenger* messenger,
+bool cmListFile::ParseFile(char const* filename, cmMessenger* messenger,
cmListFileBacktrace const& lfbt)
{
if (!cmSystemTools::FileExists(filename) ||
@@ -442,9 +442,9 @@ bool cmListFile::ParseFile(const char* filename, cmMessenger* messenger,
return !parseError;
}
-bool cmListFile::ParseString(const char* str, const char* virtual_filename,
+bool cmListFile::ParseString(char const* str, char const* virtual_filename,
cmMessenger* messenger,
- const cmListFileBacktrace& lfbt)
+ cmListFileBacktrace const& lfbt)
{
bool parseError = false;
@@ -473,7 +473,7 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
return os;
}
-bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
+bool operator<(cmListFileContext const& lhs, cmListFileContext const& rhs)
{
if (lhs.Line != rhs.Line) {
return lhs.Line < rhs.Line;
@@ -481,12 +481,12 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
return lhs.FilePath < rhs.FilePath;
}
-bool operator==(const cmListFileContext& lhs, const cmListFileContext& rhs)
+bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs)
{
return lhs.Line == rhs.Line && lhs.FilePath == rhs.FilePath;
}
-bool operator!=(const cmListFileContext& lhs, const cmListFileContext& rhs)
+bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs)
{
return !(lhs == rhs);
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index e4e6eb3..ad78c51 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -40,11 +40,11 @@ struct cmListFileArgument
, Line(line)
{
}
- bool operator==(const cmListFileArgument& r) const
+ bool operator==(cmListFileArgument const& r) const
{
return (this->Value == r.Value) && (this->Delim == r.Delim);
}
- bool operator!=(const cmListFileArgument& r) const { return !(*this == r); }
+ bool operator!=(cmListFileArgument const& r) const { return !(*this == r); }
std::string Value;
Delimiter Delim = Unquoted;
long Line = 0;
@@ -116,8 +116,8 @@ public:
// seem to be any way for this to happen given the member types.
// NOLINTNEXTLINE(bugprone-exception-escape)
cmListFileContext(cmListFileContext&& /*other*/) noexcept = default;
- cmListFileContext(const cmListFileContext& /*other*/) = default;
- cmListFileContext& operator=(const cmListFileContext& /*other*/) = default;
+ cmListFileContext(cmListFileContext const& /*other*/) = default;
+ cmListFileContext& operator=(cmListFileContext const& /*other*/) = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
cmListFileContext& operator=(cmListFileContext&& /*other*/) noexcept =
default;
@@ -138,10 +138,10 @@ public:
static cmListFileContext FromListFilePath(std::string const& filePath)
{
- // We are entering a file-level scope but have not yet reached
- // any specific line or command invocation within it. This context
- // is useful to print when it is at the top but otherwise can be
- // skipped during call stack printing.
+ // We are entering a file-level scope but have not yet reached any specific
+ // line or command invocation within it. This context is useful to print
+ // when it is at the top, but otherwise can be skipped during call stack
+ // printing if preceded by a more specific entry.
cmListFileContext lfc;
lfc.FilePath = filePath;
return lfc;
@@ -161,7 +161,7 @@ public:
};
std::ostream& operator<<(std::ostream&, cmListFileContext const&);
-bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
+bool operator<(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
@@ -237,10 +237,10 @@ std::vector<BT<std::string>> cmExpandListWithBacktrace(
struct cmListFile
{
- bool ParseFile(const char* path, cmMessenger* messenger,
+ bool ParseFile(char const* path, cmMessenger* messenger,
cmListFileBacktrace const& lfbt);
- bool ParseString(const char* str, const char* virtual_filename,
+ bool ParseString(char const* str, char const* virtual_filename,
cmMessenger* messenger, cmListFileBacktrace const& lfbt);
std::vector<cmListFileFunction> Functions;
diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h
index 3c89f63..5d56f02 100644
--- a/Source/cmListFileLexer.h
+++ b/Source/cmListFileLexer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#ifdef __cplusplus
@@ -53,13 +53,13 @@ typedef enum cmListFileLexer_BOM_e cmListFileLexer_BOM;
typedef struct cmListFileLexer_s cmListFileLexer;
cmListFileLexer* cmListFileLexer_New(void);
-int cmListFileLexer_SetFileName(cmListFileLexer*, const char*,
+int cmListFileLexer_SetFileName(cmListFileLexer*, char const*,
cmListFileLexer_BOM* bom);
-int cmListFileLexer_SetString(cmListFileLexer*, const char*);
+int cmListFileLexer_SetString(cmListFileLexer*, char const*);
cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer*);
long cmListFileLexer_GetCurrentLine(cmListFileLexer*);
long cmListFileLexer_GetCurrentColumn(cmListFileLexer*);
-const char* cmListFileLexer_GetTypeAsString(cmListFileLexer*,
+char const* cmListFileLexer_GetTypeAsString(cmListFileLexer*,
cmListFileLexer_Type);
void cmListFileLexer_Delete(cmListFileLexer*);
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 9981c05..d88dbb3 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLoadCacheCommand.h"
#include <set>
@@ -17,7 +17,7 @@ static bool ReadWithPrefix(std::vector<std::string> const& args,
static void CheckLine(cmMakefile& mf, std::string const& prefix,
std::set<std::string> const& variablesToRead,
- const char* line);
+ char const* line);
bool cmLoadCacheCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -117,7 +117,7 @@ static bool ReadWithPrefix(std::vector<std::string> const& args,
// This is a big hack read loop to overcome a buggy ifstream
// implementation on HP-UX. This should work on all platforms even
// for small buffer sizes.
- const int bufferSize = 4096;
+ int const bufferSize = 4096;
char buffer[bufferSize];
std::string line;
while (fin) {
@@ -125,10 +125,10 @@ static bool ReadWithPrefix(std::vector<std::string> const& args,
fin.read(buffer, bufferSize);
if (fin.gcount()) {
// Parse for newlines directly.
- const char* i = buffer;
- const char* end = buffer + fin.gcount();
+ char const* i = buffer;
+ char const* end = buffer + fin.gcount();
while (i != end) {
- const char* begin = i;
+ char const* begin = i;
while (i != end && *i != '\n') {
++i;
}
@@ -161,7 +161,7 @@ static bool ReadWithPrefix(std::vector<std::string> const& args,
static void CheckLine(cmMakefile& mf, std::string const& prefix,
std::set<std::string> const& variablesToRead,
- const char* line)
+ char const* line)
{
// Check one line of the cache file.
std::string var;
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 5f5b705..3deac9e 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
deleted file mode 100644
index 3e99451..0000000
--- a/Source/cmLoadCommandCommand.cxx
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-
-#if !defined(_WIN32) && !defined(__sun) && !defined(__OpenBSD__)
-// POSIX APIs are needed
-// NOLINTNEXTLINE(bugprone-reserved-identifier)
-# define _POSIX_C_SOURCE 200809L
-#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-// For isascii
-// NOLINTNEXTLINE(bugprone-reserved-identifier)
-# define _XOPEN_SOURCE 700
-#endif
-#if defined(__APPLE__)
-// Restore Darwin APIs removed by _POSIX_C_SOURCE:
-// aligned_alloc
-// NOLINTNEXTLINE(bugprone-reserved-identifier)
-# define _DARWIN_C_SOURCE
-#endif
-
-#include "cmLoadCommandCommand.h"
-
-#include <csignal>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <utility>
-
-#include <cm/memory>
-
-#include "cmCPluginAPI.h"
-#include "cmCommand.h"
-#include "cmDynamicLoader.h"
-#include "cmExecutionStatus.h"
-#include "cmListFileCache.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-
-// NOLINTNEXTLINE(bugprone-suspicious-include)
-#include "cmCPluginAPI.cxx"
-
-#ifdef __QNX__
-# include <malloc.h> /* for malloc/free on QNX */
-#endif
-
-namespace {
-
-const char* LastName = nullptr;
-
-extern "C" void TrapsForSignals(int sig);
-extern "C" void TrapsForSignals(int sig)
-{
- fprintf(stderr, "CMake loaded command %s crashed with signal: %d.\n",
- LastName, sig);
-}
-
-struct SignalHandlerGuard
-{
- explicit SignalHandlerGuard(const char* name)
- {
- LastName = name ? name : "????";
-
- signal(SIGSEGV, TrapsForSignals);
-#ifdef SIGBUS
- signal(SIGBUS, TrapsForSignals);
-#endif
- signal(SIGILL, TrapsForSignals);
- }
-
- ~SignalHandlerGuard()
- {
- signal(SIGSEGV, nullptr);
-#ifdef SIGBUS
- signal(SIGBUS, nullptr);
-#endif
- signal(SIGILL, nullptr);
- }
-
- SignalHandlerGuard(SignalHandlerGuard const&) = delete;
- SignalHandlerGuard& operator=(SignalHandlerGuard const&) = delete;
-};
-
-struct LoadedCommandImpl : cmLoadedCommandInfo
-{
- explicit LoadedCommandImpl(CM_INIT_FUNCTION init)
- : cmLoadedCommandInfo{ 0, 0, &cmStaticCAPI, 0,
- nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr }
- {
- init(this);
- }
-
- ~LoadedCommandImpl()
- {
- if (this->Destructor) {
- SignalHandlerGuard guard(this->Name);
-#if defined(__NVCOMPILER) || defined(__LCC__)
- static_cast<void>(guard); // convince compiler var is used
-#endif
- this->Destructor(this);
- }
- if (this->Error) {
- free(this->Error);
- }
- }
-
- LoadedCommandImpl(LoadedCommandImpl const&) = delete;
- LoadedCommandImpl& operator=(LoadedCommandImpl const&) = delete;
-
- int DoInitialPass(cmMakefile* mf, int argc, char* argv[])
- {
- SignalHandlerGuard guard(this->Name);
-#if defined(__NVCOMPILER) || defined(__LCC__)
- static_cast<void>(guard); // convince compiler var is used
-#endif
- return this->InitialPass(this, mf, argc, argv);
- }
-
- void DoFinalPass(cmMakefile* mf)
- {
- SignalHandlerGuard guard(this->Name);
-#if defined(__NVCOMPILER) || defined(__LCC__)
- static_cast<void>(guard); // convince compiler var is used
-#endif
- this->FinalPass(this, mf);
- }
-};
-
-// a class for loadabple commands
-class cmLoadedCommand : public cmCommand
-{
-public:
- cmLoadedCommand() = default;
- explicit cmLoadedCommand(CM_INIT_FUNCTION init)
- : Impl(std::make_shared<LoadedCommandImpl>(init))
- {
- }
-
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- auto newC = cm::make_unique<cmLoadedCommand>();
- // we must copy when we clone
- newC->Impl = this->Impl;
- return std::unique_ptr<cmCommand>(std::move(newC));
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&) override;
-
-private:
- std::shared_ptr<LoadedCommandImpl> Impl;
-};
-
-bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
-{
- if (!this->Impl->InitialPass) {
- return true;
- }
-
- // clear the error string
- if (this->Impl->Error) {
- free(this->Impl->Error);
- }
-
- // create argc and argv and then invoke the command
- int argc = static_cast<int>(args.size());
- char** argv = nullptr;
- if (argc) {
- argv = static_cast<char**>(malloc(argc * sizeof(char*)));
- }
- int i;
- for (i = 0; i < argc; ++i) {
- argv[i] = strdup(args[i].c_str());
- }
- int result = this->Impl->DoInitialPass(this->Makefile, argc, argv);
- cmFreeArguments(argc, argv);
-
- if (result) {
- if (this->Impl->FinalPass) {
- auto impl = this->Impl;
- this->Makefile->AddGeneratorAction(
- [impl](cmLocalGenerator& lg, const cmListFileBacktrace&) {
- impl->DoFinalPass(lg.GetMakefile());
- });
- }
- return true;
- }
-
- /* Initial Pass must have failed so set the error string */
- if (this->Impl->Error) {
- this->SetError(this->Impl->Error);
- }
- return false;
-}
-
-} // namespace
-
-// cmLoadCommandCommand
-bool cmLoadCommandCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.empty()) {
- return true;
- }
-
- // Construct a variable to report what file was loaded, if any.
- // Start by removing the definition in case of failure.
- std::string reportVar = cmStrCat("CMAKE_LOADED_COMMAND_", args[0]);
- status.GetMakefile().RemoveDefinition(reportVar);
-
- // the file must exist
- std::string moduleName = cmStrCat(
- status.GetMakefile().GetRequiredDefinition("CMAKE_SHARED_MODULE_PREFIX"),
- "cm", args[0],
- status.GetMakefile().GetRequiredDefinition("CMAKE_SHARED_MODULE_SUFFIX"));
-
- // search for the file
- std::vector<std::string> path;
- for (unsigned int j = 1; j < args.size(); j++) {
- // expand variables
- std::string exp = args[j];
- cmSystemTools::ExpandRegistryValues(exp);
-
- // Glob the entry in case of wildcards.
- cmSystemTools::GlobDirs(exp, path);
- }
-
- // Try to find the program.
- std::string fullPath = cmSystemTools::FindFile(moduleName, path);
- if (fullPath.empty()) {
- status.SetError(cmStrCat("Attempt to load command failed from file \"",
- moduleName, "\""));
- return false;
- }
-
- // try loading the shared library / dll
- cmsys::DynamicLoader::LibraryHandle lib =
- cmDynamicLoader::OpenLibrary(fullPath.c_str());
- if (!lib) {
- std::string err =
- cmStrCat("Attempt to load the library ", fullPath, " failed.");
- const char* error = cmsys::DynamicLoader::LastError();
- if (error) {
- err += " Additional error info is:\n";
- err += error;
- }
- status.SetError(err);
- return false;
- }
-
- // Report what file was loaded for this command.
- status.GetMakefile().AddDefinition(reportVar, fullPath);
-
- // find the init function
- std::string initFuncName = args[0] + "Init";
- CM_INIT_FUNCTION initFunction = reinterpret_cast<CM_INIT_FUNCTION>(
- cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName));
- if (!initFunction) {
- initFuncName = cmStrCat('_', args[0], "Init");
- initFunction = reinterpret_cast<CM_INIT_FUNCTION>(
- cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName));
- }
- // if the symbol is found call it to set the name on the
- // function blocker
- if (initFunction) {
- return status.GetMakefile().GetState()->AddScriptedCommand(
- args[0],
- BT<cmState::Command>(
- cmLegacyCommandWrapper(cm::make_unique<cmLoadedCommand>(initFunction)),
- status.GetMakefile().GetBacktrace()),
- status.GetMakefile());
- }
- status.SetError("Attempt to load command failed. "
- "No init function found.");
- return false;
-}
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
deleted file mode 100644
index d30ba16..0000000
--- a/Source/cmLoadCommandCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmLoadCommandCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 14b3040..8157509 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalCommonGenerator.h"
#include <memory>
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 52f7a9e..6760277 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f72e4b4..f05de3a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalGenerator.h"
#include <algorithm>
@@ -58,7 +58,6 @@
#include "cmTarget.h"
#include "cmTestGenerator.h"
#include "cmValue.h"
-#include "cmVersion.h"
#include "cmake.h"
#if defined(__HAIKU__)
@@ -102,8 +101,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
this->AliasTargets = makefile->GetAliasTargets();
this->EmitUniversalBinaryFlags = true;
- this->BackwardsCompatibility = 0;
- this->BackwardsCompatibilityFinal = false;
this->ComputeObjectMaxPath();
@@ -208,12 +205,62 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
}
std::unique_ptr<cmRulePlaceholderExpander>
-cmLocalGenerator::CreateRulePlaceholderExpander() const
+cmLocalGenerator::CreateRulePlaceholderExpander(cmBuildStep buildStep) const
{
return cm::make_unique<cmRulePlaceholderExpander>(
- this->Compilers, this->VariableMappings, this->CompilerSysroot,
+ buildStep, this->Compilers, this->VariableMappings, this->CompilerSysroot,
this->LinkerSysroot);
}
+std::unique_ptr<cmRulePlaceholderExpander>
+cmLocalGenerator::CreateRulePlaceholderExpander(
+ cmBuildStep buildStep, cmGeneratorTarget const* target,
+ std::string const& language)
+{
+ auto targetType = target->GetType();
+ if (buildStep == cmBuildStep::Link &&
+ (targetType == cmStateEnums::EXECUTABLE ||
+ targetType == cmStateEnums::SHARED_LIBRARY ||
+ targetType == cmStateEnums::MODULE_LIBRARY)) {
+ auto mappings = this->VariableMappings;
+ auto updateMapping = [buildStep, target, &language, &mappings,
+ this](std::string const& variable) {
+ auto search = this->VariableMappings.find(variable);
+ if (search != this->VariableMappings.end()) {
+ std::string finalFlags;
+ this->AppendFlags(finalFlags, search->second, variable, target,
+ buildStep, language);
+ mappings[variable] = std::move(finalFlags);
+ }
+ };
+
+ switch (targetType) {
+ // FALLTHROUGH is used because, depending of the compiler and/or
+ // platform, the wrong variable is used. For example
+ // CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS is used to generate a module,
+ // and the variable CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS is ignored.
+ case cmStateEnums::MODULE_LIBRARY:
+ updateMapping(
+ cmStrCat("CMAKE_SHARED_MODULE_CREATE_", language, "_FLAGS"));
+ CM_FALLTHROUGH;
+ case cmStateEnums::SHARED_LIBRARY:
+ updateMapping(
+ cmStrCat("CMAKE_SHARED_LIBRARY_CREATE_", language, "_FLAGS"));
+ CM_FALLTHROUGH;
+ case cmStateEnums::EXECUTABLE:
+ updateMapping(cmStrCat("CMAKE_", language, "_LINK_FLAGS"));
+ break;
+ default:
+ // no action needed
+ ;
+ }
+
+ return cm::make_unique<cmRulePlaceholderExpander>(
+ buildStep, this->Compilers, std::move(mappings), this->CompilerSysroot,
+ this->LinkerSysroot);
+ }
+
+ return this->CreateRulePlaceholderExpander(buildStep);
+}
cmLocalGenerator::~cmLocalGenerator() = default;
@@ -241,14 +288,14 @@ void cmLocalGenerator::ComputeObjectMaxPath()
std::ostringstream w;
w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax
<< ", which is less than the minimum of 128. "
- << "The value will be ignored.";
+ "The value will be ignored.";
this->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
} else {
std::ostringstream w;
w << "CMAKE_OBJECT_PATH_MAX is set to \"" << *plen
<< "\", which fails to parse as a positive integer. "
- << "The value will be ignored.";
+ "The value will be ignored.";
this->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
}
@@ -256,9 +303,9 @@ void cmLocalGenerator::ComputeObjectMaxPath()
}
static void MoveSystemIncludesToEnd(std::vector<std::string>& includeDirs,
- const std::string& config,
- const std::string& lang,
- const cmGeneratorTarget* target)
+ std::string const& config,
+ std::string const& lang,
+ cmGeneratorTarget const* target)
{
if (!target) {
return;
@@ -273,9 +320,9 @@ static void MoveSystemIncludesToEnd(std::vector<std::string>& includeDirs,
}
static void MoveSystemIncludesToEnd(std::vector<BT<std::string>>& includeDirs,
- const std::string& config,
- const std::string& lang,
- const cmGeneratorTarget* target)
+ std::string const& config,
+ std::string const& lang,
+ cmGeneratorTarget const* target)
{
if (!target) {
return;
@@ -293,8 +340,8 @@ static void MoveSystemIncludesToEnd(std::vector<BT<std::string>>& includeDirs,
void cmLocalGenerator::TraceDependencies() const
{
// Generate the rule files for each target.
- const auto& targets = this->GetGeneratorTargets();
- for (const auto& target : targets) {
+ auto const& targets = this->GetGeneratorTargets();
+ for (auto const& target : targets) {
if (!target->IsInBuildSystem()) {
continue;
}
@@ -316,9 +363,9 @@ void cmLocalGenerator::GenerateTestFiles()
std::string file =
cmStrCat(this->StateSnapshot.GetDirectory().GetCurrentBinary(),
"/CTestTestfile.cmake");
+ this->GlobalGenerator->AddTestFile(file);
cmGeneratedFileStream fout(file);
- fout.SetCopyIfDifferent(true);
fout << "# CMake generated Testfile for \n"
"# Source directory: "
@@ -353,7 +400,7 @@ void cmLocalGenerator::GenerateTestFiles()
}
// Ask each test generator to write its code.
- for (const auto& tester : this->Makefile->GetTestGenerators()) {
+ for (auto const& tester : this->Makefile->GetTestGenerators()) {
tester->Compute(this);
tester->Generate(fout, config, configurationTypes);
}
@@ -398,7 +445,7 @@ void cmLocalGenerator::CreateEvaluationFileOutputs()
void cmLocalGenerator::CreateEvaluationFileOutputs(std::string const& config)
{
- for (const auto& geef : this->Makefile->GetEvaluationFiles()) {
+ for (auto const& geef : this->Makefile->GetEvaluationFiles()) {
geef->CreateOutputFile(this, config);
}
}
@@ -406,7 +453,7 @@ void cmLocalGenerator::CreateEvaluationFileOutputs(std::string const& config)
void cmLocalGenerator::ProcessEvaluationFiles(
std::vector<std::string>& generatedFiles)
{
- for (const auto& geef : this->Makefile->GetEvaluationFiles()) {
+ for (auto const& geef : this->Makefile->GetEvaluationFiles()) {
geef->Generate(this);
if (cmSystemTools::GetFatalErrorOccurred()) {
return;
@@ -479,9 +526,9 @@ void cmLocalGenerator::GenerateInstallRules()
// Choose a default install configuration.
std::string default_config = config;
- const char* default_order[] = { "RELEASE", "MINSIZEREL", "RELWITHDEBINFO",
+ char const* default_order[] = { "RELEASE", "MINSIZEREL", "RELWITHDEBINFO",
"DEBUG", nullptr };
- for (const char** c = default_order; *c && default_config.empty(); ++c) {
+ for (char const** c = default_order; *c && default_config.empty(); ++c) {
for (std::string const& configurationType : configurationTypes) {
if (cmSystemTools::UpperCase(configurationType) == *c) {
default_config = configurationType;
@@ -502,7 +549,6 @@ void cmLocalGenerator::GenerateInstallRules()
file += "/cmake_install.cmake";
this->GetGlobalGenerator()->AddInstallScript(file);
cmGeneratedFileStream fout(file);
- fout.SetCopyIfDifferent(true);
// Write the header.
/* clang-format off */
@@ -662,13 +708,13 @@ void cmLocalGenerator::GenerateInstallRules()
bool haveSubdirectoryInstall = false;
bool haveInstallAfterSubdirectory = false;
if (status == cmPolicies::WARN) {
- for (const auto& installer : installers) {
+ for (auto const& installer : installers) {
installer->CheckCMP0082(haveSubdirectoryInstall,
haveInstallAfterSubdirectory);
installer->Generate(fout, config, configurationTypes);
}
} else {
- for (const auto& installer : installers) {
+ for (auto const& installer : installers) {
installer->Generate(fout, config, configurationTypes);
}
}
@@ -705,8 +751,6 @@ void cmLocalGenerator::GenerateInstallRules()
}
} break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// NEW behavior is handled in
// cmInstallSubdirectoryGenerator::GenerateScript()
@@ -772,7 +816,7 @@ void cmLocalGenerator::AddOwnedImportedGeneratorTarget(
}
cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
- const std::string& name) const
+ std::string const& name) const
{
auto ti = this->GeneratorTargetSearchIndex.find(name);
if (ti != this->GeneratorTargetSearchIndex.end()) {
@@ -788,8 +832,8 @@ void cmLocalGenerator::ComputeTargetManifest()
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
// Add our targets to the manifest for each configuration.
- const auto& targets = this->GetGeneratorTargets();
- for (const auto& target : targets) {
+ auto const& targets = this->GetGeneratorTargets();
+ for (auto const& target : targets) {
if (!target->IsInBuildSystem()) {
continue;
}
@@ -817,8 +861,8 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures()
}
// Process compile features of all targets.
- const auto& targets = this->GetGeneratorTargets();
- for (const auto& target : targets) {
+ auto const& targets = this->GetGeneratorTargets();
+ for (auto const& target : targets) {
for (std::string const& c : configNames) {
if (!target->ComputeCompileFeatures(c)) {
return false;
@@ -853,8 +897,8 @@ cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const
}
std::string cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
- const std::string& prop,
- const std::string& config)
+ std::string const& prop,
+ std::string const& config)
{
cmValue value = this->Makefile->GetProperty(prop);
if (target) {
@@ -975,8 +1019,8 @@ std::string cmLocalGenerator::GetIncludeFlags(
void cmLocalGenerator::AddCompileOptions(std::string& flags,
cmGeneratorTarget* target,
- const std::string& lang,
- const std::string& config)
+ std::string const& lang,
+ std::string const& config)
{
std::vector<BT<std::string>> tmpFlags;
this->AddCompileOptions(tmpFlags, target, lang, config);
@@ -985,8 +1029,8 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
cmGeneratorTarget* target,
- const std::string& lang,
- const std::string& config)
+ std::string const& lang,
+ std::string const& config)
{
std::string langFlagRegexVar = cmStrCat("CMAKE_", lang, "_FLAG_REGEX");
@@ -1051,9 +1095,9 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
}
// Add Warning as errors flags
- if (!this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
- const cmValue wError = target->GetProperty("COMPILE_WARNING_AS_ERROR");
- const cmValue wErrorOpts = this->Makefile->GetDefinition(
+ if (!this->GetCMakeInstance()->GetIgnoreCompileWarningAsError()) {
+ cmValue const wError = target->GetProperty("COMPILE_WARNING_AS_ERROR");
+ cmValue const wErrorOpts = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_WARNING_AS_ERROR"));
if (wError.IsOn() && wErrorOpts.IsSet()) {
std::string wErrorFlags;
@@ -1093,7 +1137,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
}
cmTarget* cmLocalGenerator::AddCustomCommandToTarget(
- const std::string& target, cmCustomCommandType type,
+ std::string const& target, cmCustomCommandType type,
std::unique_ptr<cmCustomCommand> cc, cmObjectLibraryCommands objLibCommands)
{
cmTarget* t = this->Makefile->GetCustomCommandTarget(
@@ -1125,7 +1169,7 @@ cmSourceFile* cmLocalGenerator::AddCustomCommandToOutput(
}
cmTarget* cmLocalGenerator::AddUtilityCommand(
- const std::string& utilityName, bool excludeFromAll,
+ std::string const& utilityName, bool excludeFromAll,
std::unique_ptr<cmCustomCommand> cc)
{
cmTarget* target =
@@ -1342,7 +1386,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
void cmLocalGenerator::GetIncludeDirectoriesImplicit(
std::vector<std::string>& dirs, cmGeneratorTarget const* target,
- const std::string& lang, const std::string& config, bool stripImplicitDirs,
+ std::string const& lang, std::string const& config, bool stripImplicitDirs,
bool appendAllImplicitDirs) const
{
std::vector<BT<std::string>> tmp = this->GetIncludeDirectoriesImplicit(
@@ -1362,8 +1406,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectories(
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
- const std::string& lang,
- const std::string& config) const
+ std::string const& lang,
+ std::string const& config) const
{
this->GetIncludeDirectoriesImplicit(dirs, target, lang, config);
}
@@ -1382,7 +1426,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags(
std::string const& config, std::string const& linkLanguage,
cmGeneratorTarget* target)
{
- const std::string configUpper = cmSystemTools::UpperCase(config);
+ std::string const configUpper = cmSystemTools::UpperCase(config);
std::vector<BT<std::string>> flags;
if (linkLanguage != "Swift" && !this->IsSplitSwiftBuild()) {
std::string staticLibFlags;
@@ -1420,7 +1464,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags(
}
void cmLocalGenerator::GetDeviceLinkFlags(
- cmLinkLineDeviceComputer& linkLineComputer, const std::string& config,
+ cmLinkLineDeviceComputer& linkLineComputer, std::string const& config,
std::string& linkLibs, std::string& linkFlags, std::string& frameworkPath,
std::string& linkPath, cmGeneratorTarget* target)
{
@@ -1459,7 +1503,7 @@ void cmLocalGenerator::GetDeviceLinkFlags(
}
void cmLocalGenerator::GetTargetFlags(
- cmLinkLineComputer* linkLineComputer, const std::string& config,
+ cmLinkLineComputer* linkLineComputer, std::string const& config,
std::string& linkLibs, std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target)
{
@@ -1474,17 +1518,17 @@ void cmLocalGenerator::GetTargetFlags(
}
void cmLocalGenerator::GetTargetFlags(
- cmLinkLineComputer* linkLineComputer, const std::string& config,
+ cmLinkLineComputer* linkLineComputer, std::string const& config,
std::vector<BT<std::string>>& linkLibs, std::string& flags,
std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath,
std::vector<BT<std::string>>& linkPath, cmGeneratorTarget* target)
{
- const std::string configUpper = cmSystemTools::UpperCase(config);
+ std::string const configUpper = cmSystemTools::UpperCase(config);
cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
- const char* libraryLinkVariable =
+ char const* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
- const std::string linkLanguage =
+ std::string const linkLanguage =
linkLineComputer->GetLinkerLanguage(target, config);
switch (target->GetType()) {
@@ -1495,17 +1539,16 @@ void cmLocalGenerator::GetTargetFlags(
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
CM_FALLTHROUGH;
case cmStateEnums::SHARED_LIBRARY: {
- std::string sharedLibFlags;
if (this->IsSplitSwiftBuild() || linkLanguage != "Swift") {
- sharedLibFlags = cmStrCat(
- this->Makefile->GetSafeDefinition(libraryLinkVariable), ' ');
- if (!configUpper.empty()) {
- std::string build = cmStrCat(libraryLinkVariable, '_', configUpper);
- sharedLibFlags += this->Makefile->GetSafeDefinition(build);
- sharedLibFlags += " ";
+ std::string libFlags;
+ this->AddConfigVariableFlags(libFlags, libraryLinkVariable, target,
+ cmBuildStep::Link, linkLanguage, config);
+ if (!libFlags.empty()) {
+ linkFlags.emplace_back(std::move(libFlags));
}
}
+ std::string sharedLibFlags;
cmValue targetLinkFlags = target->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
sharedLibFlags += *targetLinkFlags;
@@ -1538,7 +1581,6 @@ void cmLocalGenerator::GetTargetFlags(
}
} break;
case cmStateEnums::EXECUTABLE: {
- std::string exeFlags;
if (linkLanguage.empty()) {
cmSystemTools::Error(
"CMake can not determine linker language for target: " +
@@ -1547,25 +1589,28 @@ void cmLocalGenerator::GetTargetFlags(
}
if (linkLanguage != "Swift") {
- exeFlags = this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
- exeFlags += " ";
- if (!configUpper.empty()) {
- exeFlags += this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_EXE_LINKER_FLAGS_", configUpper));
- exeFlags += " ";
+ std::string exeFlags;
+ this->AddConfigVariableFlags(exeFlags, "CMAKE_EXE_LINKER_FLAGS",
+ target, cmBuildStep::Link, linkLanguage,
+ config);
+ if (!exeFlags.empty()) {
+ linkFlags.emplace_back(std::move(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 += " ";
+ {
+ auto exeType = cmStrCat(
+ "CMAKE_", linkLanguage, "_CREATE_",
+ (target->IsWin32Executable(config) ? "WIN32" : "CONSOLE"), "_EXE");
+ std::string exeFlags;
+ this->AppendFlags(exeFlags, this->Makefile->GetDefinition(exeType),
+ exeType, target, cmBuildStep::Link, linkLanguage);
+ if (!exeFlags.empty()) {
+ linkFlags.emplace_back(std::move(exeFlags));
+ }
}
+ std::string exeFlags;
if (target->IsExecutableWithExports()) {
exeFlags += this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG"));
@@ -1584,10 +1629,10 @@ void cmLocalGenerator::GetTargetFlags(
exeFlags += " ";
}
- std::string cmp0065Flags =
- this->GetLinkLibsCMP0065(linkLanguage, *target);
- if (!cmp0065Flags.empty()) {
- exeFlags += cmp0065Flags;
+ std::string exeExportFlags =
+ this->GetExeExportFlags(linkLanguage, *target);
+ if (!exeExportFlags.empty()) {
+ exeFlags += exeExportFlags;
exeFlags += " ";
}
@@ -1625,6 +1670,7 @@ void cmLocalGenerator::GetTargetFlags(
this->AppendLinkerTypeFlags(extraLinkFlags, target, config, linkLanguage);
this->AppendPositionIndependentLinkerFlags(extraLinkFlags, target, config,
linkLanguage);
+ this->AppendWarningAsErrorLinkerFlags(extraLinkFlags, target, linkLanguage);
this->AppendIPOLinkerFlags(extraLinkFlags, target, config, linkLanguage);
this->AppendModuleDefinitionFlag(extraLinkFlags, target, linkLineComputer,
config);
@@ -1703,7 +1749,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetTargetCompileFlags(
}
}
- this->AddCMP0018Flags(compileFlags, target, lang, config);
+ this->AddFeatureFlags(compileFlags, target, lang, config);
this->AddVisibilityPresetFlags(compileFlags, target, lang);
this->AddColorDiagnosticsFlags(compileFlags, lang);
this->AppendFlags(compileFlags, mf->GetDefineFlags());
@@ -1831,7 +1877,7 @@ std::set<BT<std::string>> cmLocalGenerator::GetTargetDefines(
std::set<BT<std::string>> defines;
// Add the export symbol definition for shared library objects.
- if (const std::string* exportMacro = target->GetExportMacro()) {
+ if (std::string const* exportMacro = target->GetExportMacro()) {
this->AppendDefines(defines, *exportMacro);
}
@@ -1913,52 +1959,18 @@ void cmLocalGenerator::OutputLinkLibraries(
linkLineComputer->ComputeLinkLibraries(cli, stdLibString, linkLibraries);
}
-std::string cmLocalGenerator::GetLinkLibsCMP0065(
+std::string cmLocalGenerator::GetExeExportFlags(
std::string const& linkLanguage, cmGeneratorTarget& tgt) const
{
std::string linkFlags;
- // Flags to link an executable to shared libraries.
+ // Flags to export symbols from an executable.
if (tgt.GetType() == cmStateEnums::EXECUTABLE &&
this->StateSnapshot.GetState()->GetGlobalPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS")) {
- bool add_shlib_flags = false;
- switch (tgt.GetPolicyStatusCMP0065()) {
- case cmPolicies::WARN:
- if (!tgt.GetPropertyAsBool("ENABLE_EXPORTS") &&
- this->Makefile->PolicyOptionalWarningEnabled(
- "CMAKE_POLICY_WARNING_CMP0065")) {
- std::ostringstream w;
- /* clang-format off */
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n"
- "For compatibility with older versions of CMake, "
- "additional flags may be added to export symbols on all "
- "executables regardless of their ENABLE_EXPORTS property.";
- /* clang-format on */
- this->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to always add the flags, except on AIX where
- // we compute symbol exports if ENABLE_EXPORTS is on.
- add_shlib_flags =
- !(tgt.IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS"));
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065));
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior is to only add the flags if ENABLE_EXPORTS is on,
- // except on AIX where we compute symbol exports.
- add_shlib_flags =
- !tgt.IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS");
- break;
- }
-
- if (add_shlib_flags) {
+ // Only add the flags if ENABLE_EXPORTS is on,
+ // except on AIX where we compute symbol exports.
+ if (!tgt.IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS")) {
linkFlags = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_SHARED_LIBRARY_LINK_", linkLanguage, "_FLAGS"));
}
@@ -1967,7 +1979,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
}
bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame(
- const std::vector<std::string>& archs, cmValue sysroot)
+ std::vector<std::string> const& archs, cmValue sysroot)
{
if (!sysroot) {
return false;
@@ -1983,9 +1995,9 @@ bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame(
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
- const std::string& lang,
- const std::string& config,
- const std::string& filterArch)
+ std::string const& lang,
+ std::string const& config,
+ std::string const& filterArch)
{
// Only add Apple specific flags on Apple platforms
if (target->IsApple() && this->EmitUniversalBinaryFlags) {
@@ -2002,6 +2014,11 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
cmValue sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ if (sysroot.IsEmpty() &&
+ this->Makefile->IsOn(
+ cmStrCat("CMAKE_", lang, "_COMPILER_APPLE_SYSROOT_REQUIRED"))) {
+ sysroot = this->Makefile->GetDefinition("_CMAKE_OSX_SYSROOT_PATH");
+ }
if (sysroot && *sysroot == "/") {
sysroot = nullptr;
}
@@ -2047,7 +2064,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::string flag = *deploymentTargetFlag;
// Add the deployment target architecture to the flag, if needed.
- static const std::string kARCH = "<ARCH>";
+ static std::string const kARCH = "<ARCH>";
std::string::size_type archPos = flag.find(kARCH);
if (archPos != std::string::npos) {
// This placeholder is meant for visionOS, so default to arm64
@@ -2061,7 +2078,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
// Add the deployment target version to the flag.
- static const std::string kVERSION_MIN = "<VERSION_MIN>";
+ static std::string const kVERSION_MIN = "<VERSION_MIN>";
std::string::size_type verPos = flag.find(kVERSION_MIN);
if (verPos != std::string::npos) {
// Replace the placeholder with its value.
@@ -2082,8 +2099,8 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
cmGeneratorTarget const* target,
cmBuildStep compileOrLink,
- const std::string& lang,
- const std::string& config)
+ std::string const& lang,
+ std::string const& config)
{
// Add language-specific flags.
this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
@@ -2113,12 +2130,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
}
- std::string compiler = this->Makefile->GetSafeDefinition(
+ std::string compilerId = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_COMPILER_ID"));
std::string compilerSimulateId = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_SIMULATE_ID"));
+ bool const compilerTargetsMsvcABI =
+ (compilerId == "MSVC" || compilerSimulateId == "MSVC");
+ bool const compilerTargetsWatcomABI =
+ (compilerId == "OpenWatcom" || compilerSimulateId == "OpenWatcom");
+
if (lang == "Swift") {
if (cmValue v = target->GetProperty("Swift_LANGUAGE_VERSION")) {
if (cmSystemTools::VersionCompare(
@@ -2136,12 +2158,12 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
} else if (lang == "RC" &&
this->Makefile->GetSafeDefinition("CMAKE_RC_COMPILER")
.find("llvm-rc") != std::string::npos) {
- compiler = this->Makefile->GetSafeDefinition("CMAKE_C_COMPILER_ID");
- if (!compiler.empty()) {
+ compilerId = this->Makefile->GetSafeDefinition("CMAKE_C_COMPILER_ID");
+ if (!compilerId.empty()) {
compilerSimulateId =
this->Makefile->GetSafeDefinition("CMAKE_C_SIMULATE_ID");
} else {
- compiler = this->Makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_ID");
+ compilerId = this->Makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_ID");
compilerSimulateId =
this->Makefile->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID");
}
@@ -2150,7 +2172,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
// Add VFS Overlay for Clang compilers
- if (compiler == "Clang") {
+ if (compilerId == "Clang") {
if (cmValue vfsOverlay =
this->Makefile->GetDefinition("CMAKE_CLANG_VFS_OVERLAY")) {
if (compilerSimulateId == "MSVC") {
@@ -2181,10 +2203,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
"CMAKE_" + lang + "_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_" +
msvcRuntimeLibrary)) {
this->AppendCompileOptions(flags, *msvcRuntimeLibraryOptions);
- } else if ((this->Makefile->GetSafeDefinition(
- "CMAKE_" + lang + "_COMPILER_ID") == "MSVC" ||
- this->Makefile->GetSafeDefinition(
- "CMAKE_" + lang + "_SIMULATE_ID") == "MSVC") &&
+ } else if (compilerTargetsMsvcABI &&
!cmSystemTools::GetErrorOccurredFlag()) {
// The compiler uses the MSVC ABI so it needs a known runtime library.
this->IssueMessage(MessageType::FATAL_ERROR,
@@ -2212,10 +2231,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
"CMAKE_" + lang + "_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_" +
watcomRuntimeLibrary)) {
this->AppendCompileOptions(flags, *watcomRuntimeLibraryOptions);
- } else if ((this->Makefile->GetSafeDefinition(
- "CMAKE_" + lang + "_COMPILER_ID") == "OpenWatcom" ||
- this->Makefile->GetSafeDefinition(
- "CMAKE_" + lang + "_SIMULATE_ID") == "OpenWatcom") &&
+ } else if (compilerTargetsWatcomABI &&
!cmSystemTools::GetErrorOccurredFlag()) {
// The compiler uses the Watcom ABI so it needs a known runtime
// library.
@@ -2227,6 +2243,49 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
}
+ // Add MSVC runtime checks flags. This is activated by the presence
+ // of a default selection whether or not it is overridden by a property.
+ cmValue msvcRuntimeChecksDefault =
+ this->Makefile->GetDefinition("CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT");
+ if (cmNonempty(msvcRuntimeChecksDefault)) {
+ cmValue msvcRuntimeChecksValue =
+ target->GetProperty("MSVC_RUNTIME_CHECKS");
+ if (!msvcRuntimeChecksValue) {
+ msvcRuntimeChecksValue = msvcRuntimeChecksDefault;
+ }
+ cmList msvcRuntimeChecksList = cmGeneratorExpression::Evaluate(
+ *msvcRuntimeChecksValue, this, config, target);
+ msvcRuntimeChecksList.remove_duplicates();
+
+ // RTC1/RTCsu VS GUI workaround
+ std::string const stackFrameErrorCheck = "StackFrameErrorCheck";
+ std::string const unitinitializedVariable = "UninitializedVariable";
+ std::string const rtcSU = "RTCsu";
+ if ((cm::contains(msvcRuntimeChecksList, stackFrameErrorCheck) &&
+ cm::contains(msvcRuntimeChecksList, unitinitializedVariable)) ||
+ cm::contains(msvcRuntimeChecksList, rtcSU)) {
+ msvcRuntimeChecksList.remove_items(
+ { stackFrameErrorCheck, unitinitializedVariable, rtcSU });
+ msvcRuntimeChecksList.append(rtcSU);
+ }
+
+ for (std::string const& msvcRuntimeChecks : msvcRuntimeChecksList) {
+ if (cmValue msvcRuntimeChecksOptions =
+ this->Makefile->GetDefinition(cmStrCat(
+ "CMAKE_", lang,
+ "_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_" + msvcRuntimeChecks))) {
+ this->AppendCompileOptions(flags, *msvcRuntimeChecksOptions);
+ } else if (compilerTargetsMsvcABI &&
+ !cmSystemTools::GetErrorOccurredFlag()) {
+ // The compiler uses the MSVC ABI so it needs a known runtime checks.
+ this->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("MSVC_RUNTIME_CHECKS value '",
+ msvcRuntimeChecks, "' not known for this ",
+ lang, " compiler."));
+ }
+ }
+ }
+
// Add MSVC debug information format flags if CMP0141 is NEW.
if (cm::optional<std::string> msvcDebugInformationFormat =
this->GetMSVCDebugFormatName(config, target)) {
@@ -2237,10 +2296,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
"_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_",
*msvcDebugInformationFormat))) {
this->AppendCompileOptions(flags, *msvcDebugInformationFormatOptions);
- } else if ((this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_", lang, "_COMPILER_ID")) == "MSVC"_s ||
- this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_", lang, "_SIMULATE_ID")) == "MSVC"_s) &&
+ } else if (compilerTargetsMsvcABI &&
!cmSystemTools::GetErrorOccurredFlag()) {
// The compiler uses the MSVC ABI so it needs a known runtime library.
this->IssueMessage(MessageType::FATAL_ERROR,
@@ -2254,8 +2310,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
void cmLocalGenerator::AddLanguageFlagsForLinking(
- std::string& flags, cmGeneratorTarget const* target, const std::string& lang,
- const std::string& config)
+ std::string& flags, cmGeneratorTarget const* target, std::string const& lang,
+ std::string const& config)
{
this->AddLanguageFlags(flags, target, cmBuildStep::Link, lang, config);
@@ -2265,7 +2321,7 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
}
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
- const std::string& name) const
+ std::string const& name) const
{
auto imported = this->ImportedGeneratorTargets.find(name);
if (imported != this->ImportedGeneratorTargets.end()) {
@@ -2288,8 +2344,8 @@ cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
return this->GetGlobalGenerator()->FindGeneratorTarget(name);
}
-bool cmLocalGenerator::GetRealDependency(const std::string& inName,
- const std::string& config,
+bool cmLocalGenerator::GetRealDependency(std::string const& inName,
+ std::string const& config,
std::string& dep)
{
// Older CMake code may specify the dependency using the target
@@ -2378,29 +2434,15 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
dep = cmStrCat(this->GetCurrentBinaryDirectory(), '/', inName);
}
- dep = cmSystemTools::CollapseFullPath(dep, this->GetBinaryDirectory());
+ dep = cmSystemTools::CollapseFullPath(dep);
return true;
}
-void cmLocalGenerator::AddSharedFlags(std::string& flags,
- const std::string& lang, bool shared)
-{
- std::string flagsVar;
-
- // Add flags for dealing with shared libraries for this language.
- if (shared) {
- this->AppendFlags(flags,
- this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS")));
- }
-}
-
static void AddVisibilityCompileOption(std::string& flags,
cmGeneratorTarget const* target,
cmLocalGenerator* lg,
- const std::string& lang,
- std::string* warnCMP0063)
+ std::string const& lang)
{
std::string compileOption = "CMAKE_" + lang + "_COMPILE_OPTIONS_VISIBILITY";
cmValue opt = lg->GetMakefile()->GetDefinition(compileOption);
@@ -2413,10 +2455,6 @@ static void AddVisibilityCompileOption(std::string& flags,
if (!prop) {
return;
}
- if (warnCMP0063) {
- *warnCMP0063 += " " + flagDefine + "\n";
- return;
- }
if ((*prop != "hidden") && (*prop != "default") && (*prop != "protected") &&
(*prop != "internal")) {
std::ostringstream e;
@@ -2434,8 +2472,7 @@ static void AddVisibilityCompileOption(std::string& flags,
static void AddInlineVisibilityCompileOption(std::string& flags,
cmGeneratorTarget const* target,
cmLocalGenerator* lg,
- std::string* warnCMP0063,
- const std::string& lang)
+ std::string const& lang)
{
std::string compileOption =
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN");
@@ -2448,118 +2485,40 @@ static void AddInlineVisibilityCompileOption(std::string& flags,
if (!prop) {
return;
}
- if (warnCMP0063) {
- *warnCMP0063 += " VISIBILITY_INLINES_HIDDEN\n";
- return;
- }
lg->AppendFlags(flags, *opt);
}
void cmLocalGenerator::AddVisibilityPresetFlags(
- std::string& flags, cmGeneratorTarget const* target, const std::string& lang)
+ std::string& flags, cmGeneratorTarget const* target, std::string const& lang)
{
if (lang.empty()) {
return;
}
- std::string warnCMP0063;
- std::string* pWarnCMP0063 = nullptr;
- if (target->GetType() != cmStateEnums::SHARED_LIBRARY &&
- target->GetType() != cmStateEnums::MODULE_LIBRARY &&
- !target->IsExecutableWithExports()) {
- switch (target->GetPolicyStatusCMP0063()) {
- case cmPolicies::OLD:
- return;
- case cmPolicies::WARN:
- pWarnCMP0063 = &warnCMP0063;
- break;
- default:
- break;
- }
- }
-
- AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063);
+ AddVisibilityCompileOption(flags, target, this, lang);
if (lang == "CXX" || lang == "OBJCXX") {
- AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063, lang);
- }
-
- if (!warnCMP0063.empty() && this->WarnCMP0063.insert(target).second) {
- std::ostringstream w;
- /* clang-format off */
- w <<
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n"
- "Target \"" << target->GetName() << "\" of "
- "type \"" << cmState::GetTargetTypeName(target->GetType()) << "\" "
- "has the following visibility properties set for " << lang << ":\n" <<
- warnCMP0063 <<
- "For compatibility CMake is not honoring them for this target.";
- /* clang-format on */
- target->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
- MessageType::AUTHOR_WARNING, w.str(), target->GetBacktrace());
+ AddInlineVisibilityCompileOption(flags, target, this, lang);
}
}
-void cmLocalGenerator::AddCMP0018Flags(std::string& flags,
+void cmLocalGenerator::AddFeatureFlags(std::string& flags,
cmGeneratorTarget const* target,
std::string const& lang,
- const std::string& config)
+ std::string const& config)
{
int targetType = target->GetType();
bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) ||
(targetType == cmStateEnums::MODULE_LIBRARY));
- if (this->GetShouldUseOldFlags(shared, lang)) {
- this->AddSharedFlags(flags, lang, shared);
- } else {
- if (target->GetLinkInterfaceDependentBoolProperty(
- "POSITION_INDEPENDENT_CODE", config)) {
- this->AddPositionIndependentFlags(flags, lang, targetType);
- }
- if (shared) {
- this->AppendFeatureOptions(flags, lang, "DLL");
- }
+ if (target->GetLinkInterfaceDependentBoolProperty(
+ "POSITION_INDEPENDENT_CODE", config)) {
+ this->AddPositionIndependentFlags(flags, lang, targetType);
}
-}
-
-bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
- const std::string& lang) const
-{
- std::string originalFlags =
- this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang);
if (shared) {
- std::string flagsVar = cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS");
- std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar);
-
- if (flags != originalFlags) {
- switch (this->GetPolicyStatus(cmPolicies::CMP0018)) {
- case cmPolicies::WARN: {
- std::ostringstream e;
- e << "Variable " << flagsVar
- << " has been modified. CMake "
- "will ignore the POSITION_INDEPENDENT_CODE target property "
- "for "
- "shared libraries and will use the "
- << flagsVar
- << " variable "
- "instead. This may cause errors if the original content of "
- << flagsVar << " was removed.\n"
- << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018);
-
- this->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD:
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- return false;
- }
- }
+ this->AppendFeatureOptions(flags, lang, "DLL");
}
- return false;
}
void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
@@ -2585,7 +2544,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
}
void cmLocalGenerator::AddColorDiagnosticsFlags(std::string& flags,
- const std::string& lang)
+ std::string const& lang)
{
cmValue diag = this->Makefile->GetDefinition("CMAKE_COLOR_DIAGNOSTICS");
if (diag.IsSet()) {
@@ -2607,21 +2566,34 @@ void cmLocalGenerator::AddColorDiagnosticsFlags(std::string& flags,
}
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
- const std::string& var,
- const std::string& config)
+ std::string const& var,
+ std::string const& config)
{
// Add the flags from the variable itself.
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(var));
// Add the flags from the build-type specific variable.
if (!config.empty()) {
- const std::string flagsVar =
+ std::string const flagsVar =
cmStrCat(var, '_', cmSystemTools::UpperCase(config));
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(flagsVar));
}
}
+void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
+ std::string const& var,
+ cmGeneratorTarget const* target,
+ cmBuildStep compileOrLink,
+ std::string const& lang,
+ std::string const& config)
+{
+ std::string newFlags;
+ this->AddConfigVariableFlags(newFlags, var, config);
+ if (!newFlags.empty()) {
+ this->AppendFlags(flags, newFlags, var, target, compileOrLink, lang);
+ }
+}
void cmLocalGenerator::AppendFlags(std::string& flags,
- const std::string& newFlags) const
+ std::string const& newFlags) const
{
bool allSpaces = std::all_of(newFlags.begin(), newFlags.end(), cmIsSpace);
@@ -2634,7 +2606,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
}
void cmLocalGenerator::AppendFlags(
- std::string& flags, const std::vector<BT<std::string>>& newFlags) const
+ std::string& flags, std::vector<BT<std::string>> const& newFlags) const
{
for (BT<std::string> const& flag : newFlags) {
this->AppendFlags(flags, flag.Value);
@@ -2642,13 +2614,60 @@ void cmLocalGenerator::AppendFlags(
}
void cmLocalGenerator::AppendFlagEscape(std::string& flags,
- const std::string& rawFlag) const
+ std::string const& rawFlag) const
{
this->AppendFlags(
flags,
this->EscapeForShell(rawFlag, false, false, false, this->IsNinjaMulti()));
}
+void cmLocalGenerator::AppendFlags(std::string& flags,
+ std::string const& newFlags,
+ std::string const& name,
+ cmGeneratorTarget const* target,
+ cmBuildStep compileOrLink,
+ std::string const& language)
+{
+ switch (target->GetPolicyStatusCMP0181()) {
+ case cmPolicies::WARN:
+ if (!this->Makefile->GetCMakeInstance()->GetIsInTryCompile() &&
+ this->Makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0181")) {
+ this->Makefile->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0181),
+ "\nSince the policy is not set, the contents of variable '",
+ name,
+ "' will "
+ "be used as is."),
+ target->GetBacktrace());
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ this->AppendFlags(
+ flags, this->GetGlobalGenerator()->GetEncodedLiteral(newFlags));
+ break;
+ case cmPolicies::NEW:
+ if (compileOrLink == cmBuildStep::Link) {
+ std::vector<std::string> options;
+ cmSystemTools::ParseUnixCommandLine(newFlags.c_str(), options);
+ this->SetLinkScriptShell(this->GlobalGenerator->GetUseLinkScript());
+ std::vector<BT<std::string>> optionsWithBT{ options.size() };
+ std::transform(options.cbegin(), options.cend(), optionsWithBT.begin(),
+ [](std::string const& item) -> BT<std::string> {
+ return BT<std::string>{ item };
+ });
+ target->ResolveLinkerWrapper(optionsWithBT, language);
+ for (auto const& item : optionsWithBT) {
+ this->AppendFlagEscape(flags, item.Value);
+ }
+ this->SetLinkScriptShell(false);
+ } else {
+ this->AppendFlags(flags, newFlags);
+ }
+ }
+}
+
void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
{
std::vector<std::string> enabledLanguages =
@@ -2663,7 +2682,7 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
std::vector<std::string> ispcArchSuffixes =
detail::ComputeISPCObjectSuffixes(target);
- const bool extra_objects = (ispcArchSuffixes.size() > 1);
+ bool const extra_objects = (ispcArchSuffixes.size() > 1);
std::vector<std::string> configsList =
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
@@ -2683,7 +2702,7 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
// generating
for (cmSourceFile const* sf : sources) {
// Generate this object file's rule file.
- const std::string& lang = sf->GetLanguage();
+ std::string const& lang = sf->GetLanguage();
if (lang == "ISPC") {
std::string const& objectName = target->GetObjectName(sf);
@@ -2717,21 +2736,21 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, config);
- const std::string configUpper = cmSystemTools::UpperCase(config);
- static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC",
+ std::string const configUpper = cmSystemTools::UpperCase(config);
+ static std::array<std::string, 4> const langs = { { "C", "CXX", "OBJC",
"OBJCXX" } };
std::set<std::string> pchLangSet;
if (this->GetGlobalGenerator()->IsXcode()) {
- for (const std::string& lang : langs) {
- const std::string pchHeader = target->GetPchHeader(config, lang, "");
+ for (std::string const& lang : langs) {
+ std::string const pchHeader = target->GetPchHeader(config, lang, "");
if (!pchHeader.empty()) {
pchLangSet.emplace(lang);
}
}
}
- for (const std::string& lang : langs) {
+ for (std::string const& lang : langs) {
auto langSources = std::count_if(
sources.begin(), sources.end(), [lang](cmSourceFile* sf) {
return lang == sf->GetLanguage() &&
@@ -2744,8 +2763,8 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
std::vector<std::string> pchArchs = target->GetPchArchs(config, lang);
if (pchArchs.size() > 1) {
std::string useMultiArchPch;
- for (const std::string& arch : pchArchs) {
- const std::string pchHeader =
+ for (std::string const& arch : pchArchs) {
+ std::string const pchHeader =
target->GetPchHeader(config, lang, arch);
if (!pchHeader.empty()) {
useMultiArchPch = cmStrCat(useMultiArchPch, ";-Xarch_", arch,
@@ -2761,14 +2780,14 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
}
}
- for (const std::string& arch : pchArchs) {
- const std::string pchSource = target->GetPchSource(config, lang, arch);
- const std::string pchHeader = target->GetPchHeader(config, lang, arch);
+ for (std::string const& arch : pchArchs) {
+ std::string const pchSource = target->GetPchSource(config, lang, arch);
+ std::string const pchHeader = target->GetPchHeader(config, lang, arch);
if (pchSource.empty() || pchHeader.empty()) {
if (this->GetGlobalGenerator()->IsXcode() && !pchLangSet.empty()) {
for (auto* sf : sources) {
- const auto sourceLanguage = sf->GetLanguage();
+ auto const sourceLanguage = sf->GetLanguage();
if (!sourceLanguage.empty() &&
pchLangSet.find(sourceLanguage) == pchLangSet.end()) {
sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
@@ -2799,7 +2818,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
target->AddSource(pchSource, true);
}
- const std::string pchFile = target->GetPchFile(config, lang, arch);
+ std::string const pchFile = target->GetPchFile(config, lang, arch);
// Exclude the pch files from linking
if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
@@ -2813,15 +2832,15 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
if (this->Makefile->IsOn("CMAKE_PCH_COPY_COMPILE_PDB")) {
- const std::string compilerId =
+ std::string const compilerId =
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_COMPILER_ID"));
- const std::string compilerVersion =
+ std::string const compilerVersion =
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_COMPILER_VERSION"));
- const std::string langFlags =
+ std::string const langFlags =
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_FLAGS_", configUpper));
@@ -2911,18 +2930,18 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
}
void cmLocalGenerator::CopyPchCompilePdb(
- const std::string& config, const std::string& language,
- cmGeneratorTarget* target, const std::string& ReuseFrom,
- cmGeneratorTarget* reuseTarget, const std::vector<std::string>& extensions)
+ std::string const& config, std::string const& language,
+ cmGeneratorTarget* target, std::string const& ReuseFrom,
+ cmGeneratorTarget* reuseTarget, std::vector<std::string> const& extensions)
{
- const std::string pdb_prefix =
+ std::string const pdb_prefix =
this->GetGlobalGenerator()->IsMultiConfig() ? cmStrCat(config, "/") : "";
- const std::string target_compile_pdb_dir =
+ std::string const target_compile_pdb_dir =
cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
target->GetName(), ".dir/");
- const std::string copy_script = cmStrCat(
+ std::string const copy_script = cmStrCat(
target_compile_pdb_dir, "copy_idb_pdb_", config.c_str(), ".cmake");
cmGeneratedFileStream file(copy_script);
@@ -2933,15 +2952,15 @@ void cmLocalGenerator::CopyPchCompilePdb(
<< "# the pdb file is ready to be copied.\n\n";
for (auto const& extension : extensions) {
- const std::string from_file =
+ std::string const from_file =
cmStrCat(reuseTarget->GetLocalGenerator()->GetCurrentBinaryDirectory(),
"/", ReuseFrom, ".dir/${PDB_PREFIX}", ReuseFrom, extension);
- const std::string to_dir =
+ std::string const to_dir =
cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
target->GetName(), ".dir/${PDB_PREFIX}");
- const std::string to_file = cmStrCat(to_dir, ReuseFrom, extension);
+ std::string const to_file = cmStrCat(to_dir, ReuseFrom, extension);
std::string dest_file = to_file;
@@ -2987,7 +3006,7 @@ void cmLocalGenerator::CopyPchCompilePdb(
configGenex(cmStrCat("-DPDB_PREFIX=", pdb_prefix)), configGenex("-P"),
configGenex(copy_script) });
- const char* no_message = "";
+ char const* no_message = "";
std::vector<std::string> outputs;
outputs.push_back(configGenex(
@@ -3085,7 +3104,8 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
cmLocalGenerator::UnitySource cmLocalGenerator::WriteUnitySource(
cmGeneratorTarget* target, std::vector<std::string> const& configs,
cmRange<std::vector<UnityBatchedSource>::const_iterator> sources,
- cmValue beforeInclude, cmValue afterInclude, std::string filename) const
+ cmValue beforeInclude, cmValue afterInclude, std::string filename,
+ std::string const& unityFileDirectory, UnityPathMode pathMode) const
{
cmValue uniqueIdName = target->GetProperty("UNITY_BUILD_UNIQUE_ID");
cmGeneratedFileStream file(
@@ -3108,7 +3128,8 @@ cmLocalGenerator::UnitySource cmLocalGenerator::WriteUnitySource(
}
RegisterUnitySources(target, ubs.Source, filename);
WriteUnitySourceInclude(file, cond, ubs.Source->ResolveFullPath(),
- beforeInclude, afterInclude, uniqueIdName);
+ beforeInclude, afterInclude, uniqueIdName,
+ pathMode, unityFileDirectory);
}
return UnitySource(std::move(filename), perConfig);
@@ -3117,28 +3138,35 @@ cmLocalGenerator::UnitySource cmLocalGenerator::WriteUnitySource(
void cmLocalGenerator::WriteUnitySourceInclude(
std::ostream& unity_file, cm::optional<std::string> const& cond,
std::string const& sf_full_path, cmValue beforeInclude, cmValue afterInclude,
- cmValue uniqueIdName) const
+ cmValue uniqueIdName, UnityPathMode pathMode,
+ std::string const& unityFileDirectory) const
{
if (cond) {
unity_file << "#if " << *cond << "\n";
}
+ std::string pathToHash;
+ std::string relocatableIncludePath;
+ auto PathEqOrSubDir = [](std::string const& a, std::string const& b) {
+ return (cmSystemTools::ComparePath(a, b) ||
+ cmSystemTools::IsSubDirectory(a, b));
+ };
+ auto const path = cmSystemTools::GetFilenamePath(sf_full_path);
+ if (PathEqOrSubDir(path, this->GetBinaryDirectory())) {
+ relocatableIncludePath =
+ cmSystemTools::RelativePath(unityFileDirectory, sf_full_path);
+ pathToHash = "BLD_" +
+ cmSystemTools::RelativePath(this->GetBinaryDirectory(), sf_full_path);
+ } else if (PathEqOrSubDir(path, this->GetSourceDirectory())) {
+ relocatableIncludePath =
+ cmSystemTools::RelativePath(this->GetSourceDirectory(), sf_full_path);
+ pathToHash = "SRC_" + relocatableIncludePath;
+ } else {
+ relocatableIncludePath = sf_full_path;
+ pathToHash = "ABS_" + sf_full_path;
+ }
+
if (cmNonempty(uniqueIdName)) {
- std::string pathToHash;
- auto PathEqOrSubDir = [](std::string const& a, std::string const& b) {
- return (cmSystemTools::ComparePath(a, b) ||
- cmSystemTools::IsSubDirectory(a, b));
- };
- const auto path = cmSystemTools::GetFilenamePath(sf_full_path);
- if (PathEqOrSubDir(path, this->GetBinaryDirectory())) {
- pathToHash = "BLD_" +
- cmSystemTools::RelativePath(this->GetBinaryDirectory(), sf_full_path);
- } else if (PathEqOrSubDir(path, this->GetSourceDirectory())) {
- pathToHash = "SRC_" +
- cmSystemTools::RelativePath(this->GetSourceDirectory(), sf_full_path);
- } else {
- pathToHash = "ABS_" + sf_full_path;
- }
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
unity_file << "/* " << pathToHash << " */\n"
<< "#undef " << *uniqueIdName << "\n"
@@ -3154,7 +3182,11 @@ void cmLocalGenerator::WriteUnitySourceInclude(
unity_file
<< "/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) "
"*/\n";
- unity_file << "#include \"" << sf_full_path << "\"\n";
+ if (pathMode == UnityPathMode::Relative) {
+ unity_file << "#include \"" << relocatableIncludePath << "\"\n";
+ } else {
+ unity_file << "#include \"" << sf_full_path << "\"\n";
+ }
if (afterInclude) {
unity_file << *afterInclude << "\n";
@@ -3190,7 +3222,7 @@ cmLocalGenerator::AddUnityFilesModeAuto(
std::vector<std::string> const& configs,
std::vector<UnityBatchedSource> const& filtered_sources,
cmValue beforeInclude, cmValue afterInclude,
- std::string const& filename_base, size_t batchSize)
+ std::string const& filename_base, UnityPathMode pathMode, size_t batchSize)
{
if (batchSize == 0) {
batchSize = filtered_sources.size();
@@ -3208,7 +3240,7 @@ cmLocalGenerator::AddUnityFilesModeAuto(
auto const end = begin + chunk;
unity_files.emplace_back(this->WriteUnitySource(
target, configs, cmMakeRange(begin, end), beforeInclude, afterInclude,
- std::move(filename)));
+ std::move(filename), filename_base, pathMode));
}
return unity_files;
}
@@ -3219,7 +3251,7 @@ cmLocalGenerator::AddUnityFilesModeGroup(
std::vector<std::string> const& configs,
std::vector<UnityBatchedSource> const& filtered_sources,
cmValue beforeInclude, cmValue afterInclude,
- std::string const& filename_base)
+ std::string const& filename_base, UnityPathMode pathMode)
{
std::vector<UnitySource> unity_files;
@@ -3245,7 +3277,7 @@ cmLocalGenerator::AddUnityFilesModeGroup(
cmStrCat(filename_base, "unity_", name, unity_file_extension(lang));
unity_files.emplace_back(this->WriteUnitySource(
target, configs, cmMakeRange(item.second), beforeInclude, afterInclude,
- std::move(filename)));
+ std::move(filename), filename_base, pathMode));
}
return unity_files;
@@ -3295,7 +3327,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
target->GetName(), ".dir/Unity/");
cmValue batchSizeString = target->GetProperty("UNITY_BUILD_BATCH_SIZE");
- const size_t unityBatchSize = batchSizeString
+ size_t const unityBatchSize = batchSizeString
? static_cast<size_t>(std::atoi(batchSizeString->c_str()))
: 0;
@@ -3303,6 +3335,9 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
target->GetProperty("UNITY_BUILD_CODE_BEFORE_INCLUDE");
cmValue afterInclude = target->GetProperty("UNITY_BUILD_CODE_AFTER_INCLUDE");
cmValue unityMode = target->GetProperty("UNITY_BUILD_MODE");
+ UnityPathMode pathMode = target->GetPropertyAsBool("UNITY_BUILD_RELOCATABLE")
+ ? UnityPathMode::Relative
+ : UnityPathMode::Absolute;
for (std::string lang : { "C", "CXX", "OBJC", "OBJCXX", "CUDA" }) {
std::vector<UnityBatchedSource> filtered_sources;
@@ -3323,11 +3358,11 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
if (!unityMode || *unityMode == "BATCH") {
unity_files = AddUnityFilesModeAuto(
target, lang, configs, filtered_sources, beforeInclude, afterInclude,
- filename_base, unityBatchSize);
+ filename_base, pathMode, unityBatchSize);
} else if (unityMode && *unityMode == "GROUP") {
- unity_files =
- AddUnityFilesModeGroup(target, lang, configs, filtered_sources,
- beforeInclude, afterInclude, filename_base);
+ unity_files = AddUnityFilesModeGroup(
+ target, lang, configs, filtered_sources, beforeInclude, afterInclude,
+ filename_base, pathMode);
} else {
// unity mode is set to an unsupported value
std::string e("Invalid UNITY_BUILD_MODE value of " + *unityMode +
@@ -3346,14 +3381,19 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
unity->SetProperty("COMPILE_DEFINITIONS",
"CMAKE_UNITY_CONFIG_$<UPPER_CASE:$<CONFIG>>");
}
+
+ if (pathMode == UnityPathMode::Relative) {
+ unity->AppendProperty("INCLUDE_DIRECTORIES",
+ this->GetSourceDirectory(), false);
+ }
}
}
}
void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
cmGeneratorTarget* target,
- const std::string& config,
- const std::string& linkLanguage)
+ std::string const& config,
+ std::string const& linkLanguage)
{
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
@@ -3364,12 +3404,11 @@ void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
return;
}
- auto usingLinker =
- cmStrCat("CMAKE_", linkLanguage, "_USING_",
- target->IsDeviceLink() ? "DEVICE_" : "", "LINKER_");
-
- auto format = this->Makefile->GetDefinition(cmStrCat(usingLinker, "MODE"));
- if (format && format != "FLAG"_s) {
+ auto linkMode =
+ cmStrCat("CMAKE_", linkLanguage, target->IsDeviceLink() ? "_DEVICE_" : "_",
+ "LINK_MODE");
+ auto mode = this->Makefile->GetDefinition(linkMode);
+ if (mode && mode != "DRIVER"_s) {
return;
}
@@ -3377,7 +3416,9 @@ void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
if (linkerType.empty()) {
linkerType = "DEFAULT";
}
- usingLinker = cmStrCat(usingLinker, linkerType);
+ auto usingLinker =
+ cmStrCat("CMAKE_", linkLanguage, "_USING_",
+ target->IsDeviceLink() ? "DEVICE_" : "", "LINKER_", linkerType);
auto linkerTypeFlags = this->Makefile->GetDefinition(usingLinker);
if (linkerTypeFlags) {
if (!linkerTypeFlags.IsEmpty()) {
@@ -3386,7 +3427,7 @@ void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
this->AppendFlags(flags, linkerFlags);
}
} else if (linkerType != "DEFAULT"_s) {
- auto isCMakeLinkerType = [](const std::string& type) -> bool {
+ auto isCMakeLinkerType = [](std::string const& type) -> bool {
return std::all_of(type.cbegin(), type.cend(),
[](char c) { return std::isupper(c); });
};
@@ -3407,8 +3448,8 @@ void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
cmGeneratorTarget* target,
- const std::string& config,
- const std::string& lang)
+ std::string const& config,
+ std::string const& lang)
{
if (!target->IsIPOEnabled(lang, config)) {
return;
@@ -3423,7 +3464,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
return;
}
- const std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
+ std::string const name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
cmValue rawFlagsList = this->Makefile->GetDefinition(name);
if (!rawFlagsList) {
return;
@@ -3436,21 +3477,21 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
}
void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
- std::string& flags, cmGeneratorTarget* target, const std::string& config,
- const std::string& lang)
+ std::string& flags, cmGeneratorTarget* target, std::string const& config,
+ std::string const& lang)
{
// For now, only EXECUTABLE is concerned
if (target->GetType() != cmStateEnums::EXECUTABLE) {
return;
}
- const char* PICValue = target->GetLinkPIEProperty(config);
+ char const* PICValue = target->GetLinkPIEProperty(config);
if (!PICValue) {
// POSITION_INDEPENDENT_CODE is not set
return;
}
- const std::string mode = cmIsOn(PICValue) ? "PIE" : "NO_PIE";
+ std::string const mode = cmIsOn(PICValue) ? "PIE" : "NO_PIE";
std::string supported = "CMAKE_" + lang + "_LINK_" + mode + "_SUPPORTED";
if (this->Makefile->GetDefinition(supported).IsOff()) {
@@ -3465,14 +3506,82 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
}
cmList flagsList{ pieFlags };
- for (const auto& flag : flagsList) {
+ for (auto const& flag : flagsList) {
this->AppendFlagEscape(flags, flag);
}
}
+void cmLocalGenerator::AppendWarningAsErrorLinkerFlags(
+ std::string& flags, cmGeneratorTarget* target, std::string const& lang)
+{
+ if (this->GetCMakeInstance()->GetIgnoreLinkWarningAsError()) {
+ return;
+ }
+
+ switch (target->GetType()) {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ break;
+ default:
+ return;
+ }
+
+ auto const wError = target->GetProperty("LINK_WARNING_AS_ERROR");
+ if (wError.IsOff()) {
+ return;
+ }
+ cmList wErrorOptions;
+ if (wError.IsOn()) {
+ wErrorOptions = { "DRIVER", "LINKER" };
+ } else {
+ wErrorOptions = wError;
+ std::sort(wErrorOptions.begin(), wErrorOptions.end());
+ wErrorOptions.erase(
+ std::unique(wErrorOptions.begin(), wErrorOptions.end()),
+ wErrorOptions.end());
+ }
+
+ auto linkModeIsDriver =
+ this->Makefile->GetDefinition(cmStrCat("CMAKE_", lang, "_LINK_MODE")) ==
+ "DRIVER"_s;
+ std::string errorMessage;
+ for (auto const& option : wErrorOptions) {
+ if (option != "DRIVER"_s && option != "LINKER"_s) {
+ errorMessage += cmStrCat(" ", option, '\n');
+ continue;
+ }
+
+ if (option == "DRIVER"_s && !linkModeIsDriver) {
+ continue;
+ }
+
+ auto const wErrorOpts = this->Makefile->GetDefinition(cmStrCat(
+ "CMAKE_", lang, '_', (option == "DRIVER"_s ? "COMPILE" : "LINK"),
+ "_OPTIONS_WARNING_AS_ERROR"));
+ if (wErrorOpts.IsSet()) {
+ auto items =
+ cmExpandListWithBacktrace(wErrorOpts, target->GetBacktrace());
+ if (option == "LINKER"_s) {
+ target->ResolveLinkerWrapper(items, lang);
+ }
+ for (auto const& item : items) {
+ this->AppendFlagEscape(flags, item.Value);
+ }
+ }
+ }
+ if (!errorMessage.empty()) {
+ this->Makefile->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Erroneous value(s) for 'LINK_WARNING_AS_ERROR' property of target '",
+ target->GetName(), "':\n", errorMessage));
+ }
+}
+
void cmLocalGenerator::AppendDependencyInfoLinkerFlags(
- std::string& flags, cmGeneratorTarget* target, const std::string& config,
- const std::string& linkLanguage)
+ std::string& flags, cmGeneratorTarget* target, std::string const& config,
+ std::string const& linkLanguage)
{
if (!this->GetGlobalGenerator()->SupportsLinkerDependencyFile() ||
!target->HasLinkDependencyFile(config)) {
@@ -3500,7 +3609,7 @@ void cmLocalGenerator::AppendDependencyInfoLinkerFlags(
}
std::string cmLocalGenerator::GetLinkDependencyFile(
- cmGeneratorTarget* /*target*/, const std::string& /*config*/) const
+ cmGeneratorTarget* /*target*/, std::string const& /*config*/) const
{
return "link.d";
}
@@ -3532,8 +3641,8 @@ void cmLocalGenerator::AppendModuleDefinitionFlag(
}
bool cmLocalGenerator::AppendLWYUFlags(std::string& flags,
- const cmGeneratorTarget* target,
- const std::string& lang)
+ cmGeneratorTarget const* target,
+ std::string const& lang)
{
auto useLWYU = target->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
(target->GetType() == cmStateEnums::TargetType::EXECUTABLE ||
@@ -3541,7 +3650,7 @@ bool cmLocalGenerator::AppendLWYUFlags(std::string& flags,
target->GetType() == cmStateEnums::TargetType::MODULE_LIBRARY);
if (useLWYU) {
- const auto& lwyuFlag = this->GetMakefile()->GetSafeDefinition(
+ auto const& lwyuFlag = this->GetMakefile()->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_LINK_WHAT_YOU_USE_FLAG"));
useLWYU = !lwyuFlag.empty();
@@ -3557,7 +3666,7 @@ bool cmLocalGenerator::AppendLWYUFlags(std::string& flags,
void cmLocalGenerator::AppendCompileOptions(std::string& options,
std::string const& options_list,
- const char* regex) const
+ char const* regex) const
{
// Short-circuit if there are no options.
if (options_list.empty()) {
@@ -3570,8 +3679,8 @@ void cmLocalGenerator::AppendCompileOptions(std::string& options,
}
void cmLocalGenerator::AppendCompileOptions(
- std::string& options, const std::vector<std::string>& options_vec,
- const char* regex) const
+ std::string& options, std::vector<std::string> const& options_vec,
+ char const* regex) const
{
if (regex) {
// Filter flags upon specified reges.
@@ -3591,7 +3700,7 @@ void cmLocalGenerator::AppendCompileOptions(
void cmLocalGenerator::AppendCompileOptions(
std::vector<BT<std::string>>& options,
- const std::vector<BT<std::string>>& options_vec, const char* regex) const
+ std::vector<BT<std::string>> const& options_vec, char const* regex) const
{
if (regex) {
// Filter flags upon specified regular expressions.
@@ -3614,8 +3723,8 @@ void cmLocalGenerator::AppendCompileOptions(
}
void cmLocalGenerator::AppendIncludeDirectories(
- std::vector<std::string>& includes, const std::string& includes_list,
- const cmSourceFile& sourceFile) const
+ std::vector<std::string>& includes, std::string const& includes_list,
+ cmSourceFile const& sourceFile) const
{
// Short-circuit if there are no includes.
if (includes_list.empty()) {
@@ -3629,12 +3738,12 @@ void cmLocalGenerator::AppendIncludeDirectories(
void cmLocalGenerator::AppendIncludeDirectories(
std::vector<std::string>& includes,
- const std::vector<std::string>& includes_vec,
- const cmSourceFile& sourceFile) const
+ std::vector<std::string> const& includes_vec,
+ cmSourceFile const& sourceFile) const
{
std::unordered_set<std::string> uniqueIncludes;
- for (const std::string& include : includes_vec) {
+ for (std::string const& include : includes_vec) {
if (!cmSystemTools::FileIsFullPath(include)) {
std::ostringstream e;
e << "Found relative path while evaluating include directories of "
@@ -3682,7 +3791,7 @@ void cmLocalGenerator::AppendDefines(std::set<BT<std::string>>& defines,
void cmLocalGenerator::AppendDefines(
std::set<BT<std::string>>& defines,
- const std::vector<BT<std::string>>& defines_vec) const
+ std::vector<BT<std::string>> const& defines_vec) const
{
for (BT<std::string> const& d : defines_vec) {
// Skip unsupported definitions.
@@ -3698,9 +3807,9 @@ void cmLocalGenerator::AppendDefines(
}
}
-void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
+void cmLocalGenerator::JoinDefines(std::set<std::string> const& defines,
std::string& definesString,
- const std::string& lang)
+ std::string const& lang)
{
// Lookup the define flag for the current language.
std::string dflag = "-D";
@@ -3711,7 +3820,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
dflag = *df;
}
}
- const char* itemSeparator = definesString.empty() ? "" : " ";
+ char const* itemSeparator = definesString.empty() ? "" : " ";
for (std::string const& define : defines) {
// Append the definition with proper escaping.
std::string def = dflag;
@@ -3749,8 +3858,8 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
}
void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
- const std::string& lang,
- const char* feature)
+ std::string const& lang,
+ char const* feature)
{
cmValue optionList = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
@@ -3762,8 +3871,8 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
}
}
-cmValue cmLocalGenerator::GetFeature(const std::string& feature,
- const std::string& config)
+cmValue cmLocalGenerator::GetFeature(std::string const& feature,
+ std::string const& config)
{
std::string featureName = feature;
// TODO: Define accumulation policy for features (prepend, append,
@@ -3788,7 +3897,7 @@ std::string cmLocalGenerator::GetProjectName() const
}
std::string cmLocalGenerator::ConstructComment(
- cmCustomCommandGenerator const& ccg, const char* default_comment) const
+ cmCustomCommandGenerator const& ccg, char const* default_comment) const
{
// Check for a comment provided with the command.
if (cm::optional<std::string> comment = ccg.GetComment()) {
@@ -3799,7 +3908,7 @@ std::string cmLocalGenerator::ConstructComment(
if (!ccg.GetOutputs().empty()) {
std::string comment;
comment = "Generating ";
- const char* sep = "";
+ char const* sep = "";
for (std::string const& o : ccg.GetOutputs()) {
comment += sep;
comment += this->MaybeRelativeToCurBinDir(o);
@@ -3827,13 +3936,13 @@ public:
};
void cmLocalGenerator::GenerateTargetInstallRules(
- std::ostream& os, const std::string& config,
+ std::ostream& os, std::string const& config,
std::vector<std::string> const& configurationTypes)
{
// Convert the old-style install specification from each target to
// an install generator and run it.
- const auto& tgts = this->GetGeneratorTargets();
- for (const auto& l : tgts) {
+ auto const& tgts = this->GetGeneratorTargets();
+ for (auto const& l : tgts) {
if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
@@ -3948,7 +4057,7 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName,
}
std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
- const std::string& sin, std::string const& dir_max)
+ std::string const& sin, std::string const& dir_max)
{
// Look for an existing mapped name for this object file.
auto it = this->UniqueObjectNamesMap.find(sin);
@@ -4072,7 +4181,7 @@ std::string relativeIfUnder(std::string const& top, std::string const& cur,
}
std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
- const cmSourceFile& source, std::string const& dir_max,
+ cmSourceFile const& source, std::string const& dir_max,
bool* hasSourceExtension, char const* customOutputExtension)
{
// Construct the object file name using the full path to the source
@@ -4121,7 +4230,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
// CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/generated_source_file.obj
cmValue unitySourceFile = source.GetProperty("UNITY_SOURCE_FILE");
cmValue pchExtension = source.GetProperty("PCH_EXTENSION");
- const bool isPchObject = objectName.find("cmake_pch") != std::string::npos;
+ bool const isPchObject = objectName.find("cmake_pch") != std::string::npos;
if (unitySourceFile || pchExtension || isPchObject) {
if (pchExtension) {
customOutputExtension = pchExtension->c_str();
@@ -4138,15 +4247,12 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
bool keptSourceExtension = true;
if (!source.GetPropertyAsBool("KEEP_EXTENSION")) {
// Decide whether this language wants to replace the source
- // extension with the object extension. For CMake 2.4
- // compatibility do this by default.
- bool replaceExt = this->NeedBackwardsCompatibility_2_4();
- if (!replaceExt) {
- std::string lang = source.GetLanguage();
- if (!lang.empty()) {
- replaceExt = this->Makefile->IsOn(
- cmStrCat("CMAKE_", lang, "_OUTPUT_EXTENSION_REPLACE"));
- }
+ // extension with the object extension.
+ bool replaceExt = false;
+ std::string lang = source.GetLanguage();
+ if (!lang.empty()) {
+ replaceExt = this->Makefile->IsOn(
+ cmStrCat("CMAKE_", lang, "_OUTPUT_EXTENSION_REPLACE"));
}
// Remove the source extension if it is to be replaced.
@@ -4173,7 +4279,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
return this->CreateSafeUniqueObjectFileName(objectName, dir_max);
}
-std::string cmLocalGenerator::GetSourceFileLanguage(const cmSourceFile& source)
+std::string cmLocalGenerator::GetSourceFileLanguage(cmSourceFile const& source)
{
return source.GetLanguage();
}
@@ -4204,71 +4310,13 @@ std::string const& cmLocalGenerator::GetCurrentSourceDirectory() const
}
std::string cmLocalGenerator::GetTargetDirectory(
- const cmGeneratorTarget* /*unused*/) const
+ cmGeneratorTarget const* /*unused*/) const
{
cmSystemTools::Error("GetTargetDirectory"
" called on cmLocalGenerator");
return "";
}
-KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
-{
- // The computed version may change until the project is fully
- // configured.
- if (!this->BackwardsCompatibilityFinal) {
- unsigned int major = 0;
- unsigned int minor = 0;
- unsigned int patch = 0;
- if (cmValue value =
- this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY")) {
- switch (sscanf(value->c_str(), "%u.%u.%u", &major, &minor, &patch)) {
- case 2:
- patch = 0;
- break;
- case 1:
- minor = 0;
- patch = 0;
- break;
- default:
- break;
- }
- }
- this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch);
- this->BackwardsCompatibilityFinal = true;
- }
-
- return this->BackwardsCompatibility;
-}
-
-bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
-{
- // Check the policy to decide whether to pay attention to this
- // variable.
- switch (this->GetPolicyStatus(cmPolicies::CMP0001)) {
- case cmPolicies::WARN:
- // WARN is just OLD without warning because user code does not
- // always affect whether this check is done.
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // Old behavior is to check the variable.
- break;
- case cmPolicies::NEW:
- // New behavior is to ignore the variable.
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- // This will never be the case because the only way to require
- // the setting is to require the user to specify version policy
- // 2.6 or higher. Once we add that requirement then this whole
- // method can be removed anyway.
- return false;
- }
-
- // Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set
- // equal to or lower than the given version.
- KWIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility();
- return (actual_compat && actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
-}
-
cmPolicies::PolicyStatus cmLocalGenerator::GetPolicyStatus(
cmPolicies::PolicyID id) const
{
@@ -4284,10 +4332,10 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
std::ostringstream e;
/* clang-format off */
e << "WARNING: Function-style preprocessor definitions may not be "
- << "passed on the compiler command line because many compilers "
- << "do not support it.\n"
- << "CMake is dropping a preprocessor definition: " << define << "\n"
- << "Consider defining the macro in a (configured) header file.\n";
+ "passed on the compiler command line because many compilers "
+ "do not support it.\n"
+ "CMake is dropping a preprocessor definition: " << define << "\n"
+ "Consider defining the macro in a (configured) header file.\n";
/* clang-format on */
cmSystemTools::Message(e.str());
return false;
@@ -4299,10 +4347,10 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be "
- << "passed on the compiler command line because many compilers "
- << "do not support it.\n"
- << "CMake is dropping a preprocessor definition: " << define << "\n"
- << "Consider defining the macro in a (configured) header file.\n";
+ "passed on the compiler command line because many compilers "
+ "do not support it.\n"
+ "CMake is dropping a preprocessor definition: " << define << "\n"
+ "Consider defining the macro in a (configured) header file.\n";
/* clang-format on */
cmSystemTools::Message(e.str());
return false;
@@ -4313,7 +4361,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target,
- const std::string& prop)
+ std::string const& prop)
{
if (cmValue val = target->GetProperty(prop)) {
mf->AddDefinition(prop, *val);
@@ -4321,8 +4369,8 @@ static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target,
}
void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
- const std::string& targetName,
- const std::string& fname)
+ std::string const& targetName,
+ std::string const& fname)
{
// Find the Info.plist template.
cmValue in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
@@ -4360,8 +4408,8 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
}
void cmLocalGenerator::GenerateFrameworkInfoPList(
- cmGeneratorTarget* target, const std::string& targetName,
- const std::string& fname)
+ cmGeneratorTarget* target, std::string const& targetName,
+ std::string const& fname)
{
// Find the Info.plist template.
cmValue in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
@@ -4402,10 +4450,10 @@ cm::string_view CustomOutputRoleKeyword(cmLocalGenerator::OutputRole role)
: "BYPRODUCTS"_s);
}
-void CreateGeneratedSource(cmLocalGenerator& lg, const std::string& output,
+void CreateGeneratedSource(cmLocalGenerator& lg, std::string const& output,
cmLocalGenerator::OutputRole role,
cmCommandOrigin origin,
- const cmListFileBacktrace& lfbt)
+ cmListFileBacktrace const& lfbt)
{
if (cmGeneratorExpression::Find(output) != std::string::npos) {
lg.GetCMakeInstance()->IssueMessage(
@@ -4427,7 +4475,7 @@ void CreateGeneratedSource(cmLocalGenerator& lg, const std::string& output,
}
// Make sure the output file name has no invalid characters.
- const bool hashNotAllowed = lg.GetState()->UseBorlandMake();
+ bool const hashNotAllowed = lg.GetState()->UseBorlandMake();
std::string::size_type pos = output.find_first_of("<>");
if (pos == std::string::npos && hashNotAllowed) {
pos = output.find_first_of('#');
@@ -4492,15 +4540,15 @@ cmSourceFile* AddCustomCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
bool replace)
{
cmMakefile* mf = lg.GetMakefile();
- const auto& lfbt = cc->GetBacktrace();
- const auto& outputs = cc->GetOutputs();
- const auto& byproducts = cc->GetByproducts();
- const auto& commandLines = cc->GetCommandLines();
+ auto const& lfbt = cc->GetBacktrace();
+ auto const& outputs = cc->GetOutputs();
+ auto const& byproducts = cc->GetByproducts();
+ auto const& commandLines = cc->GetCommandLines();
// Choose a source file on which to store the custom command.
cmSourceFile* file = nullptr;
if (!commandLines.empty() && cc->HasMainDependency()) {
- const auto& main_dependency = cc->GetMainDependency();
+ auto const& main_dependency = cc->GetMainDependency();
// The main dependency was specified. Use it unless a different
// custom command already used it.
file = mf->GetSource(main_dependency);
@@ -4562,8 +4610,8 @@ cmSourceFile* AddCustomCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
return file;
}
-bool AnyOutputMatches(const std::string& name,
- const std::vector<std::string>& outputs)
+bool AnyOutputMatches(std::string const& name,
+ std::vector<std::string> const& outputs)
{
return std::any_of(outputs.begin(), outputs.end(),
[&name](std::string const& output) -> bool {
@@ -4576,7 +4624,7 @@ bool AnyOutputMatches(const std::string& name,
}
bool AnyTargetCommandOutputMatches(
- const std::string& name, const std::vector<cmCustomCommand>& commands)
+ std::string const& name, std::vector<cmCustomCommand> const& commands)
{
return std::any_of(commands.begin(), commands.end(),
[&name](cmCustomCommand const& command) -> bool {
@@ -4621,11 +4669,11 @@ cmSourceFile* AddCustomCommandToOutput(cmLocalGenerator& lg,
}
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt,
- const std::string& output,
- const std::vector<std::string>& depends,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines)
+ cmListFileBacktrace const& lfbt,
+ std::string const& output,
+ std::vector<std::string> const& depends,
+ cmImplicitDependsList const& implicit_depends,
+ cmCustomCommandLines const& commandLines)
{
// Lookup an existing command.
cmSourceFile* sf = nullptr;
@@ -4694,7 +4742,7 @@ void AddUtilityCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
std::vector<std::string> ComputeISPCObjectSuffixes(cmGeneratorTarget* target)
{
- const cmValue targetProperty = target->GetProperty("ISPC_INSTRUCTION_SETS");
+ cmValue const targetProperty = target->GetProperty("ISPC_INSTRUCTION_SETS");
cmList ispcTargets;
if (!targetProperty.IsOff()) {
@@ -4731,7 +4779,7 @@ std::vector<std::string> ComputeISPCExtraObjects(
objNameNoExt.resize(dot_pos);
}
- for (const auto& ispcTarget : ispcSuffixes) {
+ for (auto const& ispcTarget : ispcSuffixes) {
computedObjects.emplace_back(
cmStrCat(normalizedDir, "/", objNameNoExt, "_", ispcTarget, extension));
}
@@ -4741,7 +4789,7 @@ std::vector<std::string> ComputeISPCExtraObjects(
}
cmSourcesWithOutput cmLocalGenerator::GetSourcesWithOutput(
- const std::string& name) const
+ std::string const& name) const
{
// Linear search? Also see GetSourceFileWithOutput for detail.
if (!cmSystemTools::FileIsFullPath(name)) {
@@ -4760,7 +4808,7 @@ cmSourcesWithOutput cmLocalGenerator::GetSourcesWithOutput(
}
cmSourceFile* cmLocalGenerator::GetSourceFileWithOutput(
- const std::string& name, cmSourceOutputKind kind) const
+ std::string const& name, cmSourceOutputKind kind) const
{
// If the queried path is not absolute we use the backward compatible
// linear-time search for an output with a matching suffix.
@@ -4837,7 +4885,7 @@ std::vector<std::string> cmLocalGenerator::ExpandCustomCommandOutputGenex(
}
void cmLocalGenerator::AddTargetByproducts(
- cmTarget* target, const std::vector<std::string>& byproducts,
+ cmTarget* target, std::vector<std::string> const& byproducts,
cmListFileBacktrace const& bt, cmCommandOrigin origin)
{
for (std::string const& o : byproducts) {
@@ -4855,7 +4903,7 @@ void cmLocalGenerator::AddTargetByproducts(
}
void cmLocalGenerator::AddSourceOutputs(
- cmSourceFile* source, const std::vector<std::string>& outputs,
+ cmSourceFile* source, std::vector<std::string> const& outputs,
OutputRole role, cmListFileBacktrace const& bt, cmCommandOrigin origin)
{
for (std::string const& o : outputs) {
@@ -4934,7 +4982,7 @@ void cmLocalGenerator::UpdateOutputToSourceMap(std::string const& output,
}
cmTarget* cmLocalGenerator::LinearGetTargetWithOutput(
- const std::string& name) const
+ std::string const& name) const
{
// We go through the ordered vector of targets to get reproducible results
// should multiple names match.
@@ -4954,7 +5002,7 @@ cmTarget* cmLocalGenerator::LinearGetTargetWithOutput(
}
cmSourceFile* cmLocalGenerator::LinearGetSourceFileWithOutput(
- const std::string& name, cmSourceOutputKind kind, bool& byproduct) const
+ std::string const& name, cmSourceOutputKind kind, bool& byproduct) const
{
// Outputs take precedence over byproducts.
byproduct = false;
@@ -4962,7 +5010,7 @@ cmSourceFile* cmLocalGenerator::LinearGetSourceFileWithOutput(
// Look through all the source files that have custom commands and see if the
// custom command has the passed source file as an output.
- for (const auto& src : this->Makefile->GetSourceFiles()) {
+ for (auto const& src : this->Makefile->GetSourceFiles()) {
// Does this source file have a custom command?
if (src->GetCustomCommand()) {
// Does the output of the custom command match the source file name?
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3ec349b..6fae5e1 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,9 +16,8 @@
#include <cm/optional>
-#include <cm3p/kwiml/int.h>
-
#include "cmCustomCommandTypes.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmListFileCache.h"
#include "cmMessageType.h" // IWYU pragma: keep
@@ -46,36 +45,6 @@ class cmake;
template <typename Iter>
class cmRange;
-/** Flag if byproducts shall also be considered. */
-enum class cmSourceOutputKind
-{
- OutputOnly,
- OutputOrByproduct
-};
-
-/** What scanner to use for dependencies lookup. */
-enum class cmDependencyScannerKind
-{
- CMake,
- Compiler
-};
-
-/** What to compute language flags for */
-enum class cmBuildStep
-{
- Compile,
- Link
-};
-
-/** What compilation mode the swift files are in */
-enum class cmSwiftCompileMode
-{
- Wholemodule,
- Incremental,
- Singlefile,
- Unknown,
-};
-
/** Target and source file which have a specific output. */
struct cmSourcesWithOutput
{
@@ -137,77 +106,98 @@ public:
cmMakefile* GetMakefile() { return this->Makefile; }
//! Get the makefile for this generator, const version
- const cmMakefile* GetMakefile() const { return this->Makefile; }
+ cmMakefile const* GetMakefile() const { return this->Makefile; }
//! Get the GlobalGenerator this is associated with
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
- const cmGlobalGenerator* GetGlobalGenerator() const
+ cmGlobalGenerator const* GetGlobalGenerator() const
{
return this->GlobalGenerator;
}
virtual std::unique_ptr<cmRulePlaceholderExpander>
- CreateRulePlaceholderExpander() const;
+ CreateRulePlaceholderExpander(
+ cmBuildStep buildStep = cmBuildStep::Compile) const;
+ virtual std::unique_ptr<cmRulePlaceholderExpander>
+ CreateRulePlaceholderExpander(cmBuildStep buildStep,
+ cmGeneratorTarget const* target,
+ std::string const& language);
- std::string GetLinkLibsCMP0065(std::string const& linkLanguage,
- cmGeneratorTarget& tgt) const;
+ std::string GetExeExportFlags(std::string const& linkLanguage,
+ cmGeneratorTarget& tgt) const;
cmState* GetState() const;
cmStateSnapshot GetStateSnapshot() const;
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
- const std::string& lang, const std::string& config,
- const std::string& filterArch = std::string());
+ std::string const& lang, std::string const& config,
+ std::string const& filterArch = std::string());
void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target,
- cmBuildStep compileOrLink, const std::string& lang,
- const std::string& config);
+ cmBuildStep compileOrLink, std::string const& lang,
+ std::string const& config);
void AddLanguageFlagsForLinking(std::string& flags,
cmGeneratorTarget const* target,
- const std::string& lang,
- const std::string& config);
- void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target,
- std::string const& lang, const std::string& config);
+ std::string const& lang,
+ std::string const& config);
+ void AddFeatureFlags(std::string& flags, cmGeneratorTarget const* target,
+ std::string const& lang, std::string const& config);
void AddVisibilityPresetFlags(std::string& flags,
cmGeneratorTarget const* target,
- const std::string& lang);
- void AddConfigVariableFlags(std::string& flags, const std::string& var,
- const std::string& config);
- void AddColorDiagnosticsFlags(std::string& flags, const std::string& lang);
+ std::string const& lang);
+ void AddConfigVariableFlags(std::string& flags, std::string const& var,
+ std::string const& config);
+ // Handle prefixes processing (like LINKER:)
+ void AddConfigVariableFlags(std::string& flags, std::string const& var,
+ cmGeneratorTarget const* target,
+ cmBuildStep compileOrLink,
+ std::string const& lang,
+ std::string const& config);
+ void AddColorDiagnosticsFlags(std::string& flags, std::string const& lang);
//! Append flags to a string.
virtual void AppendFlags(std::string& flags,
- const std::string& newFlags) const;
+ std::string const& newFlags) const;
virtual void AppendFlags(std::string& flags,
- const std::vector<BT<std::string>>& newFlags) const;
+ std::vector<BT<std::string>> const& newFlags) const;
virtual void AppendFlagEscape(std::string& flags,
- const std::string& rawFlag) const;
+ std::string const& rawFlag) const;
+ /**
+ * Append flags after parsing, prefixes processing (like LINKER:) and
+ * escaping
+ */
+ void AppendFlags(std::string& flags, std::string const& newFlags,
+ std::string const& name, cmGeneratorTarget const* target,
+ cmBuildStep compileOrLink, std::string const& lang);
void AddISPCDependencies(cmGeneratorTarget* target);
void AddPchDependencies(cmGeneratorTarget* target);
void AddUnityBuild(cmGeneratorTarget* target);
virtual void AddXCConfigSources(cmGeneratorTarget* /* target */) {}
void AppendLinkerTypeFlags(std::string& flags, cmGeneratorTarget* target,
- const std::string& config,
- const std::string& linkLanguage);
+ std::string const& config,
+ std::string const& linkLanguage);
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
- const std::string& config,
- const std::string& lang);
+ std::string const& config,
+ std::string const& lang);
void AppendPositionIndependentLinkerFlags(std::string& flags,
cmGeneratorTarget* target,
- const std::string& config,
- const std::string& lang);
+ std::string const& config,
+ std::string const& lang);
+ void AppendWarningAsErrorLinkerFlags(std::string& flags,
+ cmGeneratorTarget* target,
+ std::string const& lang);
void AppendDependencyInfoLinkerFlags(std::string& flags,
cmGeneratorTarget* target,
- const std::string& config,
- const std::string& lang);
+ std::string const& config,
+ std::string const& lang);
virtual std::string GetLinkDependencyFile(cmGeneratorTarget* target,
- const std::string& config) const;
+ std::string const& config) const;
void AppendModuleDefinitionFlag(std::string& flags,
cmGeneratorTarget const* target,
cmLinkLineComputer* linkLineComputer,
std::string const& config);
- bool AppendLWYUFlags(std::string& flags, const cmGeneratorTarget* target,
- const std::string& lang);
+ bool AppendLWYUFlags(std::string& flags, cmGeneratorTarget const* target,
+ std::string const& lang);
//! Get the include flags for the current makefile and language
std::string GetIncludeFlags(std::vector<std::string> const& includes,
@@ -218,12 +208,12 @@ public:
using GeneratorTargetVector =
std::vector<std::unique_ptr<cmGeneratorTarget>>;
- const GeneratorTargetVector& GetGeneratorTargets() const
+ GeneratorTargetVector const& GetGeneratorTargets() const
{
return this->GeneratorTargets;
}
- const GeneratorTargetVector& GetOwnedImportedGeneratorTargets() const
+ GeneratorTargetVector const& GetOwnedImportedGeneratorTargets() const
{
return this->OwnedImportedGeneratorTargets;
}
@@ -233,18 +223,18 @@ public:
void AddOwnedImportedGeneratorTarget(std::unique_ptr<cmGeneratorTarget> gt);
cmGeneratorTarget* FindLocalNonAliasGeneratorTarget(
- const std::string& name) const;
- cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
+ std::string const& name) const;
+ cmGeneratorTarget* FindGeneratorTargetToUse(std::string const& name) const;
/**
* Process a list of include directories
*/
void AppendIncludeDirectories(std::vector<std::string>& includes,
std::string const& includes_list,
- const cmSourceFile& sourceFile) const;
+ cmSourceFile const& sourceFile) const;
void AppendIncludeDirectories(std::vector<std::string>& includes,
- const std::vector<std::string>& includes_vec,
- const cmSourceFile& sourceFile) const;
+ std::vector<std::string> const& includes_vec,
+ cmSourceFile const& sourceFile) const;
/**
* Encode a list of preprocessor definitions for the compiler
@@ -255,7 +245,7 @@ public:
void AppendDefines(std::set<BT<std::string>>& defines,
std::string const& defines_list) const;
void AppendDefines(std::set<BT<std::string>>& defines,
- const std::vector<BT<std::string>>& defines_vec) const;
+ std::vector<BT<std::string>> const& defines_vec) const;
/**
* Encode a list of compile options for the compiler
@@ -263,25 +253,25 @@ public:
*/
void AppendCompileOptions(std::string& options,
std::string const& options_list,
- const char* regex = nullptr) const;
+ char const* regex = nullptr) const;
void AppendCompileOptions(std::string& options,
- const std::vector<std::string>& options_vec,
- const char* regex = nullptr) const;
+ std::vector<std::string> const& options_vec,
+ char const* regex = nullptr) const;
void AppendCompileOptions(std::vector<BT<std::string>>& options,
- const std::vector<BT<std::string>>& options_vec,
- const char* regex = nullptr) const;
+ std::vector<BT<std::string>> const& options_vec,
+ char const* regex = nullptr) const;
/**
* Join a set of defines into a definesString with a space separator.
*/
- void JoinDefines(const std::set<std::string>& defines,
- std::string& definesString, const std::string& lang);
+ void JoinDefines(std::set<std::string> const& defines,
+ std::string& definesString, std::string const& lang);
/** Lookup and append options associated with a particular feature. */
- void AppendFeatureOptions(std::string& flags, const std::string& lang,
- const char* feature);
+ void AppendFeatureOptions(std::string& flags, std::string const& lang,
+ char const* feature);
- cmValue GetFeature(const std::string& feature, const std::string& config);
+ cmValue GetFeature(std::string const& feature, std::string const& config);
/** \brief Get absolute path to dependency \a name
*
@@ -295,14 +285,14 @@ public:
* the source directory of this generator. This should only be
* used for dependencies of custom commands.
*/
- bool GetRealDependency(const std::string& name, const std::string& config,
+ bool GetRealDependency(std::string const& name, std::string const& config,
std::string& dep);
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
/** Called from command-line hook to update dependencies. */
- virtual bool UpdateDependencies(const std::string& /* tgtInfo */,
+ virtual bool UpdateDependencies(std::string const& /* tgtInfo */,
bool /*verbose*/, bool /*color*/)
{
return true;
@@ -328,8 +318,8 @@ public:
*/
void GetIncludeDirectoriesImplicit(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
- const std::string& lang = "C",
- const std::string& config = "",
+ std::string const& lang = "C",
+ std::string const& config = "",
bool stripImplicitDirs = true,
bool appendAllImplicitDirs = false) const;
@@ -338,8 +328,8 @@ public:
*/
void GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
- const std::string& lang = "C",
- const std::string& config = "") const;
+ std::string const& lang = "C",
+ std::string const& config = "") const;
/** @brief Get the include directories for the current makefile and language.
* @return The include directory list
@@ -349,16 +339,16 @@ public:
std::string const& config = "") const;
void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
- const std::string& lang, const std::string& config);
+ std::string const& lang, std::string const& config);
void AddCompileOptions(std::vector<BT<std::string>>& flags,
- cmGeneratorTarget* target, const std::string& lang,
- const std::string& config);
+ cmGeneratorTarget* target, std::string const& lang,
+ std::string const& config);
/**
* Add a custom PRE_BUILD, PRE_LINK, or POST_BUILD command to a target.
*/
cmTarget* AddCustomCommandToTarget(
- const std::string& target, cmCustomCommandType type,
+ std::string const& target, cmCustomCommandType type,
std::unique_ptr<cmCustomCommand> cc,
cmObjectLibraryCommands objLibCommands = cmObjectLibraryCommands::Reject);
@@ -372,7 +362,7 @@ public:
* Add a utility to the build. A utility target is a command that is run
* every time the target is built.
*/
- cmTarget* AddUtilityCommand(const std::string& utilityName,
+ cmTarget* AddUtilityCommand(std::string const& utilityName,
bool excludeFromAll,
std::unique_ptr<cmCustomCommand> cc);
@@ -392,7 +382,7 @@ public:
* Add target byproducts.
*/
void AddTargetByproducts(cmTarget* target,
- const std::vector<std::string>& byproducts,
+ std::vector<std::string> const& byproducts,
cmListFileBacktrace const& bt,
cmCommandOrigin origin);
@@ -415,20 +405,20 @@ public:
* target or a PRE_BUILD, PRE_LINK, or POST_BUILD command.
* Return the source file which has the provided source name as output.
*/
- cmSourcesWithOutput GetSourcesWithOutput(const std::string& name) const;
+ cmSourcesWithOutput GetSourcesWithOutput(std::string const& name) const;
/**
* Is there a source file that has the provided source name as an output?
* If so then return it.
*/
cmSourceFile* GetSourceFileWithOutput(
- const std::string& name,
+ std::string const& name,
cmSourceOutputKind kind = cmSourceOutputKind::OutputOnly) const;
std::string GetProjectName() const;
/** Compute the language used to compile the given source file. */
- std::string GetSourceFileLanguage(const cmSourceFile& source);
+ std::string GetSourceFileLanguage(cmSourceFile const& source);
// Fill the vector with the target names for the object files,
// preprocessed files and assembly files.
@@ -441,23 +431,6 @@ public:
virtual std::string GetTargetDirectory(
cmGeneratorTarget const* target) const;
- /**
- * Get the level of backwards compatibility requested by the project
- * in this directory. This is the value of the CMake variable
- * CMAKE_BACKWARDS_COMPATIBILITY whose format is
- * "major.minor[.patch]". The returned integer is encoded as
- *
- * CMake_VERSION_ENCODE(major, minor, patch)
- *
- * and is monotonically increasing with the CMake version.
- */
- KWIML_INT_uint64_t GetBackwardsCompatibility();
-
- /**
- * Test whether compatibility is set to a given version or lower.
- */
- bool NeedBackwardsCompatibility_2_4();
-
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const;
cmake* GetCMakeInstance() const;
@@ -472,21 +445,21 @@ public:
* Generate a macOS application bundle Info.plist file.
*/
void GenerateAppleInfoPList(cmGeneratorTarget* target,
- const std::string& targetName,
- const std::string& fname);
+ std::string const& targetName,
+ std::string const& fname);
/**
* Generate a macOS framework Info.plist file.
*/
void GenerateFrameworkInfoPList(cmGeneratorTarget* target,
- const std::string& targetName,
- const std::string& fname);
+ std::string const& targetName,
+ std::string const& fname);
/** Construct a comment for a custom command. */
std::string ConstructComment(cmCustomCommandGenerator const& ccg,
- const char* default_comment = "") const;
+ char const* default_comment = "") const;
// Compute object file names.
std::string GetObjectFileNameWithoutTarget(
- const cmSourceFile& source, std::string const& dir_max,
+ cmSourceFile const& source, std::string const& dir_max,
bool* hasSourceExtension = nullptr,
char const* customOutputExtension = nullptr);
@@ -501,17 +474,17 @@ public:
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
void GetDeviceLinkFlags(cmLinkLineDeviceComputer& linkLineComputer,
- const std::string& config, std::string& linkLibs,
+ std::string const& config, std::string& linkLibs,
std::string& linkFlags, std::string& frameworkPath,
std::string& linkPath, cmGeneratorTarget* target);
void GetTargetFlags(cmLinkLineComputer* linkLineComputer,
- const std::string& config, std::string& linkLibs,
+ std::string const& config, std::string& linkLibs,
std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath,
cmGeneratorTarget* target);
void GetTargetFlags(
- cmLinkLineComputer* linkLineComputer, const std::string& config,
+ cmLinkLineComputer* linkLineComputer, std::string const& config,
std::vector<BT<std::string>>& linkLibs, std::string& flags,
std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath,
std::vector<BT<std::string>>& linkPath, cmGeneratorTarget* target);
@@ -551,12 +524,12 @@ public:
void IssueMessage(MessageType t, std::string const& text) const;
void CreateEvaluationFileOutputs();
- void CreateEvaluationFileOutputs(const std::string& config);
+ void CreateEvaluationFileOutputs(std::string const& config);
void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
std::string GetRuleLauncher(cmGeneratorTarget* target,
- const std::string& prop,
- const std::string& config);
+ std::string const& prop,
+ std::string const& config);
// Return Swift_COMPILATION_MODE value if CMP0157 is NEW.
cm::optional<cmSwiftCompileMode> GetSwiftCompileMode(
@@ -586,12 +559,12 @@ protected:
// Handle old-style install rules stored in the targets.
void GenerateTargetInstallRules(
- std::ostream& os, const std::string& config,
+ std::ostream& os, std::string const& config,
std::vector<std::string> const& configurationTypes);
virtual void AddGeneratorSpecificInstallSetup(std::ostream&) {}
- std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
+ std::string& CreateSafeUniqueObjectFileName(std::string const& sin,
std::string const& dir_max);
/** Check whether the native build system supports the given
@@ -612,7 +585,6 @@ protected:
GeneratorTargetMap GeneratorTargetSearchIndex;
GeneratorTargetVector GeneratorTargets;
- std::set<cmGeneratorTarget const*> WarnCMP0063;
GeneratorTargetMap ImportedGeneratorTargets;
GeneratorTargetVector OwnedImportedGeneratorTargets;
std::map<std::string, std::string> AliasTargets;
@@ -625,14 +597,11 @@ protected:
bool EmitUniversalBinaryFlags;
- KWIML_INT_uint64_t BackwardsCompatibility;
- bool BackwardsCompatibilityFinal;
-
private:
/**
* See LinearGetSourceFileWithOutput for background information
*/
- cmTarget* LinearGetTargetWithOutput(const std::string& name) const;
+ cmTarget* LinearGetTargetWithOutput(std::string const& name) const;
/**
* Generalized old version of GetSourceFileWithOutput kept for
@@ -640,7 +609,7 @@ private:
* relative file paths. It is used as a fall back by GetSourceFileWithOutput
* and GetSourcesWithOutput.
*/
- cmSourceFile* LinearGetSourceFileWithOutput(const std::string& name,
+ cmSourceFile* LinearGetSourceFileWithOutput(std::string const& name,
cmSourceOutputKind kind,
bool& byproduct) const;
struct SourceEntry
@@ -659,20 +628,17 @@ private:
OutputRole role, cmListFileBacktrace const& bt,
cmCommandOrigin origin);
- void AddSharedFlags(std::string& flags, const std::string& lang,
- bool shared);
- bool GetShouldUseOldFlags(bool shared, const std::string& lang) const;
void AddPositionIndependentFlags(std::string& flags, std::string const& l,
int targetType);
void ComputeObjectMaxPath();
- bool AllAppleArchSysrootsAreTheSame(const std::vector<std::string>& archs,
+ bool AllAppleArchSysrootsAreTheSame(std::vector<std::string> const& archs,
cmValue sysroot);
- void CopyPchCompilePdb(const std::string& config,
- const std::string& language,
+ void CopyPchCompilePdb(std::string const& config,
+ std::string const& language,
cmGeneratorTarget* target,
- const std::string& ReuseFrom,
+ std::string const& ReuseFrom,
cmGeneratorTarget* reuseTarget,
std::vector<std::string> const& extensions);
@@ -699,28 +665,37 @@ private:
{
}
};
+ /** Whether to insert relative or absolute paths into unity files */
+ enum class UnityPathMode
+ {
+ Absolute,
+ Relative
+ };
UnitySource WriteUnitySource(
cmGeneratorTarget* target, std::vector<std::string> const& configs,
cmRange<std::vector<UnityBatchedSource>::const_iterator> sources,
- cmValue beforeInclude, cmValue afterInclude, std::string filename) const;
+ cmValue beforeInclude, cmValue afterInclude, std::string filename,
+ std::string const& unityFileDirectory, UnityPathMode pathMode) const;
void WriteUnitySourceInclude(std::ostream& unity_file,
cm::optional<std::string> const& cond,
std::string const& sf_full_path,
cmValue beforeInclude, cmValue afterInclude,
- cmValue uniqueIdName) const;
+ cmValue uniqueIdName, UnityPathMode pathMode,
+ std::string const& unityFileDirectory) const;
std::vector<UnitySource> AddUnityFilesModeAuto(
cmGeneratorTarget* target, std::string const& lang,
std::vector<std::string> const& configs,
std::vector<UnityBatchedSource> const& filtered_sources,
cmValue beforeInclude, cmValue afterInclude,
- std::string const& filename_base, size_t batchSize);
+ std::string const& filename_base, UnityPathMode pathMode,
+ size_t batchSize);
std::vector<UnitySource> AddUnityFilesModeGroup(
cmGeneratorTarget* target, std::string const& lang,
std::vector<std::string> const& configs,
std::vector<UnityBatchedSource> const& filtered_sources,
cmValue beforeInclude, cmValue afterInclude,
- std::string const& filename_base);
+ std::string const& filename_base, UnityPathMode pathMode);
};
namespace detail {
@@ -734,11 +709,11 @@ cmSourceFile* AddCustomCommandToOutput(cmLocalGenerator& lg,
bool replace);
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt,
- const std::string& output,
- const std::vector<std::string>& depends,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines);
+ cmListFileBacktrace const& lfbt,
+ std::string const& output,
+ std::vector<std::string> const& depends,
+ cmImplicitDependsList const& implicit_depends,
+ cmCustomCommandLines const& commandLines);
void AddUtilityCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
cmTarget* target, std::unique_ptr<cmCustomCommand> cc);
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index b223813..89f5014 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalGhsMultiGenerator.h"
#include <utility>
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index be32a94..698ef39 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <map>
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 46a95af..842c76c 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalNinjaGenerator.h"
#include <algorithm>
@@ -50,9 +50,20 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
// Virtual public methods.
std::unique_ptr<cmRulePlaceholderExpander>
-cmLocalNinjaGenerator::CreateRulePlaceholderExpander() const
+cmLocalNinjaGenerator::CreateRulePlaceholderExpander(
+ cmBuildStep buildStep) const
{
- auto ret = this->cmLocalGenerator::CreateRulePlaceholderExpander();
+ auto ret = this->cmLocalGenerator::CreateRulePlaceholderExpander(buildStep);
+ ret->SetTargetImpLib("$TARGET_IMPLIB");
+ return std::unique_ptr<cmRulePlaceholderExpander>(std::move(ret));
+}
+std::unique_ptr<cmRulePlaceholderExpander>
+cmLocalNinjaGenerator::CreateRulePlaceholderExpander(
+ cmBuildStep buildStep, cmGeneratorTarget const* target,
+ std::string const& language)
+{
+ auto ret = this->cmLocalGenerator::CreateRulePlaceholderExpander(
+ buildStep, target, language);
ret->SetTargetImpLib("$TARGET_IMPLIB");
return std::unique_ptr<cmRulePlaceholderExpander>(std::move(ret));
}
@@ -85,7 +96,7 @@ void cmLocalNinjaGenerator::Generate()
this->WritePools(this->GetRulesFileStream());
- const std::string& showIncludesPrefix =
+ std::string const& showIncludesPrefix =
this->GetMakefile()->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX");
if (!showIncludesPrefix.empty()) {
cmGlobalNinjaGenerator::WriteComment(this->GetRulesFileStream(),
@@ -100,7 +111,7 @@ void cmLocalNinjaGenerator::Generate()
}
}
- for (const auto& target : this->GetGeneratorTargets()) {
+ for (auto const& target : this->GetGeneratorTargets()) {
if (!target->IsInBuildSystem()) {
continue;
}
@@ -177,10 +188,10 @@ std::string cmLocalNinjaGenerator::GetTargetDirectory(
// Non-virtual public methods.
-const cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
+cmGlobalNinjaGenerator const* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
const
{
- return static_cast<const cmGlobalNinjaGenerator*>(
+ return static_cast<cmGlobalNinjaGenerator const*>(
this->GetGlobalGenerator());
}
@@ -220,7 +231,7 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
// Private methods.
cmGeneratedFileStream& cmLocalNinjaGenerator::GetImplFileStream(
- const std::string& config) const
+ std::string const& config) const
{
return *this->GetGlobalNinjaGenerator()->GetImplFileStream(config);
}
@@ -235,7 +246,7 @@ cmGeneratedFileStream& cmLocalNinjaGenerator::GetRulesFileStream() const
return *this->GetGlobalNinjaGenerator()->GetRulesFileStream();
}
-const cmake* cmLocalNinjaGenerator::GetCMakeInstance() const
+cmake const* cmLocalNinjaGenerator::GetCMakeInstance() const
{
return this->GetGlobalGenerator()->GetCMakeInstance();
}
@@ -272,8 +283,10 @@ void cmLocalNinjaGenerator::WriteBuildFileTop()
void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os)
{
cmGlobalNinjaGenerator::WriteDivider(os);
- os << "# Project: " << this->GetProjectName() << '\n'
- << "# Configurations: " << cmJoin(this->GetConfigNames(), ", ") << '\n';
+ os << "# Project: " << this->GetProjectName()
+ << "\n"
+ "# Configurations: "
+ << cmJoin(this->GetConfigNames(), ", ") << '\n';
cmGlobalNinjaGenerator::WriteDivider(os);
}
@@ -304,7 +317,7 @@ void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os)
}
void cmLocalNinjaGenerator::WriteNinjaConfigurationVariable(
- std::ostream& os, const std::string& config)
+ std::ostream& os, std::string const& config)
{
cmGlobalNinjaGenerator::WriteVariable(
os, "CONFIGURATION", config,
@@ -325,7 +338,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
os, "Pools defined by global property JOB_POOLS");
cmList pools{ *jobpools };
for (std::string const& pool : pools) {
- const std::string::size_type eq = pool.find('=');
+ std::string::size_type const eq = pool.find('=');
unsigned int jobs;
if (eq != std::string::npos &&
sscanf(pool.c_str() + eq, "=%u", &jobs) == 1) {
@@ -349,7 +362,7 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusionConfig(std::ostream& os)
std::string const commonFilePath = ng->EncodePath(ninjaCommonFile);
cmGlobalNinjaGenerator::WriteInclude(os, commonFilePath,
"Include common file.");
- os << "\n";
+ os << '\n';
}
void cmLocalNinjaGenerator::WriteNinjaFilesInclusionCommon(std::ostream& os)
@@ -362,7 +375,7 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusionCommon(std::ostream& os)
std::string const rulesFilePath = ng->EncodePath(ninjaRulesFile);
cmGlobalNinjaGenerator::WriteInclude(os, rulesFilePath,
"Include rules file.");
- os << "\n";
+ os << '\n';
}
void cmLocalNinjaGenerator::WriteNinjaWorkDir(std::ostream& os)
@@ -380,8 +393,8 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
{
cmGlobalNinjaGenerator::WriteDivider(os);
os << "# Write statements declared in CMakeLists.txt:\n"
- << "# " << this->Makefile->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE")
- << '\n';
+ "# "
+ << this->Makefile->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE") << '\n';
if (this->IsRootMakefile()) {
os << "# Which is the root file.\n";
}
@@ -391,7 +404,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
void cmLocalNinjaGenerator::AppendTargetOutputs(cmGeneratorTarget* target,
cmNinjaDeps& outputs,
- const std::string& config)
+ std::string const& config)
{
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs, config,
DependOnTargetArtifact);
@@ -399,8 +412,8 @@ void cmLocalNinjaGenerator::AppendTargetOutputs(cmGeneratorTarget* target,
void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target,
cmNinjaDeps& outputs,
- const std::string& config,
- const std::string& fileConfig,
+ std::string const& config,
+ std::string const& fileConfig,
cmNinjaTargetDepends depends)
{
this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs, config,
@@ -409,7 +422,7 @@ void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target,
void cmLocalNinjaGenerator::AppendCustomCommandDeps(
cmCustomCommandGenerator const& ccg, cmNinjaDeps& ninjaDeps,
- const std::string& config)
+ std::string const& config)
{
for (std::string const& i : ccg.GetDepends()) {
std::string dep;
@@ -610,8 +623,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
}
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
- cmCustomCommand const* cc, const std::set<cmGeneratorTarget*>& targets,
- const std::string& fileConfig)
+ cmCustomCommand const* cc, std::set<cmGeneratorTarget*> const& targets,
+ std::string const& fileConfig)
{
cmGlobalNinjaGenerator* gg = this->GetGlobalNinjaGenerator();
if (gg->SeenCustomCommand(cc, fileConfig)) {
@@ -653,8 +666,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
}
}
- const std::vector<std::string>& outputs = ccg.GetOutputs();
- const std::vector<std::string>& byproducts = ccg.GetByproducts();
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
+ std::vector<std::string> const& byproducts = ccg.GetByproducts();
bool symbolic = false;
for (std::string const& output : outputs) {
@@ -719,8 +732,6 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
depfile = ccg.GetInternalDepfile();
break;
@@ -822,8 +833,6 @@ cmLocalNinjaGenerator::MakeCustomCommandGenerators(
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
transformDepfile = true;
break;
@@ -879,7 +888,7 @@ void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
}
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements(
- const std::string& fileConfig)
+ std::string const& fileConfig)
{
for (cmCustomCommand const* customCommand : this->CustomCommands) {
auto i = this->CustomCommandTargets.find(customCommand);
@@ -902,15 +911,20 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
cmRulePlaceholderExpander::RuleVariables vars;
std::string output;
- const std::vector<std::string>& outputs = ccg.GetOutputs();
- if (!outputs.empty()) {
- output = outputs[0];
- if (ccg.GetWorkingDirectory().empty()) {
- output = this->MaybeRelativeToCurBinDir(output);
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
+ for (size_t i = 0; i < outputs.size(); ++i) {
+ output = cmStrCat(output,
+ this->ConvertToOutputFormat(
+ ccg.GetWorkingDirectory().empty()
+ ? this->MaybeRelativeToCurBinDir(outputs[i])
+ : outputs[i],
+ cmOutputConverter::SHELL));
+ if (i != outputs.size() - 1) {
+ output = cmStrCat(output, ",");
}
- output = this->ConvertToOutputFormat(output, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
+ vars.Role = ccg.GetCC().GetRole().c_str();
auto rulePlaceholderExpander = this->CreateRulePlaceholderExpander();
@@ -923,7 +937,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
return launcher;
}
-void cmLocalNinjaGenerator::AdditionalCleanFiles(const std::string& config)
+void cmLocalNinjaGenerator::AdditionalCleanFiles(std::string const& config)
{
if (cmValue prop_value =
this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 74b8b3b..549858c 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -11,6 +11,7 @@
#include <string>
#include <vector>
+#include "cmGeneratorOptions.h"
#include "cmLocalCommonGenerator.h"
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
@@ -42,16 +43,19 @@ public:
void Generate() override;
- std::unique_ptr<cmRulePlaceholderExpander> CreateRulePlaceholderExpander()
- const override;
+ std::unique_ptr<cmRulePlaceholderExpander> CreateRulePlaceholderExpander(
+ cmBuildStep buildStep = cmBuildStep::Compile) const override;
+ std::unique_ptr<cmRulePlaceholderExpander> CreateRulePlaceholderExpander(
+ cmBuildStep buildStep, cmGeneratorTarget const* target,
+ std::string const& language) override;
std::string GetTargetDirectory(
cmGeneratorTarget const* target) const override;
- const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const;
+ cmGlobalNinjaGenerator const* GetGlobalNinjaGenerator() const;
cmGlobalNinjaGenerator* GetGlobalNinjaGenerator();
- const cmake* GetCMakeInstance() const;
+ cmake const* GetCMakeInstance() const;
cmake* GetCMakeInstance();
std::string const& GetWorkingDirectory() const override;
@@ -72,10 +76,10 @@ public:
cmGeneratorTarget const* target = nullptr) const;
void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs,
- const std::string& config);
+ std::string const& config);
void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs,
- const std::string& config,
- const std::string& fileConfig,
+ std::string const& config,
+ std::string const& fileConfig,
cmNinjaTargetDepends depends);
std::string CreateUtilityOutput(std::string const& targetName,
@@ -91,7 +95,7 @@ public:
std::vector<std::string>& cmdLines);
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
cmNinjaDeps& ninjaDeps,
- const std::string& config);
+ std::string const& config);
bool HasUniqueByproducts(std::vector<std::string> const& byproducts,
cmListFileBacktrace const& bt);
@@ -104,7 +108,7 @@ protected:
std::string const& path, cmOutputConverter::OutputFormat format) override;
private:
- cmGeneratedFileStream& GetImplFileStream(const std::string& config) const;
+ cmGeneratedFileStream& GetImplFileStream(std::string const& config) const;
cmGeneratedFileStream& GetCommonFileStream() const;
cmGeneratedFileStream& GetRulesFileStream() const;
@@ -112,7 +116,7 @@ private:
void WriteProjectHeader(std::ostream& os);
void WriteNinjaRequiredVersion(std::ostream& os);
void WriteNinjaConfigurationVariable(std::ostream& os,
- const std::string& config);
+ std::string const& config);
void WriteNinjaFilesInclusionConfig(std::ostream& os);
void WriteNinjaFilesInclusionCommon(std::ostream& os);
void WriteNinjaWorkDir(std::ostream& os);
@@ -120,10 +124,10 @@ private:
void WritePools(std::ostream& os);
void WriteCustomCommandBuildStatement(
- cmCustomCommand const* cc, const std::set<cmGeneratorTarget*>& targets,
- const std::string& config);
+ cmCustomCommand const* cc, std::set<cmGeneratorTarget*> const& targets,
+ std::string const& config);
- void WriteCustomCommandBuildStatements(const std::string& config);
+ void WriteCustomCommandBuildStatements(std::string const& config);
std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg);
@@ -133,7 +137,7 @@ private:
std::string const& customStep,
cmGeneratorTarget const* target) const;
- void AdditionalCleanFiles(const std::string& config);
+ void AdditionalCleanFiles(std::string const& config);
std::string HomeRelativeOutputPath;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 1e58f0b..7e86371 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalUnixMakefileGenerator3.h"
#include <algorithm>
@@ -28,6 +28,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmInstrumentation.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -71,6 +72,26 @@ std::string cmSplitExtension(std::string const& in, std::string& base)
return ext;
}
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+// Helper function to add the Start Instrumentation command
+void addInstrumentationCommand(cmInstrumentation* instrumentation,
+ std::vector<std::string>& commands)
+{
+ // FIXME(#26668) This does not work on Windows
+ if (instrumentation->HasPreOrPostBuildHook()) {
+ std::string instrumentationCommand =
+ "$(CTEST_COMMAND) --start-instrumentation $(CMAKE_BINARY_DIR)";
+ /*
+ * On Unix systems, Make will prefix the command with `/bin/sh -c`.
+ * Use exec so that Make is the parent process of the command.
+ * Add a `;` to convince BSD make to not optimize out the shell.
+ */
+ instrumentationCommand = cmStrCat("exec ", instrumentationCommand, " ;");
+ commands.push_back(instrumentationCommand);
+ }
+}
+#endif
+
// Helper predicate for removing absolute paths that don't point to the
// source or binary directory. It is used when CMAKE_DEPENDS_IN_PROJECT_ONLY
// is set ON, to only consider in-project dependencies during the build.
@@ -85,7 +106,7 @@ public:
}
// Operator evaluating the predicate
- bool operator()(const std::string& p) const
+ bool operator()(std::string const& p) const
{
auto path = cmCMakePath(p).Normal();
@@ -122,7 +143,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(
cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() = default;
-std::string cmLocalUnixMakefileGenerator3::GetConfigName() const
+std::string const& cmLocalUnixMakefileGenerator3::GetConfigName() const
{
auto const& configNames = this->GetConfigNames();
assert(configNames.size() == 1);
@@ -155,8 +176,8 @@ void cmLocalUnixMakefileGenerator3::Generate()
}
auto& gtVisited = this->GetCommandsVisited(gt);
- const auto& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
- for (const auto& d : deps) {
+ auto const& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
+ for (auto const& d : deps) {
// Take the union of visited source files of custom commands
auto depVisited = this->GetCommandsVisited(d);
gtVisited.insert(depVisited.begin(), depVisited.end());
@@ -194,7 +215,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
std::map<std::string, LocalObjectInfo>& localObjectFiles)
{
- for (const auto& gt : this->GetGeneratorTargets()) {
+ for (auto const& gt : this->GetGeneratorTargets()) {
if (!gt->CanCompileSources()) {
continue;
}
@@ -340,7 +361,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
}
void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
- std::ostream& ruleFileStream, const char* comment, const std::string& output,
+ std::ostream& ruleFileStream, char const* comment, std::string const& output,
LocalObjectInfo const& info)
{
// If the rule includes the source file extension then create a
@@ -396,7 +417,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
// for each target we just provide a rule to cd up to the top and do a make
// on the target
std::string localName;
- for (const auto& target : this->GetGeneratorTargets()) {
+ for (auto const& target : this->GetGeneratorTargets()) {
if ((target->GetType() == cmStateEnums::EXECUTABLE) ||
(target->GetType() == cmStateEnums::STATIC_LIBRARY) ||
(target->GetType() == cmStateEnums::SHARED_LIBRARY) ||
@@ -480,53 +501,47 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
this->WriteDisclaimer(infoFileStream);
// Setup relative path conversion tops.
- /* clang-format off */
- infoFileStream
- << "# Relative path conversion top directories.\n"
- << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \""
- << this->GetRelativePathTopSource() << "\")\n"
- << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \""
- << this->GetRelativePathTopBinary() << "\")\n"
- << "\n";
- /* clang-format on */
+ infoFileStream << "# Relative path conversion top directories.\n"
+ "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \""
+ << this->GetRelativePathTopSource() << "\")\n"
+ << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \""
+ << this->GetRelativePathTopBinary() << "\")\n"
+ << '\n';
// Tell the dependency scanner to use unix paths if necessary.
if (cmSystemTools::GetForceUnixPaths()) {
- /* clang-format off */
- infoFileStream
- << "# Force unix paths in dependencies.\n"
- << "set(CMAKE_FORCE_UNIX_PATHS 1)\n"
- << "\n";
- /* clang-format on */
+ infoFileStream << "# Force unix paths in dependencies.\n"
+ "set(CMAKE_FORCE_UNIX_PATHS 1)\n"
+ "\n";
}
// Store the include regular expressions for this directory.
infoFileStream << "\n"
- << "# The C and CXX include file regular expressions for "
- << "this directory.\n";
- infoFileStream << "set(CMAKE_C_INCLUDE_REGEX_SCAN ";
+ "# The C and CXX include file regular expressions for "
+ "this directory.\n"
+ "set(CMAKE_C_INCLUDE_REGEX_SCAN ";
cmLocalUnixMakefileGenerator3::WriteCMakeArgument(
infoFileStream, this->Makefile->GetIncludeRegularExpression());
- infoFileStream << ")\n";
- infoFileStream << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN ";
+ infoFileStream << ")\n"
+ "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN ";
cmLocalUnixMakefileGenerator3::WriteCMakeArgument(
infoFileStream, this->Makefile->GetComplainRegularExpression());
- infoFileStream << ")\n";
infoFileStream
- << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n";
- infoFileStream << "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
- "${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n";
+ << ")\n"
+ << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"
+ "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
+ "${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n";
}
std::string cmLocalUnixMakefileGenerator3::ConvertToFullPath(
- const std::string& localPath)
+ std::string const& localPath)
{
std::string dir =
cmStrCat(this->GetCurrentBinaryDirectory(), '/', localPath);
return dir;
}
-const std::string& cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath()
+std::string const& cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath()
{
return this->HomeRelativeOutputPath;
}
@@ -540,9 +555,9 @@ std::string cmLocalUnixMakefileGenerator3::ConvertToMakefilePath(
}
void cmLocalUnixMakefileGenerator3::WriteMakeRule(
- std::ostream& os, const char* comment, const std::string& target,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands, bool symbolic, bool in_help)
+ std::ostream& os, char const* comment, std::string const& target,
+ std::vector<std::string> const& depends,
+ std::vector<std::string> const& commands, bool symbolic, bool in_help)
{
// Make sure there is a target.
if (target.empty()) {
@@ -572,7 +587,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
std::string tgt =
this->ConvertToMakefilePath(this->MaybeRelativeToTopBinDir(target));
- const char* space = "";
+ char const* space = "";
if (tgt.size() == 1) {
// Add a space before the ":" to avoid drive letter confusion on
// Windows.
@@ -583,7 +598,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
if (symbolic) {
if (cmValue sym =
this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE")) {
- os << tgt << space << ": " << *sym << "\n";
+ os << tgt << space << ": " << *sym << '\n';
}
}
@@ -603,12 +618,12 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
if (!commands.empty()) {
// Write the list of commands.
- os << cmWrap("\t", commands, "", "\n") << "\n";
+ os << cmWrap("\t", commands, "", "\n") << '\n';
}
if (symbolic && !this->IsWatcomWMake()) {
- os << ".PHONY : " << tgt << "\n";
+ os << ".PHONY : " << tgt << '\n';
}
- os << "\n";
+ os << '\n';
// Add the output to the local help if requested.
if (in_help) {
this->LocalHelp.push_back(target);
@@ -636,69 +651,76 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
{
this->WriteDivider(makefileStream);
makefileStream << "# Set environment variables for the build.\n"
- << "\n";
+ "\n";
cmGlobalUnixMakefileGenerator3* gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
if (gg->DefineWindowsNULL) {
makefileStream << "!IF \"$(OS)\" == \"Windows_NT\"\n"
- << "NULL=\n"
- << "!ELSE\n"
- << "NULL=nul\n"
- << "!ENDIF\n";
+ "NULL=\n"
+ "!ELSE\n"
+ "NULL=nul\n"
+ "!ENDIF\n";
}
if (this->IsWindowsShell()) {
makefileStream << "SHELL = cmd.exe\n"
- << "\n";
+ "\n";
} else {
#if !defined(__VMS)
- /* clang-format off */
- makefileStream
- << "# The shell in which to execute make rules.\n"
- << "SHELL = /bin/sh\n"
- << "\n";
-/* clang-format on */
+ makefileStream << "# The shell in which to execute make rules.\n"
+ "SHELL = /bin/sh\n"
+ "\n";
#endif
}
+ auto getShellCommand = [this](std::string command) -> std::string {
+ std::string shellCommand = this->MaybeConvertWatcomShellCommand(command);
+ return shellCommand.empty()
+ ? this->ConvertToOutputFormat(command, cmOutputConverter::SHELL)
+ : shellCommand;
+ };
+
std::string cmakeShellCommand =
- this->MaybeConvertWatcomShellCommand(cmSystemTools::GetCMakeCommand());
- if (cmakeShellCommand.empty()) {
- cmakeShellCommand = this->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
+ getShellCommand(cmSystemTools::GetCMakeCommand());
+
+ makefileStream << "# The CMake executable.\n"
+ "CMAKE_COMMAND = "
+ << cmakeShellCommand << "\n";
+
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+ // FIXME(#26668) This does not work on Windows
+ if (this->GetCMakeInstance()
+ ->GetInstrumentation()
+ ->HasPreOrPostBuildHook()) {
+ std::string ctestShellCommand =
+ getShellCommand(cmSystemTools::GetCTestCommand());
+ makefileStream << "# The CTest executable.\n"
+ "CTEST_COMMAND = "
+ << ctestShellCommand << "\n";
}
+#endif
- /* clang-format off */
makefileStream
- << "# The CMake executable.\n"
- << "CMAKE_COMMAND = "
- << cmakeShellCommand
<< "\n"
- << "\n";
- makefileStream
- << "# The command to remove a file.\n"
- << "RM = "
+ "# The command to remove a file.\n"
+ "RM = "
<< cmakeShellCommand
<< " -E rm -f\n"
- << "\n";
- makefileStream
- << "# Escaping for special characters.\n"
- << "EQUALS = =\n"
- << "\n";
- makefileStream
- << "# The top-level source directory on which CMake was run.\n"
- << "CMAKE_SOURCE_DIR = "
- << this->ConvertToOutputFormat(
- this->GetSourceDirectory(), cmOutputConverter::SHELL)
+ "\n"
+ "# Escaping for special characters.\n"
+ "EQUALS = =\n"
+ "\n"
+ "# The top-level source directory on which CMake was run.\n"
+ "CMAKE_SOURCE_DIR = "
+ << this->ConvertToOutputFormat(this->GetSourceDirectory(),
+ cmOutputConverter::SHELL)
<< "\n"
- << "\n";
- makefileStream
- << "# The top-level build directory on which CMake was run.\n"
- << "CMAKE_BINARY_DIR = "
- << this->ConvertToOutputFormat(
- this->GetBinaryDirectory(), cmOutputConverter::SHELL)
+ "\n"
+ "# The top-level build directory on which CMake was run.\n"
+ "CMAKE_BINARY_DIR = "
+ << this->ConvertToOutputFormat(this->GetBinaryDirectory(),
+ cmOutputConverter::SHELL)
<< "\n"
- << "\n";
- /* clang-format on */
+ "\n";
}
void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
@@ -706,7 +728,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
{
this->WriteDivider(makefileStream);
makefileStream << "# Special targets provided by cmake.\n"
- << "\n";
+ "\n";
std::vector<std::string> no_commands;
std::vector<std::string> no_depends;
@@ -721,10 +743,10 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
if (!this->IsNMake() && !this->IsWatcomWMake() &&
!this->BorlandMakeCurlyHack) {
// turn off RCS and SCCS automatic stuff from gmake
- constexpr const char* vcs_rules[] = {
+ constexpr char const* vcs_rules[] = {
"%,v", "RCS/%", "RCS/%,v", "SCCS/s.%", "s.%",
};
- for (const auto* vcs_rule : vcs_rules) {
+ for (auto const* vcs_rule : vcs_rules) {
std::vector<std::string> vcs_depend;
vcs_depend.emplace_back(vcs_rule);
this->WriteMakeRule(makefileStream, "Disable VCS-based implicit rules.",
@@ -740,31 +762,20 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
// Switch on WMake feature, if an error or interrupt occurs during
// makefile processing, the current target being made may be deleted
// without prompting (the same as command line -e option).
- /* clang-format off */
- makefileStream <<
- "\n"
- ".ERASE\n"
- "\n"
- ;
- /* clang-format on */
+ makefileStream << "\n"
+ ".ERASE\n"
+ "\n";
}
if (this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) {
- /* clang-format off */
- makefileStream
- << "# Produce verbose output by default.\n"
- << "VERBOSE = 1\n"
- << "\n";
- /* clang-format on */
+ makefileStream << "# Produce verbose output by default.\n"
+ "VERBOSE = 1\n"
+ "\n";
}
if (this->IsWatcomWMake()) {
- /* clang-format off */
- makefileStream <<
- "!ifndef VERBOSE\n"
- ".SILENT\n"
- "!endif\n"
- "\n"
- ;
- /* clang-format on */
+ makefileStream << "!ifndef VERBOSE\n"
+ ".SILENT\n"
+ "!endif\n"
+ "\n";
} else {
makefileStream << "# Command-line flag to silence nested $(MAKE).\n"
"$(VERBOSE)MAKESILENT = -s\n"
@@ -809,7 +820,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
{
this->WriteDivider(makefileStream);
makefileStream << "# Special targets to cleanup operation of make.\n"
- << "\n";
+ "\n";
// Write special "cmake_check_build_system" target to run cmake with
// the --check-build-system flag.
@@ -828,13 +839,19 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
std::string cmakefileName = "CMakeFiles/Makefile.cmake";
std::string runRule = cmStrCat(
"$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
- cm->GetIgnoreWarningAsError() ? "--compile-no-warning-as-error " : "",
+ cm->GetIgnoreCompileWarningAsError() ? "--compile-no-warning-as-error "
+ : "",
+ cm->GetIgnoreLinkWarningAsError() ? "--link-no-warning-as-error " : "",
"--check-build-system ",
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
" 0");
std::vector<std::string> no_depends;
commands.push_back(std::move(runRule));
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+ addInstrumentationCommand(this->GetCMakeInstance()->GetInstrumentation(),
+ commands);
+#endif
if (!this->IsRootMakefile()) {
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
@@ -851,8 +868,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
}
void cmLocalUnixMakefileGenerator3::WriteConvenienceRule(
- std::ostream& ruleFileStream, const std::string& realTarget,
- const std::string& helpTarget)
+ std::ostream& ruleFileStream, std::string const& realTarget,
+ std::string const& helpTarget)
{
// A rule is only needed if the names are different.
if (realTarget != helpTarget) {
@@ -878,7 +895,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(
}
void cmLocalUnixMakefileGenerator3::AppendFlags(
- std::string& flags, const std::string& newFlags) const
+ std::string& flags, std::string const& newFlags) const
{
if (this->IsWatcomWMake() && !newFlags.empty()) {
std::string newf = newFlags;
@@ -892,7 +909,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(
}
void cmLocalUnixMakefileGenerator3::AppendRuleDepend(
- std::vector<std::string>& depends, const char* ruleFileName)
+ std::vector<std::string>& depends, char const* ruleFileName)
{
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
@@ -913,7 +930,7 @@ void cmLocalUnixMakefileGenerator3::AppendRuleDepends(
}
void cmLocalUnixMakefileGenerator3::AppendCustomDepends(
- std::vector<std::string>& depends, const std::vector<cmCustomCommand>& ccs)
+ std::vector<std::string>& depends, std::vector<cmCustomCommand> const& ccs)
{
for (cmCustomCommand const& cc : ccs) {
cmCustomCommandGenerator ccg(cc, this->GetConfigName(), this);
@@ -934,7 +951,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomDepend(
}
void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
- std::vector<std::string>& commands, const std::vector<cmCustomCommand>& ccs,
+ std::vector<std::string>& commands, std::vector<cmCustomCommand> const& ccs,
cmGeneratorTarget* target, std::string const& relative)
{
for (cmCustomCommand const& cc : ccs) {
@@ -1018,17 +1035,22 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
vars.CMTargetName = target->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(target->GetType()).c_str();
+ vars.CMTargetLabels = target->GetTargetLabelsString().c_str();
std::string output;
- const std::vector<std::string>& outputs = ccg.GetOutputs();
- if (!outputs.empty()) {
- output = outputs[0];
- if (workingDir.empty()) {
- output = this->MaybeRelativeToCurBinDir(output);
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
+ for (size_t i = 0; i < outputs.size(); ++i) {
+ output = cmStrCat(output,
+ this->ConvertToOutputFormat(
+ ccg.GetWorkingDirectory().empty()
+ ? this->MaybeRelativeToCurBinDir(outputs[i])
+ : outputs[i],
+ cmOutputConverter::SHELL));
+ if (i != outputs.size() - 1) {
+ output = cmStrCat(output, ",");
}
- output =
- this->ConvertToOutputFormat(output, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
+ vars.Role = ccg.GetCC().GetRole().c_str();
launcher = val;
rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
@@ -1093,8 +1115,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
}
void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
- std::vector<std::string>& commands, const std::set<std::string>& files,
- cmGeneratorTarget* target, const char* filename)
+ std::vector<std::string>& commands, std::set<std::string> const& files,
+ cmGeneratorTarget* target, char const* filename)
{
std::string currentBinDir = this->GetCurrentBinaryDirectory();
std::string cleanfile = cmStrCat(
@@ -1112,7 +1134,7 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
fout << "file(REMOVE_RECURSE\n";
for (std::string const& file : files) {
std::string fc = this->MaybeRelativeToCurBinDir(file);
- fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
+ fout << " " << cmOutputConverter::EscapeForCMake(fc) << '\n';
}
fout << ")\n";
}
@@ -1132,11 +1154,11 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
languages, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
/* clang-format off */
fout << "\n"
- << "# Per-language clean rules from dependency scanning.\n"
- << "foreach(lang " << cmJoin(languages, " ") << ")\n"
- << " include(" << this->GetTargetDirectory(target)
+ "# Per-language clean rules from dependency scanning.\n"
+ "foreach(lang " << cmJoin(languages, " ") << ")\n"
+ " include(" << this->GetTargetDirectory(target)
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
- << "endforeach()\n";
+ "endforeach()\n";
/* clang-format on */
}
}
@@ -1156,7 +1178,7 @@ void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand(
return;
}
- const auto& rootLG = this->GetGlobalGenerator()->GetLocalGenerators().at(0);
+ auto const& rootLG = this->GetGlobalGenerator()->GetLocalGenerators().at(0);
std::string const& currentBinaryDir = this->GetCurrentBinaryDirectory();
std::string cleanfile =
cmStrCat(currentBinaryDir, "/CMakeFiles/cmake_directory_clean.cmake");
@@ -1171,7 +1193,7 @@ void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand(
for (std::string const& cfl : cleanFiles) {
std::string fc = rootLG->MaybeRelativeToCurBinDir(
cmSystemTools::CollapseFullPath(cfl, currentBinaryDir));
- fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
+ fout << " " << cmOutputConverter::EscapeForCMake(fc) << '\n';
}
fout << ")\n";
}
@@ -1218,7 +1240,7 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
// Echo one line at a time.
std::string line;
line.reserve(200);
- for (const char* c = text.c_str();; ++c) {
+ for (char const* c = text.c_str();; ++c) {
if (*c == '\n' || *c == '\0') {
// Avoid writing a blank last line on end-of-string.
if (*c != '\0' || !line.empty()) {
@@ -1233,17 +1255,14 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
"@$(CMAKE_COMMAND) -E cmake_echo_color \"--switch=$(COLOR)\" ",
color_name);
if (progress) {
- cmd += "--progress-dir=";
- cmd += this->ConvertToOutputFormat(progress->Dir,
- cmOutputConverter::SHELL);
- cmd += " ";
- cmd += "--progress-num=";
- cmd += progress->Arg;
- cmd += " ";
+ cmd = cmStrCat(cmd, "--progress-dir=",
+ this->ConvertToOutputFormat(
+ progress->Dir, cmOutputConverter::SHELL),
+ " --progress-num=", progress->Arg, ' ');
}
cmd += this->EscapeForShell(line);
}
- commands.push_back(std::move(cmd));
+ commands.emplace_back(std::move(cmd));
}
// Reset the line to empty.
@@ -1344,7 +1363,7 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
}
bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
- const std::string& tgtInfo, bool verbose, bool color)
+ std::string const& tgtInfo, bool verbose, bool color)
{
// read in the target info file
if (!this->Makefile->ReadListFile(tgtInfo) ||
@@ -1464,7 +1483,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
internalDepFile, depFiles, dependencies,
projectOnly ? NotInProjectDir(this->GetSourceDirectory(),
this->GetBinaryDirectory())
- : std::function<bool(const std::string&)>())) {
+ : std::function<bool(std::string const&)>())) {
// regenerate dependencies files
if (verbose) {
std::string targetName = cmCMakePath(targetDir)
@@ -1584,7 +1603,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
#ifndef CMAKE_BOOTSTRAP
else if (lang == "Fortran") {
ruleFileStream << "# Note that incremental build could trigger "
- << "a call to cmake_copy_f90_mod on each re-build\n";
+ "a call to cmake_copy_f90_mod on each re-build\n";
scanner = cm::make_unique<cmDependsFortran>(this);
} else if (lang == "Java") {
scanner = cm::make_unique<cmDependsJava>();
@@ -1617,8 +1636,8 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
// Convert the string to a list and preserve empty entries.
cmList pairs{ *pairs_string, cmList::EmptyElements::Yes };
for (auto i = pairs.begin(); i != pairs.end() && (i + 1) != pairs.end();) {
- const std::string& depender = *i++;
- const std::string& dependee = *i++;
+ std::string const& depender = *i++;
+ std::string const& dependee = *i++;
// If the depender is missing then delete the dependee to make
// sure both will be regenerated.
@@ -1672,9 +1691,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
// Write all global targets
this->WriteDivider(ruleFileStream);
ruleFileStream << "# Targets provided globally by CMake.\n"
- << "\n";
- const auto& targets = this->GetGeneratorTargets();
- for (const auto& gt : targets) {
+ "\n";
+ auto const& targets = this->GetGeneratorTargets();
+ for (auto const& gt : targets) {
if (gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
std::string targetString =
"Special rule for the target " + gt->GetName();
@@ -1682,7 +1701,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
std::vector<std::string> depends;
cmValue p = gt->GetProperty("EchoString");
- const char* text = p ? p->c_str() : "Running external command ...";
+ char const* text = p ? p->c_str() : "Running external command ...";
depends.reserve(gt->GetUtilities().size());
for (BT<std::pair<std::string, bool>> const& u : gt->GetUtilities()) {
depends.push_back(u.Value.first);
@@ -1823,11 +1842,17 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
{
std::string runRule = cmStrCat(
"$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
- cm->GetIgnoreWarningAsError() ? "--compile-no-warning-as-error " : "",
+ cm->GetIgnoreCompileWarningAsError() ? "--compile-no-warning-as-error "
+ : "",
+ cm->GetIgnoreLinkWarningAsError() ? "--link-no-warning-as-error " : "",
"--check-build-system ",
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
" 1");
commands.push_back(std::move(runRule));
+#if !defined(CMAKE_BOOTSTRAP) && !defined(_WIN32)
+ addInstrumentationCommand(this->GetCMakeInstance()->GetInstrumentation(),
+ commands);
+#endif
}
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
@@ -1898,8 +1923,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
{
// To enable dependencies filtering
cmakefileStream << "\n"
- << "# Consider dependencies only in project.\n"
- << "set(CMAKE_DEPENDS_IN_PROJECT_ONLY "
+ "# Consider dependencies only in project.\n"
+ "set(CMAKE_DEPENDS_IN_PROJECT_ONLY "
<< (cmIsOn(this->Makefile->GetSafeDefinition(
"CMAKE_DEPENDS_IN_PROJECT_ONLY"))
? "ON"
@@ -1916,8 +1941,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
// list the languages
cmakefileStream << "# The set of languages for which implicit "
- "dependencies are needed:\n";
- cmakefileStream << "set(CMAKE_DEPENDS_LANGUAGES\n";
+ "dependencies are needed:\n"
+ "set(CMAKE_DEPENDS_LANGUAGES\n";
for (auto const& implicitLang : implicitLangs) {
cmakefileStream << " \"" << implicitLang.first << "\"\n";
if (requireFortran && implicitLang.first == "Fortran"_s) {
@@ -1934,16 +1959,16 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
cmakefileStream
<< "# The set of files for implicit dependencies of each language:\n";
for (auto const& implicitLang : implicitLangs) {
- const auto& lang = implicitLang.first;
+ auto const& lang = implicitLang.first;
- cmakefileStream << "set(CMAKE_DEPENDS_CHECK_" << lang << "\n";
+ cmakefileStream << "set(CMAKE_DEPENDS_CHECK_" << lang << '\n';
auto const& implicitPairs = implicitLang.second;
// for each file pair
for (auto const& implicitPair : implicitPairs) {
for (auto const& di : implicitPair.second) {
- cmakefileStream << " \"" << di << "\" ";
- cmakefileStream << "\"" << implicitPair.first << "\"\n";
+ cmakefileStream << " \"" << di << "\" \"" << implicitPair.first
+ << "\"\n";
}
}
cmakefileStream << " )\n";
@@ -1962,32 +1987,31 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
std::string smodExt =
this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_EXT");
cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_SEP \"" << smodSep
- << "\")\n";
- cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_EXT \"" << smodExt
- << "\")\n";
+ << "\")\n"
+ "set(CMAKE_Fortran_SUBMODULE_EXT \""
+ << smodExt << "\")\n";
}
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
this->GetTargetDefines(target, this->GetConfigName(), lang, defines);
if (!defines.empty()) {
- /* clang-format off */
- cmakefileStream
- << "\n"
- << "# Preprocessor definitions for this target.\n"
- << "set(CMAKE_TARGET_DEFINITIONS_" << lang << "\n";
- /* clang-format on */
+ cmakefileStream << "\n"
+ "# Preprocessor definitions for this target.\n"
+ "set(CMAKE_TARGET_DEFINITIONS_"
+ << lang << '\n';
for (std::string const& define : defines) {
cmakefileStream << " " << cmOutputConverter::EscapeForCMake(define)
- << "\n";
+ << '\n';
}
cmakefileStream << " )\n";
}
// Target-specific include directories:
cmakefileStream << "\n"
- << "# The include file search paths:\n";
- cmakefileStream << "set(CMAKE_" << lang << "_TARGET_INCLUDE_PATH\n";
+ "# The include file search paths:\n"
+ "set(CMAKE_"
+ << lang << "_TARGET_INCLUDE_PATH\n";
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, target, lang,
@@ -2019,7 +2043,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
cmakefileStream << "\nset(CMAKE_INCLUDE_TRANSFORMS\n";
for (std::string const& tr : transformRules) {
cmakefileStream << " " << cmOutputConverter::EscapeForCMake(tr)
- << "\n";
+ << '\n';
}
cmakefileStream << " )\n";
}
@@ -2029,8 +2053,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
this->GetImplicitDepends(target, cmDependencyScannerKind::Compiler);
// list the dependency files managed by the compiler
- cmakefileStream << "\n# The set of dependency files which are needed:\n";
- cmakefileStream << "set(CMAKE_DEPENDS_DEPENDENCY_FILES\n";
+ cmakefileStream << "\n# The set of dependency files which are needed:\n"
+ "set(CMAKE_DEPENDS_DEPENDENCY_FILES\n";
for (auto const& compilerLang : compilerLangs) {
auto const& compilerPairs = compilerLang.second;
if (compilerLang.first == "CUSTOM"_s) {
@@ -2074,13 +2098,16 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os)
{
os << "# CMAKE generated file: DO NOT EDIT!\n"
- << "# Generated by \"" << this->GlobalGenerator->GetName() << "\""
- << " Generator, CMake Version " << cmVersion::GetMajorVersion() << "."
- << cmVersion::GetMinorVersion() << "\n\n";
+ "# Generated by \""
+ << this->GlobalGenerator->GetName()
+ << "\""
+ " Generator, CMake Version "
+ << cmVersion::GetMajorVersion() << '.' << cmVersion::GetMinorVersion()
+ << "\n\n";
}
std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
- const std::string& makefile, const std::string& tgt)
+ std::string const& makefile, std::string const& tgt)
{
// Call make on the given file.
std::string cmd = cmStrCat(
@@ -2130,7 +2157,7 @@ void cmLocalUnixMakefileGenerator3::WriteDivider(std::ostream& os)
}
void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os,
- const std::string& s)
+ std::string const& s)
{
// Write the given string to the stream with escaping to get it back
// into CMake through the lexical scanner.
@@ -2148,7 +2175,7 @@ void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os,
}
std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
- const std::string& p, bool useWatcomQuote)
+ std::string const& p, bool useWatcomQuote)
{
// Split the path into its components.
std::vector<std::string> components;
@@ -2169,7 +2196,7 @@ std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
// Return an empty path if there are no components.
if (!components.empty()) {
// Choose a slash direction and fix root component.
- const char* slash = "/";
+ char const* slash = "/";
#if defined(_WIN32) && !defined(__CYGWIN__)
if (!cmSystemTools::GetForceUnixPaths()) {
slash = "\\";
@@ -2225,14 +2252,14 @@ std::string cmLocalUnixMakefileGenerator3::GetTargetDirectory(
cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const&
cmLocalUnixMakefileGenerator3::GetImplicitDepends(
- const cmGeneratorTarget* tgt, cmDependencyScannerKind scanner)
+ cmGeneratorTarget const* tgt, cmDependencyScannerKind scanner)
{
return this->ImplicitDepends[tgt->GetName()][scanner];
}
void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
- const cmGeneratorTarget* tgt, const std::string& lang,
- const std::string& obj, const std::string& src,
+ cmGeneratorTarget const* tgt, std::string const& lang,
+ std::string const& obj, std::string const& src,
cmDependencyScannerKind scanner)
{
this->ImplicitDepends[tgt->GetName()][scanner][lang][obj].push_back(src);
@@ -2251,7 +2278,7 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
// used by NMake and Borland make does not support "cd /d" so this
// feature simply cannot work with them (Borland make does not even
// support changing the drive letter with just "d:").
- const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd ";
+ char const* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd ";
cmGlobalUnixMakefileGenerator3* gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7d5a922..55b939a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,8 +12,8 @@
#include <vector>
#include "cmDepends.h"
+#include "cmGeneratorOptions.h"
#include "cmLocalCommonGenerator.h"
-#include "cmLocalGenerator.h"
class cmCustomCommand;
class cmCustomCommandGenerator;
@@ -34,7 +34,7 @@ public:
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
~cmLocalUnixMakefileGenerator3() override;
- std::string GetConfigName() const;
+ std::string const& GetConfigName() const;
void ComputeHomeRelativeOutputPath() override;
@@ -45,7 +45,7 @@ public:
// this returns the relative path between the HomeOutputDirectory and this
// local generators StartOutputDirectory
- const std::string& GetHomeRelativeOutputPath();
+ std::string const& GetHomeRelativeOutputPath();
/**
* Convert a file path to a Makefile target or dependency with
@@ -54,10 +54,10 @@ public:
std::string ConvertToMakefilePath(std::string const& path) const;
// Write out a make rule
- void WriteMakeRule(std::ostream& os, const char* comment,
- const std::string& target,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands, bool symbolic,
+ void WriteMakeRule(std::ostream& os, char const* comment,
+ std::string const& target,
+ std::vector<std::string> const& depends,
+ std::vector<std::string> const& commands, bool symbolic,
bool in_help = false);
// write the main variables used by the makefiles
@@ -84,7 +84,7 @@ public:
void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; }
// used in writing out Cmake files such as WriteDirectoryInformation
- static void WriteCMakeArgument(std::ostream& os, const std::string& s);
+ static void WriteCMakeArgument(std::ostream& os, std::string const& s);
/** creates the common disclaimer text at the top of each makefile */
void WriteDisclaimer(std::ostream& os);
@@ -93,12 +93,12 @@ public:
void WriteDivider(std::ostream& os);
/** used to create a recursive make call */
- std::string GetRecursiveMakeCall(const std::string& makefile,
- const std::string& tgt);
+ std::string GetRecursiveMakeCall(std::string const& makefile,
+ std::string const& tgt);
// append flags to a string
void AppendFlags(std::string& flags,
- const std::string& newFlags) const override;
+ std::string const& newFlags) const override;
using cmLocalCommonGenerator::AppendFlags;
// append an echo command
@@ -130,15 +130,15 @@ public:
std::string const& targetDir,
std::string const& relDir);
- static std::string ConvertToQuotedOutputPath(const std::string& p,
+ static std::string ConvertToQuotedOutputPath(std::string const& p,
bool useWatcomQuote);
- std::string CreateMakeVariable(const std::string& sin,
- const std::string& s2in);
+ std::string CreateMakeVariable(std::string const& sin,
+ std::string const& s2in);
/** Called from command-line hook to bring dependencies up to date
for a target. */
- bool UpdateDependencies(const std::string& tgtInfo, bool verbose,
+ bool UpdateDependencies(std::string const& tgtInfo, bool verbose,
bool color) override;
/** Called from command-line hook to clear dependencies. */
@@ -165,8 +165,8 @@ public:
cmDependencyScannerKind scanner = cmDependencyScannerKind::CMake);
void AddImplicitDepends(
- cmGeneratorTarget const* tgt, const std::string& lang,
- const std::string& obj, const std::string& src,
+ cmGeneratorTarget const* tgt, std::string const& lang,
+ std::string const& obj, std::string const& src,
cmDependencyScannerKind scanner = cmDependencyScannerKind::CMake);
// write the target rules for the local Makefile into the stream
@@ -208,24 +208,24 @@ protected:
void WriteDependLanguageInfo(std::ostream& cmakefileStream,
cmGeneratorTarget* tgt);
- // this converts a file name that is relative to the StartOuputDirectory
+ // this converts a file name that is relative to the StartOutputDirectory
// into a full path
- std::string ConvertToFullPath(const std::string& localPath);
+ std::string ConvertToFullPath(std::string const& localPath);
void WriteConvenienceRule(std::ostream& ruleFileStream,
- const std::string& realTarget,
- const std::string& helpTarget);
+ std::string const& realTarget,
+ std::string const& helpTarget);
void AppendRuleDepend(std::vector<std::string>& depends,
- const char* ruleFileName);
+ char const* ruleFileName);
void AppendRuleDepends(std::vector<std::string>& depends,
std::vector<std::string> const& ruleFiles);
void AppendCustomDepends(std::vector<std::string>& depends,
- const std::vector<cmCustomCommand>& ccs);
+ std::vector<cmCustomCommand> const& ccs);
void AppendCustomDepend(std::vector<std::string>& depends,
cmCustomCommandGenerator const& cc);
void AppendCustomCommands(std::vector<std::string>& commands,
- const std::vector<cmCustomCommand>& ccs,
+ std::vector<cmCustomCommand> const& ccs,
cmGeneratorTarget* target,
std::string const& relative);
void AppendCustomCommand(std::vector<std::string>& commands,
@@ -235,9 +235,9 @@ protected:
bool echo_comment = false,
std::ostream* content = nullptr);
void AppendCleanCommand(std::vector<std::string>& commands,
- const std::set<std::string>& files,
+ std::set<std::string> const& files,
cmGeneratorTarget* target,
- const char* filename = nullptr);
+ char const* filename = nullptr);
void AppendDirectoryCleanCommand(std::vector<std::string>& commands);
// Helper methods for dependency updates.
@@ -281,8 +281,8 @@ private:
std::map<std::string, LocalObjectInfo>& localObjectFiles);
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
- const char* comment,
- const std::string& output,
+ char const* comment,
+ std::string const& output,
LocalObjectInfo const& info);
std::vector<std::string> LocalHelp;
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 165f0fd..586aeb8 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalVisualStudio10Generator.h"
#include <cmext/string_view>
@@ -20,8 +20,8 @@ class cmGeneratorTarget;
class cmVS10XMLParser : public cmXMLParser
{
public:
- void EndElement(const std::string& /* name */) override {}
- void CharacterDataHandler(const char* data, int length) override
+ void EndElement(std::string const& /* name */) override {}
+ void CharacterDataHandler(char const* data, int length) override
{
if (this->DoGUID) {
if (data[0] == '{') {
@@ -33,7 +33,7 @@ public:
this->DoGUID = false;
}
}
- void StartElement(const std::string& name, const char**) override
+ void StartElement(std::string const& name, char const**) override
{
// once the GUID is found do nothing
if (!this->GUID.empty()) {
@@ -82,7 +82,7 @@ void cmLocalVisualStudio10Generator::GenerateTarget(cmGeneratorTarget* target)
}
void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID(
- const std::string& name, const char* path)
+ std::string const& name, char const* path)
{
cmVS10XMLParser parser;
parser.ParseFile(path);
@@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID(
guidStoreName, parser.GUID, "Stored GUID", cmStateEnums::INTERNAL);
}
-const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const
+char const* cmLocalVisualStudio10Generator::ReportErrorLabel() const
{
return ":VCEnd";
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index fe44bb5..a8c8d45 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,11 +26,11 @@ public:
~cmLocalVisualStudio10Generator() override;
- void ReadAndStoreExternalGUID(const std::string& name,
- const char* path) override;
+ void ReadAndStoreExternalGUID(std::string const& name,
+ char const* path) override;
protected:
- const char* ReportErrorLabel() const override;
+ char const* ReportErrorLabel() const override;
bool CustomCommandUseLocal() const override { return true; }
private:
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8be21c2..ae98399 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalVisualStudio7Generator.h"
#include <algorithm>
@@ -25,6 +25,7 @@
#include "cmCustomCommandLines.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalVisualStudio7Generator.h"
@@ -47,7 +48,7 @@
#include "cmXMLParser.h"
#include "cmake.h"
-static bool cmLVS7G_IsFAT(const char* dir);
+static bool cmLVS7G_IsFAT(char const* dir);
class cmLocalVisualStudio7GeneratorInternals
{
@@ -59,7 +60,7 @@ public:
using ItemVector = cmComputeLinkInformation::ItemVector;
void OutputLibraries(std::ostream& fout, ItemVector const& libs);
void OutputObjects(std::ostream& fout, cmGeneratorTarget* t,
- std::string const& config, const char* isep = nullptr);
+ std::string const& config, char const* isep = nullptr);
private:
cmLocalVisualStudio7Generator* LocalGenerator;
@@ -86,8 +87,8 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() = default;
void cmLocalVisualStudio7Generator::AddHelperCommands()
{
// Now create GUIDs for targets
- const auto& tgts = this->GetGeneratorTargets();
- for (const auto& l : tgts) {
+ auto const& tgts = this->GetGeneratorTargets();
+ for (auto const& l : tgts) {
if (!l->IsInBuildSystem()) {
continue;
}
@@ -128,7 +129,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
// Visual Studio .NET 2003 Service Pack 1 will not run post-build
// commands for targets in which no sources are built. Add dummy
// rules to force these targets to build.
- const auto& tgts = this->GetGeneratorTargets();
+ auto const& tgts = this->GetGeneratorTargets();
for (auto const& l : tgts) {
if (l->GetType() == cmStateEnums::GLOBAL_TARGET) {
cmCustomCommandLines force_commands =
@@ -183,8 +184,8 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
auto new_end = std::unique(listFiles.begin(), listFiles.end());
listFiles.erase(new_end, listFiles.end());
- for (const std::string& lf : listFiles) {
- depFile << lf << "\n";
+ for (std::string const& lf : listFiles) {
+ depFile << lf << '\n';
}
}
@@ -228,8 +229,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
return nullptr;
}
- std::string makefileIn =
- cmStrCat(this->GetCurrentSourceDirectory(), "/CMakeLists.txt");
+ std::string makefileIn = this->GetCMakeInstance()->GetCMakeListFile(
+ this->GetCurrentSourceDirectory());
if (cmSourceFile* file = this->Makefile->GetSource(makefileIn)) {
if (file->GetCustomCommand()) {
return file;
@@ -258,9 +259,12 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
cmMakeSingleCommandLine({ cmSystemTools::GetCMakeCommand(), argS, argB,
"--check-stamp-file", stampName });
- if (cm->GetIgnoreWarningAsError()) {
+ if (cm->GetIgnoreCompileWarningAsError()) {
commandLines[0].emplace_back("--compile-no-warning-as-error");
}
+ if (cm->GetIgnoreLinkWarningAsError()) {
+ commandLines[0].emplace_back("--link-no-warning-as-error");
+ }
std::string comment = cmStrCat("Building Custom Rule ", makefileIn);
auto cc = cm::make_unique<cmCustomCommand>();
cc->SetOutputs(stampName);
@@ -284,7 +288,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
void cmLocalVisualStudio7Generator::WriteConfigurations(
std::ostream& fout, std::vector<std::string> const& configs,
- const std::string& libName, cmGeneratorTarget* target)
+ std::string const& libName, cmGeneratorTarget* target)
{
fout << "\t<Configurations>\n";
for (std::string const& config : configs) {
@@ -385,7 +389,9 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {
{ "FloatingPointModel", "fp:strict", "Use strict floating point model", "1",
0 },
{ "FloatingPointModel", "fp:fast", "Use fast floating point model", "2", 0 },
+ // noqa: spellcheck off
{ "FavorSizeOrSpeed", "Ot", "Favor fast code", "1", 0 },
+ // noqa: spellcheck on
{ "FavorSizeOrSpeed", "Os", "Favor small code", "2", 0 },
{ "CompileAs", "TC", "Compile as c code", "1", 0 },
{ "CompileAs", "TP", "Compile as c++ code", "2", 0 },
@@ -564,10 +570,10 @@ public:
, Stream(os)
{
}
- void Start(const char* tool)
+ void Start(char const* tool)
{
this->First = true;
- this->Stream << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"";
+ this->Stream << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << '"';
}
void Finish()
{
@@ -575,7 +581,7 @@ public:
if (!this->First) {
std::string finishScript =
this->LG->FinishConstructScript(VsProjectType::vcxproj);
- this->Stream << this->LG->EscapeForXML(finishScript) << "\"";
+ this->Stream << this->LG->EscapeForXML(finishScript) << '"';
}
this->Stream << "/>\n";
@@ -611,8 +617,8 @@ private:
};
void cmLocalVisualStudio7Generator::WriteConfiguration(
- std::ostream& fout, const std::string& configName,
- const std::string& libName, cmGeneratorTarget* target)
+ std::ostream& fout, std::string const& configName,
+ std::string const& libName, cmGeneratorTarget* target)
{
std::string mfcFlag;
if (cmValue p = this->Makefile->GetDefinition("CMAKE_MFC_FLAG")) {
@@ -623,15 +629,15 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
fout << "\t\t<Configuration\n"
- << "\t\t\tName=\"" << configName << "|" << gg->GetPlatformName()
- << "\"\n";
+ "\t\t\tName=\""
+ << configName << '|' << gg->GetPlatformName() << "\"\n";
// This is an internal type to Visual Studio, it seems that:
// 4 == static library
// 2 == dll
// 1 == executable
// 10 == utility
- const char* configType = "10";
- const char* projectType = nullptr;
+ char const* configType = "10";
+ char const* projectType = nullptr;
bool targetBuilds = true;
switch (target->GetType()) {
@@ -664,16 +670,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
}
std::string flags;
std::string langForClCompile;
+ std::string const& linkLanguage =
+ (this->FortranProject ? std::string("Fortran")
+ : target->GetLinkerLanguage(configName));
+ if (linkLanguage.empty()) {
+ cmSystemTools::Error(
+ cmStrCat("CMake can not determine linker language for target: ",
+ target->GetName()));
+ return;
+ }
if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
- const std::string& linkLanguage =
- (this->FortranProject ? std::string("Fortran")
- : target->GetLinkerLanguage(configName));
- if (linkLanguage.empty()) {
- cmSystemTools::Error(
- cmStrCat("CMake can not determine linker language for target: ",
- target->GetName()));
- return;
- }
langForClCompile = linkLanguage;
if (langForClCompile == "C" || langForClCompile == "CXX" ||
langForClCompile == "Fortran") {
@@ -759,7 +765,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
targetOptions.AddDefine(configDefine);
// Add the export symbol definition for shared library objects.
- if (const std::string* exportMacro = target->GetExportMacro()) {
+ if (std::string const* exportMacro = target->GetExportMacro()) {
targetOptions.AddDefine(*exportMacro);
}
@@ -773,20 +779,20 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
target->GetType() == cmStateEnums::OBJECT_LIBRARY
? intermediateDir
: target->GetDirectory(configName);
- /* clang-format off */
fout << "\t\t\tOutputDirectory=\""
<< this->ConvertToXMLOutputPathSingle(outDir) << "\"\n";
- /* clang-format on */
}
- /* clang-format off */
fout << "\t\t\tIntermediateDirectory=\""
<< this->ConvertToXMLOutputPath(intermediateDir)
<< "\"\n"
- << "\t\t\tConfigurationType=\"" << configType << "\"\n"
- << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n"
- << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n";
- /* clang-format on */
+ "\t\t\tConfigurationType=\""
+ << configType
+ << "\"\n"
+ "\t\t\tUseOfMFC=\""
+ << mfcFlag
+ << "\"\n"
+ "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n";
if (this->FortranProject) {
// Intel Fortran >= 15.0 uses TargetName property.
@@ -817,12 +823,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
} else {
fout << "\t\t\tCharacterSet=\"2\">\n";
}
- const char* tool = "VCCLCompilerTool";
+ char const* tool = "VCCLCompilerTool";
if (this->FortranProject) {
tool = "VFFortranCompilerTool";
}
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"" << tool << "\"\n";
+ "\t\t\t\tName=\""
+ << tool << "\"\n";
if (this->FortranProject) {
cmValue target_mod_dir = target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir;
@@ -850,39 +857,25 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
if (gg->IsMarmasmEnabled() && !this->FortranProject) {
Options marmasmOptions(this, Options::MarmasmCompiler, nullptr, nullptr);
- /* clang-format off */
- fout <<
- "\t\t\t<Tool\n"
- "\t\t\t\tName=\"MARMASM\"\n"
- ;
- /* clang-format on */
+ fout << "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"MARMASM\"\n";
targetOptions.OutputAdditionalIncludeDirectories(fout, 4, "ASM_MARMASM");
// Use same preprocessor definitions as VCCLCompilerTool.
targetOptions.OutputPreprocessorDefinitions(fout, 4, "ASM_MARMASM");
marmasmOptions.OutputFlagMap(fout, 4);
- /* clang-format off */
- fout <<
- "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"
- "\t\t\t/>\n";
- /* clang-format on */
+ fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"
+ "\t\t\t/>\n";
}
if (gg->IsMasmEnabled() && !this->FortranProject) {
Options masmOptions(this, Options::MasmCompiler, nullptr, nullptr);
- /* clang-format off */
- fout <<
- "\t\t\t<Tool\n"
- "\t\t\t\tName=\"MASM\"\n"
- ;
- /* clang-format on */
+ fout << "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"MASM\"\n";
targetOptions.OutputAdditionalIncludeDirectories(fout, 4, "ASM_MASM");
// Use same preprocessor definitions as VCCLCompilerTool.
targetOptions.OutputPreprocessorDefinitions(fout, 4, "ASM_MASM");
masmOptions.OutputFlagMap(fout, 4);
- /* clang-format off */
- fout <<
- "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"
- "\t\t\t/>\n";
- /* clang-format on */
+ fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"
+ "\t\t\t/>\n";
}
tool = "VCCustomBuildTool";
if (this->FortranProject) {
@@ -912,26 +905,24 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
} else {
fout << "\t\t\t\tTargetEnvironment=\"1\"\n";
}
- fout << "\t\t\t\tGenerateStublessProxies=\"true\"\n";
- fout << "\t\t\t\tTypeLibraryName=\"$(InputName).tlb\"\n";
- fout << "\t\t\t\tOutputDirectory=\"$(IntDir)\"\n";
- fout << "\t\t\t\tHeaderFileName=\"$(InputName).h\"\n";
- fout << "\t\t\t\tDLLDataFileName=\"\"\n";
- fout << "\t\t\t\tInterfaceIdentifierFileName=\"$(InputName)_i.c\"\n";
- fout << "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n";
+ fout << "\t\t\t\tGenerateStublessProxies=\"true\"\n"
+ "\t\t\t\tTypeLibraryName=\"$(InputName).tlb\"\n"
+ "\t\t\t\tOutputDirectory=\"$(IntDir)\"\n"
+ "\t\t\t\tHeaderFileName=\"$(InputName).h\"\n"
+ "\t\t\t\tDLLDataFileName=\"\"\n"
+ "\t\t\t\tInterfaceIdentifierFileName=\"$(InputName)_i.c\"\n"
+ "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n";
// end of <Tool Name=VCMIDLTool
// Add manifest tool settings.
if (targetBuilds) {
- const char* manifestTool = "VCManifestTool";
+ char const* manifestTool = "VCManifestTool";
if (this->FortranProject) {
manifestTool = "VFManifestTool";
}
- /* clang-format off */
- fout <<
- "\t\t\t<Tool\n"
- "\t\t\t\tName=\"" << manifestTool << "\"";
- /* clang-format on */
+ fout << "\t\t\t<Tool\n"
+ "\t\t\t\tName=\""
+ << manifestTool << '"';
std::vector<cmSourceFile const*> manifest_srcs;
target->GetManifests(manifest_srcs, configName);
@@ -939,9 +930,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
fout << "\n\t\t\t\tAdditionalManifestFiles=\"";
for (cmSourceFile const* manifest : manifest_srcs) {
std::string m = manifest->GetFullPath();
- fout << this->ConvertToXMLOutputPath(m) << ";";
+ fout << this->ConvertToXMLOutputPath(m) << ';';
}
- fout << "\"";
+ fout << '"';
}
// Check if we need the FAT32 workaround.
@@ -957,46 +948,34 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
}
this->OutputTargetRules(fout, configName, target, libName);
- this->OutputBuildTool(fout, configName, target, targetOptions);
+ this->OutputBuildTool(fout, linkLanguage, configName, target, targetOptions);
this->OutputDeploymentDebuggerTool(fout, configName, target);
fout << "\t\t</Configuration>\n";
}
-std::string cmLocalVisualStudio7Generator::GetBuildTypeLinkerFlags(
- std::string const& rootLinkerFlags, const std::string& configName)
-{
- std::string configTypeUpper = cmSystemTools::UpperCase(configName);
- std::string extraLinkOptionsBuildTypeDef =
- cmStrCat(rootLinkerFlags, '_', configTypeUpper);
-
- const std::string& extraLinkOptionsBuildType =
- this->Makefile->GetRequiredDefinition(extraLinkOptionsBuildTypeDef);
-
- return extraLinkOptionsBuildType;
-}
-
void cmLocalVisualStudio7Generator::OutputBuildTool(
- std::ostream& fout, const std::string& configName, cmGeneratorTarget* target,
- const Options& targetOptions)
+ std::ostream& fout, std::string const& linkLanguage,
+ std::string const& configName, cmGeneratorTarget* target,
+ Options const& targetOptions)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
std::string temp;
std::string extraLinkOptions;
if (target->GetType() == cmStateEnums::EXECUTABLE) {
- extraLinkOptions = cmStrCat(
- this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"), ' ',
- GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName));
+ this->AddConfigVariableFlags(extraLinkOptions, "CMAKE_EXE_LINKER_FLAGS",
+ target, cmBuildStep::Link, linkLanguage,
+ configName);
}
if (target->GetType() == cmStateEnums::SHARED_LIBRARY) {
- extraLinkOptions = cmStrCat(
- this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"), ' ',
- GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName));
+ this->AddConfigVariableFlags(extraLinkOptions, "CMAKE_SHARED_LINKER_FLAGS",
+ target, cmBuildStep::Link, linkLanguage,
+ configName);
}
if (target->GetType() == cmStateEnums::MODULE_LIBRARY) {
- extraLinkOptions = cmStrCat(
- this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"), ' ',
- GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName));
+ this->AddConfigVariableFlags(extraLinkOptions, "CMAKE_MODULE_LINKER_FLAGS",
+ target, cmBuildStep::Link, linkLanguage,
+ configName);
}
cmValue targetLinkFlags = target->GetProperty("LINK_FLAGS");
@@ -1018,6 +997,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
// LINK_OPTIONS are escaped.
this->AppendCompileOptions(extraLinkOptions, opts);
+ this->AppendWarningAsErrorLinkerFlags(extraLinkOptions, target,
+ linkLanguage);
+
Options linkOptions(this, Options::Linker);
if (this->FortranProject) {
linkOptions.AddTable(cmLocalVisualStudio7GeneratorFortranLinkFlagTable);
@@ -1040,11 +1022,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
std::string libpath =
cmStrCat(this->GetTargetDirectory(target), '/', configName, '/',
target->GetName(), ".lib");
- const char* tool =
+ char const* tool =
this->FortranProject ? "VFLibrarianTool" : "VCLibrarianTool";
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"" << tool << "\"\n";
- fout << "\t\t\t\tOutputFile=\""
+ "\t\t\t\tName=\""
+ << tool
+ << "\"\n"
+ "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(libpath) << "\"/>\n";
break;
}
@@ -1052,12 +1036,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
std::string targetNameFull = target->GetFullName(configName);
std::string libpath =
cmStrCat(target->GetDirectory(configName), '/', targetNameFull);
- const char* tool = "VCLibrarianTool";
+ char const* tool = "VCLibrarianTool";
if (this->FortranProject) {
tool = "VFLibrarianTool";
}
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"" << tool << "\"\n";
+ "\t\t\t\tName=\""
+ << tool << "\"\n";
if (this->FortranProject) {
std::ostringstream libdeps;
@@ -1089,7 +1074,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
return;
}
cmComputeLinkInformation& cli = *pcli;
- std::string linkLanguage = cli.GetLinkLanguage();
if (!target->GetLinkerTypeProperty(linkLanguage, configName).empty()) {
// Visual Studio 10 or upper is required for this feature
@@ -1105,12 +1089,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
// language.
std::string standardLibsVar =
cmStrCat("CMAKE_", linkLanguage, "_STANDARD_LIBRARIES");
- const char* tool = "VCLinkerTool";
+ char const* tool = "VCLinkerTool";
if (this->FortranProject) {
tool = "VFLinkerTool";
}
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"" << tool << "\"\n";
+ "\t\t\t\tName=\""
+ << tool << "\"\n";
if (!gg->NeedLinkLibraryDependencies(target)) {
fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n";
}
@@ -1121,7 +1106,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
if (this->FortranProject) {
this->Internal->OutputObjects(fout, target, configName, " ");
}
- fout << " ";
+ fout << ' ';
this->Internal->OutputLibraries(fout, cli.GetItems());
fout << "\"\n";
temp =
@@ -1173,7 +1158,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
return;
}
cmComputeLinkInformation& cli = *pcli;
- std::string linkLanguage = cli.GetLinkLanguage();
if (!target->GetLinkerTypeProperty(linkLanguage, configName).empty()) {
// Visual Studio 10 or upper is required for this feature
@@ -1191,12 +1175,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
// language.
std::string standardLibsVar =
cmStrCat("CMAKE_", linkLanguage, "_STANDARD_LIBRARIES");
- const char* tool = "VCLinkerTool";
+ char const* tool = "VCLinkerTool";
if (this->FortranProject) {
tool = "VFLinkerTool";
}
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"" << tool << "\"\n";
+ "\t\t\t\tName=\""
+ << tool << "\"\n";
if (!gg->NeedLinkLibraryDependencies(target)) {
fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n";
}
@@ -1224,7 +1209,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
fout << "\"\n";
std::string path = this->ConvertToXMLOutputPathSingle(
target->GetPDBDirectory(configName));
- fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/"
+ fout << "\t\t\t\tProgramDatabaseFile=\"" << path << '/'
<< targetNames.PDB << "\"\n";
if (targetOptions.UsingDebugInfo()) {
fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n";
@@ -1233,7 +1218,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
fout << "\t\t\t\tSubSystem=\"8\"\n";
if (!linkOptions.GetFlag("EntryPointSymbol")) {
- const char* entryPointSymbol = targetOptions.UsingUnicode()
+ char const* entryPointSymbol = targetOptions.UsingUnicode()
? (isWin32Executable ? "wWinMainCRTStartup" : "mainWCRTStartup")
: (isWin32Executable ? "WinMainCRTStartup" : "mainACRTStartup");
fout << "\t\t\t\tEntryPointSymbol=\"" << entryPointSymbol << "\"\n";
@@ -1249,7 +1234,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
std::string stackVar = cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE");
cmValue stackVal = this->Makefile->GetDefinition(stackVar);
if (stackVal) {
- fout << "\t\t\t\tStackReserveSize=\"" << *stackVal << "\"";
+ fout << "\t\t\t\tStackReserveSize=\"" << *stackVal << '"';
}
temp = cmStrCat(
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact),
@@ -1266,7 +1251,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
static std::string cmLocalVisualStudio7GeneratorEscapeForXML(
- const std::string& s)
+ std::string const& s)
{
std::string ret = s;
cmSystemTools::ReplaceString(ret, "&", "&amp;");
@@ -1277,7 +1262,7 @@ static std::string cmLocalVisualStudio7GeneratorEscapeForXML(
return ret;
}
-static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue)
+static std::string GetEscapedPropertyIfValueNotNULL(char const* propertyValue)
{
return propertyValue
? cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue)
@@ -1349,7 +1334,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
std::ostream& fout, cmGeneratorTarget* gt, std::string const& configName,
- const char* isep)
+ char const* isep)
{
// VS < 8 does not support per-config source locations so we
// list object library content on the link line instead.
@@ -1358,7 +1343,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
std::vector<cmSourceFile const*> objs;
gt->GetExternalObjects(objs, configName);
- const char* sep = isep ? isep : "";
+ char const* sep = isep ? isep : "";
for (cmSourceFile const* obj : objs) {
if (!obj->GetObjectLibrary().empty()) {
std::string const& objFile = obj->GetFullPath();
@@ -1373,7 +1358,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
std::ostream& fout, std::vector<std::string> const& stdlink,
std::vector<std::string> const& dirs)
{
- const char* comma = "";
+ char const* comma = "";
for (std::string dir : dirs) {
// Remove any trailing slash and skip empty paths.
@@ -1402,14 +1387,14 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
}
// No special processing on toolchain-defined standard link directory paths
- for (const auto& dir : stdlink) {
+ for (auto const& dir : stdlink) {
fout << comma << this->ConvertToXMLOutputPath(dir);
comma = ",";
}
}
void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
- const std::string& libName,
+ std::string const& libName,
cmGeneratorTarget* target)
{
std::vector<std::string> configs =
@@ -1522,7 +1507,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
std::string lang =
lg->GlobalGenerator->GetLanguageFromExtension(sf.GetExtension().c_str());
- const std::string& sourceLang = lg->GetSourceFileLanguage(sf);
+ std::string const& sourceLang = lg->GetSourceFileLanguage(sf);
bool needForceLang = false;
// source file does not match its extension language
if (lang != sourceLang) {
@@ -1537,12 +1522,12 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
fc.ObjectName = objectName;
needfc = true;
}
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
if (cmValue cflags = sf.GetProperty(COMPILE_FLAGS)) {
fc.CompileFlags = genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS);
needfc = true;
}
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
if (cmValue coptions = sf.GetProperty(COMPILE_OPTIONS)) {
lg->AppendCompileOptions(
fc.CompileFlags,
@@ -1550,7 +1535,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
needfc = true;
}
// Add precompile headers compile options.
- const std::string pchSource = gt->GetPchSource(config, lang);
+ std::string const pchSource = gt->GetPchSource(config, lang);
if (!pchSource.empty() && !sf.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
std::string pchOptions;
if (sf.GetFullPath() == pchSource) {
@@ -1594,7 +1579,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
break;
}
}
- const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (cmValue cdefs = sf.GetProperty(COMPILE_DEFINITIONS)) {
fc.CompileDefs = genexInterpreter.Evaluate(*cdefs, COMPILE_DEFINITIONS);
needfc = true;
@@ -1606,7 +1591,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
needfc = true;
}
- const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (cmValue cincs = sf.GetProperty(INCLUDE_DIRECTORIES)) {
fc.IncludeDirs = genexInterpreter.Evaluate(*cincs, INCLUDE_DIRECTORIES);
needfc = true;
@@ -1624,7 +1609,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
}
}
- const std::string& linkLanguage = gt->GetLinkerLanguage(config);
+ std::string const& linkLanguage = gt->GetLinkerLanguage(config);
// If HEADER_FILE_ONLY is set, we must suppress this generation in
// the project file
fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") ||
@@ -1682,19 +1667,19 @@ std::string cmLocalVisualStudio7Generator::ComputeLongestObjectDirectory(
}
bool cmLocalVisualStudio7Generator::WriteGroup(
- const cmSourceGroup* sg, cmGeneratorTarget* target, std::ostream& fout,
- const std::string& libName, std::vector<std::string> const& configs,
+ cmSourceGroup const* sg, cmGeneratorTarget* target, std::ostream& fout,
+ std::string const& libName, std::vector<std::string> const& configs,
AllConfigSources const& sources)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
- const std::vector<const cmSourceFile*>& sourceFiles = sg->GetSourceFiles();
+ std::vector<cmSourceFile const*> const& sourceFiles = sg->GetSourceFiles();
std::vector<cmSourceGroup> const& children = sg->GetGroupChildren();
// Write the children to temporary output.
bool hasChildrenWithSources = false;
std::ostringstream tmpOut;
- for (const auto& child : children) {
+ for (auto const& child : children) {
if (this->WriteGroup(&child, target, tmpOut, libName, configs, sources)) {
hasChildrenWithSources = true;
}
@@ -1714,7 +1699,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
auto& sourcesVisited = this->GetSourcesVisited(target);
// Loop through each source in the source group.
- for (const cmSourceFile* sf : sourceFiles) {
+ for (cmSourceFile const* sf : sourceFiles) {
std::string source = sf->GetFullPath();
if (source != libName || target->GetType() == cmStateEnums::UTILITY ||
@@ -1740,7 +1725,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
fcinfo);
}
} else if (!fcinfo.FileConfigMap.empty()) {
- const char* aCompilerTool = "VCCLCompilerTool";
+ char const* aCompilerTool = "VCCLCompilerTool";
std::string ppLang = "CXX";
if (this->FortranProject) {
aCompilerTool = "VFFortranCompilerTool";
@@ -1781,14 +1766,15 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
for (auto const& fci : fcinfo.FileConfigMap) {
cmLVS7GFileConfig const& fc = fci.second;
fout << "\t\t\t\t<FileConfiguration\n"
- << "\t\t\t\t\tName=\"" << fci.first << "|"
- << gg->GetPlatformName() << "\"";
+ "\t\t\t\t\tName=\""
+ << fci.first << '|' << gg->GetPlatformName() << '"';
if (fc.ExcludedFromBuild) {
fout << " ExcludedFromBuild=\"true\"";
}
- fout << ">\n";
- fout << "\t\t\t\t\t<Tool\n"
- << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n";
+ fout << ">\n"
+ "\t\t\t\t\t<Tool\n"
+ "\t\t\t\t\tName=\""
+ << aCompilerTool << "\"\n";
if (!fc.CompileFlags.empty() || !fc.CompileDefs.empty() ||
!fc.CompileDefsConfig.empty() || !fc.IncludeDirs.empty()) {
Options::Tool tool = Options::Compiler;
@@ -1821,7 +1807,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
<< "\"\n";
}
fout << "\t\t\t\t\t/>\n"
- << "\t\t\t\t</FileConfiguration>\n";
+ "\t\t\t\t</FileConfiguration>\n";
}
}
fout << "\t\t\t</File>\n";
@@ -1843,30 +1829,32 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
void cmLocalVisualStudio7Generator::WriteCustomRule(
std::ostream& fout, std::vector<std::string> const& configs,
- const char* source, const cmCustomCommand& command, FCInfo& fcinfo)
+ char const* source, cmCustomCommand const& command, FCInfo& fcinfo)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
// Write the rule for each configuration.
- const char* compileTool = "VCCLCompilerTool";
+ char const* compileTool = "VCCLCompilerTool";
if (this->FortranProject) {
compileTool = "VFCLCompilerTool";
}
- const char* customTool = "VCCustomBuildTool";
+ char const* customTool = "VCCustomBuildTool";
if (this->FortranProject) {
customTool = "VFCustomBuildTool";
}
for (std::string const& config : configs) {
cmCustomCommandGenerator ccg(command, config, this);
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[config];
- fout << "\t\t\t\t<FileConfiguration\n";
- fout << "\t\t\t\t\tName=\"" << config << "|" << gg->GetPlatformName()
- << "\">\n";
+ fout << "\t\t\t\t<FileConfiguration\n"
+ "\t\t\t\t\tName=\""
+ << config << '|' << gg->GetPlatformName() << "\">\n";
if (!fc.CompileFlags.empty()) {
fout << "\t\t\t\t\t<Tool\n"
- << "\t\t\t\t\tName=\"" << compileTool << "\"\n"
- << "\t\t\t\t\tAdditionalOptions=\""
+ "\t\t\t\t\tName=\""
+ << compileTool
+ << "\"\n"
+ "\t\t\t\t\tAdditionalOptions=\""
<< this->EscapeForXML(fc.CompileFlags) << "\"/>\n";
}
@@ -1878,12 +1866,12 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
script += this->FinishConstructScript(VsProjectType::vcxproj);
/* clang-format off */
fout << "\t\t\t\t\t<Tool\n"
- << "\t\t\t\t\tName=\"" << customTool << "\"\n"
+ "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
<< this->EscapeForXML(comment) << "\"\n"
- << "\t\t\t\t\tCommandLine=\""
+ "\t\t\t\t\tCommandLine=\""
<< this->EscapeForXML(script) << "\"\n"
- << "\t\t\t\t\tAdditionalDependencies=\"";
+ "\t\t\t\t\tAdditionalDependencies=\"";
/* clang-format on */
if (ccg.GetDepends().empty()) {
// There are no real dependencies. Produce an artificial one to
@@ -1903,32 +1891,32 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
}
}
}
- fout << "\"\n";
- fout << "\t\t\t\t\tOutputs=\"";
+ fout << "\"\n"
+ "\t\t\t\t\tOutputs=\"";
if (ccg.GetOutputs().empty()) {
fout << source << "_force";
} else {
// Write a rule for the output generated by this command.
- const char* sep = "";
+ char const* sep = "";
for (std::string const& output : ccg.GetOutputs()) {
fout << sep << this->ConvertToXMLOutputPathSingle(output);
sep = ";";
}
}
- fout << "\"/>\n";
- fout << "\t\t\t\t</FileConfiguration>\n";
+ fout << "\"/>\n"
+ "\t\t\t\t</FileConfiguration>\n";
}
}
void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout,
- const char* group,
- const char*)
+ char const* group,
+ char const*)
{
- /* clang-format off */
fout << "\t\t<Filter\n"
- << "\t\t\tName=\"" << group << "\"\n"
- << "\t\t\tFilter=\"\">\n";
- /* clang-format on */
+ "\t\t\tName=\""
+ << group
+ << "\"\n"
+ "\t\t\tFilter=\"\">\n";
}
void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
@@ -1938,8 +1926,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
// look for custom rules on a target and collect them together
void cmLocalVisualStudio7Generator::OutputTargetRules(
- std::ostream& fout, const std::string& configName, cmGeneratorTarget* target,
- const std::string& /*libName*/)
+ std::ostream& fout, std::string const& configName, cmGeneratorTarget* target,
+ std::string const& /*libName*/)
{
if (target->GetType() > cmStateEnums::GLOBAL_TARGET) {
return;
@@ -1947,7 +1935,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
EventWriter event(this, configName, fout);
// Add pre-build event.
- const char* tool =
+ char const* tool =
this->FortranProject ? "VFPreBuildEventTool" : "VCPreBuildEventTool";
event.Start(tool);
event.Write(target->GetPreBuildCommands());
@@ -1997,8 +1985,8 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
if (vsProvider && vsLocalpath && vsProjectname) {
/* clang-format off */
fout << "\tSccProjectName=\"" << *vsProjectname << "\"\n"
- << "\tSccLocalPath=\"" << *vsLocalpath << "\"\n"
- << "\tSccProvider=\"" << *vsProvider << "\"\n";
+ "\tSccLocalPath=\"" << *vsLocalpath << "\"\n"
+ "\tSccProvider=\"" << *vsProvider << "\"\n";
/* clang-format on */
cmValue vsAuxPath = target->GetProperty("VS_SCC_AUXPATH");
@@ -2009,21 +1997,20 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
}
void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
- std::ostream& fout, const std::string& libName, cmGeneratorTarget* target)
+ std::ostream& fout, std::string const& libName, cmGeneratorTarget* target)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
- /* clang-format off */
- fout << R"(<?xml version="1.0" encoding = ")"
- << gg->Encoding() << "\"?>\n"
- << "<VisualStudioProject\n"
- << "\tProjectCreator=\"Intel Fortran\"\n"
- << "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n";
- /* clang-format on */
+ fout << R"(<?xml version="1.0" encoding = ")" << gg->Encoding()
+ << "\"?>\n"
+ "<VisualStudioProject\n"
+ "\tProjectCreator=\"Intel Fortran\"\n"
+ "\tVersion=\""
+ << gg->GetIntelProjectVersion() << "\"\n";
cmValue p = target->GetProperty("VS_KEYWORD");
- const char* keyword = p ? p->c_str() : "Console Application";
- const char* projectType = nullptr;
+ char const* keyword = p ? p->c_str() : "Console Application";
+ char const* projectType = nullptr;
switch (target->GetType()) {
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
@@ -2057,15 +2044,15 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
this->WriteProjectSCC(fout, target);
/* clang-format off */
fout<< "\tKeyword=\"" << keyword << "\">\n"
- << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n"
- << "\t<Platforms>\n"
- << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
- << "\t</Platforms>\n";
+ "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n"
+ "\t<Platforms>\n"
+ "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
+ "\t</Platforms>\n";
/* clang-format on */
}
void cmLocalVisualStudio7Generator::WriteProjectStart(
- std::ostream& fout, const std::string& libName, cmGeneratorTarget* target,
+ std::ostream& fout, std::string const& libName, cmGeneratorTarget* target,
std::vector<cmSourceGroup>&)
{
if (this->FortranProject) {
@@ -2076,20 +2063,20 @@ void cmLocalVisualStudio7Generator::WriteProjectStart(
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
- /* clang-format off */
- fout << R"(<?xml version="1.0" encoding = ")"
- << gg->Encoding() << "\"?>\n"
- << "<VisualStudioProject\n"
- << "\tProjectType=\"Visual C++\"\n";
- /* clang-format on */
- fout << "\tVersion=\"" << (static_cast<uint16_t>(gg->GetVersion()) / 10)
- << ".00\"\n";
+ fout << R"(<?xml version="1.0" encoding = ")" << gg->Encoding()
+ << "\"?>\n"
+ "<VisualStudioProject\n"
+ "\tProjectType=\"Visual C++\"\n"
+ "\tVersion=\""
+ << (static_cast<uint16_t>(gg->GetVersion()) / 10) << ".00\"\n";
cmValue p = target->GetProperty("PROJECT_LABEL");
- const std::string projLabel = p ? *p : libName;
+ std::string const projLabel = p ? *p : libName;
p = target->GetProperty("VS_KEYWORD");
- const std::string keyword = p ? *p : "Win32Proj";
- fout << "\tName=\"" << projLabel << "\"\n";
- fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n";
+ std::string const keyword = p ? *p : "Win32Proj";
+ fout << "\tName=\"" << projLabel
+ << "\"\n"
+ "\tProjectGUID=\"{"
+ << gg->GetGUID(libName) << "}\"\n";
this->WriteProjectSCC(fout, target);
if (cmValue targetFrameworkVersion =
target->GetProperty("VS_DOTNET_TARGET_FRAMEWORK_VERSION")) {
@@ -2097,31 +2084,23 @@ void cmLocalVisualStudio7Generator::WriteProjectStart(
}
/* clang-format off */
fout << "\tKeyword=\"" << keyword << "\">\n"
- << "\t<Platforms>\n"
- << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
- << "\t</Platforms>\n";
+ "\t<Platforms>\n"
+ "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
+ "\t</Platforms>\n";
/* clang-format on */
if (gg->IsMarmasmEnabled()) {
- /* clang-format off */
- fout <<
- "\t<ToolFiles>\n"
- "\t\t<DefaultToolFile\n"
- "\t\t\tFileName=\"marmasm.rules\"\n"
- "\t\t/>\n"
- "\t</ToolFiles>\n"
- ;
- /* clang-format on */
+ fout << "\t<ToolFiles>\n"
+ "\t\t<DefaultToolFile\n"
+ "\t\t\tFileName=\"marmasm.rules\"\n"
+ "\t\t/>\n"
+ "\t</ToolFiles>\n";
}
if (gg->IsMasmEnabled()) {
- /* clang-format off */
- fout <<
- "\t<ToolFiles>\n"
- "\t\t<DefaultToolFile\n"
- "\t\t\tFileName=\"masm.rules\"\n"
- "\t\t/>\n"
- "\t</ToolFiles>\n"
- ;
- /* clang-format on */
+ fout << "\t<ToolFiles>\n"
+ "\t\t<DefaultToolFile\n"
+ "\t\t\tFileName=\"masm.rules\"\n"
+ "\t\t/>\n"
+ "\t</ToolFiles>\n";
}
}
@@ -2134,27 +2113,29 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
if (cmHasLiteralPrefix(key, "VS_GLOBAL_")) {
std::string name = key.substr(10);
if (!name.empty()) {
- /* clang-format off */
fout << "\t\t<Global\n"
- << "\t\t\tName=\"" << name << "\"\n"
- << "\t\t\tValue=\"" << target->GetProperty(key) << "\"\n"
- << "\t\t/>\n";
- /* clang-format on */
+ "\t\t\tName=\""
+ << name
+ << "\"\n"
+ "\t\t\tValue=\""
+ << target->GetProperty(key)
+ << "\"\n"
+ "\t\t/>\n";
}
}
}
fout << "\t</Globals>\n"
- << "</VisualStudioProject>\n";
+ "</VisualStudioProject>\n";
}
-std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
+std::string cmLocalVisualStudio7Generator::EscapeForXML(std::string const& s)
{
return cmLocalVisualStudio7GeneratorEscapeForXML(s);
}
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(
- const std::string& path)
+ std::string const& path)
{
std::string ret =
this->ConvertToOutputFormat(path, cmOutputConverter::SHELL);
@@ -2166,7 +2147,7 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(
}
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(
- const std::string& path)
+ std::string const& path)
{
std::string ret =
this->ConvertToOutputFormat(path, cmOutputConverter::SHELL);
@@ -2178,16 +2159,14 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(
}
void cmVS7GeneratorOptions::OutputFlag(std::ostream& fout, int indent,
- const std::string& flag,
- const std::string& content)
+ std::string const& flag,
+ std::string const& content)
{
fout.fill('\t');
fout.width(indent);
// write an empty string to get the fill level indent to print
- fout << "";
- fout << flag << "=\"";
- fout << cmLocalVisualStudio7GeneratorEscapeForXML(content);
- fout << "\"\n";
+ fout << "" << flag << "=\""
+ << cmLocalVisualStudio7GeneratorEscapeForXML(content) << "\"\n";
}
// This class is used to parse an existing vs 7 project
@@ -2195,8 +2174,8 @@ void cmVS7GeneratorOptions::OutputFlag(std::ostream& fout, int indent,
class cmVS7XMLParser : public cmXMLParser
{
public:
- void EndElement(const std::string& /* name */) override {}
- void StartElement(const std::string& name, const char** atts) override
+ void EndElement(std::string const& /* name */) override {}
+ void StartElement(std::string const& name, char const** atts) override
{
// once the GUID is found do nothing
if (!this->GUID.empty()) {
@@ -2236,7 +2215,7 @@ public:
};
void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
- const std::string& name, const char* path)
+ std::string const& name, char const* path)
{
cmVS7XMLParser parser;
parser.ParseFile(path);
@@ -2257,7 +2236,7 @@ std::string cmLocalVisualStudio7Generator::GetTargetDirectory(
return dir;
}
-static bool cmLVS7G_IsFAT(const char* dir)
+static bool cmLVS7G_IsFAT(char const* dir)
{
if (dir[0] && dir[1] == ':') {
char volRoot[4] = "_:/";
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 7c395d6..c1002c5 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -32,8 +32,8 @@ public:
: cmVisualStudioGeneratorOptions(lg, tool, table, extraTable)
{
}
- void OutputFlag(std::ostream& fout, int indent, const std::string& tag,
- const std::string& content) override;
+ void OutputFlag(std::ostream& fout, int indent, std::string const& tag,
+ std::string const& content) override;
};
/** \class cmLocalVisualStudio7Generator
@@ -50,9 +50,9 @@ public:
~cmLocalVisualStudio7Generator() override;
- cmLocalVisualStudio7Generator(const cmLocalVisualStudio7Generator&) = delete;
- const cmLocalVisualStudio7Generator& operator=(
- const cmLocalVisualStudio7Generator&) = delete;
+ cmLocalVisualStudio7Generator(cmLocalVisualStudio7Generator const&) = delete;
+ cmLocalVisualStudio7Generator const& operator=(
+ cmLocalVisualStudio7Generator const&) = delete;
void AddHelperCommands() override;
@@ -73,7 +73,7 @@ public:
/**
* Specify the type of the build: static, dll, or executable.
*/
- void SetBuildType(BuildType, const std::string& name);
+ void SetBuildType(BuildType, std::string const& name);
std::string GetTargetDirectory(
cmGeneratorTarget const* target) const override;
@@ -82,8 +82,8 @@ public:
std::string ComputeLongestObjectDirectory(
cmGeneratorTarget const*) const override;
- virtual void ReadAndStoreExternalGUID(const std::string& name,
- const char* path);
+ virtual void ReadAndStoreExternalGUID(std::string const& name,
+ char const* path);
std::set<cmSourceFile const*>& GetSourcesVisited(
cmGeneratorTarget const* target)
@@ -99,28 +99,27 @@ protected:
private:
using Options = cmVS7GeneratorOptions;
using FCInfo = cmLocalVisualStudio7GeneratorFCInfo;
- std::string GetBuildTypeLinkerFlags(std::string const& rootLinkerFlags,
- const std::string& configName);
void FixGlobalTargets();
- void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
+ void WriteVCProjHeader(std::ostream& fout, std::string const& libName,
cmGeneratorTarget* tgt,
std::vector<cmSourceGroup>& sgs);
void WriteVCProjFooter(std::ostream& fout, cmGeneratorTarget* target);
- void WriteVCProjFile(std::ostream& fout, const std::string& libName,
+ void WriteVCProjFile(std::ostream& fout, std::string const& libName,
cmGeneratorTarget* tgt);
void WriteConfigurations(std::ostream& fout,
std::vector<std::string> const& configs,
- const std::string& libName, cmGeneratorTarget* tgt);
- void WriteConfiguration(std::ostream& fout, const std::string& configName,
- const std::string& libName, cmGeneratorTarget* tgt);
- std::string EscapeForXML(const std::string& s);
- std::string ConvertToXMLOutputPath(const std::string& path);
- std::string ConvertToXMLOutputPathSingle(const std::string& path);
- void OutputTargetRules(std::ostream& fout, const std::string& configName,
+ std::string const& libName, cmGeneratorTarget* tgt);
+ void WriteConfiguration(std::ostream& fout, std::string const& configName,
+ std::string const& libName, cmGeneratorTarget* tgt);
+ std::string EscapeForXML(std::string const& s);
+ std::string ConvertToXMLOutputPath(std::string const& path);
+ std::string ConvertToXMLOutputPathSingle(std::string const& path);
+ void OutputTargetRules(std::ostream& fout, std::string const& configName,
cmGeneratorTarget* target,
- const std::string& libName);
- void OutputBuildTool(std::ostream& fout, const std::string& configName,
- cmGeneratorTarget* t, const Options& targetOptions);
+ std::string const& libName);
+ void OutputBuildTool(std::ostream& fout, std::string const& linkLanguage,
+ std::string const& configName, cmGeneratorTarget* t,
+ Options const& targetOptions);
void OutputDeploymentDebuggerTool(std::ostream& fout,
std::string const& config,
cmGeneratorTarget* target);
@@ -128,24 +127,24 @@ private:
std::vector<std::string> const& stdlink,
std::vector<std::string> const& dirs);
void WriteProjectSCC(std::ostream& fout, cmGeneratorTarget* target);
- void WriteProjectStart(std::ostream& fout, const std::string& libName,
+ void WriteProjectStart(std::ostream& fout, std::string const& libName,
cmGeneratorTarget* tgt,
std::vector<cmSourceGroup>& sgs);
- void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
+ void WriteProjectStartFortran(std::ostream& fout, std::string const& libName,
cmGeneratorTarget* tgt);
- void WriteVCProjBeginGroup(std::ostream& fout, const char* group,
- const char* filter);
+ void WriteVCProjBeginGroup(std::ostream& fout, char const* group,
+ char const* filter);
void WriteVCProjEndGroup(std::ostream& fout);
void WriteCustomRule(std::ostream& fout,
std::vector<std::string> const& configs,
- const char* source, const cmCustomCommand& command,
+ char const* source, cmCustomCommand const& command,
FCInfo& fcinfo);
void WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt);
class AllConfigSources;
- bool WriteGroup(const cmSourceGroup* sg, cmGeneratorTarget* target,
- std::ostream& fout, const std::string& libName,
+ bool WriteGroup(cmSourceGroup const* sg, cmGeneratorTarget* target,
+ std::ostream& fout, std::string const& libName,
std::vector<std::string> const& configs,
AllConfigSources const& sources);
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 34b8ae3..381e914 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalVisualStudioGenerator.h"
#include <utility>
@@ -18,6 +18,7 @@
#include "cmOutputConverter.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -85,7 +86,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
std::unique_ptr<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
- const std::string& config,
+ std::string const& config,
bool isFortran)
{
std::unique_ptr<cmCustomCommand> pcc;
@@ -116,18 +117,18 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
return pcc;
}
-const char* cmLocalVisualStudioGenerator::ReportErrorLabel() const
+char const* cmLocalVisualStudioGenerator::ReportErrorLabel() const
{
return ":VCReportError";
}
-const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const
+char const* cmLocalVisualStudioGenerator::GetReportErrorLabel() const
{
return this->ReportErrorLabel();
}
std::string cmLocalVisualStudioGenerator::ConstructScript(
- cmCustomCommandGenerator const& ccg, const std::string& newline_text)
+ cmCustomCommandGenerator const& ccg, std::string const& newline_text)
{
bool useLocal = this->CustomCommandUseLocal();
std::string workingDirectory = ccg.GetWorkingDirectory();
@@ -136,12 +137,12 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
std::string newline;
// Line to check for error between commands.
- std::string check_error = newline_text;
+ std::string check_error;
if (useLocal) {
- check_error += "if %errorlevel% neq 0 goto :cmEnd";
+ check_error = cmStrCat(newline_text, "if %errorlevel% neq 0 goto :cmEnd");
} else {
- check_error += "if errorlevel 1 goto ";
- check_error += this->GetReportErrorLabel();
+ check_error = cmStrCat(newline_text, "if errorlevel 1 goto ",
+ this->GetReportErrorLabel());
}
// Store the script in a string.
@@ -149,26 +150,22 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
// Open a local context.
if (useLocal) {
- script += newline;
+ script = cmStrCat(newline, "setlocal");
newline = newline_text;
- script += "setlocal";
}
if (!workingDirectory.empty()) {
// Change the working directory.
- script += newline;
+ script = cmStrCat(script, newline, "cd ",
+ this->ConvertToOutputFormat(workingDirectory, SHELL),
+ check_error);
newline = newline_text;
- script += "cd ";
- script += this->ConvertToOutputFormat(workingDirectory, SHELL);
- script += check_error;
// Change the working drive.
if (workingDirectory.size() > 1 && workingDirectory[1] == ':') {
- script += newline;
+ script = cmStrCat(script, newline, workingDirectory[0],
+ workingDirectory[1], check_error);
newline = newline_text;
- script += workingDirectory[0];
- script += workingDirectory[1];
- script += check_error;
}
}
@@ -178,11 +175,8 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
cmValue extraPath =
this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
if (extraPath) {
- script += newline;
+ script = cmStrCat(script, newline, "set PATH=", *extraPath, ";%PATH%");
newline = newline_text;
- script += "set PATH=";
- script += *extraPath;
- script += ";%PATH%";
}
}
@@ -227,26 +221,30 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
// Close the local context.
if (useLocal) {
- script += newline;
- script += ":cmEnd";
- script += newline;
- script += "endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone";
- script += newline;
- script += ":cmErrorLevel";
- script += newline;
- script += "exit /b %1";
- script += newline;
- script += ":cmDone";
- script += newline;
- script += "if %errorlevel% neq 0 goto ";
- script += this->GetReportErrorLabel();
+ // clang-format off
+ script = cmStrCat(
+ script
+ , newline
+ , ":cmEnd"
+ , newline
+ , "endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone"
+ , newline
+ , ":cmErrorLevel"
+ , newline
+ , "exit /b %1"
+ , newline
+ , ":cmDone"
+ , newline
+ , "if %errorlevel% neq 0 goto ", this->GetReportErrorLabel()
+ );
+ // clang-format on
}
return script;
}
std::string cmLocalVisualStudioGenerator::FinishConstructScript(
- VsProjectType projectType, const std::string& newline)
+ VsProjectType projectType, std::string const& newline)
{
bool useLocal = this->CustomCommandUseLocal();
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 3e1eb5f..7303f92 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,13 +34,13 @@ public:
virtual bool IsVFProj() const = 0;
std::string ConstructScript(cmCustomCommandGenerator const& ccg,
- const std::string& newline = "\n");
+ std::string const& newline = "\n");
std::string FinishConstructScript(VsProjectType projectType,
- const std::string& newline = "\n");
+ std::string const& newline = "\n");
/** Label to which to jump in a batch file after a failed step in a
sequence of custom commands. */
- const char* GetReportErrorLabel() const;
+ char const* GetReportErrorLabel() const;
cmGlobalVisualStudioGenerator::VSVersion GetVersion() const;
@@ -52,10 +52,10 @@ public:
cmGeneratorTarget const* = nullptr) override;
protected:
- virtual const char* ReportErrorLabel() const;
+ virtual char const* ReportErrorLabel() const;
virtual bool CustomCommandUseLocal() const { return false; }
/** Construct a custom command to make exe import lib dir. */
std::unique_ptr<cmCustomCommand> MaybeCreateImplibDir(
- cmGeneratorTarget* target, const std::string& config, bool isFortran);
+ cmGeneratorTarget* target, std::string const& config, bool isFortran);
};
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 9646e66..c2ea1f2 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmLocalXCodeGenerator.h"
#include <memory>
@@ -35,10 +35,10 @@ std::string cmLocalXCodeGenerator::GetTargetDirectory(
}
void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags,
- const std::string& rawFlag) const
+ std::string const& rawFlag) const
{
- const cmGlobalXCodeGenerator* gg =
- static_cast<const cmGlobalXCodeGenerator*>(this->GlobalGenerator);
+ cmGlobalXCodeGenerator const* gg =
+ static_cast<cmGlobalXCodeGenerator const*>(this->GlobalGenerator);
gg->AppendFlag(flags, rawFlag);
}
@@ -46,7 +46,7 @@ void cmLocalXCodeGenerator::Generate()
{
cmLocalGenerator::Generate();
- for (const auto& target : this->GetGeneratorTargets()) {
+ for (auto const& target : this->GetGeneratorTargets()) {
target->HasMacOSXRpathInstallNameDir("");
}
}
@@ -54,7 +54,7 @@ void cmLocalXCodeGenerator::Generate()
void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os)
{
// First check if we need to warn about incompatible settings
- for (const auto& target : this->GetGeneratorTargets()) {
+ for (auto const& target : this->GetGeneratorTargets()) {
target->HasMacOSXRpathInstallNameDir("");
}
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index b825161..49a5e93 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,7 +31,7 @@ public:
std::string GetTargetDirectory(
cmGeneratorTarget const* target) const override;
void AppendFlagEscape(std::string& flags,
- const std::string& rawFlag) const override;
+ std::string const& rawFlag) const override;
void Generate() override;
void AddGeneratorSpecificInstallSetup(std::ostream& os) override;
void ComputeObjectFilenames(
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index f7636ac..b0d1065 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
index 8cf3765..a98984c 100644
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMSVC60LinkLineComputer.h"
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index 0a303ab..fbed49e 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index 48d2453..a8a766f 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMachO.h"
#include <cstddef>
@@ -83,13 +83,13 @@ public:
// A load_command and its associated data
struct RawLoadCommand
{
- uint32_t type(const cmMachOHeaderAndLoadCommands& m) const
+ uint32_t type(cmMachOHeaderAndLoadCommands const& m) const
{
if (this->LoadCommand.size() < sizeof(load_command)) {
return 0;
}
- const load_command* cmd =
- reinterpret_cast<const load_command*>(&this->LoadCommand[0]);
+ load_command const* cmd =
+ reinterpret_cast<load_command const*>(&this->LoadCommand[0]);
return m.swap(cmd->cmd);
}
std::vector<char> LoadCommand;
@@ -103,7 +103,7 @@ public:
virtual bool read_mach_o(cmsys::ifstream& fin) = 0;
- const std::vector<RawLoadCommand>& load_commands() const
+ std::vector<RawLoadCommand> const& load_commands() const
{
return this->LoadCommands;
}
@@ -194,11 +194,11 @@ bool cmMachOHeaderAndLoadCommands::read_load_commands(uint32_t ncmds,
class cmMachOInternal
{
public:
- cmMachOInternal(const char* fname);
- cmMachOInternal(const cmMachOInternal&) = delete;
+ cmMachOInternal(char const* fname);
+ cmMachOInternal(cmMachOInternal const&) = delete;
~cmMachOInternal();
- cmMachOInternal& operator=(const cmMachOInternal&) = delete;
+ cmMachOInternal& operator=(cmMachOInternal const&) = delete;
// read a Mach-O file
bool read_mach_o(uint32_t file_offset);
@@ -217,7 +217,7 @@ public:
std::vector<std::unique_ptr<cmMachOHeaderAndLoadCommands>> MachOList;
};
-cmMachOInternal::cmMachOInternal(const char* fname)
+cmMachOInternal::cmMachOInternal(char const* fname)
: Fin(fname)
{
// Quit now if the file could not be opened.
@@ -261,7 +261,7 @@ cmMachOInternal::cmMachOInternal(const char* fname)
}
// parse each Mach-O file
- for (const auto& arch : this->FatArchs) {
+ for (auto const& arch : this->FatArchs) {
if (!this->read_mach_o(OSSwapBigToHostInt32(arch.offset))) {
return;
}
@@ -316,10 +316,10 @@ bool cmMachOInternal::read_mach_o(uint32_t file_offset)
//============================================================================
// External class implementation.
-cmMachO::cmMachO(const char* fname)
+cmMachO::cmMachO(char const* fname)
: Internal(cm::make_unique<cmMachOInternal>(fname))
{
- for (const auto& m : this->Internal->MachOList) {
+ for (auto const& m : this->Internal->MachOList) {
Headers.push_back(m->mach_header());
}
}
@@ -346,7 +346,7 @@ bool cmMachO::GetInstallName(std::string& install_name)
std::unique_ptr<cmMachOHeaderAndLoadCommands>& macho =
this->Internal->MachOList[0];
for (size_t i = 0; i < macho->load_commands().size(); i++) {
- const cmMachOHeaderAndLoadCommands::RawLoadCommand& cmd =
+ cmMachOHeaderAndLoadCommands::RawLoadCommand const& cmd =
macho->load_commands()[i];
uint32_t lc_cmd = cmd.type(*macho);
if (lc_cmd == LC_ID_DYLIB || lc_cmd == LC_LOAD_WEAK_DYLIB ||
@@ -371,8 +371,8 @@ cmMachO::StringList cmMachO::GetArchitectures() const
{
cmMachO::StringList archs;
if (Valid() && !this->Headers.empty()) {
- for (const auto& header : this->Headers) {
- const char* archName = "unknown";
+ for (auto const& header : this->Headers) {
+ char const* archName = "unknown";
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000
if (__builtin_available(macOS 13.0, *)) {
archName = (header.CpuType & CPU_TYPE_ARM)
@@ -386,7 +386,7 @@ cmMachO::StringList cmMachO::GetArchitectures() const
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
- const NXArchInfo* archInfo = (header.CpuType & CPU_TYPE_ARM)
+ NXArchInfo const* archInfo = (header.CpuType & CPU_TYPE_ARM)
? NXGetArchInfoFromCpuType(header.CpuType, header.CpuSubType)
: NXGetArchInfoFromCpuType(header.CpuType, CPU_SUBTYPE_MULTIPLE);
#ifdef CM_MACOS_DEPRECATED_NXGetArchInfoFromCpuType
diff --git a/Source/cmMachO.h b/Source/cmMachO.h
index ddbfc28..506bc7e 100644
--- a/Source/cmMachO.h
+++ b/Source/cmMachO.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,7 +34,7 @@ public:
};
/** Construct with the name of the Mach-O input file to parse. */
- cmMachO(const char* fname);
+ cmMachO(char const* fname);
/** Destruct. */
~cmMachO();
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index b57c3dd..48c23f3 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMacroCommand.h"
-#include <cstdio>
#include <utility>
#include <cm/memory>
@@ -66,21 +65,19 @@ bool cmMacroHelperCommand::operator()(
// set the value of argc
std::string argcDef = std::to_string(expandedArgs.size());
- auto eit = expandedArgs.begin() + (this->Args.size() - 1);
+ auto expIt = expandedArgs.begin() + (this->Args.size() - 1);
std::string expandedArgn =
- cmList::to_string(cmMakeRange(eit, expandedArgs.end()));
+ cmList::to_string(cmMakeRange(expIt, expandedArgs.end()));
std::string expandedArgv = cmList::to_string(expandedArgs);
std::vector<std::string> variables;
variables.reserve(this->Args.size() - 1);
for (unsigned int j = 1; j < this->Args.size(); ++j) {
- variables.push_back("${" + this->Args[j] + "}");
+ variables.emplace_back(cmStrCat("${", this->Args[j], '}'));
}
std::vector<std::string> argVs;
argVs.reserve(expandedArgs.size());
- char argvName[60];
for (unsigned int j = 0; j < expandedArgs.size(); ++j) {
- snprintf(argvName, sizeof(argvName), "${ARGV%u}", j);
- argVs.emplace_back(argvName);
+ argVs.emplace_back(cmStrCat("${ARGV", j, '}'));
}
// Invoke all the functions that were collected in the block.
// for each function
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index b65a887..a5de516 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx
index ec8b826..241e0cd 100644
--- a/Source/cmMakeDirectoryCommand.cxx
+++ b/Source/cmMakeDirectoryCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMakeDirectoryCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 340bca8..746efde 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 98da10d..beca10d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmMakefile.h"
@@ -29,7 +29,6 @@
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cmCommandArgumentParserHelper.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmCustomCommandTypes.h"
@@ -108,8 +107,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
- this->SuppressSideEffects = false;
-
// Setup the default include complaint regular expression (match nothing).
this->ComplainFileRegularExpression = "^$";
@@ -117,7 +114,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->cmDefineRegex.compile("#([ \t]*)cmakedefine[ \t]+([A-Za-z_0-9]*)");
this->cmDefine01Regex.compile("#([ \t]*)cmakedefine01[ \t]+([A-Za-z_0-9]*)");
- this->cmAtVarRegex.compile("(@[A-Za-z_0-9/.+-]+@)");
this->cmNamedCurly.compile("^[A-Za-z0-9/_.+-]+{");
this->StateSnapshot =
@@ -131,7 +127,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->PushLoopBlockBarrier();
// By default the check is not done. It is enabled by
- // cmListFileCache in the top level if necessary.
+ // cmMakefile::Configure in the top level if necessary.
this->CheckCMP0000 = false;
#if !defined(CMAKE_BOOTSTRAP)
@@ -174,9 +170,9 @@ void cmMakefile::IssueMessage(MessageType t, std::string const& text) const
Message::LogLevel cmMakefile::GetCurrentLogLevel() const
{
- const cmake* cmakeInstance = this->GetCMakeInstance();
+ cmake const* cmakeInstance = this->GetCMakeInstance();
- const Message::LogLevel logLevelCliOrDefault = cmakeInstance->GetLogLevel();
+ Message::LogLevel const logLevelCliOrDefault = cmakeInstance->GetLogLevel();
assert("Expected a valid log level here" &&
logLevelCliOrDefault != Message::LogLevel::LOG_UNDEFINED);
@@ -185,7 +181,7 @@ Message::LogLevel cmMakefile::GetCurrentLogLevel() const
// If the log-level was set via the command line option, it takes precedence
// over the CMAKE_MESSAGE_LOG_LEVEL variable.
if (!cmakeInstance->WasLogLevelSetViaCLI()) {
- const Message::LogLevel logLevelFromVar = cmake::StringToLogLevel(
+ Message::LogLevel const logLevelFromVar = cmake::StringToLogLevel(
this->GetSafeDefinition("CMAKE_MESSAGE_LOG_LEVEL"));
if (logLevelFromVar != Message::LogLevel::LOG_UNDEFINED) {
result = logLevelFromVar;
@@ -195,41 +191,15 @@ Message::LogLevel cmMakefile::GetCurrentLogLevel() const
return result;
}
-bool cmMakefile::CheckCMP0037(std::string const& targetName,
- cmStateEnums::TargetType targetType) const
+void cmMakefile::IssueInvalidTargetNameError(
+ std::string const& targetName) const
{
- MessageType messageType = MessageType::AUTHOR_WARNING;
- std::string e;
- bool issueMessage = false;
- switch (this->GetPolicyStatus(cmPolicies::CMP0037)) {
- case cmPolicies::WARN:
- if (targetType != cmStateEnums::INTERFACE_LIBRARY) {
- e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0037), '\n');
- issueMessage = true;
- }
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- issueMessage = true;
- messageType = MessageType::FATAL_ERROR;
- break;
- }
- if (issueMessage) {
- e +=
- cmStrCat("The target name \"", targetName,
- "\" is reserved or not valid for certain "
- "CMake features, such as generator expressions, and may result "
- "in undefined behavior.");
- this->IssueMessage(messageType, e);
-
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
- return true;
+ this->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("The target name \"", targetName,
+ "\" is reserved or not valid for certain "
+ "CMake features, such as generator expressions, and may result "
+ "in undefined behavior."));
}
void cmMakefile::MaybeWarnCMP0074(std::string const& rootVar, cmValue rootDef,
@@ -402,20 +372,59 @@ void cmMakefile::PrintCommandTrace(cmListFileFunction const& lff,
}
}
+cmMakefile::CallRAII::CallRAII(cmMakefile* mf, std::string const& file,
+ cmExecutionStatus& status)
+ : CallRAII(mf, cmListFileContext::FromListFilePath(file), status)
+{
+}
+
+cmMakefile::CallRAII::CallRAII(cmMakefile* mf, cmListFileContext const& lfc,
+ cmExecutionStatus& status)
+ : Makefile{ mf }
+{
+ this->Makefile->Backtrace = this->Makefile->Backtrace.Push(lfc);
+ ++this->Makefile->RecursionDepth;
+ this->Makefile->ExecutionStatusStack.push_back(&status);
+}
+
+cmMakefile::CallRAII::~CallRAII()
+{
+ if (this->Makefile) {
+ this->Detach();
+ }
+}
+
+cmMakefile* cmMakefile::CallRAII::Detach()
+{
+ assert(this->Makefile);
+
+ this->Makefile->ExecutionStatusStack.pop_back();
+ --this->Makefile->RecursionDepth;
+ this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
+
+ auto* const mf = this->Makefile;
+ this->Makefile = nullptr;
+ return mf;
+}
+
// Helper class to make sure the call stack is valid.
-class cmMakefileCall
+class cmMakefile::CallScope : public CallRAII
{
public:
- cmMakefileCall(cmMakefile* mf, cmListFileFunction const& lff,
- cm::optional<std::string> deferId, cmExecutionStatus& status)
- : Makefile(mf)
+ CallScope(cmMakefile* mf, cmListFileFunction const& lff,
+ cm::optional<std::string> deferId, cmExecutionStatus& status)
+ : CallScope{ mf, lff,
+ cmListFileContext::FromListFileFunction(
+ lff, mf->StateSnapshot.GetExecutionListFile(),
+ std::move(deferId)),
+ status }
+ {
+ }
+
+ CallScope(cmMakefile* mf, cmListFileFunction const& lff,
+ cmListFileContext const& lfc, cmExecutionStatus& status)
+ : CallRAII{ mf, lfc, status }
{
- cmListFileContext const& lfc = cmListFileContext::FromListFileFunction(
- lff, this->Makefile->StateSnapshot.GetExecutionListFile(),
- std::move(deferId));
- this->Makefile->Backtrace = this->Makefile->Backtrace.Push(lfc);
- ++this->Makefile->RecursionDepth;
- this->Makefile->ExecutionStatusStack.push_back(&status);
#if !defined(CMAKE_BOOTSTRAP)
this->ProfilingDataRAII =
this->Makefile->GetCMakeInstance()->CreateProfilingEntry(
@@ -428,8 +437,7 @@ public:
}
argsValue["functionArgs"] = args;
}
- argsValue["location"] =
- cmStrCat(lfc.FilePath, ':', std::to_string(lfc.Line));
+ argsValue["location"] = cmStrCat(lfc.FilePath, ':', lfc.Line);
return argsValue;
});
#endif
@@ -442,28 +450,25 @@ public:
#endif
}
- ~cmMakefileCall()
+ ~CallScope()
{
#if !defined(CMAKE_BOOTSTRAP)
this->ProfilingDataRAII.reset();
#endif
- this->Makefile->ExecutionStatusStack.pop_back();
- --this->Makefile->RecursionDepth;
- this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
+ auto* const mf = this->Detach();
#ifdef CMake_ENABLE_DEBUGGER
- if (this->Makefile->GetCMakeInstance()->GetDebugAdapter()) {
- this->Makefile->GetCMakeInstance()
- ->GetDebugAdapter()
- ->OnEndFunctionCall();
+ if (mf->GetCMakeInstance()->GetDebugAdapter()) {
+ mf->GetCMakeInstance()->GetDebugAdapter()->OnEndFunctionCall();
}
+#else
+ static_cast<void>(mf);
#endif
}
- cmMakefileCall(const cmMakefileCall&) = delete;
- cmMakefileCall& operator=(const cmMakefileCall&) = delete;
+ CallScope(CallScope const&) = delete;
+ CallScope& operator=(CallScope const&) = delete;
private:
- cmMakefile* Makefile;
#if !defined(CMAKE_BOOTSTRAP)
cm::optional<cmMakefileProfilingData::RAII> ProfilingDataRAII;
#endif
@@ -474,7 +479,7 @@ void cmMakefile::OnExecuteCommand(std::function<void()> callback)
this->ExecuteCommandCallback = std::move(callback);
}
-bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
+bool cmMakefile::ExecuteCommand(cmListFileFunction const& lff,
cmExecutionStatus& status,
cm::optional<std::string> deferId)
{
@@ -486,12 +491,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
return result;
}
- if (this->ExecuteCommandCallback) {
- this->ExecuteCommandCallback();
- }
-
// Place this call on the call stack.
- cmMakefileCall stack_manager(this, lff, std::move(deferId), status);
+ CallScope stack_manager(this, lff, std::move(deferId), status);
static_cast<void>(stack_manager);
// Check for maximum recursion depth.
@@ -545,6 +546,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
}
}
+ if (this->ExecuteCommandCallback) {
+ this->ExecuteCommandCallback();
+ }
+
return result;
}
@@ -561,15 +566,13 @@ public:
~IncludeScope();
void Quiet() { this->ReportError = false; }
- IncludeScope(const IncludeScope&) = delete;
- IncludeScope& operator=(const IncludeScope&) = delete;
+ IncludeScope(IncludeScope const&) = delete;
+ IncludeScope& operator=(IncludeScope const&) = delete;
private:
cmMakefile* Makefile;
bool NoPolicyScope;
- bool CheckCMP0011 = false;
bool ReportError = true;
- void EnforceCMP0011();
};
cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
@@ -587,54 +590,15 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
this->Makefile->GetState()->CreateIncludeFileSnapshot(
this->Makefile->StateSnapshot, filenametoread);
if (!this->NoPolicyScope) {
- // Check CMP0011 to determine the policy scope type.
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011)) {
- case cmPolicies::WARN:
- // We need to push a scope to detect whether the script sets
- // any policies that would affect the includer and therefore
- // requires a warning. We use a weak scope to simulate OLD
- // behavior by allowing policy changes to affect the includer.
- this->Makefile->PushPolicy(true);
- this->CheckCMP0011 = true;
- break;
- case cmPolicies::OLD:
- // OLD behavior is to not push a scope at all.
- this->NoPolicyScope = true;
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- // We should never make this policy required, but we handle it
- // here just in case.
- this->CheckCMP0011 = true;
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior is to push a (strong) scope.
- this->Makefile->PushPolicy();
- break;
- }
+ this->Makefile->PushPolicy();
}
}
cmMakefile::IncludeScope::~IncludeScope()
{
if (!this->NoPolicyScope) {
- // If we need to enforce policy CMP0011 then the top entry is the
- // one we pushed above. If the entry is empty, then the included
- // script did not set any policies that might affect the includer so
- // we do not need to enforce the policy.
- if (this->CheckCMP0011 &&
- !this->Makefile->StateSnapshot.HasDefinedPolicyCMP0011()) {
- this->CheckCMP0011 = false;
- }
-
// Pop the scope we pushed for the script.
this->Makefile->PopPolicy();
-
- // We enforce the policy after the script's policy stack entry has
- // been removed.
- if (this->CheckCMP0011) {
- this->EnforceCMP0011();
- }
}
this->Makefile->PopSnapshot(this->ReportError);
@@ -643,48 +607,7 @@ cmMakefile::IncludeScope::~IncludeScope()
this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
}
-void cmMakefile::IncludeScope::EnforceCMP0011()
-{
- // We check the setting of this policy again because the included
- // script might actually set this policy for its includer.
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011)) {
- case cmPolicies::WARN:
- // Warn because the user did not set this policy.
- {
- auto e = cmStrCat(
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0011),
- "\n"
- "The included script\n"
- " ",
- this->Makefile->GetBacktrace().Top().FilePath,
- "\n"
- "affects policy settings. "
- "CMake is implying the NO_POLICY_SCOPE option for compatibility, "
- "so the effects are applied to the including context.");
- this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e);
- }
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS: {
- auto e = cmStrCat(
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011),
- "\n"
- "The included script\n ",
- this->Makefile->GetBacktrace().Top().FilePath,
- "\n"
- "affects policy settings, so it requires this policy to be set.");
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
- } break;
- case cmPolicies::OLD:
- case cmPolicies::NEW:
- // The script set this policy. We assume the purpose of the
- // script is to initialize policies for its includer, and since
- // the policy is now set for later scripts, we do not warn.
- break;
- }
-}
-
-bool cmMakefile::ReadDependentFile(const std::string& filename,
+bool cmMakefile::ReadDependentFile(std::string const& filename,
bool noPolicyScope)
{
if (cmValue def = this->GetDefinition("CMAKE_CURRENT_LIST_FILE")) {
@@ -755,8 +678,8 @@ public:
void Quiet() { this->ReportError = false; }
- ListFileScope(const ListFileScope&) = delete;
- ListFileScope& operator=(const ListFileScope&) = delete;
+ ListFileScope(ListFileScope const&) = delete;
+ ListFileScope& operator=(ListFileScope const&) = delete;
private:
cmMakefile* Makefile;
@@ -782,8 +705,8 @@ public:
this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
}
- DeferScope(const DeferScope&) = delete;
- DeferScope& operator=(const DeferScope&) = delete;
+ DeferScope(DeferScope const&) = delete;
+ DeferScope& operator=(DeferScope const&) = delete;
private:
cmMakefile* Makefile;
@@ -803,14 +726,14 @@ public:
~DeferCallScope() { this->Makefile->PopSnapshot(); }
- DeferCallScope(const DeferCallScope&) = delete;
- DeferCallScope& operator=(const DeferCallScope&) = delete;
+ DeferCallScope(DeferCallScope const&) = delete;
+ DeferCallScope& operator=(DeferCallScope const&) = delete;
private:
cmMakefile* Makefile;
};
-bool cmMakefile::ReadListFile(const std::string& filename)
+bool cmMakefile::ReadListFile(std::string const& filename)
{
std::string filenametoread = cmSystemTools::CollapseFullPath(
filename, this->GetCurrentSourceDirectory());
@@ -851,8 +774,8 @@ bool cmMakefile::ReadListFile(const std::string& filename)
return true;
}
-bool cmMakefile::ReadListFileAsString(const std::string& content,
- const std::string& virtualFileName)
+bool cmMakefile::ReadListFileAsString(std::string const& content,
+ std::string const& virtualFileName)
{
std::string filenametoread = cmSystemTools::CollapseFullPath(
virtualFileName, this->GetCurrentSourceDirectory());
@@ -899,7 +822,7 @@ void cmMakefile::RunListFile(cmListFile const& listFile,
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
// Run the parsed commands.
- const size_t numberFunctions = listFile.Functions.size();
+ size_t const numberFunctions = listFile.Functions.size();
for (size_t i = 0; i < numberFunctions; ++i) {
cmExecutionStatus status(*this);
this->ExecuteCommand(listFile.Functions[i], status);
@@ -969,34 +892,17 @@ void cmMakefile::EnforceDirectoryLevelRules() const
"support older CMake versions for this project. "
"For more information run "
"\"cmake --help-policy CMP0000\".");
- switch (this->GetPolicyStatus(cmPolicies::CMP0000)) {
- case cmPolicies::WARN:
- // Warn because the user did not provide a minimum required
- // version.
- this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, e,
- this->Backtrace);
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to use policy version 2.4 set in
- // cmListFileCache.
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // NEW behavior is to issue an error.
- this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
- this->Backtrace);
- cmSystemTools::SetFatalErrorOccurred();
- break;
- }
+ this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
+ this->Backtrace);
+ cmSystemTools::SetFatalErrorOccurred();
}
}
void cmMakefile::AddEvaluationFile(
- const std::string& inputFile, const std::string& targetName,
+ std::string const& inputFile, std::string const& targetName,
std::unique_ptr<cmCompiledGeneratorExpression> outputName,
std::unique_ptr<cmCompiledGeneratorExpression> condition,
- const std::string& newLineCharacter, mode_t permissions, bool inputIsContent)
+ std::string const& newLineCharacter, mode_t permissions, bool inputIsContent)
{
this->EvaluationFiles.push_back(
cm::make_unique<cmGeneratorExpressionEvaluationFile>(
@@ -1005,7 +911,7 @@ void cmMakefile::AddEvaluationFile(
this->GetPolicyStatus(cmPolicies::CMP0070)));
}
-const std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>>&
+std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>> const&
cmMakefile::GetEvaluationFiles() const
{
return this->EvaluationFiles;
@@ -1017,20 +923,6 @@ cmMakefile::GetExportBuildFileGenerators() const
return this->ExportBuildFileGenerators;
}
-void cmMakefile::RemoveExportBuildFileGeneratorCMP0024(
- cmExportBuildFileGenerator* gen)
-{
- auto it =
- std::find_if(this->ExportBuildFileGenerators.begin(),
- this->ExportBuildFileGenerators.end(),
- [gen](std::unique_ptr<cmExportBuildFileGenerator> const& p) {
- return p.get() == gen;
- });
- if (it != this->ExportBuildFileGenerators.end()) {
- this->ExportBuildFileGenerators.erase(it);
- }
-}
-
void cmMakefile::AddExportBuildFileGenerator(
std::unique_ptr<cmExportBuildFileGenerator> gen)
{
@@ -1040,7 +932,7 @@ void cmMakefile::AddExportBuildFileGenerator(
namespace {
struct file_not_persistent
{
- bool operator()(const std::string& path) const
+ bool operator()(std::string const& path) const
{
return !(path.find("CMakeTmp") == std::string::npos &&
cmSystemTools::FileExists(path));
@@ -1055,7 +947,7 @@ void cmMakefile::AddGeneratorAction(GeneratorAction&& action)
}
void cmMakefile::GeneratorAction::operator()(cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt,
+ cmListFileBacktrace const& lfbt,
GeneratorActionWhen when)
{
if (this->When != when) {
@@ -1072,9 +964,6 @@ void cmMakefile::GeneratorAction::operator()(cmLocalGenerator& lg,
void cmMakefile::DoGenerate(cmLocalGenerator& lg)
{
- // do all the variable expansions here
- this->ExpandVariablesCMP0019();
-
// give all the commands a chance to do something
// after the file has been parsed before generation
for (auto& action : this->GeneratorActions) {
@@ -1141,12 +1030,12 @@ private:
}
bool cmMakefile::ValidateCustomCommand(
- const cmCustomCommandLines& commandLines) const
+ cmCustomCommandLines const& commandLines) const
{
// TODO: More strict?
- const auto it =
+ auto const it =
std::find_if(commandLines.begin(), commandLines.end(),
- [](const cmCustomCommandLine& cl) {
+ [](cmCustomCommandLine const& cl) {
return !cl.empty() && !cl[0].empty() && cl[0][0] == '"';
});
if (it != commandLines.end()) {
@@ -1159,8 +1048,8 @@ bool cmMakefile::ValidateCustomCommand(
}
cmTarget* cmMakefile::GetCustomCommandTarget(
- const std::string& target, cmObjectLibraryCommands objLibCommands,
- const cmListFileBacktrace& lfbt) const
+ std::string const& target, cmObjectLibraryCommands objLibCommands,
+ cmListFileBacktrace const& lfbt) const
{
auto realTarget = target;
@@ -1172,40 +1061,20 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
// Find the target to which to add the custom command.
auto ti = this->Targets.find(realTarget);
if (ti == this->Targets.end()) {
- MessageType messageType = MessageType::AUTHOR_WARNING;
- bool issueMessage = false;
std::string e;
- switch (this->GetPolicyStatus(cmPolicies::CMP0040)) {
- case cmPolicies::WARN:
- e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0040), '\n');
- issueMessage = true;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- issueMessage = true;
- messageType = MessageType::FATAL_ERROR;
- break;
- }
-
- if (issueMessage) {
- if (cmTarget const* t = this->FindTargetToUse(target)) {
- if (t->IsImported()) {
- e += cmStrCat("TARGET '", target,
- "' is IMPORTED and does not build here.");
- } else {
- e += cmStrCat("TARGET '", target,
- "' was not created in this directory.");
- }
+ if (cmTarget const* t = this->FindTargetToUse(target)) {
+ if (t->IsImported()) {
+ e += cmStrCat("TARGET '", target,
+ "' is IMPORTED and does not build here.");
} else {
- e += cmStrCat("No TARGET '", target,
- "' has been created in this directory.");
+ e +=
+ cmStrCat("TARGET '", target, "' was not created in this directory.");
}
- this->GetCMakeInstance()->IssueMessage(messageType, e, lfbt);
+ } else {
+ e += cmStrCat("No TARGET '", target,
+ "' has been created in this directory.");
}
-
+ this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e, lfbt);
return nullptr;
}
@@ -1232,11 +1101,11 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
}
cmTarget* cmMakefile::AddCustomCommandToTarget(
- const std::string& target, cmCustomCommandType type,
+ std::string const& target, cmCustomCommandType type,
std::unique_ptr<cmCustomCommand> cc)
{
- const auto& byproducts = cc->GetByproducts();
- const auto& commandLines = cc->GetCommandLines();
+ auto const& byproducts = cc->GetByproducts();
+ auto const& commandLines = cc->GetCommandLines();
cmTarget* t = this->GetCustomCommandTarget(
target, cmObjectLibraryCommands::Reject, this->Backtrace);
@@ -1254,7 +1123,7 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
std::move(cc),
- [this, t, type](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ [this, t, type](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
tcc->SetBacktrace(lfbt);
@@ -1266,12 +1135,12 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
}
void cmMakefile::AddCustomCommandToOutput(
- std::unique_ptr<cmCustomCommand> cc, const CommandSourceCallback& callback,
+ std::unique_ptr<cmCustomCommand> cc, CommandSourceCallback const& callback,
bool replace)
{
- const auto& outputs = cc->GetOutputs();
- const auto& byproducts = cc->GetByproducts();
- const auto& commandLines = cc->GetCommandLines();
+ auto const& outputs = cc->GetOutputs();
+ auto const& byproducts = cc->GetByproducts();
+ auto const& commandLines = cc->GetCommandLines();
// Make sure there is at least one output.
if (outputs.empty()) {
@@ -1294,7 +1163,7 @@ void cmMakefile::AddCustomCommandToOutput(
this->AddGeneratorAction(
std::move(cc),
[this, replace, callback](cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt,
+ cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
tcc->SetBacktrace(lfbt);
@@ -1306,83 +1175,17 @@ void cmMakefile::AddCustomCommandToOutput(
});
}
-void cmMakefile::AddCustomCommandOldStyle(
- const std::string& target, const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends, const std::string& source,
- const cmCustomCommandLines& commandLines, const char* comment)
-{
- auto cc = cm::make_unique<cmCustomCommand>();
- cc->SetDepends(depends);
- cc->SetCommandLines(commandLines);
- cc->SetComment(comment);
-
- // Translate the old-style signature to one of the new-style
- // signatures.
- if (source == target) {
- // In the old-style signature if the source and target were the
- // same then it added a post-build rule to the target. Preserve
- // this behavior.
- this->AddCustomCommandToTarget(target, cmCustomCommandType::POST_BUILD,
- std::move(cc));
- return;
- }
-
- auto ti = this->Targets.find(target);
- cmTarget* t = ti != this->Targets.end() ? &ti->second : nullptr;
-
- auto addRuleFileToTarget = [=](cmSourceFile* sf) {
- // If the rule was added to the source (and not a .rule file),
- // then add the source to the target to make sure the rule is
- // included.
- if (!sf->GetPropertyAsBool("__CMAKE_RULE")) {
- if (t) {
- t->AddSource(sf->ResolveFullPath());
- } else {
- cmSystemTools::Error("Attempt to add a custom rule to a target "
- "that does not exist yet for target " +
- target);
- }
- }
- };
-
- // Each output must get its own copy of this rule.
- cmsys::RegularExpression sourceFiles(
- "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|ccm|cxxm|c\\+\\+m|cu|m|mm|"
- "rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|"
- "hm|hpp|hxx|in|txx|inl)$");
-
- // Choose whether to use a main dependency.
- if (sourceFiles.find(source)) {
- // The source looks like a real file. Use it as the main dependency.
- for (std::string const& output : outputs) {
- auto cc1 = cm::make_unique<cmCustomCommand>(*cc);
- cc1->SetOutputs(output);
- cc1->SetMainDependency(source);
- this->AddCustomCommandToOutput(std::move(cc1), addRuleFileToTarget);
- }
- } else {
- cc->AppendDepends({ source });
-
- // The source may not be a real file. Do not use a main dependency.
- for (std::string const& output : outputs) {
- auto cc1 = cm::make_unique<cmCustomCommand>(*cc);
- cc1->SetOutputs(output);
- this->AddCustomCommandToOutput(std::move(cc1), addRuleFileToTarget);
- }
- }
-}
-
void cmMakefile::AppendCustomCommandToOutput(
- const std::string& output, const std::vector<std::string>& depends,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines)
+ std::string const& output, std::vector<std::string> const& depends,
+ cmImplicitDependsList const& implicit_depends,
+ cmCustomCommandLines const& commandLines)
{
// Validate custom commands.
if (this->ValidateCustomCommand(commandLines)) {
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
[this, output, depends, implicit_depends,
- commandLines](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
+ commandLines](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt) {
BacktraceGuard guard(this->Backtrace, lfbt);
detail::AppendCustomCommandToOutput(lg, lfbt, output, depends,
implicit_depends, commandLines);
@@ -1390,13 +1193,13 @@ void cmMakefile::AppendCustomCommandToOutput(
}
}
-cmTarget* cmMakefile::AddUtilityCommand(const std::string& utilityName,
+cmTarget* cmMakefile::AddUtilityCommand(std::string const& utilityName,
bool excludeFromAll,
std::unique_ptr<cmCustomCommand> cc)
{
- const auto& depends = cc->GetDepends();
- const auto& byproducts = cc->GetByproducts();
- const auto& commandLines = cc->GetCommandLines();
+ auto const& depends = cc->GetDepends();
+ auto const& byproducts = cc->GetByproducts();
+ auto const& commandLines = cc->GetCommandLines();
cmTarget* target = this->AddNewUtilityTarget(utilityName, excludeFromAll);
// Validate custom commands.
@@ -1413,7 +1216,7 @@ cmTarget* cmMakefile::AddUtilityCommand(const std::string& utilityName,
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
std::move(cc),
- [this, target](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ [this, target](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
tcc->SetBacktrace(lfbt);
@@ -1441,9 +1244,6 @@ void cmMakefile::AddDefineFlag(std::string const& flag)
return;
}
- // Update the string used for the old DEFINITIONS property.
- s_AddDefineFlag(flag, this->DefineFlagsOrig);
-
// If this is really a definition, update COMPILE_DEFINITIONS.
if (this->ParseDefineFlag(flag, false)) {
return;
@@ -1477,9 +1277,6 @@ void cmMakefile::RemoveDefineFlag(std::string const& flag)
return;
}
- // Update the string used for the old DEFINITIONS property.
- s_RemoveDefineFlag(flag, this->DefineFlagsOrig);
-
// If this is really a definition, update COMPILE_DEFINITIONS.
if (this->ParseDefineFlag(flag, true)) {
return;
@@ -1525,35 +1322,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
return false;
}
- // Definitions with non-trivial values require a policy check.
- static cmsys::RegularExpression trivial(
- "^[-/]D[A-Za-z_][A-Za-z0-9_]*(=[A-Za-z0-9_.]+)?$");
- if (!trivial.find(def)) {
- // This definition has a non-trivial value.
- switch (this->GetPolicyStatus(cmPolicies::CMP0005)) {
- case cmPolicies::WARN:
- this->IssueMessage(MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0005));
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to not escape the value. We should not
- // convert the definition to use the property.
- return false;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0005));
- return false;
- case cmPolicies::NEW:
- // NEW behavior is to escape the value. Proceed to convert it
- // to an entry in the property.
- break;
- }
- }
-
// Get the definition part after the flag.
- const char* define = def.c_str() + 2;
+ char const* define = def.c_str() + 2;
if (remove) {
if (cmValue cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
@@ -1580,29 +1350,13 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
// define flags
this->DefineFlags = parent->DefineFlags;
- this->DefineFlagsOrig = parent->DefineFlagsOrig;
// Include transform property. There is no per-config version.
{
- const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM";
+ char const* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM";
this->SetProperty(prop, parent->GetProperty(prop));
}
- // compile definitions property and per-config versions
- cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043);
- if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
- this->SetProperty("COMPILE_DEFINITIONS",
- parent->GetProperty("COMPILE_DEFINITIONS"));
- std::vector<std::string> configs =
- this->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
- for (std::string const& config : configs) {
- std::string defPropName =
- cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config));
- cmValue prop = parent->GetProperty(defPropName);
- this->SetProperty(defPropName, prop);
- }
- }
-
// labels
this->SetProperty("LABELS", parent->GetProperty("LABELS"));
@@ -1640,7 +1394,7 @@ void cmMakefile::AddTestGenerator(std::unique_ptr<cmTestGenerator> g)
}
void cmMakefile::PushFunctionScope(std::string const& fileName,
- const cmPolicies::PolicyMap& pm)
+ cmPolicies::PolicyMap const& pm)
{
this->StateSnapshot = this->GetState()->CreateFunctionCallSnapshot(
this->StateSnapshot, fileName);
@@ -1673,7 +1427,7 @@ void cmMakefile::PopFunctionScope(bool reportError)
}
void cmMakefile::PushMacroScope(std::string const& fileName,
- const cmPolicies::PolicyMap& pm)
+ cmPolicies::PolicyMap const& pm)
{
this->StateSnapshot =
this->GetState()->CreateMacroCallSnapshot(this->StateSnapshot, fileName);
@@ -1704,8 +1458,8 @@ public:
: Makefile(mf)
{
std::string currentStart =
- cmStrCat(this->Makefile->StateSnapshot.GetDirectory().GetCurrentSource(),
- "/CMakeLists.txt");
+ this->Makefile->GetCMakeInstance()->GetCMakeListFile(
+ this->Makefile->StateSnapshot.GetDirectory().GetCurrentSource());
this->Makefile->StateSnapshot.SetListFile(currentStart);
this->Makefile->StateSnapshot =
this->Makefile->StateSnapshot.GetState()->CreatePolicyScopeSnapshot(
@@ -1735,8 +1489,8 @@ public:
void Quiet() { this->ReportError = false; }
- BuildsystemFileScope(const BuildsystemFileScope&) = delete;
- BuildsystemFileScope& operator=(const BuildsystemFileScope&) = delete;
+ BuildsystemFileScope(BuildsystemFileScope const&) = delete;
+ BuildsystemFileScope& operator=(BuildsystemFileScope const&) = delete;
private:
cmMakefile* Makefile;
@@ -1748,8 +1502,8 @@ private:
void cmMakefile::Configure()
{
- std::string currentStart = cmStrCat(
- this->StateSnapshot.GetDirectory().GetCurrentSource(), "/CMakeLists.txt");
+ std::string currentStart = this->GetCMakeInstance()->GetCMakeListFile(
+ this->StateSnapshot.GetDirectory().GetCurrentSource());
// Add the bottom of all backtraces within this directory.
// We will never pop this scope because it should be available
@@ -1838,7 +1592,7 @@ void cmMakefile::Configure()
this->SetCheckCMP0000(true);
// Implicitly set the version for the user.
- cmPolicies::ApplyPolicyVersion(this, 2, 4, 0,
+ cmPolicies::ApplyPolicyVersion(this, 3, 5, 0,
cmPolicies::WarnCompat::Off);
}
}
@@ -1862,13 +1616,9 @@ void cmMakefile::Configure()
"CMake is pretending there is a \"project(Project)\" command on "
"the first line.",
this->Backtrace);
- cmListFileFunction project{ "project",
- 0,
- 0,
- { { "Project", cmListFileArgument::Unquoted,
- 0 },
- { "__CMAKE_INJECTED_PROJECT_COMMAND__",
- cmListFileArgument::Unquoted, 0 } } };
+ cmListFileFunction project{
+ "project", 0, 0, { { "Project", cmListFileArgument::Unquoted, 0 } }
+ };
listFile.Functions.insert(listFile.Functions.begin(), project);
}
}
@@ -1902,37 +1652,13 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
cmSystemTools::Message(msg);
}
- std::string const currentStartFile =
- cmStrCat(currentStart, "/CMakeLists.txt");
+ std::string currentStartFile =
+ this->GetCMakeInstance()->GetCMakeListFile(currentStart);
if (!cmSystemTools::FileExists(currentStartFile, true)) {
- // The file is missing. Check policy CMP0014.
- auto e = cmStrCat("The source directory\n ", currentStart,
- "\n"
- "does not contain a CMakeLists.txt file.");
- /* clang-format on */
- switch (this->GetPolicyStatus(cmPolicies::CMP0014)) {
- case cmPolicies::WARN:
- // Print the warning.
- e += cmStrCat("\n"
- "CMake does not support this case but it used "
- "to work accidentally and is being allowed for "
- "compatibility.\n",
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0014));
- this->IssueMessage(MessageType::AUTHOR_WARNING, e);
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior does not warn.
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- e += cmStrCat('\n',
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014));
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior prints the error.
- this->IssueMessage(MessageType::FATAL_ERROR, e);
- break;
- }
+ this->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("The source directory\n ", currentStart,
+ "\n"
+ "does not contain a CMakeLists.txt file."));
return;
}
// finally configure the subdir
@@ -1945,8 +1671,8 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
}
}
-void cmMakefile::AddSubDirectory(const std::string& srcPath,
- const std::string& binPath,
+void cmMakefile::AddSubDirectory(std::string const& srcPath,
+ std::string const& binPath,
bool excludeFromAll, bool immediate,
bool system)
{
@@ -1992,16 +1718,25 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
subMf, binPath, this->GetBacktrace()));
}
-const std::string& cmMakefile::GetCurrentSourceDirectory() const
+std::string const& cmMakefile::GetCurrentSourceDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentSource();
}
-const std::string& cmMakefile::GetCurrentBinaryDirectory() const
+std::string const& cmMakefile::GetCurrentBinaryDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
}
+cmTarget* cmMakefile::FindImportedTarget(std::string const& name) const
+{
+ auto const i = this->ImportedTargets.find(name);
+ if (i != this->ImportedTargets.end()) {
+ return i->second;
+ }
+ return nullptr;
+}
+
std::vector<cmTarget*> cmMakefile::GetImportedTargets() const
{
std::vector<cmTarget*> tgts;
@@ -2012,7 +1747,7 @@ std::vector<cmTarget*> cmMakefile::GetImportedTargets() const
return tgts;
}
-void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
+void cmMakefile::AddIncludeDirectories(std::vector<std::string> const& incs,
bool before)
{
if (incs.empty()) {
@@ -2035,7 +1770,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
}
}
-void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
+void cmMakefile::AddSystemIncludeDirectories(std::set<std::string> const& incs)
{
if (incs.empty()) {
return;
@@ -2049,7 +1784,7 @@ void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
}
}
-void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
+void cmMakefile::AddDefinition(std::string const& name, cm::string_view value)
{
this->StateSnapshot.SetDefinition(name, value);
@@ -2062,12 +1797,12 @@ void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
#endif
}
-void cmMakefile::AddDefinitionBool(const std::string& name, bool value)
+void cmMakefile::AddDefinitionBool(std::string const& name, bool value)
{
this->AddDefinition(name, value ? "ON" : "OFF");
}
-void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value,
+void cmMakefile::AddCacheDefinition(std::string const& name, cmValue value,
cmValue doc,
cmStateEnums::CacheEntryType type,
bool force)
@@ -2088,7 +1823,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value,
cmList files(value);
for (auto& file : files) {
if (!cmIsOff(file)) {
- file = cmSystemTools::CollapseFullPath(file);
+ file = cmSystemTools::ToNormalizedPathOnDisk(file);
}
}
nvalue = files.to_string();
@@ -2116,24 +1851,22 @@ void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value,
this->StateSnapshot.RemoveDefinition(name);
break;
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
break;
}
}
-void cmMakefile::MarkVariableAsUsed(const std::string& var)
+void cmMakefile::MarkVariableAsUsed(std::string const& var)
{
this->StateSnapshot.GetDefinition(var);
}
-bool cmMakefile::VariableInitialized(const std::string& var) const
+bool cmMakefile::VariableInitialized(std::string const& var) const
{
return this->StateSnapshot.IsInitialized(var);
}
void cmMakefile::MaybeWarnUninitialized(std::string const& variable,
- const char* sourceFilename) const
+ char const* sourceFilename) const
{
// check to see if we need to print a warning
// if strict mode is on and the variable has
@@ -2148,7 +1881,7 @@ void cmMakefile::MaybeWarnUninitialized(std::string const& variable,
}
}
-void cmMakefile::RemoveDefinition(const std::string& name)
+void cmMakefile::RemoveDefinition(std::string const& name)
{
this->StateSnapshot.RemoveDefinition(name);
#ifndef CMAKE_BOOTSTRAP
@@ -2160,7 +1893,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
#endif
}
-void cmMakefile::RemoveCacheDefinition(const std::string& name) const
+void cmMakefile::RemoveCacheDefinition(std::string const& name) const
{
this->GetState()->RemoveCacheEntry(name);
}
@@ -2205,7 +1938,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
}
}
-void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName,
+void cmMakefile::AddAlias(std::string const& lname, std::string const& tgtName,
bool globallyVisible)
{
this->AliasTargets[lname] = tgtName;
@@ -2214,9 +1947,9 @@ void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName,
}
}
-cmTarget* cmMakefile::AddLibrary(const std::string& lname,
+cmTarget* cmMakefile::AddLibrary(std::string const& lname,
cmStateEnums::TargetType type,
- const std::vector<std::string>& srcs,
+ std::vector<std::string> const& srcs,
bool excludeFromAll)
{
assert(type == cmStateEnums::STATIC_LIBRARY ||
@@ -2238,8 +1971,8 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
return target;
}
-cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
- const std::vector<std::string>& srcs,
+cmTarget* cmMakefile::AddExecutable(std::string const& exeName,
+ std::vector<std::string> const& srcs,
bool excludeFromAll)
{
cmTarget* target = this->AddNewTarget(cmStateEnums::EXECUTABLE, exeName);
@@ -2252,13 +1985,13 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
}
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
- const std::string& name)
+ std::string const& name)
{
return &this->CreateNewTarget(name, type).first;
}
cmTarget* cmMakefile::AddSynthesizedTarget(cmStateEnums::TargetType type,
- const std::string& name)
+ std::string const& name)
{
return &this
->CreateNewTarget(name, type, cmTarget::PerConfig::Yes,
@@ -2267,7 +2000,7 @@ cmTarget* cmMakefile::AddSynthesizedTarget(cmStateEnums::TargetType type,
}
std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
- const std::string& name, cmStateEnums::TargetType type,
+ std::string const& name, cmStateEnums::TargetType type,
cmTarget::PerConfig perConfig, cmTarget::Visibility vis)
{
auto ib =
@@ -2282,7 +2015,7 @@ std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
return std::make_pair(std::ref(it->second), true);
}
-cmTarget* cmMakefile::AddNewUtilityTarget(const std::string& utilityName,
+cmTarget* cmMakefile::AddNewUtilityTarget(std::string const& utilityName,
bool excludeFromAll)
{
cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName);
@@ -2297,7 +2030,7 @@ namespace {
#if !defined(CMAKE_BOOTSTRAP)
cmSourceGroup* cmMakefile::GetSourceGroup(
- const std::vector<std::string>& name) const
+ std::vector<std::string> const& name) const
{
cmSourceGroup* sg = nullptr;
@@ -2322,20 +2055,20 @@ cmSourceGroup* cmMakefile::GetSourceGroup(
return sg;
}
-void cmMakefile::AddSourceGroup(const std::string& name, const char* regex)
+void cmMakefile::AddSourceGroup(std::string const& name, char const* regex)
{
std::vector<std::string> nameVector;
nameVector.push_back(name);
this->AddSourceGroup(nameVector, regex);
}
-void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
- const char* regex)
+void cmMakefile::AddSourceGroup(std::vector<std::string> const& name,
+ char const* regex)
{
cmSourceGroup* sg = nullptr;
std::vector<std::string> currentName;
int i = 0;
- const int lastElement = static_cast<int>(name.size() - 1);
+ int const lastElement = static_cast<int>(name.size() - 1);
for (i = lastElement; i >= 0; --i) {
currentName.assign(name.begin(), name.begin() + i + 1);
sg = this->GetSourceGroup(currentName);
@@ -2375,7 +2108,7 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
}
cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(
- const std::vector<std::string>& folders)
+ std::vector<std::string> const& folders)
{
cmSourceGroup* sg = this->GetSourceGroup(folders);
if (!sg) {
@@ -2385,15 +2118,11 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(
return sg;
}
-cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
+cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(std::string const& name)
{
- std::string delimiters;
- if (cmValue p = this->GetDefinition("SOURCE_GROUP_DELIMITER")) {
- delimiters = *p;
- } else {
- delimiters = "/\\";
- }
- return this->GetOrCreateSourceGroup(cmTokenize(name, delimiters));
+ auto p = this->GetDefinition("SOURCE_GROUP_DELIMITER");
+ return this->GetOrCreateSourceGroup(
+ cmTokenize(name, p ? cm::string_view(*p) : R"(\/)"_s));
}
/**
@@ -2404,7 +2133,7 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
* inherited ones.
*/
cmSourceGroup* cmMakefile::FindSourceGroup(
- const std::string& source, std::vector<cmSourceGroup>& groups) const
+ std::string const& source, std::vector<cmSourceGroup>& groups) const
{
// First search for a group that lists the file explicitly.
for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) {
@@ -2427,100 +2156,12 @@ cmSourceGroup* cmMakefile::FindSourceGroup(
}
#endif
-static bool mightExpandVariablesCMP0019(const char* s)
-{
- return s && *s && strstr(s, "${") && strchr(s, '}');
-}
-
-void cmMakefile::ExpandVariablesCMP0019()
-{
- // Drop this ancient compatibility behavior with a policy.
- cmPolicies::PolicyStatus pol = this->GetPolicyStatus(cmPolicies::CMP0019);
- if (pol != cmPolicies::OLD && pol != cmPolicies::WARN) {
- return;
- }
-
- std::string e;
-
- cmValue includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
- if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) {
- std::string dirs = *includeDirs;
- this->ExpandVariablesInString(dirs, true, true);
- if (pol == cmPolicies::WARN && dirs != *includeDirs) {
- e = cmStrCat("Evaluated directory INCLUDE_DIRECTORIES\n ", *includeDirs,
- "\nas\n ", dirs, '\n');
- }
- this->SetProperty("INCLUDE_DIRECTORIES", dirs);
- }
-
- // Also for each target's INCLUDE_DIRECTORIES property:
- for (auto& target : this->Targets) {
- cmTarget& t = target.second;
- if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY ||
- t.GetType() == cmStateEnums::GLOBAL_TARGET) {
- continue;
- }
- includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
- if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) {
- std::string dirs = *includeDirs;
- this->ExpandVariablesInString(dirs, true, true);
- if (pol == cmPolicies::WARN && dirs != *includeDirs) {
- e += cmStrCat("Evaluated target ", t.GetName(),
- " INCLUDE_DIRECTORIES\n ", *includeDirs, "\nas\n ",
- dirs, '\n');
- }
- t.SetProperty("INCLUDE_DIRECTORIES", dirs);
- }
- }
-
- if (cmValue linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) {
- if (mightExpandVariablesCMP0019(linkDirsProp->c_str())) {
- std::string d = *linkDirsProp;
- const std::string orig = d;
- this->ExpandVariablesInString(d, true, true);
- if (pol == cmPolicies::WARN && d != orig) {
- e += cmStrCat("Evaluated link directories\n ", orig, "\nas\n ", d,
- '\n');
- }
- }
- }
-
- if (cmValue linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
- cmList linkLibs{ *linkLibsProp };
-
- for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) {
- std::string libName = *l;
- if (libName == "optimized"_s || libName == "debug"_s) {
- ++l;
- libName = *l;
- }
- if (mightExpandVariablesCMP0019(libName.c_str())) {
- const std::string orig = libName;
- this->ExpandVariablesInString(libName, true, true);
- if (pol == cmPolicies::WARN && libName != orig) {
- e += cmStrCat("Evaluated link library\n ", orig, "\nas\n ",
- libName, '\n');
- }
- }
- }
- }
-
- if (!e.empty()) {
- auto m = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0019),
- "\n"
- "The following variable evaluations were encountered:\n",
- e);
- this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, m,
- this->Backtrace);
- }
-}
-
-bool cmMakefile::IsOn(const std::string& name) const
+bool cmMakefile::IsOn(std::string const& name) const
{
return this->GetDefinition(name).IsOn();
}
-bool cmMakefile::IsSet(const std::string& name) const
+bool cmMakefile::IsSet(std::string const& name) const
{
cmValue value = this->GetDefinition(name);
if (!value) {
@@ -2629,7 +2270,7 @@ bool cmMakefile::PlatformSupportsAppleTextStubs() const
return this->IsOn("APPLE") && this->IsSet("CMAKE_TAPI");
}
-const char* cmMakefile::GetSONameFlag(const std::string& language) const
+char const* cmMakefile::GetSONameFlag(std::string const& language) const
{
std::string name = "CMAKE_SHARED_LIBRARY_SONAME";
if (!language.empty()) {
@@ -2656,8 +2297,8 @@ bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const
cmSystemTools::SameFile(fileName, this->GetHomeOutputDirectory());
}
-const std::string& cmMakefile::GetRequiredDefinition(
- const std::string& name) const
+std::string const& cmMakefile::GetRequiredDefinition(
+ std::string const& name) const
{
static std::string const empty;
cmValue def = this->GetDefinition(name);
@@ -2671,7 +2312,7 @@ const std::string& cmMakefile::GetRequiredDefinition(
return *def;
}
-bool cmMakefile::IsDefinitionSet(const std::string& name) const
+bool cmMakefile::IsDefinitionSet(std::string const& name) const
{
cmValue def = this->StateSnapshot.GetDefinition(name);
if (!def) {
@@ -2688,7 +2329,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
return def != nullptr;
}
-bool cmMakefile::IsNormalDefinitionSet(const std::string& name) const
+bool cmMakefile::IsNormalDefinitionSet(std::string const& name) const
{
cmValue def = this->StateSnapshot.GetDefinition(name);
#ifndef CMAKE_BOOTSTRAP
@@ -2702,7 +2343,7 @@ bool cmMakefile::IsNormalDefinitionSet(const std::string& name) const
return def != nullptr;
}
-cmValue cmMakefile::GetDefinition(const std::string& name) const
+cmValue cmMakefile::GetDefinition(std::string const& name) const
{
cmValue def = this->StateSnapshot.GetDefinition(name);
if (!def) {
@@ -2710,7 +2351,7 @@ cmValue cmMakefile::GetDefinition(const std::string& name) const
}
#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
- if (vv && !this->SuppressSideEffects) {
+ if (vv) {
bool const watch_function_executed =
vv->VariableAccessed(name,
def ? cmVariableWatch::VARIABLE_READ_ACCESS
@@ -2731,7 +2372,7 @@ cmValue cmMakefile::GetDefinition(const std::string& name) const
return def;
}
-const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const
+std::string const& cmMakefile::GetSafeDefinition(std::string const& name) const
{
return this->GetDefinition(name);
}
@@ -2744,21 +2385,16 @@ std::vector<std::string> cmMakefile::GetDefinitions() const
return res;
}
-const std::string& cmMakefile::ExpandVariablesInString(
+std::string const& cmMakefile::ExpandVariablesInString(
std::string& source) const
{
return this->ExpandVariablesInString(source, false, false);
}
-const std::string& cmMakefile::ExpandVariablesInString(
+std::string const& cmMakefile::ExpandVariablesInString(
std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly,
- const char* filename, long line, bool removeEmpty, bool replaceAt) const
+ char const* filename, long line, bool removeEmpty, bool replaceAt) const
{
- bool compareResults = false;
- MessageType mtype = MessageType::LOG;
- std::string errorstr;
- std::string original;
-
// Sanity check the @ONLY mode.
if (atOnly && (!noEscapes || !removeEmpty)) {
// This case should never be called. At-only is for
@@ -2769,193 +2405,20 @@ const std::string& cmMakefile::ExpandVariablesInString(
return source;
}
- // Variables used in the WARN case.
- std::string newResult;
- std::string newErrorstr;
- MessageType newError = MessageType::LOG;
-
- switch (this->GetPolicyStatus(cmPolicies::CMP0053)) {
- case cmPolicies::WARN: {
- // Save the original string for the warning.
- original = source;
- newResult = source;
- compareResults = true;
- // Suppress variable watches to avoid calling hooks twice. Suppress new
- // dereferences since the OLD behavior is still what is actually used.
- this->SuppressSideEffects = true;
- newError = this->ExpandVariablesInStringNew(
- newErrorstr, newResult, escapeQuotes, noEscapes, atOnly, filename,
- line, replaceAt);
- this->SuppressSideEffects = false;
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD:
- mtype = this->ExpandVariablesInStringOld(errorstr, source, escapeQuotes,
- noEscapes, atOnly, filename,
- line, removeEmpty, true);
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- // Messaging here would be *very* verbose.
- case cmPolicies::NEW:
- mtype = this->ExpandVariablesInStringNew(errorstr, source, escapeQuotes,
- noEscapes, atOnly, filename,
- line, replaceAt);
- break;
- }
-
- // If it's an error in either case, just report the error...
+ std::string errorstr;
+ MessageType mtype = this->ExpandVariablesInStringImpl(
+ errorstr, source, escapeQuotes, noEscapes, atOnly, filename, line,
+ replaceAt);
if (mtype != MessageType::LOG) {
if (mtype == MessageType::FATAL_ERROR) {
cmSystemTools::SetFatalErrorOccurred();
}
this->IssueMessage(mtype, errorstr);
}
- // ...otherwise, see if there's a difference that needs to be warned about.
- else if (compareResults && (newResult != source || newError != mtype)) {
- auto msg =
- cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0053), '\n');
-
- std::string msg_input = original;
- cmSystemTools::ReplaceString(msg_input, "\n", "\n ");
-
- std::string msg_old = source;
- cmSystemTools::ReplaceString(msg_old, "\n", "\n ");
-
- msg += cmStrCat("For input:\n '", msg_input, "'\n",
- "the old evaluation rules produce:\n '", msg_old, "'\n");
-
- if (newError == mtype) {
- std::string msg_new = newResult;
- cmSystemTools::ReplaceString(msg_new, "\n", "\n ");
- msg +=
- cmStrCat("but the new evaluation rules produce:\n '", msg_new, "'\n");
- } else {
- std::string msg_err = newErrorstr;
- cmSystemTools::ReplaceString(msg_err, "\n", "\n ");
- msg += cmStrCat("but the new evaluation rules produce an error:\n ",
- msg_err, '\n');
- }
-
- msg +=
- "Using the old result for compatibility since the policy is not set.";
-
- this->IssueMessage(MessageType::AUTHOR_WARNING, msg);
- }
return source;
}
-MessageType cmMakefile::ExpandVariablesInStringOld(
- std::string& errorstr, std::string& source, bool escapeQuotes,
- bool noEscapes, bool atOnly, const char* filename, long line,
- bool removeEmpty, bool replaceAt) const
-{
- // Fast path strings without any special characters.
- if (source.find_first_of("$@\\") == std::string::npos) {
- return MessageType::LOG;
- }
-
- // Special-case the @ONLY mode.
- if (atOnly) {
- // Store an original copy of the input.
- std::string input = source;
-
- // Start with empty output.
- source.clear();
-
- // Look for one @VAR@ at a time.
- const char* in = input.c_str();
- while (this->cmAtVarRegex.find(in)) {
- // Get the range of the string to replace.
- const char* first = in + this->cmAtVarRegex.start();
- const char* last = in + this->cmAtVarRegex.end();
-
- // Store the unchanged part of the string now.
- source.append(in, first - in);
-
- // Lookup the definition of VAR.
- std::string var(first + 1, last - first - 2);
- if (cmValue val = this->GetDefinition(var)) {
- // Store the value in the output escaping as requested.
- if (escapeQuotes) {
- source.append(cmEscapeQuotes(*val));
- } else {
- source.append(*val);
- }
- }
-
- // Continue looking for @VAR@ further along the string.
- in = last;
- }
-
- // Append the rest of the unchanged part of the string.
- source.append(in);
-
- return MessageType::LOG;
- }
-
- // This method replaces ${VAR} and @VAR@ where VAR is looked up
- // with GetDefinition(), if not found in the map, nothing is expanded.
- // It also supports the $ENV{VAR} syntax where VAR is looked up in
- // the current environment variables.
-
- cmCommandArgumentParserHelper parser;
- parser.SetMakefile(this);
- parser.SetLineFile(line, filename);
- parser.SetEscapeQuotes(escapeQuotes);
- parser.SetNoEscapeMode(noEscapes);
- parser.SetReplaceAtSyntax(replaceAt);
- parser.SetRemoveEmpty(removeEmpty);
- int res = parser.ParseString(source, 0);
- const char* emsg = parser.GetError();
- MessageType mtype = MessageType::LOG;
- if (res && !emsg[0]) {
- source = parser.GetResult();
- } else {
- // Construct the main error message.
- std::string error = "Syntax error in cmake code ";
- if (filename && line > 0) {
- // This filename and line number may be more specific than the
- // command context because one command invocation can have
- // arguments on multiple lines.
- error += cmStrCat("at\n ", filename, ':', line, '\n');
- }
- error += cmStrCat("when parsing string\n ", source, '\n', emsg);
-
- // If the parser failed ("res" is false) then this is a real
- // argument parsing error, so the policy applies. Otherwise the
- // parser reported an error message without failing because the
- // helper implementation is unhappy, which has always reported an
- // error.
- mtype = MessageType::FATAL_ERROR;
- if (!res) {
- // This is a real argument parsing error. Use policy CMP0010 to
- // decide whether it is an error.
- switch (this->GetPolicyStatus(cmPolicies::CMP0010)) {
- case cmPolicies::WARN:
- error +=
- cmStrCat('\n', cmPolicies::GetPolicyWarning(cmPolicies::CMP0010));
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior is to just warn and continue.
- mtype = MessageType::AUTHOR_WARNING;
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- error += cmStrCat(
- '\n', cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010));
- break;
- case cmPolicies::NEW:
- // NEW behavior is to report the error.
- break;
- }
- }
- errorstr = std::move(error);
- }
- return mtype;
-}
-
enum t_domain
{
NORMAL,
@@ -2969,7 +2432,7 @@ struct t_lookup
size_t loc = 0;
};
-bool cmMakefile::IsProjectFile(const char* filename) const
+bool cmMakefile::IsProjectFile(char const* filename) const
{
return cmSystemTools::IsSubDirectory(filename, this->GetHomeDirectory()) ||
(cmSystemTools::IsSubDirectory(filename, this->GetHomeOutputDirectory()) &&
@@ -3066,9 +2529,9 @@ cm::optional<std::string> cmMakefile::DeferGetCall(std::string const& id) const
return call;
}
-MessageType cmMakefile::ExpandVariablesInStringNew(
+MessageType cmMakefile::ExpandVariablesInStringImpl(
std::string& errorstr, std::string& source, bool escapeQuotes,
- bool noEscapes, bool atOnly, const char* filename, long line,
+ bool noEscapes, bool atOnly, char const* filename, long line,
bool replaceAt) const
{
// This method replaces ${VAR} and @VAR@ where VAR is looked up
@@ -3076,8 +2539,8 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
// It also supports the $ENV{VAR} syntax where VAR is looked up in
// the current environment variables.
- const char* in = source.c_str();
- const char* last = in;
+ char const* in = source.c_str();
+ char const* last = in;
std::string result;
result.reserve(source.size());
std::vector<t_lookup> openstack;
@@ -3087,7 +2550,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
cmState* state = this->GetCMakeInstance()->GetState();
- static const std::string lineVar = "CMAKE_CURRENT_LIST_LINE";
+ static std::string const lineVar = "CMAKE_CURRENT_LIST_LINE";
do {
char inc = *in;
switch (inc) {
@@ -3129,7 +2592,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
} else {
varresult = *value;
}
- } else if (!this->SuppressSideEffects) {
+ } else {
this->MaybeWarnUninitialized(lookup, filename);
}
result.replace(var.loc, result.size() - var.loc, varresult);
@@ -3140,8 +2603,8 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
case '$':
if (!atOnly) {
t_lookup lookup;
- const char* next = in + 1;
- const char* start = nullptr;
+ char const* next = in + 1;
+ char const* start = nullptr;
char nextc = *next;
if (nextc == '{') {
// Looking for a variable.
@@ -3181,7 +2644,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
CM_FALLTHROUGH;
case '\\':
if (!noEscapes) {
- const char* next = in + 1;
+ char const* next = in + 1;
char nextc = *next;
if (nextc == 't') {
result.append(last, in - last);
@@ -3228,7 +2691,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
break;
case '@':
if (replaceAt) {
- const char* nextAt = strchr(in + 1, '@');
+ char const* nextAt = strchr(in + 1, '@');
if (nextAt && nextAt != in + 1 &&
nextAt ==
in + 1 +
@@ -3245,7 +2708,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
cmValue def = this->GetDefinition(variable);
if (def) {
varresult = *def;
- } else if (!this->SuppressSideEffects) {
+ } else {
this->MaybeWarnUninitialized(variable, filename);
}
}
@@ -3267,8 +2730,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
if (!openstack.empty() &&
!(isalnum(inc) || inc == '_' || inc == '/' || inc == '.' ||
inc == '+' || inc == '-')) {
- errorstr += "Invalid character ('";
- errorstr += inc;
+ errorstr += cmStrCat("Invalid character ('", inc);
result.append(last, in - last);
errorstr += cmStrCat("') in a variable name: '",
result.substr(openstack.back().loc), '\'');
@@ -3283,9 +2745,6 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
// Check for open variable references yet.
if (!error && !openstack.empty()) {
- // There's an open variable reference waiting. Policy CMP0010 flags
- // whether this is an error or not. The new parser now enforces
- // CMP0010 as well.
errorstr += "There is an unterminated variable reference.";
error = true;
}
@@ -3365,7 +2824,7 @@ std::vector<std::string> cmMakefile::GetGeneratorConfigs(
if (this->GetGlobalGenerator()->IsMultiConfig()) {
configs.assign(this->GetDefinition("CMAKE_CONFIGURATION_TYPES"));
} else if (mode != cmMakefile::OnlyMultiConfig) {
- const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ std::string const& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
if (!buildType.empty()) {
configs.emplace_back(buildType);
}
@@ -3376,7 +2835,7 @@ std::vector<std::string> cmMakefile::GetGeneratorConfigs(
return std::move(configs.data());
}
-bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff,
+bool cmMakefile::IsFunctionBlocked(cmListFileFunction const& lff,
cmExecutionStatus& status)
{
// if there are no blockers get out of here
@@ -3546,7 +3005,7 @@ void cmMakefile::SetScriptModeFile(std::string const& scriptfile)
this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile);
}
-void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
+void cmMakefile::SetArgcArgv(std::vector<std::string> const& args)
{
this->AddDefinition("CMAKE_ARGC", std::to_string(args.size()));
@@ -3555,7 +3014,7 @@ void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
}
}
-cmSourceFile* cmMakefile::GetSource(const std::string& sourceName,
+cmSourceFile* cmMakefile::GetSource(std::string const& sourceName,
cmSourceFileLocationKind kind) const
{
// First check "Known" paths (avoids the creation of cmSourceFileLocation)
@@ -3582,7 +3041,7 @@ cmSourceFile* cmMakefile::GetSource(const std::string& sourceName,
return nullptr;
}
-cmSourceFile* cmMakefile::CreateSource(const std::string& sourceName,
+cmSourceFile* cmMakefile::CreateSource(std::string const& sourceName,
bool generated,
cmSourceFileLocationKind kind)
{
@@ -3603,7 +3062,7 @@ cmSourceFile* cmMakefile::CreateSource(const std::string& sourceName,
return this->SourceFiles.back().get();
}
-cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName,
+cmSourceFile* cmMakefile::GetOrCreateSource(std::string const& sourceName,
bool generated,
cmSourceFileLocationKind kind)
{
@@ -3614,7 +3073,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName,
}
cmSourceFile* cmMakefile::GetOrCreateGeneratedSource(
- const std::string& sourceName)
+ std::string const& sourceName)
{
cmSourceFile* sf =
this->GetOrCreateSource(sourceName, true, cmSourceFileLocationKind::Known);
@@ -3623,7 +3082,7 @@ cmSourceFile* cmMakefile::GetOrCreateGeneratedSource(
}
void cmMakefile::CreateGeneratedOutputs(
- const std::vector<std::string>& outputs)
+ std::vector<std::string> const& outputs)
{
for (std::string const& o : outputs) {
if (cmGeneratorExpression::Find(o) == std::string::npos) {
@@ -3657,7 +3116,7 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& languages,
"Languages may not be enabled during deferred execution.");
return;
}
- if (const char* def = this->GetGlobalGenerator()->GetCMakeCFGIntDir()) {
+ if (char const* def = this->GetGlobalGenerator()->GetCMakeCFGIntDir()) {
this->AddDefinition("CMAKE_CFG_INTDIR", def);
}
@@ -3705,11 +3164,11 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& languages,
}
}
-int cmMakefile::TryCompile(const std::string& srcdir,
- const std::string& bindir,
- const std::string& projectName,
- const std::string& targetName, bool fast, int jobs,
- const std::vector<std::string>* cmakeArgs,
+int cmMakefile::TryCompile(std::string const& srcdir,
+ std::string const& bindir,
+ std::string const& projectName,
+ std::string const& targetName, bool fast, int jobs,
+ std::vector<std::string> const* cmakeArgs,
std::string& output)
{
this->IsSourceFileTryCompile = fast;
@@ -3722,10 +3181,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// use the cmake object instead of calling cmake
cmWorkingDirectory workdir(bindir);
if (workdir.Failed()) {
- this->IssueMessage(MessageType::FATAL_ERROR,
- cmStrCat("Failed to set working directory to ", bindir,
- " : ",
- std::strerror(workdir.GetLastResult())));
+ this->IssueMessage(MessageType::FATAL_ERROR, workdir.GetError());
cmSystemTools::SetFatalErrorOccurred();
this->IsSourceFileTryCompile = false;
return 1;
@@ -3874,7 +3330,7 @@ cmState* cmMakefile::GetState() const
return this->GetCMakeInstance()->GetState();
}
-void cmMakefile::DisplayStatus(const std::string& message, float s) const
+void cmMakefile::DisplayStatus(std::string const& message, float s) const
{
cmake* cm = this->GetCMakeInstance();
if (cm->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
@@ -3897,16 +3353,6 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
{
std::string result;
- // We search the module always in CMAKE_ROOT and in CMAKE_MODULE_PATH,
- // and then decide based on the policy setting which one to return.
- // See CMP0017 for more details.
- // The specific problem was that KDE 4.5.0 installs a
- // FindPackageHandleStandardArgs.cmake which doesn't have the new features
- // of FPHSA.cmake introduced in CMake 2.8.3 yet, and by setting
- // CMAKE_MODULE_PATH also e.g. FindZLIB.cmake from cmake included
- // FPHSA.cmake from kdelibs and not from CMake, and tried to use the
- // new features, which were not there in the version from kdelibs, and so
- // failed ("
std::string moduleInCMakeRoot;
std::string moduleInCMakeModulePath;
@@ -3944,45 +3390,28 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
// Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file
// from which we are being called is located itself in CMAKE_ROOT, then
// prefer results from CMAKE_ROOT depending on the policy setting.
- system = false;
- result = moduleInCMakeModulePath;
- if (result.empty()) {
- system = true;
- result = moduleInCMakeRoot;
- }
-
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) {
cmValue currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/");
if (currentFile && cmSystemTools::IsSubDirectory(*currentFile, mods)) {
- switch (this->GetPolicyStatus(cmPolicies::CMP0017)) {
- case cmPolicies::WARN: {
- auto e = cmStrCat(
- "File ", *currentFile, " includes ", moduleInCMakeModulePath,
- " (found via CMAKE_MODULE_PATH) which shadows ", moduleInCMakeRoot,
- ". This may cause errors later on .\n",
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0017));
- this->IssueMessage(MessageType::AUTHOR_WARNING, e);
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD:
- system = false;
- result = moduleInCMakeModulePath;
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- system = true;
- result = moduleInCMakeRoot;
- break;
- }
+ system = true;
+ result = moduleInCMakeRoot;
+ } else {
+ system = false;
+ result = moduleInCMakeModulePath;
}
+ } else if (!moduleInCMakeModulePath.empty()) {
+ system = false;
+ result = moduleInCMakeModulePath;
+ } else {
+ system = true;
+ result = moduleInCMakeRoot;
}
return result;
}
-void cmMakefile::ConfigureString(const std::string& input, std::string& output,
+void cmMakefile::ConfigureString(std::string const& input, std::string& output,
bool atOnly, bool escapeQuotes) const
{
// Split input to handle one line at a time.
@@ -4007,7 +3436,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
if (this->cmDefineRegex.find(line)) {
cmValue def = this->GetDefinition(this->cmDefineRegex.match(2));
if (!def.IsOff()) {
- const std::string indentation = this->cmDefineRegex.match(1);
+ std::string const indentation = this->cmDefineRegex.match(1);
cmSystemTools::ReplaceString(line,
cmStrCat('#', indentation, "cmakedefine"),
cmStrCat('#', indentation, "define"));
@@ -4018,7 +3447,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
output += " */";
}
} else if (this->cmDefine01Regex.find(line)) {
- const std::string indentation = this->cmDefine01Regex.match(1);
+ std::string const indentation = this->cmDefine01Regex.match(1);
cmValue def = this->GetDefinition(this->cmDefine01Regex.match(2));
cmSystemTools::ReplaceString(line,
cmStrCat('#', indentation, "cmakedefine01"),
@@ -4042,10 +3471,10 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
}
// Perform variable replacements.
- const char* filename = nullptr;
+ char const* filename = nullptr;
long lineNumber = -1;
if (!this->Backtrace.Empty()) {
- const auto& currentTrace = this->Backtrace.Top();
+ auto const& currentTrace = this->Backtrace.Top();
filename = currentTrace.FilePath.c_str();
lineNumber = currentTrace.Line;
}
@@ -4053,8 +3482,8 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
lineNumber, true, true);
}
-int cmMakefile::ConfigureFile(const std::string& infile,
- const std::string& outfile, bool copyonly,
+int cmMakefile::ConfigureFile(std::string const& infile,
+ std::string const& outfile, bool copyonly,
bool atOnly, bool escapeQuotes,
mode_t permissions, cmNewLineStyle newLine)
{
@@ -4069,7 +3498,7 @@ int cmMakefile::ConfigureFile(const std::string& infile,
return 0;
}
std::string soutfile = outfile;
- const std::string& sinfile = infile;
+ std::string const& sinfile = infile;
this->AddCMakeDependFile(sinfile);
cmSystemTools::ConvertToUnixSlashes(soutfile);
@@ -4089,7 +3518,7 @@ int cmMakefile::ConfigureFile(const std::string& infile,
}
if (copyonly) {
- const auto copy_status =
+ auto const copy_status =
cmSystemTools::CopyFileIfDifferent(sinfile, soutfile);
if (!copy_status) {
this->IssueMessage(
@@ -4101,7 +3530,7 @@ int cmMakefile::ConfigureFile(const std::string& infile,
"file: ", copy_status.GetString()));
res = 0;
} else {
- const auto status = cmSystemTools::SetPermissions(soutfile, permissions);
+ auto const status = cmSystemTools::SetPermissions(soutfile, permissions);
if (!status) {
this->IssueMessage(MessageType::FATAL_ERROR, status.GetString());
res = 0;
@@ -4172,26 +3601,26 @@ int cmMakefile::ConfigureFile(const std::string& infile,
return res;
}
-void cmMakefile::SetProperty(const std::string& prop, cmValue value)
+void cmMakefile::SetProperty(std::string const& prop, cmValue value)
{
this->StateSnapshot.GetDirectory().SetProperty(prop, value, this->Backtrace);
}
-void cmMakefile::AppendProperty(const std::string& prop,
- const std::string& value, bool asString)
+void cmMakefile::AppendProperty(std::string const& prop,
+ std::string const& value, bool asString)
{
this->StateSnapshot.GetDirectory().AppendProperty(prop, value, asString,
this->Backtrace);
}
-cmValue cmMakefile::GetProperty(const std::string& prop) const
+cmValue cmMakefile::GetProperty(std::string const& prop) const
{
// Check for computed properties.
static std::string output;
if (prop == "TESTS"_s) {
std::vector<std::string> keys;
// get list of keys
- const auto* t = this;
+ auto const* t = this;
std::transform(
t->Tests.begin(), t->Tests.end(), std::back_inserter(keys),
[](decltype(t->Tests)::value_type const& pair) { return pair.first; });
@@ -4202,12 +3631,12 @@ cmValue cmMakefile::GetProperty(const std::string& prop) const
return this->StateSnapshot.GetDirectory().GetProperty(prop);
}
-cmValue cmMakefile::GetProperty(const std::string& prop, bool chain) const
+cmValue cmMakefile::GetProperty(std::string const& prop, bool chain) const
{
return this->StateSnapshot.GetDirectory().GetProperty(prop, chain);
}
-bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
+bool cmMakefile::GetPropertyAsBool(std::string const& prop) const
{
return this->GetProperty(prop).IsOn();
}
@@ -4217,7 +3646,7 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const
return this->StateSnapshot.GetDirectory().GetPropertyKeys();
}
-cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
+cmTarget* cmMakefile::FindLocalNonAliasTarget(std::string const& name) const
{
auto i = this->Targets.find(name);
if (i != this->Targets.end()) {
@@ -4226,7 +3655,7 @@ cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
return nullptr;
}
-cmTest* cmMakefile::CreateTest(const std::string& testName)
+cmTest* cmMakefile::CreateTest(std::string const& testName)
{
cmTest* test = this->GetTest(testName);
if (test) {
@@ -4239,7 +3668,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName)
return test;
}
-cmTest* cmMakefile::GetTest(const std::string& testName) const
+cmTest* cmMakefile::GetTest(std::string const& testName) const
{
auto mi = this->Tests.find(testName);
if (mi != this->Tests.end()) {
@@ -4248,10 +3677,10 @@ cmTest* cmMakefile::GetTest(const std::string& testName) const
return nullptr;
}
-void cmMakefile::GetTests(const std::string& config,
+void cmMakefile::GetTests(std::string const& config,
std::vector<cmTest*>& tests) const
{
- for (const auto& generator : this->GetTestGenerators()) {
+ for (auto const& generator : this->GetTestGenerators()) {
if (generator->TestsForConfig(config)) {
tests.push_back(generator->GetTest());
}
@@ -4288,7 +3717,7 @@ std::string cmMakefile::FormatListFileStack() const
auto depth = 1;
std::transform(listFiles.begin(), listFiles.end(), listFiles.begin(),
- [&depth](const std::string& file) {
+ [&depth](std::string const& file) {
return cmStrCat('[', depth++, "]\t", file);
});
@@ -4318,7 +3747,7 @@ void cmMakefile::PopScope()
this->PopSnapshot();
}
-void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
+void cmMakefile::RaiseScope(std::string const& var, char const* varDef)
{
if (var.empty()) {
return;
@@ -4340,7 +3769,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
#endif
}
-void cmMakefile::RaiseScope(const std::vector<std::string>& variables)
+void cmMakefile::RaiseScope(std::vector<std::string> const& variables)
{
for (auto const& varName : variables) {
if (this->IsNormalDefinitionSet(varName)) {
@@ -4352,7 +3781,7 @@ void cmMakefile::RaiseScope(const std::vector<std::string>& variables)
}
}
-cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
+cmTarget* cmMakefile::AddImportedTarget(std::string const& name,
cmStateEnums::TargetType type,
bool global)
{
@@ -4373,34 +3802,59 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
return this->ImportedTargetsOwned.back().get();
}
-cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
- bool excludeAliases) const
+cmTarget* cmMakefile::AddForeignTarget(std::string const& origin,
+ std::string const& name)
+{
+ std::unique_ptr<cmTarget> target(new cmTarget(
+ cmStrCat("@foreign_", origin, "::", name),
+ cmStateEnums::TargetType::INTERFACE_LIBRARY, cmTarget::Visibility::Foreign,
+ this, cmTarget::PerConfig::Yes));
+
+ this->ImportedTargets[name] = target.get();
+ this->GetGlobalGenerator()->IndexTarget(target.get());
+ this->GetStateSnapshot().GetDirectory().AddImportedTargetName(name);
+
+ this->ImportedTargetsOwned.push_back(std::move(target));
+ return this->ImportedTargetsOwned.back().get();
+}
+
+cmTarget* cmMakefile::FindTargetToUse(
+ std::string const& name, cmStateEnums::TargetDomainSet domains) const
{
// Look for an imported target. These take priority because they
// are more local in scope and do not have to be globally unique.
auto targetName = name;
- if (!excludeAliases) {
+ if (domains.contains(cmStateEnums::TargetDomain::ALIAS)) {
// Look for local alias targets.
auto alias = this->AliasTargets.find(name);
if (alias != this->AliasTargets.end()) {
targetName = alias->second;
}
}
- auto imported = this->ImportedTargets.find(targetName);
+ auto const imported = this->ImportedTargets.find(targetName);
+
+ bool const useForeign =
+ domains.contains(cmStateEnums::TargetDomain::FOREIGN);
+ bool const useNative = domains.contains(cmStateEnums::TargetDomain::NATIVE);
+
if (imported != this->ImportedTargets.end()) {
- return imported->second;
+ if (imported->second->IsForeign() ? useForeign : useNative) {
+ return imported->second;
+ }
}
// Look for a target built in this directory.
if (cmTarget* t = this->FindLocalNonAliasTarget(name)) {
- return t;
+ if (t->IsForeign() ? useForeign : useNative) {
+ return t;
+ }
}
// Look for a target built in this project.
- return this->GetGlobalGenerator()->FindTarget(name, excludeAliases);
+ return this->GetGlobalGenerator()->FindTarget(name, domains);
}
-bool cmMakefile::IsAlias(const std::string& name) const
+bool cmMakefile::IsAlias(std::string const& name) const
{
if (cm::contains(this->AliasTargets, name)) {
return true;
@@ -4427,23 +3881,6 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
"\" because an imported target with the same name already exists.");
return false;
}
- // target names must be globally unique
- switch (this->GetPolicyStatus(cmPolicies::CMP0002)) {
- case cmPolicies::WARN:
- this->IssueMessage(MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0002));
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002));
- return true;
- case cmPolicies::NEW:
- break;
- }
// The conflict is with a non-imported target.
// Allow this if the user has requested support.
@@ -4493,58 +3930,25 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
return true;
}
-bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
- const std::string& binPath) const
+bool cmMakefile::EnforceUniqueDir(std::string const& srcPath,
+ std::string const& binPath) const
{
// Make sure the binary directory is unique.
cmGlobalGenerator* gg = this->GetGlobalGenerator();
if (gg->BinaryDirectoryIsNew(binPath)) {
return true;
}
- std::string e;
- switch (this->GetPolicyStatus(cmPolicies::CMP0013)) {
- case cmPolicies::WARN:
- // Print the warning.
- e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0013),
- "\n"
- "The binary directory\n"
- " ",
- binPath,
- "\n"
- "is already used to build a source directory. "
- "This command uses it to build source directory\n"
- " ",
- srcPath,
- "\n"
- "which can generate conflicting build files. "
- "CMake does not support this use case but it used "
- "to work accidentally and is being allowed for "
- "compatibility.");
- this->IssueMessage(MessageType::AUTHOR_WARNING, e);
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // OLD behavior does not warn.
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- e = cmStrCat(cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0013),
- '\n');
- CM_FALLTHROUGH;
- case cmPolicies::NEW:
- // NEW behavior prints the error.
- e += cmStrCat("The binary directory\n"
- " ",
- binPath,
- "\n"
- "is already used to build a source directory. "
- "It cannot be used to build source directory\n"
- " ",
- srcPath,
- "\n"
- "Specify a unique binary directory name.");
- this->IssueMessage(MessageType::FATAL_ERROR, e);
- break;
- }
+ this->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("The binary directory\n"
+ " ",
+ binPath,
+ "\n"
+ "is already used to build a source directory. "
+ "It cannot be used to build source directory\n"
+ " ",
+ srcPath,
+ "\n"
+ "Specify a unique binary directory name."));
return false;
}
@@ -4598,11 +4002,6 @@ cmStateSnapshot cmMakefile::GetStateSnapshot() const
return this->StateSnapshot;
}
-const char* cmMakefile::GetDefineFlagsCMP0059() const
-{
- return this->DefineFlagsOrig.c_str();
-}
-
cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id,
bool parent_scope) const
{
@@ -4621,7 +4020,7 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) const
return cm->GetDebugOutput() || cm->GetTrace();
}
-bool cmMakefile::SetPolicy(const char* id, cmPolicies::PolicyStatus status)
+bool cmMakefile::SetPolicy(char const* id, cmPolicies::PolicyStatus status)
{
cmPolicies::PolicyID pid;
if (!cmPolicies::GetPolicyID(id, /* out */ pid)) {
@@ -4636,23 +4035,22 @@ bool cmMakefile::SetPolicy(const char* id, cmPolicies::PolicyStatus status)
bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
cmPolicies::PolicyStatus status)
{
- // A REQUIRED_ALWAYS policy may be set only to NEW.
- if (status != cmPolicies::NEW &&
- cmPolicies::GetPolicyStatus(id) == cmPolicies::REQUIRED_ALWAYS) {
- std::string msg = cmPolicies::GetRequiredAlwaysPolicyError(id);
+ // A removed policy may be set only to NEW.
+ if (cmPolicies::IsRemoved(id) && status != cmPolicies::NEW) {
+ std::string msg = cmPolicies::GetRemovedPolicyError(id);
this->IssueMessage(MessageType::FATAL_ERROR, msg);
return false;
}
// Deprecate old policies.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0129 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0139 &&
!(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::CMP0128)) &&
+ id == cmPolicies::CMP0083 || id == cmPolicies::CMP0091 ||
+ id == cmPolicies::CMP0104 || id == cmPolicies::CMP0123 ||
+ id == cmPolicies::CMP0126 || id == cmPolicies::CMP0128 ||
+ id == cmPolicies::CMP0136)) &&
(!this->IsSet("CMAKE_WARN_DEPRECATED") ||
this->IsOn("CMAKE_WARN_DEPRECATED"))) {
this->IssueMessage(MessageType::DEPRECATION_WARNING,
@@ -4725,12 +4123,6 @@ cmMakefile::VariablePushPop::~VariablePushPop()
this->Makefile->PopSnapshot();
}
-bool cmMakefile::HasCMP0054AlreadyBeenReported(
- cmListFileContext const& context) const
-{
- return !this->CMP0054ReportedIds.insert(context).second;
-}
-
void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) const
{
/* Record the setting of every policy. */
@@ -4741,26 +4133,8 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) const
}
}
-bool cmMakefile::IgnoreErrorsCMP0061() const
-{
- bool ignoreErrors = true;
- switch (this->GetPolicyStatus(cmPolicies::CMP0061)) {
- case cmPolicies::WARN:
- // No warning for this policy!
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- ignoreErrors = false;
- break;
- }
- return ignoreErrors;
-}
-
cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf,
- const std::string& fileName,
+ std::string const& fileName,
cmPolicies::PolicyMap const& pm)
: Makefile(mf)
{
@@ -4773,8 +4147,8 @@ cmMakefile::FunctionPushPop::~FunctionPushPop()
}
cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf,
- const std::string& fileName,
- const cmPolicies::PolicyMap& pm)
+ std::string const& fileName,
+ cmPolicies::PolicyMap const& pm)
: Makefile(mf)
{
this->Makefile->PushMacroScope(fileName, pm);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 6e1739e..89b3c2b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -83,15 +83,15 @@ class cmMakefile
{
public:
/* Mark a variable as used */
- void MarkVariableAsUsed(const std::string& var);
+ void MarkVariableAsUsed(std::string const& var);
/* return true if a variable has been initialized */
- bool VariableInitialized(const std::string&) const;
+ bool VariableInitialized(std::string const&) const;
/**
* Construct an empty makefile.
*/
cmMakefile(cmGlobalGenerator* globalGenerator,
- const cmStateSnapshot& snapshot);
+ cmStateSnapshot const& snapshot);
/**
* Destructor.
@@ -103,12 +103,12 @@ public:
cmDirectoryId GetDirectoryId() const;
- bool ReadListFile(const std::string& filename);
+ bool ReadListFile(std::string const& filename);
- bool ReadListFileAsString(const std::string& content,
- const std::string& virtualFileName);
+ bool ReadListFileAsString(std::string const& content,
+ std::string const& virtualFileName);
- bool ReadDependentFile(const std::string& filename,
+ bool ReadDependentFile(std::string const& filename,
bool noPolicyScope = true);
/**
@@ -129,10 +129,10 @@ public:
* Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process.
*/
- int TryCompile(const std::string& srcdir, const std::string& bindir,
- const std::string& projectName, const std::string& targetName,
+ int TryCompile(std::string const& srcdir, std::string const& bindir,
+ std::string const& projectName, std::string const& targetName,
bool fast, int jobs,
- const std::vector<std::string>* cmakeArgs,
+ std::vector<std::string> const* cmakeArgs,
std::string& output);
bool GetIsSourceFileTryCompile() const;
@@ -154,9 +154,9 @@ public:
class GeneratorAction
{
using ActionT =
- std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>;
+ std::function<void(cmLocalGenerator&, cmListFileBacktrace const&)>;
using CCActionT =
- std::function<void(cmLocalGenerator&, const cmListFileBacktrace&,
+ std::function<void(cmLocalGenerator&, cmListFileBacktrace const&,
std::unique_ptr<cmCustomCommand> cc)>;
public:
@@ -177,7 +177,7 @@ public:
{
}
- void operator()(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ void operator()(cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
GeneratorActionWhen when);
private:
@@ -212,15 +212,15 @@ public:
/**
* Get the target for PRE_BUILD, PRE_LINK, or POST_BUILD commands.
*/
- cmTarget* GetCustomCommandTarget(const std::string& target,
+ cmTarget* GetCustomCommandTarget(std::string const& target,
cmObjectLibraryCommands objLibCommands,
- const cmListFileBacktrace& lfbt) const;
+ cmListFileBacktrace const& lfbt) const;
/**
* Dispatch adding a custom PRE_BUILD, PRE_LINK, or POST_BUILD command to a
* target.
*/
- cmTarget* AddCustomCommandToTarget(const std::string& target,
+ cmTarget* AddCustomCommandToTarget(std::string const& target,
cmCustomCommandType type,
std::unique_ptr<cmCustomCommand> cc);
@@ -234,17 +234,11 @@ public:
*/
void AddCustomCommandToOutput(
std::unique_ptr<cmCustomCommand> cc,
- const CommandSourceCallback& callback = nullptr, bool replace = false);
- void AddCustomCommandOldStyle(const std::string& target,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends,
- const std::string& source,
- const cmCustomCommandLines& commandLines,
- const char* comment);
+ CommandSourceCallback const& callback = nullptr, bool replace = false);
void AppendCustomCommandToOutput(
- const std::string& output, const std::vector<std::string>& depends,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines);
+ std::string const& output, std::vector<std::string> const& depends,
+ cmImplicitDependsList const& implicit_depends,
+ cmCustomCommandLines const& commandLines);
/**
* Add a define flag to the build.
@@ -257,43 +251,46 @@ public:
void AddLinkDirectory(std::string const& directory, bool before = false);
/** Create a new imported target with the name and type given. */
- cmTarget* AddImportedTarget(const std::string& name,
+ cmTarget* AddImportedTarget(std::string const& name,
cmStateEnums::TargetType type, bool global);
+ cmTarget* AddForeignTarget(std::string const& origin,
+ std::string const& name);
+
std::pair<cmTarget&, bool> CreateNewTarget(
- const std::string& name, cmStateEnums::TargetType type,
+ std::string const& name, cmStateEnums::TargetType type,
cmTarget::PerConfig perConfig = cmTarget::PerConfig::Yes,
cmTarget::Visibility vis = cmTarget::Visibility::Normal);
cmTarget* AddNewTarget(cmStateEnums::TargetType type,
- const std::string& name);
+ std::string const& name);
cmTarget* AddSynthesizedTarget(cmStateEnums::TargetType type,
- const std::string& name);
+ std::string const& name);
/** Create a target instance for the utility. */
- cmTarget* AddNewUtilityTarget(const std::string& utilityName,
+ cmTarget* AddNewUtilityTarget(std::string const& utilityName,
bool excludeFromAll);
/**
* Add an executable to the build.
*/
- cmTarget* AddExecutable(const std::string& exename,
- const std::vector<std::string>& srcs,
+ cmTarget* AddExecutable(std::string const& exename,
+ std::vector<std::string> const& srcs,
bool excludeFromAll = false);
/**
* Dispatch adding a utility to the build. A utility target is a command
* that is run every time the target is built.
*/
- cmTarget* AddUtilityCommand(const std::string& utilityName,
+ cmTarget* AddUtilityCommand(std::string const& utilityName,
bool excludeFromAll,
std::unique_ptr<cmCustomCommand> cc);
/**
* Add a subdirectory to the build.
*/
- void AddSubDirectory(const std::string& fullSrcDir,
- const std::string& fullBinDir, bool excludeFromAll,
+ void AddSubDirectory(std::string const& fullSrcDir,
+ std::string const& fullBinDir, bool excludeFromAll,
bool immediate, bool system);
void Configure();
@@ -306,35 +303,35 @@ public:
/**
* Add an include directory to the build.
*/
- void AddIncludeDirectories(const std::vector<std::string>& incs,
+ void AddIncludeDirectories(std::vector<std::string> const& incs,
bool before = false);
/**
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.
*/
- void AddDefinition(const std::string& name, cm::string_view value);
- void AddDefinition(const std::string& name, cmValue value)
+ void AddDefinition(std::string const& name, cm::string_view value);
+ void AddDefinition(std::string const& name, cmValue value)
{
this->AddDefinition(name, *value);
}
/**
* Add bool variable definition to the build.
*/
- void AddDefinitionBool(const std::string& name, bool);
+ void AddDefinitionBool(std::string const& name, bool);
//! Add a definition to this makefile and the global cmake cache.
- void AddCacheDefinition(const std::string& name, cmValue value, cmValue doc,
+ void AddCacheDefinition(std::string const& name, cmValue value, cmValue doc,
cmStateEnums::CacheEntryType type,
bool force = false);
- void AddCacheDefinition(const std::string& name, cmValue value,
- const std::string& doc,
+ void AddCacheDefinition(std::string const& name, cmValue value,
+ std::string const& doc,
cmStateEnums::CacheEntryType type,
bool force = false)
{
this->AddCacheDefinition(name, value, cmValue{ doc }, type, force);
}
- void AddCacheDefinition(const std::string& name, const std::string& value,
- const std::string& doc,
+ void AddCacheDefinition(std::string const& name, std::string const& value,
+ std::string const& doc,
cmStateEnums::CacheEntryType type,
bool force = false)
{
@@ -346,9 +343,9 @@ public:
* Remove a variable definition from the build. This is not valid
* for cache entries, and will only affect the current makefile.
*/
- void RemoveDefinition(const std::string& name);
+ void RemoveDefinition(std::string const& name);
//! Remove a definition from the cache.
- void RemoveCacheDefinition(const std::string& name) const;
+ void RemoveCacheDefinition(std::string const& name) const;
/**
* Specify the name of the project for this build.
@@ -374,11 +371,11 @@ public:
/**
* Set the name of the library.
*/
- cmTarget* AddLibrary(const std::string& libname,
+ cmTarget* AddLibrary(std::string const& libname,
cmStateEnums::TargetType type,
- const std::vector<std::string>& srcs,
+ std::vector<std::string> const& srcs,
bool excludeFromAll = false);
- void AddAlias(const std::string& libname, const std::string& tgt,
+ void AddAlias(std::string const& libname, std::string const& tgt,
bool globallyVisible = true);
//@{
@@ -386,7 +383,7 @@ public:
* Set, Push, Pop policy values for CMake.
*/
bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
- bool SetPolicy(const char* id, cmPolicies::PolicyStatus status);
+ bool SetPolicy(char const* id, cmPolicies::PolicyStatus status);
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id,
bool parent_scope = false) const;
bool SetPolicyVersion(std::string const& version_min,
@@ -401,8 +398,8 @@ public:
PolicyPushPop(cmMakefile* m);
~PolicyPushPop();
- PolicyPushPop(const PolicyPushPop&) = delete;
- PolicyPushPop& operator=(const PolicyPushPop&) = delete;
+ PolicyPushPop(PolicyPushPop const&) = delete;
+ PolicyPushPop& operator=(PolicyPushPop const&) = delete;
private:
cmMakefile* Makefile;
@@ -423,14 +420,6 @@ public:
cmMakefile* Makefile;
};
- /**
- * Determine if the given context, name pair has already been reported
- * in context of CMP0054.
- */
- bool HasCMP0054AlreadyBeenReported(const cmListFileContext& context) const;
-
- bool IgnoreErrorsCMP0061() const;
-
std::string const& GetHomeDirectory() const;
std::string const& GetHomeOutputDirectory() const;
@@ -442,7 +431,7 @@ public:
/**
* Set CMAKE_ARGC, CMAKE_ARGV0 ... variables.
*/
- void SetArgcArgv(const std::vector<std::string>& args);
+ void SetArgcArgv(std::vector<std::string> const& args);
std::string const& GetCurrentSourceDirectory() const;
std::string const& GetCurrentBinaryDirectory() const;
@@ -453,11 +442,11 @@ public:
* Set a regular expression that include files must match
* in order to be considered as part of the depend information.
*/
- void SetIncludeRegularExpression(const std::string& regex)
+ void SetIncludeRegularExpression(std::string const& regex)
{
this->SetProperty("INCLUDE_REGULAR_EXPRESSION", regex);
}
- const std::string& GetIncludeRegularExpression() const
+ std::string const& GetIncludeRegularExpression() const
{
return this->GetProperty("INCLUDE_REGULAR_EXPRESSION");
}
@@ -466,11 +455,11 @@ public:
* Set a regular expression that include files that are not found
* must match in order to be considered a problem.
*/
- void SetComplainRegularExpression(const std::string& regex)
+ void SetComplainRegularExpression(std::string const& regex)
{
this->ComplainFileRegularExpression = regex;
}
- const std::string& GetComplainRegularExpression() const
+ std::string const& GetComplainRegularExpression() const
{
return this->ComplainFileRegularExpression;
}
@@ -482,19 +471,23 @@ public:
/** Get the target map - const version */
cmTargetMap const& GetTargets() const { return this->Targets; }
- const std::vector<std::unique_ptr<cmTarget>>& GetOwnedImportedTargets() const
+ std::vector<std::unique_ptr<cmTarget>> const& GetOwnedImportedTargets() const
{
return this->ImportedTargetsOwned;
}
std::vector<cmTarget*> GetImportedTargets() const;
- cmTarget* FindLocalNonAliasTarget(const std::string& name) const;
+ cmTarget* FindImportedTarget(std::string const& name) const;
+
+ cmTarget* FindLocalNonAliasTarget(std::string const& name) const;
/** Find a target to use in place of the given name. The target
returned may be imported or built within the project. */
- cmTarget* FindTargetToUse(const std::string& name,
- bool excludeAliases = false) const;
- bool IsAlias(const std::string& name) const;
+ cmTarget* FindTargetToUse(std::string const& name,
+ cmStateEnums::TargetDomainSet domains = {
+ cmStateEnums::TargetDomain::NATIVE,
+ cmStateEnums::TargetDomain::ALIAS }) const;
+ bool IsAlias(std::string const& name) const;
std::map<std::string, std::string> GetAliasTargets() const
{
@@ -504,13 +497,13 @@ public:
/**
* Mark include directories as system directories.
*/
- void AddSystemIncludeDirectories(const std::set<std::string>& incs);
+ void AddSystemIncludeDirectories(std::set<std::string> const& incs);
/** Get a cmSourceFile pointer for a given source name, if the name is
* not found, then a null pointer is returned.
*/
cmSourceFile* GetSource(
- const std::string& sourceName,
+ std::string const& sourceName,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous) const;
/** Create the source file and return it. generated
@@ -518,7 +511,7 @@ public:
* how to create the source file instance e.g. name
*/
cmSourceFile* CreateSource(
- const std::string& sourceName, bool generated = false,
+ std::string const& sourceName, bool generated = false,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
/** Get a cmSourceFile pointer for a given source name, if the name is
@@ -527,14 +520,14 @@ public:
* how to create the source file instance e.g. name
*/
cmSourceFile* GetOrCreateSource(
- const std::string& sourceName, bool generated = false,
+ std::string const& sourceName, bool generated = false,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
/** Get a cmSourceFile pointer for a given source name and always mark the
* file as generated, if the name is not found, then create the source file
* and return it.
*/
- cmSourceFile* GetOrCreateGeneratedSource(const std::string& sourceName);
+ cmSourceFile* GetOrCreateGeneratedSource(std::string const& sourceName);
void AddTargetObject(std::string const& tgtName, std::string const& objFile);
@@ -543,11 +536,11 @@ public:
* If the variable is not found in this makefile instance, the
* cache is then queried.
*/
- cmValue GetDefinition(const std::string&) const;
- const std::string& GetSafeDefinition(const std::string&) const;
- const std::string& GetRequiredDefinition(const std::string& name) const;
- bool IsDefinitionSet(const std::string&) const;
- bool IsNormalDefinitionSet(const std::string&) const;
+ cmValue GetDefinition(std::string const&) const;
+ std::string const& GetSafeDefinition(std::string const&) const;
+ std::string const& GetRequiredDefinition(std::string const& name) const;
+ bool IsDefinitionSet(std::string const&) const;
+ bool IsNormalDefinitionSet(std::string const&) const;
/**
* Get the list of all variables in the current space. If argument
* cacheonly is specified and is greater than 0, then only cache
@@ -561,8 +554,8 @@ public:
* cache is then queried.
* Returns false if no entry defined.
*/
- bool IsOn(const std::string& name) const;
- bool IsSet(const std::string& name) const;
+ bool IsOn(std::string const& name) const;
+ bool IsSet(std::string const& name) const;
/** Return whether the target platform is 32-bit. */
bool PlatformIs32Bit() const;
@@ -603,7 +596,7 @@ public:
bool PlatformSupportsAppleTextStubs() const;
/** Retrieve soname flag for the specified language if supported */
- const char* GetSONameFlag(const std::string& language) const;
+ char const* GetSONameFlag(std::string const& language) const;
/**
* Get a list of preprocessor define flags.
@@ -619,7 +612,7 @@ public:
/**
* Get the vector source groups.
*/
- const std::vector<cmSourceGroup>& GetSourceGroups() const
+ std::vector<cmSourceGroup> const& GetSourceGroups() const
{
return this->SourceGroups;
}
@@ -627,48 +620,48 @@ public:
/**
* Get the source group
*/
- cmSourceGroup* GetSourceGroup(const std::vector<std::string>& name) const;
+ cmSourceGroup* GetSourceGroup(std::vector<std::string> const& name) const;
/**
* Add a root source group for consideration when adding a new source.
*/
- void AddSourceGroup(const std::string& name, const char* regex = nullptr);
+ void AddSourceGroup(std::string const& name, char const* regex = nullptr);
/**
* Add a source group for consideration when adding a new source.
* name is tokenized.
*/
- void AddSourceGroup(const std::vector<std::string>& name,
- const char* regex = nullptr);
+ void AddSourceGroup(std::vector<std::string> const& name,
+ char const* regex = nullptr);
/**
* Get and existing or create a new source group.
*/
cmSourceGroup* GetOrCreateSourceGroup(
- const std::vector<std::string>& folders);
+ std::vector<std::string> const& folders);
/**
* Get and existing or create a new source group.
* The name will be tokenized.
*/
- cmSourceGroup* GetOrCreateSourceGroup(const std::string& name);
+ cmSourceGroup* GetOrCreateSourceGroup(std::string const& name);
/**
* find what source group this source is in
*/
- cmSourceGroup* FindSourceGroup(const std::string& source,
+ cmSourceGroup* FindSourceGroup(std::string const& source,
std::vector<cmSourceGroup>& groups) const;
#endif
/**
* Get the vector of list files on which this makefile depends
*/
- const std::vector<std::string>& GetListFiles() const
+ std::vector<std::string> const& GetListFiles() const
{
return this->ListFiles;
}
//! When the file changes cmake will be re-run from the build system.
- void AddCMakeDependFile(const std::string& file)
+ void AddCMakeDependFile(std::string const& file)
{
this->ListFiles.push_back(file);
}
@@ -689,11 +682,11 @@ public:
/**
* Get the vector of files created by this makefile
*/
- const std::vector<std::string>& GetOutputFiles() const
+ std::vector<std::string> const& GetOutputFiles() const
{
return this->OutputFiles;
}
- void AddCMakeOutputFile(const std::string& file)
+ void AddCMakeOutputFile(std::string const& file)
{
this->OutputFiles.push_back(file);
}
@@ -705,10 +698,10 @@ public:
* entry in the this->Definitions map. Also \@var\@ is
* expanded to match autoconf style expansions.
*/
- const std::string& ExpandVariablesInString(std::string& source) const;
- const std::string& ExpandVariablesInString(
+ std::string const& ExpandVariablesInString(std::string& source) const;
+ std::string const& ExpandVariablesInString(
std::string& source, bool escapeQuotes, bool noEscapes,
- bool atOnly = false, const char* filename = nullptr, long line = -1,
+ bool atOnly = false, char const* filename = nullptr, long line = -1,
bool removeEmpty = false, bool replaceAt = false) const;
/**
@@ -718,21 +711,16 @@ public:
void RemoveVariablesInString(std::string& source, bool atOnly = false) const;
/**
- * Expand variables in the makefiles ivars such as link directories etc
- */
- void ExpandVariablesCMP0019();
-
- /**
* Replace variables and #cmakedefine lines in the given string.
* See cmConfigureFileCommand for details.
*/
- void ConfigureString(const std::string& input, std::string& output,
+ void ConfigureString(std::string const& input, std::string& output,
bool atOnly, bool escapeQuotes) const;
/**
* Copy file but change lines according to ConfigureString
*/
- int ConfigureFile(const std::string& infile, const std::string& outfile,
+ int ConfigureFile(std::string const& infile, std::string const& outfile,
bool copyonly, bool atOnly, bool escapeQuotes,
mode_t permissions = 0, cmNewLineStyle = cmNewLineStyle());
@@ -758,7 +746,7 @@ public:
* Execute a single CMake command. Returns true if the command
* succeeded or false if it failed.
*/
- bool ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus& status,
+ bool ExecuteCommand(cmListFileFunction const& lff, cmExecutionStatus& status,
cm::optional<std::string> deferId = {});
//! Enable support for named language, if nil then all languages are
@@ -777,7 +765,7 @@ public:
#endif
//! Display progress or status message.
- void DisplayStatus(const std::string&, float) const;
+ void DisplayStatus(std::string const&, float) const;
/**
* Expand the given list file arguments into the full set after
@@ -798,7 +786,7 @@ public:
/**
* Get all the source files this makefile knows about
*/
- const std::vector<std::unique_ptr<cmSourceFile>>& GetSourceFiles() const
+ std::vector<std::unique_ptr<cmSourceFile>> const& GetSourceFiles() const
{
return this->SourceFiles;
}
@@ -809,17 +797,17 @@ public:
}
//! Add a new cmTest to the list of tests for this makefile.
- cmTest* CreateTest(const std::string& testName);
+ cmTest* CreateTest(std::string const& testName);
/** Get a cmTest pointer for a given test name, if the name is
* not found, then a null pointer is returned.
*/
- cmTest* GetTest(const std::string& testName) const;
+ cmTest* GetTest(std::string const& testName) const;
/**
* Get all tests that run under the given configuration.
*/
- void GetTests(const std::string& config, std::vector<cmTest*>& tests) const;
+ void GetTests(std::string const& config, std::vector<cmTest*>& tests) const;
/**
* Return a location of a file in cmake or custom modules directory
@@ -844,20 +832,20 @@ public:
std::string& debugBuffer) const;
//! Set/Get a property of this directory
- void SetProperty(const std::string& prop, cmValue value);
- void SetProperty(const std::string& prop, std::nullptr_t)
+ void SetProperty(std::string const& prop, cmValue value);
+ void SetProperty(std::string const& prop, std::nullptr_t)
{
this->SetProperty(prop, cmValue{ nullptr });
}
- void SetProperty(const std::string& prop, const std::string& value)
+ void SetProperty(std::string const& prop, std::string const& value)
{
this->SetProperty(prop, cmValue(value));
}
- void AppendProperty(const std::string& prop, const std::string& value,
+ void AppendProperty(std::string const& prop, std::string const& value,
bool asString = false);
- cmValue GetProperty(const std::string& prop) const;
- cmValue GetProperty(const std::string& prop, bool chain) const;
- bool GetPropertyAsBool(const std::string& prop) const;
+ cmValue GetProperty(std::string const& prop) const;
+ cmValue GetProperty(std::string const& prop, bool chain) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
std::vector<std::string> GetPropertyKeys() const;
//! Initialize a makefile from its parent
@@ -869,7 +857,7 @@ public:
{
return this->InstallGenerators;
}
- const std::vector<std::unique_ptr<cmInstallGenerator>>&
+ std::vector<std::unique_ptr<cmInstallGenerator>> const&
GetInstallGenerators() const
{
return this->InstallGenerators;
@@ -877,7 +865,7 @@ public:
void AddTestGenerator(std::unique_ptr<cmTestGenerator> g);
- const std::vector<std::unique_ptr<cmTestGenerator>>& GetTestGenerators()
+ std::vector<std::unique_ptr<cmTestGenerator>> const& GetTestGenerators()
const
{
return this->TestGenerators;
@@ -890,8 +878,8 @@ public:
cmPolicies::PolicyMap const& pm);
~FunctionPushPop();
- FunctionPushPop(const FunctionPushPop&) = delete;
- FunctionPushPop& operator=(const FunctionPushPop&) = delete;
+ FunctionPushPop(FunctionPushPop const&) = delete;
+ FunctionPushPop& operator=(FunctionPushPop const&) = delete;
void Quiet() { this->ReportError = false; }
@@ -907,8 +895,8 @@ public:
cmPolicies::PolicyMap const& pm);
~MacroPushPop();
- MacroPushPop(const MacroPushPop&) = delete;
- MacroPushPop& operator=(const MacroPushPop&) = delete;
+ MacroPushPop(MacroPushPop const&) = delete;
+ MacroPushPop& operator=(MacroPushPop const&) = delete;
void Quiet() { this->ReportError = false; }
@@ -925,12 +913,12 @@ public:
void PopMacroScope(bool reportError);
void PushScope();
void PopScope();
- void RaiseScope(const std::string& var, const char* value);
- void RaiseScope(const std::string& var, cmValue value)
+ void RaiseScope(std::string const& var, char const* value);
+ void RaiseScope(std::string const& var, cmValue value)
{
this->RaiseScope(var, value.GetCStr());
}
- void RaiseScope(const std::vector<std::string>& variables);
+ void RaiseScope(std::vector<std::string> const& variables);
// push and pop loop scopes
void PushLoopBlockBarrier();
@@ -999,8 +987,7 @@ public:
/** Set whether or not to report a CMP0000 violation. */
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
- bool CheckCMP0037(std::string const& targetName,
- cmStateEnums::TargetType targetType) const;
+ void IssueInvalidTargetNameError(std::string const& targetName) const;
cmBTStringRange GetIncludeDirectoriesEntries() const;
cmBTStringRange GetCompileOptionsEntries() const;
@@ -1024,22 +1011,19 @@ public:
cmStateSnapshot GetStateSnapshot() const;
- const char* GetDefineFlagsCMP0059() const;
-
void EnforceDirectoryLevelRules() const;
void AddEvaluationFile(
- const std::string& inputFile, const std::string& targetName,
+ std::string const& inputFile, std::string const& targetName,
std::unique_ptr<cmCompiledGeneratorExpression> outputName,
std::unique_ptr<cmCompiledGeneratorExpression> condition,
- const std::string& newLineCharacter, mode_t permissions,
+ std::string const& newLineCharacter, mode_t permissions,
bool inputIsContent);
- const std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>>&
+ std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>> const&
GetEvaluationFiles() const;
std::vector<std::unique_ptr<cmExportBuildFileGenerator>> const&
GetExportBuildFileGenerators() const;
- void RemoveExportBuildFileGeneratorCMP0024(cmExportBuildFileGenerator* gen);
void AddExportBuildFileGenerator(
std::unique_ptr<cmExportBuildFileGenerator> gen);
@@ -1054,6 +1038,9 @@ public:
public:
FindPackageStackRAII(cmMakefile* mf, std::string const& pkg);
~FindPackageStackRAII();
+
+ FindPackageStackRAII(FindPackageStackRAII const&) = delete;
+ FindPackageStackRAII& operator=(FindPackageStackRAII const&) = delete;
};
class DebugFindPkgRAII
@@ -1064,6 +1051,28 @@ public:
public:
DebugFindPkgRAII(cmMakefile* mf, std::string const& pkg);
~DebugFindPkgRAII();
+
+ DebugFindPkgRAII(DebugFindPkgRAII const&) = delete;
+ DebugFindPkgRAII& operator=(DebugFindPkgRAII const&) = delete;
+ };
+
+ class CallRAII
+ {
+ public:
+ CallRAII(cmMakefile* mf, std::string const& file,
+ cmExecutionStatus& status);
+ ~CallRAII();
+
+ CallRAII(CallRAII const&) = delete;
+ CallRAII& operator=(CallRAII const&) = delete;
+
+ protected:
+ CallRAII(cmMakefile* mf, cmListFileContext const& lfc,
+ cmExecutionStatus& status);
+
+ cmMakefile* Detach();
+
+ cmMakefile* Makefile;
};
bool GetDebugFindPkgMode() const;
@@ -1073,8 +1082,8 @@ public:
void MaybeWarnCMP0144(std::string const& rootVAR, cmValue rootDEF,
cm::optional<std::string> const& rootENV);
void MaybeWarnUninitialized(std::string const& variable,
- const char* sourceFilename) const;
- bool IsProjectFile(const char* filename) const;
+ char const* sourceFilename) const;
+ bool IsProjectFile(char const* filename) const;
size_t GetRecursionDepthLimit() const;
@@ -1091,8 +1100,6 @@ protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(cmTarget& target);
- mutable std::set<cmListFileContext> CMP0054ReportedIds;
-
// libraries, classes, and executables
mutable cmTargetMap Targets;
std::map<std::string, std::string> AliasTargets;
@@ -1130,16 +1137,13 @@ protected:
std::string ComplainFileRegularExpression;
std::string DefineFlags;
- // Track the value of the computed DEFINITIONS property.
- std::string DefineFlagsOrig;
-
#if !defined(CMAKE_BOOTSTRAP)
std::vector<cmSourceGroup> SourceGroups;
size_t ObjectLibrariesSourceGroupIndex;
#endif
cmGlobalGenerator* GlobalGenerator;
- bool IsFunctionBlocked(const cmListFileFunction& lff,
+ bool IsFunctionBlocked(cmListFileFunction const& lff,
cmExecutionStatus& status);
private:
@@ -1164,13 +1168,13 @@ private:
void DoGenerate(cmLocalGenerator& lg);
void RunListFile(cmListFile const& listFile,
- const std::string& filenametoread,
+ std::string const& filenametoread,
DeferCommands* defer = nullptr);
bool ParseDefineFlag(std::string const& definition, bool remove);
- bool EnforceUniqueDir(const std::string& srcPath,
- const std::string& binPath) const;
+ bool EnforceUniqueDir(std::string const& srcPath,
+ std::string const& binPath) const;
std::function<void()> ExecuteCommandCallback;
using FunctionBlockerPtr = std::unique_ptr<cmFunctionBlocker>;
@@ -1185,7 +1189,6 @@ private:
mutable cmsys::RegularExpression cmDefineRegex;
mutable cmsys::RegularExpression cmDefine01Regex;
- mutable cmsys::RegularExpression cmAtVarRegex;
mutable cmsys::RegularExpression cmNamedCurly;
std::vector<cmMakefile*> UnConfiguredDirectories;
@@ -1195,8 +1198,10 @@ private:
std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>>
EvaluationFiles;
+ class CallScope;
+ friend class CallScope;
+
std::vector<cmExecutionStatus*> ExecutionStatusStack;
- friend class cmMakefileCall;
friend class cmParseFileScope;
std::vector<std::unique_ptr<cmTarget>> ImportedTargetsOwned;
@@ -1225,23 +1230,15 @@ private:
class BuildsystemFileScope;
friend class BuildsystemFileScope;
- // CMP0053 == old
- MessageType ExpandVariablesInStringOld(std::string& errorstr,
- std::string& source,
- bool escapeQuotes, bool noEscapes,
- bool atOnly, const char* filename,
- long line, bool removeEmpty,
- bool replaceAt) const;
- // CMP0053 == new
- MessageType ExpandVariablesInStringNew(std::string& errorstr,
- std::string& source,
- bool escapeQuotes, bool noEscapes,
- bool atOnly, const char* filename,
- long line, bool replaceAt) const;
+ MessageType ExpandVariablesInStringImpl(std::string& errorstr,
+ std::string& source,
+ bool escapeQuotes, bool noEscapes,
+ bool atOnly, char const* filename,
+ long line, bool replaceAt) const;
- bool ValidateCustomCommand(const cmCustomCommandLines& commandLines) const;
+ bool ValidateCustomCommand(cmCustomCommandLines const& commandLines) const;
- void CreateGeneratedOutputs(const std::vector<std::string>& outputs);
+ void CreateGeneratedOutputs(std::vector<std::string> const& outputs);
std::vector<BT<GeneratorAction>> GeneratorActions;
bool GeneratorActionsInvoked = false;
@@ -1256,6 +1253,5 @@ private:
std::set<std::string> WarnedCMP0074;
std::set<std::string> WarnedCMP0144;
bool IsSourceFileTryCompile;
- mutable bool SuppressSideEffects;
ImportedTargetScope CurrentImportedTargetScope = ImportedTargetScope::Local;
};
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 96a0d5c..c812874 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMakefileExecutableTargetGenerator.h"
#include <set>
@@ -12,6 +12,7 @@
#include <cmext/algorithm>
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLinkLineComputer.h"
@@ -87,7 +88,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
bool relink)
{
#ifndef CMAKE_BOOTSTRAP
- const bool requiresDeviceLinking = requireDeviceLinking(
+ bool const requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (!requiresDeviceLinking) {
return;
@@ -131,9 +132,9 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
bool relink, std::vector<std::string>& commands,
- const std::string& targetOutput)
+ std::string const& targetOutput)
{
- const std::string linkLanguage = "CUDA";
+ std::string const linkLanguage = "CUDA";
// Build list of dependencies.
std::vector<std::string> depends;
@@ -154,8 +155,8 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
// Construct the main link rule.
- const std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE";
- const std::string linkRule = this->GetLinkRule(linkRuleVar);
+ std::string const linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE";
+ std::string const linkRule = this->GetLinkRule(linkRuleVar);
std::vector<std::string> commands1;
cmList real_link_commands(linkRule);
@@ -233,7 +234,8 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
}
auto rulePlaceholderExpander =
- this->LocalGenerator->CreateRulePlaceholderExpander();
+ this->LocalGenerator->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GeneratorTarget, linkLanguage);
// Expand placeholders in the commands.
rulePlaceholderExpander->SetTargetImpLib(targetOutput);
@@ -251,7 +253,7 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
// command lines in the make shell.
if (useLinkScript) {
// Use a link script.
- const char* name = (relink ? "drelink.txt" : "dlink.txt");
+ char const* name = (relink ? "drelink.txt" : "dlink.txt");
this->CreateLinkScript(name, real_link_commands, commands1, depends);
} else {
// No link script. Just use the link rule directly.
@@ -370,19 +372,20 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Add flags to create an executable.
this->LocalGenerator->AddConfigVariableFlags(
- linkFlags, "CMAKE_EXE_LINKER_FLAGS", this->GetConfigName());
+ linkFlags, "CMAKE_EXE_LINKER_FLAGS", this->GeneratorTarget,
+ cmBuildStep::Link, linkLanguage, this->GetConfigName());
- if (this->GeneratorTarget->IsWin32Executable(
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"))) {
- this->LocalGenerator->AppendFlags(
- linkFlags,
- this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_", linkLanguage, "_CREATE_WIN32_EXE")));
- } else {
+ {
+ auto exeType =
+ cmStrCat("CMAKE_", linkLanguage, "_CREATE_",
+ (this->GeneratorTarget->IsWin32Executable(
+ this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
+ ? "WIN32"
+ : "CONSOLE"),
+ "_EXE");
this->LocalGenerator->AppendFlags(
- linkFlags,
- this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_", linkLanguage, "_CREATE_CONSOLE_EXE")));
+ linkFlags, this->Makefile->GetDefinition(exeType), exeType,
+ this->GeneratorTarget, cmBuildStep::Link, linkLanguage);
}
// Add symbol export flags if necessary.
@@ -394,7 +397,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
this->LocalGenerator->AppendFlags(linkFlags,
- this->LocalGenerator->GetLinkLibsCMP0065(
+ this->LocalGenerator->GetExeExportFlags(
linkLanguage, *this->GeneratorTarget));
this->UseLWYU = this->LocalGenerator->AppendLWYUFlags(
@@ -534,6 +537,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(this->GeneratorTarget->GetType()).c_str();
+ vars.CMTargetLabels =
+ this->GeneratorTarget->GetTargetLabelsString().c_str();
vars.Language = linkLanguage.c_str();
vars.Linker = linker.c_str();
vars.AIXExports = aixExports.c_str();
@@ -549,6 +554,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmOutputConverter::SHELL, useWatcomQuote);
vars.Target = target.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
+ vars.Config = this->GetConfigName().c_str();
// Setup the target version.
std::string targetVersionMajor;
@@ -602,7 +608,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
auto rulePlaceholderExpander =
- this->LocalGenerator->CreateRulePlaceholderExpander();
+ this->LocalGenerator->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GeneratorTarget, linkLanguage);
// Expand placeholders in the commands.
rulePlaceholderExpander->SetTargetImpLib(targetOutPathImport);
@@ -620,7 +627,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// command lines in the make shell.
if (useLinkScript) {
// Use a link script.
- const char* name = (relink ? "relink.txt" : "link.txt");
+ char const* name = (relink ? "relink.txt" : "link.txt");
this->CreateLinkScript(name, real_link_commands, commands1, depends);
} else {
// No link script. Just use the link rule directly.
diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h
index 520f577..5c18e9e 100644
--- a/Source/cmMakefileExecutableTargetGenerator.h
+++ b/Source/cmMakefileExecutableTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,7 +26,7 @@ protected:
virtual void WriteDeviceExecutableRule(bool relink);
virtual void WriteNvidiaDeviceExecutableRule(
bool relink, std::vector<std::string>& commands,
- const std::string& targetOutput);
+ std::string const& targetOutput);
private:
std::string DeviceLinkObject;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 225e63b..57b6991 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMakefileLibraryTargetGenerator.h"
#include <cstddef>
@@ -12,6 +12,7 @@
#include <cmext/algorithm>
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLinkLineComputer.h"
@@ -131,7 +132,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
- const bool requiresDeviceLinking = requireDeviceLinking(
+ bool const requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (requiresDeviceLinking) {
this->WriteDeviceLibraryRules("CMAKE_CUDA_DEVICE_LINK_LIBRARY", false);
@@ -157,7 +158,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
}
if (!relink) {
- const bool requiresDeviceLinking = requireDeviceLinking(
+ bool const requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (requiresDeviceLinking) {
this->WriteDeviceLibraryRules("CMAKE_CUDA_DEVICE_LINK_LIBRARY", relink);
@@ -177,7 +178,8 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
std::string extraFlags;
this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
- extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->GetConfigName());
+ extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->GeneratorTarget,
+ cmBuildStep::Link, linkLanguage, this->GetConfigName());
std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
@@ -197,7 +199,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{
if (!relink) {
- const bool requiresDeviceLinking = requireDeviceLinking(
+ bool const requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (requiresDeviceLinking) {
this->WriteDeviceLibraryRules("CMAKE_CUDA_DEVICE_LINK_LIBRARY", relink);
@@ -212,7 +214,8 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
std::string extraFlags;
this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
- extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->GetConfigName());
+ extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->GeneratorTarget,
+ cmBuildStep::Link, linkLanguage, this->GetConfigName());
std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
@@ -239,13 +242,14 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
std::string extraFlags;
this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
- extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->GetConfigName());
+ extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->GeneratorTarget,
+ cmBuildStep::Link, linkLanguage, this->GetConfigName());
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
- const std::string& linkRuleVar, bool relink)
+ std::string const& linkRuleVar, bool relink)
{
#ifndef CMAKE_BOOTSTRAP
// TODO: Merge the methods that call this method to avoid
@@ -285,8 +289,8 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
}
void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
- const std::string& linkRuleVar, bool relink,
- std::vector<std::string>& commands, const std::string& targetOutput)
+ std::string const& linkRuleVar, bool relink,
+ std::vector<std::string>& commands, std::string const& targetOutput)
{
std::string linkLanguage = "CUDA";
@@ -382,7 +386,8 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
}
auto rulePlaceholderExpander =
- this->LocalGenerator->CreateRulePlaceholderExpander();
+ this->LocalGenerator->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GeneratorTarget, linkLanguage);
// Construct the main link rule and expand placeholders.
rulePlaceholderExpander->SetTargetImpLib(targetOutput);
@@ -407,7 +412,7 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
// command lines in the make shell.
if (useLinkScript) {
// Use a link script.
- const char* name = (relink ? "drelink.txt" : "dlink.txt");
+ char const* name = (relink ? "drelink.txt" : "dlink.txt");
this->CreateLinkScript(name, real_link_commands, commands1, depends);
} else {
// No link script. Just use the link rule directly.
@@ -432,7 +437,7 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
}
void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
- const std::string& linkRuleVar, const std::string& extraFlags, bool relink)
+ std::string const& linkRuleVar, std::string const& extraFlags, bool relink)
{
// TODO: Merge the methods that call this method to avoid
// code duplication.
@@ -707,7 +712,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Expand the rule variables.
auto rulePlaceholderExpander =
- this->LocalGenerator->CreateRulePlaceholderExpander();
+ this->LocalGenerator->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GeneratorTarget, linkLanguage);
bool useWatcomQuote =
this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE");
cmList real_link_commands;
@@ -775,6 +781,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(this->GeneratorTarget->GetType()).c_str();
+ vars.CMTargetLabels =
+ this->GeneratorTarget->GetTargetLabelsString().c_str();
vars.Language = linkLanguage.c_str();
vars.Linker = linker.c_str();
vars.AIXExports = aixExports.c_str();
@@ -801,8 +809,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.TargetSOName = targetOutSOName.c_str();
}
vars.LinkFlags = linkFlags.c_str();
-
vars.Manifests = manifests.c_str();
+ vars.Config = this->GetConfigName().c_str();
// Compute the directory portion of the install_name setting.
std::string install_name_dir;
@@ -928,7 +936,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// command lines in the make shell.
if (useLinkScript) {
// Use a link script.
- const char* name = (relink ? "relink.txt" : "link.txt");
+ char const* name = (relink ? "relink.txt" : "link.txt");
this->CreateLinkScript(name, real_link_commands, commands1, depends);
} else {
// No link script. Just use the link rule directly.
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index cc989e7..d355199 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,17 +27,17 @@ protected:
void WriteSharedLibraryRules(bool relink);
void WriteModuleLibraryRules(bool relink);
- void WriteDeviceLibraryRules(const std::string& linkRule, bool relink);
- void WriteNvidiaDeviceLibraryRules(const std::string& linkRuleVar,
+ void WriteDeviceLibraryRules(std::string const& linkRule, bool relink);
+ void WriteNvidiaDeviceLibraryRules(std::string const& linkRuleVar,
bool relink,
std::vector<std::string>& commands,
- const std::string& targetOutput);
- void WriteLibraryRules(const std::string& linkRule,
- const std::string& extraFlags, bool relink);
+ std::string const& targetOutput);
+ void WriteLibraryRules(std::string const& linkRule,
+ std::string const& extraFlags, bool relink);
// MacOSX Framework support methods
void WriteFrameworkRules(bool relink);
- // Store the computd framework version for OS X Frameworks.
+ // Store the computed framework version for OS X Frameworks.
std::string FrameworkVersion;
private:
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index 9387582..2f6cf0f 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/Source/cmMakefileProfilingData.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMakefileProfilingData.h"
#include <chrono>
@@ -16,7 +16,7 @@
#include "cmSystemTools.h"
cmMakefileProfilingData::cmMakefileProfilingData(
- const std::string& profileStream)
+ std::string const& profileStream)
{
std::ios::openmode omode = std::ios::out | std::ios::trunc;
this->ProfileStream.open(profileStream.c_str(), omode);
@@ -42,8 +42,8 @@ cmMakefileProfilingData::~cmMakefileProfilingData() noexcept
}
}
-void cmMakefileProfilingData::StartEntry(const std::string& category,
- const std::string& name,
+void cmMakefileProfilingData::StartEntry(std::string const& category,
+ std::string const& name,
cm::optional<Json::Value> args)
{
/* Do not try again if we previously failed to write to output. */
@@ -107,8 +107,8 @@ void cmMakefileProfilingData::StopEntry()
}
cmMakefileProfilingData::RAII::RAII(cmMakefileProfilingData& data,
- const std::string& category,
- const std::string& name,
+ std::string const& category,
+ std::string const& name,
cm::optional<Json::Value> args)
: Data(&data)
{
diff --git a/Source/cmMakefileProfilingData.h b/Source/cmMakefileProfilingData.h
index 4cf0bfa..58cdfac 100644
--- a/Source/cmMakefileProfilingData.h
+++ b/Source/cmMakefileProfilingData.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
#include <string>
@@ -17,9 +17,9 @@ class StreamWriter;
class cmMakefileProfilingData
{
public:
- cmMakefileProfilingData(const std::string&);
+ cmMakefileProfilingData(std::string const&);
~cmMakefileProfilingData() noexcept;
- void StartEntry(const std::string& category, const std::string& name,
+ void StartEntry(std::string const& category, std::string const& name,
cm::optional<Json::Value> args = cm::nullopt);
void StopEntry();
@@ -30,8 +30,8 @@ public:
RAII(const RAII&) = delete;
RAII(RAII&&) noexcept;
- RAII(cmMakefileProfilingData& data, const std::string& category,
- const std::string& name,
+ RAII(cmMakefileProfilingData& data, std::string const& category,
+ std::string const& name,
cm::optional<Json::Value> args = cm::nullopt);
~RAII();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9d0d466..21c1d19 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMakefileTargetGenerator.h"
#include <algorithm>
@@ -25,6 +25,7 @@
#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLinkLineComputer.h" // IWYU pragma: keep
@@ -74,8 +75,6 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
this->CMP0113New = false;
break;
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
this->CMP0113New = true;
break;
}
@@ -111,7 +110,7 @@ std::unique_ptr<cmMakefileTargetGenerator> cmMakefileTargetGenerator::New(
return result;
}
-std::string cmMakefileTargetGenerator::GetConfigName() const
+std::string const& cmMakefileTargetGenerator::GetConfigName() const
{
auto const& configNames = this->LocalGenerator->GetConfigNames();
assert(configNames.size() == 1);
@@ -119,7 +118,7 @@ std::string cmMakefileTargetGenerator::GetConfigName() const
}
void cmMakefileTargetGenerator::GetDeviceLinkFlags(
- std::string& linkFlags, const std::string& linkLanguage)
+ std::string& linkFlags, std::string const& linkLanguage)
{
cmGeneratorTarget::DeviceLinkSetter setter(*this->GetGeneratorTarget());
@@ -134,7 +133,7 @@ void cmMakefileTargetGenerator::GetDeviceLinkFlags(
}
void cmMakefileTargetGenerator::GetTargetLinkFlags(
- std::string& flags, const std::string& linkLanguage)
+ std::string& flags, std::string const& linkLanguage)
{
this->LocalGenerator->AppendFlags(
flags, this->GeneratorTarget->GetSafeProperty("LINK_FLAGS"));
@@ -157,6 +156,8 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
this->LocalGenerator->AppendPositionIndependentLinkerFlags(
flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
+ this->LocalGenerator->AppendWarningAsErrorLinkerFlags(
+ flags, this->GeneratorTarget, linkLanguage);
this->LocalGenerator->AppendDependencyInfoLinkerFlags(
flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
}
@@ -209,7 +210,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
// -- Write the custom commands for this target
// Evaluates generator expressions and expands prop_value
- auto evaluatedFiles = [this](const std::string& prop_value) -> cmList {
+ auto evaluatedFiles = [this](std::string const& prop_value) -> cmList {
cmList files{ cmGeneratorExpression::Evaluate(
prop_value, this->LocalGenerator, this->GetConfigName(),
this->GeneratorTarget) };
@@ -264,12 +265,12 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->GetConfigName(), this->LocalGenerator);
this->GenerateCustomRuleFile(ccg);
if (clean) {
- const std::vector<std::string>& outputs = ccg.GetOutputs();
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
for (std::string const& output : outputs) {
this->CleanFiles.insert(
this->LocalGenerator->MaybeRelativeToCurBinDir(output));
}
- const std::vector<std::string>& byproducts = ccg.GetByproducts();
+ std::vector<std::string> const& byproducts = ccg.GetByproducts();
for (std::string const& byproduct : byproducts) {
this->CleanFiles.insert(
this->LocalGenerator->MaybeRelativeToCurBinDir(byproduct));
@@ -314,10 +315,10 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
cm::append(buildEventCommands,
this->GeneratorTarget->GetPostBuildCommands());
- for (const auto& be : buildEventCommands) {
+ for (auto const& be : buildEventCommands) {
cmCustomCommandGenerator beg(be, this->GetConfigName(),
this->LocalGenerator);
- const std::vector<std::string>& byproducts = beg.GetByproducts();
+ std::vector<std::string> const& byproducts = beg.GetByproducts();
for (std::string const& byproduct : byproducts) {
this->CleanFiles.insert(
this->LocalGenerator->MaybeRelativeToCurBinDir(byproduct));
@@ -412,7 +413,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
void cmMakefileTargetGenerator::WriteCommonCodeRules()
{
- const char* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
+ char const* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
? "$(CMAKE_BINARY_DIR)/"
: "");
@@ -574,7 +575,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
this->GeneratorTarget->GetAppleArchs(this->GetConfigName(), language);
architectures.emplace_back();
- for (const std::string& arch : architectures) {
+ for (std::string const& arch : architectures) {
std::string flags =
this->GetFlags(language, this->GetConfigName(), arch);
if (escapeOctothorpe) {
@@ -587,7 +588,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
}
void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
- cmSourceFile const& source, const char* pkgloc, const std::string& config)
+ cmSourceFile const& source, char const* pkgloc, std::string const& config)
{
// Skip OS X content when not building a Framework or Bundle.
if (!this->Generator->GetGeneratorTarget()->IsBundleOnApple()) {
@@ -633,7 +634,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
cmSourceFile const& source)
{
// Identify the language of the source file.
- const std::string& lang = source.GetLanguage();
+ std::string const& lang = source.GetLanguage();
if (lang.empty()) {
// don't know anything about this file so skip it
return;
@@ -683,9 +684,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// The object file should be checked for dependency integrity.
std::string objFullPath =
cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/', obj);
- objFullPath = cmSystemTools::CollapseFullPath(objFullPath);
- std::string const srcFullPath =
- cmSystemTools::CollapseFullPath(source.GetFullPath());
+ std::string const srcFullPath = source.GetFullPath();
this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang,
objFullPath, srcFullPath, scanner);
@@ -706,8 +705,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string filterArch;
std::unordered_map<std::string, std::string> pchSources;
- for (const std::string& arch : pchArchs) {
- const std::string pchSource =
+ for (std::string const& arch : pchArchs) {
+ std::string const pchSource =
this->GeneratorTarget->GetPchSource(config, lang, arch);
if (pchSource == source.GetFullPath()) {
filterArch = arch;
@@ -718,7 +717,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
if (!pchSources.empty() && !source.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- for (const std::string& arch : pchArchs) {
+ for (std::string const& arch : pchArchs) {
std::string const& pchHeader =
this->GeneratorTarget->GetPchHeader(config, lang, arch);
depends.push_back(pchHeader);
@@ -787,9 +786,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
// Add flags from source file properties.
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
if (cmValue cflags = source.GetProperty(COMPILE_FLAGS)) {
- const std::string& evaluatedFlags =
+ std::string const& evaluatedFlags =
genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS);
this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
*this->FlagFileStream << "# Custom flags: " << relativeObj
@@ -797,9 +796,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
<< "\n";
}
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
if (cmValue coptions = source.GetProperty(COMPILE_OPTIONS)) {
- const std::string& evaluatedOptions =
+ std::string const& evaluatedOptions =
genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS);
this->LocalGenerator->AppendCompileOptions(flags, evaluatedOptions);
*this->FlagFileStream << "# Custom options: " << relativeObj
@@ -819,7 +818,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
this->GeneratorTarget->GetPchUseCompileOptions(config, lang);
}
- const std::string& evaluatedFlags =
+ std::string const& evaluatedFlags =
genexInterpreter.Evaluate(pchOptions, COMPILE_OPTIONS);
this->LocalGenerator->AppendCompileOptions(flags, evaluatedFlags);
@@ -831,9 +830,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Add include directories from source file properties.
std::vector<std::string> includes;
- const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (cmValue cincludes = source.GetProperty(INCLUDE_DIRECTORIES)) {
- const std::string& evaluatedIncludes =
+ std::string const& evaluatedIncludes =
genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES);
this->LocalGenerator->AppendIncludeDirectories(includes, evaluatedIncludes,
source);
@@ -847,9 +846,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::set<std::string> defines;
// Add source-specific preprocessor definitions.
- const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (cmValue compile_defs = source.GetProperty(COMPILE_DEFINITIONS)) {
- const std::string& evaluatedDefs =
+ std::string const& evaluatedDefs =
genexInterpreter.Evaluate(*compile_defs, COMPILE_DEFINITIONS);
this->LocalGenerator->AppendDefines(defines, evaluatedDefs);
*this->FlagFileStream << "# Custom defines: " << relativeObj
@@ -859,7 +858,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string const defPropName =
cmStrCat("COMPILE_DEFINITIONS_", configUpper);
if (cmValue config_compile_defs = source.GetProperty(defPropName)) {
- const std::string& evaluatedDefs =
+ std::string const& evaluatedDefs =
genexInterpreter.Evaluate(*config_compile_defs, COMPILE_DEFINITIONS);
this->LocalGenerator->AppendDefines(defines, evaluatedDefs);
*this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES_"
@@ -932,6 +931,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(this->GeneratorTarget->GetType()).c_str();
+ vars.CMTargetLabels = this->GeneratorTarget->GetTargetLabelsString().c_str();
vars.Language = lang.c_str();
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
@@ -952,6 +952,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
vars.ObjectFileDir = objectFileDir.c_str();
vars.Flags = flags.c_str();
vars.ISPCHeader = ispcHeaderForShell.c_str();
+ vars.Config = this->GetConfigName().c_str();
std::string definesString = cmStrCat("$(", lang, "_DEFINES)");
@@ -1003,7 +1004,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
if (lang == "CUDA") {
if (this->GeneratorTarget->GetPropertyAsBool(
"CUDA_SEPARABLE_COMPILATION")) {
- const std::string& rdcFlag =
+ std::string const& rdcFlag =
this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG");
cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " ");
}
@@ -1016,7 +1017,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
auto propName = cmStrCat("CUDA_", mode, "_COMPILATION");
auto defName = cmStrCat("_CMAKE_CUDA_", mode, "_FLAG");
if (this->GeneratorTarget->GetPropertyAsBool(propName)) {
- const std::string& flag =
+ std::string const& flag =
this->Makefile->GetRequiredDefinition(defName);
cudaCompileMode = cmStrCat(cudaCompileMode, flag);
useNormalCompileMode = false;
@@ -1024,7 +1025,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
}
if (useNormalCompileMode) {
- const std::string& wholeFlag =
+ std::string const& wholeFlag =
this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG");
cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag);
}
@@ -1032,7 +1033,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
cmList compileCommands;
- const std::string& compileRule = this->Makefile->GetRequiredDefinition(
+ std::string const& compileRule = this->Makefile->GetRequiredDefinition(
"CMAKE_" + lang + "_COMPILE_OBJECT");
compileCommands.assign(compileRule);
@@ -1132,13 +1133,13 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
vars.Flags = flagsWithDeps.c_str();
- const auto& extraCommands = this->Makefile->GetSafeDefinition(
+ auto const& extraCommands = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_DEPENDS_EXTRA_COMMANDS"));
if (!extraCommands.empty()) {
compileCommands.append(extraCommands);
}
- const auto& depFormat = this->Makefile->GetRequiredDefinition(
+ auto const& depFormat = this->Makefile->GetRequiredDefinition(
cmStrCat("CMAKE_", lang, "_DEPFILE_FORMAT"));
if (depFormat == "msvc"_s) {
@@ -1151,7 +1152,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->GetCurrentBinaryDirectory(),
cmOutputConverter::SHELL));
- const auto& prefix = this->Makefile->GetSafeDefinition(
+ auto const& prefix = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_CL_SHOWINCLUDES_PREFIX"));
depFilter += cmStrCat(" --filter-prefix=",
this->LocalGenerator->ConvertToOutputFormat(
@@ -1333,10 +1334,10 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
}
bool cmMakefileTargetGenerator::WriteMakeRule(
- std::ostream& os, const char* comment,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands, bool in_help)
+ std::ostream& os, char const* comment,
+ std::vector<std::string> const& outputs,
+ std::vector<std::string> const& depends,
+ std::vector<std::string> const& commands, bool in_help)
{
bool symbolic = false;
if (outputs.empty()) {
@@ -1499,11 +1500,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< this->GeneratorTarget->GetFortranModuleDirectory(working_dir)
<< "\")\n";
- if (this->GeneratorTarget->IsFortranBuildingInstrinsicModules()) {
+ if (this->GeneratorTarget->IsFortranBuildingIntrinsicModules()) {
*this->InfoFileStream
<< "\n"
<< "# Fortran compiler is building intrinsic modules.\n"
- << "set(CMAKE_Fortran_TARGET_BUILDING_INSTRINSIC_MODULES ON) \n";
+ << "set(CMAKE_Fortran_TARGET_BUILDING_INTRINSIC_MODULES ON) \n";
}
/* clang-format on */
@@ -1560,8 +1561,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
cmOutputConverter::SHELL)
<< " "
<< this->LocalGenerator->ConvertToOutputFormat(
- cmSystemTools::CollapseFullPath(this->InfoFileNameFull),
- cmOutputConverter::SHELL);
+ this->InfoFileNameFull, cmOutputConverter::SHELL);
if (this->LocalGenerator->GetColorMakefile()) {
depCmd << " \"--color=$(COLOR)\"";
}
@@ -1596,7 +1596,7 @@ void cmMakefileTargetGenerator::WriteObjectDependRules(
}
void cmMakefileTargetGenerator::WriteDeviceLinkRule(
- std::vector<std::string>& commands, const std::string& output)
+ std::vector<std::string>& commands, std::string const& output)
{
std::string architecturesStr =
this->GeneratorTarget->GetSafeProperty("CUDA_ARCHITECTURES");
@@ -1613,7 +1613,7 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
std::string const& relPath = localGen->GetHomeRelativeOutputPath();
// Ensure there are no duplicates.
- const std::vector<std::string> linkDeps = [&]() -> std::vector<std::string> {
+ std::vector<std::string> const linkDeps = [&]() -> std::vector<std::string> {
std::vector<std::string> deps;
this->AppendTargetDepends(deps, true);
this->GeneratorTarget->GetLinkDepends(deps, this->GetConfigName(), "CUDA");
@@ -1628,8 +1628,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
return deps;
}();
- const std::string objectDir = this->GeneratorTarget->ObjectDirectory;
- const std::string relObjectDir =
+ std::string const objectDir = this->GeneratorTarget->ObjectDirectory;
+ std::string const relObjectDir =
localGen->MaybeRelativeToCurBinDir(objectDir);
// Construct a list of files associated with this executable that
@@ -1643,7 +1643,7 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
cmStrCat(objectDir, "cmake_cuda_register.h");
// Link device code for each architecture.
- for (const std::string& architectureKind : architectures) {
+ for (std::string const& architectureKind : architectures) {
std::string registerFileCmd;
// The generated register file contains macros that when expanded
@@ -1659,9 +1659,9 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
}
// Clang always generates real code, so strip the specifier.
- const std::string architecture =
+ std::string const architecture =
architectureKind.substr(0, architectureKind.find('-'));
- const std::string cubin =
+ std::string const cubin =
cmStrCat(objectDir, "sm_", architecture, ".cubin");
profiles += cmStrCat(" -im=profile=sm_", architecture, ",file=", cubin);
@@ -1677,14 +1677,14 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
}
// Combine all architectures into a single fatbinary.
- const std::string fatbinaryCommand =
+ std::string const fatbinaryCommand =
cmStrCat(this->Makefile->GetRequiredDefinition("CMAKE_CUDA_FATBINARY"),
" -64 -cmdline=--compile-only -compress-all -link "
"--embedded-fatbin=$@",
profiles);
- const std::string fatbinaryOutput =
+ std::string const fatbinaryOutput =
cmStrCat(objectDir, "cmake_cuda_fatbin.h");
- const std::string fatbinaryOutputRel =
+ std::string const fatbinaryOutputRel =
cmStrCat(relPath, relObjectDir, "cmake_cuda_fatbin.h");
localGen->WriteMakeRule(*this->BuildFileStream, nullptr, fatbinaryOutputRel,
@@ -1696,11 +1696,12 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()).c_str();
-
+ vars.CMTargetLabels = this->GeneratorTarget->GetTargetLabelsString().c_str();
vars.Language = "CUDA";
vars.Object = output.c_str();
vars.Fatbinary = fatbinaryOutput.c_str();
vars.RegisterFile = registerFile.c_str();
+ vars.Config = this->GetConfigName().c_str();
std::string linkFlags;
this->GetDeviceLinkFlags(linkFlags, "CUDA");
@@ -1710,7 +1711,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
vars.Flags = flags.c_str();
std::string compileCmd = this->GetLinkRule("CMAKE_CUDA_DEVICE_LINK_COMPILE");
- auto rulePlaceholderExpander = localGen->CreateRulePlaceholderExpander();
+ auto rulePlaceholderExpander = localGen->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GetGeneratorTarget(), "CUDA");
rulePlaceholderExpander->ExpandRuleVariables(localGen, compileCmd, vars);
commands.emplace_back(compileCmd);
@@ -1758,7 +1760,7 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
}
// Write the rule.
- const std::vector<std::string>& outputs = ccg.GetOutputs();
+ std::vector<std::string> const& outputs = ccg.GetOutputs();
bool const symbolic = this->WriteMakeRule(*this->BuildFileStream, nullptr,
outputs, depends, commands);
@@ -1826,7 +1828,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
*this->BuildFileStream << "# Object files for target "
<< this->GeneratorTarget->GetName() << "\n"
<< variableName << " =";
- const auto& lineContinue = this->GlobalGenerator->LineContinueDirective;
+ auto const& lineContinue = this->GlobalGenerator->LineContinueDirective;
cmValue pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
@@ -1911,7 +1913,7 @@ private:
std::string::size_type LengthLimit;
std::string CurrentString;
std::string NextObject;
- const char* Space;
+ char const* Space;
};
void cmMakefileTargetGenerator::WriteObjectsStrings(
@@ -1941,7 +1943,7 @@ void cmMakefileTargetGenerator::WriteObjectsStrings(
}
void cmMakefileTargetGenerator::WriteTargetDriverRule(
- const std::string& main_output, bool relink)
+ std::string const& main_output, bool relink)
{
// Compute the name of the driver target.
std::string dir =
@@ -1954,7 +1956,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
// Build the list of target outputs to drive.
std::vector<std::string> depends{ main_output };
- const char* comment = nullptr;
+ char const* comment = nullptr;
if (relink) {
// Setup the comment for the preinstall driver.
comment = "Rule to relink during preinstall.";
@@ -1987,7 +1989,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
return;
}
- const std::string& cfg = this->GetConfigName();
+ std::string const& cfg = this->GetConfigName();
if (this->GeneratorTarget->HasLinkDependencyFile(cfg)) {
depends.push_back(
@@ -2021,7 +2023,7 @@ void cmMakefileTargetGenerator::AppendObjectDepends(
}
void cmMakefileTargetGenerator::AppendLinkDepends(
- std::vector<std::string>& depends, const std::string& linkLanguage)
+ std::vector<std::string>& depends, std::string const& linkLanguage)
{
this->AppendObjectDepends(depends);
@@ -2050,7 +2052,7 @@ void cmMakefileTargetGenerator::AppendLinkDepends(
}
std::string cmMakefileTargetGenerator::GetLinkRule(
- const std::string& linkRuleVar)
+ std::string const& linkRuleVar)
{
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
if (this->GeneratorTarget->HasImplibGNUtoMS(this->GetConfigName())) {
@@ -2073,7 +2075,7 @@ void cmMakefileTargetGenerator::CloseFileStreams()
}
void cmMakefileTargetGenerator::CreateLinkScript(
- const char* name, std::vector<std::string> const& link_commands,
+ char const* name, std::vector<std::string> const& link_commands,
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends)
{
@@ -2157,7 +2159,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
}
std::string cmMakefileTargetGenerator::CreateResponseFile(
- const std::string& name, std::string const& options,
+ std::string const& name, std::string const& options,
std::vector<std::string>& makefile_depends, std::string const& language)
{
// FIXME: Find a better way to determine the response file encoding,
@@ -2258,26 +2260,22 @@ void cmMakefileTargetGenerator::CreateObjectLists(
std::string const responseFlag = this->GetResponseFlag(responseMode);
// Write a response file for each string.
- const char* sep = "";
+ char const* sep = "";
for (unsigned int i = 0; i < object_strings.size(); ++i) {
// Number the response files.
- std::string responseFileName =
- (responseMode == Link) ? "objects" : "deviceObjects";
- responseFileName += std::to_string(i + 1);
- responseFileName += ".rsp";
+ std::string responseFileName = cmStrCat(
+ (responseMode == Link) ? "objects" : "deviceObjects", i + 1, ".rsp");
// Create this response file.
std::string objects_rsp = this->CreateResponseFile(
responseFileName, object_strings[i], makefile_depends, linkLanguage);
- // Separate from previous response file references.
- buildObjs += sep;
+ buildObjs +=
+ cmStrCat(sep, // Separate from previous response file references.
+ responseFlag, // Reference the response file.
+ this->LocalGenerator->ConvertToOutputFormat(
+ objects_rsp, cmOutputConverter::SHELL));
sep = " ";
-
- // Reference the response file.
- buildObjs += responseFlag;
- buildObjs += this->LocalGenerator->ConvertToOutputFormat(
- objects_rsp, cmOutputConverter::SHELL);
}
} else if (useLinkScript) {
if (!useArchiveRules) {
@@ -2292,8 +2290,8 @@ void cmMakefileTargetGenerator::CreateObjectLists(
}
void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
- const std::string& lang,
- const std::string& /*config*/)
+ std::string const& lang,
+ std::string const& /*config*/)
{
std::string const responseVar =
cmStrCat("CMAKE_", lang, "_USE_RESPONSE_FILE_FOR_INCLUDES");
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 08d6945..fe255f4 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,10 +33,10 @@ class cmMakefileTargetGenerator : public cmCommonTargetGenerator
public:
// constructor to set the ivars
cmMakefileTargetGenerator(cmGeneratorTarget* target);
- cmMakefileTargetGenerator(const cmMakefileTargetGenerator&) = delete;
+ cmMakefileTargetGenerator(cmMakefileTargetGenerator const&) = delete;
~cmMakefileTargetGenerator() override;
- cmMakefileTargetGenerator& operator=(const cmMakefileTargetGenerator&) =
+ cmMakefileTargetGenerator& operator=(cmMakefileTargetGenerator const&) =
delete;
// construct using this factory call
@@ -56,12 +56,12 @@ public:
cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; }
- std::string GetConfigName() const;
+ std::string const& GetConfigName() const;
protected:
void GetDeviceLinkFlags(std::string& linkFlags,
- const std::string& linkLanguage);
- void GetTargetLinkFlags(std::string& flags, const std::string& linkLanguage);
+ std::string const& linkLanguage);
+ void GetTargetLinkFlags(std::string& flags, std::string const& linkLanguage);
// create the file and directory etc
void CreateRuleFile();
@@ -95,8 +95,8 @@ protected:
{
}
- void operator()(cmSourceFile const& source, const char* pkgloc,
- const std::string& config) override;
+ void operator()(cmSourceFile const& source, char const* pkgloc,
+ std::string const& config) override;
private:
cmMakefileTargetGenerator* Generator;
@@ -112,14 +112,14 @@ protected:
// CUDA device linking.
void WriteDeviceLinkRule(std::vector<std::string>& commands,
- const std::string& output);
+ std::string const& output);
// write the build rule for a custom command
void GenerateCustomRuleFile(cmCustomCommandGenerator const& ccg);
// write a rule to drive building of more than one output from
// another rule
- void GenerateExtraOutput(const char* out, const char* in,
+ void GenerateExtraOutput(char const* out, char const* in,
bool symbolic = false);
void MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress&) const;
@@ -133,7 +133,7 @@ protected:
std::string::size_type limit = std::string::npos);
// write the driver rule to build target outputs
- void WriteTargetDriverRule(const std::string& main_output, bool relink);
+ void WriteTargetDriverRule(std::string const& main_output, bool relink);
void DriveCustomCommands(std::vector<std::string>& depends);
@@ -146,14 +146,14 @@ protected:
// Append link rule dependencies (objects, etc.).
void AppendLinkDepends(std::vector<std::string>& depends,
- const std::string& linkLanguage);
+ std::string const& linkLanguage);
// Lookup the link rule for this target.
- std::string GetLinkRule(const std::string& linkRuleVar);
+ std::string GetLinkRule(std::string const& linkRuleVar);
/** Create a script to hold link rules and a command to invoke the
script at build time. */
- void CreateLinkScript(const char* name,
+ void CreateLinkScript(char const* name,
std::vector<std::string> const& link_commands,
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends);
@@ -164,7 +164,7 @@ protected:
/** Create a response file with the given set of options. Returns
the relative path from the target build working directory to the
response file name. */
- std::string CreateResponseFile(const std::string& name,
+ std::string CreateResponseFile(std::string const& name,
std::string const& options,
std::vector<std::string>& makefile_depends,
std::string const& language);
@@ -195,8 +195,8 @@ protected:
/** Add commands for generate def files */
void GenDefFile(std::vector<std::string>& real_link_commands);
- void AddIncludeFlags(std::string& flags, const std::string& lang,
- const std::string& config) override;
+ void AddIncludeFlags(std::string& flags, std::string const& lang,
+ std::string const& config) override;
/** Return the response flag for the given configuration */
std::string GetResponseFlag(ResponseFlagFor mode) const;
@@ -261,10 +261,10 @@ protected:
using MultipleOutputPairsType = std::map<std::string, std::string>;
MultipleOutputPairsType MultipleOutputPairs;
- bool WriteMakeRule(std::ostream& os, const char* comment,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands,
+ bool WriteMakeRule(std::ostream& os, char const* comment,
+ std::vector<std::string> const& outputs,
+ std::vector<std::string> const& depends,
+ std::vector<std::string> const& commands,
bool in_help = false);
// Target name info.
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 7f854ee..3a5bdc5 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMakefileUtilityTargetGenerator.h"
#include <ostream>
@@ -37,7 +37,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
*this->BuildFileStream << "# Utility rule file for "
<< this->GeneratorTarget->GetName() << ".\n\n";
- const char* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
+ char const* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
? "$(CMAKE_BINARY_DIR)/"
: "");
@@ -55,8 +55,9 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
cmGeneratedFileStream depFileStream(
dependFile, false, this->GlobalGenerator->GetMakefileEncoding());
depFileStream << "# Empty custom commands generated dependencies file for "
- << this->GeneratorTarget->GetName() << ".\n"
- << "# This may be replaced when dependencies are built.\n";
+ << this->GeneratorTarget->GetName()
+ << ".\n"
+ "# This may be replaced when dependencies are built.\n";
}
std::string dependTimestamp =
@@ -66,7 +67,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
cmGeneratedFileStream depFileStream(
dependTimestamp, false, this->GlobalGenerator->GetMakefileEncoding());
depFileStream << "# CMAKE generated file: DO NOT EDIT!\n"
- << "# Timestamp file for custom commands dependencies "
+ "# Timestamp file for custom commands dependencies "
"management for "
<< this->GeneratorTarget->GetName() << ".\n";
}
diff --git a/Source/cmMakefileUtilityTargetGenerator.h b/Source/cmMakefileUtilityTargetGenerator.h
index d2b4ba5..5c1df5d 100644
--- a/Source/cmMakefileUtilityTargetGenerator.h
+++ b/Source/cmMakefileUtilityTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 87421f5..963076b 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMarkAsAdvancedCommand.h"
#include "cmExecutionStatus.h"
@@ -23,7 +23,7 @@ bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args,
}
unsigned int i = 0;
- const char* value = "1";
+ char const* value = "1";
bool overwrite = false;
if (args[0] == "CLEAR" || args[0] == "FORCE") {
overwrite = true;
@@ -54,8 +54,6 @@ bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args,
oldBehavior = true;
break;
case cmPolicies::NEW:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
if (!state->GetCacheEntryValue(variable)) {
ignoreVariable = true;
}
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index e420e64..c58459a 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index 1c0ff13..85c5281 100644
--- a/Source/cmMathCommand.cxx
+++ b/Source/cmMathCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMathCommand.h"
#include <cstdio>
@@ -23,7 +23,7 @@ bool cmMathCommand(std::vector<std::string> const& args,
status.SetError("must be called with at least one argument.");
return false;
}
- const std::string& subCommand = args[0];
+ std::string const& subCommand = args[0];
if (subCommand == "EXPR") {
return HandleExprCommand(args, status);
}
@@ -48,15 +48,15 @@ bool HandleExprCommand(std::vector<std::string> const& args,
HEXADECIMAL,
};
- const std::string& outputVariable = args[1];
- const std::string& expression = args[2];
+ std::string const& outputVariable = args[1];
+ std::string const& expression = args[2];
size_t argumentIndex = 3;
NumericFormat outputFormat = NumericFormat::UNINITIALIZED;
status.GetMakefile().AddDefinition(outputVariable, "ERROR");
if (argumentIndex < args.size()) {
- const std::string messageHint = "sub-command EXPR ";
+ std::string const messageHint = "sub-command EXPR ";
std::string const& option = args[argumentIndex++];
if (option == "OUTPUT_FORMAT") {
if (argumentIndex < args.size()) {
@@ -96,7 +96,7 @@ bool HandleExprCommand(std::vector<std::string> const& args,
}
char buffer[1024];
- const char* fmt;
+ char const* fmt;
switch (outputFormat) {
case NumericFormat::HEXADECIMAL:
fmt = "0x%" KWIML_INT_PRIx64;
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index e6b347b..8a4cf0b 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index a4b2538..34092b3 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMessageCommand.h"
#include <cassert>
@@ -26,20 +26,12 @@
namespace {
-enum class CheckingType
-{
- UNDEFINED,
- CHECK_START,
- CHECK_PASS,
- CHECK_FAIL
-};
-
std::string IndentText(std::string text, cmMakefile& mf)
{
auto indent =
cmList{ mf.GetSafeDefinition("CMAKE_MESSAGE_INDENT") }.join("");
- const auto showContext = mf.GetCMakeInstance()->GetShowLogContext() ||
+ auto const showContext = mf.GetCMakeInstance()->GetShowLogContext() ||
mf.IsOn("CMAKE_MESSAGE_CONTEXT_SHOW");
if (showContext) {
auto context =
@@ -77,7 +69,7 @@ void WriteMessageEvent(cmConfigureLog& log, cmMakefile const& mf,
std::string const& message)
{
// Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
- static const std::vector<unsigned long> LogVersionsWithMessageV1{ 1 };
+ static std::vector<unsigned long> const LogVersionsWithMessageV1{ 1 };
if (log.IsAnyLogVersionEnabled(LogVersionsWithMessageV1)) {
log.BeginEvent("message-v1", mf);
@@ -106,7 +98,7 @@ bool cmMessageCommand(std::vector<std::string> const& args,
auto type = MessageType::MESSAGE;
auto fatal = false;
auto level = Message::LogLevel::LOG_UNDEFINED;
- auto checkingType = CheckingType::UNDEFINED;
+ auto checkingType = Message::CheckType::UNDEFINED;
if (*i == "SEND_ERROR") {
type = MessageType::FATAL_ERROR;
level = Message::LogLevel::LOG_ERROR;
@@ -135,15 +127,15 @@ bool cmMessageCommand(std::vector<std::string> const& args,
++i;
} else if (*i == "CHECK_START") {
level = Message::LogLevel::LOG_STATUS;
- checkingType = CheckingType::CHECK_START;
+ checkingType = Message::CheckType::CHECK_START;
++i;
} else if (*i == "CHECK_PASS") {
level = Message::LogLevel::LOG_STATUS;
- checkingType = CheckingType::CHECK_PASS;
+ checkingType = Message::CheckType::CHECK_PASS;
++i;
} else if (*i == "CHECK_FAIL") {
level = Message::LogLevel::LOG_STATUS;
- checkingType = CheckingType::CHECK_FAIL;
+ checkingType = Message::CheckType::CHECK_FAIL;
++i;
} else if (*i == "CONFIGURE_LOG") {
#ifndef CMAKE_BOOTSTRAP
@@ -217,16 +209,16 @@ bool cmMessageCommand(std::vector<std::string> const& args,
case Message::LogLevel::LOG_STATUS:
switch (checkingType) {
- case CheckingType::CHECK_START:
+ case Message::CheckType::CHECK_START:
mf.DisplayStatus(IndentText(message, mf), -1);
mf.GetCMakeInstance()->PushCheckInProgressMessage(message);
break;
- case CheckingType::CHECK_PASS:
+ case Message::CheckType::CHECK_PASS:
ReportCheckResult("CHECK_PASS"_s, message, mf);
break;
- case CheckingType::CHECK_FAIL:
+ case Message::CheckType::CHECK_FAIL:
ReportCheckResult("CHECK_FAIL"_s, message, mf);
break;
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index c37098c..9c42ddb 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmMessageMetadata.h b/Source/cmMessageMetadata.h
index 7b56fae..51f6ae2 100644
--- a/Source/cmMessageMetadata.h
+++ b/Source/cmMessageMetadata.h
@@ -1,11 +1,11 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmsys/Terminal.h"
struct cmMessageMetadata
{
- const char* title = nullptr;
+ char const* title = nullptr;
int desiredColor = cmsysTerminal_Color_Normal;
};
diff --git a/Source/cmMessageType.h b/Source/cmMessageType.h
index decb4b3..a7b5b07 100644
--- a/Source/cmMessageType.h
+++ b/Source/cmMessageType.h
@@ -1,11 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
enum class MessageType
{
+ UNDEFINED,
AUTHOR_WARNING,
AUTHOR_ERROR,
FATAL_ERROR,
@@ -31,4 +32,13 @@ enum class LogLevel
LOG_DEBUG,
LOG_TRACE
};
+
+enum class CheckType
+{
+ UNDEFINED,
+ CHECK_START,
+ CHECK_PASS,
+ CHECK_FAIL
+};
+
}
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index 01ff7f0..b8055a2 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmMessenger.h"
#include "cmDocumentationFormatter.h"
@@ -10,6 +10,8 @@
#if !defined(CMAKE_BOOTSTRAP)
# include "cmsys/SystemInformation.hxx"
+
+# include "cmSarifLog.h"
#endif
#include <sstream>
@@ -22,7 +24,7 @@
#endif
namespace {
-const char* getMessageTypeStr(MessageType t)
+char const* getMessageTypeStr(MessageType t)
{
switch (t) {
case MessageType::FATAL_ERROR:
@@ -102,11 +104,10 @@ void displayMessage(MessageType t, std::ostringstream& msg)
t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) {
cmSystemTools::SetErrorOccurred();
md.title = "Error";
- cmSystemTools::Message(msg.str(), md);
} else {
md.title = "Warning";
- cmSystemTools::Message(msg.str(), md);
}
+ cmSystemTools::Message(msg.str(), md);
}
void PrintCallStack(std::ostream& out, cmListFileBacktrace bt,
@@ -117,6 +118,7 @@ void PrintCallStack(std::ostream& out, cmListFileBacktrace bt,
if (bt.Empty()) {
return;
}
+ std::string lastFilePath = bt.Top().FilePath;
bt = bt.Pop();
if (bt.Empty()) {
return;
@@ -126,15 +128,19 @@ void PrintCallStack(std::ostream& out, cmListFileBacktrace bt,
for (; !bt.Empty(); bt = bt.Pop()) {
cmListFileContext lfc = bt.Top();
if (lfc.Name.empty() &&
- lfc.Line != cmListFileContext::DeferPlaceholderLine) {
- // Skip this whole-file scope. When we get here we already will
- // have printed a more-specific context within the file.
+ lfc.Line != cmListFileContext::DeferPlaceholderLine &&
+ lfc.FilePath == lastFilePath) {
+ // An entry with no function name is frequently preceded (in the stack)
+ // by a more specific entry. When this happens (as verified by the
+ // preceding entry referencing the same file path), skip the less
+ // specific entry, as we have already printed the more specific one.
continue;
}
if (first) {
first = false;
out << "Call Stack (most recent call first):\n";
}
+ lastFilePath = lfc.FilePath;
if (topSource) {
lfc.FilePath = cmSystemTools::RelativeIfUnder(*topSource, lfc.FilePath);
}
@@ -180,8 +186,8 @@ bool cmMessenger::IsMessageTypeVisible(MessageType t) const
return true;
}
-void cmMessenger::IssueMessage(MessageType t, const std::string& text,
- const cmListFileBacktrace& backtrace) const
+void cmMessenger::IssueMessage(MessageType t, std::string const& text,
+ cmListFileBacktrace const& backtrace) const
{
bool force = false;
// override the message type, if needed, for warnings and errors
@@ -196,8 +202,8 @@ void cmMessenger::IssueMessage(MessageType t, const std::string& text,
}
}
-void cmMessenger::DisplayMessage(MessageType t, const std::string& text,
- const cmListFileBacktrace& backtrace) const
+void cmMessenger::DisplayMessage(MessageType t, std::string const& text,
+ cmListFileBacktrace const& backtrace) const
{
std::ostringstream msg;
@@ -214,6 +220,11 @@ void cmMessenger::DisplayMessage(MessageType t, const std::string& text,
displayMessage(t, msg);
+#ifndef CMAKE_BOOTSTRAP
+ // Add message to SARIF logs
+ this->SarifLog.LogMessage(t, text, backtrace);
+#endif
+
#ifdef CMake_ENABLE_DEBUGGER
if (DebuggerAdapter) {
DebuggerAdapter->OnMessageOutput(t, msg.str());
diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h
index d9462d4..ad04b77 100644
--- a/Source/cmMessenger.h
+++ b/Source/cmMessenger.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,6 +13,10 @@
#include "cmListFileCache.h"
#include "cmMessageType.h" // IWYU pragma: keep
+#ifndef CMAKE_BOOTSTRAP
+# include "cmSarifLog.h"
+#endif
+
#ifdef CMake_ENABLE_DEBUGGER
namespace cmDebugger {
class cmDebuggerAdapter;
@@ -59,6 +63,10 @@ public:
return this->DeprecatedWarningsAsErrors;
}
+#ifndef CMAKE_BOOTSTRAP
+ cmSarif::ResultsLog const& GetSarifResultsLog() const { return SarifLog; }
+#endif
+
// Print the top of a backtrace.
void PrintBacktraceTitle(std::ostream& out,
cmListFileBacktrace const& bt) const;
@@ -76,6 +84,10 @@ private:
cm::optional<std::string> TopSource;
+#ifndef CMAKE_BOOTSTRAP
+ cmSarif::ResultsLog SarifLog;
+#endif
+
bool SuppressDevWarnings = false;
bool SuppressDeprecatedWarnings = false;
bool DevWarningsAsErrors = false;
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
index 28baeb6..c693d47 100644
--- a/Source/cmNewLineStyle.cxx
+++ b/Source/cmNewLineStyle.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmNewLineStyle.h"
#include <cstddef>
@@ -11,7 +11,7 @@ bool cmNewLineStyle::IsValid() const
return this->NewLineStyle != Invalid;
}
-bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
+bool cmNewLineStyle::ReadFromArguments(std::vector<std::string> const& args,
std::string& errorString)
{
this->NewLineStyle = Invalid;
diff --git a/Source/cmNewLineStyle.h b/Source/cmNewLineStyle.h
index a2b985b..305a797 100644
--- a/Source/cmNewLineStyle.h
+++ b/Source/cmNewLineStyle.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,7 +26,7 @@ public:
bool IsValid() const;
- bool ReadFromArguments(const std::vector<std::string>& args,
+ bool ReadFromArguments(std::vector<std::string> const& args,
std::string& errorString);
std::string GetCharacters() const;
diff --git a/Source/cmNinjaLinkLineComputer.cxx b/Source/cmNinjaLinkLineComputer.cxx
index 2304ad2..45ddc30 100644
--- a/Source/cmNinjaLinkLineComputer.cxx
+++ b/Source/cmNinjaLinkLineComputer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmNinjaLinkLineComputer.h"
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index 5d22f3e..b58e421 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmNinjaLinkLineDeviceComputer.cxx b/Source/cmNinjaLinkLineDeviceComputer.cxx
index f66e2f5..ad186eb 100644
--- a/Source/cmNinjaLinkLineDeviceComputer.cxx
+++ b/Source/cmNinjaLinkLineDeviceComputer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmNinjaLinkLineDeviceComputer.h"
diff --git a/Source/cmNinjaLinkLineDeviceComputer.h b/Source/cmNinjaLinkLineDeviceComputer.h
index 457f036..e206969 100644
--- a/Source/cmNinjaLinkLineDeviceComputer.h
+++ b/Source/cmNinjaLinkLineDeviceComputer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 6535371..99c0761 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmNinjaNormalTargetGenerator.h"
#include <algorithm>
@@ -18,6 +18,7 @@
#include "cmCustomCommand.h" // IWYU pragma: keep
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
#include "cmLinkLineComputer.h"
@@ -60,7 +61,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() = default;
-void cmNinjaNormalTargetGenerator::Generate(const std::string& config)
+void cmNinjaNormalTargetGenerator::Generate(std::string const& config)
{
if (this->GetGeneratorTarget()->GetType() !=
cmStateEnums::INTERFACE_LIBRARY) {
@@ -143,7 +144,7 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config)
}
void cmNinjaNormalTargetGenerator::WriteLanguagesRules(
- const std::string& config)
+ std::string const& config)
{
#ifdef NINJA_GEN_VERBOSE_FILES
cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream());
@@ -178,7 +179,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules(
}
}
-const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
+char const* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
{
switch (this->GetGeneratorTarget()->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
@@ -199,7 +200,7 @@ const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
}
std::string cmNinjaNormalTargetGenerator::LanguageLinkerRule(
- const std::string& config) const
+ std::string const& config) const
{
return cmStrCat(
this->TargetLinkLanguage(config), "_",
@@ -211,7 +212,7 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerRule(
}
std::string cmNinjaNormalTargetGenerator::LanguageLinkerDeviceRule(
- const std::string& config) const
+ std::string const& config) const
{
return cmStrCat(
this->TargetLinkLanguage(config), "_",
@@ -223,7 +224,7 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerDeviceRule(
}
std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaDeviceRule(
- const std::string& config) const
+ std::string const& config) const
{
return cmStrCat(
this->TargetLinkLanguage(config), "_DEVICE_LINK__",
@@ -232,7 +233,7 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaDeviceRule(
}
std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaDeviceCompileRule(
- const std::string& config) const
+ std::string const& config) const
{
return cmStrCat(
this->TargetLinkLanguage(config), "_DEVICE_LINK_COMPILE__",
@@ -241,7 +242,7 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaDeviceCompileRule(
}
std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaFatbinaryRule(
- const std::string& config) const
+ std::string const& config) const
{
return cmStrCat(
this->TargetLinkLanguage(config), "_FATBINARY__",
@@ -250,7 +251,7 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerCudaFatbinaryRule(
}
std::string cmNinjaNormalTargetGenerator::TextStubsGeneratorRule(
- const std::string& config) const
+ std::string const& config) const
{
return cmStrCat(
"TEXT_STUBS_GENERATOR__",
@@ -259,7 +260,7 @@ std::string cmNinjaNormalTargetGenerator::TextStubsGeneratorRule(
}
bool cmNinjaNormalTargetGenerator::CheckUseResponseFileForLibraries(
- const std::string& l) const
+ std::string const& l) const
{
// Check for an explicit setting one way or the other.
std::string const responseVar =
@@ -283,7 +284,7 @@ struct cmNinjaRemoveNoOpCommands
};
void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
- bool useResponseFile, const std::string& config)
+ bool useResponseFile, std::string const& config)
{
cmNinjaRule rule(this->LanguageLinkerDeviceRule(config));
if (!this->GetGlobalGenerator()->HasRule(rule.Name)) {
@@ -292,6 +293,8 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
vars.CMTargetType =
cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
.c_str();
+ vars.CMTargetLabels =
+ this->GetGeneratorTarget()->GetTargetLabelsString().c_str();
vars.Language = "CUDA";
std::string linker =
@@ -339,6 +342,7 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
vars.Flags = "$FLAGS";
vars.LinkFlags = "$LINK_FLAGS";
vars.Manifests = "$MANIFESTS";
+ vars.Config = "$CONFIG";
vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS";
@@ -350,7 +354,9 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
}
auto rulePlaceholderExpander =
- this->GetLocalGenerator()->CreateRulePlaceholderExpander();
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GetGeneratorTarget(),
+ this->TargetLinkLanguage(config));
// Rule for linking library/executable.
std::vector<std::string> linkCmds = this->ComputeDeviceLinkCmd();
@@ -380,9 +386,9 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
}
void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
- const std::string& config)
+ std::string const& config)
{
- const cmMakefile* mf = this->GetMakefile();
+ cmMakefile const* mf = this->GetMakefile();
cmNinjaRule rule(this->LanguageLinkerCudaDeviceRule(config));
rule.Command = this->GetLocalGenerator()->BuildCommandLine(
@@ -397,6 +403,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()).c_str();
+ vars.CMTargetLabels =
+ this->GetGeneratorTarget()->GetTargetLabelsString().c_str();
vars.Language = "CUDA";
vars.Object = "$out";
@@ -409,11 +417,14 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
std::string flags = this->GetFlags("CUDA", config);
vars.Flags = flags.c_str();
+ vars.Config = "$CONFIG";
std::string compileCmd = this->GetMakefile()->GetRequiredDefinition(
"CMAKE_CUDA_DEVICE_LINK_COMPILE");
auto rulePlaceholderExpander =
- this->GetLocalGenerator()->CreateRulePlaceholderExpander();
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GetGeneratorTarget(),
+ this->TargetLinkLanguage(config));
rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
compileCmd, vars);
@@ -436,7 +447,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
}
void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
- const std::string& config)
+ std::string const& config)
{
cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
@@ -446,6 +457,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
cmRulePlaceholderExpander::RuleVariables vars;
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
vars.CMTargetType = cmState::GetTargetTypeName(targetType).c_str();
+ vars.CMTargetLabels =
+ this->GetGeneratorTarget()->GetTargetLabelsString().c_str();
std::string linker = this->GetGeneratorTarget()->GetLinkerTool(config);
vars.Linker = linker.c_str();
@@ -546,6 +559,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
vars.Flags = "$FLAGS";
vars.LinkFlags = "$LINK_FLAGS";
vars.Manifests = "$MANIFESTS";
+ vars.Config = "$CONFIG";
std::string langFlags;
if (targetType != cmStateEnums::EXECUTABLE) {
@@ -566,7 +580,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
}
auto rulePlaceholderExpander =
- this->GetLocalGenerator()->CreateRulePlaceholderExpander();
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander(
+ cmBuildStep::Link, this->GetGeneratorTarget(),
+ this->TargetLinkLanguage(config));
// Rule for linking library/executable.
std::vector<std::string> linkCmds = this->ComputeLinkCmd(config);
@@ -694,7 +710,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
}
std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
- const std::string& config)
+ std::string const& config)
{
cmList linkCmds;
cmMakefile* mf = this->GetMakefile();
@@ -772,7 +788,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
// file modification time. If the archive and at least one contained
// object file were created within the same second this will make look
// the archive older than the object file. On subsequent ninja runs this
- // leads to re-achiving and updating dependent targets.
+ // leads to re-archiving and updating dependent targets.
// As a work-around we touch the archive after ranlib (see #19222).
{
std::string cmakeCommand =
@@ -793,7 +809,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
}
void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
- const std::string& config, const std::string& fileConfig,
+ std::string const& config, std::string const& fileConfig,
bool firstForConfig)
{
cmGlobalNinjaGenerator* globalGen = this->GetGlobalGenerator();
@@ -855,15 +871,15 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
}
void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatements(
- const std::string& config, const std::vector<std::string>& architectures,
- const std::string& output)
+ std::string const& config, std::vector<std::string> const& architectures,
+ std::string const& output)
{
// Ensure there are no duplicates.
- const cmNinjaDeps explicitDeps = [&]() -> std::vector<std::string> {
+ cmNinjaDeps const explicitDeps = [&]() -> std::vector<std::string> {
std::unordered_set<std::string> depsSet;
- const cmNinjaDeps linkDeps =
+ cmNinjaDeps const linkDeps =
this->ComputeLinkDeps(this->TargetLinkLanguage(config), config, true);
- const cmNinjaDeps objects = this->GetObjects(config);
+ cmNinjaDeps const objects = this->GetObjects(config);
depsSet.insert(linkDeps.begin(), linkDeps.end());
depsSet.insert(objects.begin(), objects.end());
@@ -873,19 +889,19 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatements(
}();
cmGlobalNinjaGenerator* globalGen{ this->GetGlobalGenerator() };
- const std::string objectDir =
+ std::string const objectDir =
cmStrCat(this->GeneratorTarget->GetSupportDirectory(),
globalGen->ConfigDirectory(config));
- const std::string ninjaOutputDir = this->ConvertToNinjaPath(objectDir);
+ std::string const ninjaOutputDir = this->ConvertToNinjaPath(objectDir);
cmNinjaBuild fatbinary(this->LanguageLinkerCudaFatbinaryRule(config));
// Link device code for each architecture.
- for (const std::string& architectureKind : architectures) {
+ for (std::string const& architectureKind : architectures) {
// Clang always generates real code, so strip the specifier.
- const std::string architecture =
+ std::string const architecture =
architectureKind.substr(0, architectureKind.find('-'));
- const std::string cubin =
+ std::string const cubin =
cmStrCat(ninjaOutputDir, "/sm_", architecture, ".cubin");
cmNinjaBuild dlink(this->LanguageLinkerCudaDeviceRule(config));
@@ -940,8 +956,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatements(
}
void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
- const std::string& config, const std::string& fileConfig,
- const std::string& outputDir, const std::string& output)
+ std::string const& config, std::string const& fileConfig,
+ std::string const& outputDir, std::string const& output)
{
cmGeneratorTarget* genTarget = this->GetGeneratorTarget();
cmGlobalNinjaGenerator* globalGen = this->GetGlobalGenerator();
@@ -1033,13 +1049,13 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
}
if (!tgtNames.ImportLibrary.empty()) {
- const std::string impLibPath = localGen.ConvertToOutputFormat(
+ std::string const impLibPath = localGen.ConvertToOutputFormat(
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
this->EnsureParentDirectoryExists(targetOutputImplib);
}
- const std::string objPath =
+ std::string const objPath =
cmStrCat(this->GetGeneratorTarget()->GetSupportDirectory(),
globalGen->ConfigDirectory(config));
@@ -1080,7 +1096,7 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
}
void cmNinjaNormalTargetGenerator::WriteLinkStatement(
- const std::string& config, const std::string& fileConfig,
+ std::string const& config, std::string const& fileConfig,
bool firstForConfig)
{
cmMakefile* mf = this->GetMakefile();
@@ -1133,7 +1149,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
cmOSXBundleGenerator::SkipParts bundleSkipParts;
if (globalGen->GetName() == "Ninja Multi-Config") {
- const auto postFix = this->GeneratorTarget->GetFilePostfix(config);
+ auto const postFix = this->GeneratorTarget->GetFilePostfix(config);
// Skip creating Info.plist when there are multiple configurations, and
// the current configuration has a postfix. The non-postfix configuration
// Info.plist can be used by all the other configurations.
@@ -1155,7 +1171,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// Write comments.
cmGlobalNinjaGenerator::WriteDivider(this->GetImplFileStream(fileConfig));
- const cmStateEnums::TargetType targetType = gt->GetType();
+ cmStateEnums::TargetType const targetType = gt->GetType();
this->GetImplFileStream(fileConfig)
<< "# Link build statements for " << cmState::GetTargetTypeName(targetType)
<< " target " << this->GetTargetName() << "\n\n";
@@ -1201,8 +1217,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
this->GetGeneratorTarget()->GetObjectSources(sourceFiles, config);
cmLocalGenerator const* LocalGen = this->GetLocalGenerator();
- for (const auto& source : sourceFiles) {
- const std::string sourcePath = source->GetLanguage() == "Swift"
+ for (auto const& source : sourceFiles) {
+ std::string const sourcePath = source->GetLanguage() == "Swift"
? this->GetCompiledSourceNinjaPath(source)
: this->GetObjectFilePath(source, config);
oss << " "
@@ -1223,7 +1239,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// Compute specific libraries to link with.
std::vector<cmSourceFile const*> sources;
gt->GetObjectSources(sources, config);
- for (const auto& source : sources) {
+ for (auto const& source : sources) {
if (source->GetLanguage() == "Swift") {
linkBuild.Outputs.push_back(
this->ConvertToNinjaPath(this->GetObjectFilePath(source, config)));
@@ -1300,6 +1316,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
vars["AIX_EXPORTS"] = this->GetAIXExports(config);
vars["LINK_PATH"] = frameworkPath + linkPath;
+ vars["CONFIG"] = config;
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
@@ -1335,7 +1352,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
cmGlobalNinjaGenerator::CCOutputs byproducts(this->GetGlobalGenerator());
if (!gt->IsApple() && !tgtNames.ImportLibrary.empty()) {
- const std::string impLibPath = localGen.ConvertToOutputFormat(
+ std::string const impLibPath = localGen.ConvertToOutputFormat(
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
this->EnsureParentDirectoryExists(targetOutputImplib);
@@ -1362,7 +1379,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
vars["TARGET_PDB"] = components.base + components.suffix + dbg_suffix;
}
- const std::string objPath =
+ std::string const objPath =
cmStrCat(gt->GetSupportDirectory(), globalGen->ConfigDirectory(config));
vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
this->ConvertToNinjaPath(objPath), cmOutputConverter::SHELL);
@@ -1376,7 +1393,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
std::replace(link_path.begin(), link_path.end(), '\\', '/');
}
- const std::vector<cmCustomCommand>* cmdLists[3] = {
+ std::vector<cmCustomCommand> const* cmdLists[3] = {
&gt->GetPreBuildCommands(), &gt->GetPreLinkCommands(),
&gt->GetPostBuildCommands()
};
@@ -1449,7 +1466,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// If we have any PRE_LINK commands, we need to go back to CMAKE_BINARY_DIR
// for the link commands.
if (!preLinkCmdLines.empty()) {
- const std::string homeOutDir = localGen.ConvertToOutputFormat(
+ std::string const homeOutDir = localGen.ConvertToOutputFormat(
localGen.GetBinaryDirectory(), cmOutputConverter::SHELL);
preLinkCmdLines.push_back("cd " + homeOutDir);
}
@@ -1646,7 +1663,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
}
void cmNinjaNormalTargetGenerator::WriteObjectLibStatement(
- const std::string& config)
+ std::string const& config)
{
// Write a phony output that depends on all object files.
{
@@ -1667,7 +1684,7 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement(
}
void cmNinjaNormalTargetGenerator::WriteCxxModuleLibraryStatement(
- const std::string& config, const std::string& /*fileConfig*/,
+ std::string const& config, std::string const& /*fileConfig*/,
bool firstForConfig)
{
// TODO: How to use `fileConfig` properly?
@@ -1695,7 +1712,7 @@ void cmNinjaNormalTargetGenerator::WriteCxxModuleLibraryStatement(
}
cmGeneratorTarget::Names cmNinjaNormalTargetGenerator::TargetNames(
- const std::string& config) const
+ std::string const& config) const
{
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
return this->GeneratorTarget->GetExecutableNames(config);
@@ -1704,7 +1721,7 @@ cmGeneratorTarget::Names cmNinjaNormalTargetGenerator::TargetNames(
}
std::string cmNinjaNormalTargetGenerator::TargetLinkLanguage(
- const std::string& config) const
+ std::string const& config) const
{
return this->GeneratorTarget->GetLinkerLanguage(config);
}
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index 3ef0230..fd2c69f 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,48 +16,48 @@ public:
cmNinjaNormalTargetGenerator(cmGeneratorTarget* target);
~cmNinjaNormalTargetGenerator() override;
- void Generate(const std::string& config) override;
+ void Generate(std::string const& config) override;
private:
- std::string LanguageLinkerRule(const std::string& config) const;
- std::string LanguageLinkerDeviceRule(const std::string& config) const;
- std::string LanguageLinkerCudaDeviceRule(const std::string& config) const;
+ std::string LanguageLinkerRule(std::string const& config) const;
+ std::string LanguageLinkerDeviceRule(std::string const& config) const;
+ std::string LanguageLinkerCudaDeviceRule(std::string const& config) const;
std::string LanguageLinkerCudaDeviceCompileRule(
- const std::string& config) const;
- std::string LanguageLinkerCudaFatbinaryRule(const std::string& config) const;
- std::string TextStubsGeneratorRule(const std::string& config) const;
- bool CheckUseResponseFileForLibraries(const std::string& config) const;
- const char* GetVisibleTypeName() const;
- void WriteLanguagesRules(const std::string& config);
-
- void WriteLinkRule(bool useResponseFile, const std::string& config);
- void WriteDeviceLinkRules(const std::string& config);
+ std::string const& config) const;
+ std::string LanguageLinkerCudaFatbinaryRule(std::string const& config) const;
+ std::string TextStubsGeneratorRule(std::string const& config) const;
+ bool CheckUseResponseFileForLibraries(std::string const& config) const;
+ char const* GetVisibleTypeName() const;
+ void WriteLanguagesRules(std::string const& config);
+
+ void WriteLinkRule(bool useResponseFile, std::string const& config);
+ void WriteDeviceLinkRules(std::string const& config);
void WriteNvidiaDeviceLinkRule(bool useResponseFile,
- const std::string& config);
+ std::string const& config);
- void WriteLinkStatement(const std::string& config,
- const std::string& fileConfig, bool firstForConfig);
- void WriteDeviceLinkStatement(const std::string& config,
- const std::string& fileConfig,
+ void WriteLinkStatement(std::string const& config,
+ std::string const& fileConfig, bool firstForConfig);
+ void WriteDeviceLinkStatement(std::string const& config,
+ std::string const& fileConfig,
bool firstForConfig);
- void WriteDeviceLinkStatements(const std::string& config,
- const std::vector<std::string>& architectures,
- const std::string& output);
- void WriteNvidiaDeviceLinkStatement(const std::string& config,
- const std::string& fileConfig,
- const std::string& outputDir,
- const std::string& output);
-
- void WriteObjectLibStatement(const std::string& config);
- void WriteCxxModuleLibraryStatement(const std::string& config,
- const std::string& fileConfig,
+ void WriteDeviceLinkStatements(std::string const& config,
+ std::vector<std::string> const& architectures,
+ std::string const& output);
+ void WriteNvidiaDeviceLinkStatement(std::string const& config,
+ std::string const& fileConfig,
+ std::string const& outputDir,
+ std::string const& output);
+
+ void WriteObjectLibStatement(std::string const& config);
+ void WriteCxxModuleLibraryStatement(std::string const& config,
+ std::string const& fileConfig,
bool firstForConfig);
- std::vector<std::string> ComputeLinkCmd(const std::string& config);
+ std::vector<std::string> ComputeLinkCmd(std::string const& config);
std::vector<std::string> ComputeDeviceLinkCmd();
// Target name info.
- cmGeneratorTarget::Names TargetNames(const std::string& config) const;
- std::string TargetLinkLanguage(const std::string& config) const;
+ cmGeneratorTarget::Names TargetNames(std::string const& config) const;
+ std::string TargetLinkLanguage(std::string const& config) const;
std::string DeviceLinkObject;
};
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 720020d..8d93652 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmNinjaTargetGenerator.h"
#include <algorithm>
@@ -29,6 +29,7 @@
#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalCommonGenerator.h"
#include "cmGlobalNinjaGenerator.h"
@@ -97,7 +98,7 @@ cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
cmNinjaTargetGenerator::~cmNinjaTargetGenerator() = default;
cmGeneratedFileStream& cmNinjaTargetGenerator::GetImplFileStream(
- const std::string& config) const
+ std::string const& config) const
{
return *this->GetGlobalGenerator()->GetImplFileStream(config);
}
@@ -118,7 +119,7 @@ cmGlobalNinjaGenerator* cmNinjaTargetGenerator::GetGlobalGenerator() const
}
std::string cmNinjaTargetGenerator::LanguageCompilerRule(
- const std::string& lang, const std::string& config,
+ std::string const& lang, std::string const& config,
WithScanning withScanning) const
{
return cmStrCat(
@@ -128,7 +129,7 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule(
}
std::string cmNinjaTargetGenerator::LanguagePreprocessAndScanRule(
- std::string const& lang, const std::string& config) const
+ std::string const& lang, std::string const& config) const
{
return cmStrCat(
lang, "_PREPROCESS_SCAN__",
@@ -137,7 +138,7 @@ std::string cmNinjaTargetGenerator::LanguagePreprocessAndScanRule(
}
std::string cmNinjaTargetGenerator::LanguageScanRule(
- std::string const& lang, const std::string& config) const
+ std::string const& lang, std::string const& config) const
{
return cmStrCat(
lang, "_SCAN__",
@@ -158,7 +159,7 @@ bool cmNinjaTargetGenerator::CompileWithDefines(std::string const& lang) const
}
std::string cmNinjaTargetGenerator::LanguageDyndepRule(
- const std::string& lang, const std::string& config) const
+ std::string const& lang, std::string const& config) const
{
return cmStrCat(
lang, "_DYNDEP__",
@@ -167,14 +168,14 @@ std::string cmNinjaTargetGenerator::LanguageDyndepRule(
}
std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget(
- const std::string& config)
+ std::string const& config)
{
return this->GetGlobalGenerator()->OrderDependsTargetForTarget(
this->GeneratorTarget, config);
}
std::string cmNinjaTargetGenerator::OrderDependsTargetForTargetPrivate(
- const std::string& config)
+ std::string const& config)
{
return this->GetGlobalGenerator()->OrderDependsTargetForTargetPrivate(
this->GeneratorTarget, config);
@@ -185,16 +186,16 @@ std::string cmNinjaTargetGenerator::OrderDependsTargetForTargetPrivate(
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
// Refactor it.
std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
- cmSourceFile const* source, const std::string& language,
- const std::string& config, const std::string& objectFileName)
+ cmSourceFile const* source, std::string const& language,
+ std::string const& config, std::string const& objectFileName)
{
std::unordered_map<std::string, std::string> pchSources;
std::vector<std::string> pchArchs =
this->GeneratorTarget->GetPchArchs(config, language);
std::string filterArch;
- for (const std::string& arch : pchArchs) {
- const std::string pchSource =
+ for (std::string const& arch : pchArchs) {
+ std::string const pchSource =
this->GeneratorTarget->GetPchSource(config, language, arch);
if (pchSource == source->GetFullPath()) {
filterArch = arch;
@@ -225,13 +226,13 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
cmGeneratorExpressionInterpreter genexInterpreter(
this->LocalGenerator, config, this->GeneratorTarget, language);
- const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ std::string const COMPILE_FLAGS("COMPILE_FLAGS");
if (cmValue cflags = source->GetProperty(COMPILE_FLAGS)) {
this->LocalGenerator->AppendFlags(
flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
}
- const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
if (cmValue coptions = source->GetProperty(COMPILE_OPTIONS)) {
this->LocalGenerator->AppendCompileOptions(
flags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS));
@@ -282,7 +283,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
std::string const& language,
- const std::string& config)
+ std::string const& config)
{
std::vector<std::string> includes;
this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
@@ -300,8 +301,8 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
// TODO: Refactor with
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source,
- const std::string& language,
- const std::string& config)
+ std::string const& language,
+ std::string const& config)
{
std::set<std::string> defines;
cmGeneratorExpressionInterpreter genexInterpreter(
@@ -312,7 +313,7 @@ std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source,
defines.insert(cmStrCat("CMAKE_INTDIR=\"", config, '"'));
}
- const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (cmValue compile_defs = source->GetProperty(COMPILE_DEFINITIONS)) {
this->LocalGenerator->AppendDefines(
defines, genexInterpreter.Evaluate(*compile_defs, COMPILE_DEFINITIONS));
@@ -333,14 +334,14 @@ std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source,
}
std::string cmNinjaTargetGenerator::ComputeIncludes(
- cmSourceFile const* source, const std::string& language,
- const std::string& config)
+ cmSourceFile const* source, std::string const& language,
+ std::string const& config)
{
std::vector<std::string> includes;
cmGeneratorExpressionInterpreter genexInterpreter(
this->LocalGenerator, config, this->GeneratorTarget, language);
- const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (cmValue cincludes = source->GetProperty(INCLUDE_DIRECTORIES)) {
this->LocalGenerator->AppendIncludeDirectories(
includes, genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES),
@@ -356,7 +357,7 @@ std::string cmNinjaTargetGenerator::ComputeIncludes(
}
cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps(
- const std::string& linkLanguage, const std::string& config,
+ std::string const& linkLanguage, std::string const& config,
bool ignoreType) const
{
// Static libraries never depend on other targets for linking.
@@ -372,7 +373,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps(
return cmNinjaDeps();
}
- const std::vector<std::string>& deps = cli->GetDepends();
+ std::vector<std::string> const& deps = cli->GetDepends();
cmNinjaDeps result(deps.size());
std::transform(deps.begin(), deps.end(), result.begin(),
this->MapToNinjaPath());
@@ -409,7 +410,7 @@ std::string cmNinjaTargetGenerator::GetCompiledSourceNinjaPath(
}
std::string cmNinjaTargetGenerator::GetObjectFileDir(
- const std::string& config) const
+ std::string const& config) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
if (!path.empty()) {
@@ -422,14 +423,14 @@ std::string cmNinjaTargetGenerator::GetObjectFileDir(
}
std::string cmNinjaTargetGenerator::GetObjectFilePath(
- cmSourceFile const* source, const std::string& config) const
+ cmSourceFile const* source, std::string const& config) const
{
std::string const& objectName = this->GeneratorTarget->GetObjectName(source);
return cmStrCat(this->GetObjectFileDir(config), '/', objectName);
}
std::string cmNinjaTargetGenerator::GetBmiFilePath(
- cmSourceFile const* source, const std::string& config) const
+ cmSourceFile const* source, std::string const& config) const
{
auto& importedConfigInfo = this->Configs.at(config).ImportedCxxModules;
if (!importedConfigInfo.Initialized()) {
@@ -464,7 +465,7 @@ std::string cmNinjaTargetGenerator::GetClangTidyReplacementsFilePath(
}
std::string cmNinjaTargetGenerator::GetPreprocessedFilePath(
- cmSourceFile const* source, const std::string& config) const
+ cmSourceFile const* source, std::string const& config) const
{
// Choose an extension to compile already-preprocessed source.
std::string ppExt = source->GetExtension();
@@ -500,7 +501,7 @@ std::string cmNinjaTargetGenerator::GetPreprocessedFilePath(
}
std::string cmNinjaTargetGenerator::GetDyndepFilePath(
- std::string const& lang, const std::string& config) const
+ std::string const& lang, std::string const& config) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
if (!path.empty()) {
@@ -513,7 +514,7 @@ std::string cmNinjaTargetGenerator::GetDyndepFilePath(
}
std::string cmNinjaTargetGenerator::GetTargetDependInfoPath(
- std::string const& lang, const std::string& config) const
+ std::string const& lang, std::string const& config) const
{
std::string path =
cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/',
@@ -524,14 +525,14 @@ std::string cmNinjaTargetGenerator::GetTargetDependInfoPath(
}
std::string cmNinjaTargetGenerator::GetTargetOutputDir(
- const std::string& config) const
+ std::string const& config) const
{
std::string dir = this->GeneratorTarget->GetDirectory(config);
return this->ConvertToNinjaPath(dir);
}
std::string cmNinjaTargetGenerator::GetTargetFilePath(
- const std::string& name, const std::string& config) const
+ std::string const& name, std::string const& config) const
{
std::string path = this->GetTargetOutputDir(config);
if (path.empty() || path == ".") {
@@ -547,7 +548,7 @@ std::string cmNinjaTargetGenerator::GetTargetName() const
}
bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(
- cmNinjaVars& vars, const std::string& config) const
+ cmNinjaVars& vars, std::string const& config) const
{
cmMakefile* mf = this->GetMakefile();
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
@@ -576,8 +577,8 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(
return false;
}
-void cmNinjaTargetGenerator::WriteLanguageRules(const std::string& language,
- const std::string& config)
+void cmNinjaTargetGenerator::WriteLanguageRules(std::string const& language,
+ std::string const& config)
{
#ifdef NINJA_GEN_VERBOSE_FILES
this->GetRulesFileStream() << "# Rules for language " << language << "\n\n";
@@ -604,10 +605,10 @@ cmNinjaRule GetScanRule(
std::string const& ruleName, std::string const& ppFileName,
std::string const& deptype,
cmRulePlaceholderExpander::RuleVariables const& vars,
- const std::string& responseFlag, const std::string& flags,
+ std::string const& responseFlag, std::string const& flags,
cmRulePlaceholderExpander* const rulePlaceholderExpander,
cmLocalNinjaGenerator* generator, std::vector<std::string> scanCmds,
- const std::string& outputConfig)
+ std::string const& outputConfig)
{
cmNinjaRule rule(ruleName);
// Scanning always uses a depfile for preprocessor dependencies.
@@ -622,12 +623,14 @@ cmNinjaRule GetScanRule(
cmRulePlaceholderExpander::RuleVariables scanVars;
scanVars.CMTargetName = vars.CMTargetName;
scanVars.CMTargetType = vars.CMTargetType;
+ scanVars.CMTargetLabels = vars.CMTargetLabels;
scanVars.Language = vars.Language;
scanVars.Object = "$OBJ_FILE";
scanVars.PreprocessedSource = ppFileName.c_str();
scanVars.DynDepFile = "$DYNDEP_INTERMEDIATE_FILE";
scanVars.DependencyFile = rule.DepFile.c_str();
scanVars.DependencyTarget = "$out";
+ scanVars.Config = vars.Config;
// Scanning needs the same preprocessor settings as direct compilation would.
scanVars.Source = vars.Source;
@@ -660,8 +663,8 @@ cmNinjaRule GetScanRule(
}
}
-void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
- const std::string& config)
+void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
+ std::string const& config)
{
// For some cases we scan to dynamically discover dependencies.
bool const needDyndep = this->GetGeneratorTarget()->NeedDyndep(lang, config);
@@ -672,14 +675,16 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
this->WriteCompileRule(lang, config, WithScanning::No);
}
-void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
- const std::string& config,
+void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
+ std::string const& config,
WithScanning withScanning)
{
cmRulePlaceholderExpander::RuleVariables vars;
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()).c_str();
+ vars.CMTargetLabels =
+ this->GetGeneratorTarget()->GetTargetLabelsString().c_str();
vars.Language = lang.c_str();
vars.Source = "$in";
vars.Object = "$out";
@@ -691,6 +696,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
vars.ObjectFileDir = "$OBJECT_FILE_DIR";
vars.CudaCompileMode = "$CUDA_COMPILE_MODE";
vars.ISPCHeader = "$ISPC_HEADER_FILE";
+ vars.Config = "$CONFIG";
cmMakefile* mf = this->GetMakefile();
@@ -733,7 +739,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
if (withScanning == WithScanning::Yes) {
- const auto& scanDepType = this->GetMakefile()->GetSafeDefinition(
+ auto const& scanDepType = this->GetMakefile()->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_SCANDEP_DEPFILE_FORMAT"));
// Rule to scan dependencies of sources that need preprocessing.
@@ -753,9 +759,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
} else {
scanRuleName = this->LanguagePreprocessAndScanRule(lang, config);
ppFileName = "$out";
- std::string const& ppCommmand = mf->GetRequiredDefinition(
+ std::string const& ppCommand = mf->GetRequiredDefinition(
cmStrCat("CMAKE_", lang, "_PREPROCESS_SOURCE"));
- scanCommands.assign(ppCommmand);
+ scanCommands.assign(ppCommand);
for (auto& i : scanCommands) {
i = cmStrCat(launcher, i);
}
@@ -873,7 +879,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
rule.DepType = "gcc";
rule.DepFile = "$DEP_FILE";
cmValue d = mf->GetDefinition("CMAKE_C_COMPILER");
- const std::string cl =
+ std::string const cl =
d ? *d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
std::string cmcldepsPath;
cmSystemTools::GetShortPath(cmSystemTools::GetCMClDepsCommand(),
@@ -884,7 +890,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
"\" \"", cl, "\" ");
}
} else {
- const auto& depType = this->GetMakefile()->GetSafeDefinition(
+ auto const& depType = this->GetMakefile()->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_DEPFILE_FORMAT"));
if (depType == "msvc"_s) {
rule.DepType = "msvc";
@@ -896,7 +902,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
vars.DependencyFile = rule.DepFile.c_str();
vars.DependencyTarget = "$out";
- const std::string flagsName = cmStrCat("CMAKE_DEPFILE_FLAGS_", lang);
+ std::string const flagsName = cmStrCat("CMAKE_DEPFILE_FLAGS_", lang);
std::string depfileFlags = mf->GetSafeDefinition(flagsName);
if (!depfileFlags.empty()) {
rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
@@ -920,7 +926,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
if (lang == "CUDA") {
if (this->GeneratorTarget->GetPropertyAsBool(
"CUDA_SEPARABLE_COMPILATION")) {
- const std::string& rdcFlag =
+ std::string const& rdcFlag =
this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG");
cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " ");
}
@@ -932,7 +938,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
auto propName = cmStrCat("CUDA_", mode, "_COMPILATION");
auto defName = cmStrCat("_CMAKE_CUDA_", mode, "_FLAG");
if (this->GeneratorTarget->GetPropertyAsBool(propName)) {
- const std::string& flag =
+ std::string const& flag =
this->Makefile->GetRequiredDefinition(defName);
cudaCompileMode = cmStrCat(cudaCompileMode, flag);
useNormalCompileMode = false;
@@ -940,7 +946,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
}
}
if (useNormalCompileMode) {
- const std::string& wholeFlag =
+ std::string const& wholeFlag =
this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG");
cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag);
}
@@ -948,8 +954,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
}
// Rule for compiling object file.
- const std::string cmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT");
- const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
+ std::string const cmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT");
+ std::string const& compileCmd = mf->GetRequiredDefinition(cmdVar);
cmList compileCmds(compileCmd);
if (!compileCmds.empty()) {
@@ -961,7 +967,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
compileCmds.front().insert(0, cldeps);
}
- const auto& extraCommands = this->GetMakefile()->GetSafeDefinition(
+ auto const& extraCommands = this->GetMakefile()->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_DEPENDS_EXTRA_COMMANDS"));
if (!extraCommands.empty()) {
compileCmds.append(extraCommands);
@@ -983,7 +989,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
}
void cmNinjaTargetGenerator::WriteObjectBuildStatements(
- const std::string& config, const std::string& fileConfig,
+ std::string const& config, std::string const& fileConfig,
bool firstForConfig)
{
this->GeneratorTarget->CheckCxxModuleStatus(config);
@@ -1059,8 +1065,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
case cmPolicies::WARN:
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
usePrivateGeneratedSources = true;
break;
@@ -1068,8 +1072,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
}
for (cmCustomCommand const* cc : customCommands) {
cmCustomCommandGenerator ccg(*cc, config, this->GetLocalGenerator());
- const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
- const std::vector<std::string>& ccbyproducts = ccg.GetByproducts();
+ std::vector<std::string> const& ccoutputs = ccg.GetOutputs();
+ std::vector<std::string> const& ccbyproducts = ccg.GetByproducts();
auto const nPreviousOutputs = ccouts.size();
ccouts.insert(ccouts.end(), ccoutputs.begin(), ccoutputs.end());
ccouts.insert(ccouts.end(), ccbyproducts.begin(), ccbyproducts.end());
@@ -1274,11 +1278,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
build);
}
- this->GetImplFileStream(fileConfig) << "\n";
+ this->GetImplFileStream(fileConfig) << '\n';
}
void cmNinjaTargetGenerator::GenerateSwiftOutputFileMap(
- const std::string& config, std::string& flags)
+ std::string const& config, std::string& flags)
{
if (this->Configs[config].SwiftOutputMap.empty()) {
return;
@@ -1289,11 +1293,9 @@ void cmNinjaTargetGenerator::GenerateSwiftOutputFileMap(
if (cmValue name = target->GetProperty("Swift_DEPENDENCIES_FILE")) {
return *name;
}
- return this->GetLocalGenerator()->ConvertToOutputFormat(
- this->ConvertToNinjaPath(cmStrCat(target->GetSupportDirectory(), '/',
- config, '/', target->GetName(),
- ".swiftdeps")),
- cmOutputConverter::SHELL);
+ return this->ConvertToNinjaPath(cmStrCat(target->GetSupportDirectory(),
+ '/', config, '/',
+ target->GetName(), ".swiftdeps"));
}();
std::string mapFilePath =
@@ -1311,19 +1313,19 @@ void cmNinjaTargetGenerator::GenerateSwiftOutputFileMap(
// Add flag
this->LocalGenerator->AppendFlags(flags, "-output-file-map");
- this->LocalGenerator->AppendFlagEscape(
+ this->LocalGenerator->AppendFlags(
flags,
this->GetLocalGenerator()->ConvertToOutputFormat(
ConvertToNinjaPath(mapFilePath), cmOutputConverter::SHELL));
}
namespace {
-cmNinjaBuild GetScanBuildStatement(const std::string& ruleName,
- const std::string& ppFileName,
+cmNinjaBuild GetScanBuildStatement(std::string const& ruleName,
+ std::string const& ppFileName,
bool compilePP, bool compilePPWithDefines,
bool compilationPreprocesses,
cmNinjaBuild& objBuild, cmNinjaVars& vars,
- const std::string& objectFileName,
+ std::string const& objectFileName,
cmNinjaTargetGenerator* tg)
{
cmNinjaBuild scanBuild(ruleName);
@@ -1401,8 +1403,8 @@ cmNinjaBuild GetScanBuildStatement(const std::string& ruleName,
}
void cmNinjaTargetGenerator::WriteObjectBuildStatement(
- cmSourceFile const* source, const std::string& config,
- const std::string& fileConfig, bool firstForConfig)
+ cmSourceFile const* source, std::string const& config,
+ std::string const& fileConfig, bool firstForConfig)
{
std::string const language = source->GetLanguage();
std::string const sourceFilePath = this->GetCompiledSourceNinjaPath(source);
@@ -1440,6 +1442,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->ComputeFlagsForObject(source, language, config, objectFileName);
vars["DEFINES"] = this->ComputeDefines(source, language, config);
vars["INCLUDES"] = this->ComputeIncludes(source, language, config);
+ vars["CONFIG"] = config;
auto compilerLauncher = this->GetCompilerLauncher(language, config);
@@ -1449,7 +1452,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
vars["CODE_CHECK"] =
this->GenerateCodeCheckRules(*source, compilerLauncher, cmakeCmd, config,
- [this](const std::string& path) {
+ [this](std::string const& path) {
return this->ConvertToNinjaPath(path);
});
}
@@ -1509,8 +1512,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->GeneratorTarget->GetPchArchs(config, language);
std::unordered_set<std::string> pchSources;
- for (const std::string& arch : pchArchs) {
- const std::string pchSource =
+ for (std::string const& arch : pchArchs) {
+ std::string const pchSource =
this->GeneratorTarget->GetPchSource(config, language, arch);
if (!pchSource.empty()) {
@@ -1519,7 +1522,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
if (!pchSources.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- for (const std::string& arch : pchArchs) {
+ for (std::string const& arch : pchArchs) {
depList.push_back(
this->GeneratorTarget->GetPchHeader(config, language, arch));
if (pchSources.find(source->GetFullPath()) == pchSources.end()) {
@@ -1580,11 +1583,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
if (needDyndep) {
// If source/target has preprocessing turned off, we still need to
// generate an explicit dependency step
- const auto srcpp = source->GetSafeProperty("Fortran_PREPROCESS");
+ auto const srcpp = source->GetSafeProperty("Fortran_PREPROCESS");
cmOutputConverter::FortranPreprocess preprocess =
cmOutputConverter::GetFortranPreprocess(srcpp);
if (preprocess == cmOutputConverter::FortranPreprocess::Unset) {
- const auto& tgtpp =
+ auto const& tgtpp =
this->GeneratorTarget->GetSafeProperty("Fortran_PREPROCESS");
preprocess = cmOutputConverter::GetFortranPreprocess(tgtpp);
}
@@ -1762,8 +1765,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
- cmSourceFile const* source, const std::string& config,
- const std::string& fileConfig, bool firstForConfig)
+ cmSourceFile const* source, std::string const& config,
+ std::string const& fileConfig, bool firstForConfig)
{
std::string const language = source->GetLanguage();
if (language != "CXX"_s) {
@@ -1793,6 +1796,7 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
this->ComputeFlagsForObject(source, language, config, bmiFileName);
vars["DEFINES"] = this->ComputeDefines(source, language, config);
vars["INCLUDES"] = this->ComputeIncludes(source, language, config);
+ vars["CONFIG"] = config;
if (this->GetMakefile()->GetSafeDefinition(
cmStrCat("CMAKE_", language, "_DEPFILE_FORMAT")) != "msvc"_s) {
@@ -2014,7 +2018,10 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
std::string const emitModuleFlag = "-emit-module";
std::string const modulePathFlag = "-emit-module-path";
this->LocalGenerator->AppendFlags(
- vars["FLAGS"], { emitModuleFlag, modulePathFlag, moduleFilepath });
+ vars["FLAGS"],
+ { emitModuleFlag, modulePathFlag,
+ this->LocalGenerator->ConvertToOutputFormat(
+ moduleFilepath, cmOutputConverter::SHELL) });
objBuild.Outputs.push_back(moduleFilepath);
}
this->LocalGenerator->AppendFlags(vars["FLAGS"],
@@ -2032,6 +2039,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
this->GetFlags(language, config));
vars["DEFINES"] = this->GetDefines(language, config);
vars["INCLUDES"] = this->GetIncludes(language, config);
+ vars["CONFIG"] = config;
// target-level object filename
std::string const targetObjectFilename = this->ConvertToNinjaPath(cmStrCat(
@@ -2098,7 +2106,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
}
void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang,
- const std::string& config)
+ std::string const& config)
{
Json::Value tdi(Json::objectValue);
tdi["language"] = lang;
@@ -2180,7 +2188,7 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang,
}
void cmNinjaTargetGenerator::EmitSwiftDependencyInfo(
- cmSourceFile const* source, const std::string& config)
+ cmSourceFile const* source, std::string const& config)
{
std::string const sourceFilePath = this->GetCompiledSourceNinjaPath(source);
std::string const objectFilePath =
@@ -2273,7 +2281,10 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
}
compileObjectVars.Source = escapedSourceFileName.c_str();
- compileObjectVars.Object = objectFileName.c_str();
+ std::string escapedObjectFileName =
+ this->LocalGenerator->ConvertToOutputFormat(objectFileName,
+ cmOutputConverter::SHELL);
+ compileObjectVars.Object = escapedObjectFileName.c_str();
compileObjectVars.ObjectDir = objectDir.c_str();
compileObjectVars.ObjectFileDir = objectFileDir.c_str();
compileObjectVars.Flags = fullFlags.c_str();
@@ -2287,7 +2298,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
if (language == "CUDA") {
if (this->GeneratorTarget->GetPropertyAsBool(
"CUDA_SEPARABLE_COMPILATION")) {
- const std::string& rdcFlag =
+ std::string const& rdcFlag =
this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG");
cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " ");
}
@@ -2299,7 +2310,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
auto propName = cmStrCat("CUDA_", mode, "_COMPILATION");
auto defName = cmStrCat("_CMAKE_CUDA_", mode, "_FLAG");
if (this->GeneratorTarget->GetPropertyAsBool(propName)) {
- const std::string& flag =
+ std::string const& flag =
this->Makefile->GetRequiredDefinition(defName);
cudaCompileMode = cmStrCat(cudaCompileMode, flag);
useNormalCompileMode = false;
@@ -2307,15 +2318,15 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
}
}
if (useNormalCompileMode) {
- const std::string& wholeFlag =
+ std::string const& wholeFlag =
this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG");
cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag);
}
compileObjectVars.CudaCompileMode = cudaCompileMode.c_str();
}
- const std::string cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT");
- const std::string& compileCmd =
+ std::string const cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT");
+ std::string const& compileCmd =
this->Makefile->GetRequiredDefinition(cmdVar);
cmList compileCmds(compileCmd);
@@ -2409,7 +2420,7 @@ void cmNinjaTargetGenerator::ExportSwiftObjectCompileCommand(
}
}
-void cmNinjaTargetGenerator::AdditionalCleanFiles(const std::string& config)
+void cmNinjaTargetGenerator::AdditionalCleanFiles(std::string const& config)
{
if (cmValue prop_value =
this->GeneratorTarget->GetProperty("ADDITIONAL_CLEAN_FILES")) {
@@ -2426,7 +2437,7 @@ void cmNinjaTargetGenerator::AdditionalCleanFiles(const std::string& config)
}
}
-cmNinjaDeps cmNinjaTargetGenerator::GetObjects(const std::string& config) const
+cmNinjaDeps cmNinjaTargetGenerator::GetObjects(std::string const& config) const
{
auto const it = this->Configs.find(config);
if (it != this->Configs.end()) {
@@ -2436,7 +2447,7 @@ cmNinjaDeps cmNinjaTargetGenerator::GetObjects(const std::string& config) const
}
void cmNinjaTargetGenerator::EnsureDirectoryExists(
- const std::string& path) const
+ std::string const& path) const
{
if (cmSystemTools::FileIsFullPath(path)) {
cmSystemTools::MakeDirectory(path);
@@ -2451,13 +2462,13 @@ void cmNinjaTargetGenerator::EnsureDirectoryExists(
}
void cmNinjaTargetGenerator::EnsureParentDirectoryExists(
- const std::string& path) const
+ std::string const& path) const
{
this->EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path));
}
void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
- cmSourceFile const& source, const char* pkgloc, const std::string& config)
+ cmSourceFile const& source, char const* pkgloc, std::string const& config)
{
// Skip OS X content when not building a Framework or Bundle.
if (!this->Generator->GetGeneratorTarget()->IsBundleOnApple()) {
@@ -2514,7 +2525,7 @@ void cmNinjaTargetGenerator::RemoveDepfileBinding(cmNinjaVars& vars) const
}
void cmNinjaTargetGenerator::addPoolNinjaVariable(
- const std::string& pool_property, cmGeneratorTarget* target,
+ std::string const& pool_property, cmGeneratorTarget* target,
cmNinjaVars& vars)
{
cmValue pool = target->GetProperty(pool_property);
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 5711922..7376a84 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,7 +38,7 @@ public:
/// Destructor.
~cmNinjaTargetGenerator() override;
- virtual void Generate(const std::string& config) = 0;
+ virtual void Generate(std::string const& config) = 0;
std::string GetTargetName() const;
@@ -46,9 +46,9 @@ public:
void RemoveDepfileBinding(cmNinjaVars& vars) const;
protected:
- bool SetMsvcTargetPdbVariable(cmNinjaVars&, const std::string& config) const;
+ bool SetMsvcTargetPdbVariable(cmNinjaVars&, std::string const& config) const;
- cmGeneratedFileStream& GetImplFileStream(const std::string& config) const;
+ cmGeneratedFileStream& GetImplFileStream(std::string const& config) const;
cmGeneratedFileStream& GetCommonFileStream() const;
cmGeneratedFileStream& GetRulesFileStream() const;
@@ -71,20 +71,20 @@ protected:
No,
Yes,
};
- std::string LanguageCompilerRule(const std::string& lang,
- const std::string& config,
+ std::string LanguageCompilerRule(std::string const& lang,
+ std::string const& config,
WithScanning withScanning) const;
std::string LanguagePreprocessAndScanRule(std::string const& lang,
- const std::string& config) const;
+ std::string const& config) const;
std::string LanguageScanRule(std::string const& lang,
- const std::string& config) const;
+ std::string const& config) const;
std::string LanguageDyndepRule(std::string const& lang,
- const std::string& config) const;
+ std::string const& config) const;
bool NeedExplicitPreprocessing(std::string const& lang) const;
bool CompileWithDefines(std::string const& lang) const;
- std::string OrderDependsTargetForTarget(const std::string& config);
- std::string OrderDependsTargetForTargetPrivate(const std::string& config);
+ std::string OrderDependsTargetForTarget(std::string const& config);
+ std::string OrderDependsTargetForTargetPrivate(std::string const& config);
std::string ComputeOrderDependsForTarget();
@@ -94,22 +94,22 @@ protected:
* by LanguageFlagsVarName().
*/
std::string ComputeFlagsForObject(cmSourceFile const* source,
- const std::string& language,
- const std::string& config,
- const std::string& objectFileName);
+ std::string const& language,
+ std::string const& config,
+ std::string const& objectFileName);
void AddIncludeFlags(std::string& flags, std::string const& lang,
- const std::string& config) override;
+ std::string const& config) override;
std::string ComputeDefines(cmSourceFile const* source,
- const std::string& language,
- const std::string& config);
+ std::string const& language,
+ std::string const& config);
std::string ComputeIncludes(cmSourceFile const* source,
- const std::string& language,
- const std::string& config);
+ std::string const& language,
+ std::string const& config);
- std::string const& ConvertToNinjaPath(const std::string& path) const
+ std::string const& ConvertToNinjaPath(std::string const& path) const
{
return this->GetGlobalGenerator()->ConvertToNinjaPath(path);
}
@@ -124,23 +124,23 @@ protected:
}
/// @return the list of link dependency for the given target @a target.
- cmNinjaDeps ComputeLinkDeps(const std::string& linkLanguage,
- const std::string& config,
+ cmNinjaDeps ComputeLinkDeps(std::string const& linkLanguage,
+ std::string const& config,
bool ignoreType = false) const;
/// @return the source file path for the given @a source.
std::string GetCompiledSourceNinjaPath(cmSourceFile const* source) const;
- std::string GetObjectFileDir(const std::string& config) const;
+ std::string GetObjectFileDir(std::string const& config) const;
/// @return the object file path for the given @a source.
std::string GetObjectFilePath(cmSourceFile const* source,
- const std::string& config) const;
+ std::string const& config) const;
std::string GetBmiFilePath(cmSourceFile const* source,
- const std::string& config) const;
+ std::string const& config) const;
/// @return the preprocessed source file path for the given @a source.
std::string GetPreprocessedFilePath(cmSourceFile const* source,
- const std::string& config) const;
+ std::string const& config) const;
/// @return the clang-tidy replacements file path for the given @a source.
std::string GetClangTidyReplacementsFilePath(
@@ -149,46 +149,46 @@ protected:
/// @return the dyndep file path for this target.
std::string GetDyndepFilePath(std::string const& lang,
- const std::string& config) const;
+ std::string const& config) const;
/// @return the target dependency scanner info file path
std::string GetTargetDependInfoPath(std::string const& lang,
- const std::string& config) const;
+ std::string const& config) const;
/// @return the file path where the target named @a name is generated.
- std::string GetTargetFilePath(const std::string& name,
- const std::string& config) const;
+ std::string GetTargetFilePath(std::string const& name,
+ std::string const& config) const;
/// @return the output path for the target.
- virtual std::string GetTargetOutputDir(const std::string& config) const;
+ virtual std::string GetTargetOutputDir(std::string const& config) const;
- void WriteLanguageRules(const std::string& language,
- const std::string& config);
- void WriteCompileRule(const std::string& language,
- const std::string& config);
- void WriteCompileRule(const std::string& language, const std::string& config,
+ void WriteLanguageRules(std::string const& language,
+ std::string const& config);
+ void WriteCompileRule(std::string const& language,
+ std::string const& config);
+ void WriteCompileRule(std::string const& language, std::string const& config,
WithScanning withScanning);
- void WriteObjectBuildStatements(const std::string& config,
- const std::string& fileConfig,
+ void WriteObjectBuildStatements(std::string const& config,
+ std::string const& fileConfig,
bool firstForConfig);
void WriteCxxModuleBmiBuildStatement(cmSourceFile const* source,
- const std::string& config,
- const std::string& fileConfig,
+ std::string const& config,
+ std::string const& fileConfig,
bool firstForConfig);
void WriteSwiftObjectBuildStatement(
- std::vector<cmSourceFile const*> const& sources, const std::string& config,
- const std::string& fileConfig, bool firstForConfig);
+ std::vector<cmSourceFile const*> const& sources, std::string const& config,
+ std::string const& fileConfig, bool firstForConfig);
void WriteObjectBuildStatement(cmSourceFile const* source,
- const std::string& config,
- const std::string& fileConfig,
+ std::string const& config,
+ std::string const& fileConfig,
bool firstForConfig);
void WriteTargetDependInfo(std::string const& lang,
- const std::string& config);
+ std::string const& config);
void EmitSwiftDependencyInfo(cmSourceFile const* source,
- const std::string& config);
+ std::string const& config);
- void GenerateSwiftOutputFileMap(const std::string& config,
+ void GenerateSwiftOutputFileMap(std::string const& config,
std::string& flags);
void ExportObjectCompileCommand(
@@ -205,12 +205,12 @@ protected:
std::string const& defines, std::string const& includes,
std::string const& outputConfig, bool singleOutput);
- void AdditionalCleanFiles(const std::string& config);
+ void AdditionalCleanFiles(std::string const& config);
- cmNinjaDeps GetObjects(const std::string& config) const;
+ cmNinjaDeps GetObjects(std::string const& config) const;
- void EnsureDirectoryExists(const std::string& dir) const;
- void EnsureParentDirectoryExists(const std::string& path) const;
+ void EnsureDirectoryExists(std::string const& dir) const;
+ void EnsureParentDirectoryExists(std::string const& path) const;
// write rules for macOS Application Bundle content.
struct MacOSXContentGeneratorType
@@ -223,8 +223,8 @@ protected:
{
}
- void operator()(cmSourceFile const& source, const char* pkgloc,
- const std::string& config) override;
+ void operator()(cmSourceFile const& source, char const* pkgloc,
+ std::string const& config) override;
private:
cmNinjaTargetGenerator* Generator;
@@ -236,7 +236,7 @@ protected:
std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator;
std::set<std::string> MacContentFolders;
- void addPoolNinjaVariable(const std::string& pool_property,
+ void addPoolNinjaVariable(std::string const& pool_property,
cmGeneratorTarget* target, cmNinjaVars& vars);
bool ForceResponseFile();
diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h
index b77e0b5..c76df4d 100644
--- a/Source/cmNinjaTypes.h
+++ b/Source/cmNinjaTypes.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 35c8367..f4b95eb 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmNinjaUtilityTargetGenerator.h"
#include <algorithm>
@@ -33,7 +33,7 @@ cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() = default;
-void cmNinjaUtilityTargetGenerator::Generate(const std::string& config)
+void cmNinjaUtilityTargetGenerator::Generate(std::string const& config)
{
if (!this->GetGeneratorTarget()->Target->IsPerConfig()) {
this->WriteUtilBuildStatements(config, config);
@@ -104,8 +104,8 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
lg->AddCustomCommandTarget(cc, genTarget);
// Depend on all custom command outputs.
- const std::vector<std::string>& ccOutputs = ccg.GetOutputs();
- const std::vector<std::string>& ccByproducts = ccg.GetByproducts();
+ std::vector<std::string> const& ccOutputs = ccg.GetOutputs();
+ std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
std::transform(ccOutputs.begin(), ccOutputs.end(),
std::back_inserter(deps), this->MapToNinjaPath());
std::transform(ccByproducts.begin(), ccByproducts.end(),
diff --git a/Source/cmNinjaUtilityTargetGenerator.h b/Source/cmNinjaUtilityTargetGenerator.h
index dbd3797..336101f 100644
--- a/Source/cmNinjaUtilityTargetGenerator.h
+++ b/Source/cmNinjaUtilityTargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,7 +16,7 @@ public:
cmNinjaUtilityTargetGenerator(cmGeneratorTarget* target);
~cmNinjaUtilityTargetGenerator() override;
- void Generate(const std::string& config) override;
+ void Generate(std::string const& config) override;
private:
void WriteUtilBuildStatements(std::string const& config,
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 4301f05..e25da96 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmOSXBundleGenerator.h"
#include <cassert>
@@ -30,9 +30,9 @@ bool cmOSXBundleGenerator::MustSkip()
return !this->GT->HaveWellDefinedOutputFiles();
}
-void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
+void cmOSXBundleGenerator::CreateAppBundle(std::string const& targetName,
std::string& outpath,
- const std::string& config)
+ std::string const& config)
{
if (this->MustSkip()) {
return;
@@ -57,8 +57,8 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
}
void cmOSXBundleGenerator::CreateFramework(
- const std::string& targetName, const std::string& outpath,
- const std::string& config, const cmOSXBundleGenerator::SkipParts& skipParts)
+ std::string const& targetName, std::string const& outpath,
+ std::string const& config, cmOSXBundleGenerator::SkipParts const& skipParts)
{
if (this->MustSkip()) {
return;
@@ -163,9 +163,9 @@ void cmOSXBundleGenerator::CreateFramework(
}
}
-void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
- const std::string& root,
- const std::string& config)
+void cmOSXBundleGenerator::CreateCFBundle(std::string const& targetName,
+ std::string const& root,
+ std::string const& config)
{
if (this->MustSkip()) {
return;
@@ -191,7 +191,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
void cmOSXBundleGenerator::GenerateMacOSXContentStatements(
std::vector<cmSourceFile const*> const& sources,
- MacOSXContentGeneratorType* generator, const std::string& config)
+ MacOSXContentGeneratorType* generator, std::string const& config)
{
if (this->MustSkip()) {
return;
@@ -207,7 +207,7 @@ void cmOSXBundleGenerator::GenerateMacOSXContentStatements(
}
std::string cmOSXBundleGenerator::InitMacOSXContentDirectory(
- const char* pkgloc, const std::string& config)
+ char const* pkgloc, std::string const& config)
{
// Construct the full path to the content subdirectory.
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 38453fd..bfd9aec 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,30 +28,30 @@ public:
// create an app bundle at a given root, and return
// the directory within the bundle that contains the executable
- void CreateAppBundle(const std::string& targetName, std::string& root,
- const std::string& config);
+ void CreateAppBundle(std::string const& targetName, std::string& root,
+ std::string const& config);
// create a framework at a given root
- void CreateFramework(const std::string& targetName, const std::string& root,
- const std::string& config,
- const SkipParts& skipParts = SkipParts{});
+ void CreateFramework(std::string const& targetName, std::string const& root,
+ std::string const& config,
+ SkipParts const& skipParts = SkipParts{});
// create a cf bundle at a given root
- void CreateCFBundle(const std::string& targetName, const std::string& root,
- const std::string& config);
+ void CreateCFBundle(std::string const& targetName, std::string const& root,
+ std::string const& config);
struct MacOSXContentGeneratorType
{
virtual ~MacOSXContentGeneratorType() = default;
- virtual void operator()(cmSourceFile const& source, const char* pkgloc,
- const std::string& config) = 0;
+ virtual void operator()(cmSourceFile const& source, char const* pkgloc,
+ std::string const& config) = 0;
};
void GenerateMacOSXContentStatements(
std::vector<cmSourceFile const*> const& sources,
- MacOSXContentGeneratorType* generator, const std::string& config);
- std::string InitMacOSXContentDirectory(const char* pkgloc,
- const std::string& config);
+ MacOSXContentGeneratorType* generator, std::string const& config);
+ std::string InitMacOSXContentDirectory(char const* pkgloc,
+ std::string const& config);
void SetMacContentFolders(std::set<std::string>* macContentFolders)
{
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index d589f0e..cc20002 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmOptionCommand.h"
#include "cmExecutionStatus.h"
@@ -16,7 +16,7 @@
bool cmOptionCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- const bool argError = (args.size() < 2) || (args.size() > 3);
+ bool const argError = (args.size() < 2) || (args.size() > 3);
if (argError) {
std::string m = cmStrCat("called with incorrect number of arguments: ",
cmJoin(args, " "));
@@ -29,7 +29,7 @@ bool cmOptionCommand(std::vector<std::string> const& args,
{
auto policyStatus =
status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0077);
- const auto& existsBeforeSet =
+ auto const& existsBeforeSet =
status.GetMakefile().GetStateSnapshot().GetDefinition(args[0]);
switch (policyStatus) {
case cmPolicies::WARN:
@@ -38,8 +38,6 @@ bool cmOptionCommand(std::vector<std::string> const& args,
case cmPolicies::OLD:
// OLD behavior does not warn.
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW: {
// See if a local variable with this name already exists.
// If so we ignore the option command.
@@ -77,7 +75,7 @@ bool cmOptionCommand(std::vector<std::string> const& args,
}
if (checkAndWarn) {
- const auto& existsAfterSet =
+ auto const& existsAfterSet =
status.GetMakefile().GetStateSnapshot().GetDefinition(args[0]);
if (!existsAfterSet) {
status.GetMakefile().IssueMessage(
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 912e0ee..06c87ce 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index a46c87b..8ace6b4 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmOrderDirectories.h"
#include <algorithm>
@@ -140,7 +140,7 @@ class cmOrderDirectoriesConstraintSOName : public cmOrderDirectoriesConstraint
public:
cmOrderDirectoriesConstraintSOName(cmOrderDirectories* od,
std::string const& file,
- const char* soname)
+ char const* soname)
: cmOrderDirectoriesConstraint(od, file)
, SOName(soname ? soname : "")
{
@@ -242,8 +242,8 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)
}
cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg,
- const cmGeneratorTarget* target,
- const char* purpose)
+ cmGeneratorTarget const* target,
+ char const* purpose)
{
this->GlobalGenerator = gg;
this->Target = target;
@@ -265,10 +265,10 @@ std::vector<std::string> const& cmOrderDirectories::GetOrderedDirectories()
}
void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
- const char* soname)
+ char const* soname)
{
// Add the runtime library at most once.
- if (this->EmmittedConstraintSOName.insert(fullPath).second) {
+ if (this->EmittedConstraintSOName.insert(fullPath).second) {
// Implicit link directories need special handling.
if (!this->ImplicitDirectories.empty()) {
std::string dir = cmSystemTools::GetFilenamePath(fullPath);
@@ -309,7 +309,7 @@ void cmOrderDirectories::AddLinkLibrary(std::string const& fullPath)
assert(!this->LinkExtensions.empty());
// Add the link library at most once.
- if (this->EmmittedConstraintLibrary.insert(fullPath).second) {
+ if (this->EmittedConstraintLibrary.insert(fullPath).second) {
// Implicit link directories need special handling.
if (!this->ImplicitDirectories.empty()) {
std::string dir = cmSystemTools::GetFilenamePath(fullPath);
@@ -371,7 +371,7 @@ void cmOrderDirectories::CollectOriginalDirectories()
this->AddOriginalDirectories(this->UserDirectories);
// Add directories containing constraints.
- for (const auto& entry : this->ConstraintEntries) {
+ for (auto const& entry : this->ConstraintEntries) {
entry->AddDirectory();
}
@@ -456,7 +456,7 @@ void cmOrderDirectories::FindImplicitConflicts()
// Check for items in implicit link directories that have conflicts
// in the explicit directories.
std::ostringstream conflicts;
- for (const auto& entry : this->ImplicitDirEntries) {
+ for (auto const& entry : this->ImplicitDirEntries) {
entry->FindImplicitConflicts(conflicts);
}
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 7788ea8..ea1b845 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,12 +24,12 @@ class cmOrderDirectories
{
public:
cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target,
- const char* purpose);
+ char const* purpose);
~cmOrderDirectories();
- cmOrderDirectories(const cmOrderDirectories&) = delete;
- cmOrderDirectories& operator=(const cmOrderDirectories&) = delete;
+ cmOrderDirectories(cmOrderDirectories const&) = delete;
+ cmOrderDirectories& operator=(cmOrderDirectories const&) = delete;
void AddRuntimeLibrary(std::string const& fullPath,
- const char* soname = nullptr);
+ char const* soname = nullptr);
void AddLinkLibrary(std::string const& fullPath);
void AddUserDirectories(std::vector<std::string> const& extra);
void AddLanguageDirectories(std::vector<std::string> const& dirs);
@@ -54,8 +54,8 @@ private:
cmsys::RegularExpression RemoveLibraryExtension;
std::vector<std::string> LinkExtensions;
std::set<std::string> ImplicitDirectories;
- std::set<std::string> EmmittedConstraintSOName;
- std::set<std::string> EmmittedConstraintLibrary;
+ std::set<std::string> EmittedConstraintSOName;
+ std::set<std::string> EmittedConstraintLibrary;
std::vector<std::string> OriginalDirectories;
std::map<std::string, int> DirectoryIndex;
std::vector<int> DirectoryVisited;
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 9aac273..35975f8 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmOutputConverter.h"
#include <algorithm>
@@ -154,7 +154,7 @@ std::string cmOutputConverter::MaybeRelativeToCurBinDir(
}
std::string cmOutputConverter::ConvertToOutputForExisting(
- const std::string& remote, OutputFormat format, bool useWatcomQuote) const
+ std::string const& remote, OutputFormat format, bool useWatcomQuote) const
{
#ifdef _WIN32
// Cache the Short Paths since we only convert the same few paths anyway and
@@ -300,7 +300,7 @@ std::string cmOutputConverter::EscapeForCMake(cm::string_view str,
{
// Always double-quote the argument to take care of most escapes.
std::string result = (wrapQuotes == WrapQuotes::Wrap) ? "\"" : "";
- for (const char c : str) {
+ for (char const c : str) {
if (c == '"') {
// Escape the double quote to avoid ending the argument.
result += "\\\"";
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 424f004..d0e7862 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -54,7 +54,7 @@ public:
std::string ConvertDirectorySeparatorsForShell(cm::string_view source) const;
//! for existing files convert to output path and short path if spaces
- std::string ConvertToOutputForExisting(const std::string& remote,
+ std::string ConvertToOutputForExisting(std::string const& remote,
OutputFormat format = SHELL,
bool useWatcomQuote = false) const;
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
deleted file mode 100644
index aa3155a..0000000
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ /dev/null
@@ -1,514 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmOutputRequiredFilesCommand.h"
-
-#include <cstdio>
-#include <map>
-#include <set>
-#include <unordered_map>
-#include <utility>
-
-#include <cm/memory>
-
-#include "cmsys/FStream.hxx"
-#include "cmsys/RegularExpression.hxx"
-
-#include "cmExecutionStatus.h"
-#include "cmGeneratorExpression.h"
-#include "cmList.h"
-#include "cmMakefile.h"
-#include "cmSourceFile.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmTarget.h"
-#include "cmValue.h"
-
-namespace {
-/** \class cmDependInformation
- * \brief Store dependency information for a single source file.
- *
- * This structure stores the depend information for a single source file.
- */
-class cmDependInformation
-{
-public:
- /**
- * Construct with dependency generation marked not done; instance
- * not placed in cmMakefile's list.
- */
- cmDependInformation() = default;
-
- /**
- * The set of files on which this one depends.
- */
- using DependencySetType = std::set<cmDependInformation*>;
- DependencySetType DependencySet;
-
- /**
- * This flag indicates whether dependency checking has been
- * performed for this file.
- */
- bool DependDone = false;
-
- /**
- * If this object corresponds to a cmSourceFile instance, this points
- * to it.
- */
- const cmSourceFile* SourceFile = nullptr;
-
- /**
- * Full path to this file.
- */
- std::string FullPath;
-
- /**
- * Full path not including file name.
- */
- std::string PathOnly;
-
- /**
- * Name used to #include this file.
- */
- std::string IncludeName;
-
- /**
- * This method adds the dependencies of another file to this one.
- */
- void AddDependencies(cmDependInformation* info)
- {
- if (this != info) {
- this->DependencySet.insert(info);
- }
- }
-};
-
-class cmLBDepend
-{
-public:
- /**
- * Construct the object with verbose turned off.
- */
- cmLBDepend()
- {
- this->Verbose = false;
- this->IncludeFileRegularExpression.compile("^.*$");
- this->ComplainFileRegularExpression.compile("^$");
- }
-
- /**
- * Destructor.
- */
- ~cmLBDepend() = default;
-
- cmLBDepend(const cmLBDepend&) = delete;
- cmLBDepend& operator=(const cmLBDepend&) = delete;
-
- /**
- * Set the makefile that is used as a source of classes.
- */
- void SetMakefile(cmMakefile* makefile)
- {
- this->Makefile = makefile;
-
- // Now extract the include file regular expression from the makefile.
- this->IncludeFileRegularExpression.compile(
- this->Makefile->GetIncludeRegularExpression());
- this->ComplainFileRegularExpression.compile(
- this->Makefile->GetComplainRegularExpression());
-
- // Now extract any include paths from the targets
- std::set<std::string> uniqueIncludes;
- std::vector<std::string> orderedAndUniqueIncludes;
- for (auto const& target : this->Makefile->GetTargets()) {
- cmValue incDirProp = target.second.GetProperty("INCLUDE_DIRECTORIES");
- if (!incDirProp) {
- continue;
- }
-
- std::string incDirs = cmGeneratorExpression::Preprocess(
- *incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions);
-
- cmList includes{ incDirs };
-
- for (auto& path : includes) {
- this->Makefile->ExpandVariablesInString(path);
- if (uniqueIncludes.insert(path).second) {
- orderedAndUniqueIncludes.push_back(path);
- }
- }
- }
-
- for (std::string const& inc : orderedAndUniqueIncludes) {
- this->AddSearchPath(inc);
- }
- }
-
- /**
- * Add a directory to the search path for include files.
- */
- void AddSearchPath(const std::string& path)
- {
- this->IncludeDirectories.push_back(path);
- }
-
- /**
- * Generate dependencies for the file given. Returns a pointer to
- * the cmDependInformation object for the file.
- */
- const cmDependInformation* FindDependencies(const std::string& file)
- {
- cmDependInformation* info = this->GetDependInformation(file, "");
- this->GenerateDependInformation(info);
- return info;
- }
-
-protected:
- /**
- * Compute the depend information for this class.
- */
-
- void DependWalk(cmDependInformation* info)
- {
- cmsys::ifstream fin(info->FullPath.c_str());
- if (!fin) {
- cmSystemTools::Error("error can not open " + info->FullPath);
- return;
- }
-
- std::string line;
- while (cmSystemTools::GetLineFromStream(fin, line)) {
- if (cmHasLiteralPrefix(line, "#include")) {
- // if it is an include line then create a string class
- size_t qstart = line.find('\"', 8);
- size_t qend;
- // if a quote is not found look for a <
- if (qstart == std::string::npos) {
- qstart = line.find('<', 8);
- // if a < is not found then move on
- if (qstart == std::string::npos) {
- cmSystemTools::Error("unknown include directive " + line);
- continue;
- }
- qend = line.find('>', qstart + 1);
- } else {
- qend = line.find('\"', qstart + 1);
- }
- // extract the file being included
- std::string includeFile = line.substr(qstart + 1, qend - qstart - 1);
- // see if the include matches the regular expression
- if (!this->IncludeFileRegularExpression.find(includeFile)) {
- if (this->Verbose) {
- std::string message =
- cmStrCat("Skipping ", includeFile, " for file ", info->FullPath);
- cmSystemTools::Error(message);
- }
- continue;
- }
-
- // Add this file and all its dependencies.
- this->AddDependency(info, includeFile);
- /// add the cxx file if it exists
- std::string cxxFile = includeFile;
- std::string::size_type pos = cxxFile.rfind('.');
- if (pos != std::string::npos) {
- std::string root = cxxFile.substr(0, pos);
- cxxFile = root + ".cxx";
- bool found = false;
- // try jumping to .cxx .cpp and .c in order
- if (cmSystemTools::FileExists(cxxFile)) {
- found = true;
- }
- for (std::string const& path : this->IncludeDirectories) {
- if (cmSystemTools::FileExists(cmStrCat(path, "/", cxxFile))) {
- found = true;
- }
- }
- if (!found) {
- cxxFile = root + ".cpp";
- if (cmSystemTools::FileExists(cxxFile)) {
- found = true;
- }
- for (std::string const& path : this->IncludeDirectories) {
- if (cmSystemTools::FileExists(cmStrCat(path, "/", cxxFile))) {
- found = true;
- }
- }
- }
- if (!found) {
- cxxFile = root + ".c";
- if (cmSystemTools::FileExists(cxxFile)) {
- found = true;
- }
- for (std::string const& path : this->IncludeDirectories) {
- if (cmSystemTools::FileExists(cmStrCat(path, "/", cxxFile))) {
- found = true;
- }
- }
- }
- if (!found) {
- cxxFile = root + ".txx";
- if (cmSystemTools::FileExists(cxxFile)) {
- found = true;
- }
- for (std::string const& path : this->IncludeDirectories) {
- if (cmSystemTools::FileExists(cmStrCat(path, "/", cxxFile))) {
- found = true;
- }
- }
- }
- if (found) {
- this->AddDependency(info, cxxFile);
- }
- }
- }
- }
- }
-
- /**
- * Add a dependency. Possibly walk it for more dependencies.
- */
- void AddDependency(cmDependInformation* info, const std::string& file)
- {
- cmDependInformation* dependInfo =
- this->GetDependInformation(file, info->PathOnly);
- this->GenerateDependInformation(dependInfo);
- info->AddDependencies(dependInfo);
- }
-
- /**
- * Fill in the given object with dependency information. If the
- * information is already complete, nothing is done.
- */
- void GenerateDependInformation(cmDependInformation* info)
- {
- // If dependencies are already done, stop now.
- if (info->DependDone) {
- return;
- }
- // Make sure we don't visit the same file more than once.
- info->DependDone = true;
-
- const std::string& path = info->FullPath;
- if (path.empty()) {
- cmSystemTools::Error(
- "Attempt to find dependencies for file without path!");
- return;
- }
-
- bool found = false;
-
- // If the file exists, use it to find dependency information.
- if (cmSystemTools::FileExists(path, true)) {
- // Use the real file to find its dependencies.
- this->DependWalk(info);
- found = true;
- }
-
- // See if the cmSourceFile for it has any files specified as
- // dependency hints.
- if (info->SourceFile) {
-
- // Get the cmSourceFile corresponding to this.
- const cmSourceFile& cFile = *(info->SourceFile);
- // See if there are any hints for finding dependencies for the missing
- // file.
- if (!cFile.GetDepends().empty()) {
- // Dependency hints have been given. Use them to begin the
- // recursion.
- for (std::string const& file : cFile.GetDepends()) {
- this->AddDependency(info, file);
- }
-
- // Found dependency information. We are done.
- found = true;
- }
- }
-
- if (!found) {
- // Try to find the file amongst the sources
- cmSourceFile* srcFile = this->Makefile->GetSource(
- cmSystemTools::GetFilenameWithoutExtension(path));
- if (srcFile) {
- if (srcFile->ResolveFullPath() == path) {
- found = true;
- } else {
- // try to guess which include path to use
- for (std::string incpath : this->IncludeDirectories) {
- if (!incpath.empty() && incpath.back() != '/') {
- incpath += "/";
- }
- incpath += path;
- if (srcFile->ResolveFullPath() == incpath) {
- // set the path to the guessed path
- info->FullPath = incpath;
- found = true;
- }
- }
- }
- }
- }
-
- if (!found) {
- // Couldn't find any dependency information.
- if (this->ComplainFileRegularExpression.find(info->IncludeName)) {
- cmSystemTools::Error("error cannot find dependencies for " + path);
- } else {
- // Destroy the name of the file so that it won't be output as a
- // dependency.
- info->FullPath.clear();
- }
- }
- }
-
- /**
- * Get an instance of cmDependInformation corresponding to the given file
- * name.
- */
- cmDependInformation* GetDependInformation(const std::string& file,
- const std::string& extraPath)
- {
- // Get the full path for the file so that lookup is unambiguous.
- std::string fullPath = this->FullPath(file, extraPath);
-
- // Try to find the file's instance of cmDependInformation.
- auto result = this->DependInformationMap.find(fullPath);
- if (result != this->DependInformationMap.end()) {
- // Found an instance, return it.
- return result->second.get();
- }
- // Didn't find an instance. Create a new one and save it.
- auto info = cm::make_unique<cmDependInformation>();
- auto* ptr = info.get();
- info->FullPath = fullPath;
- info->PathOnly = cmSystemTools::GetFilenamePath(fullPath);
- info->IncludeName = file;
- this->DependInformationMap[fullPath] = std::move(info);
- return ptr;
- }
-
- /**
- * Find the full path name for the given file name.
- * This uses the include directories.
- * TODO: Cache path conversions to reduce FileExists calls.
- */
- std::string FullPath(const std::string& fname, const std::string& extraPath)
- {
- auto m = this->DirectoryToFileToPathMap.find(extraPath);
-
- if (m != this->DirectoryToFileToPathMap.end()) {
- FileToPathMapType& map = m->second;
- auto p = map.find(fname);
- if (p != map.end()) {
- return p->second;
- }
- }
-
- if (cmSystemTools::FileExists(fname, true)) {
- std::string fp = cmSystemTools::CollapseFullPath(fname);
- this->DirectoryToFileToPathMap[extraPath][fname] = fp;
- return fp;
- }
-
- for (std::string path : this->IncludeDirectories) {
- if (!path.empty() && path.back() != '/') {
- path += "/";
- }
- path += fname;
- if (cmSystemTools::FileExists(path, true)) {
- std::string fp = cmSystemTools::CollapseFullPath(path);
- this->DirectoryToFileToPathMap[extraPath][fname] = fp;
- return fp;
- }
- }
-
- if (!extraPath.empty()) {
- std::string path = extraPath;
- if (!path.empty() && path.back() != '/') {
- path = path + "/";
- }
- path = path + fname;
- if (cmSystemTools::FileExists(path, true)) {
- std::string fp = cmSystemTools::CollapseFullPath(path);
- this->DirectoryToFileToPathMap[extraPath][fname] = fp;
- return fp;
- }
- }
-
- // Couldn't find the file.
- return fname;
- }
-
- cmMakefile* Makefile;
- bool Verbose;
- cmsys::RegularExpression IncludeFileRegularExpression;
- cmsys::RegularExpression ComplainFileRegularExpression;
- std::vector<std::string> IncludeDirectories;
- using FileToPathMapType = std::map<std::string, std::string>;
- using DirectoryToFileToPathMapType =
- std::map<std::string, FileToPathMapType>;
- using DependInformationMapType =
- std::map<std::string, std::unique_ptr<cmDependInformation>>;
- DependInformationMapType DependInformationMap;
- DirectoryToFileToPathMapType DirectoryToFileToPathMap;
-};
-
-void ListDependencies(cmDependInformation const* info, FILE* fout,
- std::set<cmDependInformation const*>* visited);
-}
-
-// cmOutputRequiredFilesCommand
-bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.size() != 2) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- // store the arg for final pass
- const std::string& file = args[0];
- const std::string& outputFile = args[1];
-
- // compute the list of files
- cmLBDepend md;
- md.SetMakefile(&status.GetMakefile());
- md.AddSearchPath(status.GetMakefile().GetCurrentSourceDirectory());
- // find the depends for a file
- const cmDependInformation* info = md.FindDependencies(file);
- if (info) {
- // write them out
- FILE* fout = cmsys::SystemTools::Fopen(outputFile, "w");
- if (!fout) {
- status.SetError(cmStrCat("Can not open output file: ", outputFile));
- return false;
- }
- std::set<cmDependInformation const*> visited;
- ListDependencies(info, fout, &visited);
- fclose(fout);
- }
-
- return true;
-}
-
-namespace {
-void ListDependencies(cmDependInformation const* info, FILE* fout,
- std::set<cmDependInformation const*>* visited)
-{
- // add info to the visited set
- visited->insert(info);
- // now recurse with info's dependencies
- for (cmDependInformation* d : info->DependencySet) {
- if (visited->find(d) == visited->end()) {
- if (!info->FullPath.empty()) {
- std::string tmp = d->FullPath;
- std::string::size_type pos = tmp.rfind('.');
- if (pos != std::string::npos && (tmp.substr(pos) != ".h")) {
- tmp = tmp.substr(0, pos);
- fprintf(fout, "%s\n", d->FullPath.c_str());
- }
- }
- ListDependencies(d, fout, visited);
- }
- }
-}
-}
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
deleted file mode 100644
index 9daba8f..0000000
--- a/Source/cmOutputRequiredFilesCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmPackageInfoReader.cxx b/Source/cmPackageInfoReader.cxx
new file mode 100644
index 0000000..3d20c48
--- /dev/null
+++ b/Source/cmPackageInfoReader.cxx
@@ -0,0 +1,788 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#include "cmPackageInfoReader.h"
+
+#include <initializer_list>
+#include <limits>
+#include <unordered_map>
+#include <utility>
+
+#include <cmext/string_view>
+
+#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
+#include <cm3p/json/version.h>
+
+#include "cmsys/FStream.hxx"
+#include "cmsys/RegularExpression.hxx"
+
+#include "cmExecutionStatus.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+
+namespace {
+
+// Map of CPS language names to CMake language name. Case insensitivity is
+// achieved by converting the CPS value to lower case, so keys in this map must
+// be lower case.
+std::unordered_map<std::string, std::string> Languages = {
+ // clang-format off
+ { "c", "C" },
+ { "c++", "CXX" },
+ { "cpp", "CXX" },
+ { "cxx", "CXX" },
+ { "objc", "OBJC" },
+ { "objc++", "OBJCXX" },
+ { "objcpp", "OBJCXX" },
+ { "objcxx", "OBJCXX" },
+ { "swift", "swift" },
+ { "hip", "HIP" },
+ { "cuda", "CUDA" },
+ { "ispc", "ISPC" },
+ { "c#", "CSharp" },
+ { "csharp", "CSharp" },
+ { "fortran", "Fortran" },
+ // clang-format on
+};
+
+enum LanguageGlobOption
+{
+ DisallowGlob,
+ AllowGlob,
+};
+
+cm::string_view MapLanguage(cm::string_view lang,
+ LanguageGlobOption glob = AllowGlob)
+{
+ if (glob == AllowGlob && lang == "*"_s) {
+ return "*"_s;
+ }
+ auto const li = Languages.find(cmSystemTools::LowerCase(lang));
+ if (li != Languages.end()) {
+ return li->second;
+ }
+ return {};
+}
+
+std::string GetRealPath(std::string const& path)
+{
+ return cmSystemTools::GetRealPath(path);
+}
+
+std::string GetRealDir(std::string const& path)
+{
+ return cmSystemTools::GetFilenamePath(cmSystemTools::GetRealPath(path));
+}
+
+Json::Value ReadJson(std::string const& fileName)
+{
+ // Open the specified file.
+ cmsys::ifstream file(fileName.c_str(), std::ios::in | std::ios::binary);
+ if (!file) {
+#if JSONCPP_VERSION_HEXA < 0x01070300
+ return Json::Value::null;
+#else
+ return Json::Value::nullSingleton();
+#endif
+ }
+
+ // Read file content and translate JSON.
+ Json::Value data;
+ Json::CharReaderBuilder builder;
+ builder["collectComments"] = false;
+ if (!Json::parseFromStream(builder, file, &data, nullptr)) {
+#if JSONCPP_VERSION_HEXA < 0x01070300
+ return Json::Value::null;
+#else
+ return Json::Value::nullSingleton();
+#endif
+ }
+
+ return data;
+}
+
+bool CheckSchemaVersion(Json::Value const& data)
+{
+ std::string const& version = data["cps_version"].asString();
+
+ // Check that a valid version is specified.
+ if (version.empty()) {
+ return false;
+ }
+
+ // Check that we understand this version.
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
+ version, "0.13") &&
+ cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, version, "1");
+
+ // TODO Eventually this probably needs to return the version tuple, and
+ // should share code with cmPackageInfoReader::ParseVersion.
+}
+
+bool ComparePathSuffix(std::string const& path, std::string const& suffix)
+{
+ std::string const& tail = path.substr(path.size() - suffix.size());
+ return cmSystemTools::ComparePath(tail, suffix);
+}
+
+std::string DeterminePrefix(std::string const& filepath,
+ Json::Value const& data)
+{
+ // First check if an absolute prefix was supplied.
+ std::string prefix = data["prefix"].asString();
+ if (!prefix.empty()) {
+ // Ensure that the specified prefix is valid.
+ if (cmsys::SystemTools::FileIsFullPath(prefix) &&
+ cmsys::SystemTools::FileIsDirectory(prefix)) {
+ cmSystemTools::ConvertToUnixSlashes(prefix);
+ return prefix;
+ }
+ // The specified absolute prefix is not valid.
+ return {};
+ }
+
+ // Get and validate prefix-relative path.
+ std::string const& absPath = cmSystemTools::GetFilenamePath(filepath);
+ std::string relPath = data["cps_path"].asString();
+ cmSystemTools::ConvertToUnixSlashes(relPath);
+ if (relPath.empty() || !cmHasLiteralPrefix(relPath, "@prefix@")) {
+ // The relative prefix is not valid.
+ return {};
+ }
+ if (relPath.size() == 8) {
+ // The relative path is exactly "@prefix@".
+ return absPath;
+ }
+ if (relPath[8] != '/') {
+ // The relative prefix is not valid.
+ return {};
+ }
+ relPath = relPath.substr(8);
+
+ // Get directory portion of the absolute path.
+ if (ComparePathSuffix(absPath, relPath)) {
+ return absPath.substr(0, absPath.size() - relPath.size());
+ }
+
+ for (auto* const f : { GetRealPath, GetRealDir }) {
+ std::string const& tmpPath = (*f)(absPath);
+ if (!cmSystemTools::ComparePath(tmpPath, absPath) &&
+ ComparePathSuffix(tmpPath, relPath)) {
+ return tmpPath.substr(0, tmpPath.size() - relPath.size());
+ }
+ }
+
+ return {};
+}
+
+// Extract key name from value iterator as string_view.
+cm::string_view IterKey(Json::Value::const_iterator const& iter)
+{
+ char const* end;
+ char const* const start = iter.memberName(&end);
+ return { start, static_cast<std::string::size_type>(end - start) };
+}
+
+// Get list-of-strings value from object.
+std::vector<std::string> ReadList(Json::Value const& arr)
+{
+ std::vector<std::string> result;
+
+ if (arr.isArray()) {
+ for (Json::Value const& val : arr) {
+ if (val.isString()) {
+ result.push_back(val.asString());
+ }
+ }
+ }
+
+ return result;
+}
+
+std::vector<std::string> ReadList(Json::Value const& data, char const* key)
+{
+ return ReadList(data[key]);
+}
+
+std::string NormalizeTargetName(std::string const& name,
+ std::string const& context)
+{
+ if (cmHasLiteralPrefix(name, ":")) {
+ return cmStrCat(context, ':', name);
+ }
+
+ std::string::size_type const n = name.find_first_of(':');
+ if (n != std::string::npos) {
+ cm::string_view v{ name };
+ return cmStrCat(v.substr(0, n), ':', v.substr(n));
+ }
+ return name;
+}
+
+void AppendProperty(cmMakefile* makefile, cmTarget* target,
+ cm::string_view property, cm::string_view configuration,
+ std::string const& value)
+{
+ std::string fullprop;
+ if (configuration.empty()) {
+ fullprop = cmStrCat("INTERFACE_"_s, property);
+ } else {
+ fullprop = cmStrCat("INTERFACE_"_s, property, '_',
+ cmSystemTools::UpperCase(configuration));
+ }
+
+ target->AppendProperty(fullprop, value, makefile->GetBacktrace());
+}
+
+template <typename Transform>
+void AppendLanguageProperties(cmMakefile* makefile, cmTarget* target,
+ cm::string_view property,
+ cm::string_view configuration,
+ Json::Value const& data, char const* key,
+ Transform transform)
+{
+ Json::Value const& value = data[key];
+ if (value.isArray()) {
+ for (std::string v : ReadList(value)) {
+ AppendProperty(makefile, target, property, configuration,
+ transform(std::move(v)));
+ }
+ } else if (value.isObject()) {
+ for (auto vi = value.begin(), ve = value.end(); vi != ve; ++vi) {
+ cm::string_view const originalLang = IterKey(vi);
+ cm::string_view const lang = MapLanguage(originalLang);
+ if (lang.empty()) {
+ makefile->IssueMessage(MessageType::WARNING,
+ cmStrCat(R"(ignoring unknown language ")"_s,
+ originalLang, R"(" in )"_s, key,
+ " for "_s, target->GetName()));
+ continue;
+ }
+
+ if (lang == "*"_s) {
+ for (std::string v : ReadList(*vi)) {
+ AppendProperty(makefile, target, property, configuration,
+ transform(std::move(v)));
+ }
+ } else {
+ for (std::string v : ReadList(*vi)) {
+ v = cmStrCat("$<$<COMPILE_LANGUAGE:"_s, lang, ">:"_s,
+ transform(std::move(v)), '>');
+ AppendProperty(makefile, target, property, configuration, v);
+ }
+ }
+ }
+ }
+}
+
+void AddCompileFeature(cmMakefile* makefile, cmTarget* target,
+ cm::string_view configuration, std::string const& value)
+{
+ auto reLanguageLevel = []() -> cmsys::RegularExpression {
+ static cmsys::RegularExpression re{ "^[Cc]([+][+])?([0-9][0-9])$" };
+ return re;
+ }();
+
+ if (reLanguageLevel.find(value)) {
+ std::string::size_type const n = reLanguageLevel.end() - 2;
+ cm::string_view const featurePrefix = (n == 3 ? "cxx_std_"_s : "c_std_"_s);
+ if (configuration.empty()) {
+ AppendProperty(makefile, target, "COMPILE_FEATURES"_s, {},
+ cmStrCat(featurePrefix, value.substr(n)));
+ } else {
+ std::string const& feature =
+ cmStrCat("$<$<CONFIG:"_s, configuration, ">:"_s, featurePrefix,
+ value.substr(n), '>');
+ AppendProperty(makefile, target, "COMPILE_FEATURES"_s, {}, feature);
+ }
+ } else if (cmStrCaseEq(value, "gnu"_s)) {
+ // Not implemented in CMake at this time
+ } else if (cmStrCaseEq(value, "threads"_s)) {
+ AppendProperty(makefile, target, "LINK_LIBRARIES"_s, configuration,
+ "Threads::Threads");
+ }
+}
+
+void AddLinkFeature(cmMakefile* makefile, cmTarget* target,
+ cm::string_view configuration, std::string const& value)
+{
+ if (cmStrCaseEq(value, "thread"_s)) {
+ AppendProperty(makefile, target, "LINK_LIBRARIES"_s, configuration,
+ "Threads::Threads");
+ }
+}
+
+std::string BuildDefinition(std::string const& name, Json::Value const& value)
+{
+ if (!value.isNull() && value.isConvertibleTo(Json::stringValue)) {
+ return cmStrCat(name, '=', value.asString());
+ }
+ return name;
+}
+
+void AddDefinition(cmMakefile* makefile, cmTarget* target,
+ cm::string_view configuration,
+ std::string const& definition)
+{
+ AppendProperty(makefile, target, "COMPILE_DEFINITIONS"_s, configuration,
+ definition);
+}
+
+using DefinitionLanguageMap = std::map<cm::string_view, Json::Value>;
+using DefinitionsMap = std::map<std::string, DefinitionLanguageMap>;
+
+void AddDefinitions(cmMakefile* makefile, cmTarget* target,
+ cm::string_view configuration,
+ DefinitionsMap const& definitions)
+{
+ for (auto const& di : definitions) {
+ auto const& g = di.second.find("*"_s);
+ if (g != di.second.end()) {
+ std::string const& def = BuildDefinition(di.first, g->second);
+ if (di.second.size() == 1) {
+ // Only the non-language-specific definition exists.
+ AddDefinition(makefile, target, configuration, def);
+ continue;
+ }
+
+ // Create a genex to apply this definition to all languages except
+ // those that override it.
+ std::vector<cm::string_view> excludedLanguages;
+ for (auto const& li : di.second) {
+ if (li.first != "*"_s) {
+ excludedLanguages.emplace_back(li.first);
+ }
+ }
+ AddDefinition(makefile, target, configuration,
+ cmStrCat("$<$<NOT:$<COMPILE_LANGUAGE:"_s,
+ cmJoin(excludedLanguages, ","_s), ">>:"_s, def,
+ '>'));
+ }
+
+ // Add language-specific definitions.
+ for (auto const& li : di.second) {
+ if (li.first != "*"_s) {
+ AddDefinition(makefile, target, configuration,
+ cmStrCat("$<$<COMPILE_LANGUAGE:"_s, li.first, ">:"_s,
+ BuildDefinition(di.first, li.second), '>'));
+ }
+ }
+ }
+}
+
+cm::optional<cmPackageInfoReader::Pep440Version> ParseSimpleVersion(
+ std::string const& version)
+{
+ if (version.empty()) {
+ return cm::nullopt;
+ }
+
+ cmPackageInfoReader::Pep440Version result;
+ result.Simple = true;
+
+ cm::string_view remnant{ version };
+ for (;;) {
+ // Find the next part separator.
+ std::string::size_type const n = remnant.find_first_of(".+-"_s);
+ if (n == 0) {
+ // The part is an empty string.
+ return cm::nullopt;
+ }
+
+ // Extract the part as a number.
+ cm::string_view const part = remnant.substr(0, n);
+ std::string::size_type const l = part.size();
+ std::string::size_type p;
+ unsigned long const value = std::stoul(std::string{ part }, &p);
+ if (p != l || value > std::numeric_limits<unsigned>::max()) {
+ // The part was not a valid number or is too big.
+ return cm::nullopt;
+ }
+ result.ReleaseComponents.push_back(static_cast<unsigned>(value));
+
+ // Have we consumed the entire input?
+ if (n == std::string::npos) {
+ return { std::move(result) };
+ }
+
+ // Lop off the current part.
+ char const sep = remnant[n];
+ remnant = remnant.substr(n + 1);
+ if (sep == '+' || sep == '-') {
+ // If we hit the local label, we're done.
+ result.LocalLabel = remnant;
+ return { std::move(result) };
+ }
+
+ // We just consumed a '.'; check that there's more.
+ if (remnant.empty()) {
+ // A trailing part separator is not allowed.
+ return cm::nullopt;
+ }
+
+ // Continue with the remaining input.
+ }
+
+ // Unreachable.
+}
+
+} // namespace
+
+std::unique_ptr<cmPackageInfoReader> cmPackageInfoReader::Read(
+ std::string const& path, cmPackageInfoReader const* parent)
+{
+ // Read file and perform some basic validation:
+ // - the input is valid JSON
+ // - the input is a JSON object
+ // - the input has a "cps_version" that we (in theory) know how to parse
+ Json::Value data = ReadJson(path);
+ if (!data.isObject() || (!parent && !CheckSchemaVersion(data))) {
+ return nullptr;
+ }
+
+ // - the input has a "name" attribute that is a non-empty string
+ Json::Value const& name = data["name"];
+ if (!name.isString() || name.empty()) {
+ return nullptr;
+ }
+
+ // - the input has a "components" attribute that is a JSON object
+ if (!data["components"].isObject()) {
+ return nullptr;
+ }
+
+ std::string prefix = (parent ? parent->Prefix : DeterminePrefix(path, data));
+ if (prefix.empty()) {
+ return nullptr;
+ }
+
+ // Seems sane enough to hand back to the caller.
+ std::unique_ptr<cmPackageInfoReader> reader{ new cmPackageInfoReader };
+ reader->Data = std::move(data);
+ reader->Prefix = std::move(prefix);
+ reader->Path = path;
+
+ // Determine other information we need to know immediately, or (if this is
+ // a supplemental reader) copy from the parent.
+ if (parent) {
+ reader->ComponentTargets = parent->ComponentTargets;
+ reader->DefaultConfigurations = parent->DefaultConfigurations;
+ } else {
+ for (std::string const& config :
+ ReadList(reader->Data, "configurations")) {
+ reader->DefaultConfigurations.emplace_back(
+ cmSystemTools::UpperCase(config));
+ }
+ }
+
+ return reader;
+}
+
+std::string cmPackageInfoReader::GetName() const
+{
+ return this->Data["name"].asString();
+}
+
+cm::optional<std::string> cmPackageInfoReader::GetVersion() const
+{
+ Json::Value const& version = this->Data["version"];
+ if (version.isString()) {
+ return version.asString();
+ }
+ return cm::nullopt;
+}
+
+cm::optional<std::string> cmPackageInfoReader::GetCompatVersion() const
+{
+ Json::Value const& version = this->Data["compat_version"];
+ if (version.isString()) {
+ return version.asString();
+ }
+ return cm::nullopt;
+}
+
+cm::optional<cmPackageInfoReader::Pep440Version>
+cmPackageInfoReader::ParseVersion(
+ cm::optional<std::string> const& version) const
+{
+ // Check that we have a version.
+ if (!version) {
+ return cm::nullopt;
+ }
+
+ // Check if we know how to parse the version.
+ Json::Value const& schema = this->Data["version_schema"];
+ if (schema.isNull() || cmStrCaseEq(schema.asString(), "simple"_s)) {
+ return ParseSimpleVersion(*version);
+ }
+
+ return cm::nullopt;
+}
+
+std::vector<cmPackageRequirement> cmPackageInfoReader::GetRequirements() const
+{
+ std::vector<cmPackageRequirement> requirements;
+
+ auto const& requirementObjects = this->Data["requires"];
+
+ for (auto ri = requirementObjects.begin(), re = requirementObjects.end();
+ ri != re; ++ri) {
+ cmPackageRequirement r{ ri.name(), (*ri)["version"].asString(),
+ ReadList(*ri, "components"),
+ ReadList(*ri, "hints") };
+ requirements.emplace_back(std::move(r));
+ }
+
+ return requirements;
+}
+
+std::vector<std::string> cmPackageInfoReader::GetComponentNames() const
+{
+ std::vector<std::string> componentNames;
+
+ Json::Value const& components = this->Data["components"];
+ for (auto ci = components.begin(), ce = components.end(); ci != ce; ++ci) {
+ componentNames.emplace_back(ci.name());
+ }
+
+ return componentNames;
+}
+
+std::string cmPackageInfoReader::ResolvePath(std::string path) const
+{
+ cmSystemTools::ConvertToUnixSlashes(path);
+ if (cmHasPrefix(path, "@prefix@"_s)) {
+ return cmStrCat(this->Prefix, path.substr(8));
+ }
+ if (!cmSystemTools::FileIsFullPath(path)) {
+ return cmStrCat(cmSystemTools::GetFilenamePath(this->Path), '/', path);
+ }
+ return path;
+}
+
+void cmPackageInfoReader::SetOptionalProperty(cmTarget* target,
+ cm::string_view property,
+ cm::string_view configuration,
+ Json::Value const& value) const
+{
+ if (!value.isNull()) {
+ std::string fullprop;
+ if (configuration.empty()) {
+ fullprop = cmStrCat("IMPORTED_"_s, property);
+ } else {
+ fullprop = cmStrCat("IMPORTED_"_s, property, '_',
+ cmSystemTools::UpperCase(configuration));
+ }
+
+ target->SetProperty(fullprop, this->ResolvePath(value.asString()));
+ }
+}
+
+void cmPackageInfoReader::SetTargetProperties(
+ cmMakefile* makefile, cmTarget* target, Json::Value const& data,
+ std::string const& package, cm::string_view configuration) const
+{
+ // Add configuration (if applicable).
+ if (!configuration.empty()) {
+ target->AppendProperty("IMPORTED_CONFIGURATIONS",
+ cmSystemTools::UpperCase(configuration),
+ makefile->GetBacktrace());
+ }
+
+ // Add compile and link features.
+ for (std::string const& def : ReadList(data, "compile_features")) {
+ AddCompileFeature(makefile, target, configuration, def);
+ }
+
+ for (std::string const& def : ReadList(data, "link_features")) {
+ AddLinkFeature(makefile, target, configuration, def);
+ }
+
+ // Add compile definitions.
+ Json::Value const& defs = data["definitions"];
+ DefinitionsMap definitionsMap;
+ for (auto ldi = defs.begin(), lde = defs.end(); ldi != lde; ++ldi) {
+ cm::string_view const originalLang = IterKey(ldi);
+ cm::string_view const lang = MapLanguage(originalLang);
+ if (lang.empty()) {
+ makefile->IssueMessage(
+ MessageType::WARNING,
+ cmStrCat(R"(ignoring unknown language ")"_s, originalLang,
+ R"(" in definitions for )"_s, target->GetName()));
+ continue;
+ }
+
+ for (auto di = ldi->begin(), de = ldi->end(); di != de; ++di) {
+ definitionsMap[di.name()].emplace(lang, *di);
+ }
+ }
+ AddDefinitions(makefile, target, configuration, definitionsMap);
+
+ // Add include directories.
+ AppendLanguageProperties(makefile, target, "INCLUDE_DIRECTORIES"_s,
+ configuration, data, "includes",
+ [this](std::string p) -> std::string {
+ return this->ResolvePath(std::move(p));
+ });
+
+ // Add link name/location(s).
+ this->SetOptionalProperty(target, "LOCATION"_s, configuration,
+ data["location"]);
+
+ this->SetOptionalProperty(target, "IMPLIB"_s, configuration,
+ data["link_location"]);
+
+ this->SetOptionalProperty(target, "SONAME"_s, configuration,
+ data["link_name"]);
+
+ // Add link languages.
+ for (std::string const& originalLang : ReadList(data, "link_languages")) {
+ cm::string_view const lang = MapLanguage(originalLang, DisallowGlob);
+ if (!lang.empty()) {
+ AppendProperty(makefile, target, "LINK_LANGUAGES"_s, configuration,
+ std::string{ lang });
+ }
+ }
+
+ // Add transitive dependencies.
+ for (std::string const& dep : ReadList(data, "requires")) {
+ AppendProperty(makefile, target, "LINK_LIBRARIES"_s, configuration,
+ NormalizeTargetName(dep, package));
+ }
+
+ for (std::string const& dep : ReadList(data, "link_requires")) {
+ std::string const& lib =
+ cmStrCat("$<LINK_ONLY:"_s, NormalizeTargetName(dep, package), '>');
+ AppendProperty(makefile, target, "LINK_LIBRARIES"_s, configuration, lib);
+ }
+}
+
+cmTarget* cmPackageInfoReader::AddLibraryComponent(
+ cmMakefile* makefile, cmStateEnums::TargetType type, std::string const& name,
+ Json::Value const& data, std::string const& package) const
+{
+ // Create the imported target.
+ cmTarget* const target = makefile->AddImportedTarget(name, type, false);
+
+ // Set default configurations.
+ if (!this->DefaultConfigurations.empty()) {
+ target->SetProperty("IMPORTED_CONFIGURATIONS",
+ cmJoin(this->DefaultConfigurations, ";"_s));
+ }
+
+ // Set target properties.
+ this->SetTargetProperties(makefile, target, data, package, {});
+ auto const& cfgData = data["configurations"];
+ for (auto ci = cfgData.begin(), ce = cfgData.end(); ci != ce; ++ci) {
+ this->SetTargetProperties(makefile, target, *ci, package, IterKey(ci));
+ }
+
+ return target;
+}
+
+bool cmPackageInfoReader::ImportTargets(cmMakefile* makefile,
+ cmExecutionStatus& status)
+{
+ std::string const& package = this->GetName();
+
+ // Read components.
+ Json::Value const& components = this->Data["components"];
+
+ for (auto ci = components.begin(), ce = components.end(); ci != ce; ++ci) {
+ cm::string_view const& name = IterKey(ci);
+ std::string const& type =
+ cmSystemTools::LowerCase((*ci)["type"].asString());
+
+ // Get and validate full target name.
+ std::string const& fullName = cmStrCat(package, "::"_s, name);
+ {
+ std::string msg;
+ if (!makefile->EnforceUniqueName(fullName, msg)) {
+ status.SetError(msg);
+ return false;
+ }
+ }
+
+ cmTarget* target = nullptr;
+ if (type == "symbolic"_s) {
+ // TODO
+ } else if (type == "dylib"_s) {
+ target = this->AddLibraryComponent(
+ makefile, cmStateEnums::SHARED_LIBRARY, fullName, *ci, package);
+ } else if (type == "module"_s) {
+ target = this->AddLibraryComponent(
+ makefile, cmStateEnums::MODULE_LIBRARY, fullName, *ci, package);
+ } else if (type == "archive"_s) {
+ target = this->AddLibraryComponent(
+ makefile, cmStateEnums::STATIC_LIBRARY, fullName, *ci, package);
+ } else if (type == "interface"_s) {
+ target = this->AddLibraryComponent(
+ makefile, cmStateEnums::INTERFACE_LIBRARY, fullName, *ci, package);
+ } else {
+ makefile->IssueMessage(MessageType::WARNING,
+ cmStrCat(R"(component ")"_s, fullName,
+ R"(" has unknown type ")"_s, type,
+ R"(" and was not imported)"_s));
+ }
+
+ if (target) {
+ this->ComponentTargets.emplace(std::string{ name }, target);
+ }
+ }
+
+ // Read default components.
+ std::vector<std::string> const& defaultComponents =
+ ReadList(this->Data, "default_components");
+ if (!defaultComponents.empty()) {
+ std::string msg;
+ if (!makefile->EnforceUniqueName(package, msg)) {
+ status.SetError(msg);
+ return false;
+ }
+
+ cmTarget* const target = makefile->AddImportedTarget(
+ package, cmStateEnums::INTERFACE_LIBRARY, false);
+ for (std::string const& name : defaultComponents) {
+ std::string const& fullName = cmStrCat(package, "::"_s, name);
+ AppendProperty(makefile, target, "LINK_LIBRARIES"_s, {}, fullName);
+ }
+ }
+
+ return true;
+}
+
+bool cmPackageInfoReader::ImportTargetConfigurations(
+ cmMakefile* makefile, cmExecutionStatus& status) const
+{
+ std::string const& configuration = this->Data["configuration"].asString();
+
+ if (configuration.empty()) {
+ makefile->IssueMessage(MessageType::WARNING,
+ cmStrCat("supplemental file "_s, this->Path,
+ " does not specify a configuration"_s));
+ return true;
+ }
+
+ std::string const& package = this->GetName();
+ Json::Value const& components = this->Data["components"];
+
+ for (auto ci = components.begin(), ce = components.end(); ci != ce; ++ci) {
+ // Get component name and look up target.
+ cm::string_view const& name = IterKey(ci);
+ auto const& ti = this->ComponentTargets.find(std::string{ name });
+ if (ti == this->ComponentTargets.end()) {
+ status.SetError(cmStrCat("component "_s, name, " was not found"_s));
+ return false;
+ }
+
+ // Read supplemental data for component.
+ this->SetTargetProperties(makefile, ti->second, *ci, package,
+ configuration);
+ }
+
+ return true;
+}
diff --git a/Source/cmPackageInfoReader.h b/Source/cmPackageInfoReader.h
new file mode 100644
index 0000000..1bb6f4d
--- /dev/null
+++ b/Source/cmPackageInfoReader.h
@@ -0,0 +1,109 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include <cm/optional>
+#include <cm/string_view>
+
+#include <cm3p/json/value.h>
+
+#include "cmStateTypes.h"
+
+class cmExecutionStatus;
+class cmMakefile;
+class cmTarget;
+
+struct cmPackageRequirement
+{
+ std::string Name;
+ std::string Version;
+ std::vector<std::string> Components;
+ std::vector<std::string> Hints;
+};
+
+/** \class cmPackageInfoReader
+ * \brief Read and parse CPS files.
+ *
+ * This class encapsulates the functionality to read package configuration
+ * files which use the Common Package Specification, and provides utilities to
+ * translate the declarations therein into imported targets.
+ */
+class cmPackageInfoReader
+{
+public:
+ static std::unique_ptr<cmPackageInfoReader> Read(
+ std::string const& path, cmPackageInfoReader const* parent = nullptr);
+
+ std::string GetName() const;
+ cm::optional<std::string> GetVersion() const;
+ cm::optional<std::string> GetCompatVersion() const;
+
+ // NOTE: The eventual intent is for CPS to support multiple version schemas,
+ // and in particular, we expect to want to support "simple", "custom", "rpm",
+ // "dpkg" and "pep440". Additionally, we desire to be able to parse each of
+ // these to the maximum extent possible; in particular, we want to be able
+ // to decompose "simple" and "pep440" versions into components represented
+ // as numeric types rather than strings, which is not possible with the "rpm"
+ // and "dpkg" schemas. Therefore, we require different data structures to
+ // represent different version schemas.
+
+ struct Pep440Version
+ {
+ // NOTE: This structure is currently incomplete as we only support the
+ // "simple" schema at this time.
+ bool Simple; // "simple" can be represented as a subset of "pep440"
+ std::vector<unsigned> ReleaseComponents;
+ cm::optional<std::string> LocalLabel;
+ };
+
+ // FIXME: Return a sum type (e.g. {cm,std}::variant) of possible versions
+ // when we support more than just the "simple" (and possibly "pep440")
+ // schema(s).
+ /// If the package uses the 'simple' version scheme, parse the provided
+ /// version string as a numeric tuple and optional trailing string. Returns
+ /// a disengaged optional for other schemes or if no version is specified.
+ cm::optional<Pep440Version> ParseVersion(
+ cm::optional<std::string> const& version) const;
+
+ std::vector<cmPackageRequirement> GetRequirements() const;
+ std::vector<std::string> GetComponentNames() const;
+
+ /// Create targets for components specified in the CPS file.
+ bool ImportTargets(cmMakefile* makefile, cmExecutionStatus& status);
+
+ /// Add configuration-specific properties for targets.
+ bool ImportTargetConfigurations(cmMakefile* makefile,
+ cmExecutionStatus& status) const;
+
+private:
+ cmPackageInfoReader() = default;
+
+ cmTarget* AddLibraryComponent(cmMakefile* makefile,
+ cmStateEnums::TargetType type,
+ std::string const& name,
+ Json::Value const& data,
+ std::string const& package) const;
+
+ void SetTargetProperties(cmMakefile* makefile, cmTarget* target,
+ Json::Value const& data, std::string const& package,
+ cm::string_view configuration) const;
+ void SetOptionalProperty(cmTarget* target, cm::string_view property,
+ cm::string_view configuration,
+ Json::Value const& value) const;
+
+ std::string ResolvePath(std::string path) const;
+
+ std::string Path;
+ Json::Value Data;
+ std::string Prefix;
+
+ std::map<std::string, cmTarget*> ComponentTargets;
+ std::vector<std::string> DefaultConfigurations;
+};
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 40b18ff..b043b11 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmParseArgumentsCommand.h"
#include <map>
@@ -22,7 +22,7 @@
namespace {
-std::string EscapeArg(const std::string& arg)
+std::string EscapeArg(std::string const& arg)
{
// replace ";" with "\;" so output argument lists will split correctly
std::string escapedArg;
@@ -73,17 +73,17 @@ struct UserArgumentParser : public cmArgumentParser<void>
} // namespace
static void PassParsedArguments(
- const std::string& prefix, cmMakefile& makefile, const options_map& options,
- const single_map& singleValArgs, const multi_map& multiValArgs,
- const std::vector<std::string>& unparsed, const options_set& keywordsSeen,
- const options_set& keywordsMissingValues, bool parseFromArgV)
+ std::string const& prefix, cmMakefile& makefile, options_map const& options,
+ single_map const& singleValArgs, multi_map const& multiValArgs,
+ std::vector<std::string> const& unparsed, options_set const& keywordsSeen,
+ options_set const& keywordsMissingValues, bool parseFromArgV)
{
for (auto const& iter : options) {
makefile.AddDefinition(cmStrCat(prefix, iter.first),
iter.second ? "TRUE" : "FALSE");
}
- const cmPolicies::PolicyStatus cmp0174 =
+ cmPolicies::PolicyStatus const cmp0174 =
makefile.GetPolicyStatus(cmPolicies::CMP0174);
for (auto const& iter : singleValArgs) {
if (keywordsSeen.find(iter.first) == keywordsSeen.end()) {
@@ -170,7 +170,7 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
argIter++; // move past N
}
// the first argument is the prefix
- const std::string prefix = (*argIter++) + "_";
+ std::string const prefix = (*argIter++) + "_";
UserArgumentParser parser;
@@ -220,7 +220,7 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
return true;
}
for (unsigned long i = argvStart; i < count; ++i) {
- const std::string argName{ cmStrCat("ARGV", i) };
+ std::string const argName{ cmStrCat("ARGV", i) };
cmValue arg = status.GetMakefile().GetDefinition(argName);
if (!arg) {
status.GetMakefile().IssueMessage(
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index 008977b..263d25a 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmPathLabel.cxx b/Source/cmPathLabel.cxx
index fb81351..d9790f2 100644
--- a/Source/cmPathLabel.cxx
+++ b/Source/cmPathLabel.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPathLabel.h"
#include <utility>
@@ -19,12 +19,12 @@ cmPathLabel::cmPathLabel(std::string label)
this->Hash += ((this->Hash & 0x0001FFFF) << 15);
}
-bool cmPathLabel::operator<(const cmPathLabel& l) const
+bool cmPathLabel::operator<(cmPathLabel const& l) const
{
return this->Hash < l.Hash;
}
-bool cmPathLabel::operator==(const cmPathLabel& l) const
+bool cmPathLabel::operator==(cmPathLabel const& l) const
{
return this->Hash == l.Hash;
}
diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h
index d19d2be..36e7a07 100644
--- a/Source/cmPathLabel.h
+++ b/Source/cmPathLabel.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,11 +20,11 @@ public:
// The comparison operators are only for quick sorting and searching and
// in no way imply any lexicographical order of the label
- bool operator<(const cmPathLabel& l) const;
- bool operator==(const cmPathLabel& l) const;
+ bool operator<(cmPathLabel const& l) const;
+ bool operator==(cmPathLabel const& l) const;
- const std::string& GetLabel() const { return this->Label; }
- const unsigned int& GetHash() const { return this->Hash; }
+ std::string const& GetLabel() const { return this->Label; }
+ unsigned int const& GetHash() const { return this->Hash; }
protected:
cmPathLabel();
diff --git a/Source/cmPathResolver.cxx b/Source/cmPathResolver.cxx
new file mode 100644
index 0000000..32f3ef7
--- /dev/null
+++ b/Source/cmPathResolver.cxx
@@ -0,0 +1,552 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#include "cmPathResolver.h"
+
+#include <algorithm>
+#include <cerrno>
+#include <cstddef>
+#include <string>
+#include <utility>
+
+#include <cm/optional>
+#include <cm/string_view>
+#include <cmext/string_view>
+
+#ifdef _WIN32
+# include <cctype>
+
+# include <windows.h>
+#endif
+
+#define MAX_SYMBOLIC_LINKS 32
+
+namespace cm {
+namespace PathResolver {
+
+namespace {
+
+namespace Options {
+
+enum class ActualCase
+{
+ No,
+ Yes,
+};
+
+enum class Symlinks
+{
+ None,
+ Lazy,
+ Eager,
+};
+
+enum class Existence
+{
+ Agnostic,
+ Required,
+};
+}
+
+enum class Root
+{
+ None,
+ POSIX,
+#ifdef _WIN32
+ Drive,
+ Network,
+#endif
+};
+
+struct Control
+{
+ enum class Tag
+ {
+ Continue,
+ Restart,
+ Error,
+ };
+ Tag tag;
+ union
+ {
+ std::string::size_type slash; // data for Continue
+ cmsys::Status error; // data for Error
+ };
+ static Control Continue(std::string::size_type s)
+ {
+ Control c{ Tag::Continue };
+ c.slash = s;
+ return c;
+ }
+ static Control Restart() { return Control{ Tag::Restart }; }
+ static Control Error(cmsys::Status e)
+ {
+ Control c{ Tag::Error };
+ c.error = e;
+ return c;
+ }
+
+private:
+ Control(Tag t)
+ : tag(t)
+ {
+ }
+};
+
+Root ClassifyRoot(cm::string_view p)
+{
+#ifdef _WIN32
+ if (p.size() >= 2 && std::isalpha(p[0]) && p[1] == ':') {
+ return Root::Drive;
+ }
+ if (p.size() >= 3 && p[0] == '/' && p[1] == '/' && p[2] != '/') {
+ return Root::Network;
+ }
+#endif
+ if (!p.empty() && p[0] == '/') {
+ return Root::POSIX;
+ }
+ return Root::None;
+}
+
+class ImplBase
+{
+protected:
+ ImplBase(System& os)
+ : OS(os)
+ {
+ }
+
+ System& OS;
+ std::string P;
+ std::size_t SymlinkDepth = 0;
+
+#ifdef _WIN32
+ std::string GetWorkingDirectoryOnDrive(char letter);
+ Control ResolveRootRelative();
+#endif
+ cm::optional<std::string> ReadSymlink(std::string const& path,
+ cmsys::Status& status);
+ Control ResolveSymlink(Root root, std::string::size_type slash,
+ std::string::size_type next_slash,
+ std::string symlink_target);
+};
+
+template <class Policy>
+class Impl : public ImplBase
+{
+ Control ResolveRelativePath();
+ Control ResolveRoot(Root root);
+ Control ResolveComponent(Root root, std::string::size_type root_slash,
+ std::string::size_type slash);
+ Control ResolvePath();
+
+public:
+ Impl(System& os)
+ : ImplBase(os)
+ {
+ }
+ cmsys::Status Resolve(std::string in, std::string& out);
+};
+
+template <class Policy>
+Control Impl<Policy>::ResolveRelativePath()
+{
+ // This is a relative path. Convert it to absolute and restart.
+ std::string p = this->OS.GetWorkingDirectory();
+ std::replace(p.begin(), p.end(), '\\', '/');
+ if (ClassifyRoot(p) == Root::None) {
+ p.insert(0, 1, '/');
+ }
+ if (p.back() != '/') {
+ p.push_back('/');
+ }
+ P.insert(0, p);
+ return Control::Restart();
+}
+
+#ifdef _WIN32
+std::string ImplBase::GetWorkingDirectoryOnDrive(char letter)
+{
+ // Use the drive's working directory, if any.
+ std::string d = this->OS.GetWorkingDirectoryOnDrive(letter);
+ std::replace(d.begin(), d.end(), '\\', '/');
+ if (d.size() >= 3 && std::toupper(d[0]) == std::toupper(letter) &&
+ d[1] == ':' && d[2] == '/') {
+ d[0] = letter;
+ d.push_back('/');
+ return d;
+ }
+
+ // Use the current working directory if the drive matches.
+ d = this->OS.GetWorkingDirectory();
+ if (d.size() >= 3 && std::toupper(d[0]) == std::toupper(letter) &&
+ d[1] == ':' && d[2] == '/') {
+ d[0] = letter;
+ d.push_back('/');
+ return d;
+ }
+
+ // Fall back to the root directory on the drive.
+ d = "_:/";
+ d[0] = letter;
+ return d;
+}
+
+Control ImplBase::ResolveRootRelative()
+{
+ // This is a root-relative path. Resolve the root drive and restart.
+ P.replace(0, 2, this->GetWorkingDirectoryOnDrive(P[0]));
+ return Control::Restart();
+}
+#endif
+
+cm::optional<std::string> ImplBase::ReadSymlink(std::string const& path,
+ cmsys::Status& status)
+{
+ cm::optional<std::string> result;
+ std::string target;
+ status = this->OS.ReadSymlink(path, target);
+ if (status && ++this->SymlinkDepth >= MAX_SYMBOLIC_LINKS) {
+ status = cmsys::Status::POSIX(ELOOP);
+ }
+ if (status) {
+ if (!target.empty()) {
+ result = std::move(target);
+ }
+ } else if (status.GetPOSIX() == EINVAL
+#ifdef _WIN32
+ || status.GetWindows() == ERROR_NOT_A_REPARSE_POINT
+#endif
+ ) {
+ // The path was not a symlink.
+ status = cmsys::Status::Success();
+ }
+ return result;
+}
+
+Control ImplBase::ResolveSymlink(Root root, std::string::size_type slash,
+ std::string::size_type next_slash,
+ std::string symlink_target)
+{
+ std::replace(symlink_target.begin(), symlink_target.end(), '\\', '/');
+ Root const symlink_target_root = ClassifyRoot(symlink_target);
+ if (symlink_target_root == Root::None) {
+ // This is a symlink to a relative path.
+ // Resolve the symlink, while preserving the leading and
+ // trailing (if any) slash:
+ // "*/link/" => "*/dest/"
+ // ^slash ^slash
+ P.replace(slash + 1, next_slash - slash - 1, symlink_target);
+ return Control::Continue(slash);
+ }
+
+#ifdef _WIN32
+ if (root == Root::Drive && symlink_target_root == Root::POSIX) {
+ // This is a symlink to a POSIX absolute path,
+ // but the current path is on a drive letter. Resolve the
+ // symlink while preserving the drive letter, and start over:
+ // "C:/*/link/" => "C:/dest/"
+ // ^slash (restart)
+ P.replace(2, next_slash - 2, symlink_target);
+ return Control::Restart();
+ }
+#else
+ static_cast<void>(root);
+#endif
+
+ // This is a symlink to an absolute path.
+ // Resolve it and start over:
+ // "*/link/" => "/dest/"
+ // ^slash (restart)
+ P.replace(0, next_slash, symlink_target);
+ return Control::Restart();
+}
+
+template <class Policy>
+Control Impl<Policy>::ResolveRoot(Root root)
+{
+ if (root == Root::None) {
+ return this->ResolveRelativePath();
+ }
+
+ // POSIX absolute paths always start with a '/'.
+ std::string::size_type root_slash = 0;
+
+#ifdef _WIN32
+ if (root == Root::Drive) {
+ if (P.size() == 2 || P[2] != '/') {
+ return this->ResolveRootRelative();
+ }
+
+ if (Policy::ActualCase == Options::ActualCase::Yes) {
+ // Normalize the drive letter to upper-case.
+ P[0] = static_cast<char>(std::toupper(P[0]));
+ }
+
+ // The root is a drive letter. The root '/' immediately follows.
+ root_slash = 2;
+ } else if (root == Root::Network) {
+ // The root is a network name. Find the root '/' after it.
+ root_slash = P.find('/', 2);
+ if (root_slash == std::string::npos) {
+ root_slash = P.size();
+ P.push_back('/');
+ }
+ }
+#endif
+
+ if (Policy::Existence == Options::Existence::Required
+#ifdef _WIN32
+ && root != Root::Network
+#endif
+ ) {
+ std::string path = P.substr(0, root_slash + 1);
+ if (!this->OS.PathExists(path)) {
+ P = std::move(path);
+ return Control::Error(cmsys::Status::POSIX(ENOENT));
+ }
+ }
+
+ return Control::Continue(root_slash);
+}
+
+template <class Policy>
+Control Impl<Policy>::ResolveComponent(Root root,
+ std::string::size_type root_slash,
+ std::string::size_type slash)
+{
+ // Look for the '/' or end-of-input that ends this component.
+ // The sample paths in comments below show the trailing slash
+ // even if it is actually beyond the end of the path.
+ std::string::size_type next_slash = P.find('/', slash + 1);
+ if (next_slash == std::string::npos) {
+ next_slash = P.size();
+ }
+ cm::string_view c =
+ cm::string_view(P).substr(slash + 1, next_slash - (slash + 1));
+
+ if (slash == root_slash) {
+ if (c.empty() || c == "."_s || c == ".."_s) {
+ // This is an empty, '.', or '..' component at the root.
+ // Drop the component and its trailing slash, if any,
+ // while preserving the root slash:
+ // "//" => "/"
+ // "/./" => "/"
+ // "/../" => "/"
+ // ^slash ^slash
+ P.erase(slash + 1, next_slash - slash);
+ return Control::Continue(slash);
+ }
+ } else {
+ if (c.empty() || c == "."_s) {
+ // This is an empty or '.' component not at the root.
+ // Drop the component and its leading slash:
+ // "*//" => "*/"
+ // "*/./" => "*/"
+ // ^slash ^slash
+ P.erase(slash, next_slash - slash);
+ return Control::Continue(slash);
+ }
+
+ if (c == ".."_s) {
+ // This is a '..' component not at the root.
+ // Rewind to the previous component:
+ // "*/prev/../" => "*/prev/../"
+ // ^slash ^slash
+ next_slash = slash;
+ slash = P.rfind('/', slash - 1);
+
+ if (Policy::Symlinks == Options::Symlinks::Lazy) {
+ cmsys::Status status;
+ std::string path = P.substr(0, next_slash);
+ if (cm::optional<std::string> maybe_symlink_target =
+ this->ReadSymlink(path, status)) {
+ return this->ResolveSymlink(root, slash, next_slash,
+ std::move(*maybe_symlink_target));
+ }
+ if (!status && Policy::Existence == Options::Existence::Required) {
+ P = std::move(path);
+ return Control::Error(status);
+ }
+ }
+
+ // This is not a symlink.
+ // Drop the component, the following '..', and its trailing slash,
+ // if any, while preserving the (possibly root) leading slash:
+ // "*/dir/../" => "*/"
+ // ^slash ^slash
+ P.erase(slash + 1, next_slash + 3 - slash);
+ return Control::Continue(slash);
+ }
+ }
+
+ // This is a named component.
+
+ if (Policy::Symlinks == Options::Symlinks::Eager) {
+ cmsys::Status status;
+ std::string path = P.substr(0, next_slash);
+ if (cm::optional<std::string> maybe_symlink_target =
+ this->ReadSymlink(path, status)) {
+ return this->ResolveSymlink(root, slash, next_slash,
+ std::move(*maybe_symlink_target));
+ }
+ if (!status && Policy::Existence == Options::Existence::Required) {
+ P = std::move(path);
+ return Control::Error(status);
+ }
+ }
+
+#if defined(_WIN32) || defined(__APPLE__)
+ bool exists = false;
+ if (Policy::ActualCase == Options::ActualCase::Yes) {
+ std::string name;
+ std::string path = P.substr(0, next_slash);
+ if (cmsys::Status status = this->OS.ReadName(path, name)) {
+ exists = true;
+ if (!name.empty()) {
+ // Rename this component:
+ // "*/name/" => "*/Name/"
+ // ^slash ^slash
+ P.replace(slash + 1, next_slash - slash - 1, name);
+ next_slash = slash + 1 + name.length();
+ }
+ } else if (Policy::Existence == Options::Existence::Required) {
+ P = std::move(path);
+ return Control::Error(status);
+ }
+ }
+#endif
+
+ if (Policy::Existence == Options::Existence::Required
+#if defined(_WIN32) || defined(__APPLE__)
+ && !exists
+#endif
+ ) {
+ std::string path = P.substr(0, next_slash);
+ if (!this->OS.PathExists(path)) {
+ P = std::move(path);
+ return Control::Error(cmsys::Status::POSIX(ENOENT));
+ }
+ }
+
+ // Keep this component:
+ // "*/name/" => "*/name/"
+ // ^slash ^slash
+ return Control::Continue(next_slash);
+}
+
+template <class Policy>
+Control Impl<Policy>::ResolvePath()
+{
+ Root const root = ClassifyRoot(P);
+
+ // Resolve the root component. It always ends in a slash.
+ Control control = this->ResolveRoot(root);
+ if (control.tag != Control::Tag::Continue) {
+ return control;
+ }
+ std::string::size_type const root_slash = control.slash;
+
+ // Resolve later components. Every iteration that finishes
+ // the loop body makes progress either by removing a component
+ // or advancing the slash past it.
+ for (std::string::size_type slash = root_slash;
+ P.size() > root_slash + 1 && slash < P.size();) {
+ control = this->ResolveComponent(root, root_slash, slash);
+ if (control.tag != Control::Tag::Continue) {
+ return control;
+ }
+ slash = control.slash;
+ }
+ return Control::Continue(P.size());
+}
+
+template <class Policy>
+cmsys::Status Impl<Policy>::Resolve(std::string in, std::string& out)
+{
+ P = std::move(in);
+ std::replace(P.begin(), P.end(), '\\', '/');
+ for (;;) {
+ Control control = this->ResolvePath();
+ switch (control.tag) {
+ case Control::Tag::Continue:
+ out = std::move(P);
+ return cmsys::Status::Success();
+ case Control::Tag::Restart:
+ continue;
+ case Control::Tag::Error:
+ out = std::move(P);
+ return control.error;
+ };
+ }
+}
+
+}
+
+namespace Policies {
+struct NaivePath
+{
+#if defined(_WIN32) || defined(__APPLE__)
+ static constexpr Options::ActualCase ActualCase = Options::ActualCase::No;
+#endif
+ static constexpr Options::Symlinks Symlinks = Options::Symlinks::None;
+ static constexpr Options::Existence Existence = Options::Existence::Agnostic;
+};
+struct CasePath
+{
+#if defined(_WIN32) || defined(__APPLE__)
+ static constexpr Options::ActualCase ActualCase = Options::ActualCase::Yes;
+#endif
+ static constexpr Options::Symlinks Symlinks = Options::Symlinks::None;
+ static constexpr Options::Existence Existence = Options::Existence::Agnostic;
+};
+struct RealPath
+{
+#if defined(_WIN32) || defined(__APPLE__)
+ static constexpr Options::ActualCase ActualCase = Options::ActualCase::Yes;
+#endif
+ static constexpr Options::Symlinks Symlinks = Options::Symlinks::Eager;
+ static constexpr Options::Existence Existence = Options::Existence::Required;
+};
+struct LogicalPath
+{
+#if defined(_WIN32) || defined(__APPLE__)
+ static constexpr Options::ActualCase ActualCase = Options::ActualCase::Yes;
+#endif
+ static constexpr Options::Symlinks Symlinks = Options::Symlinks::Lazy;
+ static constexpr Options::Existence Existence = Options::Existence::Agnostic;
+};
+
+#if defined(__SUNPRO_CC)
+constexpr Options::Symlinks NaivePath::Symlinks;
+constexpr Options::Existence NaivePath::Existence;
+constexpr Options::Symlinks CasePath::Symlinks;
+constexpr Options::Existence CasePath::Existence;
+constexpr Options::Symlinks RealPath::Symlinks;
+constexpr Options::Existence RealPath::Existence;
+constexpr Options::Symlinks LogicalPath::Symlinks;
+constexpr Options::Existence LogicalPath::Existence;
+#endif
+}
+
+template <class Policy>
+Resolver<Policy>::Resolver(System& os)
+ : OS(os)
+{
+}
+template <class Policy>
+cmsys::Status Resolver<Policy>::Resolve(std::string in, std::string& out) const
+{
+ return Impl<Policy>(OS).Resolve(std::move(in), out);
+}
+
+System::System() = default;
+System::~System() = default;
+
+template class Resolver<Policies::LogicalPath>;
+template class Resolver<Policies::RealPath>;
+template class Resolver<Policies::CasePath>;
+template class Resolver<Policies::NaivePath>;
+
+}
+}
diff --git a/Source/cmPathResolver.h b/Source/cmPathResolver.h
new file mode 100644
index 0000000..e2399ba
--- /dev/null
+++ b/Source/cmPathResolver.h
@@ -0,0 +1,106 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+
+#include "cmsys/Status.hxx"
+
+namespace cm {
+namespace PathResolver {
+
+class System;
+
+/** Normalize filesystem paths according to a Policy.
+ *
+ * Resolved paths are always absolute, have no '..', '.', or empty
+ * components, and have a trailing '/' if and only if the entire
+ * path is a root component.
+ *
+ * The Policy determines behavior w.r.t. symbolic links, existence,
+ * and matching the on-disk case (upper/lower) of existing paths.
+ */
+template <class Policy>
+class Resolver
+{
+ System& OS;
+
+public:
+ /** Construct with a concrete filesystem access implementation. */
+ Resolver(System& os);
+
+ /** Resolve the input path according to the Policy, if possible.
+ On success, the resolved path is stored in 'out'.
+ On failure, the non-existent path is stored in 'out'. */
+ cmsys::Status Resolve(std::string in, std::string& out) const;
+};
+
+/** Access the filesystem via runtime dispatch.
+ This allows unit tests to work without accessing a real filesystem,
+ which is particularly important on Windows where symbolic links
+ may not be something we can create without administrator privileges.
+ */
+class System
+{
+public:
+ System();
+ virtual ~System() = 0;
+
+ /** If the given path is a symbolic link, read its target.
+ If the path exists but is not a symbolic link, fail
+ with EINVAL or ERROR_NOT_A_REPARSE_POINT. */
+ virtual cmsys::Status ReadSymlink(std::string const& path,
+ std::string& symlink_target) = 0;
+
+ /** Return whether the given path exists on disk. */
+ virtual bool PathExists(std::string const& path) = 0;
+
+ /** Get the process's working directory. */
+ virtual std::string GetWorkingDirectory() = 0;
+
+#ifdef _WIN32
+ /** Get the process's working directory on a Windows drive letter.
+ This is a legacy DOS concept supported by 'cmd' shells. */
+ virtual std::string GetWorkingDirectoryOnDrive(char drive_letter) = 0;
+#endif
+
+#if defined(_WIN32) || defined(__APPLE__)
+ /** Read the on-disk spelling of the last component of a file path. */
+ virtual cmsys::Status ReadName(std::string const& path,
+ std::string& name) = 0;
+#endif
+};
+
+namespace Policies {
+// IWYU pragma: begin_exports
+
+/** Normalizes paths while resolving symlinks only when followed
+ by '..' components. Does not require paths to exist, but
+ reads on-disk case of paths that do exist (on Windows and macOS). */
+struct LogicalPath;
+
+/** Normalizes paths while resolving all symlinks. Requires paths to exist,
+ and reads their on-disk case (on Windows and macOS). */
+struct RealPath;
+
+/** Normalizes paths while assuming components followed by '..'
+ components are not symlinks. Does not require paths to exist, but
+ reads on-disk case of paths that do exist (on Windows and macOS). */
+struct CasePath;
+
+/** Normalizes paths in memory without disk access.
+ Assumes components followed by '..' components are not symlinks. */
+struct NaivePath;
+
+// IWYU pragma: end_exports
+}
+
+extern template class Resolver<Policies::LogicalPath>;
+extern template class Resolver<Policies::RealPath>;
+extern template class Resolver<Policies::CasePath>;
+extern template class Resolver<Policies::NaivePath>;
+
+}
+}
diff --git a/Source/cmPkgConfigParser.cxx b/Source/cmPkgConfigParser.cxx
index 992d1ea..3804527 100644
--- a/Source/cmPkgConfigParser.cxx
+++ b/Source/cmPkgConfigParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPkgConfigParser.h"
@@ -44,19 +44,19 @@ llpkgc_errno_t cmPkgConfigParser::Finish(char* buf, std::size_t len)
return llpkgc_finish(static_cast<llpkgc_t*>(this));
}
-int cmPkgConfigParser::OnSpanNext(const char*, std::size_t len)
+int cmPkgConfigParser::OnSpanNext(char const*, std::size_t len)
{
Len_ += len;
return 0;
}
-int cmPkgConfigParser::OnSpanNextTr(llpkgc_t* parser, const char* at,
+int cmPkgConfigParser::OnSpanNextTr(llpkgc_t* parser, char const* at,
std::size_t len)
{
return static_cast<cmPkgConfigParser*>(parser)->OnSpanNext(at, len);
}
-int cmPkgConfigParser::OnKey(const char* at, std::size_t len)
+int cmPkgConfigParser::OnKey(char const* at, std::size_t len)
{
Ptr_ = at;
Len_ = len;
@@ -64,7 +64,7 @@ int cmPkgConfigParser::OnKey(const char* at, std::size_t len)
return 0;
}
-int cmPkgConfigParser::OnKeyTr(llpkgc_t* parser, const char* at,
+int cmPkgConfigParser::OnKeyTr(llpkgc_t* parser, char const* at,
std::size_t len)
{
return static_cast<cmPkgConfigParser*>(parser)->OnKey(at, len);
@@ -94,7 +94,7 @@ int cmPkgConfigParser::OnVariableCompleteTr(llpkgc_t* parser)
return static_cast<cmPkgConfigParser*>(parser)->OnVariableComplete();
}
-int cmPkgConfigParser::OnValueLiteral(const char* at, std::size_t len)
+int cmPkgConfigParser::OnValueLiteral(char const* at, std::size_t len)
{
Ptr_ = at;
Len_ = len;
@@ -102,7 +102,7 @@ int cmPkgConfigParser::OnValueLiteral(const char* at, std::size_t len)
return 0;
}
-int cmPkgConfigParser::OnValueLiteralTr(llpkgc_t* parser, const char* at,
+int cmPkgConfigParser::OnValueLiteralTr(llpkgc_t* parser, char const* at,
std::size_t len)
{
return static_cast<cmPkgConfigParser*>(parser)->OnValueLiteral(at, len);
@@ -124,7 +124,7 @@ int cmPkgConfigParser::OnValueLiteralCompleteTr(llpkgc_t* parser)
return static_cast<cmPkgConfigParser*>(parser)->OnValueLiteralComplete();
}
-int cmPkgConfigParser::OnValueVariable(const char* at, std::size_t len)
+int cmPkgConfigParser::OnValueVariable(char const* at, std::size_t len)
{
Ptr_ = at;
Len_ = len;
@@ -132,7 +132,7 @@ int cmPkgConfigParser::OnValueVariable(const char* at, std::size_t len)
return 0;
}
-int cmPkgConfigParser::OnValueVariableTr(llpkgc_t* parser, const char* at,
+int cmPkgConfigParser::OnValueVariableTr(llpkgc_t* parser, char const* at,
std::size_t len)
{
return static_cast<cmPkgConfigParser*>(parser)->OnValueVariable(at, len);
diff --git a/Source/cmPkgConfigParser.h b/Source/cmPkgConfigParser.h
index e671c27..9500c11 100644
--- a/Source/cmPkgConfigParser.h
+++ b/Source/cmPkgConfigParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -48,11 +48,11 @@ public:
std::vector<cmPkgConfigEntry>& Data() { return Data_; }
private:
- int OnSpanNext(const char*, std::size_t len);
- static int OnSpanNextTr(llpkgc_t* parser, const char* at, std::size_t len);
+ int OnSpanNext(char const*, std::size_t len);
+ static int OnSpanNextTr(llpkgc_t* parser, char const* at, std::size_t len);
- int OnKey(const char* at, std::size_t len);
- static int OnKeyTr(llpkgc_t* parser, const char* at, std::size_t len);
+ int OnKey(char const* at, std::size_t len);
+ static int OnKeyTr(llpkgc_t* parser, char const* at, std::size_t len);
int OnKeywordComplete();
static int OnKeywordCompleteTr(llpkgc_t* parser);
@@ -60,15 +60,15 @@ private:
int OnVariableComplete();
static int OnVariableCompleteTr(llpkgc_t* parser);
- int OnValueLiteral(const char* at, std::size_t len);
- static int OnValueLiteralTr(llpkgc_t* parser, const char* at,
+ int OnValueLiteral(char const* at, std::size_t len);
+ static int OnValueLiteralTr(llpkgc_t* parser, char const* at,
std::size_t len);
int OnValueLiteralComplete();
static int OnValueLiteralCompleteTr(llpkgc_t* parser);
- int OnValueVariable(const char* at, std::size_t len);
- static int OnValueVariableTr(llpkgc_t* parser, const char* at,
+ int OnValueVariable(char const* at, std::size_t len);
+ static int OnValueVariableTr(llpkgc_t* parser, char const* at,
std::size_t len);
int OnValueVariableComplete();
@@ -87,7 +87,7 @@ private:
nullptr, // on_pkgc_complete
};
- const char* Ptr_;
+ char const* Ptr_;
std::size_t Len_;
std::vector<cmPkgConfigEntry> Data_;
};
diff --git a/Source/cmPkgConfigResolver.cxx b/Source/cmPkgConfigResolver.cxx
index 251dfb7..0180245 100644
--- a/Source/cmPkgConfigResolver.cxx
+++ b/Source/cmPkgConfigResolver.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPkgConfigResolver.h"
@@ -57,7 +57,7 @@ std::string AppendAndTrim(std::string& str, cm::string_view sv)
} // namespace
-std::string cmPkgConfigResult::StrOrDefault(const std::string& key,
+std::string cmPkgConfigResult::StrOrDefault(std::string const& key,
cm::string_view def)
{
auto it = Keywords.find(key);
@@ -194,7 +194,7 @@ void cmPkgConfigResolver::ReplaceSep(std::string& list)
}
cm::optional<cmPkgConfigResult> cmPkgConfigResolver::ResolveStrict(
- const std::vector<cmPkgConfigEntry>& entries, cmPkgConfigEnv env)
+ std::vector<cmPkgConfigEntry> const& entries, cmPkgConfigEnv env)
{
cm::optional<cmPkgConfigResult> result;
cmPkgConfigResult config;
@@ -212,7 +212,7 @@ cm::optional<cmPkgConfigResult> cmPkgConfigResolver::ResolveStrict(
config.env = std::move(env);
- for (const auto& entry : entries) {
+ for (auto const& entry : entries) {
std::string key(entry.Key);
if (entry.IsVariable) {
if (config.Variables.find(key) != config.Variables.end()) {
@@ -256,12 +256,12 @@ cm::optional<cmPkgConfigResult> cmPkgConfigResolver::ResolveStrict(
}
cm::optional<cmPkgConfigResult> cmPkgConfigResolver::ResolvePermissive(
- const std::vector<cmPkgConfigEntry>& entries, cmPkgConfigEnv env)
+ std::vector<cmPkgConfigEntry> const& entries, cmPkgConfigEnv env)
{
cm::optional<cmPkgConfigResult> result;
cmPkgConfigResult config = ResolveBestEffort(entries, std::move(env));
- const auto& keys = config.Keywords;
+ auto const& keys = config.Keywords;
if (keys.find("Name") == keys.end() ||
keys.find("Description") == keys.end() ||
@@ -274,7 +274,7 @@ cm::optional<cmPkgConfigResult> cmPkgConfigResolver::ResolvePermissive(
}
cmPkgConfigResult cmPkgConfigResolver::ResolveBestEffort(
- const std::vector<cmPkgConfigEntry>& entries, cmPkgConfigEnv env)
+ std::vector<cmPkgConfigEntry> const& entries, cmPkgConfigEnv env)
{
cmPkgConfigResult result;
@@ -290,7 +290,7 @@ cmPkgConfigResult cmPkgConfigResolver::ResolveBestEffort(
result.env = std::move(env);
- for (const auto& entry : entries) {
+ for (auto const& entry : entries) {
std::string key(entry.Key);
if (entry.IsVariable) {
result.Variables[key] =
@@ -303,11 +303,11 @@ cmPkgConfigResult cmPkgConfigResolver::ResolveBestEffort(
}
std::string cmPkgConfigResolver::HandleVariablePermissive(
- const cmPkgConfigEntry& entry,
- const std::unordered_map<std::string, std::string>& variables)
+ cmPkgConfigEntry const& entry,
+ std::unordered_map<std::string, std::string> const& variables)
{
std::string result;
- for (const auto& segment : entry.Val) {
+ for (auto const& segment : entry.Val) {
if (!segment.IsVariable) {
result += segment.Data;
} else if (entry.Key != segment.Data) {
@@ -323,13 +323,13 @@ std::string cmPkgConfigResolver::HandleVariablePermissive(
}
cm::optional<std::string> cmPkgConfigResolver::HandleVariableStrict(
- const cmPkgConfigEntry& entry,
- const std::unordered_map<std::string, std::string>& variables)
+ cmPkgConfigEntry const& entry,
+ std::unordered_map<std::string, std::string> const& variables)
{
cm::optional<std::string> result;
std::string value;
- for (const auto& segment : entry.Val) {
+ for (auto const& segment : entry.Val) {
if (!segment.IsVariable) {
value += segment.Data;
} else if (entry.Key == segment.Data) {
@@ -350,11 +350,11 @@ cm::optional<std::string> cmPkgConfigResolver::HandleVariableStrict(
}
std::string cmPkgConfigResolver::HandleKeyword(
- const cmPkgConfigEntry& entry,
- const std::unordered_map<std::string, std::string>& variables)
+ cmPkgConfigEntry const& entry,
+ std::unordered_map<std::string, std::string> const& variables)
{
std::string result;
- for (const auto& segment : entry.Val) {
+ for (auto const& segment : entry.Val) {
if (!segment.IsVariable) {
result += segment.Data;
} else {
@@ -370,7 +370,7 @@ std::string cmPkgConfigResolver::HandleKeyword(
}
std::vector<cm::string_view> cmPkgConfigResolver::TokenizeFlags(
- const std::string& flagline)
+ std::string const& flagline)
{
std::vector<cm::string_view> result;
@@ -380,7 +380,7 @@ std::vector<cm::string_view> cmPkgConfigResolver::TokenizeFlags(
}
while (it != flagline.end()) {
- const char* start = &(*it);
+ char const* start = &(*it);
std::size_t len = 0;
for (; it != flagline.end() && !std::isspace(*it); ++it) {
@@ -398,7 +398,7 @@ std::vector<cm::string_view> cmPkgConfigResolver::TokenizeFlags(
}
cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
- const std::vector<cm::string_view>& flags)
+ std::vector<cm::string_view> const& flags)
{
cmPkgConfigCflagsResult result;
@@ -414,7 +414,7 @@ cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
}
cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
- const std::vector<cm::string_view>& flags, const std::string& sysroot)
+ std::vector<cm::string_view> const& flags, std::string const& sysroot)
{
cmPkgConfigCflagsResult result;
@@ -431,8 +431,8 @@ cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
}
cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
- const std::vector<cm::string_view>& flags,
- const std::vector<std::string>& syspaths)
+ std::vector<cm::string_view> const& flags,
+ std::vector<std::string> const& syspaths)
{
cmPkgConfigCflagsResult result;
@@ -441,7 +441,7 @@ cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
cm::string_view noprefix{ flag.data() + 2, flag.size() - 2 };
if (std::all_of(syspaths.begin(), syspaths.end(),
- [&](const std::string& path) {
+ [&](std::string const& path) {
return noprefix.rfind(path, 0) == noprefix.npos;
})) {
result.Includes.emplace_back(AppendAndTrim(result.Flagline, flag));
@@ -456,8 +456,8 @@ cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
}
cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
- const std::vector<cm::string_view>& flags, const std::string& sysroot,
- const std::vector<std::string>& syspaths)
+ std::vector<cm::string_view> const& flags, std::string const& sysroot,
+ std::vector<std::string> const& syspaths)
{
cmPkgConfigCflagsResult result;
@@ -467,7 +467,7 @@ cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
cm::string_view noprefix{ reroot.data() + 2, reroot.size() - 2 };
if (std::all_of(syspaths.begin(), syspaths.end(),
- [&](const std::string& path) {
+ [&](std::string const& path) {
return noprefix.rfind(path, 0) == noprefix.npos;
})) {
result.Includes.emplace_back(AppendAndTrim(result.Flagline, reroot));
@@ -482,7 +482,7 @@ cmPkgConfigCflagsResult cmPkgConfigResolver::MangleCflags(
}
cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
- const std::vector<cm::string_view>& flags)
+ std::vector<cm::string_view> const& flags)
{
cmPkgConfigLibsResult result;
@@ -500,7 +500,7 @@ cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
}
cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
- const std::vector<cm::string_view>& flags, const std::string& sysroot)
+ std::vector<cm::string_view> const& flags, std::string const& sysroot)
{
cmPkgConfigLibsResult result;
@@ -519,8 +519,8 @@ cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
}
cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
- const std::vector<cm::string_view>& flags,
- const std::vector<std::string>& syspaths)
+ std::vector<cm::string_view> const& flags,
+ std::vector<std::string> const& syspaths)
{
cmPkgConfigLibsResult result;
@@ -529,7 +529,7 @@ cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
cm::string_view noprefix{ flag.data() + 2, flag.size() - 2 };
if (std::all_of(syspaths.begin(), syspaths.end(),
- [&](const std::string& path) {
+ [&](std::string const& path) {
return noprefix.rfind(path, 0) == noprefix.npos;
})) {
result.LibDirs.emplace_back(AppendAndTrim(result.Flagline, flag));
@@ -546,8 +546,8 @@ cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
}
cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
- const std::vector<cm::string_view>& flags, const std::string& sysroot,
- const std::vector<std::string>& syspaths)
+ std::vector<cm::string_view> const& flags, std::string const& sysroot,
+ std::vector<std::string> const& syspaths)
{
cmPkgConfigLibsResult result;
@@ -557,7 +557,7 @@ cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
cm::string_view noprefix{ reroot.data() + 2, reroot.size() - 2 };
if (std::all_of(syspaths.begin(), syspaths.end(),
- [&](const std::string& path) {
+ [&](std::string const& path) {
return noprefix.rfind(path, 0) == noprefix.npos;
})) {
result.LibDirs.emplace_back(AppendAndTrim(result.Flagline, reroot));
@@ -575,7 +575,7 @@ cmPkgConfigLibsResult cmPkgConfigResolver::MangleLibs(
std::string cmPkgConfigResolver::Reroot(cm::string_view flag,
cm::string_view prefix,
- const std::string& sysroot)
+ std::string const& sysroot)
{
std::string result = std::string{ prefix };
result += sysroot;
@@ -655,7 +655,7 @@ cmPkgConfigVersionReq cmPkgConfigResolver::ParseVersion(
}
std::vector<cmPkgConfigDependency> cmPkgConfigResolver::ParseDependencies(
- const std::string& deps)
+ std::string const& deps)
{
std::vector<cmPkgConfigDependency> result;
@@ -706,8 +706,8 @@ std::vector<cmPkgConfigDependency> cmPkgConfigResolver::ParseDependencies(
return result;
}
-bool cmPkgConfigResolver::CheckVersion(const cmPkgConfigVersionReq& desired,
- const std::string& provided)
+bool cmPkgConfigResolver::CheckVersion(cmPkgConfigVersionReq const& desired,
+ std::string const& provided)
{
if (desired.Operation == cmPkgConfigVersionReq::ANY) {
@@ -847,7 +847,7 @@ bool cmPkgConfigResolver::CheckVersion(const cmPkgConfigVersionReq& desired,
}
cmPkgConfigVersionReq cmPkgConfigResolver::ParseVersion(
- const std::string& version)
+ std::string const& version)
{
cmPkgConfigVersionReq result;
diff --git a/Source/cmPkgConfigResolver.h b/Source/cmPkgConfigResolver.h
index a230ae7..7112184 100644
--- a/Source/cmPkgConfigResolver.h
+++ b/Source/cmPkgConfigResolver.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -87,7 +87,7 @@ public:
cmPkgConfigEnv env;
private:
- std::string StrOrDefault(const std::string& key, cm::string_view def = "");
+ std::string StrOrDefault(std::string const& key, cm::string_view def = "");
};
class cmPkgConfigResolver
@@ -96,77 +96,77 @@ class cmPkgConfigResolver
public:
static cm::optional<cmPkgConfigResult> ResolveStrict(
- const std::vector<cmPkgConfigEntry>& entries, cmPkgConfigEnv env);
+ std::vector<cmPkgConfigEntry> const& entries, cmPkgConfigEnv env);
static cm::optional<cmPkgConfigResult> ResolvePermissive(
- const std::vector<cmPkgConfigEntry>& entries, cmPkgConfigEnv env);
+ std::vector<cmPkgConfigEntry> const& entries, cmPkgConfigEnv env);
static cmPkgConfigResult ResolveBestEffort(
- const std::vector<cmPkgConfigEntry>& entries, cmPkgConfigEnv env);
+ std::vector<cmPkgConfigEntry> const& entries, cmPkgConfigEnv env);
- static cmPkgConfigVersionReq ParseVersion(const std::string& version);
+ static cmPkgConfigVersionReq ParseVersion(std::string const& version);
- static bool CheckVersion(const cmPkgConfigVersionReq& desired,
- const std::string& provided);
+ static bool CheckVersion(cmPkgConfigVersionReq const& desired,
+ std::string const& provided);
static void ReplaceSep(std::string& list);
#ifdef _WIN32
- static const char Sep = ';';
+ static char const Sep = ';';
#else
- static const char Sep = ':';
+ static char const Sep = ':';
#endif
private:
static std::string HandleVariablePermissive(
- const cmPkgConfigEntry& entry,
- const std::unordered_map<std::string, std::string>& variables);
+ cmPkgConfigEntry const& entry,
+ std::unordered_map<std::string, std::string> const& variables);
static cm::optional<std::string> HandleVariableStrict(
- const cmPkgConfigEntry& entry,
- const std::unordered_map<std::string, std::string>& variables);
+ cmPkgConfigEntry const& entry,
+ std::unordered_map<std::string, std::string> const& variables);
static std::string HandleKeyword(
- const cmPkgConfigEntry& entry,
- const std::unordered_map<std::string, std::string>& variables);
+ cmPkgConfigEntry const& entry,
+ std::unordered_map<std::string, std::string> const& variables);
static std::vector<cm::string_view> TokenizeFlags(
- const std::string& flagline);
+ std::string const& flagline);
static cmPkgConfigCflagsResult MangleCflags(
- const std::vector<cm::string_view>& flags);
+ std::vector<cm::string_view> const& flags);
static cmPkgConfigCflagsResult MangleCflags(
- const std::vector<cm::string_view>& flags, const std::string& sysroot);
+ std::vector<cm::string_view> const& flags, std::string const& sysroot);
static cmPkgConfigCflagsResult MangleCflags(
- const std::vector<cm::string_view>& flags,
- const std::vector<std::string>& syspaths);
+ std::vector<cm::string_view> const& flags,
+ std::vector<std::string> const& syspaths);
static cmPkgConfigCflagsResult MangleCflags(
- const std::vector<cm::string_view>& flags, const std::string& sysroot,
- const std::vector<std::string>& syspaths);
+ std::vector<cm::string_view> const& flags, std::string const& sysroot,
+ std::vector<std::string> const& syspaths);
static cmPkgConfigLibsResult MangleLibs(
- const std::vector<cm::string_view>& flags);
+ std::vector<cm::string_view> const& flags);
static cmPkgConfigLibsResult MangleLibs(
- const std::vector<cm::string_view>& flags, const std::string& sysroot);
+ std::vector<cm::string_view> const& flags, std::string const& sysroot);
static cmPkgConfigLibsResult MangleLibs(
- const std::vector<cm::string_view>& flags,
- const std::vector<std::string>& syspaths);
+ std::vector<cm::string_view> const& flags,
+ std::vector<std::string> const& syspaths);
static cmPkgConfigLibsResult MangleLibs(
- const std::vector<cm::string_view>& flags, const std::string& sysroot,
- const std::vector<std::string>& syspaths);
+ std::vector<cm::string_view> const& flags, std::string const& sysroot,
+ std::vector<std::string> const& syspaths);
static std::string Reroot(cm::string_view flag, cm::string_view prefix,
- const std::string& sysroot);
+ std::string const& sysroot);
static cmPkgConfigVersionReq ParseVersion(std::string::const_iterator& cur,
std::string::const_iterator end);
static std::vector<cmPkgConfigDependency> ParseDependencies(
- const std::string& deps);
+ std::string const& deps);
};
diff --git a/Source/cmPlaceholderExpander.cxx b/Source/cmPlaceholderExpander.cxx
index 11c7485..f5dc544 100644
--- a/Source/cmPlaceholderExpander.cxx
+++ b/Source/cmPlaceholderExpander.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPlaceholderExpander.h"
#include <cctype>
diff --git a/Source/cmPlaceholderExpander.h b/Source/cmPlaceholderExpander.h
index 24225cc..3a4b1bc 100644
--- a/Source/cmPlaceholderExpander.h
+++ b/Source/cmPlaceholderExpander.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Source/cmPlistParser.cxx b/Source/cmPlistParser.cxx
index ce3c171..0bd85fc 100644
--- a/Source/cmPlistParser.cxx
+++ b/Source/cmPlistParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPlistParser.h"
#include <cm3p/json/reader.h>
@@ -8,7 +8,7 @@
#include "cmUVProcessChain.h"
#include "cmUVStream.h"
-cm::optional<Json::Value> cmParsePlist(const std::string& filename)
+cm::optional<Json::Value> cmParsePlist(std::string const& filename)
{
cmUVProcessChainBuilder builder;
builder.AddCommand(
diff --git a/Source/cmPlistParser.h b/Source/cmPlistParser.h
index 2ace254..83d96c8 100644
--- a/Source/cmPlistParser.h
+++ b/Source/cmPlistParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -10,4 +10,4 @@ namespace Json {
class Value;
}
-cm::optional<Json::Value> cmParsePlist(const std::string& filename);
+cm::optional<Json::Value> cmParsePlist(std::string const& filename);
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index d3b2769..8e16d51 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -1,3 +1,5 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPolicies.h"
#include <cassert>
@@ -10,15 +12,13 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmState.h"
#include "cmStateSnapshot.h"
-#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
#include "cmVersion.h"
-static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
+static bool stringToId(char const* input, cmPolicies::PolicyID& pid)
{
assert(input);
if (strlen(input) != 7) {
@@ -55,7 +55,11 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
#define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \
CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC)
-static const char* idToString(cmPolicies::PolicyID id)
+#define CM_SELECT_ID_STATUS(F, A1, A2, A3, A4, A5, A6) F(A1, A6)
+#define CM_FOR_EACH_POLICY_ID_STATUS(POLICY) \
+ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_STATUS)
+
+static char const* idToString(cmPolicies::PolicyID id)
{
switch (id) {
#define POLICY_CASE(ID) \
@@ -69,7 +73,7 @@ static const char* idToString(cmPolicies::PolicyID id)
return nullptr;
}
-static const char* idToVersion(cmPolicies::PolicyID id)
+static char const* idToVersion(cmPolicies::PolicyID id)
{
switch (id) {
#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \
@@ -103,7 +107,7 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id, unsigned int majorV,
return false;
}
-static const char* idToShortDescription(cmPolicies::PolicyID id)
+static char const* idToShortDescription(cmPolicies::PolicyID id)
{
switch (id) {
#define POLICY_CASE(ID, SHORT_DESCRIPTION) \
@@ -117,6 +121,23 @@ static const char* idToShortDescription(cmPolicies::PolicyID id)
return nullptr;
}
+namespace {
+cmPolicies::PolicyStatus idToStatus(cmPolicies::PolicyID id)
+{
+ switch (id) {
+#define POLICY_CASE(ID, STATUS) \
+ case cmPolicies::ID: \
+ return cmPolicies::STATUS;
+ // NOLINTNEXTLINE(bugprone-branch-clone)
+ CM_FOR_EACH_POLICY_ID_STATUS(POLICY_CASE)
+#undef POLICY_CASE
+ case cmPolicies::CMPCOUNT:
+ break;
+ }
+ return cmPolicies::WARN;
+}
+}
+
static void DiagnoseAncientPolicies(
std::vector<cmPolicies::PolicyID> const& ancient, unsigned int majorVer,
unsigned int minorVer, unsigned int patchVer, cmMakefile* mf)
@@ -254,27 +275,73 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf,
warnCompat);
}
+namespace {
+bool IsFromLegacyInstallEXPORT(cmMakefile* mf, unsigned int majorVer,
+ unsigned int minorVer, unsigned int patchVer)
+{
+ return majorVer == 2 && minorVer == 6 && patchVer == 0 &&
+ mf->GetStateSnapshot().CanPopPolicyScope() &&
+ cmSystemTools::Strucmp(mf->GetBacktrace().Top().Name.c_str(),
+ "cmake_policy") == 0;
+}
+#define ADVICE_UPDATE_VERSION_ARGUMENT \
+ "Update the VERSION argument <min> value. Or, use the <min>...<max> " \
+ "syntax to tell CMake that the project requires at least <min> but has " \
+ "been updated to work with policies introduced by <max> or earlier."
+}
+
bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
unsigned int minorVer,
unsigned int patchVer,
WarnCompat warnCompat)
{
- // Warn about policy versions for which support will be removed.
- if (warnCompat == WarnCompat::On &&
- (majorVer < 3 || (majorVer == 3 && minorVer < 10)) &&
- // Avoid warning on calls generated by install(EXPORT)
+ cmValue varVer = mf->GetDefinition("CMAKE_POLICY_VERSION_MINIMUM");
+ if (!varVer.IsEmpty()) {
+ unsigned int varMajor = 0;
+ unsigned int varMinor = 0;
+ unsigned int varPatch = 0;
+ unsigned int varTweak = 0;
+ if (sscanf(varVer.GetCStr(), "%u.%u.%u.%u", &varMajor, &varMinor,
+ &varPatch, &varTweak) < 2) {
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Invalid CMAKE_POLICY_VERSION_MINIMUM value \"", varVer,
+ "\". "
+ "A numeric major.minor[.patch[.tweak]] must be given."));
+ return false;
+ }
+ if (varMajor > majorVer || (varMajor == majorVer && varMinor > minorVer) ||
+ (varMajor == majorVer && varMinor == minorVer &&
+ varPatch > patchVer)) {
+ majorVer = varMajor;
+ minorVer = varMinor;
+ patchVer = varPatch;
+ }
+ }
+
+ // Error on policy versions for which support has been removed.
+ if (majorVer < 3 || (majorVer == 3 && minorVer < 5)) {
+ if (IsFromLegacyInstallEXPORT(mf, majorVer, minorVer, patchVer)) {
+ // Silently tolerate cmake_policy calls generated by install(EXPORT)
// in CMake versions prior to 3.18.
- !(majorVer == 2 && minorVer == 6 && patchVer == 0 &&
- mf->GetStateSnapshot().CanPopPolicyScope() &&
- cmSystemTools::Strucmp(mf->GetBacktrace().Top().Name.c_str(),
- "cmake_policy") == 0)) {
+ majorVer = 3;
+ minorVer = 5;
+ patchVer = 0;
+ } else {
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ "Compatibility with CMake < 3.5 has been removed "
+ "from CMake.\n" ADVICE_UPDATE_VERSION_ARGUMENT "\n"
+ "Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try "
+ "configuring anyway.");
+ cmSystemTools::SetFatalErrorOccurred();
+ return false;
+ }
+ } else if (majorVer == 3 && minorVer < 10 && warnCompat == WarnCompat::On) {
+ // Warn about policy versions for which support will be removed.
mf->IssueMessage(
MessageType::DEPRECATION_WARNING,
"Compatibility with CMake < 3.10 will be removed from "
- "a future version of CMake.\n"
- "Update the VERSION argument <min> value. Or, use the <min>...<max> "
- "syntax to tell CMake that the project requires at least <min> but has "
- "been updated to work with policies introduced by <max> or earlier.");
+ "a future version of CMake.\n" ADVICE_UPDATE_VERSION_ARGUMENT);
}
// now loop over all the policies and set them as appropriate
@@ -282,7 +349,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
for (PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT;
pid = static_cast<PolicyID>(pid + 1)) {
if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) {
- if (cmPolicies::GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) {
+ if (cmPolicies::IsRemoved(pid)) {
ancientPolicies.push_back(pid);
} else {
cmPolicies::PolicyStatus status = cmPolicies::WARN;
@@ -290,20 +357,6 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
!mf->SetPolicy(pid, status)) {
return false;
}
- if (pid == cmPolicies::CMP0001 &&
- (status == cmPolicies::WARN || status == cmPolicies::OLD)) {
- if (!(mf->GetState()->GetInitializedCacheValue(
- "CMAKE_BACKWARDS_COMPATIBILITY"))) {
- // Set it to 2.4 because that is the last version where the
- // variable had meaning.
- mf->AddCacheDefinition(
- "CMAKE_BACKWARDS_COMPATIBILITY", "2.4",
- "For backwards compatibility, what version of CMake "
- "commands and "
- "syntax should this version of CMake try to support.",
- cmStateEnums::STRING);
- }
- }
}
} else {
if (!mf->SetPolicy(pid, cmPolicies::NEW)) {
@@ -322,7 +375,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
return true;
}
-bool cmPolicies::GetPolicyID(const char* id, cmPolicies::PolicyID& pid)
+bool cmPolicies::GetPolicyID(char const* id, cmPolicies::PolicyID& pid)
{
return stringToId(id, pid);
}
@@ -353,36 +406,12 @@ std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id)
"to the NEW behavior and not rely on setting a policy to OLD.");
}
-//! return an error string for when a required policy is unspecified
-std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
-{
- return cmStrCat(
- "Policy ", idToString(id),
- " is not set to NEW: ", idToShortDescription(id),
- " "
- "Run \"cmake --help-policy ",
- idToString(id),
- "\" for policy details. "
- "CMake now requires this policy to be set to NEW by the project. "
- "The policy may be set explicitly using the code\n"
- " cmake_policy(SET ",
- idToString(id),
- " NEW)\n"
- "or by upgrading all policies with the code\n"
- " cmake_policy(VERSION ",
- idToVersion(id),
- ") # or later\n"
- "Run \"cmake --help-command cmake_policy\" for more information.");
-}
-
-//! Get the default status for a policy
-cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus(
- cmPolicies::PolicyID /*unused*/)
+bool cmPolicies::IsRemoved(cmPolicies::PolicyID id)
{
- return cmPolicies::WARN;
+ return idToStatus(id) == cmPolicies::NEW;
}
-std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
+std::string cmPolicies::GetRemovedPolicyError(cmPolicies::PolicyID id)
{
std::string pid = idToString(id);
return cmStrCat(
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index dbd6ce8..637e710 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -9,550 +9,553 @@
class cmMakefile;
+// Each policy has a short description, the version of CMake in which
+// it was introduced, and its default status. The status is WARN for
+// existing policies and NEW for removed policies.
+
#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
SELECT(POLICY, CMP0000, \
- "A minimum required CMake version must be specified.", 2, 6, 0, \
- cmPolicies::WARN) \
+ "A minimum required CMake version must be specified.", 2, 6, 0, NEW) \
SELECT(POLICY, CMP0001, \
"CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", 2, 6, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0002, "Logical target names must be globally unique.", 2, \
- 6, 0, cmPolicies::WARN) \
+ 6, 0, NEW) \
SELECT( \
POLICY, CMP0003, \
"Libraries linked via full path no longer produce linker search paths.", \
- 2, 6, 0, cmPolicies::WARN) \
+ 2, 6, 0, NEW) \
SELECT(POLICY, CMP0004, \
"Libraries linked may not have leading or trailing whitespace.", 2, \
- 6, 0, cmPolicies::WARN) \
+ 6, 0, NEW) \
SELECT(POLICY, CMP0005, \
"Preprocessor definition values are now escaped automatically.", 2, \
- 6, 0, cmPolicies::WARN) \
+ 6, 0, NEW) \
SELECT(POLICY, CMP0006, \
"Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \
- 2, 6, 0, cmPolicies::WARN) \
+ 2, 6, 0, NEW) \
SELECT(POLICY, CMP0007, "list command no longer ignores empty elements.", \
- 2, 6, 0, cmPolicies::WARN) \
+ 2, 6, 0, NEW) \
SELECT( \
POLICY, CMP0008, \
"Libraries linked by full-path must have a valid library file name.", 2, \
- 6, 1, cmPolicies::WARN) \
+ 6, 1, NEW) \
SELECT(POLICY, CMP0009, \
"FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
- 6, 2, cmPolicies::WARN) \
+ 6, 2, NEW) \
SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
- 3, cmPolicies::WARN) \
+ 3, NEW) \
SELECT(POLICY, CMP0011, \
"Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.", \
- 2, 8, 0, cmPolicies::WARN) \
+ 2, 8, 0, NEW) \
SELECT(POLICY, CMP0013, "Duplicate binary directories are not allowed.", 2, \
- 8, 0, cmPolicies::WARN) \
+ 8, 0, NEW) \
SELECT(POLICY, CMP0014, "Input directories must have CMakeLists.txt.", 2, \
- 8, 0, cmPolicies::WARN) \
+ 8, 0, NEW) \
SELECT(POLICY, CMP0015, \
"link_directories() treats paths relative to the source dir.", 2, 8, \
- 1, cmPolicies::WARN) \
+ 1, NEW) \
SELECT(POLICY, CMP0016, \
"target_link_libraries() reports error if its only argument " \
"is not a target.", \
- 2, 8, 3, cmPolicies::WARN) \
+ 2, 8, 3, NEW) \
SELECT(POLICY, CMP0017, \
"Prefer files from the CMake module directory when including from " \
"there.", \
- 2, 8, 4, cmPolicies::WARN) \
+ 2, 8, 4, NEW) \
SELECT(POLICY, CMP0018, \
- "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, \
- cmPolicies::WARN) \
+ "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, NEW) \
SELECT(POLICY, CMP0019, \
"Do not re-expand variables in include and link information.", 2, 8, \
- 11, cmPolicies::WARN) \
+ 11, NEW) \
SELECT(POLICY, CMP0020, \
"Automatically link Qt executables to qtmain target on Windows.", 2, \
- 8, 11, cmPolicies::WARN) \
+ 8, 11, NEW) \
SELECT( \
POLICY, CMP0021, \
"Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \
- 2, 8, 12, cmPolicies::WARN) \
+ 2, 8, 12, NEW) \
SELECT(POLICY, CMP0022, \
"INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \
- cmPolicies::WARN) \
+ NEW) \
SELECT( \
POLICY, CMP0023, \
"Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \
- 8, 12, cmPolicies::WARN) \
- SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, \
- cmPolicies::WARN) \
+ 8, 12, NEW) \
+ SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, NEW) \
SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0026, "Disallow use of the LOCATION target property.", 3, \
- 0, 0, cmPolicies::WARN) \
+ 0, 0, NEW) \
SELECT(POLICY, CMP0027, \
"Conditionally linked imported targets with missing include " \
"directories.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0028, \
"Double colon in target name means ALIAS or IMPORTED target.", 3, 0, \
- 0, cmPolicies::WARN) \
+ 0, NEW) \
SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0030, \
- "The use_mangled_mesa command should not be called.", 3, 0, 0, \
- cmPolicies::WARN) \
+ "The use_mangled_mesa command should not be called.", 3, 0, 0, NEW) \
SELECT(POLICY, CMP0031, "The load_command command should not be called.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0032, \
"The output_required_files command should not be called.", 3, 0, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0033, \
"The export_library_dependencies command should not be called.", 3, \
- 0, 0, cmPolicies::WARN) \
+ 0, 0, NEW) \
SELECT(POLICY, CMP0034, "The utility_source command should not be called.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0035, \
- "The variable_requires command should not be called.", 3, 0, 0, \
- cmPolicies::WARN) \
+ "The variable_requires command should not be called.", 3, 0, 0, NEW) \
SELECT(POLICY, CMP0036, "The build_name command should not be called.", 3, \
- 0, 0, cmPolicies::WARN) \
+ 0, 0, NEW) \
SELECT(POLICY, CMP0037, \
"Target names should not be reserved and should match a validity " \
"pattern.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0038, "Targets may not link directly to themselves.", 3, \
- 0, 0, cmPolicies::WARN) \
+ 0, 0, NEW) \
SELECT(POLICY, CMP0039, "Utility targets may not have link dependencies.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0040, \
"The target in the TARGET signature of add_custom_command() must " \
"exist and must be defined in the current directory.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0041, \
"Error on relative include with generator expression.", 3, 0, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0042, "MACOSX_RPATH is enabled by default.", 3, 0, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0043, "Ignore COMPILE_DEFINITIONS_<Config> properties.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0044, \
"Case sensitive <LANG>_COMPILER_ID generator expressions.", 3, 0, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0045, \
"Error on non-existent target in get_target_property.", 3, 0, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0046, \
"Error on non-existent dependency in add_dependencies.", 3, 0, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0047, "Use QCC compiler id for the qcc drivers on QNX.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0048, "project() command manages VERSION variables.", 3, \
- 0, 0, cmPolicies::WARN) \
+ 0, 0, NEW) \
SELECT(POLICY, CMP0049, \
- "Do not expand variables in target source entries.", 3, 0, 0, \
- cmPolicies::WARN) \
+ "Do not expand variables in target source entries.", 3, 0, 0, NEW) \
SELECT(POLICY, CMP0050, "Disallow add_custom_command SOURCE signatures.", \
- 3, 0, 0, cmPolicies::WARN) \
+ 3, 0, 0, NEW) \
SELECT(POLICY, CMP0051, "List TARGET_OBJECTS in SOURCES target property.", \
- 3, 1, 0, cmPolicies::WARN) \
+ 3, 1, 0, NEW) \
SELECT(POLICY, CMP0052, \
"Reject source and build dirs in installed " \
"INTERFACE_INCLUDE_DIRECTORIES.", \
- 3, 1, 0, cmPolicies::WARN) \
+ 3, 1, 0, NEW) \
SELECT(POLICY, CMP0053, \
"Simplify variable reference and escape sequence evaluation.", 3, 1, \
- 0, cmPolicies::WARN) \
+ 0, NEW) \
SELECT( \
POLICY, CMP0054, \
"Only interpret if() arguments as variables or keywords when unquoted.", \
- 3, 1, 0, cmPolicies::WARN) \
+ 3, 1, 0, NEW) \
SELECT(POLICY, CMP0055, "Strict checking for break() command.", 3, 2, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0056, \
"Honor link flags in try_compile() source-file signature.", 3, 2, 0, \
- cmPolicies::WARN) \
- SELECT(POLICY, CMP0057, "Support new IN_LIST if() operator.", 3, 3, 0, \
- cmPolicies::WARN) \
+ NEW) \
+ SELECT(POLICY, CMP0057, "Support new IN_LIST if() operator.", 3, 3, 0, NEW) \
SELECT(POLICY, CMP0058, \
"Ninja requires custom command byproducts to be explicit.", 3, 3, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0059, \
"Do not treat DEFINITIONS as a built-in directory property.", 3, 3, \
- 0, cmPolicies::WARN) \
+ 0, NEW) \
SELECT(POLICY, CMP0060, \
"Link libraries by full path even in implicit directories.", 3, 3, \
- 0, cmPolicies::WARN) \
+ 0, NEW) \
SELECT(POLICY, CMP0061, \
"CTest does not by default tell make to ignore errors (-i).", 3, 3, \
- 0, cmPolicies::WARN) \
+ 0, NEW) \
SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
- cmPolicies::WARN) \
+ NEW) \
SELECT(POLICY, CMP0063, \
- "Honor visibility properties for all target types.", 3, 3, 0, \
- cmPolicies::WARN) \
- SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, \
- cmPolicies::WARN) \
+ "Honor visibility properties for all target types.", 3, 3, 0, NEW) \
+ SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, NEW) \
SELECT(POLICY, CMP0065, \
"Do not add flags to export symbols from executables without " \
"the ENABLE_EXPORTS target property.", \
- 3, 4, 0, cmPolicies::WARN) \
+ 3, 4, 0, NEW) \
SELECT(POLICY, CMP0066, \
"Honor per-config flags in try_compile() source-file signature.", 3, \
- 7, 0, cmPolicies::WARN) \
+ 7, 0, WARN) \
SELECT(POLICY, CMP0067, \
"Honor language standard in try_compile() source-file signature.", \
- 3, 8, 0, cmPolicies::WARN) \
+ 3, 8, 0, WARN) \
SELECT(POLICY, CMP0068, \
"RPATH settings on macOS do not affect install_name.", 3, 9, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0069, \
"INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.", 3, 9, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0070, \
"Define file(GENERATE) behavior for relative paths.", 3, 10, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0071, "Let AUTOMOC and AUTOUIC process GENERATED files.", \
- 3, 10, 0, cmPolicies::WARN) \
+ 3, 10, 0, WARN) \
SELECT(POLICY, CMP0072, \
"FindOpenGL prefers GLVND by default when available.", 3, 11, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0073, \
- "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \
- cmPolicies::WARN) \
+ "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, WARN) \
SELECT(POLICY, CMP0074, "find_package uses <PackageName>_ROOT variables.", \
- 3, 12, 0, cmPolicies::WARN) \
+ 3, 12, 0, WARN) \
SELECT(POLICY, CMP0075, \
"Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0076, \
"target_sources() command converts relative paths to absolute.", 3, \
- 13, 0, cmPolicies::WARN) \
+ 13, 0, WARN) \
SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT( \
POLICY, CMP0079, \
"target_link_libraries allows use with targets in other directories.", 3, \
- 13, 0, cmPolicies::WARN) \
+ 13, 0, WARN) \
SELECT(POLICY, CMP0080, \
"BundleUtilities cannot be included at configure time.", 3, 13, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0081, \
"Relative paths not allowed in LINK_DIRECTORIES target property.", \
- 3, 13, 0, cmPolicies::WARN) \
+ 3, 13, 0, WARN) \
SELECT(POLICY, CMP0082, \
"Install rules from add_subdirectory() are interleaved with those " \
"in caller.", \
- 3, 14, 0, cmPolicies::WARN) \
+ 3, 14, 0, WARN) \
SELECT(POLICY, CMP0083, "Add PIE options when linking executable.", 3, 14, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0084, \
"The FindQt module does not exist for find_package().", 3, 14, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0085, "$<IN_LIST:...> handles empty list items.", 3, 14, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0086, \
- "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0, \
- cmPolicies::WARN) \
+ "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0, WARN) \
SELECT(POLICY, CMP0087, \
"Install CODE|SCRIPT allow the use of generator " \
"expressions.", \
- 3, 14, 0, cmPolicies::WARN) \
+ 3, 14, 0, WARN) \
SELECT(POLICY, CMP0088, \
"FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \
- 3, 14, 0, cmPolicies::WARN) \
+ 3, 14, 0, WARN) \
SELECT(POLICY, CMP0089, \
"Compiler id for IBM Clang-based XL compilers is now XLClang.", 3, \
- 15, 0, cmPolicies::WARN) \
+ 15, 0, WARN) \
SELECT(POLICY, CMP0090, \
"export(PACKAGE) does not populate package registry by default.", 3, \
- 15, 0, cmPolicies::WARN) \
+ 15, 0, WARN) \
SELECT(POLICY, CMP0091, \
"MSVC runtime library flags are selected by an abstraction.", 3, 15, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0092, \
"MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.", 3, \
- 15, 0, cmPolicies::WARN) \
+ 15, 0, WARN) \
SELECT(POLICY, CMP0093, "FindBoost reports Boost_VERSION in x.y.z format.", \
- 3, 15, 0, cmPolicies::WARN) \
+ 3, 15, 0, WARN) \
SELECT(POLICY, CMP0094, \
- "FindPython3, FindPython2 and FindPyton use " \
+ "FindPython3, FindPython2 and FindPython use " \
"LOCATION for lookup strategy.", \
- 3, 15, 0, cmPolicies::WARN) \
+ 3, 15, 0, WARN) \
SELECT(POLICY, CMP0095, \
"RPATH entries are properly escaped in the intermediary CMake " \
"install script.", \
- 3, 16, 0, cmPolicies::WARN) \
+ 3, 16, 0, WARN) \
SELECT(POLICY, CMP0096, \
"project() preserves leading zeros in version components.", 3, 16, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0097, \
"ExternalProject_Add with GIT_SUBMODULES \"\" initializes no " \
"submodules.", \
- 3, 16, 0, cmPolicies::WARN) \
+ 3, 16, 0, WARN) \
SELECT(POLICY, CMP0098, \
"FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
- 17, 0, cmPolicies::WARN) \
+ 17, 0, WARN) \
SELECT(POLICY, CMP0099, \
"Link properties are transitive over private dependencies of " \
"static libraries.", \
- 3, 17, 0, cmPolicies::WARN) \
+ 3, 17, 0, WARN) \
SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3, \
- 17, 0, cmPolicies::WARN) \
+ 17, 0, WARN) \
SELECT(POLICY, CMP0101, \
"target_compile_options honors BEFORE keyword in all scopes.", 3, \
- 17, 0, cmPolicies::WARN) \
+ 17, 0, WARN) \
SELECT(POLICY, CMP0102, \
"mark_as_advanced() does nothing if a cache entry does not exist.", \
- 3, 17, 0, cmPolicies::WARN) \
+ 3, 17, 0, WARN) \
SELECT(POLICY, CMP0103, \
"Multiple export() with same FILE without APPEND is not allowed.", \
- 3, 18, 0, cmPolicies::WARN) \
+ 3, 18, 0, WARN) \
SELECT(POLICY, CMP0104, \
"CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty " \
"CUDA_ARCHITECTURES not allowed.", \
- 3, 18, 0, cmPolicies::WARN) \
+ 3, 18, 0, WARN) \
SELECT(POLICY, CMP0105, "Device link step uses the link options.", 3, 18, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0107, "An ALIAS target cannot overwrite another target.", \
- 3, 18, 0, cmPolicies::WARN) \
+ 3, 18, 0, WARN) \
SELECT(POLICY, CMP0108, "A target cannot link to itself through an alias.", \
- 3, 18, 0, cmPolicies::WARN) \
+ 3, 18, 0, WARN) \
SELECT(POLICY, CMP0109, \
"find_program() requires permission to execute but not to read.", 3, \
- 19, 0, cmPolicies::WARN) \
+ 19, 0, WARN) \
SELECT(POLICY, CMP0110, \
"add_test() supports arbitrary characters in test names.", 3, 19, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0111, \
"An imported target missing its location property fails during " \
"generation.", \
- 3, 19, 0, cmPolicies::WARN) \
+ 3, 19, 0, WARN) \
SELECT(POLICY, CMP0112, \
"Target file component generator expressions do not add target " \
"dependencies.", \
- 3, 19, 0, cmPolicies::WARN) \
+ 3, 19, 0, WARN) \
SELECT(POLICY, CMP0113, \
"Makefile generators do not repeat custom commands from target " \
"dependencies.", \
- 3, 19, 0, cmPolicies::WARN) \
+ 3, 19, 0, WARN) \
SELECT(POLICY, CMP0114, \
"ExternalProject step targets fully adopt their steps.", 3, 19, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0115, "Source file extensions must be explicit.", 3, 20, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0116, \
"Ninja generators transform DEPFILEs from add_custom_command().", 3, \
- 20, 0, cmPolicies::WARN) \
+ 20, 0, WARN) \
SELECT(POLICY, CMP0117, \
"MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
- 20, 0, cmPolicies::WARN) \
+ 20, 0, WARN) \
SELECT(POLICY, CMP0118, \
"GENERATED sources may be used across directories without manual " \
"marking.", \
- 3, 20, 0, cmPolicies::WARN) \
+ 3, 20, 0, WARN) \
SELECT(POLICY, CMP0119, \
"LANGUAGE source file property explicitly compiles as specified " \
"language.", \
- 3, 20, 0, cmPolicies::WARN) \
+ 3, 20, 0, WARN) \
SELECT(POLICY, CMP0120, \
"The WriteCompilerDetectionHeader module is removed.", 3, 20, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0121, \
"The list() command now validates parsing of index arguments.", 3, \
- 21, 0, cmPolicies::WARN) \
+ 21, 0, WARN) \
SELECT( \
POLICY, CMP0122, \
"UseSWIG use standard library name conventions for csharp language.", 3, \
- 21, 0, cmPolicies::WARN) \
+ 21, 0, WARN) \
SELECT(POLICY, CMP0123, \
"ARMClang cpu/arch compile and link flags must be set explicitly.", \
- 3, 21, 0, cmPolicies::WARN) \
+ 3, 21, 0, WARN) \
SELECT(POLICY, CMP0124, \
"foreach() loop variables are only available in the loop scope.", 3, \
- 21, 0, cmPolicies::WARN) \
+ 21, 0, WARN) \
SELECT(POLICY, CMP0125, \
"find_(path|file|library|program) have consistent behavior for " \
"cache variables.", \
- 3, 21, 0, cmPolicies::WARN) \
+ 3, 21, 0, WARN) \
SELECT(POLICY, CMP0126, \
"set(CACHE) does not remove a normal variable of the same name.", 3, \
- 21, 0, cmPolicies::WARN) \
+ 21, 0, WARN) \
SELECT(POLICY, CMP0127, \
"cmake_dependent_option() supports full Condition Syntax.", 3, 22, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0128, \
"Selection of language standard and extension flags improved.", 3, \
- 22, 0, cmPolicies::WARN) \
+ 22, 0, WARN) \
SELECT(POLICY, CMP0129, \
"Compiler id for MCST LCC compilers is now LCC, not GNU.", 3, 23, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0130, "while() diagnoses condition evaluation errors.", \
- 3, 24, 0, cmPolicies::WARN) \
+ 3, 24, 0, WARN) \
SELECT(POLICY, CMP0131, \
"LINK_LIBRARIES supports the LINK_ONLY generator expression.", 3, \
- 24, 0, cmPolicies::WARN) \
+ 24, 0, WARN) \
SELECT(POLICY, CMP0132, \
"Do not set compiler environment variables on first run", 3, 24, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0133, \
"The CPack module disables SLA by default in the CPack DragNDrop " \
"Generator.", \
- 3, 24, 0, cmPolicies::WARN) \
+ 3, 24, 0, WARN) \
SELECT(POLICY, CMP0134, \
"Fallback to \"HOST\" Windows registry view when \"TARGET\" view " \
"is not usable.", \
- 3, 24, 0, cmPolicies::WARN) \
+ 3, 24, 0, WARN) \
SELECT(POLICY, CMP0135, \
"ExternalProject and FetchContent ignore timestamps in archives by " \
"default for the URL download method", \
- 3, 24, 0, cmPolicies::WARN) \
+ 3, 24, 0, WARN) \
SELECT(POLICY, CMP0136, \
"Watcom runtime library flags are selected by an abstraction.", 3, \
- 24, 0, cmPolicies::WARN) \
+ 24, 0, WARN) \
SELECT(POLICY, CMP0137, \
"try_compile() passes platform variables in project mode", 3, 24, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0138, \
"CheckIPOSupported uses flags from calling project.", 3, 24, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT( \
POLICY, CMP0139, \
"The if() command supports path comparisons using PATH_EQUAL operator.", \
- 3, 24, 0, cmPolicies::WARN) \
+ 3, 24, 0, WARN) \
SELECT(POLICY, CMP0140, "The return() command checks its arguments.", 3, \
- 25, 0, cmPolicies::WARN) \
+ 25, 0, WARN) \
SELECT( \
POLICY, CMP0141, \
"MSVC debug information format flags are selected by an abstraction.", 3, \
- 25, 0, cmPolicies::WARN) \
+ 25, 0, WARN) \
SELECT(POLICY, CMP0142, \
"The Xcode generator does not append per-config suffixes to " \
"library search paths.", \
- 3, 25, 0, cmPolicies::WARN) \
+ 3, 25, 0, WARN) \
SELECT(POLICY, CMP0143, \
"Global property USE_FOLDERS treated as ON by default", 3, 26, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0144, \
"find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \
- 27, 0, cmPolicies::WARN) \
- SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0, \
- cmPolicies::WARN) \
+ 27, 0, WARN) \
+ SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0, WARN) \
SELECT(POLICY, CMP0147, \
"Visual Studio generators build custom commands in parallel.", 3, \
- 27, 0, cmPolicies::WARN) \
+ 27, 0, WARN) \
SELECT(POLICY, CMP0148, \
"The FindPythonInterp and FindPythonLibs modules are removed.", 3, \
- 27, 0, cmPolicies::WARN) \
+ 27, 0, WARN) \
SELECT(POLICY, CMP0149, \
"Visual Studio generators select latest Windows SDK by default.", 3, \
- 27, 0, cmPolicies::WARN) \
+ 27, 0, WARN) \
SELECT(POLICY, CMP0150, \
"ExternalProject_Add and FetchContent_Declare commands " \
"treat relative GIT_REPOSITORY paths as being relative " \
"to the parent project's remote.", \
- 3, 27, 0, cmPolicies::WARN) \
+ 3, 27, 0, WARN) \
SELECT(POLICY, CMP0151, \
"AUTOMOC include directory is a system include directory by " \
"default.", \
- 3, 27, 0, cmPolicies::WARN) \
+ 3, 27, 0, WARN) \
SELECT( \
POLICY, CMP0152, \
"file(REAL_PATH) resolves symlinks before collapsing ../ components.", 3, \
- 28, 0, cmPolicies::WARN) \
+ 28, 0, WARN) \
SELECT(POLICY, CMP0153, "The exec_program command should not be called.", \
- 3, 28, 0, cmPolicies::WARN) \
+ 3, 28, 0, WARN) \
SELECT( \
POLICY, CMP0154, \
"Generated files are private by default in targets using file sets.", 3, \
- 28, 0, cmPolicies::WARN) \
+ 28, 0, WARN) \
SELECT(POLICY, CMP0155, \
"C++ sources in targets with at least C++20 are scanned for " \
"imports when supported.", \
- 3, 28, 0, cmPolicies::WARN) \
+ 3, 28, 0, WARN) \
SELECT( \
POLICY, CMP0156, \
"De-duplicate libraries on link lines based on linker capabilities.", 3, \
- 29, 0, cmPolicies::WARN) \
+ 29, 0, WARN) \
SELECT(POLICY, CMP0157, \
"Swift compilation mode selected by an abstraction.", 3, 29, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0158, \
"add_test() honors CMAKE_CROSSCOMPILING_EMULATOR only when " \
"cross-compiling.", \
- 3, 29, 0, cmPolicies::WARN) \
+ 3, 29, 0, WARN) \
SELECT(POLICY, CMP0159, \
- "file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0, \
- cmPolicies::WARN) \
+ "file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0, WARN) \
SELECT( \
POLICY, CMP0160, \
"More read-only target properties now error when trying to set them.", 3, \
- 29, 0, cmPolicies::WARN) \
+ 29, 0, WARN) \
SELECT(POLICY, CMP0161, "CPACK_PRODUCTBUILD_DOMAINS defaults to true.", 3, \
- 29, 0, cmPolicies::WARN) \
+ 29, 0, WARN) \
SELECT( \
POLICY, CMP0162, \
"Visual Studio generators add UseDebugLibraries indicators by default.", \
- 3, 30, 0, cmPolicies::WARN) \
+ 3, 30, 0, WARN) \
SELECT( \
POLICY, CMP0163, \
"The GENERATED source file property is now visible in all directories.", \
- 3, 30, 0, cmPolicies::WARN) \
+ 3, 30, 0, WARN) \
SELECT(POLICY, CMP0164, \
"add_library() rejects SHARED libraries when not supported by the " \
"platform.", \
- 3, 30, 0, cmPolicies::WARN) \
+ 3, 30, 0, WARN) \
SELECT(POLICY, CMP0165, \
"enable_language() must not be called before project().", 3, 30, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0166, \
"TARGET_PROPERTY evaluates link properties transitively over " \
"private dependencies of static libraries.", \
- 3, 30, 0, cmPolicies::WARN) \
- SELECT(POLICY, CMP0167, "The FindBoost module is removed.", 3, 30, 0, \
- cmPolicies::WARN) \
+ 3, 30, 0, WARN) \
+ SELECT(POLICY, CMP0167, "The FindBoost module is removed.", 3, 30, 0, WARN) \
SELECT(POLICY, CMP0168, \
"FetchContent implements steps directly instead of through a " \
"sub-build.", \
- 3, 30, 0, cmPolicies::WARN) \
+ 3, 30, 0, WARN) \
SELECT(POLICY, CMP0169, \
"FetchContent_Populate(depName) single-argument signature is " \
"deprecated.", \
- 3, 30, 0, cmPolicies::WARN) \
+ 3, 30, 0, WARN) \
SELECT(POLICY, CMP0170, \
"FETCHCONTENT_FULLY_DISCONNECTED requirements are enforced.", 3, 30, \
- 0, cmPolicies::WARN) \
+ 0, WARN) \
SELECT(POLICY, CMP0171, "'codegen' is a reserved target name.", 3, 31, 0, \
- cmPolicies::WARN) \
+ WARN) \
SELECT(POLICY, CMP0172, \
"The CPack module enables per-machine installation by default in " \
"the CPack WIX Generator.", \
- 3, 31, 0, cmPolicies::WARN) \
+ 3, 31, 0, WARN) \
SELECT(POLICY, CMP0173, "The CMakeFindFrameworks module is removed.", 3, \
- 31, 0, cmPolicies::WARN) \
+ 31, 0, WARN) \
SELECT(POLICY, CMP0174, \
"cmake_parse_arguments(PARSE_ARGV) defines a variable for an empty " \
"string after a single-value keyword.", \
- 3, 31, 0, cmPolicies::WARN) \
+ 3, 31, 0, WARN) \
SELECT(POLICY, CMP0175, "add_custom_command() rejects invalid arguments.", \
- 3, 31, 0, cmPolicies::WARN) \
+ 3, 31, 0, WARN) \
SELECT(POLICY, CMP0176, "execute_process() ENCODING is UTF-8 by default.", \
- 3, 31, 0, cmPolicies::WARN) \
+ 3, 31, 0, WARN) \
SELECT(POLICY, CMP0177, "install() DESTINATION paths are normalized.", 3, \
- 31, 0, cmPolicies::WARN) \
+ 31, 0, WARN) \
SELECT(POLICY, CMP0178, "Test command lines preserve empty arguments.", 3, \
- 31, 0, cmPolicies::WARN) \
+ 31, 0, WARN) \
SELECT(POLICY, CMP0179, \
"De-duplication of static libraries on link lines keeps first " \
"occurrence.", \
- 3, 31, 0, cmPolicies::WARN) \
+ 3, 31, 0, WARN) \
SELECT(POLICY, CMP0180, \
"project() always sets <PROJECT-NAME>_* as normal variables.", 3, \
- 31, 0, cmPolicies::WARN)
+ 31, 0, WARN) \
+ SELECT(POLICY, CMP0181, \
+ "Link command-line fragment variables are parsed and re-quoted.", 4, \
+ 0, 0, WARN) \
+ SELECT(POLICY, CMP0182, \
+ "Create shared library archives by default on AIX.", 4, 0, 0, WARN) \
+ SELECT(POLICY, CMP0183, \
+ "add_feature_info() supports full Condition Syntax.", 4, 0, 0, WARN) \
+ SELECT(POLICY, CMP0184, \
+ "MSVC runtime check flags are selected by an abstraction.", 4, 0, 0, \
+ WARN) \
+ SELECT(POLICY, CMP0185, \
+ "FindRuby no longer provides upper-case RUBY_* variables.", 4, 0, 0, \
+ WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
@@ -597,7 +600,9 @@ class cmMakefile;
F(CMP0157) \
F(CMP0160) \
F(CMP0162) \
- F(CMP0179)
+ F(CMP0179) \
+ F(CMP0181) \
+ F(CMP0182)
#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
F(CMP0116) \
@@ -617,10 +622,6 @@ public:
OLD, ///< Use old behavior
WARN, ///< Use old behavior but issue a warning
NEW, ///< Use new behavior
- /// Issue an error if user doesn't set policy status to NEW and hits the
- /// check
- REQUIRED_IF_USED,
- REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
};
/// Policy identifiers
@@ -639,10 +640,10 @@ public:
};
//! convert a string policy ID into a number
- static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid);
+ static bool GetPolicyID(char const* id, /* out */ cmPolicies::PolicyID& pid);
- //! Get the default status for a policy
- static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
+ //! Return whether a policy has been removed.
+ static bool IsRemoved(cmPolicies::PolicyID id);
enum class WarnCompat
{
@@ -664,10 +665,7 @@ public:
static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
//! return an error string for when a required policy is unspecified
- static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
-
- //! return an error string for when a required policy is unspecified
- static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
+ static std::string GetRemovedPolicyError(cmPolicies::PolicyID id);
/** Represent a set of policy values. */
struct PolicyMap
diff --git a/Source/cmProcessOutput.cxx b/Source/cmProcessOutput.cxx
index 601d701..ec3fd67 100644
--- a/Source/cmProcessOutput.cxx
+++ b/Source/cmProcessOutput.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmProcessOutput.h"
@@ -123,7 +123,7 @@ bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
#endif
}
-bool cmProcessOutput::DecodeText(const char* data, size_t length,
+bool cmProcessOutput::DecodeText(char const* data, size_t length,
std::string& decoded, size_t id)
{
return this->DecodeText(std::string(data, length), decoded, id);
@@ -133,7 +133,7 @@ bool cmProcessOutput::DecodeText(std::vector<char> raw,
std::vector<char>& decoded, size_t id)
{
std::string str;
- const bool success =
+ bool const success =
this->DecodeText(std::string(raw.begin(), raw.end()), str, id);
decoded.assign(str.begin(), str.end());
return success;
@@ -144,7 +144,7 @@ bool cmProcessOutput::DoDecodeText(std::string raw, std::string& decoded,
wchar_t* lastChar)
{
bool success = false;
- const int wlength =
+ int const wlength =
MultiByteToWideChar(codepage, 0, raw.c_str(), int(raw.size()), nullptr, 0);
auto wdata = cm::make_unique<wchar_t[]>(wlength);
int r = MultiByteToWideChar(codepage, 0, raw.c_str(), int(raw.size()),
diff --git a/Source/cmProcessOutput.h b/Source/cmProcessOutput.h
index f15e3f9..1582cd8 100644
--- a/Source/cmProcessOutput.h
+++ b/Source/cmProcessOutput.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,7 +69,7 @@ public:
* \return true if successfully decoded \a data to \a decoded or false if
* not.
*/
- bool DecodeText(const char* data, size_t length, std::string& decoded,
+ bool DecodeText(char const* data, size_t length, std::string& decoded,
size_t id = 0);
/**
* \overload
diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx
index 1dd1dce..d5d5160 100644
--- a/Source/cmProcessTools.cxx
+++ b/Source/cmProcessTools.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmProcessTools.h"
#include <algorithm>
@@ -60,7 +60,7 @@ std::vector<cmUVProcessChain::Status> cmProcessTools::RunProcess(
auto status = chain.GetStatus();
std::transform(
status.begin(), status.end(), std::back_inserter(result),
- [](const cmUVProcessChain::Status* s) -> cmUVProcessChain::Status {
+ [](cmUVProcessChain::Status const* s) -> cmUVProcessChain::Status {
return *s;
});
return result;
@@ -72,16 +72,16 @@ cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR)
{
}
-void cmProcessTools::LineParser::SetLog(std::ostream* log, const char* prefix)
+void cmProcessTools::LineParser::SetLog(std::ostream* log, char const* prefix)
{
this->Log = log;
this->Prefix = prefix ? prefix : "";
}
-bool cmProcessTools::LineParser::ProcessChunk(const char* first, int length)
+bool cmProcessTools::LineParser::ProcessChunk(char const* first, int length)
{
- const char* last = first + length;
- for (const char* c = first; c != last; ++c) {
+ char const* last = first + length;
+ for (char const* c = first; c != last; ++c) {
if (*c == this->Separator || *c == '\0') {
this->LineEnd = *c;
diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h
index 2bdabea..47b428d 100644
--- a/Source/cmProcessTools.h
+++ b/Source/cmProcessTools.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,11 +27,11 @@ public:
/** Process the given output data from a tool. Processing may be
done incrementally. Returns true if the parser is interested
in any more data and false if it is done. */
- bool Process(const char* data, int length)
+ bool Process(char const* data, int length)
{
return this->ProcessChunk(data, length);
}
- bool Process(const char* data)
+ bool Process(char const* data)
{
return this->Process(data, static_cast<int>(strlen(data)));
}
@@ -41,7 +41,7 @@ public:
protected:
/** Implement in a subclass to process a chunk of data. It should
return true only if it is interested in more data. */
- virtual bool ProcessChunk(const char* data, int length) = 0;
+ virtual bool ProcessChunk(char const* data, int length) = 0;
};
/** Process output parser that extracts one line at a time. */
@@ -53,16 +53,16 @@ public:
LineParser(char sep = '\n', bool ignoreCR = true);
/** Configure logging of lines as they are extracted. */
- void SetLog(std::ostream* log, const char* prefix);
+ void SetLog(std::ostream* log, char const* prefix);
protected:
std::ostream* Log = nullptr;
- const char* Prefix = nullptr;
+ char const* Prefix = nullptr;
std::string Line;
char Separator;
char LineEnd = '\0';
bool IgnoreCR;
- bool ProcessChunk(const char* data, int length) override;
+ bool ProcessChunk(char const* data, int length) override;
/** Implement in a subclass to process one line of input. It
should return true only if it is interested in more data. */
@@ -73,7 +73,7 @@ public:
class OutputLogger : public LineParser
{
public:
- OutputLogger(std::ostream& log, const char* prefix = nullptr)
+ OutputLogger(std::ostream& log, char const* prefix = nullptr)
{
this->SetLog(&log, prefix);
}
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 5d854cd..cdab869 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmProjectCommand.h"
#include <array>
@@ -23,7 +23,7 @@
#include "cmValue.h"
static bool IncludeByVariable(cmExecutionStatus& status,
- const std::string& variable);
+ std::string const& variable);
static void TopLevelCMakeVarCondSet(cmMakefile& mf, std::string const& name,
std::string const& value);
@@ -107,7 +107,6 @@ bool cmProjectCommand(std::vector<std::string> const& args,
bool haveLanguages = false;
bool haveDescription = false;
bool haveHomepage = false;
- bool injectedProjectCommand = false;
std::string version;
std::string description;
std::string homepage;
@@ -198,8 +197,6 @@ bool cmProjectCommand(std::vector<std::string> const& args,
"by a value that expanded to nothing.");
resetReporter();
};
- } else if (i == 1 && args[i] == "__CMAKE_INJECTED_PROJECT_COMMAND__") {
- injectedProjectCommand = true;
} else if (doing == DoingVersion) {
doing = DoingLanguages;
version = args[i];
@@ -234,17 +231,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
languages.emplace_back("NONE");
}
- cmPolicies::PolicyStatus const cmp0048 =
- mf.GetPolicyStatus(cmPolicies::CMP0048);
if (haveVersion) {
- // Set project VERSION variables to given values
- if (cmp0048 == cmPolicies::OLD || cmp0048 == cmPolicies::WARN) {
- mf.IssueMessage(MessageType::FATAL_ERROR,
- "VERSION not allowed unless CMP0048 is set to NEW");
- cmSystemTools::SetFatalErrorOccurred();
- return true;
- }
-
cmsys::RegularExpression vx(
R"(^([0-9]+(\.[0-9]+(\.[0-9]+(\.[0-9]+)?)?)?)?$)");
if (!vx.find(version)) {
@@ -266,7 +253,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
std::numeric_limits<unsigned>::digits10 + 2;
char vb[MAX_VERSION_COMPONENTS][maxIntLength];
unsigned v[MAX_VERSION_COMPONENTS] = { 0, 0, 0, 0 };
- const int vc = std::sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1],
+ int const vc = std::sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1],
&v[2], &v[3]);
for (auto i = 0u; i < MAX_VERSION_COMPONENTS; ++i) {
if (static_cast<int>(i) < vc) {
@@ -315,7 +302,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
version_components[2]);
TopLevelCMakeVarCondSet(mf, "CMAKE_PROJECT_VERSION_TWEAK",
version_components[3]);
- } else if (cmp0048 != cmPolicies::OLD) {
+ } else {
// Set project VERSION variables to empty
std::vector<std::string> vv = { "PROJECT_VERSION",
"PROJECT_VERSION_MAJOR",
@@ -334,26 +321,12 @@ bool cmProjectCommand(std::vector<std::string> const& args,
vv.emplace_back("CMAKE_PROJECT_VERSION_PATCH");
vv.emplace_back("CMAKE_PROJECT_VERSION_TWEAK");
}
- std::string vw;
for (std::string const& i : vv) {
cmValue v = mf.GetDefinition(i);
if (cmNonempty(v)) {
- if (cmp0048 == cmPolicies::WARN) {
- if (!injectedProjectCommand) {
- vw += "\n ";
- vw += i;
- }
- } else {
- mf.AddDefinition(i, "");
- }
+ mf.AddDefinition(i, "");
}
}
- if (!vw.empty()) {
- mf.IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0048),
- "\nThe following variable(s) would be set to empty:", vw));
- }
}
mf.AddDefinition("PROJECT_DESCRIPTION", description);
@@ -383,7 +356,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
}
static bool IncludeByVariable(cmExecutionStatus& status,
- const std::string& variable)
+ std::string const& variable)
{
cmMakefile& mf = status.GetMakefile();
cmValue include = mf.GetDefinition(variable);
@@ -423,7 +396,7 @@ static bool IncludeByVariable(cmExecutionStatus& status,
continue;
}
- const bool readit = mf.ReadDependentFile(filePath);
+ bool const readit = mf.ReadDependentFile(filePath);
if (readit) {
// If the included file ran successfully, continue to the next file
continue;
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index 33f0955..711da96 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 0781109..5aa631d 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx
index 22723b9..49281ae 100644
--- a/Source/cmPropertyDefinition.cxx
+++ b/Source/cmPropertyDefinition.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPropertyDefinition.h"
#include <tuple>
@@ -16,9 +16,9 @@ cmPropertyDefinition::cmPropertyDefinition(std::string shortDescription,
}
void cmPropertyDefinitionMap::DefineProperty(
- const std::string& name, cmProperty::ScopeType scope,
- const std::string& ShortDescription, const std::string& FullDescription,
- bool chain, const std::string& initializeFromVariable)
+ std::string const& name, cmProperty::ScopeType scope,
+ std::string const& ShortDescription, std::string const& FullDescription,
+ bool chain, std::string const& initializeFromVariable)
{
auto it = this->Map_.find(KeyType(name, scope));
if (it == this->Map_.end()) {
@@ -31,7 +31,7 @@ void cmPropertyDefinitionMap::DefineProperty(
}
cmPropertyDefinition const* cmPropertyDefinitionMap::GetPropertyDefinition(
- const std::string& name, cmProperty::ScopeType scope) const
+ std::string const& name, cmProperty::ScopeType scope) const
{
auto it = this->Map_.find(KeyType(name, scope));
if (it != this->Map_.end()) {
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index 9dd2cfe..4147d9b 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,19 +29,19 @@ public:
bool IsChained() const { return this->Chained; }
/// Get the documentation (short version)
- const std::string& GetShortDescription() const
+ std::string const& GetShortDescription() const
{
return this->ShortDescription;
}
/// Get the documentation (full version)
- const std::string& GetFullDescription() const
+ std::string const& GetFullDescription() const
{
return this->FullDescription;
}
/// Get the variable the property is initialized from
- const std::string& GetInitializeFromVariable() const
+ std::string const& GetInitializeFromVariable() const
{
return this->InitializeFromVariable;
}
@@ -60,17 +60,17 @@ class cmPropertyDefinitionMap
{
public:
// define the property
- void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
- const std::string& ShortDescription,
- const std::string& FullDescription, bool chain,
- const std::string& initializeFromVariable);
+ void DefineProperty(std::string const& name, cmProperty::ScopeType scope,
+ std::string const& ShortDescription,
+ std::string const& FullDescription, bool chain,
+ std::string const& initializeFromVariable);
// get the property definition if present, otherwise nullptr
cmPropertyDefinition const* GetPropertyDefinition(
- const std::string& name, cmProperty::ScopeType scope) const;
+ std::string const& name, cmProperty::ScopeType scope) const;
using KeyType = std::pair<std::string, cmProperty::ScopeType>;
- const std::map<KeyType, cmPropertyDefinition>& GetMap() const
+ std::map<KeyType, cmPropertyDefinition> const& GetMap() const
{
return this->Map_;
}
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 5bb769a..cb8938f 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmPropertyMap.h"
#include <algorithm>
@@ -10,7 +10,7 @@ void cmPropertyMap::Clear()
this->Map_.clear();
}
-void cmPropertyMap::SetProperty(const std::string& name, cmValue value)
+void cmPropertyMap::SetProperty(std::string const& name, cmValue value)
{
if (!value) {
this->Map_.erase(name);
@@ -20,8 +20,8 @@ void cmPropertyMap::SetProperty(const std::string& name, cmValue value)
this->Map_[name] = *value;
}
-void cmPropertyMap::AppendProperty(const std::string& name,
- const std::string& value, bool asString)
+void cmPropertyMap::AppendProperty(std::string const& name,
+ std::string const& value, bool asString)
{
// Skip if nothing to append.
if (value.empty()) {
@@ -37,12 +37,12 @@ void cmPropertyMap::AppendProperty(const std::string& name,
}
}
-void cmPropertyMap::RemoveProperty(const std::string& name)
+void cmPropertyMap::RemoveProperty(std::string const& name)
{
this->Map_.erase(name);
}
-cmValue cmPropertyMap::GetPropertyValue(const std::string& name) const
+cmValue cmPropertyMap::GetPropertyValue(std::string const& name) const
{
auto it = this->Map_.find(name);
if (it != this->Map_.end()) {
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 3cd90ec..1caa4d3 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,21 +25,21 @@ public:
// -- Properties
//! Set the property value
- void SetProperty(const std::string& name, cmValue value);
- void SetProperty(const std::string& name, const std::string& value)
+ void SetProperty(std::string const& name, cmValue value);
+ void SetProperty(std::string const& name, std::string const& value)
{
this->SetProperty(name, cmValue(value));
}
//! Append to the property value
- void AppendProperty(const std::string& name, const std::string& value,
+ void AppendProperty(std::string const& name, std::string const& value,
bool asString = false);
//! Get the property value
- cmValue GetPropertyValue(const std::string& name) const;
+ cmValue GetPropertyValue(std::string const& name) const;
//! Remove the property @a name from the map
- void RemoveProperty(const std::string& name);
+ void RemoveProperty(std::string const& name);
// -- Lists
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 58cf514..30ff21a 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQTWrapCPPCommand.h"
#include <utility>
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 28ceb3a..fab4406 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 8b2a42c..692f77b 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQTWrapUICommand.h"
#include <utility>
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 3f92ea9..886d362 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 0a394b5..71fd8de 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQtAutoGen.h"
#include <algorithm>
@@ -56,8 +56,8 @@ static void MergeOptions(std::vector<std::string>& baseOpts,
}
// Test if this is a value option and change the existing value
if (!optName.empty() && cm::contains(valueOpts, optName)) {
- const auto existItNext(existIt + 1);
- const auto fitNext(fit + 1);
+ auto const existItNext(existIt + 1);
+ auto const fitNext(fit + 1);
if ((existItNext != baseOpts.end()) && (fitNext != fitEnd)) {
*existItNext = *fitNext;
++fit;
@@ -134,7 +134,7 @@ std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc)
std::string cmQtAutoGen::Quoted(cm::string_view text)
{
- static std::initializer_list<std::pair<const char*, const char*>> const
+ static std::initializer_list<std::pair<char const*, char const*>> const
replacements = { { "\\", "\\\\" }, { "\"", "\\\"" }, { "\a", "\\a" },
{ "\b", "\\b" }, { "\f", "\\f" }, { "\n", "\\n" },
{ "\r", "\\r" }, { "\t", "\\t" }, { "\v", "\\v" } };
@@ -231,7 +231,7 @@ static void RccListParseContent(std::string const& content,
cmsys::RegularExpression fileMatchRegex("(<file[^<]+)");
cmsys::RegularExpression fileReplaceRegex("(^<file[^>]*>)");
- const char* contentChars = content.c_str();
+ char const* contentChars = content.c_str();
while (fileMatchRegex.find(contentChars)) {
std::string const qrcEntry = fileMatchRegex.match(1);
contentChars += qrcEntry.size();
@@ -296,7 +296,7 @@ cmQtAutoGen::RccLister::RccLister() = default;
cmQtAutoGen::RccLister::RccLister(std::string rccExecutable,
std::vector<std::string> listOptions)
- : RccExcutable_(std::move(rccExecutable))
+ : RccExecutable_(std::move(rccExecutable))
, ListOptions_(std::move(listOptions))
{
}
@@ -319,8 +319,8 @@ bool cmQtAutoGen::RccLister::list(std::string const& qrcFile,
// contains non-ASCII characters.
std::string const fileDir = cmSystemTools::GetFilenamePath(qrcFile);
- if (!this->RccExcutable_.empty() &&
- cmSystemTools::FileExists(this->RccExcutable_, true) &&
+ if (!this->RccExecutable_.empty() &&
+ cmSystemTools::FileExists(this->RccExecutable_, true) &&
!this->ListOptions_.empty()) {
bool result = false;
@@ -329,7 +329,7 @@ bool cmQtAutoGen::RccLister::list(std::string const& qrcFile,
std::string rccStdErr;
{
std::vector<std::string> cmd;
- cmd.emplace_back(this->RccExcutable_);
+ cmd.emplace_back(this->RccExecutable_);
cm::append(cmd, this->ListOptions_);
cmd.emplace_back(cmSystemTools::GetFilenameName(qrcFile));
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index b302403..926480f 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -127,10 +127,10 @@ public:
RccLister(std::string rccExecutable, std::vector<std::string> listOptions);
//! The rcc executable
- std::string const& RccExcutable() const { return this->RccExcutable_; }
+ std::string const& RccExecutable() const { return this->RccExecutable_; }
void SetRccExecutable(std::string const& rccExecutable)
{
- this->RccExcutable_ = rccExecutable;
+ this->RccExecutable_ = rccExecutable;
}
//! The rcc executable list options
@@ -152,7 +152,7 @@ public:
std::string& error, bool verbose = false) const;
private:
- std::string RccExcutable_;
+ std::string RccExecutable_;
std::vector<std::string> ListOptions_;
};
};
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 2f377ae..7b41d91 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQtAutoGenGlobalInitializer.h"
#include <set>
@@ -44,7 +44,7 @@ cmQtAutoGenGlobalInitializer::Keywords::Keywords()
cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
std::vector<std::unique_ptr<cmLocalGenerator>> const& localGenerators)
{
- for (const auto& localGen : localGenerators) {
+ for (auto const& localGen : localGenerators) {
// Detect global autogen and autorcc target names
bool globalAutoGenTarget = false;
bool globalAutoRccTarget = false;
@@ -76,7 +76,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
}
// Find targets that require AUTOMOC/UIC/RCC processing
- for (const auto& target : localGen->GetGeneratorTargets()) {
+ for (auto const& target : localGen->GetGeneratorTargets()) {
// Process only certain target types
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
@@ -249,7 +249,7 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures(
command.emplace_back(exe);
command.emplace_back("-h");
int retVal = 0;
- const bool runResult = cmSystemTools::RunSingleCommand(
+ bool const runResult = cmSystemTools::RunSingleCommand(
command, &stdOut, &stdErr, &retVal, nullptr,
cmSystemTools::OUTPUT_NONE, cmDuration::zero(),
cmProcessOutput::Auto);
@@ -300,7 +300,7 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures(
command.emplace_back(executable.Default);
command.emplace_back("-h");
int retVal = 0;
- const bool runResult = cmSystemTools::RunSingleCommand(
+ bool const runResult = cmSystemTools::RunSingleCommand(
command, &stdOut, &stdErr, &retVal, nullptr, cmSystemTools::OUTPUT_NONE,
cmDuration::zero(), cmProcessOutput::Auto);
if (!runResult) {
diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h
index c1c4758..4d3c51b 100644
--- a/Source/cmQtAutoGenGlobalInitializer.h
+++ b/Source/cmQtAutoGenGlobalInitializer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 5810d03..2e42602 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQtAutoGenInitializer.h"
#include <array>
@@ -360,11 +360,11 @@ void cmQtAutoGenInitializer::AddAutogenExecutableToDependencies(
if (genVars.ExecutableTarget) {
dependencies.push_back(genVars.ExecutableTarget->Target->GetName());
} else if (this->MultiConfig && this->UseBetterGraph) {
- cm::string_view const& configGenexWithCommandConfig =
+ cm::string_view const configGenexWithCommandConfig =
"$<COMMAND_CONFIG:$<$<CONFIG:";
- cm::string_view const& configGenex = "$<$<CONFIG:";
- cm::string_view const& configGenexEnd = ">";
- cm::string_view const& configGenexEndWithCommandConfig = ">>";
+ cm::string_view const configGenex = "$<$<CONFIG:";
+ cm::string_view const configGenexEnd = ">";
+ cm::string_view const configGenexEndWithCommandConfig = ">>";
auto genexBegin =
this->CrossConfig ? configGenexWithCommandConfig : configGenex;
auto genexEnd =
@@ -433,8 +433,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
case cmPolicies::OLD:
// Ignore GENERATED files
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// Process GENERATED files
this->CMP0071Accept = true;
@@ -450,8 +448,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
case cmPolicies::OLD:
// Ignore .hh files
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// Process .hh file
this->CMP0100Accept = true;
@@ -532,7 +528,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
#ifdef _WIN32
{
- const auto& value =
+ auto const& value =
this->GenTarget->GetProperty("AUTOGEN_COMMAND_LINE_LENGTH_MAX");
if (value.IsSet()) {
using maxCommandLineLengthType =
@@ -669,8 +665,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
case cmPolicies::OLD:
addBefore = true;
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
"CXX");
@@ -888,10 +882,10 @@ bool cmQtAutoGenInitializer::InitRcc()
std::string const qtFeatureZSTD = "QT_FEATURE_zstd";
if (this->GenTarget->Target->GetMakefile()->IsDefinitionSet(
qtFeatureZSTD)) {
- const auto zstdDef =
+ auto const zstdDef =
this->GenTarget->Target->GetMakefile()->GetSafeDefinition(
qtFeatureZSTD);
- const auto zstdVal = cmValue(zstdDef);
+ auto const zstdVal = cmValue(zstdDef);
if (zstdVal.IsOff()) {
auto const& kw = this->GlobalInitializer->kw();
auto rccOptions = this->GenTarget->GetSafeProperty(kw.AUTORCC_OPTIONS);
@@ -936,7 +930,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
auto addMUHeader = [this](MUFileHandle&& muf, cm::string_view extension) {
cmSourceFile* sf = muf->SF;
- const bool muIt = (muf->MocIt || muf->UicIt);
+ bool const muIt = (muf->MocIt || muf->UicIt);
if (this->CMP0100Accept || (extension != "hh")) {
// Accept
if (muIt && muf->Generated) {
@@ -1064,7 +1058,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// The reason is that their file names might be discovered from source files
// at generation time.
if (this->MocOrUicEnabled()) {
- for (const auto& sf : this->Makefile->GetSourceFiles()) {
+ for (auto const& sf : this->Makefile->GetSourceFiles()) {
// sf->GetExtension() is only valid after sf->ResolveFullPath() ...
// Since we're iterating over source files that might be not in the
// target we need to check for path errors (not existing files).
@@ -1216,7 +1210,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Process qrc files
if (!this->Rcc.Qrcs.empty()) {
- const bool modernQt = (this->QtVersion.Major >= 5);
+ bool const modernQt = (this->QtVersion.Major >= 5);
// Target rcc options
cmList const optionsTarget{ this->GenTarget->GetSafeProperty(
kw.AUTORCC_OPTIONS) };
@@ -1328,7 +1322,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// ${target}_autogen/timestamp custom command.
// We cannot just use Moc.CompilationFileGenex here, because that
// custom command runs cmake_autogen for each configuration.
- for (const auto& p : this->Moc.CompilationFile.Config) {
+ for (auto const& p : this->Moc.CompilationFile.Config) {
timestampByproducts.push_back(p.second);
}
} else {
@@ -1457,8 +1451,11 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
if (this->AutogenTarget.DependOrigin) {
// add_dependencies/addUtility do not support generator expressions.
// We depend only on the libraries found in all configs therefore.
- std::map<cmGeneratorTarget const*, std::size_t> commonTargets;
+ std::map<cmGeneratorTarget const*, std::size_t> targetsPartOfAllConfigs;
for (std::string const& config : this->ConfigsList) {
+ // The same target might appear multiple times in a config, but we
+ // should only count it once.
+ std::set<cmGeneratorTarget const*> seenTargets;
cmLinkImplementationLibraries const* libs =
this->GenTarget->GetLinkImplementationLibraries(
config, cmGeneratorTarget::UseTo::Link);
@@ -1466,14 +1463,15 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
for (cmLinkItem const& item : libs->Libraries) {
cmGeneratorTarget const* libTarget = item.Target;
if (libTarget &&
- !StaticLibraryCycle(this->GenTarget, libTarget, config)) {
+ !StaticLibraryCycle(this->GenTarget, libTarget, config) &&
+ seenTargets.insert(libTarget).second) {
// Increment target config count
- commonTargets[libTarget]++;
+ targetsPartOfAllConfigs[libTarget]++;
}
}
}
}
- for (auto const& item : commonTargets) {
+ for (auto const& item : targetsPartOfAllConfigs) {
if (item.second == this->ConfigsList.size()) {
this->AutogenTarget.DependTargets.insert(item.first->Target);
}
@@ -1498,7 +1496,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// The dependency tree would then look like
// '_autogen_timestamp_deps (order-only)' <- '/timestamp' file <-
// '_autogen' target.
- const auto timestampTargetName =
+ auto const timestampTargetName =
cmStrCat(this->GenTarget->GetName(), "_autogen_timestamp_deps");
auto cc = cm::make_unique<cmCustomCommand>();
@@ -1642,7 +1640,7 @@ void cmQtAutoGenInitializer::AddCMakeProcessToCommandLines(
"$<CONFIG>", "$<COMMAND_CONFIG:$<CONFIG>>" }));
} else if ((this->MultiConfig && this->GlobalGen->IsXcode()) ||
this->CrossConfig) {
- const auto& configs =
+ auto const& configs =
processName == "cmake_autorcc" ? this->ConfigsList : autogenConfigs;
for (std::string const& config : configs) {
commandLines.push_back(
@@ -2177,7 +2175,7 @@ static cmQtAutoGen::IntegerVersion parseMocVersion(std::string str)
{
cmQtAutoGen::IntegerVersion result;
- static const std::string prelude = "moc ";
+ static std::string const prelude = "moc ";
size_t const pos = str.find(prelude);
if (pos == std::string::npos) {
return result;
@@ -2197,7 +2195,7 @@ static cmQtAutoGen::IntegerVersion parseMocVersion(std::string str)
}
static cmQtAutoGen::IntegerVersion GetMocVersion(
- const std::string& mocExecutablePath)
+ std::string const& mocExecutablePath)
{
std::string capturedStdOut;
int exitCode;
@@ -2218,8 +2216,7 @@ static std::string FindMocExecutableFromMocTarget(cmMakefile const* makefile,
unsigned int qtMajorVersion)
{
std::string result;
- const std::string mocTargetName =
- "Qt" + std::to_string(qtMajorVersion) + "::moc";
+ std::string const mocTargetName = cmStrCat("Qt", qtMajorVersion, "::moc");
cmTarget const* mocTarget = makefile->FindTargetToUse(mocTargetName);
if (mocTarget) {
result = mocTarget->GetSafeProperty("IMPORTED_LOCATION");
@@ -2232,7 +2229,7 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target,
std::string mocExecutable)
{
// Converts a char ptr to an unsigned int value
- auto toUInt = [](const char* const input) -> unsigned int {
+ auto toUInt = [](char const* const input) -> unsigned int {
unsigned long tmp = 0;
if (input && cmStrToULong(input, &tmp)) {
return static_cast<unsigned int>(tmp);
@@ -2365,7 +2362,7 @@ std::string cmQtAutoGenInitializer::GetMocBuildPath(MUFile const& muf)
}
bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
- const std::string& executable,
+ std::string const& executable,
bool ignoreMissingTarget) const
{
auto print_err = [this, &genVars](std::string const& err) {
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 1ab038b..09015fe 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -139,7 +139,7 @@ private:
std::string GetMocBuildPath(MUFile const& muf);
- bool GetQtExecutable(GenVarsT& genVars, const std::string& executable,
+ bool GetQtExecutable(GenVarsT& genVars, std::string const& executable,
bool ignoreMissingTarget) const;
void handleSkipPch(cmSourceFile* sf);
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 376ac2a..124692a 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQtAutoGenerator.h"
#include <iterator>
@@ -439,7 +439,6 @@ bool cmQtAutoGenerator::Run(cm::string_view infoFile, cm::string_view config,
// Info file
this->InfoFile_ = std::string(infoFile);
- cmSystemTools::CollapseFullPath(this->InfoFile_);
this->InfoDir_ = cmSystemTools::GetFilenamePath(this->InfoFile_);
// Load info file time
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 4b15fc7..f8ea90d 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 251ef3a..6d524ef 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQtAutoMocUic.h"
#include <algorithm>
@@ -7,7 +7,6 @@
#include <cstddef>
#include <limits>
#include <map>
-#include <mutex>
#include <set>
#include <string>
#include <unordered_map>
@@ -345,8 +344,6 @@ public:
void MaybeWriteResponseFile(std::string const& outputFile,
std::vector<std::string>& cmd) const;
- static void MaybePrependCmdExe(std::vector<std::string>& cmd);
-
/** @brief Run an external process. Use only during Process() call! */
bool RunProcess(GenT genType, cmWorkerPool::ProcessResultT& result,
std::vector<std::string> const& command,
@@ -386,7 +383,7 @@ public:
std::set<std::string> const& source,
std::size_t basePrefixLength);
void MocMacro();
- void MocDependecies();
+ void MocDependencies();
void MocIncludes();
void UicIncludes();
@@ -561,7 +558,6 @@ public:
std::string AbsoluteIncludePath(cm::string_view relativePath) const;
template <class JOBTYPE>
void CreateParseJobs(SourceFileMapT const& sourceMap);
- std::string CollapseFullPathTS(std::string const& path) const;
private:
// -- Abstract processing interface
@@ -579,7 +575,7 @@ private:
// -- Generation
bool CreateDirectories();
// -- Support for depfiles
- std::vector<std::string> dependenciesFromDepFile(const char* filePath);
+ std::vector<std::string> dependenciesFromDepFile(char const* filePath);
// -- Settings
BaseSettingsT BaseConst_;
@@ -595,8 +591,6 @@ private:
// -- Worker thread pool
std::atomic<bool> JobError_{ false };
cmWorkerPool WorkerPool_;
- // -- Concurrent processing
- mutable std::mutex CMakeLibMutex_;
};
cmQtAutoMocUicT::IncludeKeyT::IncludeKeyT(std::string const& key,
@@ -757,9 +751,9 @@ bool cmQtAutoMocUicT::MocSettingsT::skipped(std::string const& fileName) const
std::string cmQtAutoMocUicT::MocSettingsT::MacrosString() const
{
std::string res;
- const auto itB = this->MacroFilters.cbegin();
- const auto itE = this->MacroFilters.cend();
- const auto itL = itE - 1;
+ auto const itB = this->MacroFilters.cbegin();
+ auto const itE = this->MacroFilters.cend();
+ auto const itL = itE - 1;
auto itC = itB;
for (; itC != itE; ++itC) {
// Separator
@@ -850,54 +844,6 @@ void cmQtAutoMocUicT::JobT::MaybeWriteResponseFile(
#endif
}
-/*
- * According to the CreateProcessW documentation which is the underlying
- * function for all RunProcess calls:
- *
- * "To run a batch file, you must start the command interpreter; set"
- * "lpApplicationName to cmd.exe and set lpCommandLine to the following"
- * "arguments: /c plus the name of the batch file."
- *
- * we should to take care of the correctness of the command line when
- * attempting to execute the batch files.
- *
- * Also cmd.exe is unable to parse batch file names correctly if they
- * contain spaces. This function uses cmSystemTools::GetShortPath conversion
- * to suppress this behavior.
- *
- * The function is noop on platforms different from the pure WIN32 one.
- */
-void cmQtAutoMocUicT::JobT::MaybePrependCmdExe(
- std::vector<std::string>& cmdLine)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
- if (!cmdLine.empty()) {
- const auto& applicationName = cmdLine.at(0);
- if (cmSystemTools::StringEndsWith(applicationName, ".bat") ||
- cmSystemTools::StringEndsWith(applicationName, ".cmd")) {
- std::vector<std::string> output;
- output.reserve(cmdLine.size() + 2);
- output.emplace_back(cmSystemTools::GetComspec());
- output.emplace_back("/c");
- std::string tmpShortPath;
- if (applicationName.find(' ') != std::string::npos &&
- cmSystemTools::GetShortPath(applicationName, tmpShortPath)) {
- // If the batch file name contains spaces convert it to the windows
- // short path. Otherwise it might cause issue when running cmd.exe.
- output.emplace_back(tmpShortPath);
- } else {
- output.push_back(applicationName);
- }
- std::move(cmdLine.begin() + 1, cmdLine.end(),
- std::back_inserter(output));
- cmdLine = std::move(output);
- }
- }
-#else
- static_cast<void>(cmdLine);
-#endif
-}
-
bool cmQtAutoMocUicT::JobT::RunProcess(GenT genType,
cmWorkerPool::ProcessResultT& result,
std::vector<std::string> const& command,
@@ -942,8 +888,6 @@ void cmQtAutoMocUicT::JobMocPredefsT::Process()
// Check if response file is necessary
MaybeWriteResponseFile(this->MocConst().PredefsFileAbs, cmd);
- MaybePrependCmdExe(cmd);
-
// Execute command
if (!this->RunProcess(GenT::MOC, result, cmd, reason.get())) {
this->LogCommandError(GenT::MOC,
@@ -1087,7 +1031,7 @@ void cmQtAutoMocUicT::JobParseT::MocMacro()
}
}
-void cmQtAutoMocUicT::JobParseT::MocDependecies()
+void cmQtAutoMocUicT::JobParseT::MocDependencies()
{
if (this->MocConst().DependFilters.empty() ||
this->MocConst().CanOutputDependencies) {
@@ -1102,7 +1046,7 @@ void cmQtAutoMocUicT::JobParseT::MocDependecies()
continue;
}
// Run the expensive regular expression check loop
- const char* contentChars = this->Content.c_str();
+ char const* contentChars = this->Content.c_str();
cmsys::RegularExpressionMatch match;
while (filter.Exp.find(contentChars, match)) {
{
@@ -1138,7 +1082,7 @@ void cmQtAutoMocUicT::JobParseT::MocIncludes()
std::set<std::string> underscore;
std::set<std::string> dot;
{
- const char* contentChars = this->Content.c_str();
+ char const* contentChars = this->Content.c_str();
cmsys::RegularExpression const& regExp = this->MocConst().RegExpInclude;
cmsys::RegularExpressionMatch match;
while (regExp.find(contentChars, match)) {
@@ -1170,7 +1114,7 @@ void cmQtAutoMocUicT::JobParseT::UicIncludes()
std::set<std::string> includes;
{
- const char* contentChars = this->Content.c_str();
+ char const* contentChars = this->Content.c_str();
cmsys::RegularExpression const& regExp = this->UicConst().RegExpInclude;
cmsys::RegularExpressionMatch match;
while (regExp.find(contentChars, match)) {
@@ -1191,7 +1135,7 @@ void cmQtAutoMocUicT::JobParseHeaderT::Process()
// Moc parsing
if (this->FileHandle->Moc) {
this->MocMacro();
- this->MocDependecies();
+ this->MocDependencies();
}
// Uic parsing
if (this->FileHandle->Uic) {
@@ -1207,7 +1151,7 @@ void cmQtAutoMocUicT::JobParseSourceT::Process()
// Moc parsing
if (this->FileHandle->Moc) {
this->MocMacro();
- this->MocDependecies();
+ this->MocDependencies();
this->MocIncludes();
}
// Uic parsing
@@ -1494,8 +1438,9 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader(
&headerHandle](std::string const& basePath) -> bool {
bool found = false;
for (std::string const& ext : this->BaseConst().HeaderExtensions) {
- std::string const testPath =
- this->Gen()->CollapseFullPathTS(cmStrCat(basePath, '.', ext));
+ std::string const testPath = cmSystemTools::CollapseFullPath(
+ cmStrCat(basePath, '.', ext),
+ this->Gen()->ProjectDirs().CurrentSource);
cmFileTime fileTime;
if (!fileTime.Load(testPath)) {
// File not found
@@ -1682,7 +1627,8 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::FindIncludedUi(
this->SearchLocations.clear();
auto findUi = [this](std::string const& testPath) -> bool {
- std::string const fullPath = this->Gen()->CollapseFullPathTS(testPath);
+ std::string const fullPath = cmSystemTools::CollapseFullPath(
+ testPath, this->Gen()->ProjectDirs().CurrentSource);
cmFileTime fileTime;
if (!fileTime.Load(fullPath)) {
this->SearchLocations.emplace_back(cmQtAutoGen::ParentDir(fullPath));
@@ -2143,7 +2089,6 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
cmd.push_back(sourceFile);
MaybeWriteResponseFile(outputFile, cmd);
- MaybePrependCmdExe(cmd);
}
// Execute moc command
@@ -2173,7 +2118,7 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
// Extract dependencies from the dep file moc generated for us
if (this->MocConst().CanOutputDependencies) {
- const std::string depfile = outputFile + ".d";
+ std::string const depfile = outputFile + ".d";
if (this->Log().Verbose()) {
this->Log().Info(
GenT::MOC, "Reading dependencies from " + this->MessagePath(depfile));
@@ -2210,8 +2155,6 @@ void cmQtAutoMocUicT::JobCompileUicT::Process()
cmd.emplace_back(outputFile);
cmd.emplace_back(sourceFile);
- MaybePrependCmdExe(cmd);
-
cmWorkerPool::ProcessResultT result;
if (this->RunProcess(GenT::UIC, result, cmd, this->Reason.get())) {
// Uic command success
@@ -2250,7 +2193,7 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process()
"enum some_compilers { need_more_than_nothing };\n";
} else {
// Valid content
- const bool mc = this->BaseConst().MultiConfig;
+ bool const mc = this->BaseConst().MultiConfig;
cm::string_view const wrapFront = mc ? "#include <" : "#include \"";
cm::string_view const wrapBack = mc ? ">\n" : "\"\n";
content += cmWrap(wrapFront, this->MocEval().CompFiles, wrapBack, "");
@@ -2289,7 +2232,7 @@ std::string escapeDependencyPath(cm::string_view path)
{
std::string escapedPath;
escapedPath.reserve(path.size());
- const size_t s = path.size();
+ size_t const s = path.size();
int backslashCount = 0;
for (size_t i = 0; i < s; ++i) {
if (path[i] == '\\') {
@@ -2326,7 +2269,7 @@ cmQtAutoMocUicT::JobDepFilesMergeT::initialDependencies() const
this->BaseEval().Sources.size());
cm::append(dependencies, this->BaseConst().ListFiles);
auto append_file_path =
- [&dependencies](const SourceFileMapT::value_type& p) {
+ [&dependencies](SourceFileMapT::value_type const& p) {
dependencies.push_back(p.first);
};
std::for_each(this->BaseEval().Headers.begin(),
@@ -2344,7 +2287,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
this->MessagePath(this->BaseConst().DepFile)));
}
auto processDepFile =
- [this](const std::string& mocOutputFile) -> std::vector<std::string> {
+ [this](std::string const& mocOutputFile) -> std::vector<std::string> {
std::string f = mocOutputFile + ".d";
if (!cmSystemTools::FileExists(f)) {
return {};
@@ -2354,7 +2297,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
std::vector<std::string> dependencies = this->initialDependencies();
ParseCacheT& parseCache = this->BaseEval().ParseCache;
- auto processMappingEntry = [&](const MappingMapT::value_type& m) {
+ auto processMappingEntry = [&](MappingMapT::value_type const& m) {
auto cacheEntry = parseCache.GetOrInsert(m.first);
if (cacheEntry.first->Moc.Depends.empty()) {
cacheEntry.first->Moc.Depends = processDepFile(m.second->OutputFile);
@@ -2373,7 +2316,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
// Also remove AUTOUIC header files to avoid cyclic dependency.
dependencies.erase(
std::remove_if(dependencies.begin(), dependencies.end(),
- [this](const std::string& dep) {
+ [this](std::string const& dep) {
return this->MocConst().skipped(dep) ||
std::any_of(
this->UicEval().Includes.begin(),
@@ -2390,7 +2333,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
dependencies.end());
// Add form files
- for (const auto& uif : this->UicEval().UiFiles) {
+ for (auto const& uif : this->UicEval().UiFiles) {
dependencies.push_back(uif.first);
}
@@ -2406,7 +2349,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
return;
}
ofs << this->BaseConst().DepFileRuleName << ": \\\n";
- for (const std::string& file : dependencies) {
+ for (std::string const& file : dependencies) {
ofs << '\t' << escapeDependencyPath(file) << " \\\n";
if (!ofs.good()) {
this->LogError(GenT::GEN,
@@ -2873,7 +2816,7 @@ void cmQtAutoMocUicT::CreateParseJobs(SourceFileMapT const& sourceMap)
{
cmFileTime const parseCacheTime = this->BaseEval().ParseCacheTime;
ParseCacheT& parseCache = this->BaseEval().ParseCache;
- for (const auto& src : sourceMap) {
+ for (auto const& src : sourceMap) {
// Get or create the file parse data reference
ParseCacheT::GetOrInsertT cacheEntry = parseCache.GetOrInsert(src.first);
src.second->ParseData = std::move(cacheEntry.first);
@@ -2885,17 +2828,6 @@ void cmQtAutoMocUicT::CreateParseJobs(SourceFileMapT const& sourceMap)
}
}
-/** Concurrently callable implementation of cmSystemTools::CollapseFullPath */
-std::string cmQtAutoMocUicT::CollapseFullPathTS(std::string const& path) const
-{
- std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
-#if defined(__NVCOMPILER) || defined(__LCC__)
- static_cast<void>(guard); // convince compiler var is used
-#endif
- return cmSystemTools::CollapseFullPath(path,
- this->ProjectDirs().CurrentSource);
-}
-
void cmQtAutoMocUicT::InitJobs()
{
// Add moc_predefs.h job
@@ -2985,7 +2917,7 @@ void cmQtAutoMocUicT::SettingsFileRead()
cha(this->UicConst().Executable);
std::for_each(this->UicConst().Options.begin(),
this->UicConst().Options.end(), cha);
- for (const auto& item : this->UicConst().UiFiles) {
+ for (auto const& item : this->UicConst().UiFiles) {
cha(item.first);
auto const& opts = item.second.Options;
std::for_each(opts.begin(), opts.end(), cha);
@@ -3128,12 +3060,8 @@ bool cmQtAutoMocUicT::CreateDirectories()
}
std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile(
- const char* filePath)
+ char const* filePath)
{
- std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
-#if defined(__NVCOMPILER) || defined(__LCC__)
- static_cast<void>(guard); // convince compiler var is used
-#endif
auto const content = cmReadGccDepfile(filePath);
if (!content || content->empty()) {
return {};
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 5cb4ff1..07c73d2 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
index 605dad5..db72f92 100644
--- a/Source/cmQtAutoRcc.cxx
+++ b/Source/cmQtAutoRcc.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmQtAutoRcc.h"
#include <algorithm>
diff --git a/Source/cmQtAutoRcc.h b/Source/cmQtAutoRcc.h
index 9c0a4e9..1117b05 100644
--- a/Source/cmQtAutoRcc.h
+++ b/Source/cmQtAutoRcc.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 3934a29..f743064 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmRST.h"
#include <algorithm>
diff --git a/Source/cmRST.h b/Source/cmRST.h
index 65a8a71..64fb02c 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmRange.h b/Source/cmRange.h
index 85cb8ea..a13554e 100644
--- a/Source/cmRange.h
+++ b/Source/cmRange.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index 65a2268..7ce0a50 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmRemoveCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 37bfd8c..64e214a 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx
index 339ff9d..1d51bb1 100644
--- a/Source/cmRemoveDefinitionsCommand.cxx
+++ b/Source/cmRemoveDefinitionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmRemoveDefinitionsCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 8d0fe18..b205714 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx
index 765b772..7e475eb 100644
--- a/Source/cmReturnCommand.cxx
+++ b/Source/cmReturnCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmReturnCommand.h"
#include <cm/string_view>
@@ -29,13 +29,6 @@ bool cmReturnCommand(std::vector<std::string> const& args,
CM_FALLTHROUGH;
case cmPolicies::OLD:
return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- status.GetMakefile().IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat('\n', cmPolicies::GetPolicyWarning(cmPolicies::CMP0140)));
- cmSystemTools::SetFatalErrorOccurred();
- return false;
default:
break;
}
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index abae1a4..18997f4 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index a8c81d0..9a79489 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmRulePlaceholderExpander.h"
#include <utility>
@@ -9,10 +9,11 @@
#include "cmSystemTools.h"
cmRulePlaceholderExpander::cmRulePlaceholderExpander(
- std::map<std::string, std::string> compilers,
+ cmBuildStep buildStep, std::map<std::string, std::string> compilers,
std::map<std::string, std::string> variableMappings,
std::string compilerSysroot, std::string linkerSysroot)
- : Compilers(std::move(compilers))
+ : BuildStep(buildStep)
+ , Compilers(std::move(compilers))
, VariableMappings(std::move(variableMappings))
, CompilerSysroot(std::move(compilerSysroot))
, LinkerSysroot(std::move(linkerSysroot))
@@ -260,6 +261,13 @@ std::string cmRulePlaceholderExpander::ExpandVariable(
return this->ReplaceValues->CMTargetType;
}
}
+ if (variable == "TARGET_LABELS") {
+ if (this->ReplaceValues->CMTargetLabels) {
+ return this->ReplaceValues->CMTargetLabels;
+ }
+ return "";
+ }
+
if (this->ReplaceValues->Output) {
if (variable == "OUTPUT") {
return this->ReplaceValues->Output;
@@ -269,6 +277,18 @@ std::string cmRulePlaceholderExpander::ExpandVariable(
return this->OutputConverter->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
}
+ if (variable == "ROLE") {
+ if (this->ReplaceValues->Role) {
+ return this->ReplaceValues->Role;
+ }
+ return "";
+ }
+ if (variable == "CONFIG") {
+ if (this->ReplaceValues->Config) {
+ return this->ReplaceValues->Config;
+ }
+ return "";
+ }
auto compIt = this->Compilers.find(variable);
@@ -320,9 +340,8 @@ std::string cmRulePlaceholderExpander::ExpandVariable(
}
std::string sysroot;
// Some platforms may use separate sysroots for compiling and linking.
- // If we detect link flags, then we pass the link sysroot instead.
- // FIXME: Use a more robust way to detect link line expansion.
- if (this->ReplaceValues->LinkFlags) {
+ // When the build step is link, pass the link sysroot instead.
+ if (this->BuildStep == cmBuildStep::Link) {
sysroot = this->LinkerSysroot;
} else {
sysroot = this->CompilerSysroot;
@@ -347,7 +366,7 @@ std::string cmRulePlaceholderExpander::ExpandVariable(
void cmRulePlaceholderExpander::ExpandRuleVariables(
cmOutputConverter* outputConverter, std::string& s,
- const RuleVariables& replaceValues)
+ RuleVariables const& replaceValues)
{
this->OutputConverter = outputConverter;
this->ReplaceValues = &replaceValues;
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 225abd4..598a8ed 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -8,6 +8,7 @@
#include <map>
#include <string>
+#include "cmGeneratorOptions.h"
#include "cmPlaceholderExpander.h"
class cmOutputConverter;
@@ -16,7 +17,7 @@ class cmRulePlaceholderExpander : public cmPlaceholderExpander
{
public:
cmRulePlaceholderExpander(
- std::map<std::string, std::string> compilers,
+ cmBuildStep buildStep, std::map<std::string, std::string> compilers,
std::map<std::string, std::string> variableMappings,
std::string compilerSysroot, std::string linkerSysroot);
@@ -29,61 +30,65 @@ public:
// ExpandRuleVariables
struct RuleVariables
{
- const char* CMTargetName = nullptr;
- const char* CMTargetType = nullptr;
- const char* TargetPDB = nullptr;
- const char* TargetCompilePDB = nullptr;
- const char* TargetVersionMajor = nullptr;
- const char* TargetVersionMinor = nullptr;
- const char* Language = nullptr;
- const char* AIXExports = nullptr;
- const char* Objects = nullptr;
- const char* Target = nullptr;
- const char* LinkLibraries = nullptr;
- const char* Source = nullptr;
- const char* AssemblySource = nullptr;
- const char* PreprocessedSource = nullptr;
- const char* DynDepFile = nullptr;
- const char* Output = nullptr;
- const char* Object = nullptr;
- const char* ObjectDir = nullptr;
- const char* ObjectFileDir = nullptr;
- const char* Flags = nullptr;
- const char* ObjectsQuoted = nullptr;
- const char* SONameFlag = nullptr;
- const char* TargetSOName = nullptr;
- const char* TargetInstallNameDir = nullptr;
- const char* Linker = nullptr;
- const char* LinkFlags = nullptr;
- const char* Manifests = nullptr;
- const char* LanguageCompileFlags = nullptr;
- const char* Defines = nullptr;
- const char* Includes = nullptr;
- const char* DependencyFile = nullptr;
- const char* DependencyTarget = nullptr;
- const char* FilterPrefix = nullptr;
- const char* SwiftLibraryName = nullptr;
- const char* SwiftModule = nullptr;
- const char* SwiftModuleName = nullptr;
- const char* SwiftOutputFileMapOption = nullptr;
- const char* SwiftSources = nullptr;
- const char* ISPCHeader = nullptr;
- const char* CudaCompileMode = nullptr;
- const char* Fatbinary = nullptr;
- const char* RegisterFile = nullptr;
- const char* Launcher = nullptr;
+ char const* CMTargetName = nullptr;
+ char const* CMTargetType = nullptr;
+ char const* CMTargetLabels = nullptr;
+ char const* TargetPDB = nullptr;
+ char const* TargetCompilePDB = nullptr;
+ char const* TargetVersionMajor = nullptr;
+ char const* TargetVersionMinor = nullptr;
+ char const* Language = nullptr;
+ char const* AIXExports = nullptr;
+ char const* Objects = nullptr;
+ char const* Target = nullptr;
+ char const* LinkLibraries = nullptr;
+ char const* Source = nullptr;
+ char const* AssemblySource = nullptr;
+ char const* PreprocessedSource = nullptr;
+ char const* DynDepFile = nullptr;
+ char const* Output = nullptr;
+ char const* Object = nullptr;
+ char const* ObjectDir = nullptr;
+ char const* ObjectFileDir = nullptr;
+ char const* Flags = nullptr;
+ char const* ObjectsQuoted = nullptr;
+ char const* SONameFlag = nullptr;
+ char const* TargetSOName = nullptr;
+ char const* TargetInstallNameDir = nullptr;
+ char const* Linker = nullptr;
+ char const* LinkFlags = nullptr;
+ char const* Manifests = nullptr;
+ char const* LanguageCompileFlags = nullptr;
+ char const* Defines = nullptr;
+ char const* Includes = nullptr;
+ char const* DependencyFile = nullptr;
+ char const* DependencyTarget = nullptr;
+ char const* FilterPrefix = nullptr;
+ char const* SwiftLibraryName = nullptr;
+ char const* SwiftModule = nullptr;
+ char const* SwiftModuleName = nullptr;
+ char const* SwiftOutputFileMapOption = nullptr;
+ char const* SwiftSources = nullptr;
+ char const* ISPCHeader = nullptr;
+ char const* CudaCompileMode = nullptr;
+ char const* Fatbinary = nullptr;
+ char const* RegisterFile = nullptr;
+ char const* Launcher = nullptr;
+ char const* Role = nullptr;
+ char const* Config = nullptr;
};
// Expand rule variables in CMake of the type found in language rules
void ExpandRuleVariables(cmOutputConverter* outputConverter,
std::string& string,
- const RuleVariables& replaceValues);
+ RuleVariables const& replaceValues);
private:
std::string ExpandVariable(std::string const& variable) override;
std::string TargetImpLib;
+ cmBuildStep BuildStep = cmBuildStep::Compile;
std::map<std::string, std::string> Compilers;
std::map<std::string, std::string> VariableMappings;
std::string CompilerSysroot;
diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx
index 2fbf2fa..1ee80b4 100644
--- a/Source/cmRuntimeDependencyArchive.cxx
+++ b/Source/cmRuntimeDependencyArchive.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmRuntimeDependencyArchive.h"
@@ -32,7 +32,7 @@
#if defined(_WIN32)
static void AddVisualStudioPath(std::vector<std::string>& paths,
- const std::string& prefix,
+ std::string const& prefix,
unsigned int version, cmGlobalGenerator* gg)
{
// If generating for the VS IDE, use the same instance.
@@ -71,7 +71,7 @@ static void AddVisualStudioPath(std::vector<std::string>& paths,
}
static void AddRegistryPath(std::vector<std::string>& paths,
- const std::string& path, cmMakefile* mf)
+ std::string const& path, cmMakefile* mf)
{
// We should view the registry as the target application would view
// it.
@@ -94,8 +94,8 @@ static void AddRegistryPath(std::vector<std::string>& paths,
cmSystemTools::GlobDirs(expanded, paths);
}
-static void AddEnvPath(std::vector<std::string>& paths, const std::string& var,
- const std::string& suffix)
+static void AddEnvPath(std::vector<std::string>& paths, std::string const& var,
+ std::string const& suffix)
{
std::string value;
if (cmSystemTools::GetEnv(var, value)) {
@@ -104,7 +104,7 @@ static void AddEnvPath(std::vector<std::string>& paths, const std::string& var,
}
#endif
-static cmsys::RegularExpression TransformCompile(const std::string& str)
+static cmsys::RegularExpression TransformCompile(std::string const& str)
{
return cmsys::RegularExpression(str);
}
@@ -112,10 +112,10 @@ static cmsys::RegularExpression TransformCompile(const std::string& str)
cmRuntimeDependencyArchive::cmRuntimeDependencyArchive(
cmExecutionStatus& status, std::vector<std::string> searchDirectories,
std::string bundleExecutable,
- const std::vector<std::string>& preIncludeRegexes,
- const std::vector<std::string>& preExcludeRegexes,
- const std::vector<std::string>& postIncludeRegexes,
- const std::vector<std::string>& postExcludeRegexes,
+ std::vector<std::string> const& preIncludeRegexes,
+ std::vector<std::string> const& preExcludeRegexes,
+ std::vector<std::string> const& postIncludeRegexes,
+ std::vector<std::string> const& postExcludeRegexes,
std::vector<std::string> postIncludeFiles,
std::vector<std::string> postExcludeFiles,
std::vector<std::string> postExcludeFilesStrict)
@@ -173,9 +173,9 @@ bool cmRuntimeDependencyArchive::Prepare()
}
bool cmRuntimeDependencyArchive::GetRuntimeDependencies(
- const std::vector<std::string>& executables,
- const std::vector<std::string>& libraries,
- const std::vector<std::string>& modules)
+ std::vector<std::string> const& executables,
+ std::vector<std::string> const& libraries,
+ std::vector<std::string> const& modules)
{
for (auto const& exe : executables) {
if (!this->Linker->ScanDependencies(exe, cmStateEnums::EXECUTABLE)) {
@@ -193,23 +193,23 @@ bool cmRuntimeDependencyArchive::GetRuntimeDependencies(
});
}
-void cmRuntimeDependencyArchive::SetError(const std::string& e)
+void cmRuntimeDependencyArchive::SetError(std::string const& e)
{
this->Status.SetError(e);
}
-const std::string& cmRuntimeDependencyArchive::GetBundleExecutable() const
+std::string const& cmRuntimeDependencyArchive::GetBundleExecutable() const
{
return this->BundleExecutable;
}
-const std::vector<std::string>&
+std::vector<std::string> const&
cmRuntimeDependencyArchive::GetSearchDirectories() const
{
return this->SearchDirectories;
}
-const std::string& cmRuntimeDependencyArchive::GetGetRuntimeDependenciesTool()
+std::string const& cmRuntimeDependencyArchive::GetGetRuntimeDependenciesTool()
const
{
return this->GetMakefile()->GetSafeDefinition(
@@ -217,7 +217,7 @@ const std::string& cmRuntimeDependencyArchive::GetGetRuntimeDependenciesTool()
}
bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand(
- const std::string& search, std::vector<std::string>& command) const
+ std::string const& search, std::vector<std::string>& command) const
{
// First see if it was supplied by the user
std::string toolCommand = this->GetMakefile()->GetSafeDefinition(
@@ -311,16 +311,16 @@ bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand(
return false;
}
-bool cmRuntimeDependencyArchive::IsPreExcluded(const std::string& name) const
+bool cmRuntimeDependencyArchive::IsPreExcluded(std::string const& name) const
{
cmsys::RegularExpressionMatch match;
auto const regexMatch =
- [&match, name](const cmsys::RegularExpression& regex) -> bool {
+ [&match, name](cmsys::RegularExpression const& regex) -> bool {
return regex.find(name.c_str(), match);
};
auto const regexSearch =
[&regexMatch](
- const std::vector<cmsys::RegularExpression>& regexes) -> bool {
+ std::vector<cmsys::RegularExpression> const& regexes) -> bool {
return std::any_of(regexes.begin(), regexes.end(), regexMatch);
};
@@ -328,23 +328,23 @@ bool cmRuntimeDependencyArchive::IsPreExcluded(const std::string& name) const
regexSearch(this->PreExcludeRegexes);
}
-bool cmRuntimeDependencyArchive::IsPostExcluded(const std::string& name) const
+bool cmRuntimeDependencyArchive::IsPostExcluded(std::string const& name) const
{
cmsys::RegularExpressionMatch match;
auto const regexMatch =
- [&match, name](const cmsys::RegularExpression& regex) -> bool {
+ [&match, name](cmsys::RegularExpression const& regex) -> bool {
return regex.find(name.c_str(), match);
};
auto const regexSearch =
[&regexMatch](
- const std::vector<cmsys::RegularExpression>& regexes) -> bool {
+ std::vector<cmsys::RegularExpression> const& regexes) -> bool {
return std::any_of(regexes.begin(), regexes.end(), regexMatch);
};
- auto const fileMatch = [name](const std::string& file) -> bool {
+ auto const fileMatch = [name](std::string const& file) -> bool {
return cmSystemTools::SameFile(file, name);
};
auto const fileSearch =
- [&fileMatch](const std::vector<std::string>& files) -> bool {
+ [&fileMatch](std::vector<std::string> const& files) -> bool {
return std::any_of(files.begin(), files.end(), fileMatch);
};
@@ -356,7 +356,7 @@ bool cmRuntimeDependencyArchive::IsPostExcluded(const std::string& name) const
}
void cmRuntimeDependencyArchive::AddResolvedPath(
- const std::string& name, const std::string& path, bool& unique,
+ std::string const& name, std::string const& path, bool& unique,
std::vector<std::string> rpaths)
{
auto it = this->ResolvedPaths.emplace(name, std::set<std::string>{}).first;
@@ -371,7 +371,7 @@ void cmRuntimeDependencyArchive::AddResolvedPath(
this->RPaths[path] = std::move(rpaths);
}
-void cmRuntimeDependencyArchive::AddUnresolvedPath(const std::string& name)
+void cmRuntimeDependencyArchive::AddUnresolvedPath(std::string const& name)
{
this->UnresolvedPaths.insert(name);
}
@@ -381,28 +381,28 @@ cmMakefile* cmRuntimeDependencyArchive::GetMakefile() const
return &this->Status.GetMakefile();
}
-const std::map<std::string, std::set<std::string>>&
+std::map<std::string, std::set<std::string>> const&
cmRuntimeDependencyArchive::GetResolvedPaths() const
{
return this->ResolvedPaths;
}
-const std::set<std::string>& cmRuntimeDependencyArchive::GetUnresolvedPaths()
+std::set<std::string> const& cmRuntimeDependencyArchive::GetUnresolvedPaths()
const
{
return this->UnresolvedPaths;
}
-const std::map<std::string, std::vector<std::string>>&
+std::map<std::string, std::vector<std::string>> const&
cmRuntimeDependencyArchive::GetRPaths() const
{
return this->RPaths;
}
bool cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
- const std::string& platform)
+ std::string const& platform)
{
- static const std::set<std::string> supportedPlatforms = { "Windows", "Linux",
+ static std::set<std::string> const supportedPlatforms = { "Windows", "Linux",
"Darwin" };
return supportedPlatforms.count(platform);
}
diff --git a/Source/cmRuntimeDependencyArchive.h b/Source/cmRuntimeDependencyArchive.h
index b170815..0349f76 100644
--- a/Source/cmRuntimeDependencyArchive.h
+++ b/Source/cmRuntimeDependencyArchive.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -22,38 +22,38 @@ public:
explicit cmRuntimeDependencyArchive(
cmExecutionStatus& status, std::vector<std::string> searchDirectories,
std::string bundleExecutable,
- const std::vector<std::string>& preIncludeRegexes,
- const std::vector<std::string>& preExcludeRegexes,
- const std::vector<std::string>& postIncludeRegexes,
- const std::vector<std::string>& postExcludeRegexes,
+ std::vector<std::string> const& preIncludeRegexes,
+ std::vector<std::string> const& preExcludeRegexes,
+ std::vector<std::string> const& postIncludeRegexes,
+ std::vector<std::string> const& postExcludeRegexes,
std::vector<std::string> postIncludeFiles,
std::vector<std::string> postExcludeFiles,
std::vector<std::string> postExcludeFilesStrict);
bool Prepare();
- bool GetRuntimeDependencies(const std::vector<std::string>& executables,
- const std::vector<std::string>& libraries,
- const std::vector<std::string>& modules);
+ bool GetRuntimeDependencies(std::vector<std::string> const& executables,
+ std::vector<std::string> const& libraries,
+ std::vector<std::string> const& modules);
- void SetError(const std::string& e);
+ void SetError(std::string const& e);
- const std::string& GetBundleExecutable() const;
- const std::vector<std::string>& GetSearchDirectories() const;
- const std::string& GetGetRuntimeDependenciesTool() const;
+ std::string const& GetBundleExecutable() const;
+ std::vector<std::string> const& GetSearchDirectories() const;
+ std::string const& GetGetRuntimeDependenciesTool() const;
bool GetGetRuntimeDependenciesCommand(
- const std::string& search, std::vector<std::string>& command) const;
- bool IsPreExcluded(const std::string& name) const;
- bool IsPostExcluded(const std::string& name) const;
+ std::string const& search, std::vector<std::string>& command) const;
+ bool IsPreExcluded(std::string const& name) const;
+ bool IsPostExcluded(std::string const& name) const;
- void AddResolvedPath(const std::string& name, const std::string& path,
+ void AddResolvedPath(std::string const& name, std::string const& path,
bool& unique, std::vector<std::string> rpaths = {});
- void AddUnresolvedPath(const std::string& name);
+ void AddUnresolvedPath(std::string const& name);
cmMakefile* GetMakefile() const;
- const std::map<std::string, std::set<std::string>>& GetResolvedPaths() const;
- const std::set<std::string>& GetUnresolvedPaths() const;
- const std::map<std::string, std::vector<std::string>>& GetRPaths() const;
+ std::map<std::string, std::set<std::string>> const& GetResolvedPaths() const;
+ std::set<std::string> const& GetUnresolvedPaths() const;
+ std::map<std::string, std::vector<std::string>> const& GetRPaths() const;
- static bool PlatformSupportsRuntimeDependencies(const std::string& platform);
+ static bool PlatformSupportsRuntimeDependencies(std::string const& platform);
private:
cmExecutionStatus& Status;
diff --git a/Source/cmSarifLog.cxx b/Source/cmSarifLog.cxx
new file mode 100644
index 0000000..35b67f7
--- /dev/null
+++ b/Source/cmSarifLog.cxx
@@ -0,0 +1,383 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#include "cmSarifLog.h"
+
+#include <memory>
+#include <stdexcept>
+
+#include <cm/filesystem>
+
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
+
+#include "cmsys/FStream.hxx"
+
+#include "cmListFileCache.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmValue.h"
+#include "cmVersionConfig.h"
+#include "cmake.h"
+
+cmSarif::ResultsLog::ResultsLog()
+{
+ // Add the known CMake rules
+ this->KnownRules.emplace(RuleBuilder("CMake.AuthorWarning")
+ .Name("CMake Warning (dev)")
+ .DefaultMessage("CMake Warning (dev): {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.Warning")
+ .Name("CMake Warning")
+ .DefaultMessage("CMake Warning: {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.DeprecationWarning")
+ .Name("CMake Deprecation Warning")
+ .DefaultMessage("CMake Deprecation Warning: {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.AuthorError")
+ .Name("CMake Error (dev)")
+ .DefaultMessage("CMake Error (dev): {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.FatalError")
+ .Name("CMake Error")
+ .DefaultMessage("CMake Error: {0}")
+ .Build());
+ this->KnownRules.emplace(
+ RuleBuilder("CMake.InternalError")
+ .Name("CMake Internal Error")
+ .DefaultMessage("CMake Internal Error (please report a bug): {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.DeprecationError")
+ .Name("CMake Deprecation Error")
+ .DefaultMessage("CMake Deprecation Error: {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.Message")
+ .Name("CMake Message")
+ .DefaultMessage("CMake Message: {0}")
+ .Build());
+ this->KnownRules.emplace(RuleBuilder("CMake.Log")
+ .Name("CMake Log")
+ .DefaultMessage("CMake Log: {0}")
+ .Build());
+}
+
+void cmSarif::ResultsLog::Log(cmSarif::Result&& result) const
+{
+ // The rule ID is optional, but if it is present, enable metadata output for
+ // the rule by marking it as used
+ if (result.RuleId) {
+ std::size_t index = this->UseRule(*result.RuleId);
+ result.RuleIndex = index;
+ }
+
+ // Add the result to the log
+ this->Results.emplace_back(result);
+}
+
+void cmSarif::ResultsLog::LogMessage(
+ MessageType t, std::string const& text,
+ cmListFileBacktrace const& backtrace) const
+{
+ // Add metadata to the result object
+ // The CMake SARIF rules for messages all expect 1 string argument with the
+ // message text
+ Json::Value additionalProperties(Json::objectValue);
+ Json::Value args(Json::arrayValue);
+ args.append(text);
+ additionalProperties["message"]["id"] = "default";
+ additionalProperties["message"]["arguments"] = args;
+
+ // Create and log a result object
+ // Rule indices are assigned when writing the final JSON output. Right now,
+ // leave it as nullopt. The other optional fields are filled if available
+ this->Log(cmSarif::Result{
+ text, cmSarif::SourceFileLocation::FromBacktrace(backtrace),
+ cmSarif::MessageSeverityLevel(t), cmSarif::MessageRuleId(t), cm::nullopt,
+ additionalProperties });
+}
+
+std::size_t cmSarif::ResultsLog::UseRule(std::string const& id) const
+{
+ // Check if the rule is already in the index
+ auto it = this->RuleToIndex.find(id);
+ if (it != this->RuleToIndex.end()) {
+ // The rule is already in use. Return the known index
+ return it->second;
+ }
+
+ // This rule is not yet in the index, so check if it is recognized
+ auto itKnown = this->KnownRules.find(id);
+ if (itKnown == this->KnownRules.end()) {
+ // The rule is not known. Add an empty rule to the known rules so that it
+ // is included in the output
+ this->KnownRules.emplace(RuleBuilder(id.c_str()).Build());
+ }
+
+ // Since this is the first time the rule is used, enable it and add it to the
+ // index
+ std::size_t idx = this->EnabledRules.size();
+ this->RuleToIndex[id] = idx;
+ this->EnabledRules.emplace_back(id);
+ return idx;
+}
+
+cmSarif::ResultSeverityLevel cmSarif::MessageSeverityLevel(MessageType t)
+{
+ switch (t) {
+ case MessageType::AUTHOR_WARNING:
+ case MessageType::WARNING:
+ case MessageType::DEPRECATION_WARNING:
+ return ResultSeverityLevel::SARIF_WARNING;
+ case MessageType::AUTHOR_ERROR:
+ case MessageType::FATAL_ERROR:
+ case MessageType::INTERNAL_ERROR:
+ case MessageType::DEPRECATION_ERROR:
+ return ResultSeverityLevel::SARIF_ERROR;
+ case MessageType::MESSAGE:
+ case MessageType::LOG:
+ return ResultSeverityLevel::SARIF_NOTE;
+ default:
+ return ResultSeverityLevel::SARIF_NONE;
+ }
+}
+
+cm::optional<std::string> cmSarif::MessageRuleId(MessageType t)
+{
+ switch (t) {
+ case MessageType::AUTHOR_WARNING:
+ return "CMake.AuthorWarning";
+ case MessageType::WARNING:
+ return "CMake.Warning";
+ case MessageType::DEPRECATION_WARNING:
+ return "CMake.DeprecationWarning";
+ case MessageType::AUTHOR_ERROR:
+ return "CMake.AuthorError";
+ case MessageType::FATAL_ERROR:
+ return "CMake.FatalError";
+ case MessageType::INTERNAL_ERROR:
+ return "CMake.InternalError";
+ case MessageType::DEPRECATION_ERROR:
+ return "CMake.DeprecationError";
+ case MessageType::MESSAGE:
+ return "CMake.Message";
+ case MessageType::LOG:
+ return "CMake.Log";
+ default:
+ return cm::nullopt;
+ }
+}
+
+Json::Value cmSarif::Rule::GetJson() const
+{
+ Json::Value rule(Json::objectValue);
+ rule["id"] = this->Id;
+
+ if (this->Name) {
+ rule["name"] = *this->Name;
+ }
+ if (this->FullDescription) {
+ rule["fullDescription"]["text"] = *this->FullDescription;
+ }
+ if (this->DefaultMessage) {
+ rule["messageStrings"]["default"]["text"] = *this->DefaultMessage;
+ }
+
+ return rule;
+}
+
+cmSarif::SourceFileLocation::SourceFileLocation(
+ cmListFileBacktrace const& backtrace)
+{
+ if (backtrace.Empty()) {
+ throw std::runtime_error("Empty source file location");
+ }
+
+ cmListFileContext const& lfc = backtrace.Top();
+ this->Uri = lfc.FilePath;
+ this->Line = lfc.Line;
+}
+
+cm::optional<cmSarif::SourceFileLocation>
+cmSarif::SourceFileLocation::FromBacktrace(
+ cmListFileBacktrace const& backtrace)
+{
+ if (backtrace.Empty()) {
+ return cm::nullopt;
+ }
+ cmListFileContext const& lfc = backtrace.Top();
+ if (lfc.Line <= 0 || lfc.FilePath.empty()) {
+ return cm::nullopt;
+ }
+
+ return cm::make_optional<cmSarif::SourceFileLocation>(backtrace);
+}
+
+void cmSarif::ResultsLog::WriteJson(Json::Value& root) const
+{
+ // Add SARIF metadata
+ root["version"] = "2.1.0";
+ root["$schema"] = "https://schemastore.azurewebsites.net/schemas/json/"
+ "sarif-2.1.0-rtm.4.json";
+
+ // JSON object for the SARIF runs array
+ Json::Value runs(Json::arrayValue);
+
+ // JSON object for the current (only) run
+ Json::Value currentRun(Json::objectValue);
+
+ // Accumulate info about the reported rules
+ Json::Value jsonRules(Json::arrayValue);
+ for (auto const& ruleId : this->EnabledRules) {
+ jsonRules.append(KnownRules.at(ruleId).GetJson());
+ }
+
+ // Add info the driver for the current run (CMake)
+ Json::Value driverTool(Json::objectValue);
+ driverTool["name"] = "CMake";
+ driverTool["version"] = CMake_VERSION;
+ driverTool["rules"] = jsonRules;
+ currentRun["tool"]["driver"] = driverTool;
+
+ runs.append(currentRun);
+
+ // Add all results
+ Json::Value jsonResults(Json::arrayValue);
+ for (auto const& res : this->Results) {
+ Json::Value jsonResult(Json::objectValue);
+
+ if (res.Message) {
+ jsonResult["message"]["text"] = *(res.Message);
+ }
+
+ // If the result has a level, add it to the result
+ if (res.Level) {
+ switch (*res.Level) {
+ case ResultSeverityLevel::SARIF_WARNING:
+ jsonResult["level"] = "warning";
+ break;
+ case ResultSeverityLevel::SARIF_ERROR:
+ jsonResult["level"] = "error";
+ break;
+ case ResultSeverityLevel::SARIF_NOTE:
+ jsonResult["level"] = "note";
+ break;
+ case ResultSeverityLevel::SARIF_NONE:
+ jsonResult["level"] = "none";
+ break;
+ }
+ }
+
+ // If the result has a rule ID or index, add it to the result
+ if (res.RuleId) {
+ jsonResult["ruleId"] = *res.RuleId;
+ }
+ if (res.RuleIndex) {
+ jsonResult["ruleIndex"] = Json::UInt64(*res.RuleIndex);
+ }
+
+ if (res.Location) {
+ jsonResult["locations"][0]["physicalLocation"]["artifactLocation"]
+ ["uri"] = (res.Location)->Uri;
+ jsonResult["locations"][0]["physicalLocation"]["region"]["startLine"] =
+ Json::Int64((res.Location)->Line);
+ }
+
+ jsonResults.append(jsonResult);
+ }
+
+ currentRun["results"] = jsonResults;
+ runs[0] = currentRun;
+ root["runs"] = runs;
+}
+
+cmSarif::LogFileWriter::~LogFileWriter()
+{
+ // If the file has not been written yet, try to finalize it
+ if (!this->FileWritten) {
+ // Try to write and check the result
+ if (this->TryWrite() == WriteResult::FAILURE) {
+ // If the result is `FAILURE`, it means the write condition is true but
+ // the file still wasn't written. This is an error.
+ cmSystemTools::Error("Failed to write SARIF log to " +
+ this->FilePath.generic_string());
+ }
+ }
+}
+
+bool cmSarif::LogFileWriter::EnsureFileValid()
+{
+ // First, ensure directory exists
+ cm::filesystem::path dir = this->FilePath.parent_path();
+ if (!cmSystemTools::FileIsDirectory(dir.generic_string())) {
+ if (!this->CreateDirectories ||
+ !cmSystemTools::MakeDirectory(dir.generic_string()).IsSuccess()) {
+ return false;
+ }
+ }
+
+ // Open the file for writing
+ cmsys::ofstream outputFile(this->FilePath.generic_string().c_str());
+ if (!outputFile.good()) {
+ return false;
+ }
+ return true;
+}
+
+cmSarif::LogFileWriter::WriteResult cmSarif::LogFileWriter::TryWrite()
+{
+ // Check that SARIF logging is enabled
+ if (!this->WriteCondition || !this->WriteCondition()) {
+ return WriteResult::SKIPPED;
+ }
+
+ // Open the file
+ if (!this->EnsureFileValid()) {
+ return WriteResult::FAILURE;
+ }
+ cmsys::ofstream outputFile(this->FilePath.generic_string().c_str());
+
+ // The file is available, so proceed to write the log
+
+ // Assemble the SARIF JSON from the results in the log
+ Json::Value root(Json::objectValue);
+ this->Log.WriteJson(root);
+
+ // Serialize the JSON to the file
+ Json::StreamWriterBuilder builder;
+ std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
+
+ writer->write(root, &outputFile);
+ outputFile.close();
+
+ this->FileWritten = true;
+ return WriteResult::SUCCESS;
+}
+
+bool cmSarif::LogFileWriter::ConfigureForCMakeRun(cmake& cm)
+{
+ // If an explicit SARIF output path has been provided, set and check it
+ cm::optional<std::string> sarifFilePath = cm.GetSarifFilePath();
+ if (sarifFilePath) {
+ this->SetPath(cm::filesystem::path(*sarifFilePath));
+ if (!this->EnsureFileValid()) {
+ cmSystemTools::Error(
+ cmStrCat("Invalid SARIF output file path: ", *sarifFilePath));
+ return false;
+ }
+ }
+
+ // The write condition is checked immediately before writing the file, which
+ // allows projects to enable SARIF diagnostics by setting a cache variable
+ // and have it take effect for the current run.
+ this->SetWriteCondition([&cm]() {
+ // The command-line option can be used to set an explicit path, but in
+ // normal mode, the project variable `CMAKE_EXPORT_SARIF` can also enable
+ // SARIF logging.
+ return cm.GetSarifFilePath().has_value() ||
+ (cm.GetWorkingMode() == cmake::NORMAL_MODE &&
+ cm.GetCacheDefinition(cmSarif::PROJECT_SARIF_FILE_VARIABLE).IsOn());
+ });
+
+ return true;
+}
diff --git a/Source/cmSarifLog.h b/Source/cmSarifLog.h
new file mode 100644
index 0000000..efdaf14
--- /dev/null
+++ b/Source/cmSarifLog.h
@@ -0,0 +1,287 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <cstddef>
+#include <functional>
+#include <string>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include <cm/filesystem>
+#include <cm/optional>
+
+#include <cm3p/json/value.h>
+
+class cmake;
+class cmListFileBacktrace;
+enum class MessageType;
+
+/// @brief CMake support for SARIF logging
+namespace cmSarif {
+
+constexpr char const* PROJECT_SARIF_FILE_VARIABLE = "CMAKE_EXPORT_SARIF";
+
+constexpr char const* PROJECT_DEFAULT_SARIF_FILE = ".cmake/sarif/cmake.sarif";
+
+/// @brief The severity level of a result in SARIF
+///
+/// The SARIF specification section 3.27.10 defines four levels of severity
+/// for results.
+enum class ResultSeverityLevel
+{
+ SARIF_WARNING,
+ SARIF_ERROR,
+ SARIF_NOTE,
+ SARIF_NONE,
+};
+
+/// @brief A location in a source file logged with a SARIF result
+struct SourceFileLocation
+{
+ std::string Uri;
+ long Line = 0;
+
+ /// @brief Construct a SourceFileLocation at the top of the call stack
+ SourceFileLocation(cmListFileBacktrace const& backtrace);
+
+ /// @brief Get the SourceFileLocation from the top of a call stack, if any
+ /// @return The location or nullopt if the call stack is empty or is missing
+ /// location information
+ static cm::optional<SourceFileLocation> FromBacktrace(
+ cmListFileBacktrace const& backtrace);
+};
+
+/// @brief A result defined by SARIF reported by a CMake run
+///
+/// This is the data model for results in a SARIF log. Typically, a result only
+/// requires either a message or a rule index. The most common properties are
+/// named in this struct, but arbitrary metadata can be added to the result
+/// using the additionalProperties field.
+struct Result
+{
+ /// @brief The message text of the result (required if no rule index)
+ cm::optional<std::string> Message;
+
+ /// @brief The location of the result (optional)
+ cm::optional<cmSarif::SourceFileLocation> Location;
+
+ /// @brief The severity level of the result (optional)
+ cm::optional<cmSarif::ResultSeverityLevel> Level;
+
+ /// @brief The rule ID of the result (optional)
+ cm::optional<std::string> RuleId;
+
+ /// @brief The index of the rule in the log's rule array (optional)
+ cm::optional<std::size_t> RuleIndex;
+
+ /// @brief Additional JSON properties for the result (optional)
+ ///
+ /// The additional properties should be merged into the result object when it
+ /// is written to the SARIF log.
+ Json::Value AdditionalProperties;
+};
+
+/// @brief A SARIF reporting rule
+///
+/// A rule in SARIF is described by a reportingDescriptor object (SARIF
+/// specification section 3.49). The only property required for a rule is the
+/// ID property. The ID is normally an opaque string that identifies a rule
+/// applicable to a class of results. The other included properties are
+/// optional but recommended for rules reported by CMake.
+struct Rule
+{
+ /// @brief The ID of the rule. Required by SARIF
+ std::string Id;
+
+ /// @brief The end-user name of the rule (optional)
+ cm::optional<std::string> Name;
+
+ /// @brief The extended description of the rule (optional)
+ cm::optional<std::string> FullDescription;
+
+ /// @brief The default message for the rule (optional)
+ cm::optional<std::string> DefaultMessage;
+
+ /// @brief Get the JSON representation of this rule
+ Json::Value GetJson() const;
+};
+
+/// @brief A builder for SARIF rules
+///
+/// `Rule` is a data model for SARIF rules. Known rules are usually initialized
+/// manually by field. Using a builder makes initialization more readable and
+/// prevents issues with reordering and optional fields.
+class RuleBuilder
+{
+public:
+ /// @brief Construct a new rule builder for a rule with the given ID
+ RuleBuilder(char const* id) { this->NewRule.Id = id; }
+
+ /// @brief Set the name of the rule
+ RuleBuilder& Name(std::string name)
+ {
+ this->NewRule.Name = std::move(name);
+ return *this;
+ }
+
+ /// @brief Set the full description of the rule
+ RuleBuilder& FullDescription(std::string fullDescription)
+ {
+ this->NewRule.FullDescription = std::move(fullDescription);
+ return *this;
+ }
+
+ /// @brief Set the default message for the rule
+ RuleBuilder& DefaultMessage(std::string defaultMessage)
+ {
+ this->NewRule.DefaultMessage = std::move(defaultMessage);
+ return *this;
+ }
+
+ /// @brief Build the rule
+ std::pair<std::string, Rule> Build() const
+ {
+ return std::make_pair(this->NewRule.Id, this->NewRule);
+ }
+
+private:
+ Rule NewRule;
+};
+
+/// @brief Get the SARIF severity level of a CMake message type
+ResultSeverityLevel MessageSeverityLevel(MessageType t);
+
+/// @brief Get the SARIF rule ID of a CMake message type
+/// @return The rule ID or nullopt if the message type is unrecognized
+///
+/// The rule ID is a string assigned to SARIF results to identify the category
+/// of the result. CMake maps messages to rules based on the message type.
+/// CMake's rules are of the form "CMake.<MessageType>".
+cm::optional<std::string> MessageRuleId(MessageType t);
+
+/// @brief A log for reporting results in the SARIF format
+class ResultsLog
+{
+public:
+ ResultsLog();
+
+ /// @brief Log a result of this run to the SARIF output
+ void Log(cmSarif::Result&& result) const;
+
+ /// @brief Log a result from a CMake message with a source file location
+ /// @param t The type of the message, which corresponds to the level and rule
+ /// of the result
+ /// @param text The contents of the message
+ /// @param backtrace The call stack where the message originated (may be
+ /// empty)
+ void LogMessage(MessageType t, std::string const& text,
+ cmListFileBacktrace const& backtrace) const;
+
+ /// @brief Write this SARIF log to an empty JSON object
+ /// @param[out] root The JSON object to write to
+ void WriteJson(Json::Value& root) const;
+
+private:
+ // Private methods
+
+ // Log that a rule was used and should be included in the output. Returns the
+ // index of the rule in the log
+ std::size_t UseRule(std::string const& id) const;
+
+ // Private data
+ // All data is mutable since log results are often added in const methods
+
+ // All results added chronologically
+ mutable std::vector<cmSarif::Result> Results;
+
+ // Mapping of rule IDs to rule indices in the log.
+ // In SARIF, rule metadata is typically only included if the rule is
+ // referenced. The indices are unique to one log output and and vary
+ // depending on when the rule was first encountered.
+ mutable std::unordered_map<std::string, std::size_t> RuleToIndex;
+
+ // Rules that will be added to the log in order of appearance
+ mutable std::vector<std::string> EnabledRules;
+
+ // All known rules that could be included in a log
+ mutable std::unordered_map<std::string, Rule> KnownRules;
+};
+
+/// @brief Writes contents of a `cmSarif::ResultsLog` to a file
+///
+/// The log file writer is a helper class that writes the contents of a
+/// `cmSarif::ResultsLog` upon destruction if a condition (e.g. project
+/// variable is enabled) is met.
+class LogFileWriter
+{
+public:
+ /// @brief Create a new, disabled log file writer
+ ///
+ /// The returned writer will not write anything until the path generator
+ /// and write condition are set. If the log has not been written when the
+ /// object is being destroyed, the destructor will write the log if the
+ /// condition is met and a valid path is available.
+ LogFileWriter(ResultsLog const& log)
+ : Log(log)
+ {
+ }
+
+ /// @brief Configure a log file writer for a CMake run
+ ///
+ /// CMake should write a SARIF log if the project variable
+ /// `CMAKE_EXPORT_SARIF` is `ON` or if the `--sarif-output=<path>` command
+ /// line option is set. The writer will be configured to respond to these
+ /// conditions.
+ ///
+ /// This does not configure a default path, so one must be set once it is
+ /// known that we're in normal mode if none was explicitly provided.
+ bool ConfigureForCMakeRun(cmake& cm);
+
+ ~LogFileWriter();
+
+ /// @brief Check if a valid path is set by opening the output file
+ /// @return True if the file can be opened for writing
+ bool EnsureFileValid();
+
+ /// @brief The possible outcomes of trying to write the log file
+ enum class WriteResult
+ {
+ SUCCESS, ///< File written with no issues
+ FAILURE, ///< Error encountered while writing the file
+ SKIPPED, ///< Writing was skipped due to false write condition
+ };
+
+ /// @brief Try to write the log file and return `true` if it was written
+ ///
+ /// Check the write condition and path generator to determine if the log
+ /// file should be written.
+ WriteResult TryWrite();
+
+ /// @brief Set a lambda to check if the log file should be written
+ void SetWriteCondition(std::function<bool()> const& checkConditionCallback)
+ {
+ this->WriteCondition = checkConditionCallback;
+ }
+
+ /// @brief Set the output file path, optionally creating parent directories
+ ///
+ /// The settings will apply when the log file is written. If the output
+ /// file should be checked earlier, use `CheckFileValidity`.
+ void SetPath(cm::filesystem::path const& path,
+ bool createParentDirectories = false)
+ {
+ this->FilePath = path;
+ this->CreateDirectories = createParentDirectories;
+ }
+
+private:
+ ResultsLog const& Log;
+ std::function<bool()> WriteCondition;
+ cm::filesystem::path FilePath;
+ bool CreateDirectories = false;
+ bool FileWritten = false;
+};
+
+} // namespace cmSarif
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx
index 81ef3da..bd38273 100644
--- a/Source/cmScanDepFormat.cxx
+++ b/Source/cmScanDepFormat.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmScanDepFormat.h"
@@ -343,7 +343,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
require_obj["source-path"] = EncodeFilename(require.SourcePath);
}
- const char* lookup_method = nullptr;
+ char const* lookup_method = nullptr;
switch (require.Method) {
case LookupMethod::ByName:
// No explicit value needed for the default.
diff --git a/Source/cmScanDepFormat.h b/Source/cmScanDepFormat.h
index dc55bf1..7e8027e 100644
--- a/Source/cmScanDepFormat.h
+++ b/Source/cmScanDepFormat.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 32f9bec..b3dff8b 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmScriptGenerator.h"
#include <algorithm>
@@ -18,7 +18,7 @@ cmScriptGenerator::cmScriptGenerator(std::string config_var,
cmScriptGenerator::~cmScriptGenerator() = default;
void cmScriptGenerator::Generate(
- std::ostream& os, const std::string& config,
+ std::ostream& os, std::string const& config,
std::vector<std::string> const& configurationTypes)
{
this->ConfigurationName = config;
@@ -28,10 +28,10 @@ void cmScriptGenerator::Generate(
this->ConfigurationTypes = nullptr;
}
-static void cmScriptGeneratorEncodeConfig(const std::string& config,
+static void cmScriptGeneratorEncodeConfig(std::string const& config,
std::string& result)
{
- for (const char* c = config.c_str(); *c; ++c) {
+ for (char const* c = config.c_str(); *c; ++c) {
if (*c >= 'a' && *c <= 'z') {
result += "[";
result += static_cast<char>(*c + 'A' - 'a');
@@ -48,7 +48,7 @@ static void cmScriptGeneratorEncodeConfig(const std::string& config,
}
}
-std::string cmScriptGenerator::CreateConfigTest(const std::string& config)
+std::string cmScriptGenerator::CreateConfigTest(std::string const& config)
{
std::string result = cmStrCat(this->RuntimeConfigVariable, " MATCHES \"^(");
if (!config.empty()) {
@@ -62,7 +62,7 @@ std::string cmScriptGenerator::CreateConfigTest(
std::vector<std::string> const& configs)
{
std::string result = cmStrCat(this->RuntimeConfigVariable, " MATCHES \"^(");
- const char* sep = "";
+ char const* sep = "";
for (std::string const& config : configs) {
result += sep;
sep = "|";
@@ -100,13 +100,13 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os, Indent indent)
}
void cmScriptGenerator::GenerateScriptForConfig(std::ostream& /*unused*/,
- const std::string& /*unused*/,
+ std::string const& /*unused*/,
Indent /*unused*/)
{
// No actions for this generator.
}
-bool cmScriptGenerator::GeneratesForConfig(const std::string& config)
+bool cmScriptGenerator::GeneratesForConfig(std::string const& config)
{
// If this is not a configuration-specific rule then we install.
if (this->Configurations.empty()) {
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 3d7b350..616817b 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -51,7 +51,7 @@ public:
cmScriptGenerator(cmScriptGenerator const&) = delete;
cmScriptGenerator& operator=(cmScriptGenerator const&) = delete;
- void Generate(std::ostream& os, const std::string& config,
+ void Generate(std::ostream& os, std::string const& config,
std::vector<std::string> const& configurationTypes);
protected:
@@ -60,17 +60,17 @@ protected:
virtual void GenerateScriptConfigs(std::ostream& os, Indent indent);
virtual void GenerateScriptActions(std::ostream& os, Indent indent);
virtual void GenerateScriptForConfig(std::ostream& os,
- const std::string& config,
+ std::string const& config,
Indent indent);
virtual void GenerateScriptNoConfig(std::ostream&, Indent) {}
virtual bool NeedsScriptNoConfig() const { return false; }
// Test if this generator does something for a given configuration.
- bool GeneratesForConfig(const std::string&);
+ bool GeneratesForConfig(std::string const&);
- std::string CreateConfigTest(const std::string& config);
+ std::string CreateConfigTest(std::string const& config);
std::string CreateConfigTest(std::vector<std::string> const& configs);
- std::string CreateComponentTest(const std::string& component);
+ std::string CreateComponentTest(std::string const& component);
// Information shared by most generator types.
std::string RuntimeConfigVariable;
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index ec70c05..c1b0469 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSearchPath.h"
#include <algorithm>
@@ -23,28 +23,24 @@ cmSearchPath::cmSearchPath(cmFindCommon* findCmd)
cmSearchPath::~cmSearchPath() = default;
-void cmSearchPath::ExtractWithout(const std::set<std::string>& ignorePaths,
- const std::set<std::string>& ignorePrefixes,
- std::vector<std::string>& outPaths,
- bool clear) const
+void cmSearchPath::ExtractWithout(std::set<std::string> const& ignorePaths,
+ std::set<std::string> const& ignorePrefixes,
+ std::vector<std::string>& outPaths) const
{
- if (clear) {
- outPaths.clear();
- }
for (auto const& path : this->Paths) {
- if (ignorePaths.count(path.Path) == 0 &&
- ignorePrefixes.count(path.Prefix) == 0) {
+ if (ignorePaths.find(path.Path) == ignorePaths.end() &&
+ ignorePrefixes.find(path.Prefix) == ignorePrefixes.end()) {
outPaths.push_back(path.Path);
}
}
}
-void cmSearchPath::AddPath(const std::string& path)
+void cmSearchPath::AddPath(std::string const& path)
{
this->AddPathInternal(path, "");
}
-void cmSearchPath::AddUserPath(const std::string& path)
+void cmSearchPath::AddUserPath(std::string const& path)
{
assert(this->FC);
@@ -54,7 +50,7 @@ void cmSearchPath::AddUserPath(const std::string& path)
cmWindowsRegistry::SimpleTypes);
auto expandedPaths = registry.ExpandExpression(path, this->FC->RegistryView);
if (expandedPaths) {
- for (const auto& expandedPath : expandedPaths.value()) {
+ for (auto const& expandedPath : expandedPaths.value()) {
cmSystemTools::GlobDirs(expandedPath, outPaths);
}
}
@@ -62,11 +58,13 @@ void cmSearchPath::AddUserPath(const std::string& path)
// Process them all from the current directory
for (std::string const& p : outPaths) {
this->AddPathInternal(
- p, "", this->FC->Makefile->GetCurrentSourceDirectory().c_str());
+ cmSystemTools::CollapseFullPath(
+ p, this->FC->Makefile->GetCurrentSourceDirectory()),
+ "");
}
}
-void cmSearchPath::AddCMakePath(const std::string& variable)
+void cmSearchPath::AddCMakePath(std::string const& variable)
{
assert(this->FC);
@@ -76,30 +74,34 @@ void cmSearchPath::AddCMakePath(const std::string& variable)
for (std::string const& p : expanded) {
this->AddPathInternal(
- p, "", this->FC->Makefile->GetCurrentSourceDirectory().c_str());
+ cmSystemTools::CollapseFullPath(
+ p, this->FC->Makefile->GetCurrentSourceDirectory()),
+ "");
}
}
}
-void cmSearchPath::AddEnvPath(const std::string& variable)
+void cmSearchPath::AddEnvPath(std::string const& variable)
{
- std::vector<std::string> expanded;
- cmSystemTools::GetPath(expanded, variable.c_str());
+ std::vector<std::string> expanded =
+ cmSystemTools::GetEnvPathNormalized(variable);
for (std::string const& p : expanded) {
this->AddPathInternal(p, "");
}
}
-void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
+void cmSearchPath::AddCMakePrefixPath(std::string const& variable)
{
assert(this->FC);
// Get a path from a CMake variable.
if (cmValue value = this->FC->Makefile->GetDefinition(variable)) {
cmList expanded{ *value };
-
- this->AddPrefixPaths(
- expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
+ for (std::string& p : expanded) {
+ p = cmSystemTools::CollapseFullPath(
+ p, this->FC->Makefile->GetCurrentSourceDirectory());
+ }
+ this->AddPrefixPaths(expanded);
}
}
@@ -112,10 +114,10 @@ static std::string cmSearchPathStripBin(std::string const& s)
return s;
}
-void cmSearchPath::AddEnvPrefixPath(const std::string& variable, bool stripBin)
+void cmSearchPath::AddEnvPrefixPath(std::string const& variable, bool stripBin)
{
- std::vector<std::string> expanded;
- cmSystemTools::GetPath(expanded, variable.c_str());
+ std::vector<std::string> expanded =
+ cmSystemTools::GetEnvPathNormalized(variable);
if (stripBin) {
std::transform(expanded.begin(), expanded.end(), expanded.begin(),
cmSearchPathStripBin);
@@ -123,7 +125,7 @@ void cmSearchPath::AddEnvPrefixPath(const std::string& variable, bool stripBin)
this->AddPrefixPaths(expanded);
}
-void cmSearchPath::AddSuffixes(const std::vector<std::string>& suffixes)
+void cmSearchPath::AddSuffixes(std::vector<std::string> const& suffixes)
{
std::vector<PathWithPrefix> inPaths;
inPaths.swap(this->Paths);
@@ -138,21 +140,20 @@ void cmSearchPath::AddSuffixes(const std::vector<std::string>& suffixes)
// path on windows and cause huge delays.
std::string p = inPath.Path;
if (!p.empty() && p.back() != '/') {
- p += "/";
+ p += '/';
}
// Combine with all the suffixes
for (std::string const& suffix : suffixes) {
- this->Paths.push_back(PathWithPrefix{ p + suffix, inPath.Prefix });
+ this->Paths.emplace_back(PathWithPrefix{ p + suffix, inPath.Prefix });
}
// And now the original w/o any suffix
- this->Paths.push_back(std::move(inPath));
+ this->Paths.emplace_back(std::move(inPath));
}
}
-void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
- const char* base)
+void cmSearchPath::AddPrefixPaths(std::vector<std::string> const& paths)
{
assert(this->FC);
@@ -192,52 +193,43 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
"CMAKE_PREFIX_LIBRARY_ARCHITECTURE")) {
if (foundUnknown) {
this->AddPathInternal(cmStrCat('/', archNoUnknown, dir, subdir),
- cmStrCat('/', archNoUnknown, prefix), base);
+ cmStrCat('/', archNoUnknown, prefix));
}
this->AddPathInternal(cmStrCat('/', *arch, dir, subdir),
- cmStrCat('/', *arch, prefix), base);
+ cmStrCat('/', *arch, prefix));
} else {
if (foundUnknown) {
this->AddPathInternal(cmStrCat(dir, subdir, '/', archNoUnknown),
- prefix, base);
+ prefix);
}
- this->AddPathInternal(cmStrCat(dir, subdir, '/', *arch), prefix,
- base);
+ this->AddPathInternal(cmStrCat(dir, subdir, '/', *arch), prefix);
}
}
}
std::string add = dir + subdir;
if (add != "/") {
- this->AddPathInternal(add, prefix, base);
+ this->AddPathInternal(add, prefix);
}
if (subdir == "bin") {
- this->AddPathInternal(dir + "sbin", prefix, base);
+ this->AddPathInternal(dir + "sbin", prefix);
}
if (!subdir.empty() && path != "/") {
- this->AddPathInternal(path, prefix, base);
+ this->AddPathInternal(path, prefix);
}
}
}
-void cmSearchPath::AddPathInternal(const std::string& path,
- const std::string& prefix, const char* base)
+void cmSearchPath::AddPathInternal(std::string const& path,
+ std::string const& prefix)
{
assert(this->FC);
- std::string collapsedPath = cmSystemTools::CollapseFullPath(path, base);
-
- if (collapsedPath.empty()) {
+ if (path.empty()) {
return;
}
- std::string collapsedPrefix;
- if (!prefix.empty()) {
- collapsedPrefix = cmSystemTools::CollapseFullPath(prefix, base);
- }
-
// Insert the path if has not already been emitted.
- PathWithPrefix pathWithPrefix{ std::move(collapsedPath),
- std::move(collapsedPrefix) };
+ PathWithPrefix pathWithPrefix{ path, prefix };
if (this->FC->SearchPathsEmitted.insert(pathWithPrefix).second) {
this->Paths.emplace_back(std::move(pathWithPrefix));
}
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index 4c0cabb..20c33d1 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,41 +26,38 @@ public:
cmSearchPath(cmFindCommon* findCmd = nullptr);
~cmSearchPath();
- cmSearchPath(const cmSearchPath&) = default;
- cmSearchPath& operator=(const cmSearchPath&) = default;
+ cmSearchPath(cmSearchPath const&) = default;
+ cmSearchPath& operator=(cmSearchPath const&) = default;
struct PathWithPrefix
{
std::string Path;
std::string Prefix;
- bool operator<(const PathWithPrefix& other) const
+ bool operator<(PathWithPrefix const& other) const
{
return this->Path < other.Path ||
(this->Path == other.Path && this->Prefix < other.Prefix);
}
};
- const std::vector<PathWithPrefix>& GetPaths() const { return this->Paths; }
+ std::vector<PathWithPrefix> const& GetPaths() const { return this->Paths; }
std::size_t size() const { return this->Paths.size(); }
- void ExtractWithout(const std::set<std::string>& ignorePaths,
- const std::set<std::string>& ignorePrefixes,
- std::vector<std::string>& outPaths,
- bool clear = false) const;
+ void ExtractWithout(std::set<std::string> const& ignorePaths,
+ std::set<std::string> const& ignorePrefixes,
+ std::vector<std::string>& outPaths) const;
- void AddPath(const std::string& path);
- void AddUserPath(const std::string& path);
- void AddCMakePath(const std::string& variable);
- void AddEnvPath(const std::string& variable);
- void AddCMakePrefixPath(const std::string& variable);
- void AddEnvPrefixPath(const std::string& variable, bool stripBin = false);
- void AddSuffixes(const std::vector<std::string>& suffixes);
- void AddPrefixPaths(const std::vector<std::string>& paths,
- const char* base = nullptr);
+ void AddPath(std::string const& path);
+ void AddUserPath(std::string const& path);
+ void AddCMakePath(std::string const& variable);
+ void AddEnvPath(std::string const& variable);
+ void AddCMakePrefixPath(std::string const& variable);
+ void AddEnvPrefixPath(std::string const& variable, bool stripBin = false);
+ void AddSuffixes(std::vector<std::string> const& suffixes);
+ void AddPrefixPaths(std::vector<std::string> const& paths);
protected:
- void AddPathInternal(const std::string& path, const std::string& prefix,
- const char* base = nullptr);
+ void AddPathInternal(std::string const& path, std::string const& prefix);
cmFindCommon* FC;
std::vector<PathWithPrefix> Paths;
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 3576e4f..5540e8f 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSeparateArgumentsCommand.h"
#include <algorithm>
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index d284a40..a24d3a3 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index c98745a..e865bf6 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSetCommand.h"
#include "cmExecutionStatus.h"
@@ -31,7 +31,7 @@ bool cmSetCommand(std::vector<std::string> const& args,
// what is the current value if any
std::string currValue;
- const bool currValueSet = cmSystemTools::GetEnv(varName, currValue);
+ bool const currValueSet = cmSystemTools::GetEnv(varName, currValue);
// will it be set to something, then set it
if (args.size() > 1 && !args[1].empty()) {
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 695b185..a3e709a 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx
index 9adf537..cdfd068 100644
--- a/Source/cmSetDirectoryPropertiesCommand.cxx
+++ b/Source/cmSetDirectoryPropertiesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSetDirectoryPropertiesCommand.h"
#include "cmExecutionStatus.h"
@@ -21,7 +21,7 @@ bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
}
for (auto iter = args.begin() + 1; iter != args.end(); iter += 2) {
- const std::string& prop = *iter;
+ std::string const& prop = *iter;
if (prop == "VARIABLES") {
status.SetError(
"Variables and cache variables should be set using SET command");
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index f5b6406..293e30e 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index a229ea2..a243954 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSetPropertyCommand.h"
#include <set>
@@ -29,59 +29,59 @@
namespace {
bool HandleGlobalMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleDirectoryMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleTargetMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleTarget(cmTarget* target, cmMakefile& makefile,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleSourceMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove,
- const std::vector<cmMakefile*>& directory_makefiles,
+ std::vector<cmMakefile*> const& directory_makefiles,
bool source_file_paths_should_be_absolute);
-bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+bool HandleSource(cmSourceFile* sf, std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove,
cmMakefile* test_directory_makefile);
-bool HandleTest(cmTest* test, const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+bool HandleTest(cmTest* test, std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleCacheMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
-bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+bool HandleCacheEntry(std::string const& cacheKey, cmMakefile const& makefile,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleInstallMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
bool HandleInstall(cmInstalledFile* file, cmMakefile& makefile,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove);
}
@@ -95,8 +95,8 @@ bool HandleSourceFileDirectoryScopes(
cmMakefile* current_dir_mf = &status.GetMakefile();
if (!source_file_directories.empty()) {
- for (const std::string& dir_path : source_file_directories) {
- const std::string absolute_dir_path = cmSystemTools::CollapseFullPath(
+ for (std::string const& dir_path : source_file_directories) {
+ std::string const absolute_dir_path = cmSystemTools::CollapseFullPath(
dir_path, current_dir_mf->GetCurrentSourceDirectory());
cmMakefile* dir_mf =
status.GetMakefile().GetGlobalGenerator()->FindMakefile(
@@ -114,7 +114,7 @@ bool HandleSourceFileDirectoryScopes(
}
if (!source_file_target_directories.empty()) {
- for (const std::string& target_name : source_file_target_directories) {
+ for (std::string const& target_name : source_file_target_directories) {
cmTarget* target = current_dir_mf->FindTargetToUse(target_name);
if (!target) {
status.SetError(cmStrCat(
@@ -193,7 +193,7 @@ bool HandleTestDirectoryScopes(cmExecutionStatus& status,
{
cmMakefile* current_dir_mf = &status.GetMakefile();
if (!test_directory.empty()) {
- const std::string absolute_dir_path = cmSystemTools::CollapseFullPath(
+ std::string const absolute_dir_path = cmSystemTools::CollapseFullPath(
test_directory, current_dir_mf->GetCurrentSourceDirectory());
cmMakefile* dir_mf =
status.GetMakefile().GetGlobalGenerator()->FindMakefile(
@@ -242,8 +242,8 @@ bool HandleAndValidateTestDirectoryScopes(cmExecutionStatus& status,
}
std::string MakeSourceFilePathAbsoluteIfNeeded(
- cmExecutionStatus& status, const std::string& source_file_path,
- const bool needed)
+ cmExecutionStatus& status, std::string const& source_file_path,
+ bool const needed)
{
if (!needed) {
return source_file_path;
@@ -257,7 +257,7 @@ void MakeSourceFilePathsAbsoluteIfNeeded(
cmExecutionStatus& status,
std::vector<std::string>& source_files_absolute_paths,
std::vector<std::string>::const_iterator files_it_begin,
- std::vector<std::string>::const_iterator files_it_end, const bool needed)
+ std::vector<std::string>::const_iterator files_it_end, bool const needed)
{
// Make the file paths absolute, so that relative source file paths are
@@ -273,7 +273,7 @@ void MakeSourceFilePathsAbsoluteIfNeeded(
}
for (; files_it_begin != files_it_end; ++files_it_begin) {
- const std::string absolute_file_path =
+ std::string const absolute_file_path =
MakeSourceFilePathAbsoluteIfNeeded(status, *files_it_begin, true);
source_files_absolute_paths.push_back(absolute_file_path);
}
@@ -282,7 +282,7 @@ void MakeSourceFilePathsAbsoluteIfNeeded(
bool HandleAndValidateSourceFilePropertyGENERATED(
cmSourceFile* sf, std::string const& propertyValue, PropertyOp op)
{
- const auto& mf = *sf->GetLocation().GetMakefile();
+ auto const& mf = *sf->GetLocation().GetMakefile();
auto isProblematic = [&mf, &propertyValue,
op](cm::string_view policy) -> bool {
@@ -314,8 +314,8 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
return false;
};
- const auto cmp0163PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0163);
- const bool cmp0163PolicyNEW = cmp0163PolicyStatus != cmPolicies::OLD &&
+ auto const cmp0163PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0163);
+ bool const cmp0163PolicyNEW = cmp0163PolicyStatus != cmPolicies::OLD &&
cmp0163PolicyStatus != cmPolicies::WARN;
if (cmp0163PolicyNEW) {
if (!isProblematic("CMP0163")) {
@@ -324,9 +324,9 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
return true;
}
- const auto cmp0118PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118);
- const bool cmp0118PolicyWARN = cmp0118PolicyStatus == cmPolicies::WARN;
- const bool cmp0118PolicyNEW =
+ auto const cmp0118PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118);
+ bool const cmp0118PolicyWARN = cmp0118PolicyStatus == cmPolicies::WARN;
+ bool const cmp0118PolicyNEW =
cmp0118PolicyStatus != cmPolicies::OLD && !cmp0118PolicyWARN;
if (cmp0118PolicyNEW) {
@@ -444,7 +444,7 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
DoingTestDirectory,
};
Doing doing = DoingNames;
- const char* sep = "";
+ char const* sep = "";
for (std::string const& arg : cmMakeRange(args).advance(1)) {
if (arg == "PROPERTY") {
doing = DoingProperty;
@@ -552,9 +552,9 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
namespace /* anonymous */ {
bool HandleGlobalMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
if (!names.empty()) {
@@ -578,9 +578,9 @@ bool HandleGlobalMode(cmExecutionStatus& status,
}
bool HandleDirectoryMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
if (names.size() > 1) {
@@ -624,9 +624,9 @@ bool HandleDirectoryMode(cmExecutionStatus& status,
}
bool HandleTargetMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
for (std::string const& name : names) {
@@ -650,8 +650,8 @@ bool HandleTargetMode(cmExecutionStatus& status,
}
bool HandleTarget(cmTarget* target, cmMakefile& makefile,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
// Set or append the property.
@@ -673,12 +673,12 @@ bool HandleTarget(cmTarget* target, cmMakefile& makefile,
}
bool HandleSourceMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove,
- const std::vector<cmMakefile*>& directory_makefiles,
- const bool source_file_paths_should_be_absolute)
+ std::vector<cmMakefile*> const& directory_makefiles,
+ bool const source_file_paths_should_be_absolute)
{
std::vector<std::string> files_absolute;
std::vector<std::string> unique_files(names.begin(), names.end());
@@ -705,8 +705,8 @@ bool HandleSourceMode(cmExecutionStatus& status,
return true;
}
-bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+bool HandleSource(cmSourceFile* sf, std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
// Special validation and handling of GENERATED flag?
@@ -734,8 +734,8 @@ bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
}
bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove, cmMakefile* test_makefile)
{
// Look for tests with all names given.
@@ -766,8 +766,8 @@ bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
return true;
}
-bool HandleTest(cmTest* test, const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+bool HandleTest(cmTest* test, std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
// Set or append the property.
@@ -785,9 +785,9 @@ bool HandleTest(cmTest* test, const std::string& propertyName,
}
bool HandleCacheMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
if (propertyName == "ADVANCED") {
@@ -831,9 +831,9 @@ bool HandleCacheMode(cmExecutionStatus& status,
return true;
}
-bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+bool HandleCacheEntry(std::string const& cacheKey, cmMakefile const& makefile,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
// Set or append the property.
@@ -852,9 +852,9 @@ bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile,
}
bool HandleInstallMode(cmExecutionStatus& status,
- const std::set<std::string>& names,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::set<std::string> const& names,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
cmake* cm = status.GetMakefile().GetCMakeInstance();
@@ -876,8 +876,8 @@ bool HandleInstallMode(cmExecutionStatus& status,
}
bool HandleInstall(cmInstalledFile* file, cmMakefile& makefile,
- const std::string& propertyName,
- const std::string& propertyValue, bool appendAsString,
+ std::string const& propertyName,
+ std::string const& propertyValue, bool appendAsString,
bool appendMode, bool remove)
{
// Set or append the property.
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 4d9480d..8291257 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -46,7 +46,7 @@ bool HandleAndValidateTestDirectoryScopes(
std::string& test_directory, cmMakefile*& test_directory_makefile);
std::string MakeSourceFilePathAbsoluteIfNeeded(
- cmExecutionStatus& status, const std::string& source_file_path, bool needed);
+ cmExecutionStatus& status, std::string const& source_file_path, bool needed);
void MakeSourceFilePathsAbsoluteIfNeeded(
cmExecutionStatus& status,
std::vector<std::string>& source_files_absolute_paths,
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index ab93ddb..98911c0 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSetSourceFilesPropertiesCommand.h"
#include <algorithm>
@@ -31,13 +31,13 @@ bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
// break the arguments into source file names and properties
// old style allows for specifier before PROPERTIES keyword
- static const cm::string_view prop_names[] = {
+ static cm::string_view const prop_names[] = {
"ABSTRACT", "GENERATED", "WRAP_EXCLUDE", "COMPILE_FLAGS",
"OBJECT_DEPENDS", "PROPERTIES", "DIRECTORY", "TARGET_DIRECTORY"
};
auto isAPropertyKeyword =
- [](const std::vector<std::string>::const_iterator& arg_it) {
+ [](std::vector<std::string>::const_iterator const& arg_it) {
return std::any_of(
std::begin(prop_names), std::end(prop_names),
[&arg_it](cm::string_view prop_name) { return *arg_it == prop_name; });
@@ -80,7 +80,7 @@ bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
}
}
- const auto props_begin = options_it;
+ auto const props_begin = options_it;
bool file_scopes_handled =
SetPropertyCommand::HandleAndValidateSourceFileDirectoryScopes(
@@ -163,7 +163,7 @@ static bool RunCommandForScope(
}
// loop over all the files
- for (const std::string& sfname : cmStringRange{ file_begin, file_end }) {
+ for (std::string const& sfname : cmStringRange{ file_begin, file_end }) {
// get the source file
if (cmSourceFile* sf = mf->GetOrCreateSource(sfname)) {
// loop through the props and set them
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 8f88522..486cbfc 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index bdc84af..64be3be 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSetTargetPropertiesCommand.h"
#include <algorithm>
@@ -34,7 +34,7 @@ bool cmSetTargetPropertiesCommand(std::vector<std::string> const& args,
cmMakefile& mf = status.GetMakefile();
// loop over all the targets
- for (const std::string& tname : cmStringRange{ args.begin(), propsIter }) {
+ for (std::string const& tname : cmStringRange{ args.begin(), propsIter }) {
if (mf.IsAlias(tname)) {
status.SetError("can not be used on an ALIAS target.");
return false;
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 0c04f31..758c13a 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 2ac445c..f2bbbae 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSetTestsPropertiesCommand.h"
#include <algorithm>
@@ -58,7 +58,7 @@ bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
}
// loop over all the tests
- for (const std::string& tname : tests) {
+ for (std::string const& tname : tests) {
if (cmTest* test = mf->GetTest(tname)) {
// loop through all the props and set them
for (auto k = propsIter + 1; k != args.end(); k += 2) {
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index b4f1641..3eeef79 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 61d1c30..91dedf7 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSiteNameCommand.h"
#include "cmsys/RegularExpression.hxx"
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 432ba37..9960012 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 5443c47..b4090b3 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSourceFile.h"
#include <utility>
@@ -20,7 +20,7 @@
#include "cmValue.h"
#include "cmake.h"
-cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name,
+cmSourceFile::cmSourceFile(cmMakefile* mf, std::string const& name,
bool generated, cmSourceFileLocationKind kind)
: Location(mf, name, (!generated) ? kind : cmSourceFileLocationKind::Known)
{
@@ -34,15 +34,15 @@ std::string const& cmSourceFile::GetExtension() const
return this->Extension;
}
-const std::string propTRUE = "1";
-const std::string propFALSE = "0";
-const std::string cmSourceFile::propLANGUAGE = "LANGUAGE";
-const std::string cmSourceFile::propLOCATION = "LOCATION";
-const std::string cmSourceFile::propGENERATED = "GENERATED";
-const std::string cmSourceFile::propCOMPILE_DEFINITIONS =
+std::string const propTRUE = "1";
+std::string const propFALSE = "0";
+std::string const cmSourceFile::propLANGUAGE = "LANGUAGE";
+std::string const cmSourceFile::propLOCATION = "LOCATION";
+std::string const cmSourceFile::propGENERATED = "GENERATED";
+std::string const cmSourceFile::propCOMPILE_DEFINITIONS =
"COMPILE_DEFINITIONS";
-const std::string cmSourceFile::propCOMPILE_OPTIONS = "COMPILE_OPTIONS";
-const std::string cmSourceFile::propINCLUDE_DIRECTORIES =
+std::string const cmSourceFile::propCOMPILE_OPTIONS = "COMPILE_OPTIONS";
+std::string const cmSourceFile::propINCLUDE_DIRECTORIES =
"INCLUDE_DIRECTORIES";
void cmSourceFile::SetObjectLibrary(std::string const& objlib)
@@ -226,8 +226,6 @@ bool cmSourceFile::FindFullPath(std::string* error,
err = cmStrCat(err, " .", ext);
}
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
break;
}
@@ -285,7 +283,7 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc)
return this->Location.Matches(loc);
}
-void cmSourceFile::SetProperty(const std::string& prop, cmValue value)
+void cmSourceFile::SetProperty(std::string const& prop, cmValue value)
{
if (prop == propINCLUDE_DIRECTORIES) {
this->IncludeDirectories.clear();
@@ -310,8 +308,8 @@ void cmSourceFile::SetProperty(const std::string& prop, cmValue value)
}
}
-void cmSourceFile::AppendProperty(const std::string& prop,
- const std::string& value, bool asString)
+void cmSourceFile::AppendProperty(std::string const& prop,
+ std::string const& value, bool asString)
{
if (prop == propINCLUDE_DIRECTORIES) {
if (!value.empty()) {
@@ -333,7 +331,7 @@ void cmSourceFile::AppendProperty(const std::string& prop,
}
}
-cmValue cmSourceFile::GetPropertyForUser(const std::string& prop)
+cmValue cmSourceFile::GetPropertyForUser(std::string const& prop)
{
// This method is a consequence of design history and backwards
// compatibility. GetProperty is (and should be) a const method.
@@ -385,7 +383,7 @@ cmValue cmSourceFile::GetPropertyForUser(const std::string& prop)
return this->GetProperty(prop);
}
-cmValue cmSourceFile::GetProperty(const std::string& prop) const
+cmValue cmSourceFile::GetProperty(std::string const& prop) const
{
// Check for computed properties.
if (prop == propLOCATION) {
@@ -429,7 +427,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const
cmValue retVal = this->Properties.GetPropertyValue(prop);
if (!retVal) {
cmMakefile const* mf = this->Location.GetMakefile();
- const bool chain =
+ bool const chain =
mf->GetState()->IsPropertyChained(prop, cmProperty::SOURCE_FILE);
if (chain) {
return mf->GetProperty(prop, chain);
@@ -440,7 +438,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const
return retVal;
}
-const std::string& cmSourceFile::GetSafeProperty(const std::string& prop) const
+std::string const& cmSourceFile::GetSafeProperty(std::string const& prop) const
{
cmValue ret = this->GetProperty(prop);
if (ret) {
@@ -451,7 +449,7 @@ const std::string& cmSourceFile::GetSafeProperty(const std::string& prop) const
return s_empty;
}
-bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
+bool cmSourceFile::GetPropertyAsBool(std::string const& prop) const
{
return this->GetProperty(prop).IsOn();
}
@@ -459,7 +457,7 @@ bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
void cmSourceFile::MarkAsGenerated()
{
this->IsGenerated = true;
- const auto& mf = *this->Location.GetMakefile();
+ auto const& mf = *this->Location.GetMakefile();
mf.GetGlobalGenerator()->MarkAsGeneratedFile(this->ResolveFullPath());
}
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 5cacbbc..89afec1 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,7 +31,7 @@ public:
* kind is assumed to be known, regardless of the given value.
*/
cmSourceFile(
- cmMakefile* mf, const std::string& name, bool generated,
+ cmMakefile* mf, std::string const& name, bool generated,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
/**
@@ -41,26 +41,26 @@ public:
void SetCustomCommand(std::unique_ptr<cmCustomCommand> cc);
//! Set/Get a property of this source file
- void SetProperty(const std::string& prop, cmValue value);
- void RemoveProperty(const std::string& prop)
+ void SetProperty(std::string const& prop, cmValue value);
+ void RemoveProperty(std::string const& prop)
{
this->SetProperty(prop, cmValue{ nullptr });
}
- void SetProperty(const std::string& prop, const std::string& value)
+ void SetProperty(std::string const& prop, std::string const& value)
{
this->SetProperty(prop, cmValue(value));
}
- void AppendProperty(const std::string& prop, const std::string& value,
+ void AppendProperty(std::string const& prop, std::string const& value,
bool asString = false);
//! Might return a nullptr if the property is not set or invalid
- cmValue GetProperty(const std::string& prop) const;
+ cmValue GetProperty(std::string const& prop) const;
//! Always returns a valid pointer
- const std::string& GetSafeProperty(const std::string& prop) const;
- bool GetPropertyAsBool(const std::string& prop) const;
+ std::string const& GetSafeProperty(std::string const& prop) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
/** Implement getting a property when called from a CMake language
command like get_property or get_source_file_property. */
- cmValue GetPropertyForUser(const std::string& prop);
+ cmValue GetPropertyForUser(std::string const& prop);
/// Marks this file as generated
/**
@@ -86,17 +86,17 @@ public:
bool GetIsGenerated(
CheckScope checkScope = CheckScope::GlobalAndLocal) const;
- const std::vector<BT<std::string>>& GetCompileOptions() const
+ std::vector<BT<std::string>> const& GetCompileOptions() const
{
return this->CompileOptions;
}
- const std::vector<BT<std::string>>& GetCompileDefinitions() const
+ std::vector<BT<std::string>> const& GetCompileDefinitions() const
{
return this->CompileDefinitions;
}
- const std::vector<BT<std::string>>& GetIncludeDirectories() const
+ std::vector<BT<std::string>> const& GetIncludeDirectories() const
{
return this->IncludeDirectories;
}
@@ -135,11 +135,11 @@ public:
/**
* Return the vector that holds the list of dependencies
*/
- const std::vector<std::string>& GetDepends() const { return this->Depends; }
- void AddDepend(const std::string& d) { this->Depends.push_back(d); }
+ std::vector<std::string> const& GetDepends() const { return this->Depends; }
+ void AddDepend(std::string const& d) { this->Depends.push_back(d); }
// Get the properties
- const cmPropertyMap& GetProperties() const { return this->Properties; }
+ cmPropertyMap const& GetProperties() const { return this->Properties; }
// Set the properties
void SetProperties(cmPropertyMap properties);
@@ -171,12 +171,12 @@ private:
void CheckExtension();
void CheckLanguage(std::string const& ext);
- static const std::string propLANGUAGE;
- static const std::string propLOCATION;
- static const std::string propGENERATED;
- static const std::string propCOMPILE_DEFINITIONS;
- static const std::string propCOMPILE_OPTIONS;
- static const std::string propINCLUDE_DIRECTORIES;
+ static std::string const propLANGUAGE;
+ static std::string const propLOCATION;
+ static std::string const propGENERATED;
+ static std::string const propCOMPILE_DEFINITIONS;
+ static std::string const propCOMPILE_OPTIONS;
+ static std::string const propINCLUDE_DIRECTORIES;
};
// TODO: Factor out into platform information modules.
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 8c7154d..d8f9d0d 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSourceFileLocation.h"
#include <cassert>
@@ -15,7 +15,7 @@
cmSourceFileLocation::cmSourceFileLocation() = default;
-cmSourceFileLocation::cmSourceFileLocation(const cmSourceFileLocation& loc)
+cmSourceFileLocation::cmSourceFileLocation(cmSourceFileLocation const& loc)
: Makefile(loc.Makefile)
{
this->AmbiguousDirectory = loc.AmbiguousDirectory;
@@ -25,7 +25,7 @@ cmSourceFileLocation::cmSourceFileLocation(const cmSourceFileLocation& loc)
}
cmSourceFileLocation::cmSourceFileLocation(cmMakefile const* mf,
- const std::string& name,
+ std::string const& name,
cmSourceFileLocationKind kind)
: Makefile(mf)
{
@@ -86,7 +86,7 @@ void cmSourceFileLocation::DirectoryUseBinary()
}
}
-void cmSourceFileLocation::UpdateExtension(const std::string& name)
+void cmSourceFileLocation::UpdateExtension(std::string const& name)
{
assert(this->Makefile);
// Check the extension.
@@ -171,8 +171,8 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
return false;
}
} else {
- const cmSourceFileLocation* loc1;
- const cmSourceFileLocation* loc2;
+ cmSourceFileLocation const* loc1;
+ cmSourceFileLocation const* loc2;
if (this->AmbiguousExtension) {
// Only "this" extension is ambiguous.
loc1 = &loc;
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index b373d3d..bb3b866 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,10 +28,10 @@ public:
* instance with an initial name.
*/
cmSourceFileLocation(
- cmMakefile const* mf, const std::string& name,
+ cmMakefile const* mf, std::string const& name,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
cmSourceFileLocation();
- cmSourceFileLocation(const cmSourceFileLocation& loc);
+ cmSourceFileLocation(cmSourceFileLocation const& loc);
cmSourceFileLocation& operator=(cmSourceFileLocation const&) = delete;
@@ -68,7 +68,7 @@ public:
* Otherwise it will be a relative path (possibly empty) that is
* either with respect to the source or build tree.
*/
- const std::string& GetDirectory() const { return this->Directory; }
+ std::string const& GetDirectory() const { return this->Directory; }
/**
* Get the file name as best is currently known. If
@@ -76,7 +76,7 @@ public:
* final name (but could be). Otherwise the returned name is the
* final name.
*/
- const std::string& GetName() const { return this->Name; }
+ std::string const& GetName() const { return this->Name; }
/**
* Get the full file path composed of GetDirectory() and GetName().
@@ -99,5 +99,5 @@ private:
// Update the location with additional knowledge.
void Update(cmSourceFileLocation const& loc);
- void UpdateExtension(const std::string& name);
+ void UpdateExtension(std::string const& name);
};
diff --git a/Source/cmSourceFileLocationKind.h b/Source/cmSourceFileLocationKind.h
index 73108f1..af78f48 100644
--- a/Source/cmSourceFileLocationKind.h
+++ b/Source/cmSourceFileLocationKind.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
enum class cmSourceFileLocationKind
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index 6019de1..3a3ca59 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSourceGroup.h"
#include <utility>
@@ -14,8 +14,8 @@ public:
std::vector<cmSourceGroup> GroupChildren;
};
-cmSourceGroup::cmSourceGroup(std::string name, const char* regex,
- const char* parentName)
+cmSourceGroup::cmSourceGroup(std::string name, char const* regex,
+ char const* parentName)
: Name(std::move(name))
{
this->Internal = cm::make_unique<cmSourceGroupInternals>();
@@ -48,7 +48,7 @@ cmSourceGroup& cmSourceGroup::operator=(cmSourceGroup const& r)
return *this;
}
-void cmSourceGroup::SetGroupRegex(const char* regex)
+void cmSourceGroup::SetGroupRegex(char const* regex)
{
if (regex) {
this->GroupRegex.compile(regex);
@@ -57,7 +57,7 @@ void cmSourceGroup::SetGroupRegex(const char* regex)
}
}
-void cmSourceGroup::AddGroupFile(const std::string& name)
+void cmSourceGroup::AddGroupFile(std::string const& name)
{
this->GroupFiles.insert(name);
}
@@ -72,22 +72,22 @@ std::string const& cmSourceGroup::GetFullName() const
return this->FullName;
}
-bool cmSourceGroup::MatchesRegex(const std::string& name)
+bool cmSourceGroup::MatchesRegex(std::string const& name)
{
return this->GroupRegex.find(name);
}
-bool cmSourceGroup::MatchesFiles(const std::string& name) const
+bool cmSourceGroup::MatchesFiles(std::string const& name) const
{
return this->GroupFiles.find(name) != this->GroupFiles.cend();
}
-void cmSourceGroup::AssignSource(const cmSourceFile* sf)
+void cmSourceGroup::AssignSource(cmSourceFile const* sf)
{
this->SourceFiles.push_back(sf);
}
-const std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() const
+std::vector<cmSourceFile const*> const& cmSourceGroup::GetSourceFiles() const
{
return this->SourceFiles;
}
@@ -97,7 +97,7 @@ void cmSourceGroup::AddChild(cmSourceGroup const& child)
this->Internal->GroupChildren.push_back(child);
}
-cmSourceGroup* cmSourceGroup::LookupChild(const std::string& name)
+cmSourceGroup* cmSourceGroup::LookupChild(std::string const& name)
{
for (cmSourceGroup& group : this->Internal->GroupChildren) {
// look if descenened is the one were looking for
@@ -110,7 +110,7 @@ cmSourceGroup* cmSourceGroup::LookupChild(const std::string& name)
return nullptr;
}
-cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const std::string& name)
+cmSourceGroup* cmSourceGroup::MatchChildrenFiles(std::string const& name)
{
if (this->MatchesFiles(name)) {
return this;
@@ -124,14 +124,14 @@ cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const std::string& name)
return nullptr;
}
-const cmSourceGroup* cmSourceGroup::MatchChildrenFiles(
- const std::string& name) const
+cmSourceGroup const* cmSourceGroup::MatchChildrenFiles(
+ std::string const& name) const
{
if (this->MatchesFiles(name)) {
return this;
}
- for (const cmSourceGroup& group : this->Internal->GroupChildren) {
- const cmSourceGroup* result = group.MatchChildrenFiles(name);
+ for (cmSourceGroup const& group : this->Internal->GroupChildren) {
+ cmSourceGroup const* result = group.MatchChildrenFiles(name);
if (result) {
return result;
}
@@ -139,7 +139,7 @@ const cmSourceGroup* cmSourceGroup::MatchChildrenFiles(
return nullptr;
}
-cmSourceGroup* cmSourceGroup::MatchChildrenRegex(const std::string& name)
+cmSourceGroup* cmSourceGroup::MatchChildrenRegex(std::string const& name)
{
for (cmSourceGroup& group : this->Internal->GroupChildren) {
cmSourceGroup* result = group.MatchChildrenRegex(name);
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 9ce71c7..20f052d 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,8 +27,8 @@ class cmSourceGroupInternals;
class cmSourceGroup
{
public:
- cmSourceGroup(std::string name, const char* regex,
- const char* parentName = nullptr);
+ cmSourceGroup(std::string name, char const* regex,
+ char const* parentName = nullptr);
cmSourceGroup(cmSourceGroup const& r);
~cmSourceGroup();
cmSourceGroup& operator=(cmSourceGroup const&);
@@ -36,12 +36,12 @@ public:
/**
* Set the regular expression for this group.
*/
- void SetGroupRegex(const char* regex);
+ void SetGroupRegex(char const* regex);
/**
* Add a file name to the explicit list of files for this group.
*/
- void AddGroupFile(const std::string& name);
+ void AddGroupFile(std::string const& name);
/**
* Add child to this sourcegroup
@@ -51,7 +51,7 @@ public:
/**
* Looks up child and returns it
*/
- cmSourceGroup* LookupChild(const std::string& name);
+ cmSourceGroup* LookupChild(std::string const& name);
/**
* Get the name of this group.
@@ -66,41 +66,41 @@ public:
/**
* Check if the given name matches this group's regex.
*/
- bool MatchesRegex(const std::string& name);
+ bool MatchesRegex(std::string const& name);
/**
* Check if the given name matches this group's explicit file list.
*/
- bool MatchesFiles(const std::string& name) const;
+ bool MatchesFiles(std::string const& name) const;
/**
* Check if the given name matches this group's explicit file list
* in children.
*/
- cmSourceGroup* MatchChildrenFiles(const std::string& name);
+ cmSourceGroup* MatchChildrenFiles(std::string const& name);
/**
* Check if the given name matches this group's explicit file list
* in children.
*/
- const cmSourceGroup* MatchChildrenFiles(const std::string& name) const;
+ cmSourceGroup const* MatchChildrenFiles(std::string const& name) const;
/**
* Check if the given name matches this group's regex in children.
*/
- cmSourceGroup* MatchChildrenRegex(const std::string& name);
+ cmSourceGroup* MatchChildrenRegex(std::string const& name);
/**
* Assign the given source file to this group. Used only by
* generators.
*/
- void AssignSource(const cmSourceFile* sf);
+ void AssignSource(cmSourceFile const* sf);
/**
* Get the list of the source files that have been assigned to this
* source group.
*/
- const std::vector<const cmSourceFile*>& GetSourceFiles() const;
+ std::vector<cmSourceFile const*> const& GetSourceFiles() const;
std::vector<cmSourceGroup> const& GetGroupChildren() const;
@@ -126,7 +126,7 @@ private:
* Vector of all source files that have been assigned to
* this group.
*/
- std::vector<const cmSourceFile*> SourceFiles;
+ std::vector<cmSourceFile const*> SourceFiles;
std::unique_ptr<cmSourceGroupInternals> Internal;
};
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index bb92856..aabde88 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSourceGroupCommand.h"
#include <cstddef>
@@ -23,22 +23,17 @@ namespace {
using ParsedArguments = std::map<std::string, std::vector<std::string>>;
using ExpectedOptions = std::vector<std::string>;
-const std::string kTreeOptionName = "TREE";
-const std::string kPrefixOptionName = "PREFIX";
-const std::string kFilesOptionName = "FILES";
-const std::string kRegexOptionName = "REGULAR_EXPRESSION";
-const std::string kSourceGroupOptionName = "<sg_name>";
-
-std::vector<std::string> tokenizePath(const std::string& path)
-{
- return cmTokenize(path, "\\/");
-}
+std::string const kTreeOptionName = "TREE";
+std::string const kPrefixOptionName = "PREFIX";
+std::string const kFilesOptionName = "FILES";
+std::string const kRegexOptionName = "REGULAR_EXPRESSION";
+std::string const kSourceGroupOptionName = "<sg_name>";
std::set<std::string> getSourceGroupFilesPaths(
- const std::string& root, const std::vector<std::string>& files)
+ std::string const& root, std::vector<std::string> const& files)
{
std::set<std::string> ret;
- const std::string::size_type rootLength = root.length();
+ std::string::size_type const rootLength = root.length();
for (std::string const& file : files) {
ret.insert(file.substr(rootLength + 1)); // +1 to also omnit last '/'
@@ -47,8 +42,8 @@ std::set<std::string> getSourceGroupFilesPaths(
return ret;
}
-bool rootIsPrefix(const std::string& root,
- const std::vector<std::string>& files, std::string& error)
+bool rootIsPrefix(std::string const& root,
+ std::vector<std::string> const& files, std::string& error)
{
for (std::string const& file : files) {
if (!cmHasPrefix(file, root)) {
@@ -61,8 +56,8 @@ bool rootIsPrefix(const std::string& root,
}
std::vector<std::string> prepareFilesPathsForTree(
- const std::vector<std::string>& filesPaths,
- const std::string& currentSourceDir)
+ std::vector<std::string> const& filesPaths,
+ std::string const& currentSourceDir)
{
std::vector<std::string> prepared;
prepared.reserve(filesPaths.size());
@@ -87,39 +82,36 @@ std::vector<std::string> prepareFilesPathsForTree(
return prepared;
}
-bool addFilesToItsSourceGroups(const std::string& root,
- const std::set<std::string>& sgFilesPaths,
- const std::string& prefix, cmMakefile& makefile,
+bool addFilesToItsSourceGroups(std::string const& root,
+ std::set<std::string> const& sgFilesPaths,
+ std::string const& prefix, cmMakefile& makefile,
std::string& errorMsg)
{
cmSourceGroup* sg;
for (std::string const& sgFilesPath : sgFilesPaths) {
+ std::vector<std::string> tokenizedPath = cmTokenize(
+ prefix.empty() ? sgFilesPath : cmStrCat(prefix, '/', sgFilesPath),
+ R"(\/)", cmTokenizerMode::New);
- std::vector<std::string> tokenizedPath;
- if (!prefix.empty()) {
- tokenizedPath = tokenizePath(cmStrCat(prefix, '/', sgFilesPath));
- } else {
- tokenizedPath = tokenizePath(sgFilesPath);
+ if (tokenizedPath.empty()) {
+ continue;
}
+ tokenizedPath.pop_back();
- if (!tokenizedPath.empty()) {
- tokenizedPath.pop_back();
-
- if (tokenizedPath.empty()) {
- tokenizedPath.emplace_back();
- }
+ if (tokenizedPath.empty()) {
+ tokenizedPath.emplace_back();
+ }
- sg = makefile.GetOrCreateSourceGroup(tokenizedPath);
+ sg = makefile.GetOrCreateSourceGroup(tokenizedPath);
- if (!sg) {
- errorMsg = "Could not create source group for file: " + sgFilesPath;
- return false;
- }
- const std::string fullPath =
- cmSystemTools::CollapseFullPath(sgFilesPath, root);
- sg->AddGroupFile(fullPath);
+ if (!sg) {
+ errorMsg = "Could not create source group for file: " + sgFilesPath;
+ return false;
}
+ std::string const fullPath =
+ cmSystemTools::CollapseFullPath(sgFilesPath, root);
+ sg->AddGroupFile(fullPath);
}
return true;
@@ -137,16 +129,16 @@ ExpectedOptions getExpectedOptions()
return options;
}
-bool isExpectedOption(const std::string& argument,
- const ExpectedOptions& expectedOptions)
+bool isExpectedOption(std::string const& argument,
+ ExpectedOptions const& expectedOptions)
{
return cm::contains(expectedOptions, argument);
}
-void parseArguments(const std::vector<std::string>& args,
+void parseArguments(std::vector<std::string> const& args,
ParsedArguments& parsedArguments)
{
- const ExpectedOptions expectedOptions = getExpectedOptions();
+ ExpectedOptions const expectedOptions = getExpectedOptions();
size_t i = 0;
// at this point we know that args vector is not empty
@@ -160,7 +152,7 @@ void parseArguments(const std::vector<std::string>& args,
for (; i < args.size();) {
// get current option and increment index to go to next argument
- const std::string& currentOption = args[i++];
+ std::string const& currentOption = args[i++];
// create current option entry in parsed arguments
std::vector<std::string>& currentOptionArguments =
@@ -175,14 +167,14 @@ void parseArguments(const std::vector<std::string>& args,
} // namespace
-static bool checkArgumentsPreconditions(const ParsedArguments& parsedArguments,
+static bool checkArgumentsPreconditions(ParsedArguments const& parsedArguments,
std::string& errorMsg);
static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments,
std::string& errorMsg);
static bool checkSingleParameterArgumentPreconditions(
- const std::string& argument, const ParsedArguments& parsedArguments,
+ std::string const& argument, ParsedArguments const& parsedArguments,
std::string& errorMsg);
bool cmSourceGroupCommand(std::vector<std::string> const& args,
@@ -242,12 +234,12 @@ bool cmSourceGroupCommand(std::vector<std::string> const& args,
// handle regex
if (parsedArguments.find(kRegexOptionName) != parsedArguments.end()) {
- const std::string& sgRegex = parsedArguments[kRegexOptionName].front();
+ std::string const& sgRegex = parsedArguments[kRegexOptionName].front();
sg->SetGroupRegex(sgRegex.c_str());
}
// handle files
- const std::vector<std::string>& filesArguments =
+ std::vector<std::string> const& filesArguments =
parsedArguments[kFilesOptionName];
for (auto const& filesArg : filesArguments) {
std::string src = filesArg;
@@ -260,7 +252,7 @@ bool cmSourceGroupCommand(std::vector<std::string> const& args,
return true;
}
-static bool checkArgumentsPreconditions(const ParsedArguments& parsedArguments,
+static bool checkArgumentsPreconditions(ParsedArguments const& parsedArguments,
std::string& errorMsg)
{
return checkSingleParameterArgumentPreconditions(
@@ -274,7 +266,7 @@ static bool checkArgumentsPreconditions(const ParsedArguments& parsedArguments,
static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments,
std::string& errorMsg)
{
- const std::string root =
+ std::string const root =
cmSystemTools::CollapseFullPath(parsedArguments[kTreeOptionName].front());
std::string prefix = parsedArguments[kPrefixOptionName].empty()
? ""
@@ -285,16 +277,16 @@ static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments,
if (filesArgIt != parsedArguments.end()) {
files = filesArgIt->second;
} else {
- const std::vector<std::unique_ptr<cmSourceFile>>& srcFiles =
+ std::vector<std::unique_ptr<cmSourceFile>> const& srcFiles =
mf.GetSourceFiles();
- for (const auto& srcFile : srcFiles) {
+ for (auto const& srcFile : srcFiles) {
if (!srcFile->GetIsGenerated()) {
files.push_back(srcFile->GetLocation().GetFullPath());
}
}
}
- const std::vector<std::string> filesVector =
+ std::vector<std::string> const filesVector =
prepareFilesPathsForTree(files, mf.GetCurrentSourceDirectory());
if (!rootIsPrefix(root, filesVector, errorMsg)) {
@@ -309,12 +301,12 @@ static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments,
}
static bool checkSingleParameterArgumentPreconditions(
- const std::string& argument, const ParsedArguments& parsedArguments,
+ std::string const& argument, ParsedArguments const& parsedArguments,
std::string& errorMsg)
{
auto foundArgument = parsedArguments.find(argument);
if (foundArgument != parsedArguments.end()) {
- const std::vector<std::string>& optionArguments = foundArgument->second;
+ std::vector<std::string> const& optionArguments = foundArgument->second;
if (optionArguments.empty()) {
errorMsg = argument + " argument given without an argument.";
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 44e1f8e..e90f229 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmStandardLevel.h b/Source/cmStandardLevel.h
index 86d178b..dbf71b8 100644
--- a/Source/cmStandardLevel.h
+++ b/Source/cmStandardLevel.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 44c4ae1..1bb865d 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmStandardLevelResolver.h"
@@ -35,16 +35,16 @@
namespace {
#define FEATURE_STRING(F) , #F
-const char* const C_FEATURES[] = { nullptr FOR_EACH_C_FEATURE(
+char const* const C_FEATURES[] = { nullptr FOR_EACH_C_FEATURE(
FEATURE_STRING) };
-const char* const CXX_FEATURES[] = { nullptr FOR_EACH_CXX_FEATURE(
+char const* const CXX_FEATURES[] = { nullptr FOR_EACH_CXX_FEATURE(
FEATURE_STRING) };
-const char* const CUDA_FEATURES[] = { nullptr FOR_EACH_CUDA_FEATURE(
+char const* const CUDA_FEATURES[] = { nullptr FOR_EACH_CUDA_FEATURE(
FEATURE_STRING) };
-const char* const HIP_FEATURES[] = { nullptr FOR_EACH_HIP_FEATURE(
+char const* const HIP_FEATURES[] = { nullptr FOR_EACH_HIP_FEATURE(
FEATURE_STRING) };
#undef FEATURE_STRING
@@ -76,8 +76,8 @@ struct StandardLevelComputer
std::string const& config) const
{
- const auto& stds = this->Levels;
- const auto& stdsStrings = this->LevelsAsStrings;
+ auto const& stds = this->Levels;
+ auto const& stdsStrings = this->LevelsAsStrings;
cmValue defaultStd = makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
@@ -117,7 +117,7 @@ struct StandardLevelComputer
makefile->PolicyOptionalWarningEnabled(
"CMAKE_POLICY_WARNING_CMP0128") &&
ext != defaultExt) {
- const char* state{};
+ char const* state{};
if (ext) {
if (!makefile->GetDefinition(cmStrCat(
"CMAKE_", this->Language, "_EXTENSION_COMPILE_OPTION"))) {
@@ -242,8 +242,8 @@ struct StandardLevelComputer
cmGeneratorTarget const* target,
std::string const& config) const
{
- const auto& stds = this->Levels;
- const auto& stdsStrings = this->LevelsAsStrings;
+ auto const& stds = this->Levels;
+ auto const& stdsStrings = this->LevelsAsStrings;
cmValue defaultStd = makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
@@ -367,7 +367,7 @@ struct StandardLevelComputer
std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
ParseStd(*existingStandard));
if (existingLevelIter == cm::cend(this->Levels)) {
- const std::string e =
+ std::string const e =
cmStrCat("The ", this->Language, "_STANDARD property on target \"",
targetName, "\" contained an invalid value: \"",
*existingStandard, "\".");
@@ -411,7 +411,7 @@ struct StandardLevelComputer
// convert defaultStandard to an integer
if (std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
ParseStd(*defaultStandard)) == cm::cend(this->Levels)) {
- const std::string e = cmStrCat("The CMAKE_", this->Language,
+ std::string const e = cmStrCat("The CMAKE_", this->Language,
"_STANDARD_DEFAULT variable contains an "
"invalid value: \"",
*defaultStandard, "\".");
@@ -429,7 +429,7 @@ struct StandardLevelComputer
std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
ParseStd(*existingStandard));
if (existingLevelIter == cm::cend(this->Levels)) {
- const std::string e =
+ std::string const e =
cmStrCat("The ", this->Language, "_STANDARD property on target \"",
target->GetName(), "\" contained an invalid value: \"",
*existingStandard, "\".");
@@ -521,7 +521,7 @@ std::string cmStandardLevelResolver::GetCompileOptionDef(
cmGeneratorTarget const* target, std::string const& lang,
std::string const& config) const
{
- const auto& mapping = StandardComputerMapping.find(lang);
+ auto const& mapping = StandardComputerMapping.find(lang);
if (mapping == cm::cend(StandardComputerMapping)) {
return std::string{};
}
@@ -533,7 +533,7 @@ std::string cmStandardLevelResolver::GetEffectiveStandard(
cmGeneratorTarget const* target, std::string const& lang,
std::string const& config) const
{
- const auto& mapping = StandardComputerMapping.find(lang);
+ auto const& mapping = StandardComputerMapping.find(lang);
if (mapping == cm::cend(StandardComputerMapping)) {
return std::string{};
}
@@ -557,7 +557,7 @@ std::string cmStandardLevelResolver::GetLevelString(
}
bool cmStandardLevelResolver::AddRequiredTargetFeature(
- cmTarget* target, const std::string& feature, std::string* error) const
+ cmTarget* target, std::string const& feature, std::string* error) const
{
if (cmGeneratorExpression::Find(feature) != std::string::npos) {
target->AppendProperty("COMPILE_FEATURES", feature,
@@ -592,7 +592,7 @@ bool cmStandardLevelResolver::AddRequiredTargetFeature(
}
bool cmStandardLevelResolver::CheckCompileFeaturesAvailable(
- const std::string& targetName, const std::string& feature, std::string& lang,
+ std::string const& targetName, std::string const& feature, std::string& lang,
std::string* error) const
{
if (!this->CompileFeatureKnown(targetName, feature, lang, error)) {
@@ -631,7 +631,7 @@ bool cmStandardLevelResolver::CheckCompileFeaturesAvailable(
}
bool cmStandardLevelResolver::CompileFeatureKnown(
- const std::string& targetName, const std::string& feature, std::string& lang,
+ std::string const& targetName, std::string const& feature, std::string& lang,
std::string* error) const
{
assert(cmGeneratorExpression::Find(feature) == std::string::npos);
@@ -704,7 +704,7 @@ cm::optional<cmStandardLevel> cmStandardLevelResolver::LanguageStandardLevel(
}
cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
- const std::string& lang, std::string* error) const
+ std::string const& lang, std::string* error) const
{
if (!this->Makefile->GetGlobalGenerator()->GetLanguageEnabled(lang)) {
std::ostringstream e;
@@ -750,7 +750,7 @@ cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
}
bool cmStandardLevelResolver::GetNewRequiredStandard(
- const std::string& targetName, const std::string& feature,
+ std::string const& targetName, std::string const& feature,
cmValue currentLangStandardValue,
cm::optional<cmStandardLevel>& featureLevel,
std::string& newRequiredStandard, std::string* error) const
@@ -773,7 +773,7 @@ bool cmStandardLevelResolver::GetNewRequiredStandard(
bool cmStandardLevelResolver::HaveStandardAvailable(
cmGeneratorTarget const* target, std::string const& lang,
- std::string const& config, const std::string& feature) const
+ std::string const& config, std::string const& feature) const
{
auto mapping = StandardComputerMapping.find(lang);
if (mapping != cm::cend(StandardComputerMapping)) {
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 523aa73..1543641 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -32,11 +32,11 @@ public:
std::string GetLevelString(std::string const& lang,
cmStandardLevel const& level) const;
- bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
+ bool AddRequiredTargetFeature(cmTarget* target, std::string const& feature,
std::string* error = nullptr) const;
- bool CompileFeatureKnown(const std::string& targetName,
- const std::string& feature, std::string& lang,
+ bool CompileFeatureKnown(std::string const& targetName,
+ std::string const& feature, std::string& lang,
std::string* error) const;
cm::optional<cmStandardLevel> CompileFeatureStandardLevel(
@@ -45,11 +45,11 @@ public:
cm::optional<cmStandardLevel> LanguageStandardLevel(
std::string const& lang, std::string const& standardStr) const;
- cmValue CompileFeaturesAvailable(const std::string& lang,
+ cmValue CompileFeaturesAvailable(std::string const& lang,
std::string* error) const;
- bool GetNewRequiredStandard(const std::string& targetName,
- const std::string& feature,
+ bool GetNewRequiredStandard(std::string const& targetName,
+ std::string const& feature,
cmValue currentLangStandardValue,
cm::optional<cmStandardLevel>& featureLevel,
std::string& newRequiredStandard,
@@ -58,14 +58,14 @@ public:
bool HaveStandardAvailable(cmGeneratorTarget const* target,
std::string const& lang,
std::string const& config,
- const std::string& feature) const;
+ std::string const& feature) const;
bool IsLaterStandard(std::string const& lang, std::string const& lhs,
std::string const& rhs) const;
private:
- bool CheckCompileFeaturesAvailable(const std::string& targetName,
- const std::string& feature,
+ bool CheckCompileFeaturesAvailable(std::string const& targetName,
+ std::string const& feature,
std::string& lang,
std::string* error) const;
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index e39deb0..71e40d8 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#if defined(__linux)
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index b716dc7..6c261f4 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmState.h"
#include <algorithm>
@@ -13,7 +13,6 @@
#include "cmsys/RegularExpression.hxx"
#include "cmCacheManager.h"
-#include "cmCommand.h"
#include "cmDefinitions.h"
#include "cmExecutionStatus.h"
#include "cmGlobCacheEntry.h"
@@ -38,7 +37,7 @@ cmState::cmState(Mode mode, ProjectKind projectKind)
cmState::~cmState() = default;
-const std::string& cmState::GetTargetTypeName(
+std::string const& cmState::GetTargetTypeName(
cmStateEnums::TargetType targetType)
{
#define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP
@@ -51,7 +50,7 @@ const std::string& cmState::GetTargetTypeName(
MAKE_STATIC_PROP(GLOBAL_TARGET);
MAKE_STATIC_PROP(INTERFACE_LIBRARY);
MAKE_STATIC_PROP(UNKNOWN_LIBRARY);
- static const std::string propEmpty;
+ static std::string const propEmpty;
#undef MAKE_STATIC_PROP
switch (targetType) {
@@ -78,12 +77,12 @@ const std::string& cmState::GetTargetTypeName(
return propEmpty;
}
-static const std::array<std::string, 7> cmCacheEntryTypes = {
+static std::array<std::string, 7> const cmCacheEntryTypes = {
{ "BOOL", "PATH", "FILEPATH", "STRING", "INTERNAL", "STATIC",
"UNINITIALIZED" }
};
-const std::string& cmState::CacheEntryTypeToString(
+std::string const& cmState::CacheEntryTypeToString(
cmStateEnums::CacheEntryType type)
{
if (type < cmStateEnums::BOOL || type > cmStateEnums::UNINITIALIZED) {
@@ -93,14 +92,14 @@ const std::string& cmState::CacheEntryTypeToString(
}
cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(
- const std::string& s)
+ std::string const& s)
{
cmStateEnums::CacheEntryType type = cmStateEnums::STRING;
StringToCacheEntryType(s, type);
return type;
}
-bool cmState::StringToCacheEntryType(const std::string& s,
+bool cmState::StringToCacheEntryType(std::string const& s,
cmStateEnums::CacheEntryType& type)
{
// NOLINTNEXTLINE(readability-qualified-auto)
@@ -121,19 +120,19 @@ bool cmState::IsCacheEntryType(std::string const& key)
[&key](std::string const& i) -> bool { return key == i; });
}
-bool cmState::LoadCache(const std::string& path, bool internal,
+bool cmState::LoadCache(std::string const& path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes)
{
return this->CacheManager->LoadCache(path, internal, excludes, includes);
}
-bool cmState::SaveCache(const std::string& path, cmMessenger* messenger)
+bool cmState::SaveCache(std::string const& path, cmMessenger* messenger)
{
return this->CacheManager->SaveCache(path, messenger);
}
-bool cmState::DeleteCache(const std::string& path)
+bool cmState::DeleteCache(std::string const& path)
{
return this->CacheManager->DeleteCache(path);
}
@@ -193,7 +192,7 @@ void cmState::SetCacheEntryBoolProperty(std::string const& key,
}
std::vector<std::string> cmState::GetCacheEntryPropertyList(
- const std::string& key)
+ std::string const& key)
{
return this->CacheManager->GetCacheEntryPropertyList(key);
}
@@ -210,8 +209,8 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
return this->CacheManager->GetCacheEntryPropertyAsBool(key, propertyName);
}
-void cmState::AddCacheEntry(const std::string& key, cmValue value,
- const std::string& helpString,
+void cmState::AddCacheEntry(std::string const& key, cmValue value,
+ std::string const& helpString,
cmStateEnums::CacheEntryType type)
{
this->CacheManager->AddCacheEntry(key, value, helpString, type);
@@ -232,15 +231,15 @@ std::string const& cmState::GetGlobVerifyStamp() const
return this->GlobVerificationManager->GetVerifyStamp();
}
-bool cmState::SaveVerificationScript(const std::string& path,
+bool cmState::SaveVerificationScript(std::string const& path,
cmMessenger* messenger)
{
return this->GlobVerificationManager->SaveVerificationScript(path,
messenger);
}
-void cmState::AddGlobCacheEntry(const cmGlobCacheEntry& entry,
- const std::string& variable,
+void cmState::AddGlobCacheEntry(cmGlobCacheEntry const& entry,
+ std::string const& variable,
cmListFileBacktrace const& backtrace,
cmMessenger* messenger)
{
@@ -258,9 +257,9 @@ void cmState::RemoveCacheEntry(std::string const& key)
this->CacheManager->RemoveCacheEntry(key);
}
-void cmState::AppendCacheEntryProperty(const std::string& key,
- const std::string& property,
- const std::string& value, bool asString)
+void cmState::AppendCacheEntryProperty(std::string const& key,
+ std::string const& property,
+ std::string const& value, bool asString)
{
this->CacheManager->AppendCacheEntryProperty(key, property, value, asString);
}
@@ -331,11 +330,11 @@ cmStateSnapshot cmState::Reset()
return { this, pos };
}
-void cmState::DefineProperty(const std::string& name,
+void cmState::DefineProperty(std::string const& name,
cmProperty::ScopeType scope,
- const std::string& ShortDescription,
- const std::string& FullDescription, bool chained,
- const std::string& initializeFromVariable)
+ std::string const& ShortDescription,
+ std::string const& FullDescription, bool chained,
+ std::string const& initializeFromVariable)
{
this->PropertyDefinitions.DefineProperty(name, scope, ShortDescription,
FullDescription, chained,
@@ -343,15 +342,15 @@ void cmState::DefineProperty(const std::string& name,
}
cmPropertyDefinition const* cmState::GetPropertyDefinition(
- const std::string& name, cmProperty::ScopeType scope) const
+ std::string const& name, cmProperty::ScopeType scope) const
{
return this->PropertyDefinitions.GetPropertyDefinition(name, scope);
}
-bool cmState::IsPropertyChained(const std::string& name,
+bool cmState::IsPropertyChained(std::string const& name,
cmProperty::ScopeType scope) const
{
- if (const auto* def = this->GetPropertyDefinition(name, scope)) {
+ if (auto const* def = this->GetPropertyDefinition(name, scope)) {
return def->IsChained();
}
return false;
@@ -397,12 +396,6 @@ void cmState::SetIsGeneratorMultiConfig(bool b)
this->IsGeneratorMultiConfig = b;
}
-void cmState::AddBuiltinCommand(std::string const& name,
- std::unique_ptr<cmCommand> command)
-{
- this->AddBuiltinCommand(name, cmLegacyCommandWrapper(std::move(command)));
-}
-
void cmState::AddBuiltinCommand(std::string const& name, Command command)
{
assert(name == cmSystemTools::LowerCase(name));
@@ -429,7 +422,7 @@ void cmState::AddBuiltinCommand(std::string const& name,
{
this->AddBuiltinCommand(
name,
- [command](const std::vector<cmListFileArgument>& args,
+ [command](std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status) -> bool {
return InvokeBuiltinCommand(command, args, status);
});
@@ -451,13 +444,13 @@ void cmState::AddFlowControlCommand(std::string const& name,
void cmState::AddDisallowedCommand(std::string const& name,
BuiltinCommand command,
cmPolicies::PolicyID policy,
- const char* message,
- const char* additionalWarning)
+ char const* message,
+ char const* additionalWarning)
{
this->AddBuiltinCommand(
name,
[command, policy, message,
- additionalWarning](const std::vector<cmListFileArgument>& args,
+ additionalWarning](std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status) -> bool {
cmMakefile& mf = status.GetMakefile();
switch (mf.GetPolicyStatus(policy)) {
@@ -471,8 +464,6 @@ void cmState::AddDisallowedCommand(std::string const& name,
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
mf.IssueMessage(MessageType::FATAL_ERROR, message);
return true;
@@ -481,7 +472,19 @@ void cmState::AddDisallowedCommand(std::string const& name,
});
}
-void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
+void cmState::AddRemovedCommand(std::string const& name,
+ std::string const& message)
+{
+ this->AddBuiltinCommand(name,
+ [message](std::vector<cmListFileArgument> const&,
+ cmExecutionStatus& status) -> bool {
+ status.GetMakefile().IssueMessage(
+ MessageType::FATAL_ERROR, message);
+ return true;
+ });
+}
+
+void cmState::AddUnexpectedCommand(std::string const& name, char const* error)
{
this->AddBuiltinCommand(
name,
@@ -499,7 +502,7 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
}
void cmState::AddUnexpectedFlowControlCommand(std::string const& name,
- const char* error)
+ char const* error)
{
this->FlowControlCommands.insert(name);
this->AddUnexpectedCommand(name, error);
@@ -575,23 +578,23 @@ void cmState::RemoveUserDefinedCommands()
this->ScriptedCommands.clear();
}
-void cmState::SetGlobalProperty(const std::string& prop,
- const std::string& value)
+void cmState::SetGlobalProperty(std::string const& prop,
+ std::string const& value)
{
this->GlobalProperties.SetProperty(prop, value);
}
-void cmState::SetGlobalProperty(const std::string& prop, cmValue value)
+void cmState::SetGlobalProperty(std::string const& prop, cmValue value)
{
this->GlobalProperties.SetProperty(prop, value);
}
-void cmState::AppendGlobalProperty(const std::string& prop,
- const std::string& value, bool asString)
+void cmState::AppendGlobalProperty(std::string const& prop,
+ std::string const& value, bool asString)
{
this->GlobalProperties.AppendProperty(prop, value, asString);
}
-cmValue cmState::GetGlobalProperty(const std::string& prop)
+cmValue cmState::GetGlobalProperty(std::string const& prop)
{
if (prop == "CACHE_VARIABLES") {
std::vector<std::string> cacheKeys = this->GetCacheEntryKeys();
@@ -615,52 +618,52 @@ cmValue cmState::GetGlobalProperty(const std::string& prop)
}
#define STRING_LIST_ELEMENT(F) ";" #F
if (prop == "CMAKE_C_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_C90_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_C90_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_C99_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_C99_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_C11_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_C11_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_CXX_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_CXX98_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_CXX98_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_CXX11_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_CXX11_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_CXX14_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_CXX14_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_CUDA_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_CUDA_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
if (prop == "CMAKE_HIP_KNOWN_FEATURES") {
- static const std::string s_out(
+ static std::string const s_out(
&FOR_EACH_HIP_FEATURE(STRING_LIST_ELEMENT)[1]);
return cmValue(s_out);
}
@@ -669,7 +672,7 @@ cmValue cmState::GetGlobalProperty(const std::string& prop)
return this->GlobalProperties.GetPropertyValue(prop);
}
-bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
+bool cmState::GetGlobalPropertyAsBool(std::string const& prop)
{
return this->GetGlobalProperty(prop).IsOn();
}
@@ -1047,7 +1050,7 @@ cmStateSnapshot cmState::Pop(cmStateSnapshot const& originSnapshot)
return { this, prevPos };
}
-static bool ParseEntryWithoutType(const std::string& entry, std::string& var,
+static bool ParseEntryWithoutType(std::string const& entry, std::string& var,
std::string& value)
{
// input line is: key=value
@@ -1077,7 +1080,7 @@ static bool ParseEntryWithoutType(const std::string& entry, std::string& var,
return flag;
}
-bool cmState::ParseCacheEntry(const std::string& entry, std::string& var,
+bool cmState::ParseCacheEntry(std::string const& entry, std::string& var,
std::string& value,
cmStateEnums::CacheEntryType& type)
{
diff --git a/Source/cmState.h b/Source/cmState.h
index 4dc982f..fc8f7a7 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -27,7 +27,6 @@
#include "cmValue.h"
class cmCacheManager;
-class cmCommand;
class cmGlobVerificationManager;
class cmMakefile;
class cmStateSnapshot;
@@ -65,10 +64,10 @@ public:
cmState(Mode mode, ProjectKind projectKind = ProjectKind::Normal);
~cmState();
- cmState(const cmState&) = delete;
- cmState& operator=(const cmState&) = delete;
+ cmState(cmState const&) = delete;
+ cmState& operator=(cmState const&) = delete;
- static const std::string& GetTargetTypeName(
+ static std::string const& GetTargetTypeName(
cmStateEnums::TargetType targetType);
cmStateSnapshot CreateBaseSnapshot();
@@ -91,20 +90,20 @@ public:
cmStateSnapshot Pop(cmStateSnapshot const& originSnapshot);
static cmStateEnums::CacheEntryType StringToCacheEntryType(
- const std::string&);
- static bool StringToCacheEntryType(const std::string&,
+ std::string const&);
+ static bool StringToCacheEntryType(std::string const&,
cmStateEnums::CacheEntryType& type);
- static const std::string& CacheEntryTypeToString(
+ static std::string const& CacheEntryTypeToString(
cmStateEnums::CacheEntryType);
static bool IsCacheEntryType(std::string const& key);
- bool LoadCache(const std::string& path, bool internal,
+ bool LoadCache(std::string const& path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes);
- bool SaveCache(const std::string& path, cmMessenger* messenger);
+ bool SaveCache(std::string const& path, cmMessenger* messenger);
- bool DeleteCache(const std::string& path);
+ bool DeleteCache(std::string const& path);
bool IsCacheLoaded() const;
@@ -128,34 +127,34 @@ public:
bool GetCacheEntryPropertyAsBool(std::string const& key,
std::string const& propertyName);
void AppendCacheEntryProperty(std::string const& key,
- const std::string& property,
- const std::string& value,
+ std::string const& property,
+ std::string const& value,
bool asString = false);
void RemoveCacheEntryProperty(std::string const& key,
std::string const& propertyName);
//! Break up a line like VAR:type="value" into var, type and value
- static bool ParseCacheEntry(const std::string& entry, std::string& var,
+ static bool ParseCacheEntry(std::string const& entry, std::string& var,
std::string& value,
cmStateEnums::CacheEntryType& type);
cmStateSnapshot Reset();
// Define a property
- void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
- const std::string& ShortDescription,
- const std::string& FullDescription, bool chain = false,
- const std::string& initializeFromVariable = "");
+ void DefineProperty(std::string const& name, cmProperty::ScopeType scope,
+ std::string const& ShortDescription,
+ std::string const& FullDescription, bool chain = false,
+ std::string const& initializeFromVariable = "");
// get property definition
cmPropertyDefinition const* GetPropertyDefinition(
- const std::string& name, cmProperty::ScopeType scope) const;
+ std::string const& name, cmProperty::ScopeType scope) const;
- const cmPropertyDefinitionMap& GetPropertyDefinitions() const
+ cmPropertyDefinitionMap const& GetPropertyDefinitions() const
{
return this->PropertyDefinitions;
}
- bool IsPropertyChained(const std::string& name,
+ bool IsPropertyChained(std::string const& name,
cmProperty::ScopeType scope) const;
void SetLanguageEnabled(std::string const& l);
@@ -177,30 +176,29 @@ public:
// Returns a command from its name, or nullptr
Command GetCommandByExactName(std::string const& name) const;
- void AddBuiltinCommand(std::string const& name,
- std::unique_ptr<cmCommand> command);
void AddBuiltinCommand(std::string const& name, Command command);
void AddBuiltinCommand(std::string const& name, BuiltinCommand command);
void AddFlowControlCommand(std::string const& name, Command command);
void AddFlowControlCommand(std::string const& name, BuiltinCommand command);
void AddDisallowedCommand(std::string const& name, BuiltinCommand command,
- cmPolicies::PolicyID policy, const char* message,
- const char* additionalWarning = nullptr);
- void AddUnexpectedCommand(std::string const& name, const char* error);
+ cmPolicies::PolicyID policy, char const* message,
+ char const* additionalWarning = nullptr);
+ void AddRemovedCommand(std::string const& name, std::string const& message);
+ void AddUnexpectedCommand(std::string const& name, char const* error);
void AddUnexpectedFlowControlCommand(std::string const& name,
- const char* error);
+ char const* error);
bool AddScriptedCommand(std::string const& name, BT<Command> command,
cmMakefile& mf);
void RemoveBuiltinCommand(std::string const& name);
void RemoveUserDefinedCommands();
std::vector<std::string> GetCommandNames() const;
- void SetGlobalProperty(const std::string& prop, const std::string& value);
- void SetGlobalProperty(const std::string& prop, cmValue value);
- void AppendGlobalProperty(const std::string& prop, const std::string& value,
+ void SetGlobalProperty(std::string const& prop, std::string const& value);
+ void SetGlobalProperty(std::string const& prop, cmValue value);
+ void AppendGlobalProperty(std::string const& prop, std::string const& value,
bool asString = false);
- cmValue GetGlobalProperty(const std::string& prop);
- bool GetGlobalPropertyAsBool(const std::string& prop);
+ cmValue GetGlobalProperty(std::string const& prop);
+ bool GetGlobalPropertyAsBool(std::string const& prop);
std::string const& GetSourceDirectory() const;
void SetSourceDirectory(std::string const& sourceDirectory);
@@ -258,16 +256,16 @@ public:
private:
friend class cmake;
- void AddCacheEntry(const std::string& key, cmValue value,
- const std::string& helpString,
+ void AddCacheEntry(std::string const& key, cmValue value,
+ std::string const& helpString,
cmStateEnums::CacheEntryType type);
bool DoWriteGlobVerifyTarget() const;
std::string const& GetGlobVerifyScript() const;
std::string const& GetGlobVerifyStamp() const;
- bool SaveVerificationScript(const std::string& path, cmMessenger* messenger);
- void AddGlobCacheEntry(const cmGlobCacheEntry& entry,
- const std::string& variable,
+ bool SaveVerificationScript(std::string const& path, cmMessenger* messenger);
+ void AddGlobCacheEntry(cmGlobCacheEntry const& entry,
+ std::string const& variable,
cmListFileBacktrace const& bt,
cmMessenger* messenger);
std::vector<cmGlobCacheEntry> GetGlobCacheEntries() const;
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 343bee5..1c69b3b 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmStateDirectory.h"
@@ -21,7 +21,6 @@
#include "cmState.h"
#include "cmStatePrivate.h"
#include "cmStateTypes.h"
-#include "cmSystemTools.h"
#include "cmValue.h"
static std::string const kBINARY_DIR = "BINARY_DIR";
@@ -36,11 +35,9 @@ std::string const& cmStateDirectory::GetCurrentSource() const
void cmStateDirectory::SetCurrentSource(std::string const& dir)
{
- std::string& loc = this->DirectoryState->Location;
- loc = dir;
- cmSystemTools::ConvertToUnixSlashes(loc);
- loc = cmSystemTools::CollapseFullPath(loc);
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
+ this->DirectoryState->Location = dir;
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR",
+ this->DirectoryState->Location);
}
std::string const& cmStateDirectory::GetCurrentBinary() const
@@ -50,16 +47,14 @@ std::string const& cmStateDirectory::GetCurrentBinary() const
void cmStateDirectory::SetCurrentBinary(std::string const& dir)
{
- std::string& loc = this->DirectoryState->OutputLocation;
- loc = dir;
- cmSystemTools::ConvertToUnixSlashes(loc);
- loc = cmSystemTools::CollapseFullPath(loc);
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
+ this->DirectoryState->OutputLocation = dir;
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR",
+ this->DirectoryState->OutputLocation);
}
cmStateDirectory::cmStateDirectory(
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
- const cmStateSnapshot& snapshot)
+ cmStateSnapshot const& snapshot)
: DirectoryState(iter)
, Snapshot_(snapshot)
{
@@ -71,7 +66,7 @@ cmBTStringRange GetPropertyContent(T const& content, U contentEndPosition)
auto end = content.begin() + contentEndPosition;
auto rbegin = cm::make_reverse_iterator(end);
- rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
+ rbegin = std::find(rbegin, content.rend(), cmPropertySentinel);
return cmMakeRange(rbegin.base(), end);
}
@@ -135,7 +130,7 @@ void cmStateDirectory::PrependIncludeDirectoriesEntry(
auto rend = this->DirectoryState->IncludeDirectories.rend();
auto rbegin = cm::make_reverse_iterator(entryEnd);
- rbegin = std::find(rbegin, rend, cmPropertySentinal);
+ rbegin = std::find(rbegin, rend, cmPropertySentinel);
auto entryIt = rbegin.base();
@@ -249,7 +244,7 @@ void cmStateDirectory::PrependLinkDirectoriesEntry(const BT<std::string>& vec)
auto rend = this->DirectoryState->LinkDirectories.rend();
auto rbegin = cm::make_reverse_iterator(entryEnd);
- rbegin = std::find(rbegin, rend, cmPropertySentinal);
+ rbegin = std::find(rbegin, rend, cmPropertySentinel);
auto entryIt = rbegin.base();
@@ -271,7 +266,7 @@ void cmStateDirectory::ClearLinkDirectories()
this->Snapshot_.Position->LinkDirectoriesPosition);
}
-void cmStateDirectory::SetProperty(const std::string& prop, cmValue value,
+void cmStateDirectory::SetProperty(std::string const& prop, cmValue value,
cmListFileBacktrace const& lfbt)
{
if (prop == "INCLUDE_DIRECTORIES") {
@@ -318,8 +313,8 @@ void cmStateDirectory::SetProperty(const std::string& prop, cmValue value,
this->DirectoryState->Properties.SetProperty(prop, value);
}
-void cmStateDirectory::AppendProperty(const std::string& prop,
- const std::string& value, bool asString,
+void cmStateDirectory::AppendProperty(std::string const& prop,
+ std::string const& value, bool asString,
cmListFileBacktrace const& lfbt)
{
if (prop == "INCLUDE_DIRECTORIES") {
@@ -346,14 +341,14 @@ void cmStateDirectory::AppendProperty(const std::string& prop,
this->DirectoryState->Properties.AppendProperty(prop, value, asString);
}
-cmValue cmStateDirectory::GetProperty(const std::string& prop) const
+cmValue cmStateDirectory::GetProperty(std::string const& prop) const
{
- const bool chain =
+ bool const chain =
this->Snapshot_.State->IsPropertyChained(prop, cmProperty::DIRECTORY);
return this->GetProperty(prop, chain);
}
-cmValue cmStateDirectory::GetProperty(const std::string& prop,
+cmValue cmStateDirectory::GetProperty(std::string const& prop,
bool chain) const
{
static std::string output;
@@ -449,7 +444,7 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop,
return retVal;
}
-bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const
+bool cmStateDirectory::GetPropertyAsBool(std::string const& prop) const
{
return this->GetProperty(prop).IsOn();
}
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index 6c4711f..49ab440 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -58,18 +58,18 @@ public:
void SetLinkDirectories(BT<std::string> const& vecs);
void ClearLinkDirectories();
- void SetProperty(const std::string& prop, cmValue value,
+ void SetProperty(std::string const& prop, cmValue value,
cmListFileBacktrace const& lfbt);
- void SetProperty(const std::string& prop, std::nullptr_t,
+ void SetProperty(std::string const& prop, std::nullptr_t,
cmListFileBacktrace const& lfbt)
{
this->SetProperty(prop, cmValue{ nullptr }, lfbt);
}
- void AppendProperty(const std::string& prop, const std::string& value,
+ void AppendProperty(std::string const& prop, std::string const& value,
bool asString, cmListFileBacktrace const& lfbt);
- cmValue GetProperty(const std::string& prop) const;
- cmValue GetProperty(const std::string& prop, bool chain) const;
- bool GetPropertyAsBool(const std::string& prop) const;
+ cmValue GetProperty(std::string const& prop) const;
+ cmValue GetProperty(std::string const& prop, bool chain) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
std::vector<std::string> GetPropertyKeys() const;
void AddNormalTargetName(std::string const& name);
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
index ec14834..65e2111 100644
--- a/Source/cmStatePrivate.h
+++ b/Source/cmStatePrivate.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -21,7 +21,7 @@ struct BuildsystemDirectoryStateType;
struct PolicyStackEntry;
} // namespace cmStateDetail
-static const std::string cmPropertySentinal = std::string();
+static std::string const cmPropertySentinel = std::string();
struct cmStateDetail::SnapshotDataType
{
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 6ee0225..71b7dda 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmStateSnapshot.h"
@@ -46,7 +46,7 @@ cmStateEnums::SnapshotType cmStateSnapshot::GetType() const
return this->Position->SnapshotType;
}
-void cmStateSnapshot::SetListFile(const std::string& listfile)
+void cmStateSnapshot::SetListFile(std::string const& listfile)
{
*this->Position->ExecutionListFile = listfile;
}
@@ -165,13 +165,12 @@ void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id,
cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(cmPolicies::PolicyID id,
bool parent_scope) const
{
- cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id);
-
- if (status == cmPolicies::REQUIRED_ALWAYS ||
- status == cmPolicies::REQUIRED_IF_USED) {
- return status;
+ if (cmPolicies::IsRemoved(id)) {
+ return cmPolicies::NEW;
}
+ cmPolicies::PolicyStatus status = cmPolicies::WARN;
+
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator dir =
this->Position->BuildSystemDirectory;
@@ -201,11 +200,6 @@ cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(cmPolicies::PolicyID id,
return status;
}
-bool cmStateSnapshot::HasDefinedPolicyCMP0011()
-{
- return !this->Position->Policies->IsEmpty();
-}
-
cmValue cmStateSnapshot::GetDefinition(std::string const& name) const
{
assert(this->Position->Vars.IsValid());
@@ -235,7 +229,7 @@ std::vector<std::string> cmStateSnapshot::ClosureKeys() const
this->Position->Root);
}
-bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef)
+bool cmStateSnapshot::RaiseScope(std::string const& var, char const* varDef)
{
if (this->Position->ScopeParent == this->Position->DirectoryParent) {
cmStateSnapshot parentDir = this->GetBuildsystemDirectoryParent();
@@ -272,7 +266,7 @@ void InitializeContentFromParent(T& parentContent, T& thisContent,
auto parentRbegin = cm::make_reverse_iterator(parentEnd);
auto parentRend = parentContent.rend();
- parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
+ parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinel);
auto parentIt = parentRbegin.base();
thisContent = std::vector<BT<std::string>>(parentIt, parentEnd);
@@ -331,6 +325,11 @@ void cmStateSnapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_HOST_LINUX", "1");
#endif
+#if defined(_AIX)
+ this->SetDefinition("AIX", "1");
+ this->SetDefinition("CMAKE_HOST_AIX", "1");
+#endif
+
this->SetDefinition("CMAKE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()));
this->SetDefinition("CMAKE_MINOR_VERSION",
@@ -409,7 +408,7 @@ cmStateDirectory cmStateSnapshot::GetDirectory() const
return { this->Position->BuildSystemDirectory, *this };
}
-void cmStateSnapshot::SetProjectName(const std::string& name)
+void cmStateSnapshot::SetProjectName(std::string const& name)
{
this->Position->BuildSystemDirectory->ProjectName = name;
}
@@ -432,17 +431,17 @@ void cmStateSnapshot::InitializeFromParent_ForSubdirsCommand()
}
bool cmStateSnapshot::StrictWeakOrder::operator()(
- const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) const
+ cmStateSnapshot const& lhs, cmStateSnapshot const& rhs) const
{
return lhs.Position.StrictWeakOrdered(rhs.Position);
}
-bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs)
+bool operator==(cmStateSnapshot const& lhs, cmStateSnapshot const& rhs)
{
return lhs.Position == rhs.Position;
}
-bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs)
+bool operator!=(cmStateSnapshot const& lhs, cmStateSnapshot const& rhs)
{
return lhs.Position != rhs.Position;
}
diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h
index 1796d76..866ec0a 100644
--- a/Source/cmStateSnapshot.h
+++ b/Source/cmStateSnapshot.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
@@ -28,7 +28,7 @@ public:
void SetDefinition(std::string const& name, cm::string_view value);
void RemoveDefinition(std::string const& name);
std::vector<std::string> ClosureKeys() const;
- bool RaiseScope(std::string const& var, const char* varDef);
+ bool RaiseScope(std::string const& var, char const* varDef);
void SetListFile(std::string const& listfile);
@@ -46,7 +46,6 @@ public:
void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id,
bool parent_scope = false) const;
- bool HasDefinedPolicyCMP0011();
void PushPolicy(cmPolicies::PolicyMap const& entry, bool weak);
bool PopPolicy();
bool CanPopPolicyScope();
@@ -62,18 +61,18 @@ public:
struct StrictWeakOrder
{
- bool operator()(const cmStateSnapshot& lhs,
- const cmStateSnapshot& rhs) const;
+ bool operator()(cmStateSnapshot const& lhs,
+ cmStateSnapshot const& rhs) const;
};
void SetDirectoryDefinitions();
void SetDefaultDefinitions();
private:
- friend bool operator==(const cmStateSnapshot& lhs,
- const cmStateSnapshot& rhs);
- friend bool operator!=(const cmStateSnapshot& lhs,
- const cmStateSnapshot& rhs);
+ friend bool operator==(cmStateSnapshot const& lhs,
+ cmStateSnapshot const& rhs);
+ friend bool operator!=(cmStateSnapshot const& lhs,
+ cmStateSnapshot const& rhs);
friend class cmState;
friend class cmStateDirectory;
friend struct StrictWeakOrder;
@@ -84,5 +83,5 @@ private:
cmStateDetail::PositionType Position;
};
-bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs);
-bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs);
+bool operator==(cmStateSnapshot const& lhs, cmStateSnapshot const& rhs);
+bool operator!=(cmStateSnapshot const& lhs, cmStateSnapshot const& rhs);
diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h
index 24b809b..b3fbc13 100644
--- a/Source/cmStateTypes.h
+++ b/Source/cmStateTypes.h
@@ -1,10 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cmext/enum_set>
+
#include "cmLinkedTree.h"
namespace cmStateDetail {
@@ -43,6 +45,22 @@ enum TargetType
UNKNOWN_LIBRARY
};
+// Target search domains for FindTarget() style commands.
+enum class TargetDomain : unsigned
+{
+ // Native, unaliased CMake targets, generated via add_library or
+ // add_executable
+ NATIVE,
+ // Alias index, must include another domain
+ ALIAS,
+ // Foreign domain targets, generated directly inside CMake
+ FOREIGN
+};
+using TargetDomainSet = cm::enum_set<TargetDomain>;
+static TargetDomainSet const AllTargetDomains{ TargetDomain::NATIVE,
+ TargetDomain::ALIAS,
+ TargetDomain::FOREIGN };
+
enum CacheEntryType
{
BOOL = 0,
diff --git a/Source/cmString.cxx b/Source/cmString.cxx
index d7c0ec3..2640938 100644
--- a/Source/cmString.cxx
+++ b/Source/cmString.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
// NOLINTNEXTLINE(bugprone-reserved-identifier)
#define _SCL_SECURE_NO_WARNINGS
@@ -64,9 +64,9 @@ std::string const& String::str()
return *this->string_;
}
-const char* String::c_str()
+char const* String::c_str()
{
- const char* c = this->data();
+ char const* c = this->data();
if (!c) {
return c;
}
@@ -137,7 +137,7 @@ std::string& operator+=(std::string& self, String const& s)
return self += s.view();
}
-String IntoString<char*>::into_string(const char* s)
+String IntoString<char*>::into_string(char const* s)
{
if (!s) {
return String();
diff --git a/Source/cmString.hxx b/Source/cmString.hxx
index 5e1b524..3c2b49b 100644
--- a/Source/cmString.hxx
+++ b/Source/cmString.hxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,7 +60,7 @@ struct IntoString<T const[N]> : IntoString<T[N]>
template <>
struct IntoString<char*> : std::true_type
{
- static String into_string(const char* s);
+ static String into_string(char const* s);
};
template <>
@@ -124,7 +124,7 @@ struct AsStringView<T const[N]> : AsStringView<T[N]>
template <>
struct AsStringView<char*> : std::true_type
{
- static string_view view(const char* s) { return s; }
+ static string_view view(char const* s) { return s; }
};
template <std::string::size_type N>
@@ -142,7 +142,7 @@ struct AsStringView<std::string> : std::true_type
template <>
struct AsStringView<char> : std::true_type
{
- static string_view view(const char& s) { return string_view(&s, 1); }
+ static string_view view(char const& s) { return string_view(&s, 1); }
};
template <>
@@ -250,7 +250,7 @@ public:
}
/** Construct by copying the specified buffer. */
- String(const char* d, size_type s)
+ String(char const* d, size_type s)
: String(std::string(d, s))
{
}
@@ -349,7 +349,7 @@ public:
bool empty() const noexcept { return this->view_.empty(); }
/** Return a pointer to the start of the string. */
- const char* data() const noexcept { return this->view_.data(); }
+ char const* data() const noexcept { return this->view_.data(); }
/** Return the length of the string in bytes. */
size_type size() const noexcept { return this->view_.size(); }
@@ -389,7 +389,7 @@ public:
containing the same value as this instance. The pointer
is valid until this instance is mutated, destroyed,
or str() is called. */
- const char* c_str();
+ char const* c_str();
const_iterator begin() const noexcept { return this->view_.begin(); }
const_iterator end() const noexcept { return this->view_.end(); }
@@ -546,12 +546,12 @@ public:
return this->view_.compare(pos1, count1, v, pos2, count2);
}
- int compare(size_type pos1, size_type count1, const char* s) const
+ int compare(size_type pos1, size_type count1, char const* s) const
{
return this->view_.compare(pos1, count1, s);
}
- int compare(size_type pos1, size_type count1, const char* s,
+ int compare(size_type pos1, size_type count1, char const* s,
size_type count2) const
{
return this->view_.compare(pos1, count1, s, count2);
@@ -565,7 +565,7 @@ public:
return this->view_.find(v, pos);
}
- size_type find(const char* s, size_type pos, size_type count) const
+ size_type find(char const* s, size_type pos, size_type count) const
{
return this->view_.find(s, pos, count);
}
@@ -578,7 +578,7 @@ public:
return this->view_.rfind(v, pos);
}
- size_type rfind(const char* s, size_type pos, size_type count) const
+ size_type rfind(char const* s, size_type pos, size_type count) const
{
return this->view_.rfind(s, pos, count);
}
@@ -591,7 +591,7 @@ public:
return this->view_.find_first_of(v, pos);
}
- size_type find_first_of(const char* s, size_type pos, size_type count) const
+ size_type find_first_of(char const* s, size_type pos, size_type count) const
{
return this->view_.find_first_of(s, pos, count);
}
@@ -604,7 +604,7 @@ public:
return this->view_.find_first_not_of(v, pos);
}
- size_type find_first_not_of(const char* s, size_type pos,
+ size_type find_first_not_of(char const* s, size_type pos,
size_type count) const
{
return this->view_.find_first_not_of(s, pos, count);
@@ -618,7 +618,7 @@ public:
return this->view_.find_last_of(v, pos);
}
- size_type find_last_of(const char* s, size_type pos, size_type count) const
+ size_type find_last_of(char const* s, size_type pos, size_type count) const
{
return this->view_.find_last_of(s, pos, count);
}
@@ -631,7 +631,7 @@ public:
return this->view_.find_last_not_of(v, pos);
}
- size_type find_last_not_of(const char* s, size_type pos,
+ size_type find_last_not_of(char const* s, size_type pos,
size_type count) const
{
return this->view_.find_last_not_of(s, pos, count);
@@ -708,104 +708,104 @@ struct IsComparable<char> : std::true_type
};
/** comparison operators */
-inline bool operator==(const String& l, const String& r)
+inline bool operator==(String const& l, String const& r)
{
return l.view() == r.view();
}
template <typename L>
typename std::enable_if<IsComparable<L>::value, bool>::type operator==(
- L&& l, const String& r)
+ L&& l, String const& r)
{
return AsStringView<L>::view(std::forward<L>(l)) == r.view();
}
template <typename R>
typename std::enable_if<IsComparable<R>::value, bool>::type operator==(
- const String& l, R&& r)
+ String const& l, R&& r)
{
return l.view() == AsStringView<R>::view(std::forward<R>(r));
}
-inline bool operator!=(const String& l, const String& r)
+inline bool operator!=(String const& l, String const& r)
{
return l.view() != r.view();
}
template <typename L>
typename std::enable_if<IsComparable<L>::value, bool>::type operator!=(
- L&& l, const String& r)
+ L&& l, String const& r)
{
return AsStringView<L>::view(std::forward<L>(l)) != r.view();
}
template <typename R>
typename std::enable_if<IsComparable<R>::value, bool>::type operator!=(
- const String& l, R&& r)
+ String const& l, R&& r)
{
return l.view() != AsStringView<R>::view(std::forward<R>(r));
}
-inline bool operator<(const String& l, const String& r)
+inline bool operator<(String const& l, String const& r)
{
return l.view() < r.view();
}
template <typename L>
typename std::enable_if<IsComparable<L>::value, bool>::type operator<(
- L&& l, const String& r)
+ L&& l, String const& r)
{
return AsStringView<L>::view(std::forward<L>(l)) < r.view();
}
template <typename R>
typename std::enable_if<IsComparable<R>::value, bool>::type operator<(
- const String& l, R&& r)
+ String const& l, R&& r)
{
return l.view() < AsStringView<R>::view(std::forward<R>(r));
}
-inline bool operator<=(const String& l, const String& r)
+inline bool operator<=(String const& l, String const& r)
{
return l.view() <= r.view();
}
template <typename L>
typename std::enable_if<IsComparable<L>::value, bool>::type operator<=(
- L&& l, const String& r)
+ L&& l, String const& r)
{
return AsStringView<L>::view(std::forward<L>(l)) <= r.view();
}
template <typename R>
typename std::enable_if<IsComparable<R>::value, bool>::type operator<=(
- const String& l, R&& r)
+ String const& l, R&& r)
{
return l.view() <= AsStringView<R>::view(std::forward<R>(r));
}
-inline bool operator>(const String& l, const String& r)
+inline bool operator>(String const& l, String const& r)
{
return l.view() > r.view();
}
template <typename L>
typename std::enable_if<IsComparable<L>::value, bool>::type operator>(
- L&& l, const String& r)
+ L&& l, String const& r)
{
return AsStringView<L>::view(std::forward<L>(l)) > r.view();
}
template <typename R>
typename std::enable_if<IsComparable<R>::value, bool>::type operator>(
- const String& l, R&& r)
+ String const& l, R&& r)
{
return l.view() > AsStringView<R>::view(std::forward<R>(r));
}
-inline bool operator>=(const String& l, const String& r)
+inline bool operator>=(String const& l, String const& r)
{
return l.view() >= r.view();
}
template <typename L>
typename std::enable_if<IsComparable<L>::value, bool>::type operator>=(
- L&& l, const String& r)
+ L&& l, String const& r)
{
return AsStringView<L>::view(std::forward<L>(l)) >= r.view();
}
template <typename R>
typename std::enable_if<IsComparable<R>::value, bool>::type operator>=(
- const String& l, R&& r)
+ String const& l, R&& r)
{
return l.view() >= AsStringView<R>::view(std::forward<R>(r));
}
@@ -835,7 +835,7 @@ struct StringOpPlus
template <typename T>
struct StringAdd
{
- static const bool value = AsStringView<T>::value;
+ static bool const value = AsStringView<T>::value;
using temp_type = string_view;
template <typename S>
static temp_type temp(S&& s)
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index 332bd8d..a64bfc8 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmStringAlgorithms.h"
#include <algorithm>
@@ -8,6 +8,16 @@
#include <cstdio>
#include <cstdlib>
+bool cmStrCaseEq(cm::string_view s1, cm::string_view s2)
+{
+ if (s1.size() != s2.size()) {
+ return false;
+ }
+
+ return std::equal(s1.begin(), s1.end(), s2.begin(),
+ [](char a, char b) { return tolower(a) == tolower(b); });
+}
+
std::string cmTrimWhitespace(cm::string_view str)
{
// XXX(clang-tidy): This declaration and the next cannot be `const auto*`
@@ -46,7 +56,7 @@ std::string cmEscapeQuotes(cm::string_view str)
{
std::string result;
result.reserve(str.size());
- for (const char ch : str) {
+ for (char const ch : str) {
if (ch == '"') {
result += '\\';
}
@@ -55,34 +65,10 @@ std::string cmEscapeQuotes(cm::string_view str)
return result;
}
-std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep)
-{
- std::vector<std::string> tokens;
- cm::string_view::size_type tokend = 0;
-
- do {
- cm::string_view::size_type tokstart = str.find_first_not_of(sep, tokend);
- if (tokstart == cm::string_view::npos) {
- break; // no more tokens
- }
- tokend = str.find_first_of(sep, tokstart);
- if (tokend == cm::string_view::npos) {
- tokens.emplace_back(str.substr(tokstart));
- } else {
- tokens.emplace_back(str.substr(tokstart, tokend - tokstart));
- }
- } while (tokend != cm::string_view::npos);
-
- if (tokens.empty()) {
- tokens.emplace_back();
- }
- return tokens;
-}
-
namespace {
template <std::size_t N, typename T>
inline void MakeDigits(cm::string_view& view, char (&digits)[N],
- const char* pattern, T value)
+ char const* pattern, T value)
{
int res = std::snprintf(digits, N, pattern, value);
if (res > 0 && res < static_cast<int>(N)) {
@@ -174,7 +160,7 @@ std::string cmCatViews(
return result;
}
-bool cmStrToLong(const char* str, long* value)
+bool cmStrToLong(char const* str, long* value)
{
errno = 0;
char* endp;
@@ -187,7 +173,7 @@ bool cmStrToLong(std::string const& str, long* value)
return cmStrToLong(str.c_str(), value);
}
-bool cmStrToULong(const char* str, unsigned long* value)
+bool cmStrToULong(char const* str, unsigned long* value)
{
errno = 0;
char* endp;
@@ -206,7 +192,7 @@ bool cmStrToULong(std::string const& str, unsigned long* value)
return cmStrToULong(str.c_str(), value);
}
-bool cmStrToLongLong(const char* str, long long* value)
+bool cmStrToLongLong(char const* str, long long* value)
{
errno = 0;
char* endp;
@@ -219,7 +205,7 @@ bool cmStrToLongLong(std::string const& str, long long* value)
return cmStrToLongLong(str.c_str(), value);
}
-bool cmStrToULongLong(const char* str, unsigned long long* value)
+bool cmStrToULongLong(char const* str, unsigned long long* value)
{
errno = 0;
char* endp;
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 2bd615a..3bf6022 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,7 +24,7 @@ using cmStringRange = cmRange<std::vector<std::string>::const_iterator>;
/** Returns length of a literal string. */
template <size_t N>
-constexpr size_t cmStrLen(const char (&/*str*/)[N])
+constexpr size_t cmStrLen(char const (&)[N])
{
return N - 1;
}
@@ -43,6 +43,13 @@ private:
std::string const Test_;
};
+/**
+ * Test if two strings are identical, ignoring case.
+ *
+ * Note that this is not guaranteed to work correctly on non-ASCII strings.
+ */
+bool cmStrCaseEq(cm::string_view a, cm::string_view b);
+
/** Returns true if the character @a ch is a whitespace character. **/
inline bool cmIsSpace(char ch)
{
@@ -91,12 +98,12 @@ std::string cmJoinStrings(Range const& rng, cm::string_view separator,
}
std::string result;
- result.reserve(
- std::accumulate(std::begin(rng), std::end(rng),
- initial.size() + (rng.size() - 1) * separator.size(),
- [](std::size_t sum, const std::string& item) {
- return sum + item.size();
- }));
+ result.reserve(std::accumulate(
+ std::begin(rng), std::end(rng),
+ initial.size() + (rng.size() - 1) * separator.size(),
+ [](std::size_t sum, typename Range::value_type const& item) {
+ return sum + item.size();
+ }));
result.append(std::begin(initial), std::end(initial));
auto begin = std::begin(rng);
@@ -122,8 +129,81 @@ std::string cmJoin(std::vector<std::string> const& rng,
std::string cmJoin(cmStringRange const& rng, cm::string_view separator,
cm::string_view initial = {});
-/** Extract tokens that are separated by any of the characters in @a sep. */
-std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep);
+enum class cmTokenizerMode
+{
+ /// A backward-compatible behavior when in the case of no
+ /// tokens have found in an input text it'll return one empty
+ /// token in the result container (vector).
+ Legacy,
+ /// The new behavior is to return an empty vector.
+ New
+};
+
+/**
+ * \brief A generic version of a tokenizer.
+ *
+ * Extract tokens from the input string separated by any
+ * of the characters in `sep` and assign them to the
+ * given output iterator.
+ *
+ * The `mode` parameter defines the behavior in the case when
+ * no tokens have found in the input text.
+ *
+ */
+template <typename StringT, typename OutIt, typename Sep = char>
+void cmTokenize(OutIt outIt, cm::string_view str, Sep sep,
+ cmTokenizerMode mode)
+{
+ auto hasTokens = false;
+ // clang-format off
+ for (auto start = str.find_first_not_of(sep)
+ , end = str.find_first_of(sep, start)
+ ; start != cm::string_view::npos
+ ; start = str.find_first_not_of(sep, end)
+ , end = str.find_first_of(sep, start)
+ , hasTokens = true
+ ) {
+ *outIt++ = StringT{ str.substr(start, end - start) };
+ }
+ // clang-format on
+ if (!hasTokens && mode == cmTokenizerMode::Legacy) {
+ *outIt = {};
+ }
+}
+
+/**
+ * \brief Extract tokens that are separated by any of the
+ * characters in `sep`.
+ *
+ * Backward compatible signature.
+ *
+ * \return A vector of strings.
+ */
+template <typename Sep = char>
+std::vector<std::string> cmTokenize(
+ cm::string_view str, Sep sep, cmTokenizerMode mode = cmTokenizerMode::Legacy)
+{
+ using StringType = std::string;
+ std::vector<StringType> tokens;
+ cmTokenize<StringType>(std::back_inserter(tokens), str, sep, mode);
+ return tokens;
+}
+
+/**
+ * \brief Extract tokens that are separated by any of the
+ * characters in `sep`.
+ *
+ * \return A vector of string views.
+ */
+template <typename Sep = char>
+std::vector<cm::string_view> cmTokenizedView(
+ cm::string_view str, Sep sep, cmTokenizerMode mode = cmTokenizerMode::Legacy)
+{
+ using StringType = cm::string_view;
+ std::vector<StringType> tokens;
+ cmTokenize<StringType>(std::back_inserter(tokens), str, sep, mode);
+ return tokens;
+}
/** Concatenate string pieces into a single string. */
std::string cmCatViews(
@@ -145,7 +225,7 @@ public:
: RValueString_(&str)
{
}
- cmAlphaNum(const char* str)
+ cmAlphaNum(char const* str)
: View_(str ? cm::string_view(str) : cm::string_view())
{
}
@@ -188,7 +268,7 @@ template <typename A, typename B, typename... AV>
inline std::string cmStrCat(A&& a, B&& b, AV&&... args)
{
static auto const makePair =
- [](const cmAlphaNum& arg) -> std::pair<cm::string_view, std::string*> {
+ [](cmAlphaNum const& arg) -> std::pair<cm::string_view, std::string*> {
return { arg.View(), arg.RValueString() };
};
@@ -247,7 +327,7 @@ inline bool cmHasPrefix(cm::string_view str, cmValue prefix)
/** Returns true if string @a str starts with string @a prefix. */
template <size_t N>
-inline bool cmHasLiteralPrefix(cm::string_view str, const char (&prefix)[N])
+inline bool cmHasLiteralPrefix(cm::string_view str, char const (&prefix)[N])
{
return cmHasPrefix(str, cm::string_view(prefix, N - 1));
}
@@ -278,7 +358,7 @@ inline bool cmHasSuffix(cm::string_view str, cmValue suffix)
/** Returns true if string @a str ends with string @a suffix. */
template <size_t N>
-inline bool cmHasLiteralSuffix(cm::string_view str, const char (&suffix)[N])
+inline bool cmHasLiteralSuffix(cm::string_view str, char const (&suffix)[N])
{
return cmHasSuffix(str, cm::string_view(suffix, N - 1));
}
@@ -300,20 +380,20 @@ inline void cmStripSuffixIfExists(std::string& str, cm::string_view suffix)
}
/** Converts a string to long. Expects that the whole string is an integer. */
-bool cmStrToLong(const char* str, long* value);
+bool cmStrToLong(char const* str, long* value);
bool cmStrToLong(std::string const& str, long* value);
/** Converts a string to unsigned long. Expects that the whole string is an
* integer */
-bool cmStrToULong(const char* str, unsigned long* value);
+bool cmStrToULong(char const* str, unsigned long* value);
bool cmStrToULong(std::string const& str, unsigned long* value);
/** Converts a string to long long. Expects that the whole string
* is an integer */
-bool cmStrToLongLong(const char* str, long long* value);
+bool cmStrToLongLong(char const* str, long long* value);
bool cmStrToLongLong(std::string const& str, long long* value);
/** Converts a string to unsigned long long. Expects that the whole string
* is an integer */
-bool cmStrToULongLong(const char* str, unsigned long long* value);
+bool cmStrToULongLong(char const* str, unsigned long long* value);
bool cmStrToULongLong(std::string const& str, unsigned long long* value);
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index ab87f34..2fad917 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
// NOLINTNEXTLINE(bugprone-reserved-identifier)
#define _SCL_SECURE_NO_WARNINGS
@@ -290,7 +290,7 @@ bool RegexMatchAll(std::vector<std::string> const& args,
// Scan through the input for all matches.
std::string output;
- const char* p = input.c_str();
+ char const* p = input.c_str();
while (re.find(p)) {
status.GetMakefile().ClearMatches();
status.GetMakefile().StoreMatches(re);
@@ -341,7 +341,7 @@ bool RegexReplace(std::vector<std::string> const& args,
}
// Concatenate all the last arguments together.
- const std::string input =
+ std::string const input =
cmJoin(cmMakeRange(args).advance(5), std::string());
std::string output;
@@ -378,9 +378,9 @@ bool HandleFindCommand(std::vector<std::string> const& args,
}
// local parameter names.
- const std::string& sstring = args[1];
- const std::string& schar = args[2];
- const std::string& outvar = args[3];
+ std::string const& sstring = args[1];
+ std::string const& schar = args[2];
+ std::string const& outvar = args[3];
// ensure that the user cannot accidentally specify REVERSE as a variable
if (outvar == "REVERSE") {
@@ -426,9 +426,9 @@ bool HandleCompareCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& left = args[2];
- const std::string& right = args[3];
- const std::string& outvar = args[4];
+ std::string const& left = args[2];
+ std::string const& right = args[3];
+ std::string const& outvar = args[4];
bool result;
if (mode == "LESS") {
result = (left < right);
@@ -464,9 +464,9 @@ bool HandleReplaceCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& matchExpression = args[1];
- const std::string& replaceExpression = args[2];
- const std::string& variableName = args[3];
+ std::string const& matchExpression = args[1];
+ std::string const& replaceExpression = args[2];
+ std::string const& variableName = args[3];
std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
@@ -485,10 +485,10 @@ bool HandleSubstringCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& stringValue = args[1];
+ std::string const& stringValue = args[1];
int begin = atoi(args[2].c_str());
int end = atoi(args[3].c_str());
- const std::string& variableName = args[4];
+ std::string const& variableName = args[4];
size_t stringLength = stringValue.size();
int intStringLength = static_cast<int>(stringLength);
@@ -515,8 +515,8 @@ bool HandleLengthCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& stringValue = args[1];
- const std::string& variableName = args[2];
+ std::string const& stringValue = args[1];
+ std::string const& variableName = args[2];
size_t length = stringValue.size();
char buffer[1024];
@@ -563,7 +563,7 @@ bool HandlePrependCommand(std::vector<std::string> const& args,
return true;
}
- const std::string& variable = args[1];
+ std::string const& variable = args[1];
std::string value = cmJoin(cmMakeRange(args).advance(2), std::string());
cmValue oldValue = status.GetMakefile().GetDefinition(variable);
@@ -597,7 +597,7 @@ bool HandleJoinCommand(std::vector<std::string> const& args,
}
bool joinImpl(std::vector<std::string> const& args, std::string const& glue,
- const size_t varIdx, cmMakefile& makefile)
+ size_t const varIdx, cmMakefile& makefile)
{
std::string const& variableName = args[varIdx];
// NOTE Items to concat/join placed right after the variable for
@@ -616,8 +616,8 @@ bool HandleMakeCIdentifierCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& input = args[1];
- const std::string& variableName = args[2];
+ std::string const& input = args[1];
+ std::string const& variableName = args[2];
status.GetMakefile().AddDefinition(variableName,
cmSystemTools::MakeCidentifier(input));
@@ -632,12 +632,12 @@ bool HandleGenexStripCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& input = args[1];
+ std::string const& input = args[1];
std::string result = cmGeneratorExpression::Preprocess(
input, cmGeneratorExpression::StripAllGeneratorExpressions);
- const std::string& variableName = args[2];
+ std::string const& variableName = args[2];
status.GetMakefile().AddDefinition(variableName, result);
return true;
@@ -651,12 +651,12 @@ bool HandleStripCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& stringValue = args[1];
- const std::string& variableName = args[2];
+ std::string const& stringValue = args[1];
+ std::string const& variableName = args[2];
size_t inStringLength = stringValue.size();
size_t startPos = inStringLength + 1;
size_t endPos = 0;
- const char* ptr = stringValue.c_str();
+ char const* ptr = stringValue.c_str();
size_t cc;
for (cc = 0; cc < inStringLength; ++cc) {
if (!cmIsSpace(*ptr)) {
@@ -712,9 +712,9 @@ bool HandleRepeatCommand(std::vector<std::string> const& args,
return true;
}
- const auto& stringValue = args[ArgPos::VALUE];
- const auto& variableName = args[ArgPos::OUTPUT_VARIABLE];
- const auto inStringLength = stringValue.size();
+ auto const& stringValue = args[ArgPos::VALUE];
+ auto const& variableName = args[ArgPos::OUTPUT_VARIABLE];
+ auto const inStringLength = stringValue.size();
std::string result;
switch (inStringLength) {
@@ -751,7 +751,7 @@ bool HandleRandomCommand(std::vector<std::string> const& args,
bool force_seed = false;
unsigned int seed = 0;
int length = 5;
- const char cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm"
+ char const cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm"
"QWERTYUIOPASDFGHJKLZXCVBNM"
"0123456789";
std::string alphabet;
@@ -787,7 +787,7 @@ bool HandleRandomCommand(std::vector<std::string> const& args,
status.SetError("sub-command RANDOM invoked with bad length.");
return false;
}
- const std::string& variableName = args.back();
+ std::string const& variableName = args.back();
std::vector<char> result;
@@ -796,7 +796,7 @@ bool HandleRandomCommand(std::vector<std::string> const& args,
srand(force_seed ? seed : cmSystemTools::RandomSeed());
}
- const char* alphaPtr = alphabet.c_str();
+ char const* alphaPtr = alphabet.c_str();
for (int cc = 0; cc < length; cc++) {
int idx = static_cast<int>(sizeofAlphabet * rand() / (RAND_MAX + 1.0));
result.push_back(*(alphaPtr + idx));
@@ -821,7 +821,7 @@ bool HandleTimestampCommand(std::vector<std::string> const& args,
unsigned int argsIndex = 1;
- const std::string& outputVariable = args[argsIndex++];
+ std::string const& outputVariable = args[argsIndex++];
std::string formatString;
if (args.size() > argsIndex && args[argsIndex] != "UTC") {
@@ -858,7 +858,7 @@ bool HandleUuidCommand(std::vector<std::string> const& args,
return false;
}
- const std::string& outputVariable = args[argsIndex++];
+ std::string const& outputVariable = args[argsIndex++];
std::string uuidNamespaceString;
std::string uuidName;
@@ -941,14 +941,14 @@ struct Args : cmRange<typename std::vector<std::string>::const_iterator>
{
using cmRange<typename std::vector<std::string>::const_iterator>::cmRange;
- auto PopFront(cm::string_view error) -> const std::string&;
- auto PopBack(cm::string_view error) -> const std::string&;
+ auto PopFront(cm::string_view error) -> std::string const&;
+ auto PopBack(cm::string_view error) -> std::string const&;
};
class json_error : public std::runtime_error
{
public:
- json_error(const std::string& message,
+ json_error(std::string const& message,
cm::optional<Args> errorPath = cm::nullopt)
: std::runtime_error(message)
, ErrorPath{
@@ -959,22 +959,22 @@ public:
cm::optional<Args> ErrorPath;
};
-const std::string& Args::PopFront(cm::string_view error)
+std::string const& Args::PopFront(cm::string_view error)
{
if (this->empty()) {
throw json_error(std::string(error));
}
- const std::string& res = *this->begin();
+ std::string const& res = *this->begin();
this->advance(1);
return res;
}
-const std::string& Args::PopBack(cm::string_view error)
+std::string const& Args::PopBack(cm::string_view error)
{
if (this->empty()) {
throw json_error(std::string(error));
}
- const std::string& res = *(this->end() - 1);
+ std::string const& res = *(this->end() - 1);
this->retreat(1);
return res;
}
@@ -1001,7 +1001,7 @@ cm::string_view JsonTypeToString(Json::ValueType type)
}
int ParseIndex(
- const std::string& str, cm::optional<Args> const& progress = cm::nullopt,
+ std::string const& str, cm::optional<Args> const& progress = cm::nullopt,
Json::ArrayIndex max = std::numeric_limits<Json::ArrayIndex>::max())
{
unsigned long lindex;
@@ -1024,7 +1024,7 @@ Json::Value& ResolvePath(Json::Value& json, Args path)
Json::Value* search = &json;
for (auto curr = path.begin(); curr != path.end(); ++curr) {
- const std::string& field = *curr;
+ std::string const& field = *curr;
Args progress{ path.begin(), curr + 1 };
if (search->isArray()) {
@@ -1033,13 +1033,13 @@ Json::Value& ResolvePath(Json::Value& json, Args path)
} else if (search->isObject()) {
if (!search->isMember(field)) {
- const auto progressStr = cmJoin(progress, " "_s);
+ auto const progressStr = cmJoin(progress, " "_s);
throw json_error(cmStrCat("member '"_s, progressStr, "' not found"_s),
progress);
}
search = &(*search)[field];
} else {
- const auto progressStr = cmJoin(progress, " "_s);
+ auto const progressStr = cmJoin(progress, " "_s);
throw json_error(
cmStrCat("invalid path '"_s, progressStr,
"', need element of OBJECT or ARRAY type to lookup '"_s,
@@ -1050,7 +1050,7 @@ Json::Value& ResolvePath(Json::Value& json, Args path)
return *search;
}
-Json::Value ReadJson(const std::string& jsonstr)
+Json::Value ReadJson(std::string const& jsonstr)
{
Json::CharReaderBuilder builder;
builder["collectComments"] = false;
@@ -1063,7 +1063,7 @@ Json::Value ReadJson(const std::string& jsonstr)
}
return json;
}
-std::string WriteJson(const Json::Value& value)
+std::string WriteJson(Json::Value const& value)
{
Json::StreamWriterBuilder writer;
writer["indentation"] = " ";
@@ -1081,8 +1081,8 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
auto& makefile = status.GetMakefile();
Args args{ arguments.begin() + 1, arguments.end() };
- const std::string* errorVariable = nullptr;
- const std::string* outputVariable = nullptr;
+ std::string const* errorVariable = nullptr;
+ std::string const* outputVariable = nullptr;
bool success = true;
try {
@@ -1094,7 +1094,7 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
makefile.AddDefinition(*errorVariable, "NOTFOUND"_s);
}
- const auto& mode = args.PopFront("missing mode argument"_s);
+ auto const& mode = args.PopFront("missing mode argument"_s);
if (mode != "GET"_s && mode != "TYPE"_s && mode != "MEMBER"_s &&
mode != "LENGTH"_s && mode != "REMOVE"_s && mode != "SET"_s &&
mode != "EQUAL"_s) {
@@ -1104,11 +1104,11 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
" EQUAL"_s));
}
- const auto& jsonstr = args.PopFront("missing json string argument"_s);
+ auto const& jsonstr = args.PopFront("missing json string argument"_s);
Json::Value json = ReadJson(jsonstr);
if (mode == "GET"_s) {
- const auto& value = ResolvePath(json, args);
+ auto const& value = ResolvePath(json, args);
if (value.isObject() || value.isArray()) {
makefile.AddDefinition(*outputVariable, WriteJson(value));
} else if (value.isBool()) {
@@ -1118,12 +1118,12 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
}
} else if (mode == "TYPE"_s) {
- const auto& value = ResolvePath(json, args);
+ auto const& value = ResolvePath(json, args);
makefile.AddDefinition(*outputVariable, JsonTypeToString(value.type()));
} else if (mode == "MEMBER"_s) {
- const auto& indexStr = args.PopBack("missing member index"_s);
- const auto& value = ResolvePath(json, args);
+ auto const& indexStr = args.PopBack("missing member index"_s);
+ auto const& value = ResolvePath(json, args);
if (!value.isObject()) {
throw json_error(
cmStrCat("MEMBER needs to be called with an element of "
@@ -1131,13 +1131,13 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
JsonTypeToString(value.type())),
args);
}
- const auto index = ParseIndex(
+ auto const index = ParseIndex(
indexStr, Args{ args.begin(), args.end() + 1 }, value.size());
- const auto memIt = std::next(value.begin(), index);
+ auto const memIt = std::next(value.begin(), index);
makefile.AddDefinition(*outputVariable, memIt.name());
} else if (mode == "LENGTH"_s) {
- const auto& value = ResolvePath(json, args);
+ auto const& value = ResolvePath(json, args);
if (!value.isArray() && !value.isObject()) {
throw json_error(cmStrCat("LENGTH needs to be called with an "
"element of type ARRAY or OBJECT, got "_s,
@@ -1149,12 +1149,12 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
makefile.AddDefinition(*outputVariable, sizeStr.View());
} else if (mode == "REMOVE"_s) {
- const auto& toRemove =
+ auto const& toRemove =
args.PopBack("missing member or index to remove"_s);
auto& value = ResolvePath(json, args);
if (value.isArray()) {
- const auto index = ParseIndex(
+ auto const index = ParseIndex(
toRemove, Args{ args.begin(), args.end() + 1 }, value.size());
Json::Value removed;
value.removeIndex(index, &removed);
@@ -1172,15 +1172,15 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
makefile.AddDefinition(*outputVariable, WriteJson(json));
} else if (mode == "SET"_s) {
- const auto& newValueStr = args.PopBack("missing new value remove"_s);
- const auto& toAdd = args.PopBack("missing member name to add"_s);
+ auto const& newValueStr = args.PopBack("missing new value remove"_s);
+ auto const& toAdd = args.PopBack("missing member name to add"_s);
auto& value = ResolvePath(json, args);
Json::Value newValue = ReadJson(newValueStr);
if (value.isObject()) {
value[toAdd] = newValue;
} else if (value.isArray()) {
- const auto index =
+ auto const index =
ParseIndex(toAdd, Args{ args.begin(), args.end() + 1 });
if (value.isValidIndex(index)) {
value[static_cast<int>(index)] = newValue;
@@ -1196,15 +1196,15 @@ bool HandleJSONCommand(std::vector<std::string> const& arguments,
makefile.AddDefinition(*outputVariable, WriteJson(json));
} else if (mode == "EQUAL"_s) {
- const auto& jsonstr2 =
+ auto const& jsonstr2 =
args.PopFront("missing second json string argument"_s);
Json::Value json2 = ReadJson(jsonstr2);
makefile.AddDefinitionBool(*outputVariable, json == json2);
}
- } catch (const json_error& e) {
+ } catch (json_error const& e) {
if (outputVariable && e.ErrorPath) {
- const auto errorPath = cmJoin(*e.ErrorPath, "-");
+ auto const errorPath = cmJoin(*e.ErrorPath, "-");
makefile.AddDefinition(*outputVariable,
cmStrCat(errorPath, "-NOTFOUND"_s));
} else if (outputVariable) {
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 5320ea5..a6c7ad6 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx
index 768effd..c3e44df 100644
--- a/Source/cmStringReplaceHelper.cxx
+++ b/Source/cmStringReplaceHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmStringReplaceHelper.h"
@@ -8,7 +8,7 @@
#include "cmMakefile.h"
-cmStringReplaceHelper::cmStringReplaceHelper(const std::string& regex,
+cmStringReplaceHelper::cmStringReplaceHelper(std::string const& regex,
std::string replace_expr,
cmMakefile* makefile)
: RegExString(regex)
@@ -19,7 +19,7 @@ cmStringReplaceHelper::cmStringReplaceHelper(const std::string& regex,
this->ParseReplaceExpression();
}
-bool cmStringReplaceHelper::Replace(const std::string& input,
+bool cmStringReplaceHelper::Replace(std::string const& input,
std::string& output)
{
output.clear();
@@ -46,7 +46,7 @@ bool cmStringReplaceHelper::Replace(const std::string& input,
}
// Concatenate the replacement for the match.
- for (const auto& replacement : this->Replacements) {
+ for (auto const& replacement : this->Replacements) {
if (replacement.Number < 0) {
// This is just a plain-text part of the replacement.
output += replacement.Value;
diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h
index fd59d17..ffe9983 100644
--- a/Source/cmStringReplaceHelper.h
+++ b/Source/cmStringReplaceHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -13,7 +13,7 @@ class cmMakefile;
class cmStringReplaceHelper
{
public:
- cmStringReplaceHelper(const std::string& regex, std::string replace_expr,
+ cmStringReplaceHelper(std::string const& regex, std::string replace_expr,
cmMakefile* makefile = nullptr);
bool IsRegularExpressionValid() const
@@ -25,15 +25,15 @@ public:
return this->ValidReplaceExpression;
}
- bool Replace(const std::string& input, std::string& output);
+ bool Replace(std::string const& input, std::string& output);
- const std::string& GetError() { return this->ErrorString; }
+ std::string const& GetError() { return this->ErrorString; }
private:
class RegexReplacement
{
public:
- RegexReplacement(const char* s)
+ RegexReplacement(char const* s)
: Number(-1)
, Value(s)
{
diff --git a/Source/cmSubcommandTable.cxx b/Source/cmSubcommandTable.cxx
index f6194f8..d1d35d5 100644
--- a/Source/cmSubcommandTable.cxx
+++ b/Source/cmSubcommandTable.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSubcommandTable.h"
#include <algorithm>
diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h
index 80d8c6d..cc0a67e 100644
--- a/Source/cmSubcommandTable.h
+++ b/Source/cmSubcommandTable.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index 47082f1..e4f0384 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmSubdirCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 6770874..1fe071b 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx
deleted file mode 100644
index 496c60d..0000000
--- a/Source/cmSubdirDependsCommand.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmSubdirDependsCommand.h"
-
-class cmExecutionStatus;
-
-bool cmSubdirDependsCommand(std::vector<std::string> const&,
- cmExecutionStatus&)
-{
- return true;
-}
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
deleted file mode 100644
index 133d702..0000000
--- a/Source/cmSubdirDependsCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmSubdirDependsCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmSyntheticTargetCache.h b/Source/cmSyntheticTargetCache.h
index 22d1533..439f6ec 100644
--- a/Source/cmSyntheticTargetCache.h
+++ b/Source/cmSyntheticTargetCache.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5ad0439..ca6639f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#if !defined(_WIN32) && !defined(__sun) && !defined(__OpenBSD__)
// POSIX APIs are needed
@@ -18,8 +18,22 @@
# define _DARWIN_C_SOURCE
#endif
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
+#if !defined(__clang__) || __has_feature(cxx_thread_local)
+# define CM_HAVE_THREAD_LOCAL
+#endif
+
#include "cmSystemTools.h"
+#include <iterator>
+
+#if defined(_WIN32) || defined(__APPLE__)
+# include <unordered_map>
+#endif
+
#include <cm/optional>
#include <cmext/algorithm>
#include <cmext/string_view>
@@ -29,6 +43,7 @@
#include "cmDuration.h"
#include "cmELF.h"
#include "cmMessageMetadata.h"
+#include "cmPathResolver.h"
#include "cmProcessOutput.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
@@ -72,10 +87,15 @@
#include <functional>
#include <iostream>
#include <memory>
+#include <random>
#include <sstream>
#include <utility>
#include <vector>
+#ifndef CM_HAVE_THREAD_LOCAL
+# include <mutex>
+#endif
+
#include <fcntl.h>
#include "cmsys/Directory.hxx"
@@ -111,10 +131,33 @@
# include <malloc.h> /* for malloc/free on QNX */
#endif
+#ifdef __linux__
+# include <linux/fs.h>
+
+# include <sys/ioctl.h>
+#endif
+
#if !defined(_WIN32) && !defined(__ANDROID__)
# include <sys/utsname.h>
#endif
+#if defined(CMAKE_BOOTSTRAP) && defined(__sun) && defined(__i386)
+# define CMAKE_NO_MKDTEMP
+#endif
+
+#ifdef CMAKE_NO_MKDTEMP
+# include <dlfcn.h>
+#endif
+
+#ifndef CMAKE_NO_GETPWNAM
+# if defined(_WIN32)
+# define CMAKE_NO_GETPWNAM
+# endif
+#endif
+#ifndef CMAKE_NO_GETPWNAM
+# include <pwd.h>
+#endif
+
#if defined(_MSC_VER) && _MSC_VER >= 1800
# define CM_WINDOWS_DEPRECATED_GetVersionEx
#endif
@@ -126,6 +169,202 @@ cmSystemTools::MessageCallback s_MessageCallback;
cmSystemTools::OutputCallback s_StderrCallback;
cmSystemTools::OutputCallback s_StdoutCallback;
+std::string ResolveTildePath(std::string p)
+{
+ if (!p.empty() && p[0] == '~') {
+ cm::optional<std::string> home;
+ std::string::size_type last = p.find_first_of("/\\");
+ if (last == std::string::npos) {
+ last = p.size();
+ }
+ if (last == 1) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ home = cmSystemTools::GetEnvVar("USERPROFILE");
+ if (!home)
+#endif
+ home = cmSystemTools::GetEnvVar("HOME");
+#ifndef CMAKE_NO_GETPWNAM
+ } else if (last > 1) {
+ std::string user = p.substr(1, last - 1);
+ if (passwd* pw = getpwnam(user.c_str())) {
+ home = std::string(pw->pw_dir);
+ }
+#endif
+ }
+ if (home) {
+ p.replace(0, last, *home);
+ }
+ }
+ return p;
+}
+
+#ifdef _WIN32
+std::string GetDosDriveWorkingDirectory(char letter)
+{
+ // The Windows command processor tracks a per-drive working
+ // directory for compatibility with MS-DOS by using special
+ // environment variables named "=C:".
+ // https://web.archive.org/web/20100522040616/
+ // https://blogs.msdn.com/oldnewthing/archive/2010/05/06/10008132.aspx
+ return cmSystemTools::GetEnvVar(cmStrCat('=', letter, ':'))
+ .value_or(std::string());
+}
+
+cmsys::Status ReadNameOnDisk(std::string const& path, std::string& name)
+{
+ std::wstring wp = cmsys::Encoding::ToWide(path);
+ HANDLE h = CreateFileW(
+ wp.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
+ FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nullptr);
+ if (h == INVALID_HANDLE_VALUE) {
+ return cmsys::Status::Windows_GetLastError();
+ }
+
+ WCHAR local_fni[((sizeof(FILE_NAME_INFO) - 1) / sizeof(WCHAR)) + 1024];
+ size_t fni_size = sizeof(local_fni);
+ auto* fni = reinterpret_cast<FILE_NAME_INFO*>(local_fni);
+ if (!GetFileInformationByHandleEx(h, FileNameInfo, fni, fni_size)) {
+ DWORD e = GetLastError();
+ if (e != ERROR_MORE_DATA) {
+ CloseHandle(h);
+ return cmsys::Status::Windows(e);
+ }
+ fni_size = fni->FileNameLength;
+ fni = static_cast<FILE_NAME_INFO*>(malloc(fni_size));
+ if (!fni) {
+ e = ERROR_NOT_ENOUGH_MEMORY;
+ CloseHandle(h);
+ return cmsys::Status::Windows(e);
+ }
+ if (!GetFileInformationByHandleEx(h, FileNameInfo, fni, fni_size)) {
+ e = GetLastError();
+ free(fni);
+ CloseHandle(h);
+ return cmsys::Status::Windows(e);
+ }
+ }
+
+ std::wstring wn{ fni->FileName, fni->FileNameLength / sizeof(WCHAR) };
+ std::string nn = cmsys::Encoding::ToNarrow(wn);
+ std::string::size_type last_slash = nn.find_last_of("/\\");
+ if (last_slash != std::string::npos) {
+ name = nn.substr(last_slash + 1);
+ }
+ if (fni != reinterpret_cast<FILE_NAME_INFO*>(local_fni)) {
+ free(fni);
+ }
+ CloseHandle(h);
+ return cmsys::Status::Success();
+}
+#elif defined(__APPLE__)
+cmsys::Status ReadNameOnDiskIterateDir(std::string const& path,
+ std::string& name)
+{
+ // Read contents of the parent directory to find the
+ // entry matching the given path.
+ std::string const bn = cmSystemTools::GetFilenameName(path);
+ std::string const dn = cmSystemTools::GetFilenamePath(path);
+ DIR* d = opendir(dn.c_str());
+ while (struct dirent* dr = readdir(d)) {
+ if (strcasecmp(dr->d_name, bn.c_str()) == 0) {
+ name = dr->d_name;
+ closedir(d);
+ return cmsys::Status::Success();
+ }
+ }
+ closedir(d);
+ return cmsys::Status::POSIX(ENOENT);
+}
+
+cmsys::Status ReadNameOnDiskFcntlGetPath(std::string const& path,
+ std::string& name)
+{
+ // macOS (and *BSD) offer a syscall to get an on-disk path to
+ // a descriptor's file.
+ int fd = open(path.c_str(), O_SYMLINK | O_RDONLY);
+ if (fd == -1) {
+ return cmsys::Status::POSIX(errno);
+ }
+ char out[MAXPATHLEN + 1];
+ if (fcntl(fd, F_GETPATH, out) == -1) {
+ int e = errno;
+ close(fd);
+ return cmsys::Status::POSIX(e);
+ }
+ close(fd);
+ name = cmSystemTools::GetFilenameName(out);
+ return cmsys::Status::Success();
+}
+
+cmsys::Status ReadNameOnDisk(std::string const& path, std::string& name)
+{
+ struct stat stat_path;
+ if (lstat(path.c_str(), &stat_path) != 0) {
+ return cmsys::Status::POSIX(errno);
+ }
+ // macOS (and *BSD) use namei(9) to cache file paths. Use it unless
+ // the inode has multiple hardlinks: if it is opened through multiple
+ // paths, the results may be unpredictable.
+ if (S_ISDIR(stat_path.st_mode) || stat_path.st_nlink < 2) {
+ return ReadNameOnDiskFcntlGetPath(path, name);
+ }
+ // Fall back to reading the parent directory.
+ return ReadNameOnDiskIterateDir(path, name);
+}
+#endif
+
+class RealSystem : public cm::PathResolver::System
+{
+public:
+ ~RealSystem() override = default;
+ cmsys::Status ReadSymlink(std::string const& path,
+ std::string& link) override
+ {
+ return cmSystemTools::ReadSymlink(path, link);
+ }
+ bool PathExists(std::string const& path) override
+ {
+ return cmSystemTools::PathExists(path);
+ }
+ std::string GetWorkingDirectory() override
+ {
+ return cmSystemTools::GetLogicalWorkingDirectory();
+ }
+#ifdef _WIN32
+ std::string GetWorkingDirectoryOnDrive(char letter) override
+ {
+ return GetDosDriveWorkingDirectory(letter);
+ }
+#endif
+
+#if defined(_WIN32) || defined(__APPLE__)
+ struct NameOnDisk
+ {
+ cmsys::Status Status;
+ std::string Name;
+ };
+ using NameOnDiskMap = std::unordered_map<std::string, NameOnDisk>;
+ NameOnDiskMap CachedNameOnDisk;
+
+ cmsys::Status ReadName(std::string const& path, std::string& name) override
+ {
+ // Cache results to avoid repeated filesystem access.
+ // We assume any files created by our own process keep their case.
+ // Index the cache by lower-case paths to make it case-insensitive.
+ std::string path_lower = cmSystemTools::LowerCase(path);
+ auto i = this->CachedNameOnDisk.find(path_lower);
+ if (i == this->CachedNameOnDisk.end()) {
+ i = this->CachedNameOnDisk.emplace(path_lower, NameOnDisk()).first;
+ i->second.Status = ReadNameOnDisk(path, i->second.Name);
+ }
+ name = i->second.Name;
+ return i->second.Status;
+ }
+#endif
+};
+
+RealSystem RealOS;
+
} // namespace
#if !defined(HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
@@ -133,7 +372,7 @@ cmSystemTools::OutputCallback s_StdoutCallback;
# if defined(_WIN32)
extern __declspec(dllimport) char** environ;
# else
-extern char** environ;
+extern char** environ; // NOLINT(readability-redundant-declaration)
# endif
#endif
@@ -147,7 +386,7 @@ static std::string cm_archive_entry_pathname(struct archive_entry* entry)
# endif
}
-static int cm_archive_read_open_file(struct archive* a, const char* file,
+static int cm_archive_read_open_file(struct archive* a, char const* file,
int block_size)
{
# if cmsys_STL_HAS_WSTRING
@@ -213,6 +452,28 @@ void cmSystemTools::ExpandRegistryValues(std::string& source,
}
#endif
+// Return a lower case string
+std::string cmSystemTools::LowerCase(cm::string_view s)
+{
+ std::string n;
+ n.resize(s.size());
+ for (size_t i = 0; i < s.size(); i++) {
+ n[i] = static_cast<std::string::value_type>(tolower(s[i]));
+ }
+ return n;
+}
+
+// Return an upper case string
+std::string cmSystemTools::UpperCase(cm::string_view s)
+{
+ std::string n;
+ n.resize(s.size());
+ for (size_t i = 0; i < s.size(); i++) {
+ n[i] = static_cast<std::string::value_type>(toupper(s[i]));
+ }
+ return n;
+}
+
std::string cmSystemTools::HelpFileName(cm::string_view str)
{
std::string name(str);
@@ -221,7 +482,7 @@ std::string cmSystemTools::HelpFileName(cm::string_view str)
return name;
}
-void cmSystemTools::Error(const std::string& m)
+void cmSystemTools::Error(std::string const& m)
{
std::string message = "CMake Error: " + m;
cmSystemTools::s_ErrorOccurred = true;
@@ -256,7 +517,7 @@ void cmSystemTools::SetStderrCallback(OutputCallback f)
s_StderrCallback = std::move(f);
}
-void cmSystemTools::Stderr(const std::string& s)
+void cmSystemTools::Stderr(std::string const& s)
{
if (s_StderrCallback) {
s_StderrCallback(s);
@@ -265,7 +526,7 @@ void cmSystemTools::Stderr(const std::string& s)
}
}
-void cmSystemTools::Stdout(const std::string& s)
+void cmSystemTools::Stdout(std::string const& s)
{
if (s_StdoutCallback) {
s_StdoutCallback(s);
@@ -274,14 +535,14 @@ void cmSystemTools::Stdout(const std::string& s)
}
}
-void cmSystemTools::Message(const std::string& m, const char* title)
+void cmSystemTools::Message(std::string const& m, char const* title)
{
cmMessageMetadata md;
md.title = title;
Message(m, md);
}
-void cmSystemTools::Message(const std::string& m, const cmMessageMetadata& md)
+void cmSystemTools::Message(std::string const& m, cmMessageMetadata const& md)
{
if (s_MessageCallback) {
s_MessageCallback(m, md);
@@ -290,14 +551,14 @@ void cmSystemTools::Message(const std::string& m, const cmMessageMetadata& md)
}
}
-void cmSystemTools::ReportLastSystemError(const char* msg)
+void cmSystemTools::ReportLastSystemError(char const* msg)
{
std::string m =
cmStrCat(msg, ": System Error: ", Superclass::GetLastSystemError());
cmSystemTools::Error(m);
}
-void cmSystemTools::ParseWindowsCommandLine(const char* command,
+void cmSystemTools::ParseWindowsCommandLine(char const* command,
std::vector<std::string>& args)
{
// See the MSDN document "Parsing C Command-Line Arguments" at
@@ -308,7 +569,7 @@ void cmSystemTools::ParseWindowsCommandLine(const char* command,
bool in_quotes = false;
int backslashes = 0;
std::string arg;
- for (const char* c = command; *c; ++c) {
+ for (char const* c = command; *c; ++c) {
if (*c == '\\') {
++backslashes;
in_argument = true;
@@ -366,8 +627,8 @@ public:
}
free(this->ArgV);
}
- cmSystemToolsArgV(const cmSystemToolsArgV&) = delete;
- cmSystemToolsArgV& operator=(const cmSystemToolsArgV&) = delete;
+ cmSystemToolsArgV(cmSystemToolsArgV const&) = delete;
+ cmSystemToolsArgV& operator=(cmSystemToolsArgV const&) = delete;
void Store(std::vector<std::string>& args) const
{
for (char** arg = this->ArgV; arg && *arg; ++arg) {
@@ -376,7 +637,7 @@ public:
}
};
-void cmSystemTools::ParseUnixCommandLine(const char* command,
+void cmSystemTools::ParseUnixCommandLine(char const* command,
std::vector<std::string>& args)
{
// Invoke the underlying parser.
@@ -415,14 +676,14 @@ std::vector<std::string> cmSystemTools::HandleResponseFile(
return arg_full;
}
-std::vector<std::string> cmSystemTools::ParseArguments(const std::string& cmd)
+std::vector<std::string> cmSystemTools::ParseArguments(std::string const& cmd)
{
std::vector<std::string> args;
std::string arg;
bool win_path = false;
- const char* command = cmd.c_str();
+ char const* command = cmd.c_str();
if (command[0] && command[1] &&
((command[0] != '/' && command[1] == ':' && command[2] == '\\') ||
(command[0] == '\"' && command[1] != '/' && command[2] == ':' &&
@@ -433,7 +694,7 @@ std::vector<std::string> cmSystemTools::ParseArguments(const std::string& cmd)
win_path = true;
}
// Split the command into an argv array.
- for (const char* c = command; *c;) {
+ for (char const* c = command; *c;) {
// Skip over whitespace.
while (*c == ' ' || *c == '\t') {
++c;
@@ -486,7 +747,7 @@ bool cmSystemTools::SplitProgramFromArgs(std::string const& command,
std::string& program,
std::string& args)
{
- const char* c = command.c_str();
+ char const* c = command.c_str();
// Skip leading whitespace.
while (cmIsSpace(*c)) {
@@ -572,10 +833,38 @@ std::size_t cmSystemTools::CalculateCommandLineLengthLimit()
return sz;
}
+void cmSystemTools::MaybePrependCmdExe(std::vector<std::string>& cmdLine)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (!cmdLine.empty()) {
+ std::string& applicationName = cmdLine.at(0);
+ static cmsys::RegularExpression const winCmdRegex(
+ "\\.([Bb][Aa][Tt]|[Cc][Mm][Dd])$");
+ cmsys::RegularExpressionMatch winCmdMatch;
+ if (winCmdRegex.find(applicationName.c_str(), winCmdMatch)) {
+ // Wrap `.bat` and `.cmd` commands with `cmd /c call`.
+ std::vector<std::string> output;
+ output.reserve(cmdLine.size() + 3);
+ output.emplace_back(cmSystemTools::GetComspec());
+ output.emplace_back("/c");
+ output.emplace_back("call");
+ // Convert the batch file path to use backslashes for cmd.exe to parse.
+ std::replace(applicationName.begin(), applicationName.end(), '/', '\\');
+ output.emplace_back(applicationName);
+ std::move(cmdLine.begin() + 1, cmdLine.end(),
+ std::back_inserter(output));
+ cmdLine = std::move(output);
+ }
+ }
+#else
+ static_cast<void>(cmdLine);
+#endif
+}
+
bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
std::string* captureStdOut,
std::string* captureStdErr, int* retVal,
- const char* dir, OutputOption outputflag,
+ char const* dir, OutputOption outputflag,
cmDuration timeout, Encoding encoding)
{
cmUVProcessChainBuilder builder;
@@ -628,7 +917,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
[&outputflag, &processOutput,
&chain](cm::uv_pipe_ptr& pipe, int stream, std::string* captureStd,
std::vector<char>& tempStd, int id,
- void (*outputFunc)(const std::string&),
+ void (*outputFunc)(std::string const&),
bool& finished) -> std::unique_ptr<cmUVStreamReadHandle> {
if (stream < 0) {
return nullptr;
@@ -695,7 +984,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
bool result = true;
if (timedOut) {
- const char* error_str = "Process terminated due to timeout\n";
+ char const* error_str = "Process terminated due to timeout\n";
if (outputflag != OUTPUT_NONE) {
std::cerr << error_str << std::endl;
}
@@ -734,10 +1023,10 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
return result;
}
-bool cmSystemTools::RunSingleCommand(const std::string& command,
+bool cmSystemTools::RunSingleCommand(std::string const& command,
std::string* captureStdOut,
std::string* captureStdErr, int* retVal,
- const char* dir, OutputOption outputflag,
+ char const* dir, OutputOption outputflag,
cmDuration timeout)
{
if (s_DisableRunCommandOutput) {
@@ -764,7 +1053,7 @@ std::string cmSystemTools::PrintSingleCommand(
}
bool cmSystemTools::DoesFileExistWithExtensions(
- const std::string& name, const std::vector<std::string>& headerExts)
+ std::string const& name, std::vector<std::string> const& headerExts)
{
std::string hname;
@@ -778,8 +1067,8 @@ bool cmSystemTools::DoesFileExistWithExtensions(
}
std::string cmSystemTools::FileExistsInParentDirectories(
- const std::string& fname, const std::string& directory,
- const std::string& toplevel)
+ std::string const& fname, std::string const& directory,
+ std::string const& toplevel)
{
std::string file = fname;
cmSystemTools::ConvertToUnixSlashes(file);
@@ -984,8 +1273,78 @@ std::string cmSystemTools::GetComspec()
#endif
+// File changes involve removing SETUID/SETGID bits when a file is modified.
+// This behavior is consistent across most Unix-like operating systems.
+class FileModeGuard
+{
+public:
+ FileModeGuard(std::string const& file_path, std::string* emsg);
+ bool Restore(std::string* emsg);
+ bool HasErrors() const;
+
+private:
+#ifndef _WIN32
+ mode_t mode_;
+#endif
+ std::string filepath_;
+};
+
+FileModeGuard::FileModeGuard(std::string const& file_path, std::string* emsg)
+{
+#ifndef _WIN32
+ struct stat file_stat;
+ if (stat(file_path.c_str(), &file_stat) != 0) {
+ if (emsg) {
+ *emsg = cmStrCat("Cannot get file stat: ", strerror(errno));
+ }
+ return;
+ }
+
+ mode_ = file_stat.st_mode;
+#else
+ static_cast<void>(emsg);
+#endif
+ filepath_ = file_path;
+}
+
+bool FileModeGuard::Restore(std::string* emsg)
+{
+ assert(filepath_.empty() == false);
+
+#ifndef _WIN32
+ struct stat file_stat;
+ if (stat(filepath_.c_str(), &file_stat) != 0) {
+ if (emsg) {
+ *emsg = cmStrCat("Cannot get file stat: ", strerror(errno));
+ }
+ return false;
+ }
+
+ // Nothing changed; everything is in the expected state
+ if (file_stat.st_mode == mode_) {
+ return true;
+ }
+
+ if (chmod(filepath_.c_str(), mode_) != 0) {
+ if (emsg) {
+ *emsg = cmStrCat("Cannot restore the file mode: ", strerror(errno));
+ }
+ return false;
+ }
+#else
+ static_cast<void>(emsg);
+#endif
+
+ return true;
+}
+
+bool FileModeGuard::HasErrors() const
+{
+ return filepath_.empty();
+}
+
std::string cmSystemTools::GetRealPathResolvingWindowsSubst(
- const std::string& path, std::string* errorMessage)
+ std::string const& path, std::string* errorMessage)
{
#ifdef _WIN32
// uv_fs_realpath uses Windows Vista API so fallback to kwsys if not found
@@ -995,26 +1354,66 @@ std::string cmSystemTools::GetRealPathResolvingWindowsSubst(
if (!err) {
resolved_path = std::string((char*)req.ptr);
cmSystemTools::ConvertToUnixSlashes(resolved_path);
- // Normalize to upper-case drive letter as GetActualCaseForPath does.
- if (resolved_path.size() > 1 && resolved_path[1] == ':') {
- resolved_path[0] = toupper(resolved_path[0]);
- }
} else if (err == UV_ENOSYS) {
resolved_path = cmsys::SystemTools::GetRealPath(path, errorMessage);
} else if (errorMessage) {
- LPSTR message = nullptr;
- DWORD size = FormatMessageA(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&message,
- 0, nullptr);
- *errorMessage = std::string(message, size);
- LocalFree(message);
-
- resolved_path = "";
+ cmsys::Status status =
+ cmsys::Status::Windows(uv_fs_get_system_error(&req));
+ *errorMessage = status.GetString();
+ resolved_path.clear();
} else {
resolved_path = path;
}
+ // Normalize to upper-case drive letter as cm::PathResolver does.
+ if (resolved_path.size() > 1 && resolved_path[1] == ':') {
+ resolved_path[0] = toupper(resolved_path[0]);
+ }
+ return resolved_path;
+#else
+ return cmsys::SystemTools::GetRealPath(path, errorMessage);
+#endif
+}
+
+std::string cmSystemTools::GetRealPath(std::string const& path,
+ std::string* errorMessage)
+{
+#ifdef _WIN32
+ std::string resolved_path =
+ cmSystemTools::GetRealPathResolvingWindowsSubst(path, errorMessage);
+
+ // If the original path used a subst drive and the real path starts
+ // with the substitution, restore the subst drive prefix. This may
+ // incorrectly restore a subst drive if the underlying drive was
+ // encountered via an absolute symlink, but this is an acceptable
+ // limitation to otherwise preserve susbt drives.
+ if (resolved_path.size() >= 2 && resolved_path[1] == ':' &&
+ path.size() >= 2 && path[1] == ':' &&
+ toupper(resolved_path[0]) != toupper(path[0])) {
+ // FIXME: Add thread_local or mutex if we use threads.
+ static std::map<char, std::string> substMap;
+ char const drive = static_cast<char>(toupper(path[0]));
+ std::string maybe_subst = cmStrCat(drive, ":/");
+ auto smi = substMap.find(drive);
+ if (smi == substMap.end()) {
+ smi = substMap
+ .emplace(
+ drive,
+ cmSystemTools::GetRealPathResolvingWindowsSubst(maybe_subst))
+ .first;
+ }
+ std::string const& resolved_subst = smi->second;
+ std::string::size_type const ns = resolved_subst.size();
+ if (ns > 0) {
+ std::string::size_type const np = resolved_path.size();
+ if (ns == np && resolved_path == resolved_subst) {
+ resolved_path = maybe_subst;
+ } else if (ns > 0 && ns < np && resolved_path[ns] == '/' &&
+ resolved_path.compare(0, ns, resolved_subst) == 0) {
+ resolved_path.replace(0, ns + 1, maybe_subst);
+ }
+ }
+ }
+
return resolved_path;
#else
return cmsys::SystemTools::GetRealPath(path, errorMessage);
@@ -1051,7 +1450,7 @@ using mode_t = cmSystemTools::SystemTools::mode_t;
# include <sys/stat.h>
#endif
-inline int Mkdir(const char* dir, const mode_t* mode)
+inline int Mkdir(char const* dir, mode_t const* mode)
{
#if defined(_WIN32)
int ret = _wmkdir(cmSystemTools::ConvertToWindowsExtendedPath(dir).c_str());
@@ -1063,8 +1462,31 @@ inline int Mkdir(const char* dir, const mode_t* mode)
#endif
}
+#ifdef CMAKE_NO_MKDTEMP
+namespace {
+char* cm_mkdtemp_fallback(char* template_)
+{
+ if (mktemp(template_) == nullptr || mkdir(template_, 0700) != 0) {
+ return nullptr;
+ }
+ return template_;
+}
+using cm_mkdtemp_t = char* (*)(char*);
+cm_mkdtemp_t const cm_mkdtemp = []() -> cm_mkdtemp_t {
+ cm_mkdtemp_t f = (cm_mkdtemp_t)dlsym(RTLD_DEFAULT, "mkdtemp");
+ dlerror(); // Ignore/cleanup dlsym errors.
+ if (!f) {
+ f = cm_mkdtemp_fallback;
+ }
+ return f;
+}();
+}
+#else
+# define cm_mkdtemp mkdtemp
+#endif
+
cmsys::Status cmSystemTools::MakeTempDirectory(std::string& path,
- const mode_t* mode)
+ mode_t const* mode)
{
if (path.empty()) {
return cmsys::Status::POSIX(EINVAL);
@@ -1072,14 +1494,14 @@ cmsys::Status cmSystemTools::MakeTempDirectory(std::string& path,
return cmSystemTools::MakeTempDirectory(&path.front(), mode);
}
-cmsys::Status cmSystemTools::MakeTempDirectory(char* path, const mode_t* mode)
+cmsys::Status cmSystemTools::MakeTempDirectory(char* path, mode_t const* mode)
{
if (!path) {
return cmsys::Status::POSIX(EINVAL);
}
// verify that path ends with "XXXXXX"
- const auto l = std::strlen(path);
+ auto const l = std::strlen(path);
if (!cmHasLiteralSuffix(cm::string_view{ path, l }, "XXXXXX")) {
return cmsys::Status::POSIX(EINVAL);
}
@@ -1097,8 +1519,8 @@ cmsys::Status cmSystemTools::MakeTempDirectory(char* path, const mode_t* mode)
}
#ifdef _WIN32
- const int nchars = 36;
- const char chars[nchars + 1] = "abcdefghijklmnopqrstuvwxyz0123456789";
+ int const nchars = 36;
+ char const chars[nchars + 1] = "abcdefghijklmnopqrstuvwxyz0123456789";
std::random_device rd;
std::mt19937 rg{ rd() };
@@ -1116,7 +1538,7 @@ cmsys::Status cmSystemTools::MakeTempDirectory(char* path, const mode_t* mode)
}
return cmsys::Status::POSIX(EAGAIN);
#else
- if (mkdtemp(path)) {
+ if (cm_mkdtemp(path)) {
if (mode) {
chmod(path, *mode);
}
@@ -1219,8 +1641,8 @@ cmSystemTools::CopyResult cmSystemTools::CopySingleFile(
return CopyResult::Success;
}
-bool cmSystemTools::RenameFile(const std::string& oldname,
- const std::string& newname)
+bool cmSystemTools::RenameFile(std::string const& oldname,
+ std::string const& newname)
{
return cmSystemTools::RenameFile(oldname, newname, Replace::Yes) ==
RenameResult::Success;
@@ -1232,7 +1654,7 @@ cmSystemTools::RenameResult cmSystemTools::RenameFile(
{
#ifdef _WIN32
# ifndef INVALID_FILE_ATTRIBUTES
-# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+# define INVALID_FILE_ATTRIBUTES ((DWORD) - 1)
# endif
std::wstring const oldname_wstr =
SystemTools::ConvertToWindowsExtendedPath(oldname);
@@ -1332,7 +1754,7 @@ cmSystemTools::RenameResult cmSystemTools::RenameFile(
}
cmsys::Status cmSystemTools::MoveFileIfDifferent(
- const std::string& source, const std::string& destination)
+ std::string const& source, std::string const& destination)
{
cmsys::Status res = {};
if (FilesDiffer(source, destination)) {
@@ -1345,8 +1767,8 @@ cmsys::Status cmSystemTools::MoveFileIfDifferent(
return res;
}
-void cmSystemTools::Glob(const std::string& directory,
- const std::string& regexp,
+void cmSystemTools::Glob(std::string const& directory,
+ std::string const& regexp,
std::vector<std::string>& files)
{
cmsys::Directory d;
@@ -1365,7 +1787,7 @@ void cmSystemTools::Glob(const std::string& directory,
}
}
-void cmSystemTools::GlobDirs(const std::string& path,
+void cmSystemTools::GlobDirs(std::string const& path,
std::vector<std::string>& files)
{
std::string::size_type pos = path.find("/*");
@@ -1391,7 +1813,7 @@ void cmSystemTools::GlobDirs(const std::string& path,
}
}
-bool cmSystemTools::SimpleGlob(const std::string& glob,
+bool cmSystemTools::SimpleGlob(std::string const& glob,
std::vector<std::string>& files,
int type /* = 0 */)
{
@@ -1485,7 +1907,7 @@ void cmSystemTools::ConvertToLongPath(std::string& path)
#endif
}
-std::string cmSystemTools::ConvertToRunCommandPath(const std::string& path)
+std::string cmSystemTools::ConvertToRunCommandPath(std::string const& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
return cmSystemTools::ConvertToWindowsOutputPath(path);
@@ -1614,22 +2036,67 @@ cm::optional<std::string> cmSystemTools::GetEnvVar(std::string const& var)
return result;
}
-std::vector<std::string> cmSystemTools::SplitEnvPath(std::string const& value)
+std::vector<std::string> cmSystemTools::GetEnvPathNormalized(
+ std::string const& var)
+{
+ std::vector<std::string> result;
+ if (cm::optional<std::string> env = cmSystemTools::GetEnvVar(var)) {
+ std::vector<std::string> p = cmSystemTools::SplitEnvPathNormalized(*env);
+ std::move(p.begin(), p.end(), std::back_inserter(result));
+ }
+ return result;
+}
+
+std::vector<std::string> cmSystemTools::SplitEnvPath(cm::string_view in)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
static cm::string_view sep = ";"_s;
#else
static cm::string_view sep = ":"_s;
#endif
- std::vector<std::string> paths = cmTokenize(value, sep);
- for (std::string& p : paths) {
- SystemTools::ConvertToUnixSlashes(p);
+ std::vector<std::string> paths;
+ cm::string_view::size_type e = 0;
+ for (;;) {
+ cm::string_view::size_type b = in.find_first_not_of(sep, e);
+ if (b == cm::string_view::npos) {
+ break;
+ }
+ e = in.find_first_of(sep, b);
+ if (e == cm::string_view::npos) {
+ paths.emplace_back(in.substr(b));
+ break;
+ }
+ paths.emplace_back(in.substr(b, e - b));
}
return paths;
}
+std::vector<std::string> cmSystemTools::SplitEnvPathNormalized(
+ cm::string_view in)
+{
+ std::vector<std::string> paths = cmSystemTools::SplitEnvPath(in);
+ std::transform(paths.begin(), paths.end(), paths.begin(),
+ cmSystemTools::ToNormalizedPathOnDisk);
+ return paths;
+}
+
+std::string cmSystemTools::ToNormalizedPathOnDisk(std::string p)
+{
+ p = ResolveTildePath(p);
+ using namespace cm::PathResolver;
+#ifdef _WIN32
+ // IWYU pragma: no_forward_declare cm::PathResolver::Policies::CasePath
+ static Resolver<Policies::CasePath> const resolver(RealOS);
+#else
+ // IWYU pragma: no_forward_declare cm::PathResolver::Policies::LogicalPath
+ static Resolver<Policies::LogicalPath> const resolver(RealOS);
+#endif
+ resolver.Resolve(std::move(p), p);
+ return p;
+}
+
#ifndef CMAKE_BOOTSTRAP
-bool cmSystemTools::UnsetEnv(const char* value)
+bool cmSystemTools::UnsetEnv(char const* value)
{
# if !defined(HAVE_UNSETENV)
return cmSystemTools::UnPutEnv(value);
@@ -1660,19 +2127,19 @@ std::vector<std::string> cmSystemTools::GetEnvironmentVariables()
void cmSystemTools::AppendEnv(std::vector<std::string> const& env)
{
- for (std::string const& eit : env) {
- cmSystemTools::PutEnv(eit);
+ for (std::string const& var : env) {
+ cmSystemTools::PutEnv(var);
}
}
void cmSystemTools::EnvDiff::AppendEnv(std::vector<std::string> const& env)
{
- for (std::string const& eit : env) {
- this->PutEnv(eit);
+ for (std::string const& var : env) {
+ this->PutEnv(var);
}
}
-void cmSystemTools::EnvDiff::PutEnv(const std::string& env)
+void cmSystemTools::EnvDiff::PutEnv(std::string const& env)
{
auto const eq_loc = env.find('=');
if (eq_loc != std::string::npos) {
@@ -1683,23 +2150,23 @@ void cmSystemTools::EnvDiff::PutEnv(const std::string& env)
}
}
-void cmSystemTools::EnvDiff::UnPutEnv(const std::string& env)
+void cmSystemTools::EnvDiff::UnPutEnv(std::string const& env)
{
diff[env] = cm::nullopt;
}
-bool cmSystemTools::EnvDiff::ParseOperation(const std::string& envmod)
+bool cmSystemTools::EnvDiff::ParseOperation(std::string const& envmod)
{
char path_sep = GetSystemPathlistSeparator();
- auto apply_diff = [this](const std::string& name,
+ auto apply_diff = [this](std::string const& name,
std::function<void(std::string&)> const& apply) {
cm::optional<std::string> old_value = diff[name];
std::string output;
if (old_value) {
output = *old_value;
} else {
- const char* curval = cmSystemTools::GetEnv(name);
+ char const* curval = cmSystemTools::GetEnv(name);
if (curval) {
output = curval;
}
@@ -1848,38 +2315,38 @@ void cmSystemTools::EnableVSConsoleOutput()
#endif
}
-bool cmSystemTools::IsPathToFramework(const std::string& path)
+bool cmSystemTools::IsPathToFramework(std::string const& path)
{
return (cmSystemTools::FileIsFullPath(path) &&
cmHasLiteralSuffix(path, ".framework"));
}
-bool cmSystemTools::IsPathToXcFramework(const std::string& path)
+bool cmSystemTools::IsPathToXcFramework(std::string const& path)
{
return (cmSystemTools::FileIsFullPath(path) &&
cmHasLiteralSuffix(path, ".xcframework"));
}
-bool cmSystemTools::IsPathToMacOSSharedLibrary(const std::string& path)
+bool cmSystemTools::IsPathToMacOSSharedLibrary(std::string const& path)
{
return (cmSystemTools::FileIsFullPath(path) &&
cmHasLiteralSuffix(path, ".dylib"));
}
-bool cmSystemTools::CreateTar(const std::string& outFileName,
- const std::vector<std::string>& files,
- const std::string& workingDirectory,
+bool cmSystemTools::CreateTar(std::string const& outFileName,
+ std::vector<std::string> const& files,
+ std::string const& workingDirectory,
cmTarCompression compressType, bool verbose,
std::string const& mtime,
std::string const& format, int compressionLevel)
{
#if !defined(CMAKE_BOOTSTRAP)
- cmWorkingDirectory workdir(cmSystemTools::GetCurrentWorkingDirectory());
+ cmWorkingDirectory workdir(cmSystemTools::GetLogicalWorkingDirectory());
if (!workingDirectory.empty()) {
workdir.SetDirectory(workingDirectory);
}
- const std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string const cwd = cmSystemTools::GetLogicalWorkingDirectory();
cmsys::ofstream fout(outFileName.c_str(), std::ios::out | std::ios::binary);
if (!fout) {
std::string e = cmStrCat("Cannot open output file \"", outFileName,
@@ -1943,8 +2410,8 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
{
char tmp[100];
size_t w;
- const char* p;
- const char* fmt;
+ char const* p;
+ char const* fmt;
time_t tim;
static time_t now;
size_t u_width = 6;
@@ -2040,10 +2507,10 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
fflush(out);
}
-void ArchiveError(const char* m1, struct archive* a)
+void ArchiveError(char const* m1, struct archive* a)
{
std::string message(m1);
- const char* m2 = archive_error_string(a);
+ char const* m2 = archive_error_string(a);
if (m2) {
message += m2;
}
@@ -2059,7 +2526,7 @@ bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r)
}
if (r >= ARCHIVE_WARN) {
- const char* warn = archive_error_string(ar);
+ char const* warn = archive_error_string(ar);
if (!warn) {
warn = "unknown warning";
}
@@ -2068,7 +2535,7 @@ bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r)
}
// Error.
- const char* err = archive_error_string(ar);
+ char const* err = archive_error_string(ar);
if (!err) {
err = "unknown error";
}
@@ -2080,7 +2547,7 @@ bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r)
bool copy_data(struct archive* ar, struct archive* aw)
{
long r;
- const void* buff;
+ void const* buff;
size_t size;
# if defined(ARCHIVE_VERSION_NUMBER) && ARCHIVE_VERSION_NUMBER >= 3000000
__LA_INT64_T offset;
@@ -2108,8 +2575,8 @@ bool copy_data(struct archive* ar, struct archive* aw)
# endif
}
-bool extract_tar(const std::string& outFileName,
- const std::vector<std::string>& files, bool verbose,
+bool extract_tar(std::string const& outFileName,
+ std::vector<std::string> const& files, bool verbose,
cmSystemTools::cmTarExtractTimestamps extractTimestamps,
bool extract)
{
@@ -2127,7 +2594,7 @@ bool extract_tar(const std::string& outFileName,
return false;
}
- for (const auto& filename : files) {
+ for (auto const& filename : files) {
if (archive_match_include_pattern(matching, filename.c_str()) !=
ARCHIVE_OK) {
cmSystemTools::Error("Failed to add to inclusion list: " + filename);
@@ -2188,7 +2655,7 @@ bool extract_tar(const std::string& outFileName,
}
}
# ifdef _WIN32
- else if (const char* linktext = archive_entry_symlink(entry)) {
+ else if (char const* linktext = archive_entry_symlink(entry)) {
std::cerr << "cmake -E tar: warning: skipping symbolic link \""
<< cm_archive_entry_pathname(entry) << "\" -> \"" << linktext
<< "\"." << std::endl;
@@ -2203,18 +2670,18 @@ bool extract_tar(const std::string& outFileName,
}
}
- bool error_occured = false;
+ bool error_occurred = false;
if (matching) {
- const char* p;
+ char const* p;
int ar;
while ((ar = archive_match_path_unmatched_inclusions_next(matching, &p)) ==
ARCHIVE_OK) {
cmSystemTools::Error("tar: " + std::string(p) +
": Not found in archive");
- error_occured = true;
+ error_occurred = true;
}
- if (error_occured) {
+ if (error_occurred) {
return false;
}
if (ar == ARCHIVE_FATAL) {
@@ -2231,8 +2698,8 @@ bool extract_tar(const std::string& outFileName,
}
#endif
-bool cmSystemTools::ExtractTar(const std::string& outFileName,
- const std::vector<std::string>& files,
+bool cmSystemTools::ExtractTar(std::string const& outFileName,
+ std::vector<std::string> const& files,
cmTarExtractTimestamps extractTimestamps,
bool verbose)
{
@@ -2247,8 +2714,8 @@ bool cmSystemTools::ExtractTar(const std::string& outFileName,
#endif
}
-bool cmSystemTools::ListTar(const std::string& outFileName,
- const std::vector<std::string>& files,
+bool cmSystemTools::ListTar(std::string const& outFileName,
+ std::vector<std::string> const& files,
bool verbose)
{
#if !defined(CMAKE_BOOTSTRAP)
@@ -2401,7 +2868,7 @@ cmSystemTools::WaitForLineResult cmSystemTools::WaitForLine(
#ifdef _WIN32
static void EnsureStdPipe(int stdFd, DWORD nStdHandle, FILE* stream,
- const wchar_t* mode)
+ wchar_t const* mode)
{
if (fileno(stream) >= 0) {
return;
@@ -2513,30 +2980,71 @@ unsigned int cmSystemTools::RandomSeed()
#endif
}
-static std::string cmSystemToolsCMakeCommand;
-static std::string cmSystemToolsCTestCommand;
-static std::string cmSystemToolsCPackCommand;
-static std::string cmSystemToolsCMakeCursesCommand;
-static std::string cmSystemToolsCMakeGUICommand;
-static std::string cmSystemToolsCMClDepsCommand;
-static std::string cmSystemToolsCMakeRoot;
-static std::string cmSystemToolsHTMLDoc;
-void cmSystemTools::FindCMakeResources(const char* argv0)
+unsigned int cmSystemTools::RandomNumber()
+{
+#ifndef CM_HAVE_THREAD_LOCAL
+ static std::mutex gen_mutex;
+ std::lock_guard<std::mutex> gen_mutex_lock(gen_mutex);
+#else
+ thread_local
+#endif
+ static std::mt19937 gen{ cmSystemTools::RandomSeed() };
+ return static_cast<unsigned int>(gen());
+}
+
+std::string cmSystemTools::FindProgram(std::string const& name,
+ std::vector<std::string> const& path)
+{
+ std::string exe = cmsys::SystemTools::FindProgram(name, path);
+ if (!exe.empty()) {
+ exe = cmSystemTools::ToNormalizedPathOnDisk(std::move(exe));
+ }
+ return exe;
+}
+
+namespace {
+std::string InitLogicalWorkingDirectory()
+{
+ std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
+ std::string pwd;
+ if (cmSystemTools::GetEnv("PWD", pwd) &&
+ cmSystemTools::FileIsFullPath(pwd)) {
+ std::string const pwd_real = cmSystemTools::GetRealPath(pwd);
+ if (pwd_real == cwd) {
+ cwd = cmSystemTools::ToNormalizedPathOnDisk(std::move(pwd));
+ }
+ }
+ return cwd;
+}
+
+std::string cmSystemToolsLogicalWorkingDirectory =
+ InitLogicalWorkingDirectory();
+
+std::string cmSystemToolsCMakeCommand;
+std::string cmSystemToolsCTestCommand;
+std::string cmSystemToolsCPackCommand;
+std::string cmSystemToolsCMakeCursesCommand;
+std::string cmSystemToolsCMakeGUICommand;
+std::string cmSystemToolsCMClDepsCommand;
+std::string cmSystemToolsCMakeRoot;
+std::string cmSystemToolsHTMLDoc;
+
+#if defined(__APPLE__)
+bool IsCMakeAppBundleExe(std::string const& exe)
+{
+ return cmHasLiteralSuffix(cmSystemTools::LowerCase(exe), "/macos/cmake");
+}
+#endif
+
+std::string FindOwnExecutable(char const* argv0)
{
- std::string exe_dir;
#if defined(_WIN32) && !defined(__CYGWIN__)
- (void)argv0; // ignore this on windows
+ static_cast<void>(argv0);
wchar_t modulepath[_MAX_PATH];
::GetModuleFileNameW(nullptr, modulepath, sizeof(modulepath));
- std::string path = cmsys::Encoding::ToNarrow(modulepath);
- std::string realPath =
- cmSystemTools::GetRealPathResolvingWindowsSubst(path, nullptr);
- if (realPath.empty()) {
- realPath = path;
- }
- exe_dir = cmSystemTools::GetFilenamePath(realPath);
+ std::string exe = cmsys::Encoding::ToNarrow(modulepath);
#elif defined(__APPLE__)
- (void)argv0; // ignore this on OS X
+ static_cast<void>(argv0);
# define CM_EXE_PATH_LOCAL_SIZE 16384
char exe_path_local[CM_EXE_PATH_LOCAL_SIZE];
# if defined(MAC_OS_X_VERSION_10_3) && !defined(MAC_OS_X_VERSION_10_4)
@@ -2550,41 +3058,139 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
exe_path = static_cast<char*>(malloc(exe_path_size));
_NSGetExecutablePath(exe_path, &exe_path_size);
}
- exe_dir =
- cmSystemTools::GetFilenamePath(cmSystemTools::GetRealPath(exe_path));
+ std::string exe = exe_path;
if (exe_path != exe_path_local) {
free(exe_path);
}
- if (cmSystemTools::GetFilenameName(exe_dir) == "MacOS") {
+ if (IsCMakeAppBundleExe(exe)) {
// The executable is inside an application bundle.
- // Look for ..<CMAKE_BIN_DIR> (install tree) and then fall back to
- // ../../../bin (build tree).
- exe_dir = cmSystemTools::GetFilenamePath(exe_dir);
- if (cmSystemTools::FileExists(exe_dir + CMAKE_BIN_DIR "/cmake")) {
- exe_dir += CMAKE_BIN_DIR;
- } else {
- exe_dir = cmSystemTools::GetFilenamePath(exe_dir);
- exe_dir = cmSystemTools::GetFilenamePath(exe_dir);
+ // The install tree has "..<CMAKE_BIN_DIR>/cmake-gui".
+ // The build tree has '../../../cmake-gui".
+ std::string dir = cmSystemTools::GetFilenamePath(exe);
+ dir = cmSystemTools::GetFilenamePath(dir);
+ exe = cmStrCat(dir, CMAKE_BIN_DIR "/cmake-gui");
+ if (!cmSystemTools::PathExists(exe)) {
+ dir = cmSystemTools::GetFilenamePath(dir);
+ dir = cmSystemTools::GetFilenamePath(dir);
+ exe = cmStrCat(dir, "/cmake-gui");
}
}
#else
- std::string errorMsg;
- std::string exe;
- if (cmSystemTools::FindProgramPath(argv0, exe, errorMsg)) {
- // remove symlinks
- exe = cmSystemTools::GetRealPath(exe);
- exe_dir = cmSystemTools::GetFilenamePath(exe);
+ std::string exe = cmsys::SystemTools::FindProgram(argv0);
+#endif
+ exe = cmSystemTools::ToNormalizedPathOnDisk(std::move(exe));
+ return exe;
+}
+
+#ifndef CMAKE_BOOTSTRAP
+bool ResolveSymlinkToOwnExecutable(std::string& exe, std::string& exe_dir)
+{
+ std::string linked_exe;
+ if (!cmSystemTools::ReadSymlink(exe, linked_exe)) {
+ return false;
+ }
+# if defined(__APPLE__)
+ // Ignore "cmake-gui -> ../MacOS/CMake".
+ if (IsCMakeAppBundleExe(linked_exe)) {
+ return false;
+ }
+# endif
+ if (cmSystemTools::FileIsFullPath(linked_exe)) {
+ exe = std::move(linked_exe);
} else {
- // ???
+ exe = cmStrCat(exe_dir, '/', std::move(linked_exe));
+ }
+ exe = cmSystemTools::ToNormalizedPathOnDisk(std::move(exe));
+ exe_dir = cmSystemTools::GetFilenamePath(exe);
+ return true;
+}
+
+bool FindCMakeResourcesInInstallTree(std::string const& exe_dir)
+{
+ // Install tree has
+ // - "<prefix><CMAKE_BIN_DIR>/cmake"
+ // - "<prefix><CMAKE_DATA_DIR>"
+ // - "<prefix><CMAKE_DOC_DIR>"
+ if (cmHasLiteralSuffix(exe_dir, CMAKE_BIN_DIR)) {
+ std::string const prefix =
+ exe_dir.substr(0, exe_dir.size() - cmStrLen(CMAKE_BIN_DIR));
+ // Set cmSystemToolsCMakeRoot set to the location expected in an
+ // install tree, even if it does not exist, so that
+ // cmake::AddCMakePaths can print the location in its error message.
+ cmSystemToolsCMakeRoot = cmStrCat(prefix, CMAKE_DATA_DIR);
+ if (cmSystemTools::FileExists(
+ cmStrCat(cmSystemToolsCMakeRoot, "/Modules/CMake.cmake"))) {
+ if (cmSystemTools::FileExists(
+ cmStrCat(prefix, CMAKE_DOC_DIR "/html/index.html"))) {
+ cmSystemToolsHTMLDoc = cmStrCat(prefix, CMAKE_DOC_DIR "/html");
+ }
+ return true;
+ }
}
+ return false;
+}
+
+void FindCMakeResourcesInBuildTree(std::string const& exe_dir)
+{
+ // Build tree has "<build>/bin[/<config>]/cmake" and
+ // "<build>/CMakeFiles/CMakeSourceDir.txt".
+ std::string dir = cmSystemTools::GetFilenamePath(exe_dir);
+ std::string src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt");
+ cmsys::ifstream fin(src_dir_txt.c_str());
+ std::string src_dir;
+ if (fin && cmSystemTools::GetLineFromStream(fin, src_dir) &&
+ cmSystemTools::FileIsDirectory(src_dir)) {
+ cmSystemToolsCMakeRoot = src_dir;
+ } else {
+ dir = cmSystemTools::GetFilenamePath(dir);
+ src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt");
+ cmsys::ifstream fin2(src_dir_txt.c_str());
+ if (fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) &&
+ cmSystemTools::FileIsDirectory(src_dir)) {
+ cmSystemToolsCMakeRoot = src_dir;
+ }
+ }
+ if (!cmSystemToolsCMakeRoot.empty() && cmSystemToolsHTMLDoc.empty() &&
+ cmSystemTools::FileExists(
+ cmStrCat(dir, "/Utilities/Sphinx/html/index.html"))) {
+ cmSystemToolsHTMLDoc = cmStrCat(dir, "/Utilities/Sphinx/html");
+ }
+}
#endif
- exe_dir = cmSystemTools::GetActualCaseForPath(exe_dir);
- cmSystemToolsCMakeCommand =
- cmStrCat(exe_dir, "/cmake", cmSystemTools::GetExecutableExtension());
+}
+
+void cmSystemTools::FindCMakeResources(char const* argv0)
+{
+ std::string exe = FindOwnExecutable(argv0);
#ifdef CMAKE_BOOTSTRAP
+ // The bootstrap cmake knows its resource locations.
+ cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
+ cmSystemToolsCMakeCommand = exe;
// The bootstrap cmake does not provide the other tools,
// so use the directory where they are about to be built.
- exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
+ std::string exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
+#else
+ // Find resources relative to our own executable.
+ std::string exe_dir = cmSystemTools::GetFilenamePath(exe);
+ bool found = false;
+ // When running through a symlink to our own executable,
+ // preserve symlinks in directory components if possible.
+ do {
+ found = FindCMakeResourcesInInstallTree(exe_dir);
+ } while (!found && ResolveSymlinkToOwnExecutable(exe, exe_dir));
+ // If we have not yet found the resources, the above loop will
+ // have left 'exe' referring to a real file, not a symlink, so
+ // all our binaries should exist under 'exe_dir'. However, the
+ // resources may be discoverable only in the real path.
+ if (!found) {
+ found =
+ FindCMakeResourcesInInstallTree(cmSystemTools::GetRealPath(exe_dir));
+ }
+ if (!found) {
+ FindCMakeResourcesInBuildTree(exe_dir);
+ }
+ cmSystemToolsCMakeCommand =
+ cmStrCat(exe_dir, "/cmake", cmSystemTools::GetExecutableExtension());
#endif
cmSystemToolsCTestCommand =
cmStrCat(exe_dir, "/ctest", cmSystemTools::GetExecutableExtension());
@@ -2605,52 +3211,6 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
if (!cmSystemTools::FileExists(cmSystemToolsCMClDepsCommand)) {
cmSystemToolsCMClDepsCommand.clear();
}
-
-#ifndef CMAKE_BOOTSTRAP
- // Install tree has
- // - "<prefix><CMAKE_BIN_DIR>/cmake"
- // - "<prefix><CMAKE_DATA_DIR>"
- // - "<prefix><CMAKE_DOC_DIR>"
- if (cmHasLiteralSuffix(exe_dir, CMAKE_BIN_DIR)) {
- std::string const prefix =
- exe_dir.substr(0, exe_dir.size() - cmStrLen(CMAKE_BIN_DIR));
- cmSystemToolsCMakeRoot = cmStrCat(prefix, CMAKE_DATA_DIR);
- if (cmSystemTools::FileExists(
- cmStrCat(prefix, CMAKE_DOC_DIR "/html/index.html"))) {
- cmSystemToolsHTMLDoc = cmStrCat(prefix, CMAKE_DOC_DIR "/html");
- }
- }
- if (cmSystemToolsCMakeRoot.empty() ||
- !cmSystemTools::FileExists(
- cmStrCat(cmSystemToolsCMakeRoot, "/Modules/CMake.cmake"))) {
- // Build tree has "<build>/bin[/<config>]/cmake" and
- // "<build>/CMakeFiles/CMakeSourceDir.txt".
- std::string dir = cmSystemTools::GetFilenamePath(exe_dir);
- std::string src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt");
- cmsys::ifstream fin(src_dir_txt.c_str());
- std::string src_dir;
- if (fin && cmSystemTools::GetLineFromStream(fin, src_dir) &&
- cmSystemTools::FileIsDirectory(src_dir)) {
- cmSystemToolsCMakeRoot = src_dir;
- } else {
- dir = cmSystemTools::GetFilenamePath(dir);
- src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt");
- cmsys::ifstream fin2(src_dir_txt.c_str());
- if (fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) &&
- cmSystemTools::FileIsDirectory(src_dir)) {
- cmSystemToolsCMakeRoot = src_dir;
- }
- }
- if (!cmSystemToolsCMakeRoot.empty() && cmSystemToolsHTMLDoc.empty() &&
- cmSystemTools::FileExists(
- cmStrCat(dir, "/Utilities/Sphinx/html/index.html"))) {
- cmSystemToolsHTMLDoc = cmStrCat(dir, "/Utilities/Sphinx/html");
- }
- }
-#else
- // Bootstrap build knows its source.
- cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
-#endif
}
std::string const& cmSystemTools::GetCMakeCommand()
@@ -2737,13 +3297,21 @@ cm::optional<std::string> cmSystemTools::GetCMakeConfigDirectory()
return config;
}
-std::string cmSystemTools::GetCurrentWorkingDirectory()
+std::string const& cmSystemTools::GetLogicalWorkingDirectory()
+{
+ return cmSystemToolsLogicalWorkingDirectory;
+}
+
+cmsys::Status cmSystemTools::SetLogicalWorkingDirectory(std::string const& lwd)
{
- return cmSystemTools::CollapseFullPath(
- cmsys::SystemTools::GetCurrentWorkingDirectory());
+ cmsys::Status status = cmSystemTools::ChangeDirectory(lwd);
+ if (status) {
+ cmSystemToolsLogicalWorkingDirectory = lwd;
+ }
+ return status;
}
-void cmSystemTools::MakefileColorEcho(int color, const char* message,
+void cmSystemTools::MakefileColorEcho(int color, char const* message,
bool newline, bool enabled)
{
// On some platforms (an MSYS prompt) cmsysTerminal may not be able
@@ -2861,13 +3429,13 @@ struct cmSystemToolsRPathInfo
std::string Value;
};
-using EmptyCallback = std::function<bool(std::string*, const cmELF&)>;
+using EmptyCallback = std::function<bool(std::string*, cmELF const&)>;
using AdjustCallback = std::function<bool(
- cm::optional<std::string>&, const std::string&, const char*, std::string*)>;
+ cm::optional<std::string>&, std::string const&, char const*, std::string*)>;
cm::optional<bool> AdjustRPathELF(std::string const& file,
- const EmptyCallback& emptyCallback,
- const AdjustCallback& adjustCallback,
+ EmptyCallback const& emptyCallback,
+ AdjustCallback const& adjustCallback,
std::string* emsg, bool* changed)
{
if (changed) {
@@ -2890,7 +3458,7 @@ cm::optional<bool> AdjustRPathELF(std::string const& file,
// Get the RPATH and RUNPATH entries from it.
int se_count = 0;
cmELF::StringEntry const* se[2] = { nullptr, nullptr };
- const char* se_name[2] = { nullptr, nullptr };
+ char const* se_name[2] = { nullptr, nullptr };
if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
se[se_count] = se_rpath;
se_name[se_count] = "RPATH";
@@ -2957,6 +3525,11 @@ cm::optional<bool> AdjustRPathELF(std::string const& file,
return cmSystemTools::RemoveRPath(file, emsg, changed);
}
+ FileModeGuard file_mode_guard(file, emsg);
+ if (file_mode_guard.HasErrors()) {
+ return false;
+ }
+
{
// Open the file for update.
cmsys::ofstream f(file.c_str(),
@@ -2996,6 +3569,10 @@ cm::optional<bool> AdjustRPathELF(std::string const& file,
}
}
+ if (!file_mode_guard.Restore(emsg)) {
+ return false;
+ }
+
// Everything was updated successfully.
if (changed) {
*changed = true;
@@ -3003,10 +3580,10 @@ cm::optional<bool> AdjustRPathELF(std::string const& file,
return true;
}
-std::function<bool(std::string*, const cmELF&)> MakeEmptyCallback(
- const std::string& newRPath)
+std::function<bool(std::string*, cmELF const&)> MakeEmptyCallback(
+ std::string const& newRPath)
{
- return [newRPath](std::string* emsg, const cmELF& elf) -> bool {
+ return [newRPath](std::string* emsg, cmELF const& elf) -> bool {
if (newRPath.empty()) {
// The new rpath is empty and there is no rpath anyway so it is
// okay.
@@ -3030,7 +3607,7 @@ static cm::optional<bool> ChangeRPathELF(std::string const& file,
{
auto adjustCallback = [oldRPath, newRPath, removeEnvironmentRPath](
cm::optional<std::string>& outRPath,
- const std::string& inRPath, const char* se_name,
+ std::string const& inRPath, char const* se_name,
std::string* emsg2) -> bool {
// Make sure the current rpath contains the old rpath.
std::string::size_type pos = cmSystemToolsFindRPath(inRPath, oldRPath);
@@ -3083,8 +3660,8 @@ static cm::optional<bool> SetRPathELF(std::string const& file,
std::string* emsg, bool* changed)
{
auto adjustCallback = [newRPath](cm::optional<std::string>& outRPath,
- const std::string& inRPath,
- const char* /*se_name*/, std::string*
+ std::string const& inRPath,
+ char const* /*se_name*/, std::string*
/*emsg*/) -> bool {
if (inRPath != newRPath) {
outRPath = newRPath;
@@ -3231,11 +3808,11 @@ bool cmSystemTools::SetRPath(std::string const& file,
}
namespace {
-bool VersionCompare(cmSystemTools::CompareOp op, const char* lhss,
- const char* rhss)
+bool VersionCompare(cmSystemTools::CompareOp op, char const* lhss,
+ char const* rhss)
{
- const char* endl = lhss;
- const char* endr = rhss;
+ char const* endl = lhss;
+ char const* endr = rhss;
while (((*endl >= '0') && (*endl <= '9')) ||
((*endr >= '0') && (*endr <= '9'))) {
@@ -3248,8 +3825,8 @@ bool VersionCompare(cmSystemTools::CompareOp op, const char* lhss,
endr++;
}
- const char* beginl = endl;
- const char* beginr = endr;
+ char const* beginl = endl;
+ char const* beginr = endr;
// count significant digits
while ((*endl >= '0') && (*endl <= '9')) {
@@ -3289,13 +3866,13 @@ bool VersionCompare(cmSystemTools::CompareOp op, const char* lhss,
}
bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
- const std::string& lhs,
- const std::string& rhs)
+ std::string const& lhs,
+ std::string const& rhs)
{
return ::VersionCompare(op, lhs.c_str(), rhs.c_str());
}
bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
- const std::string& lhs, const char rhs[])
+ std::string const& lhs, char const rhs[])
{
return ::VersionCompare(op, lhs.c_str(), rhs);
}
@@ -3319,8 +3896,8 @@ bool cmSystemTools::VersionCompareGreaterEq(std::string const& lhs,
rhs);
}
-static size_t cm_strverscmp_find_first_difference_or_end(const char* lhs,
- const char* rhs)
+static size_t cm_strverscmp_find_first_difference_or_end(char const* lhs,
+ char const* rhs)
{
size_t i = 0;
/* Step forward until we find a difference or both strings end together.
@@ -3331,7 +3908,7 @@ static size_t cm_strverscmp_find_first_difference_or_end(const char* lhs,
return i;
}
-static size_t cm_strverscmp_find_digits_begin(const char* s, size_t i)
+static size_t cm_strverscmp_find_digits_begin(char const* s, size_t i)
{
/* Step back until we are not preceded by a digit. */
while (i > 0 && isdigit(s[i - 1])) {
@@ -3340,7 +3917,7 @@ static size_t cm_strverscmp_find_digits_begin(const char* s, size_t i)
return i;
}
-static size_t cm_strverscmp_find_digits_end(const char* s, size_t i)
+static size_t cm_strverscmp_find_digits_end(char const* s, size_t i)
{
/* Step forward over digits. */
while (isdigit(s[i])) {
@@ -3349,7 +3926,7 @@ static size_t cm_strverscmp_find_digits_end(const char* s, size_t i)
return i;
}
-static size_t cm_strverscmp_count_leading_zeros(const char* s, size_t b)
+static size_t cm_strverscmp_count_leading_zeros(char const* s, size_t b)
{
size_t i = b;
/* Step forward over zeros that are followed by another digit. */
@@ -3359,7 +3936,7 @@ static size_t cm_strverscmp_count_leading_zeros(const char* s, size_t b)
return i - b;
}
-static int cm_strverscmp(const char* lhs, const char* rhs)
+static int cm_strverscmp(char const* lhs, char const* rhs)
{
size_t const i = cm_strverscmp_find_first_difference_or_end(lhs, rhs);
if (lhs[i] != rhs[i]) {
@@ -3489,6 +4066,11 @@ static cm::optional<bool> RemoveRPathELF(std::string const& file,
bytesBegin = elf.GetDynamicEntryPosition(0);
}
+ FileModeGuard file_mode_guard(file, emsg);
+ if (file_mode_guard.HasErrors()) {
+ return false;
+ }
+
// Open the file for update.
cmsys::ofstream f(file.c_str(),
std::ios::in | std::ios::out | std::ios::binary);
@@ -3532,6 +4114,13 @@ static cm::optional<bool> RemoveRPathELF(std::string const& file,
}
}
+ // Close the handle to allow further operations on the file
+ f.close();
+
+ if (!file_mode_guard.Restore(emsg)) {
+ return false;
+ }
+
// Everything was updated successfully.
if (removed) {
*removed = true;
@@ -3550,15 +4139,28 @@ static cm::optional<bool> RemoveRPathXCOFF(std::string const& file,
(void)emsg;
return cm::nullopt; // Cannot handle XCOFF files.
#else
- cmXCOFF xcoff(file.c_str(), cmXCOFF::Mode::ReadWrite);
- if (!xcoff) {
- return cm::nullopt; // Not a valid XCOFF file.
+ bool rm = false;
+
+ FileModeGuard file_mode_guard(file, emsg);
+ if (file_mode_guard.HasErrors()) {
+ return false;
}
- bool rm = xcoff.RemoveLibPath();
- if (!xcoff) {
- if (emsg) {
- *emsg = xcoff.GetErrorMessage();
+
+ {
+ cmXCOFF xcoff(file.c_str(), cmXCOFF::Mode::ReadWrite);
+ if (!xcoff) {
+ return cm::nullopt; // Not a valid XCOFF file.
+ }
+ rm = xcoff.RemoveLibPath();
+ if (!xcoff) {
+ if (emsg) {
+ *emsg = xcoff.GetErrorMessage();
+ }
+ return false;
}
+ }
+
+ if (!file_mode_guard.Restore(emsg)) {
return false;
}
@@ -3623,7 +4225,7 @@ bool cmSystemTools::CheckRPath(std::string const& file,
return newRPath.empty();
}
-bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
+bool cmSystemTools::RepeatedRemoveDirectory(std::string const& dir)
{
#ifdef _WIN32
// Windows sometimes locks files temporarily so try a few times.
@@ -3670,6 +4272,38 @@ std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes)
return out;
}
+cm::optional<cmSystemTools::DirCase> cmSystemTools::GetDirCase(
+ std::string const& dir)
+{
+ if (!cmSystemTools::FileIsDirectory(dir)) {
+ return cm::nullopt;
+ }
+#if defined(_WIN32) || defined(__APPLE__)
+ return DirCase::Insensitive;
+#elif defined(__linux__)
+ int fd = open(dir.c_str(), O_RDONLY);
+ if (fd == -1) {
+ // cannot open dir but it exists, assume dir is case sensitive.
+ return DirCase::Sensitive;
+ }
+ int attr = 0;
+ int ioctl_res = ioctl(fd, FS_IOC_GETFLAGS, &attr);
+ close(fd);
+
+ if (ioctl_res == -1) {
+ return DirCase::Sensitive;
+ }
+
+ // FS_CASEFOLD_FD from linux/fs.h, in Linux libc-dev 5.4+
+ // For compat with old libc-dev, define it here.
+ int const CMAKE_FS_CASEFOLD_FL = 0x40000000;
+ return (attr & CMAKE_FS_CASEFOLD_FL) != 0 ? DirCase::Insensitive
+ : DirCase::Sensitive;
+#else
+ return DirCase::Sensitive;
+#endif
+}
+
cmsys::Status cmSystemTools::CreateSymlink(std::string const& origName,
std::string const& newName)
{
@@ -3763,7 +4397,7 @@ cm::string_view cmSystemTools::GetSystemName()
}
// fix for BSD/OS, remove the /
- static const cmsys::RegularExpression bsdOsRegex("BSD.OS");
+ static cmsys::RegularExpression const bsdOsRegex("BSD.OS");
cmsys::RegularExpressionMatch match;
if (bsdOsRegex.find(uts_name.sysname, match)) {
systemName = "BSDOS";
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 0531f63..892da76 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,6 +41,26 @@ public:
using Encoding = cmProcessOutput::Encoding;
/**
+ * Return a lower case string
+ */
+ static std::string LowerCase(cm::string_view);
+ static std::string LowerCase(char const* s)
+ {
+ return LowerCase(cm::string_view{ s });
+ }
+ using cmsys::SystemTools::LowerCase;
+
+ /**
+ * Return an upper case string
+ */
+ static std::string UpperCase(cm::string_view);
+ static std::string UpperCase(char const* s)
+ {
+ return UpperCase(cm::string_view{ s });
+ }
+ using cmsys::SystemTools::UpperCase;
+
+ /**
* Look for and replace registry values in a string
*/
static void ExpandRegistryValues(std::string& source,
@@ -50,7 +70,7 @@ public:
static std::string HelpFileName(cm::string_view);
using MessageCallback =
- std::function<void(const std::string&, const cmMessageMetadata&)>;
+ std::function<void(std::string const&, cmMessageMetadata const&)>;
/**
* Set the function used by GUIs to display error messages
* Function gets passed: message as a const char*,
@@ -61,22 +81,22 @@ public:
/**
* Display an error message.
*/
- static void Error(const std::string& m);
+ static void Error(std::string const& m);
/**
* Display a message.
*/
- static void Message(const std::string& m, const char* title = nullptr);
- static void Message(const std::string& m, const cmMessageMetadata& md);
+ static void Message(std::string const& m, char const* title = nullptr);
+ static void Message(std::string const& m, cmMessageMetadata const& md);
using OutputCallback = std::function<void(std::string const&)>;
//! Send a string to stdout
- static void Stdout(const std::string& s);
+ static void Stdout(std::string const& s);
static void SetStdoutCallback(OutputCallback f);
//! Send a string to stderr
- static void Stderr(const std::string& s);
+ static void Stderr(std::string const& s);
static void SetStderrCallback(OutputCallback f);
using InterruptCallback = std::function<bool()>;
@@ -109,17 +129,17 @@ public:
}
//! Return true if the path is a framework
- static bool IsPathToFramework(const std::string& path);
+ static bool IsPathToFramework(std::string const& path);
//! Return true if the path is a xcframework
- static bool IsPathToXcFramework(const std::string& path);
+ static bool IsPathToXcFramework(std::string const& path);
//! Return true if the path is a macOS non-framework shared library (aka
//! .dylib)
- static bool IsPathToMacOSSharedLibrary(const std::string& path);
+ static bool IsPathToMacOSSharedLibrary(std::string const& path);
static bool DoesFileExistWithExtensions(
- const std::string& name, const std::vector<std::string>& sourceExts);
+ std::string const& name, std::vector<std::string> const& sourceExts);
/**
* Check if the given file exists in one of the parent directory of the
@@ -127,12 +147,12 @@ public:
* Toplevel specifies the top-most directory to where it will look.
*/
static std::string FileExistsInParentDirectories(
- const std::string& fname, const std::string& directory,
- const std::string& toplevel);
+ std::string const& fname, std::string const& directory,
+ std::string const& toplevel);
- static void Glob(const std::string& directory, const std::string& regexp,
+ static void Glob(std::string const& directory, std::string const& regexp,
std::vector<std::string>& files);
- static void GlobDirs(const std::string& fullPath,
+ static void GlobDirs(std::string const& fullPath,
std::vector<std::string>& files);
/**
@@ -144,7 +164,7 @@ public:
* want to find. 0 means all files, -1 means directories, 1 means
* files only. This method returns true if search was successful.
*/
- static bool SimpleGlob(const std::string& glob,
+ static bool SimpleGlob(std::string const& glob,
std::vector<std::string>& files, int type = 0);
enum class CopyWhen
@@ -180,9 +200,9 @@ public:
* Note that this function may modify \p path even if it does not succeed.
*/
static cmsys::Status MakeTempDirectory(char* path,
- const mode_t* mode = nullptr);
+ mode_t const* mode = nullptr);
static cmsys::Status MakeTempDirectory(std::string& path,
- const mode_t* mode = nullptr);
+ mode_t const* mode = nullptr);
/** Copy a file. */
static CopyResult CopySingleFile(std::string const& oldname,
@@ -204,15 +224,29 @@ public:
/** Rename a file or directory within a single disk volume (atomic
if possible). */
- static bool RenameFile(const std::string& oldname,
- const std::string& newname);
+ static bool RenameFile(std::string const& oldname,
+ std::string const& newname);
static RenameResult RenameFile(std::string const& oldname,
std::string const& newname, Replace replace,
std::string* err = nullptr);
//! Rename a file if contents are different, delete the source otherwise
- static cmsys::Status MoveFileIfDifferent(const std::string& source,
- const std::string& destination);
+ static cmsys::Status MoveFileIfDifferent(std::string const& source,
+ std::string const& destination);
+
+ /**
+ * According to the CreateProcessW documentation:
+ *
+ * To run a batch file, you must start the command interpreter; set
+ * lpApplicationName to cmd.exe and set lpCommandLine to the following
+ * arguments: /c plus the name of the batch file.
+ *
+ * Additionally, "cmd /c" does not always parse batch file names correctly
+ * if they contain spaces, but using "cmd /c call" seems to work.
+ *
+ * The function is noop on platforms different from the pure WIN32 one.
+ */
+ static void MaybePrependCmdExe(std::vector<std::string>& cmdLine);
/**
* Run a single executable command
@@ -243,11 +277,11 @@ public:
OUTPUT_FORWARD,
OUTPUT_PASSTHROUGH
};
- static bool RunSingleCommand(const std::string& command,
+ static bool RunSingleCommand(std::string const& command,
std::string* captureStdOut = nullptr,
std::string* captureStdErr = nullptr,
int* retVal = nullptr,
- const char* dir = nullptr,
+ char const* dir = nullptr,
OutputOption outputflag = OUTPUT_MERGE,
cmDuration timeout = cmDuration::zero());
/**
@@ -259,7 +293,7 @@ public:
std::string* captureStdOut = nullptr,
std::string* captureStdErr = nullptr,
int* retVal = nullptr,
- const char* dir = nullptr,
+ char const* dir = nullptr,
OutputOption outputflag = OUTPUT_MERGE,
cmDuration timeout = cmDuration::zero(),
Encoding encoding = cmProcessOutput::Auto);
@@ -269,14 +303,14 @@ public:
/**
* Parse arguments out of a single string command
*/
- static std::vector<std::string> ParseArguments(const std::string& command);
+ static std::vector<std::string> ParseArguments(std::string const& command);
/** Parse arguments out of a windows command line string. */
- static void ParseWindowsCommandLine(const char* command,
+ static void ParseWindowsCommandLine(char const* command,
std::vector<std::string>& args);
/** Parse arguments out of a unix command line string. */
- static void ParseUnixCommandLine(const char* command,
+ static void ParseUnixCommandLine(char const* command,
std::vector<std::string>& args);
/** Split a command-line string into the parsed command and the unparsed
@@ -309,10 +343,10 @@ public:
/**
* Compare versions
*/
- static bool VersionCompare(CompareOp op, const std::string& lhs,
- const std::string& rhs);
- static bool VersionCompare(CompareOp op, const std::string& lhs,
- const char rhs[]);
+ static bool VersionCompare(CompareOp op, std::string const& lhs,
+ std::string const& rhs);
+ static bool VersionCompare(CompareOp op, std::string const& lhs,
+ char const rhs[]);
static bool VersionCompareEqual(std::string const& lhs,
std::string const& rhs);
static bool VersionCompareGreater(std::string const& lhs,
@@ -338,7 +372,7 @@ public:
/** Call cmSystemTools::Error with the message m, plus the
* result of strerror(errno)
*/
- static void ReportLastSystemError(const char* m);
+ static void ReportLastSystemError(char const* m);
enum class WaitForLineResult
{
@@ -365,7 +399,7 @@ public:
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
// be used when RunCommand is called from cmake, because the
// running cmake needs paths to be in its format
- static std::string ConvertToRunCommandPath(const std::string& path);
+ static std::string ConvertToRunCommandPath(std::string const& path);
/**
* For windows computes the long path for the given path,
@@ -399,11 +433,24 @@ public:
std::string const& in);
static cm::optional<std::string> GetEnvVar(std::string const& var);
- static std::vector<std::string> SplitEnvPath(std::string const& value);
+ static std::vector<std::string> GetEnvPathNormalized(std::string const& var);
+
+ static std::vector<std::string> SplitEnvPath(cm::string_view in);
+ static std::vector<std::string> SplitEnvPathNormalized(cm::string_view in);
+
+ /** Convert an input path to an absolute path with no '/..' components.
+ Backslashes in the input path are converted to forward slashes.
+ Relative paths are interpreted w.r.t. GetLogicalWorkingDirectory.
+ This is similar to 'realpath', but preserves symlinks that are
+ not erased by '../' components.
+
+ On Windows and macOS, the on-disk capitalization is loaded for
+ existing paths. */
+ static std::string ToNormalizedPathOnDisk(std::string p);
#ifndef CMAKE_BOOTSTRAP
/** Remove an environment variable */
- static bool UnsetEnv(const char* value);
+ static bool UnsetEnv(char const* value);
/** Get the list of all environment variables */
static std::vector<std::string> GetEnvironmentVariables();
@@ -426,16 +473,16 @@ public:
* Add a single variable (or remove if no = sign) to the current
* environment diff.
*/
- void PutEnv(const std::string& env);
+ void PutEnv(std::string const& env);
/** Remove a single variable from the current environment diff. */
- void UnPutEnv(const std::string& env);
+ void UnPutEnv(std::string const& env);
/**
* Apply an ENVIRONMENT_MODIFICATION operation to this diff. Returns
* false and issues an error on parse failure.
*/
- bool ParseOperation(const std::string& envmod);
+ bool ParseOperation(std::string const& envmod);
/**
* Apply this diff to the actual environment, optionally writing out the
@@ -493,27 +540,36 @@ public:
No
};
- static bool ListTar(const std::string& outFileName,
- const std::vector<std::string>& files, bool verbose);
- static bool CreateTar(const std::string& outFileName,
- const std::vector<std::string>& files,
- const std::string& workingDirectory,
+ static bool ListTar(std::string const& outFileName,
+ std::vector<std::string> const& files, bool verbose);
+ static bool CreateTar(std::string const& outFileName,
+ std::vector<std::string> const& files,
+ std::string const& workingDirectory,
cmTarCompression compressType, bool verbose,
std::string const& mtime = std::string(),
std::string const& format = std::string(),
int compressionLevel = 0);
- static bool ExtractTar(const std::string& inFileName,
- const std::vector<std::string>& files,
+ static bool ExtractTar(std::string const& inFileName,
+ std::vector<std::string> const& files,
cmTarExtractTimestamps extractTimestamps,
bool verbose);
static void EnsureStdPipes();
- /** Random seed generation. */
+ /** Random number generation. */
static unsigned int RandomSeed();
+ static unsigned int RandomNumber();
+
+ /**
+ * Find an executable in the system PATH, with optional extra paths.
+ * This wraps KWSys's FindProgram to add ToNormalizedPathOnDisk.
+ */
+ static std::string FindProgram(
+ std::string const& name,
+ std::vector<std::string> const& path = std::vector<std::string>());
/** Find the directory containing CMake executables. */
- static void FindCMakeResources(const char* argv0);
+ static void FindCMakeResources(char const* argv0);
/** Get the CMake resource paths, after FindCMakeResources. */
static std::string const& GetCTestCommand();
@@ -529,11 +585,14 @@ public:
static cm::optional<std::string> GetSystemConfigDirectory();
static cm::optional<std::string> GetCMakeConfigDirectory();
- /** Get the CWD mapped through the KWSys translation map. */
- static std::string GetCurrentWorkingDirectory();
+ static std::string const& GetLogicalWorkingDirectory();
+
+ /** The logical working directory may contain symlinks but must not
+ contain any '../' path components. */
+ static cmsys::Status SetLogicalWorkingDirectory(std::string const& lwd);
/** Echo a message in color using KWSys's Terminal cprintf. */
- static void MakefileColorEcho(int color, const char* message, bool newLine,
+ static void MakefileColorEcho(int color, char const* message, bool newLine,
bool enabled);
/** Try to guess the soname of a shared library. */
@@ -564,12 +623,21 @@ public:
static bool CheckRPath(std::string const& file, std::string const& newRPath);
/** Remove a directory; repeat a few times in case of locked files. */
- static bool RepeatedRemoveDirectory(const std::string& dir);
+ static bool RepeatedRemoveDirectory(std::string const& dir);
/** Encode a string as a URL. */
static std::string EncodeURL(std::string const& in,
bool escapeSlashes = true);
+ enum class DirCase
+ {
+ Sensitive,
+ Insensitive,
+ };
+
+ /** Returns nullopt when `dir` is not a valid directory */
+ static cm::optional<DirCase> GetDirCase(std::string const& dir);
+
#ifdef _WIN32
struct WindowsFileRetry
{
@@ -595,7 +663,11 @@ public:
This variant of GetRealPath also works on Windows but will
resolve subst drives too. */
static std::string GetRealPathResolvingWindowsSubst(
- const std::string& path, std::string* errorMessage = nullptr);
+ std::string const& path, std::string* errorMessage = nullptr);
+
+ /** Get the real path for a given path, removing all symlinks. */
+ static std::string GetRealPath(std::string const& path,
+ std::string* errorMessage = nullptr);
/** Perform one-time initialization of libuv. */
static void InitializeLibUV();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f1dcc76..46ef8ed 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTarget.h"
#include <algorithm>
@@ -23,7 +23,6 @@
#include "cmFileSet.h"
#include "cmFindPackageStack.h"
#include "cmGeneratorExpression.h"
-#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmList.h"
#include "cmListFileCache.h"
@@ -46,47 +45,17 @@
#include "cmake.h"
template <>
-const std::string& cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
- cmTarget const* tgt)
+std::string const& cmTargetPropertyComputer::ImportedLocation<cmTarget>(
+ cmTarget const* tgt, std::string const& config)
{
static std::string loc;
- if (tgt->IsImported()) {
- loc = tgt->ImportedGetFullPath("", cmStateEnums::RuntimeBinaryArtifact);
- return loc;
- }
-
- cmGlobalGenerator* gg = tgt->GetGlobalGenerator();
- if (!gg->GetConfigureDoneCMP0026()) {
- gg->CreateGenerationObjects();
- }
- cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName());
- loc = gt->GetLocationForBuild();
- return loc;
-}
-
-template <>
-const std::string& cmTargetPropertyComputer::ComputeLocation<cmTarget>(
- cmTarget const* tgt, const std::string& config)
-{
- static std::string loc;
- if (tgt->IsImported()) {
- loc =
- tgt->ImportedGetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
- return loc;
- }
-
- cmGlobalGenerator* gg = tgt->GetGlobalGenerator();
- if (!gg->GetConfigureDoneCMP0026()) {
- gg->CreateGenerationObjects();
- }
- cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName());
- loc = gt->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
+ assert(tgt->IsImported());
+ loc = tgt->ImportedGetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
return loc;
}
template <>
-cmValue cmTargetPropertyComputer::GetSources<cmTarget>(cmTarget const* tgt,
- cmMakefile const& mf)
+cmValue cmTargetPropertyComputer::GetSources<cmTarget>(cmTarget const* tgt)
{
cmBTStringRange entries = tgt->GetSourceEntries();
if (entries.empty()) {
@@ -94,54 +63,13 @@ cmValue cmTargetPropertyComputer::GetSources<cmTarget>(cmTarget const* tgt,
}
std::ostringstream ss;
- const char* sep = "";
+ char const* sep = "";
for (auto const& entry : entries) {
cmList files{ entry.Value };
for (std::string const& file : files) {
- if (cmHasLiteralPrefix(file, "$<TARGET_OBJECTS:") &&
- file.back() == '>') {
- std::string objLibName = file.substr(17, file.size() - 18);
-
- if (cmGeneratorExpression::Find(objLibName) != std::string::npos) {
- ss << sep;
- sep = ";";
- ss << file;
- continue;
- }
-
- bool addContent = false;
- bool noMessage = true;
- std::ostringstream e;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (mf.GetPolicyStatus(cmPolicies::CMP0051)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n";
- noMessage = false;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- addContent = true;
- break;
- }
- if (!noMessage) {
- e << "Target \"" << tgt->GetName()
- << "\" contains $<TARGET_OBJECTS> generator expression in its "
- "sources list. This content was not previously part of the "
- "SOURCES property when that property was read at configure "
- "time. Code reading that property needs to be adapted to "
- "ignore the generator expression using the string(GENEX_STRIP) "
- "command.";
- mf.IssueMessage(messageType, e.str());
- }
- if (addContent) {
- ss << sep;
- sep = ";";
- ss << file;
- }
- } else if (cmGeneratorExpression::Find(file) == std::string::npos) {
+ if ((cmHasLiteralPrefix(file, "$<TARGET_OBJECTS:") &&
+ file.back() == '>') ||
+ cmGeneratorExpression::Find(file) == std::string::npos) {
ss << sep;
sep = ";";
ss << file;
@@ -223,13 +151,13 @@ struct FileSetType
template <typename ValueType>
bool WriteProperties(cmTarget* tgt, cmTargetInternals* impl,
- const std::string& prop, ValueType value,
+ std::string const& prop, ValueType value,
Action action);
std::pair<bool, cmValue> ReadProperties(cmTarget const* tgt,
cmTargetInternals const* impl,
- const std::string& prop) const;
+ std::string const& prop) const;
- void AddFileSet(const std::string& name, cmFileSetVisibility vis,
+ void AddFileSet(std::string const& name, cmFileSetVisibility vis,
cmListFileBacktrace bt);
};
@@ -250,7 +178,7 @@ struct UsageRequirementProperty
void CopyFromEntries(cmBTStringRange entries)
{
- return cm::append(this->Entries, entries);
+ cm::append(this->Entries, entries);
}
enum class Action
@@ -263,13 +191,13 @@ struct UsageRequirementProperty
template <typename ValueType>
bool Write(cmTargetInternals const* impl,
cm::optional<cmListFileBacktrace> const& bt,
- const std::string& prop, ValueType value, Action action);
+ std::string const& prop, ValueType value, Action action);
template <typename ValueType>
void WriteDirect(cmTargetInternals const* impl,
cm::optional<cmListFileBacktrace> const& bt,
ValueType value, Action action);
void WriteDirect(BT<std::string> value, Action action);
- std::pair<bool, cmValue> Read(const std::string& prop) const;
+ std::pair<bool, cmValue> Read(std::string const& prop) const;
cm::static_string_view const Name;
AppendEmpty const AppendBehavior;
@@ -354,6 +282,8 @@ struct TargetProperty
}
cm::static_string_view const Name;
+ // Explicit initialization is needed for AppleClang in Xcode 8 and below
+ // NOLINTNEXTLINE(readability-redundant-member-init)
cm::optional<cm::static_string_view> const Default = {};
InitCondition const InitConditional = InitCondition::Always;
Repetition const Repeat = Repetition::Once;
@@ -373,6 +303,8 @@ struct TargetProperty
TargetProperty const StaticTargetProperties[] = {
/* clang-format off */
+ // -- Debugger Properties
+ { "DEBUGGER_WORKING_DIRECTORY"_s, IC::ExecutableTarget },
// Compilation properties
{ "COMPILE_WARNING_AS_ERROR"_s, IC::CanCompileSources },
{ "INTERPROCEDURAL_OPTIMIZATION"_s, IC::CanCompileSources },
@@ -398,6 +330,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "OSX_ARCHITECTURES"_s, IC::CanCompileSources },
// ---- Windows
{ "MSVC_DEBUG_INFORMATION_FORMAT"_s, IC::CanCompileSources },
+ { "MSVC_RUNTIME_CHECKS"_s, IC::CanCompileSources },
{ "MSVC_RUNTIME_LIBRARY"_s, IC::CanCompileSources },
{ "VS_JUST_MY_CODE_DEBUGGING"_s, IC::CanCompileSources },
{ "VS_DEBUGGER_COMMAND"_s, IC::ExecutableTarget },
@@ -464,6 +397,7 @@ TargetProperty const StaticTargetProperties[] = {
// Linking properties
{ "LINKER_TYPE"_s, IC::CanCompileSources },
+ { "LINK_WARNING_AS_ERROR"_s, IC::CanCompileSources },
{ "ENABLE_EXPORTS"_s, IC::TargetWithSymbolExports },
{ "LINK_LIBRARIES_ONLY_TARGETS"_s, IC::NormalNonImportedTarget },
{ "LINK_LIBRARIES_STRATEGY"_s, IC::NormalNonImportedTarget },
@@ -551,6 +485,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "UNITY_BUILD_UNIQUE_ID"_s, IC::CanCompileSources },
{ "UNITY_BUILD_BATCH_SIZE"_s, "8"_s, IC::CanCompileSources },
{ "UNITY_BUILD_MODE"_s, "BATCH"_s, IC::CanCompileSources },
+ { "UNITY_BUILD_RELOCATABLE"_s, IC::CanCompileSources },
{ "OPTIMIZE_DEPENDENCIES"_s, IC::CanCompileSources },
{ "VERIFY_INTERFACE_HEADER_SETS"_s },
// -- Android
@@ -617,6 +552,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_LAUNCH_CONFIGURATION"_s, IC::NeedsXcodeAndCanCompileSources },
+ { "XCODE_SCHEME_TEST_CONFIGURATION"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_ENABLE_GPU_API_VALIDATION"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_WORKING_DIRECTORY"_s, IC::NeedsXcodeAndCanCompileSources },
@@ -626,6 +562,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "XCODE_SCHEME_MALLOC_GUARD_EDGES"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_GUARD_MALLOC"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_LAUNCH_MODE"_s, IC::NeedsXcodeAndCanCompileSources },
+ { "XCODE_SCHEME_LLDB_INIT_FILE"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_ZOMBIE_OBJECTS"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_MALLOC_STACK"_s, IC::NeedsXcodeAndCanCompileSources },
{ "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE"_s, IC::NeedsXcodeAndCanCompileSources },
@@ -706,8 +643,6 @@ public:
bool CheckImportedLibName(std::string const& prop,
std::string const& value) const;
- std::string ProcessSourceItemCMP0049(const std::string& s) const;
-
template <typename ValueType>
void AddDirectoryToFileSet(cmTarget* self, std::string const& fileSetName,
ValueType value, cm::string_view fileSetType,
@@ -769,7 +704,7 @@ cmTargetInternals::cmTargetInternals()
template <typename ValueType>
bool FileSetType::WriteProperties(cmTarget* tgt, cmTargetInternals* impl,
- const std::string& prop, ValueType value,
+ std::string const& prop, ValueType value,
Action action)
{
if (prop == this->DefaultDirectoryProperty) {
@@ -816,7 +751,7 @@ bool FileSetType::WriteProperties(cmTarget* tgt, cmTargetInternals* impl,
std::pair<bool, cmValue> FileSetType::ReadProperties(
cmTarget const* tgt, cmTargetInternals const* impl,
- const std::string& prop) const
+ std::string const& prop) const
{
bool did_read = false;
cmValue value = nullptr;
@@ -854,7 +789,7 @@ std::pair<bool, cmValue> FileSetType::ReadProperties(
return { did_read, value };
}
-void FileSetType::AddFileSet(const std::string& name, cmFileSetVisibility vis,
+void FileSetType::AddFileSet(std::string const& name, cmFileSetVisibility vis,
cmListFileBacktrace bt)
{
if (cmFileSetVisibilityIsForSelf(vis)) {
@@ -868,7 +803,7 @@ void FileSetType::AddFileSet(const std::string& name, cmFileSetVisibility vis,
template <typename ValueType>
bool UsageRequirementProperty::Write(
cmTargetInternals const* impl, cm::optional<cmListFileBacktrace> const& bt,
- const std::string& prop, ValueType value, Action action)
+ std::string const& prop, ValueType value, Action action)
{
if (prop == this->Name) {
this->WriteDirect(impl, bt, value, action);
@@ -910,7 +845,7 @@ void UsageRequirementProperty::WriteDirect(BT<std::string> value,
}
std::pair<bool, cmValue> UsageRequirementProperty::Read(
- const std::string& prop) const
+ std::string const& prop) const
{
bool did_read = false;
cmValue value = nullptr;
@@ -993,14 +928,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// Record current policies for later use.
this->impl->Makefile->RecordPolicies(this->impl->PolicyMap);
- if (this->impl->TargetType == cmStateEnums::INTERFACE_LIBRARY) {
- // This policy is checked in a few conditions. The properties relevant
- // to the policy are always ignored for cmStateEnums::INTERFACE_LIBRARY
- // targets,
- // so ensure that the conditions don't lead to nonsense.
- this->impl->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW);
- }
-
std::set<TargetProperty::InitCondition> metConditions;
metConditions.insert(TargetProperty::InitCondition::Always);
if (this->CanCompileSources()) {
@@ -1060,8 +987,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
std::string defKey;
defKey.reserve(128);
defKey += "CMAKE_";
- auto initProperty = [this, mf, &defKey](const std::string& property,
- const char* default_value) {
+ auto initProperty = [this, mf, &defKey](std::string const& property,
+ char const* default_value) {
// special init for ENABLE_EXPORTS
// For SHARED_LIBRARY, only CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS variable
// is used
@@ -1108,7 +1035,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
continue;
}
- const char* dflt = nullptr;
+ char const* dflt = nullptr;
if (tp.Default) {
dflt_storage = std::string(*tp.Default);
dflt = dflt_storage.c_str();
@@ -1139,16 +1066,16 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// if any
cmValue globals = mf->GetDefinition("CMAKE_VS_GLOBALS");
if (globals) {
- const std::string genName = mf->GetGlobalGenerator()->GetName();
+ std::string const genName = mf->GetGlobalGenerator()->GetName();
if (cmHasLiteralPrefix(genName, "Visual Studio")) {
cmList props{ *globals };
- const std::string vsGlobal = "VS_GLOBAL_";
- for (const std::string& i : props) {
+ std::string const vsGlobal = "VS_GLOBAL_";
+ for (std::string const& i : props) {
// split NAME=VALUE
- const std::string::size_type assignment = i.find('=');
+ std::string::size_type const assignment = i.find('=');
if (assignment != std::string::npos) {
- const std::string propName = vsGlobal + i.substr(0, assignment);
- const std::string propValue = i.substr(assignment + 1);
+ std::string const propName = vsGlobal + i.substr(0, assignment);
+ std::string const propValue = i.substr(assignment + 1);
initProperty(propName, propValue.c_str());
}
}
@@ -1190,12 +1117,12 @@ cmPolicies::PolicyMap const& cmTarget::GetPolicyMap() const
return this->impl->PolicyMap;
}
-const std::string& cmTarget::GetName() const
+std::string const& cmTarget::GetName() const
{
return this->impl->Name;
}
-const std::string& cmTarget::GetTemplateName() const
+std::string const& cmTarget::GetTemplateName() const
{
if (this->impl->TemplateTarget) {
return this->impl->TemplateTarget->GetTemplateName();
@@ -1215,7 +1142,7 @@ cmGlobalGenerator* cmTarget::GetGlobalGenerator() const
}
BTs<std::string> const* cmTarget::GetLanguageStandardProperty(
- const std::string& propertyName) const
+ std::string const& propertyName) const
{
auto entry = this->impl->LanguageStandardProperties.find(propertyName);
if (entry != this->impl->LanguageStandardProperties.end()) {
@@ -1227,7 +1154,7 @@ BTs<std::string> const* cmTarget::GetLanguageStandardProperty(
void cmTarget::SetLanguageStandardProperty(std::string const& lang,
std::string const& value,
- const std::string& feature)
+ std::string const& feature)
{
cmListFileBacktrace featureBacktrace;
for (auto const& entry : this->impl->CompileFeatures.Entries) {
@@ -1305,8 +1232,25 @@ bool cmTarget::IsFrameworkOnApple() const
bool cmTarget::IsArchivedAIXSharedLibrary() const
{
- return (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->IsAIX() &&
- this->GetPropertyAsBool("AIX_SHARED_LIBRARY_ARCHIVE"));
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->IsAIX()) {
+ cmValue value = this->GetProperty("AIX_SHARED_LIBRARY_ARCHIVE");
+ if (!value.IsEmpty()) {
+ return value.IsOn();
+ }
+ if (this->IsImported()) {
+ return false;
+ }
+ switch (this->GetPolicyStatusCMP0182()) {
+ case cmPolicies::WARN:
+ case cmPolicies::OLD:
+ // The OLD behavior's default is to disable shared library archives.
+ break;
+ case cmPolicies::NEW:
+ // The NEW behavior's default is to enable shared library archives.
+ return true;
+ }
+ }
+ return false;
}
bool cmTarget::IsAppBundleOnApple() const
@@ -1383,14 +1327,8 @@ void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
void cmTarget::AddSources(std::vector<std::string> const& srcs)
{
std::vector<std::string> srcFiles;
- for (auto filename : srcs) {
+ for (std::string const& filename : srcs) {
if (!cmGeneratorExpression::StartsWithGeneratorExpression(filename)) {
- if (!filename.empty()) {
- filename = this->impl->ProcessSourceItemCMP0049(filename);
- if (filename.empty()) {
- return;
- }
- }
this->impl->Makefile->GetOrCreateSource(filename);
}
srcFiles.emplace_back(filename);
@@ -1398,49 +1336,6 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
this->AddTracedSources(srcFiles);
}
-std::string cmTargetInternals::ProcessSourceItemCMP0049(
- const std::string& s) const
-{
- std::string src = s;
-
- // For backwards compatibility replace variables in source names.
- // This should eventually be removed.
- this->Makefile->ExpandVariablesInString(src);
- if (src != s) {
- std::ostringstream e;
- bool noMessage = false;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0049)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0049) << "\n";
- break;
- case cmPolicies::OLD:
- noMessage = true;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- messageType = MessageType::FATAL_ERROR;
- }
- if (!noMessage) {
- e << "Legacy variable expansion in source file \"" << s
- << "\" expanded to \"" << src << "\" in target \"" << this->Name
- << "\". This behavior will be removed in a "
- "future version of CMake.";
- this->Makefile->IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return "";
- }
- }
- }
- return src;
-}
-
-std::string cmTarget::GetSourceCMP0049(const std::string& s)
-{
- return this->impl->ProcessSourceItemCMP0049(s);
-}
-
struct CreateLocation
{
cmMakefile const* Makefile;
@@ -1450,7 +1345,7 @@ struct CreateLocation
{
}
- cmSourceFileLocation operator()(const std::string& filename) const
+ cmSourceFileLocation operator()(std::string const& filename) const
{
return cmSourceFileLocation(this->Makefile, filename);
}
@@ -1458,9 +1353,9 @@ struct CreateLocation
struct LocationMatcher
{
- const cmSourceFileLocation& Needle;
+ cmSourceFileLocation const& Needle;
- LocationMatcher(const cmSourceFileLocation& needle)
+ LocationMatcher(cmSourceFileLocation const& needle)
: Needle(needle)
{
}
@@ -1474,10 +1369,10 @@ struct LocationMatcher
struct TargetPropertyEntryFinder
{
private:
- const cmSourceFileLocation& Needle;
+ cmSourceFileLocation const& Needle;
public:
- TargetPropertyEntryFinder(const cmSourceFileLocation& needle)
+ TargetPropertyEntryFinder(cmSourceFileLocation const& needle)
: Needle(needle)
{
}
@@ -1495,7 +1390,7 @@ public:
}
};
-cmSourceFile* cmTarget::AddSource(const std::string& src, bool before)
+cmSourceFile* cmTarget::AddSource(std::string const& src, bool before)
{
cmSourceFileLocation sfl(this->impl->Makefile, src,
cmSourceFileLocationKind::Known);
@@ -1521,7 +1416,7 @@ void cmTarget::ClearDependencyInformation(cmMakefile& mf) const
}
std::string cmTarget::GetDebugGeneratorExpressions(
- const std::string& value, cmTargetLinkLibraryType llt) const
+ std::string const& value, cmTargetLinkLibraryType llt) const
{
if (llt == GENERAL_LibraryType) {
return value;
@@ -1546,7 +1441,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(
return "$<" + configString + ":" + value + ">";
}
-static std::string targetNameGenex(const std::string& lib)
+static std::string targetNameGenex(std::string const& lib)
{
return "$<TARGET_NAME:" + lib + ">";
}
@@ -1569,7 +1464,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature,
void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const
{
- const char* sigString =
+ char const* sigString =
(sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain");
s << "The uses of the " << sigString << " signature are here:\n";
for (auto const& cmd : this->impl->TLLCommands) {
@@ -1644,9 +1539,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
{
cmTarget* tgt = mf.FindTargetToUse(lib);
{
- const bool isNonImportedTarget = tgt && !tgt->IsImported();
+ bool const isNonImportedTarget = tgt && !tgt->IsImported();
- const std::string libName =
+ std::string const libName =
(isNonImportedTarget && llt != GENERAL_LibraryType)
? targetNameGenex(lib)
: lib;
@@ -1702,7 +1597,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
}
}
-void cmTarget::AddSystemIncludeDirectories(const std::set<std::string>& incs)
+void cmTarget::AddSystemIncludeDirectories(std::set<std::string> const& incs)
{
this->impl->SystemIncludeDirectories.insert(incs.begin(), incs.end());
}
@@ -1852,7 +1747,7 @@ void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
// - IDE metadata properties
// - static analysis properties
- static const std::string propertiesToCopy[] = {
+ static std::string const propertiesToCopy[] = {
// Compilation properties
"DEFINE_SYMBOL",
"DEPRECATION",
@@ -1869,6 +1764,7 @@ void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
"OSX_ARCHITECTURES",
// ---- Windows
"MSVC_DEBUG_INFORMATION_FORMAT",
+ "MSVC_RUNTIME_CHECKS",
"MSVC_RUNTIME_LIBRARY",
"VS_PLATFORM_TOOLSET",
// ---- OpenWatcom
@@ -1923,7 +1819,7 @@ void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
copyProperty(prop);
}
- static const cm::static_string_view perConfigPropertiesToCopy[] = {
+ static cm::static_string_view const perConfigPropertiesToCopy[] = {
"EXCLUDE_FROM_DEFAULT_BUILD_"_s,
"IMPORTED_CXX_MODULES_"_s,
"MAP_IMPORTED_CONFIG_"_s,
@@ -1947,7 +1843,7 @@ void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
if (xcodeGenerateScheme.IsOn()) {
#ifdef __APPLE__
- static const std::string xcodeSchemePropertiesToCopy[] = {
+ static std::string const xcodeSchemePropertiesToCopy[] = {
// FIXME: Do all of these apply? Do they matter?
"XCODE_SCHEME_ADDRESS_SANITIZER",
"XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN",
@@ -2052,15 +1948,18 @@ struct ReadOnlyProperty
{
ReadOnlyProperty(ReadOnlyCondition cond)
: Condition{ cond }
- , Policy{} {};
+ {
+ }
ReadOnlyProperty(ReadOnlyCondition cond, cmPolicies::PolicyID id)
: Condition{ cond }
- , Policy{ id } {};
+ , Policy{ id }
+ {
+ }
ReadOnlyCondition Condition;
cm::optional<cmPolicies::PolicyID> Policy;
- std::string message(const std::string& prop, cmTarget* target) const
+ std::string message(std::string const& prop, cmTarget* target) const
{
std::string msg;
if (this->Condition == ReadOnlyCondition::All) {
@@ -2073,7 +1972,7 @@ struct ReadOnlyProperty
return cmStrCat(prop, msg, target->GetName(), "\")\n");
}
- bool isReadOnly(const std::string& prop, cmMakefile* context,
+ bool isReadOnly(std::string const& prop, cmMakefile* context,
cmTarget* target) const
{
auto importedTarget = target->IsImported();
@@ -2104,8 +2003,6 @@ struct ReadOnlyProperty
case cmPolicies::OLD:
readOnly = false;
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
context->IssueMessage(MessageType::FATAL_ERROR,
this->message(prop, target));
@@ -2116,8 +2013,8 @@ struct ReadOnlyProperty
}
};
-bool IsSetableProperty(cmMakefile* context, cmTarget* target,
- const std::string& prop)
+bool IsSettableProperty(cmMakefile* context, cmTarget* target,
+ std::string const& prop)
{
using ROC = ReadOnlyCondition;
static std::unordered_map<std::string, ReadOnlyProperty> const readOnlyProps{
@@ -2148,9 +2045,9 @@ bool IsSetableProperty(cmMakefile* context, cmTarget* target,
}
}
-void cmTarget::SetProperty(const std::string& prop, cmValue value)
+void cmTarget::SetProperty(std::string const& prop, cmValue value)
{
- if (!IsSetableProperty(this->impl->Makefile, this, prop)) {
+ if (!IsSettableProperty(this->impl->Makefile, this, prop)) {
return;
}
@@ -2227,7 +2124,7 @@ void cmTarget::SetProperty(const std::string& prop, cmValue value)
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
return;
}
- const bool flag_found =
+ bool const flag_found =
(prop == propCUDA_PTX_COMPILATION &&
this->impl->Makefile->GetDefinition("_CMAKE_CUDA_PTX_FLAG")) ||
(prop == propCUDA_CUBIN_COMPILATION &&
@@ -2256,7 +2153,7 @@ void cmTarget::SetProperty(const std::string& prop, cmValue value)
->GetGlobalGenerator()
->FindTarget(value);
if (!reusedTarget) {
- const std::string e(
+ std::string const e(
"PRECOMPILE_HEADERS_REUSE_FROM set with non existing target");
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
return;
@@ -2290,12 +2187,12 @@ void cmTarget::SetProperty(const std::string& prop, cmValue value)
}
}
-void cmTarget::AppendProperty(const std::string& prop,
- const std::string& value,
+void cmTarget::AppendProperty(std::string const& prop,
+ std::string const& value,
cm::optional<cmListFileBacktrace> const& bt,
bool asString)
{
- if (!IsSetableProperty(this->impl->Makefile, this, prop)) {
+ if (!IsSettableProperty(this->impl->Makefile, this, prop)) {
return;
}
if (prop == "IMPORTED_GLOBAL") {
@@ -2506,7 +2403,7 @@ bool CheckLinkLibraryPattern(UsageRequirementProperty const& usage,
bool isValid = true;
- for (const auto& item : usage.Entries) {
+ for (auto const& item : usage.Entries) {
if (!linkPattern.find(item.Value)) {
continue;
}
@@ -2530,8 +2427,7 @@ bool CheckLinkLibraryPattern(UsageRequirementProperty const& usage,
}
void cmTarget::FinalizeTargetConfiguration(
- const cmBTStringRange& noConfigCompileDefinitions,
- cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions)
+ cmBTStringRange const& compileDefinitions)
{
if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
return;
@@ -2552,35 +2448,9 @@ void cmTarget::FinalizeTargetConfiguration(
return;
}
- for (auto const& def : noConfigCompileDefinitions) {
+ for (auto const& def : compileDefinitions) {
this->InsertCompileDefinition(def);
}
-
- auto* mf = this->GetMakefile();
- cmPolicies::PolicyStatus polSt = mf->GetPolicyStatus(cmPolicies::CMP0043);
- if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
- if (perConfigCompileDefinitions) {
- for (auto const& it : *perConfigCompileDefinitions) {
- if (cmValue val = it.second) {
- this->AppendProperty(it.first, *val);
- }
- }
- } else {
- perConfigCompileDefinitions.emplace();
- std::vector<std::string> configs =
- mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
-
- for (std::string const& c : configs) {
- std::string defPropName =
- cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(c));
- cmValue val = mf->GetProperty(defPropName);
- (*perConfigCompileDefinitions)[defPropName] = val;
- if (val) {
- this->AppendProperty(defPropName, *val);
- }
- }
- }
- }
}
void cmTarget::InsertInclude(BT<std::string> const& entry, bool before)
@@ -2628,12 +2498,12 @@ void cmTarget::InsertPrecompileHeader(BT<std::string> const& entry)
}
namespace {
-void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
- const std::string& value,
+void CheckLINK_INTERFACE_LIBRARIES(std::string const& prop,
+ std::string const& value,
cmMakefile* context, bool imported)
{
// Support imported and non-imported versions of the property.
- const char* base = (imported ? "IMPORTED_LINK_INTERFACE_LIBRARIES"
+ char const* base = (imported ? "IMPORTED_LINK_INTERFACE_LIBRARIES"
: "LINK_INTERFACE_LIBRARIES");
// Look for link-type keywords in the value.
@@ -2664,7 +2534,7 @@ void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
}
}
-void CheckINTERFACE_LINK_LIBRARIES(const std::string& value,
+void CheckINTERFACE_LINK_LIBRARIES(std::string const& value,
cmMakefile* context)
{
// Look for link-type keywords in the value.
@@ -2684,12 +2554,12 @@ void CheckINTERFACE_LINK_LIBRARIES(const std::string& value,
}
}
-void CheckIMPORTED_GLOBAL(const cmTarget* target, cmMakefile* context)
+void CheckIMPORTED_GLOBAL(cmTarget const* target, cmMakefile* context)
{
- const auto& targets = context->GetOwnedImportedTargets();
+ auto const& targets = context->GetOwnedImportedTargets();
auto it =
std::find_if(targets.begin(), targets.end(),
- [&](const std::unique_ptr<cmTarget>& importTarget) -> bool {
+ [&](std::unique_ptr<cmTarget> const& importTarget) -> bool {
return target == importTarget.get();
});
if (it == targets.end()) {
@@ -2702,7 +2572,7 @@ void CheckIMPORTED_GLOBAL(const cmTarget* target, cmMakefile* context)
}
}
-void cmTarget::CheckProperty(const std::string& prop,
+void cmTarget::CheckProperty(std::string const& prop,
cmMakefile* context) const
{
// Certain properties need checking.
@@ -2725,13 +2595,13 @@ void cmTarget::CheckProperty(const std::string& prop,
}
}
-cmValue cmTarget::GetComputedProperty(const std::string& prop,
+cmValue cmTarget::GetComputedProperty(std::string const& prop,
cmMakefile& mf) const
{
return cmTargetPropertyComputer::GetProperty(this, prop, mf);
}
-cmValue cmTarget::GetProperty(const std::string& prop) const
+cmValue cmTarget::GetProperty(std::string const& prop) const
{
static std::unordered_set<std::string> const specialProps{
propC_STANDARD,
@@ -2863,7 +2733,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
cmValue retVal = this->impl->Properties.GetPropertyValue(prop);
if (!retVal) {
- const bool chain = this->impl->Makefile->GetState()->IsPropertyChained(
+ bool const chain = this->impl->Makefile->GetState()->IsPropertyChained(
prop, cmProperty::TARGET);
if (chain) {
return this->impl->Makefile->GetStateSnapshot()
@@ -2886,7 +2756,7 @@ std::string const& cmTarget::GetSafeProperty(std::string const& prop) const
return s_empty;
}
-bool cmTarget::GetPropertyAsBool(const std::string& prop) const
+bool cmTarget::GetPropertyAsBool(std::string const& prop) const
{
return this->GetProperty(prop).IsOn();
}
@@ -2918,6 +2788,7 @@ bool cmTarget::IsNormal() const
case Visibility::Generated:
case Visibility::Imported:
case Visibility::ImportedGlobally:
+ case Visibility::Foreign:
return false;
}
assert(false && "unknown visibility (IsNormal)");
@@ -2932,6 +2803,7 @@ bool cmTarget::IsSynthetic() const
case Visibility::Normal:
case Visibility::Imported:
case Visibility::ImportedGlobally:
+ case Visibility::Foreign:
return false;
}
assert(false && "unknown visibility (IsSynthetic)");
@@ -2943,6 +2815,7 @@ bool cmTargetInternals::IsImported() const
switch (this->TargetVisibility) {
case cmTarget::Visibility::Imported:
case cmTarget::Visibility::ImportedGlobally:
+ case cmTarget::Visibility::Foreign:
return true;
case cmTarget::Visibility::Normal:
case cmTarget::Visibility::Generated:
@@ -2965,12 +2838,28 @@ bool cmTarget::IsImportedGloballyVisible() const
case Visibility::Normal:
case Visibility::Generated:
case Visibility::Imported:
+ case Visibility::Foreign:
return false;
}
assert(false && "unknown visibility (IsImportedGloballyVisible)");
return false;
}
+bool cmTarget::IsForeign() const
+{
+ switch (this->impl->TargetVisibility) {
+ case Visibility::Foreign:
+ return true;
+ case Visibility::Normal:
+ case Visibility::Generated:
+ case Visibility::Imported:
+ case Visibility::ImportedGlobally:
+ return false;
+ }
+ assert(false && "unknown visibility (isForeign)");
+ return false;
+}
+
bool cmTarget::IsPerConfig() const
{
return this->impl->PerConfig;
@@ -3018,7 +2907,7 @@ bool cmTarget::CanCompileSources() const
return false;
}
-const char* cmTarget::GetSuffixVariableInternal(
+char const* cmTarget::GetSuffixVariableInternal(
cmStateEnums::ArtifactType artifact) const
{
switch (this->GetType()) {
@@ -3062,7 +2951,7 @@ const char* cmTarget::GetSuffixVariableInternal(
return "";
}
-const char* cmTarget::GetPrefixVariableInternal(
+char const* cmTarget::GetPrefixVariableInternal(
cmStateEnums::ArtifactType artifact) const
{
switch (this->GetType()) {
@@ -3105,7 +2994,7 @@ const char* cmTarget::GetPrefixVariableInternal(
}
std::string cmTarget::ImportedGetFullPath(
- const std::string& config, cmStateEnums::ArtifactType artifact) const
+ std::string const& config, cmStateEnums::ArtifactType artifact) const
{
assert(this->IsImported());
@@ -3229,20 +3118,20 @@ std::string cmTarget::ImportedGetFullPath(
return result;
}
-const cmFileSet* cmTarget::GetFileSet(const std::string& name) const
+cmFileSet const* cmTarget::GetFileSet(std::string const& name) const
{
auto it = this->impl->FileSets.find(name);
return it == this->impl->FileSets.end() ? nullptr : &it->second;
}
-cmFileSet* cmTarget::GetFileSet(const std::string& name)
+cmFileSet* cmTarget::GetFileSet(std::string const& name)
{
auto it = this->impl->FileSets.find(name);
return it == this->impl->FileSets.end() ? nullptr : &it->second;
}
std::pair<cmFileSet*, bool> cmTarget::GetOrCreateFileSet(
- const std::string& name, const std::string& type, cmFileSetVisibility vis)
+ std::string const& name, std::string const& type, cmFileSetVisibility vis)
{
auto result = this->impl->FileSets.emplace(
name,
@@ -3258,7 +3147,7 @@ std::pair<cmFileSet*, bool> cmTarget::GetOrCreateFileSet(
return std::make_pair(&result.first->second, result.second);
}
-std::string cmTarget::GetFileSetsPropertyName(const std::string& type)
+std::string cmTarget::GetFileSetsPropertyName(std::string const& type)
{
if (type == "HEADERS") {
return "HEADER_SETS";
@@ -3269,7 +3158,7 @@ std::string cmTarget::GetFileSetsPropertyName(const std::string& type)
return "";
}
-std::string cmTarget::GetInterfaceFileSetsPropertyName(const std::string& type)
+std::string cmTarget::GetInterfaceFileSetsPropertyName(std::string const& type)
{
if (type == "HEADERS") {
return "INTERFACE_HEADER_SETS";
@@ -3296,7 +3185,7 @@ std::vector<std::string> cmTarget::GetAllInterfaceFileSets() const
std::vector<std::string> result;
auto inserter = std::back_inserter(result);
- auto appendEntries = [=](const std::vector<BT<std::string>>& entries) {
+ auto appendEntries = [=](std::vector<BT<std::string>> const& entries) {
for (auto const& entry : entries) {
cmList expanded{ entry.Value };
std::copy(expanded.begin(), expanded.end(), inserter);
@@ -3453,9 +3342,9 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, cmValue& loc,
if (cmValue iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) {
availableConfigs.assign(*iconfigs);
}
- for (auto aci = availableConfigs.begin();
- !loc && !imp && aci != availableConfigs.end(); ++aci) {
- suffix = cmStrCat('_', cmSystemTools::UpperCase(*aci));
+ for (auto it = availableConfigs.begin();
+ !loc && !imp && it != availableConfigs.end(); ++it) {
+ suffix = cmStrCat('_', cmSystemTools::UpperCase(*it));
std::string locProp = cmStrCat(locPropBase, suffix);
loc = this->GetProperty(locProp);
if (allowImp) {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index d0e9e3d..2bddec5 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -1,11 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
-#include <map>
#include <memory>
#include <set>
#include <string>
@@ -49,6 +48,7 @@ public:
Generated,
Imported,
ImportedGlobally,
+ Foreign,
};
enum class PerConfig
@@ -77,8 +77,8 @@ public:
cmGlobalGenerator* GetGlobalGenerator() const;
//! Set/Get the name of the target
- const std::string& GetName() const;
- const std::string& GetTemplateName() const;
+ std::string const& GetName() const;
+ std::string const& GetTemplateName() const;
//! Get the policy map
cmPolicies::PolicyMap const& GetPolicyMap() const;
@@ -114,8 +114,7 @@ public:
//! Add sources to the target.
void AddSources(std::vector<std::string> const& srcs);
void AddTracedSources(std::vector<std::string> const& srcs);
- std::string GetSourceCMP0049(const std::string& src);
- cmSourceFile* AddSource(const std::string& src, bool before = false);
+ cmSourceFile* AddSource(std::string const& src, bool before = false);
//! how we identify a library, by name and type
using LibraryID = std::pair<std::string, cmTargetLinkLibraryType>;
@@ -183,26 +182,26 @@ public:
std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const;
//! Set/Get a property of this target file
- void SetProperty(const std::string& prop, cmValue value);
- void SetProperty(const std::string& prop, std::nullptr_t)
+ void SetProperty(std::string const& prop, cmValue value);
+ void SetProperty(std::string const& prop, std::nullptr_t)
{
this->SetProperty(prop, cmValue{ nullptr });
}
- void SetProperty(const std::string& prop, const std::string& value)
+ void SetProperty(std::string const& prop, std::string const& value)
{
this->SetProperty(prop, cmValue(value));
}
void AppendProperty(
- const std::string& prop, const std::string& value,
+ std::string const& prop, std::string const& value,
cm::optional<cmListFileBacktrace> const& bt = cm::nullopt,
bool asString = false);
//! Might return a nullptr if the property is not set or invalid
- cmValue GetProperty(const std::string& prop) const;
+ cmValue GetProperty(std::string const& prop) const;
//! Always returns a valid pointer
std::string const& GetSafeProperty(std::string const& prop) const;
- bool GetPropertyAsBool(const std::string& prop) const;
- void CheckProperty(const std::string& prop, cmMakefile* context) const;
- cmValue GetComputedProperty(const std::string& prop, cmMakefile& mf) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
+ void CheckProperty(std::string const& prop, cmMakefile* context) const;
+ cmValue GetComputedProperty(std::string const& prop, cmMakefile& mf) const;
//! Get all properties
cmPropertyMap const& GetProperties() const;
@@ -218,6 +217,7 @@ public:
bool IsSynthetic() const;
bool IsImported() const;
bool IsImportedGloballyVisible() const;
+ bool IsForeign() const;
bool IsPerConfig() const;
bool IsRuntimeBinary() const;
bool CanCompileSources() const;
@@ -260,11 +260,9 @@ public:
void InsertPrecompileHeader(BT<std::string> const& entry);
void AppendBuildInterfaceIncludes();
- void FinalizeTargetConfiguration(
- const cmBTStringRange& noConfigCompileDefinitions,
- cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions);
+ void FinalizeTargetConfiguration(cmBTStringRange const& compileDefinitions);
- std::string GetDebugGeneratorExpressions(const std::string& value,
+ std::string GetDebugGeneratorExpressions(std::string const& value,
cmTargetLinkLibraryType llt) const;
void AddSystemIncludeDirectories(std::set<std::string> const& incs);
@@ -276,11 +274,11 @@ public:
cmTargetExport const& te) const;
BTs<std::string> const* GetLanguageStandardProperty(
- const std::string& propertyName) const;
+ std::string const& propertyName) const;
void SetLanguageStandardProperty(std::string const& lang,
std::string const& value,
- const std::string& feature);
+ std::string const& feature);
cmBTStringRange GetIncludeDirectoriesEntries() const;
@@ -314,7 +312,7 @@ public:
cmBTStringRange GetInterfaceHeaderSetsEntries() const;
cmBTStringRange GetInterfaceCxxModuleSetsEntries() const;
- std::string ImportedGetFullPath(const std::string& config,
+ std::string ImportedGetFullPath(std::string const& config,
cmStateEnums::ArtifactType artifact) const;
struct StrictTargetComparison
@@ -322,17 +320,17 @@ public:
bool operator()(cmTarget const* t1, cmTarget const* t2) const;
};
- const cmFileSet* GetFileSet(const std::string& name) const;
- cmFileSet* GetFileSet(const std::string& name);
- std::pair<cmFileSet*, bool> GetOrCreateFileSet(const std::string& name,
- const std::string& type,
+ cmFileSet const* GetFileSet(std::string const& name) const;
+ cmFileSet* GetFileSet(std::string const& name);
+ std::pair<cmFileSet*, bool> GetOrCreateFileSet(std::string const& name,
+ std::string const& type,
cmFileSetVisibility vis);
std::vector<std::string> GetAllFileSetNames() const;
std::vector<std::string> GetAllInterfaceFileSets() const;
- static std::string GetFileSetsPropertyName(const std::string& type);
- static std::string GetInterfaceFileSetsPropertyName(const std::string& type);
+ static std::string GetFileSetsPropertyName(std::string const& type);
+ static std::string GetInterfaceFileSetsPropertyName(std::string const& type);
bool HasFileSets() const;
@@ -340,9 +338,9 @@ private:
// Internal representation details.
friend class cmGeneratorTarget;
- const char* GetSuffixVariableInternal(
+ char const* GetSuffixVariableInternal(
cmStateEnums::ArtifactType artifact) const;
- const char* GetPrefixVariableInternal(
+ char const* GetPrefixVariableInternal(
cmStateEnums::ArtifactType artifact) const;
std::unique_ptr<cmTargetInternals> impl;
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 268bfac..95a3db9 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetCompileDefinitionsCommand.h"
#include "cmListFileCache.h"
@@ -17,7 +17,7 @@ public:
using cmTargetPropCommandBase::cmTargetPropCommandBase;
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -26,7 +26,7 @@ private:
}
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool /*prepend*/, bool /*system*/) override
{
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content),
@@ -34,7 +34,7 @@ private:
return true; // Successfully handled.
}
- std::string Join(const std::vector<std::string>& content) override
+ std::string Join(std::vector<std::string> const& content) override
{
std::string defs;
std::string sep;
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 54a20fd..ce6c5ad 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 37c125b..40c6c30 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetCompileFeaturesCommand.h"
#include "cmList.h"
@@ -19,7 +19,7 @@ public:
using cmTargetPropCommandBase::cmTargetPropCommandBase;
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -28,7 +28,7 @@ private:
}
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool /*prepend*/, bool /*system*/) override
{
cmStandardLevelResolver standardResolver(this->Makefile);
@@ -42,7 +42,7 @@ private:
return true; // Successfully handled.
}
- std::string Join(const std::vector<std::string>& content) override
+ std::string Join(std::vector<std::string> const& content) override
{
return cmList::to_string(content);
}
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 9dbf486..8c9eb16 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index e73a75f..2abcbd1 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetCompileOptionsCommand.h"
#include "cmList.h"
@@ -19,7 +19,7 @@ public:
using cmTargetPropCommandBase::cmTargetPropCommandBase;
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -28,7 +28,7 @@ private:
}
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool /*system*/) override
{
cmPolicies::PolicyStatus policyStatus =
@@ -43,7 +43,7 @@ private:
return true; // Successfully handled.
}
- std::string Join(const std::vector<std::string>& content) override
+ std::string Join(std::vector<std::string> const& content) override
{
return cmList::to_string(content);
}
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 1f7c684..56de699 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 4ff5eb4..26fdb8e 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index caeb54d..3c46c35 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index 7a2dd09..c28a4ef 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetIncludeDirectoriesCommand.h"
#include <set>
@@ -21,7 +21,7 @@ public:
using cmTargetPropCommandBase::cmTargetPropCommandBase;
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -30,18 +30,18 @@ private:
}
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool system) override;
void HandleInterfaceContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool system) override;
- std::string Join(const std::vector<std::string>& content) override;
+ std::string Join(std::vector<std::string> const& content) override;
};
std::string TargetIncludeDirectoriesImpl::Join(
- const std::vector<std::string>& content)
+ std::vector<std::string> const& content)
{
std::string dirs;
std::string sep;
@@ -59,7 +59,7 @@ std::string TargetIncludeDirectoriesImpl::Join(
}
bool TargetIncludeDirectoriesImpl::HandleDirectContent(
- cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
+ cmTarget* tgt, std::vector<std::string> const& content, bool prepend,
bool system)
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -81,7 +81,7 @@ bool TargetIncludeDirectoriesImpl::HandleDirectContent(
}
void TargetIncludeDirectoriesImpl::HandleInterfaceContent(
- cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
+ cmTarget* tgt, std::vector<std::string> const& content, bool prepend,
bool system)
{
this->cmTargetPropCommandBase::HandleInterfaceContent(tgt, content, prepend,
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 223da7d..128741d 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetLinkDirectoriesCommand.cxx b/Source/cmTargetLinkDirectoriesCommand.cxx
index dddb348..227f685 100644
--- a/Source/cmTargetLinkDirectoriesCommand.cxx
+++ b/Source/cmTargetLinkDirectoriesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetLinkDirectoriesCommand.h"
#include "cmGeneratorExpression.h"
@@ -20,7 +20,7 @@ public:
using cmTargetPropCommandBase::cmTargetPropCommandBase;
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -28,10 +28,10 @@ private:
"\" which is not built by this project."));
}
- std::string Join(const std::vector<std::string>& content) override;
+ std::string Join(std::vector<std::string> const& content) override;
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool /*system*/) override
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -42,11 +42,11 @@ private:
};
std::string TargetLinkDirectoriesImpl::Join(
- const std::vector<std::string>& content)
+ std::vector<std::string> const& content)
{
std::vector<std::string> directories;
- for (const auto& dir : content) {
+ for (auto const& dir : content) {
auto unixPath = dir;
cmSystemTools::ConvertToUnixSlashes(unixPath);
if (!cmSystemTools::FileIsFullPath(unixPath) &&
diff --git a/Source/cmTargetLinkDirectoriesCommand.h b/Source/cmTargetLinkDirectoriesCommand.h
index e305709..0ffe6ae 100644
--- a/Source/cmTargetLinkDirectoriesCommand.h
+++ b/Source/cmTargetLinkDirectoriesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 51dce76..be9fc8f 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetLinkLibrariesCommand.h"
#include <cassert>
@@ -25,8 +25,6 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
-#include "cmValue.h"
-#include "cmake.h"
namespace {
@@ -41,7 +39,7 @@ enum ProcessingState
ProcessingKeywordPrivateInterface
};
-const char* LinkLibraryTypeNames[3] = { "general", "debug", "optimized" };
+char const* LinkLibraryTypeNames[3] = { "general", "debug", "optimized" };
struct TLL
{
@@ -57,7 +55,7 @@ struct TLL
~TLL();
bool HandleLibrary(ProcessingState currentProcessingState,
- const std::string& lib, cmTargetLinkLibraryType llt);
+ std::string const& lib, cmTargetLinkLibraryType llt);
void AppendProperty(std::string const& prop, std::string const& value);
void AffectsProperty(std::string const& prop);
};
@@ -87,84 +85,31 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
// Lookup the target for which libraries are specified.
cmTarget* target = mf.GetGlobalGenerator()->FindTarget(args[0]);
if (!target) {
- for (const auto& importedTarget : mf.GetOwnedImportedTargets()) {
- if (importedTarget->GetName() == args[0]) {
+ for (auto const& importedTarget : mf.GetOwnedImportedTargets()) {
+ if (importedTarget->GetName() == args[0] &&
+ !importedTarget->IsForeign()) {
target = importedTarget.get();
break;
}
}
}
if (!target) {
- MessageType t = MessageType::FATAL_ERROR; // fail by default
- std::ostringstream e;
- e << "Cannot specify link libraries for target \"" << args[0] << "\" "
- << "which is not built by this project.";
- // The bad target is the only argument. Check how policy CMP0016 is set,
- // and accept, warn or fail respectively:
- if (args.size() < 2) {
- switch (mf.GetPolicyStatus(cmPolicies::CMP0016)) {
- case cmPolicies::WARN:
- t = MessageType::AUTHOR_WARNING;
- // Print the warning.
- e << "\n"
- << "CMake does not support this but it used to work accidentally "
- << "and is being allowed for compatibility."
- << "\n"
- << cmPolicies::GetPolicyWarning(cmPolicies::CMP0016);
- break;
- case cmPolicies::OLD: // OLD behavior does not warn.
- t = MessageType::MESSAGE;
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- e << "\n" << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0016);
- break;
- case cmPolicies::NEW: // NEW behavior prints the error.
- break;
- }
- }
- // Now actually print the message.
- switch (t) {
- case MessageType::AUTHOR_WARNING:
- mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- break;
- case MessageType::FATAL_ERROR:
- mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
- cmSystemTools::SetFatalErrorOccurred();
- break;
- default:
- break;
- }
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Cannot specify link libraries for target \"",
+ args[0],
+ "\" which is not built by this project."));
+ cmSystemTools::SetFatalErrorOccurred();
return true;
}
// Having a UTILITY library on the LHS is a bug.
if (target->GetType() == cmStateEnums::UTILITY) {
- std::ostringstream e;
- const char* modal = nullptr;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (mf.GetPolicyStatus(cmPolicies::CMP0039)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n";
- modal = "should";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- modal = "must";
- messageType = MessageType::FATAL_ERROR;
- break;
- }
- if (modal) {
- e << "Utility target \"" << target->GetName() << "\" " << modal
- << " not be used as the target of a target_link_libraries call.";
- mf.IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Utility target \"", target->GetName(),
+ "\" must not be used as the target of a target_link_libraries call."));
+ return false;
}
// But we might not have any libs after variable expansion.
@@ -182,7 +127,7 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
// specification if the keyword is encountered as the first argument.
ProcessingState currentProcessingState = ProcessingLinkLibraries;
- // Accumulate consectuive non-keyword arguments into one entry in
+ // Accumulate consecutive non-keyword arguments into one entry in
// order to handle unquoted generator expressions containing ';'.
std::size_t genexNesting = 0;
cm::optional<std::string> currentEntry;
@@ -364,21 +309,6 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
cmSystemTools::SetFatalErrorOccurred();
}
- const cmPolicies::PolicyStatus policy22Status =
- target->GetPolicyStatusCMP0022();
-
- // If any of the LINK_ options were given, make sure the
- // LINK_INTERFACE_LIBRARIES target property exists.
- // Use of any of the new keywords implies awareness of
- // this property. And if no libraries are named, it should
- // result in an empty link interface.
- if ((policy22Status == cmPolicies::OLD ||
- policy22Status == cmPolicies::WARN) &&
- currentProcessingState != ProcessingLinkLibraries &&
- !target->GetProperty("LINK_INTERFACE_LIBRARIES")) {
- target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
- }
-
return true;
}
@@ -408,8 +338,6 @@ TLL::TLL(cmMakefile& mf, cmTarget* target)
case cmPolicies::OLD:
this->RejectRemoteLinking = true;
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
this->EncodeRemoteReference = true;
break;
@@ -422,7 +350,7 @@ TLL::TLL(cmMakefile& mf, cmTarget* target)
}
bool TLL::HandleLibrary(ProcessingState currentProcessingState,
- const std::string& lib, cmTargetLinkLibraryType llt)
+ std::string const& lib, cmTargetLinkLibraryType llt)
{
if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
currentProcessingState != ProcessingKeywordLinkInterface) {
@@ -452,43 +380,22 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
if (!this->Target->PushTLLCommandTrace(
sig, this->Makefile.GetBacktrace().Top())) {
std::ostringstream e;
- const char* modal = nullptr;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile.GetPolicyStatus(cmPolicies::CMP0023)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n";
- modal = "should";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- modal = "must";
- messageType = MessageType::FATAL_ERROR;
- break;
- }
-
- if (modal) {
- // If the sig is a keyword form and there is a conflict, the existing
- // form must be the plain form.
- const char* existingSig =
- (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
- e << "The " << existingSig
- << " signature for target_link_libraries has "
- "already been used with the target \""
- << this->Target->GetName()
- << "\". All uses of target_link_libraries with a target " << modal
- << " be either all-keyword or all-plain.\n";
- this->Target->GetTllSignatureTraces(e,
- sig == cmTarget::KeywordTLLSignature
- ? cmTarget::PlainTLLSignature
- : cmTarget::KeywordTLLSignature);
- this->Makefile.IssueMessage(messageType, e.str());
- if (messageType == MessageType::FATAL_ERROR) {
- return false;
- }
- }
+ // If the sig is a keyword form and there is a conflict, the existing
+ // form must be the plain form.
+ char const* existingSig =
+ (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
+ e << "The " << existingSig
+ << " signature for target_link_libraries has "
+ "already been used with the target \""
+ << this->Target->GetName()
+ << "\". All uses of target_link_libraries with a target must "
+ << " be either all-keyword or all-plain.\n";
+ this->Target->GetTllSignatureTraces(e,
+ sig == cmTarget::KeywordTLLSignature
+ ? cmTarget::PlainTLLSignature
+ : cmTarget::KeywordTLLSignature);
+ this->Makefile.IssueMessage(MessageType::FATAL_ERROR, e.str());
+ return false;
}
// Handle normal case where the command was called with another keyword than
@@ -569,54 +476,6 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
// property of the target on the LHS shall be populated.)
this->AppendProperty("INTERFACE_LINK_LIBRARIES",
this->Target->GetDebugGeneratorExpressions(lib, llt));
-
- // Stop processing if called without any keyword.
- if (currentProcessingState == ProcessingLinkLibraries) {
- return true;
- }
- // Stop processing if policy CMP0022 is set to NEW.
- const cmPolicies::PolicyStatus policy22Status =
- this->Target->GetPolicyStatusCMP0022();
- if (policy22Status != cmPolicies::OLD &&
- policy22Status != cmPolicies::WARN) {
- return true;
- }
- // Stop processing if called with an INTERFACE library on the LHS.
- if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
- return true;
- }
-
- // Handle (additional) backward-compatibility case where the command was
- // called with PUBLIC / INTERFACE / LINK_PUBLIC / LINK_INTERFACE_LIBRARIES.
- // (The policy CMP0022 is not set to NEW.)
- {
- // Get the list of configurations considered to be DEBUG.
- std::vector<std::string> debugConfigs =
- this->Makefile.GetCMakeInstance()->GetDebugConfigs();
- std::string prop;
-
- // Include this library in the link interface for the target.
- if (llt == DEBUG_LibraryType || llt == GENERAL_LibraryType) {
- // Put in the DEBUG configuration interfaces.
- for (std::string const& dc : debugConfigs) {
- prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc);
- this->AppendProperty(prop, lib);
- }
- }
- if (llt == OPTIMIZED_LibraryType || llt == GENERAL_LibraryType) {
- // Put in the non-DEBUG configuration interfaces.
- this->AppendProperty("LINK_INTERFACE_LIBRARIES", lib);
-
- // Make sure the DEBUG configuration interfaces exist so that the
- // general one will not be used as a fall-back.
- for (std::string const& dc : debugConfigs) {
- prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc);
- if (!this->Target->GetProperty(prop)) {
- this->Target->SetProperty(prop, "");
- }
- }
- }
- }
return true;
}
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index bc76f3e..7635d48 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetLinkLibraryType.h b/Source/cmTargetLinkLibraryType.h
index 16ac41a..01945ba 100644
--- a/Source/cmTargetLinkLibraryType.h
+++ b/Source/cmTargetLinkLibraryType.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
enum cmTargetLinkLibraryType
diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx
index cd93835..89953fc 100644
--- a/Source/cmTargetLinkOptionsCommand.cxx
+++ b/Source/cmTargetLinkOptionsCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetLinkOptionsCommand.h"
#include "cmList.h"
@@ -18,7 +18,7 @@ public:
using cmTargetPropCommandBase::cmTargetPropCommandBase;
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -27,7 +27,7 @@ private:
}
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool /*system*/) override
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -35,7 +35,7 @@ private:
return true; // Successfully handled.
}
- std::string Join(const std::vector<std::string>& content) override
+ std::string Join(std::vector<std::string> const& content) override
{
return cmList::to_string(content);
}
diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h
index fbe7d49..7db485e 100644
--- a/Source/cmTargetLinkOptionsCommand.h
+++ b/Source/cmTargetLinkOptionsCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetPrecompileHeadersCommand.cxx b/Source/cmTargetPrecompileHeadersCommand.cxx
index 0173a92..9f763ae 100644
--- a/Source/cmTargetPrecompileHeadersCommand.cxx
+++ b/Source/cmTargetPrecompileHeadersCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetPrecompileHeadersCommand.h"
#include <utility>
@@ -17,7 +17,7 @@
namespace {
std::vector<std::string> ConvertToAbsoluteContent(
- const std::vector<std::string>& content, std::string const& baseDir)
+ std::vector<std::string> const& content, std::string const& baseDir)
{
std::vector<std::string> absoluteContent;
absoluteContent.reserve(content.size());
@@ -45,7 +45,7 @@ public:
private:
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool /*prepend*/, bool /*system*/) override
{
std::string const& base = this->Makefile->GetCurrentSourceDirectory();
@@ -56,7 +56,7 @@ private:
}
void HandleInterfaceContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool system) override
{
std::string const& base = this->Makefile->GetCurrentSourceDirectory();
@@ -64,7 +64,7 @@ private:
tgt, ConvertToAbsoluteContent(content, base), prepend, system);
}
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -72,7 +72,7 @@ private:
"\" which is not built by this project."));
}
- std::string Join(const std::vector<std::string>& content) override
+ std::string Join(std::vector<std::string> const& content) override
{
return cmList::to_string(content);
}
diff --git a/Source/cmTargetPrecompileHeadersCommand.h b/Source/cmTargetPrecompileHeadersCommand.h
index dd08a6d..7472499 100644
--- a/Source/cmTargetPrecompileHeadersCommand.h
+++ b/Source/cmTargetPrecompileHeadersCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index de2012f..9b9a708 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetPropCommandBase.h"
#include "cmExecutionStatus.h"
@@ -21,7 +21,7 @@ void cmTargetPropCommandBase::SetError(std::string const& e)
}
bool cmTargetPropCommandBase::HandleArguments(
- std::vector<std::string> const& args, const std::string& prop,
+ std::vector<std::string> const& args, std::string const& prop,
unsigned int flags)
{
if (args.size() < 2) {
@@ -42,7 +42,7 @@ bool cmTargetPropCommandBase::HandleArguments(
this->HandleMissingTarget(args[0]);
return false;
}
- const bool isRegularTarget =
+ bool const isRegularTarget =
(this->Target->GetType() == cmStateEnums::EXECUTABLE) ||
(this->Target->GetType() == cmStateEnums::STATIC_LIBRARY) ||
(this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) ||
@@ -50,7 +50,7 @@ bool cmTargetPropCommandBase::HandleArguments(
(this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
(this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) ||
(this->Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY);
- const bool isCustomTarget = this->Target->GetType() == cmStateEnums::UTILITY;
+ bool const isCustomTarget = this->Target->GetType() == cmStateEnums::UTILITY;
if (prop == "SOURCES") {
if (!isRegularTarget && !isCustomTarget) {
@@ -156,7 +156,7 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
}
bool cmTargetPropCommandBase::PopulateTargetProperties(
- const std::string& scope, const std::vector<std::string>& content,
+ std::string const& scope, std::vector<std::string> const& content,
bool prepend, bool system)
{
if (content.empty()) {
@@ -174,12 +174,12 @@ bool cmTargetPropCommandBase::PopulateTargetProperties(
}
void cmTargetPropCommandBase::HandleInterfaceContent(
- cmTarget* tgt, const std::vector<std::string>& content, bool prepend, bool)
+ cmTarget* tgt, std::vector<std::string> const& content, bool prepend, bool)
{
if (prepend) {
- const std::string propName = std::string("INTERFACE_") + this->Property;
+ std::string const propName = std::string("INTERFACE_") + this->Property;
cmValue propValue = tgt->GetProperty(propName);
- const std::string totalContent =
+ std::string const totalContent =
this->Join(content) + (propValue ? (";" + *propValue) : std::string());
tgt->SetProperty(propName, totalContent);
} else {
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index ac50b4d..9c2301f 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,7 +29,7 @@ public:
};
bool HandleArguments(std::vector<std::string> const& args,
- const std::string& prop, unsigned int flags = NO_FLAGS);
+ std::string const& prop, unsigned int flags = NO_FLAGS);
protected:
std::string Property;
@@ -37,20 +37,20 @@ protected:
cmMakefile* Makefile;
virtual void HandleInterfaceContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool system);
virtual bool PopulateTargetProperties(
- const std::string& scope, const std::vector<std::string>& content,
+ std::string const& scope, std::vector<std::string> const& content,
bool prepend, bool system);
private:
- virtual void HandleMissingTarget(const std::string& name) = 0;
+ virtual void HandleMissingTarget(std::string const& name) = 0;
virtual bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool system) = 0;
- virtual std::string Join(const std::vector<std::string>& content) = 0;
+ virtual std::string Join(std::vector<std::string> const& content) = 0;
bool ProcessContentArgs(std::vector<std::string> const& args,
unsigned int& argIndex, bool prepend, bool system);
diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx
index 134b4b6..fc21a16 100644
--- a/Source/cmTargetPropertyComputer.cxx
+++ b/Source/cmTargetPropertyComputer.cxx
@@ -1,43 +1,19 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetPropertyComputer.h"
-#include <sstream>
-
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
-bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
+void cmTargetPropertyComputer::IssueLocationPropertyError(
std::string const& tgtName, cmMakefile const& mf)
{
- std::ostringstream e;
- const char* modal = nullptr;
- MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (mf.GetPolicyStatus(cmPolicies::CMP0026)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
- modal = "should";
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- modal = "may";
- messageType = MessageType::FATAL_ERROR;
- break;
- }
-
- if (modal) {
- e << "The LOCATION property " << modal << " not be read from target \""
- << tgtName
- << "\". Use the target name directly with "
- "add_custom_command, or use the generator expression $<TARGET_FILE>, "
- "as appropriate.\n";
- mf.IssueMessage(messageType, e.str());
- }
-
- return messageType != MessageType::FATAL_ERROR;
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "The LOCATION property may not be read from target \"", tgtName,
+ "\". Use the target name directly with "
+ "add_custom_command, or use the generator expression $<TARGET_FILE>, "
+ "as appropriate.\n"));
}
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index a14a3f0..2daeb48 100644
--- a/Source/cmTargetPropertyComputer.h
+++ b/Source/cmTargetPropertyComputer.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,7 +17,7 @@ class cmTargetPropertyComputer
{
public:
template <typename Target>
- static cmValue GetProperty(Target const* tgt, const std::string& prop,
+ static cmValue GetProperty(Target const* tgt, std::string const& prop,
cmMakefile const& mf)
{
if (cmValue loc = GetLocation(tgt, prop, mf)) {
@@ -27,20 +27,18 @@ public:
return nullptr;
}
if (prop == "SOURCES") {
- return GetSources(tgt, mf);
+ return GetSources(tgt);
}
return nullptr;
}
private:
- static bool HandleLocationPropertyPolicy(std::string const& tgtName,
- cmMakefile const& mf);
+ static void IssueLocationPropertyError(std::string const& tgtName,
+ cmMakefile const& mf);
template <typename Target>
- static const std::string& ComputeLocationForBuild(Target const* tgt);
- template <typename Target>
- static const std::string& ComputeLocation(Target const* tgt,
- std::string const& config);
+ static std::string const& ImportedLocation(Target const* tgt,
+ std::string const& config);
template <typename Target>
static cmValue GetLocation(Target const* tgt, std::string const& prop,
@@ -54,23 +52,23 @@ private:
tgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
tgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
tgt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
- static const std::string propLOCATION = "LOCATION";
+ static std::string const propLOCATION = "LOCATION";
if (prop == propLOCATION) {
- if (!tgt->IsImported() &&
- !HandleLocationPropertyPolicy(tgt->GetName(), mf)) {
+ if (!tgt->IsImported()) {
+ IssueLocationPropertyError(tgt->GetName(), mf);
return nullptr;
}
- return cmValue(ComputeLocationForBuild(tgt));
+ return cmValue(ImportedLocation(tgt, std::string()));
}
// Support "LOCATION_<CONFIG>".
if (cmHasLiteralPrefix(prop, "LOCATION_")) {
- if (!tgt->IsImported() &&
- !HandleLocationPropertyPolicy(tgt->GetName(), mf)) {
+ if (!tgt->IsImported()) {
+ IssueLocationPropertyError(tgt->GetName(), mf);
return nullptr;
}
std::string configName = prop.substr(9);
- return cmValue(ComputeLocation(tgt, configName));
+ return cmValue(ImportedLocation(tgt, configName));
}
// Support "<CONFIG>_LOCATION".
@@ -78,11 +76,11 @@ private:
!cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
std::string configName(prop.c_str(), prop.size() - 9);
if (configName != "IMPORTED") {
- if (!tgt->IsImported() &&
- !HandleLocationPropertyPolicy(tgt->GetName(), mf)) {
+ if (!tgt->IsImported()) {
+ IssueLocationPropertyError(tgt->GetName(), mf);
return nullptr;
}
- return cmValue(ComputeLocation(tgt, configName));
+ return cmValue(ImportedLocation(tgt, configName));
}
}
}
@@ -90,5 +88,5 @@ private:
}
template <typename Target>
- static cmValue GetSources(Target const* tgt, cmMakefile const& mf);
+ static cmValue GetSources(Target const* tgt);
};
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index cdb9836..3e88828 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetSourcesCommand.h"
#include <sstream>
@@ -54,7 +54,7 @@ public:
protected:
void HandleInterfaceContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool prepend, bool system) override
{
this->cmTargetPropCommandBase::HandleInterfaceContent(
@@ -65,7 +65,7 @@ protected:
}
private:
- void HandleMissingTarget(const std::string& name) override
+ void HandleMissingTarget(std::string const& name) override
{
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -74,7 +74,7 @@ private:
}
bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
+ std::vector<std::string> const& content,
bool /*prepend*/, bool /*system*/) override
{
tgt->AppendProperty("SOURCES",
@@ -84,8 +84,8 @@ private:
return true; // Successfully handled.
}
- bool PopulateTargetProperties(const std::string& scope,
- const std::vector<std::string>& content,
+ bool PopulateTargetProperties(std::string const& scope,
+ std::vector<std::string> const& content,
bool prepend, bool system) override
{
if (!content.empty() && content.front() == "FILE_SET"_s) {
@@ -95,7 +95,7 @@ private:
scope, content, prepend, system);
}
- std::string Join(const std::vector<std::string>& content) override
+ std::string Join(std::vector<std::string> const& content) override
{
return cmList::to_string(content);
}
@@ -111,17 +111,17 @@ private:
No,
};
std::vector<std::string> ConvertToAbsoluteContent(
- cmTarget* tgt, const std::vector<std::string>& content,
+ cmTarget* tgt, std::vector<std::string> const& content,
IsInterface isInterfaceContent, CheckCMP0076 checkCmp0076);
- bool HandleFileSetMode(const std::string& scope,
- const std::vector<std::string>& content);
- bool HandleOneFileSet(const std::string& scope,
- const std::vector<std::string>& content);
+ bool HandleFileSetMode(std::string const& scope,
+ std::vector<std::string> const& content);
+ bool HandleOneFileSet(std::string const& scope,
+ std::vector<std::string> const& content);
};
std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
- cmTarget* tgt, const std::vector<std::string>& content,
+ cmTarget* tgt, std::vector<std::string> const& content,
IsInterface isInterfaceContent, CheckCMP0076 checkCmp0076)
{
// Skip conversion in case old behavior has been explicitly requested
@@ -165,12 +165,6 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
case cmPolicies::OLD:
issueMessage = false;
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076));
- break;
case cmPolicies::NEW: {
issueMessage = false;
useAbsoluteContent = true;
@@ -197,7 +191,7 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
}
bool TargetSourcesImpl::HandleFileSetMode(
- const std::string& scope, const std::vector<std::string>& content)
+ std::string const& scope, std::vector<std::string> const& content)
{
auto args = FileSetsArgsParser.Parse(content, /*unparsedArguments=*/nullptr);
@@ -212,7 +206,7 @@ bool TargetSourcesImpl::HandleFileSetMode(
}
bool TargetSourcesImpl::HandleOneFileSet(
- const std::string& scope, const std::vector<std::string>& content)
+ std::string const& scope, std::vector<std::string> const& content)
{
std::vector<std::string> unparsed;
auto args = FileSetArgsParser.Parse(content, &unparsed);
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index 306226c..502c2ea 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTargetTraceDependencies.cxx b/Source/cmTargetTraceDependencies.cxx
index f14cfbf..b8f5ac6 100644
--- a/Source/cmTargetTraceDependencies.cxx
+++ b/Source/cmTargetTraceDependencies.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTargetTraceDependencies.h"
#include <sstream>
@@ -39,7 +39,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
std::vector<cmSourceFile*> sources;
this->GeneratorTarget->GetSourceFiles(sources, c);
for (cmSourceFile* sf : sources) {
- const std::set<cmGeneratorTarget const*> tgts =
+ std::set<cmGeneratorTarget const*> const tgts =
this->GlobalGenerator->GetFilenameTargetDepends(sf);
if (cm::contains(tgts, this->GeneratorTarget)) {
std::ostringstream e;
@@ -242,7 +242,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
}
void cmTargetTraceDependencies::CheckCustomCommands(
- const std::vector<cmCustomCommand>& commands)
+ std::vector<cmCustomCommand> const& commands)
{
for (cmCustomCommand const& command : commands) {
this->CheckCustomCommand(command);
diff --git a/Source/cmTargetTraceDependencies.h b/Source/cmTargetTraceDependencies.h
index 5bbe8df..319779d 100644
--- a/Source/cmTargetTraceDependencies.h
+++ b/Source/cmTargetTraceDependencies.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,5 +42,5 @@ private:
void FollowNames(std::vector<std::string> const& names);
bool IsUtility(std::string const& dep);
void CheckCustomCommand(cmCustomCommand const& cc);
- void CheckCustomCommands(const std::vector<cmCustomCommand>& commands);
+ void CheckCustomCommands(std::vector<cmCustomCommand> const& commands);
};
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index c72e020..1620b46 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTest.h"
#include "cmMakefile.h"
@@ -23,7 +23,7 @@ cmListFileBacktrace const& cmTest::GetBacktrace() const
return this->Backtrace;
}
-void cmTest::SetName(const std::string& name)
+void cmTest::SetName(std::string const& name)
{
this->Name = name;
}
@@ -33,11 +33,11 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
this->Command = command;
}
-cmValue cmTest::GetProperty(const std::string& prop) const
+cmValue cmTest::GetProperty(std::string const& prop) const
{
cmValue retVal = this->Properties.GetPropertyValue(prop);
if (!retVal) {
- const bool chain =
+ bool const chain =
this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
if (chain) {
if (cmValue p = this->Makefile->GetProperty(prop, chain)) {
@@ -49,17 +49,17 @@ cmValue cmTest::GetProperty(const std::string& prop) const
return retVal;
}
-bool cmTest::GetPropertyAsBool(const std::string& prop) const
+bool cmTest::GetPropertyAsBool(std::string const& prop) const
{
return this->GetProperty(prop).IsOn();
}
-void cmTest::SetProperty(const std::string& prop, cmValue value)
+void cmTest::SetProperty(std::string const& prop, cmValue value)
{
this->Properties.SetProperty(prop, value);
}
-void cmTest::AppendProperty(const std::string& prop, const std::string& value,
+void cmTest::AppendProperty(std::string const& prop, std::string const& value,
bool asString)
{
this->Properties.AppendProperty(prop, value, asString);
diff --git a/Source/cmTest.h b/Source/cmTest.h
index 244aa62..0e62d6e 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,26 +29,26 @@ public:
~cmTest();
//! Set the test name
- void SetName(const std::string& name);
+ void SetName(std::string const& name);
std::string GetName() const { return this->Name; }
void SetCommand(std::vector<std::string> const& command);
std::vector<std::string> const& GetCommand() const { return this->Command; }
//! Set/Get a property of this source file
- void SetProperty(const std::string& prop, cmValue value);
- void SetProperty(const std::string& prop, std::nullptr_t)
+ void SetProperty(std::string const& prop, cmValue value);
+ void SetProperty(std::string const& prop, std::nullptr_t)
{
this->SetProperty(prop, cmValue{ nullptr });
}
- void SetProperty(const std::string& prop, const std::string& value)
+ void SetProperty(std::string const& prop, std::string const& value)
{
this->SetProperty(prop, cmValue(value));
}
- void AppendProperty(const std::string& prop, const std::string& value,
+ void AppendProperty(std::string const& prop, std::string const& value,
bool asString = false);
- cmValue GetProperty(const std::string& prop) const;
- bool GetPropertyAsBool(const std::string& prop) const;
+ cmValue GetProperty(std::string const& prop) const;
+ bool GetPropertyAsBool(std::string const& prop) const;
cmPropertyMap& GetProperties() { return this->Properties; }
/** Get the cmMakefile instance that owns this test. */
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index ffb5e21..83d798c 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTestGenerator.h"
#include <algorithm>
@@ -31,7 +31,7 @@
namespace /* anonymous */
{
-bool needToQuoteTestName(const cmMakefile& mf, const std::string& name)
+bool needToQuoteTestName(cmMakefile const& mf, std::string const& name)
{
// Determine if policy CMP0110 is set to NEW.
switch (mf.GetPolicyStatus(cmPolicies::CMP0110)) {
@@ -49,8 +49,6 @@ bool needToQuoteTestName(const cmMakefile& mf, const std::string& name)
case cmPolicies::OLD:
// OLD behavior is to not quote the test's name.
return false;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
default:
// NEW behavior is to quote the test's name.
@@ -58,7 +56,7 @@ bool needToQuoteTestName(const cmMakefile& mf, const std::string& name)
}
}
-std::size_t countMaxConsecutiveEqualSigns(const std::string& name)
+std::size_t countMaxConsecutiveEqualSigns(std::string const& name)
{
std::size_t max = 0;
auto startIt = find(name.begin(), name.end(), '=');
@@ -91,7 +89,7 @@ void cmTestGenerator::Compute(cmLocalGenerator* lg)
this->LG = lg;
}
-bool cmTestGenerator::TestsForConfig(const std::string& config)
+bool cmTestGenerator::TestsForConfig(std::string const& config)
{
return this->GeneratesForConfig(config);
}
@@ -122,7 +120,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os, Indent indent)
}
void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
- const std::string& config,
+ std::string const& config,
Indent indent)
{
this->TestGenerated = true;
@@ -132,11 +130,11 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
this->Test->GetBacktrace());
// Determine if policy CMP0110 is set to NEW.
- const bool quote_test_name =
+ bool const quote_test_name =
needToQuoteTestName(*this->Test->GetMakefile(), this->Test->GetName());
// Determine the number of equal-signs needed for quoting test name with
// [==[...]==] syntax.
- const std::string equalSigns(
+ std::string const equalSigns(
1 + countMaxConsecutiveEqualSigns(this->Test->GetName()), '=');
// Start the test command.
@@ -174,7 +172,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
if (!cmNonempty(launcher)) {
return;
}
- const auto propVal = ge.Parse(*launcher)->Evaluate(this->LG, config);
+ auto const propVal = ge.Parse(*launcher)->Evaluate(this->LG, config);
cmList launcherWithArgs(propVal, cmList::ExpandElements::Yes,
this->Test->GetCMP0178() == cmPolicies::NEW
? cmList::EmptyElements::Yes
@@ -251,11 +249,11 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent)
{
// Determine if policy CMP0110 is set to NEW.
- const bool quote_test_name =
+ bool const quote_test_name =
needToQuoteTestName(*this->Test->GetMakefile(), this->Test->GetName());
// Determine the number of equal-signs needed for quoting test name with
// [==[...]==] syntax.
- const std::string equalSigns(
+ std::string const equalSigns(
1 + countMaxConsecutiveEqualSigns(this->Test->GetName()), '=');
if (quote_test_name) {
@@ -280,11 +278,11 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent)
this->TestGenerated = true;
// Determine if policy CMP0110 is set to NEW.
- const bool quote_test_name =
+ bool const quote_test_name =
needToQuoteTestName(*this->Test->GetMakefile(), this->Test->GetName());
// Determine the number of equal-signs needed for quoting test name with
// [==[...]==] syntax.
- const std::string equalSigns(
+ std::string const equalSigns(
1 + countMaxConsecutiveEqualSigns(this->Test->GetName()), '=');
// Get the test command line to be executed.
@@ -347,7 +345,7 @@ void cmTestGenerator::GenerateInternalProperties(std::ostream& os)
bool prependTripleSeparator = false;
while (!bt.Empty()) {
- const auto& entry = bt.Top();
+ auto const& entry = bt.Top();
if (prependTripleSeparator) {
os << ";";
}
@@ -360,12 +358,12 @@ void cmTestGenerator::GenerateInternalProperties(std::ostream& os)
}
std::vector<std::string> cmTestGenerator::EvaluateCommandLineArguments(
- const std::vector<std::string>& argv, cmGeneratorExpression& ge,
- const std::string& config) const
+ std::vector<std::string> const& argv, cmGeneratorExpression& ge,
+ std::string const& config) const
{
// Evaluate executable name and arguments
auto evaluatedRange =
- cmMakeRange(argv).transform([&](const std::string& arg) {
+ cmMakeRange(argv).transform([&](std::string const& arg) {
return ge.Parse(arg)->Evaluate(this->LG, config);
});
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 6903140..b728ba3 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -32,20 +32,20 @@ public:
void Compute(cmLocalGenerator* lg);
/** Test if this generator installs the test for a given configuration. */
- bool TestsForConfig(const std::string& config);
+ bool TestsForConfig(std::string const& config);
cmTest* GetTest() const;
private:
void GenerateInternalProperties(std::ostream& os);
std::vector<std::string> EvaluateCommandLineArguments(
- const std::vector<std::string>& argv, cmGeneratorExpression& ge,
- const std::string& config) const;
+ std::vector<std::string> const& argv, cmGeneratorExpression& ge,
+ std::string const& config) const;
protected:
void GenerateScriptConfigs(std::ostream& os, Indent indent) override;
void GenerateScriptActions(std::ostream& os, Indent indent) override;
- void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ void GenerateScriptForConfig(std::ostream& os, std::string const& config,
Indent indent) override;
void GenerateScriptNoConfig(std::ostream& os, Indent indent) override;
bool NeedsScriptNoConfig() const override;
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index e3e3e25..82fab53 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#if !defined(_WIN32) && !defined(__sun) && !defined(__OpenBSD__)
// POSIX APIs are needed
@@ -35,7 +35,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-std::string cmTimestamp::CurrentTime(const std::string& formatString,
+std::string cmTimestamp::CurrentTime(std::string const& formatString,
bool utcFlag) const
{
// get current time with microsecond resolution
@@ -65,8 +65,8 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString,
formatString, utcFlag);
}
-std::string cmTimestamp::FileModificationTime(const char* path,
- const std::string& formatString,
+std::string cmTimestamp::FileModificationTime(char const* path,
+ std::string const& formatString,
bool utcFlag) const
{
std::string real_path =
@@ -101,7 +101,7 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
}
std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
- const uint32_t microseconds,
+ uint32_t const microseconds,
std::string formatString,
bool utcFlag) const
{
@@ -186,8 +186,8 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const
}
std::string cmTimestamp::AddTimestampComponent(
- char flag, struct tm& timeStruct, const time_t timeT, const bool utcFlag,
- const uint32_t microseconds) const
+ char flag, struct tm& timeStruct, time_t const timeT, bool const utcFlag,
+ uint32_t const microseconds) const
{
std::string formatString = cmStrCat('%', flag);
@@ -275,7 +275,7 @@ std::string cmTimestamp::AddTimestampComponent(
tmUnixEpoch.tm_mday = 1;
tmUnixEpoch.tm_year = 1970 - 1900;
- const time_t unixEpoch = this->CreateUtcTimeTFromTm(tmUnixEpoch);
+ time_t const unixEpoch = this->CreateUtcTimeTFromTm(tmUnixEpoch);
if (unixEpoch == -1) {
cmSystemTools::Error(
"Error generating UNIX epoch in string(TIMESTAMP ...) or "
@@ -301,7 +301,7 @@ std::string cmTimestamp::AddTimestampComponent(
#ifdef __MINGW32__
/* See a bug in MinGW: https://sourceforge.net/p/mingw-w64/bugs/793/. A work
* around is to try to use strftime() from ucrtbase.dll. */
- using T = size_t(__cdecl*)(char*, size_t, const char*, const struct tm*);
+ using T = size_t(__cdecl*)(char*, size_t, char const*, const struct tm*);
auto loadUcrtStrftime = []() -> T {
auto handle =
LoadLibraryExA("ucrtbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h
index 05c6342..1057cc9 100644
--- a/Source/cmTimestamp.h
+++ b/Source/cmTimestamp.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -15,10 +15,10 @@
class cmTimestamp
{
public:
- std::string CurrentTime(const std::string& formatString, bool utcFlag) const;
+ std::string CurrentTime(std::string const& formatString, bool utcFlag) const;
- std::string FileModificationTime(const char* path,
- const std::string& formatString,
+ std::string FileModificationTime(char const* path,
+ std::string const& formatString,
bool utcFlag) const;
std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString,
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index ffc4de9..e043a58 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTransformDepfile.h"
#include <algorithm>
@@ -22,7 +22,7 @@
#include "cmSystemTools.h"
namespace {
-void WriteFilenameGcc(cmsys::ofstream& fout, const std::string& filename)
+void WriteFilenameGcc(cmsys::ofstream& fout, std::string const& filename)
{
for (auto c : filename) {
switch (c) {
@@ -40,16 +40,16 @@ void WriteFilenameGcc(cmsys::ofstream& fout, const std::string& filename)
}
void WriteDepfile(cmDepfileFormat format, cmsys::ofstream& fout,
- const cmLocalGenerator& lg,
- const cmGccDepfileContent& content)
+ cmLocalGenerator const& lg,
+ cmGccDepfileContent const& content)
{
- std::function<std::string(const std::string&)> formatPath =
- [&lg](const std::string& path) -> std::string {
+ std::function<std::string(std::string const&)> formatPath =
+ [&lg](std::string const& path) -> std::string {
return lg.MaybeRelativeToTopBinDir(path);
};
if (lg.GetGlobalGenerator()->GetName() == "Xcode") {
// full paths must be preserved for Xcode compliance
- formatPath = [](const std::string& path) -> std::string { return path; };
+ formatPath = [](std::string const& path) -> std::string { return path; };
}
for (auto const& dep : content) {
@@ -91,14 +91,14 @@ void WriteMSBuildAdditionalInputs(cmsys::ofstream& fout,
}
// Write a UTF-8 BOM so MSBuild knows the encoding when reading the file.
- static const char utf8bom[] = { static_cast<char>(0xEF),
+ static char const utf8bom[] = { static_cast<char>(0xEF),
static_cast<char>(0xBB),
static_cast<char>(0xBF) };
fout.write(utf8bom, sizeof(utf8bom));
// Write the format expected by MSBuild CustomBuild AdditionalInputs.
- const char* sep = "";
- for (const auto& c : content) {
+ char const* sep = "";
+ for (auto const& c : content) {
for (std::string path : c.paths) {
if (!cmSystemTools::FileIsFullPath(path)) {
path = cmSystemTools::CollapseFullPath(path,
@@ -113,8 +113,8 @@ void WriteMSBuildAdditionalInputs(cmsys::ofstream& fout,
}
}
-bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg,
- const std::string& infile, const std::string& outfile)
+bool cmTransformDepfile(cmDepfileFormat format, cmLocalGenerator const& lg,
+ std::string const& infile, std::string const& outfile)
{
cmGccDepfileContent content;
if (cmSystemTools::FileExists(infile)) {
diff --git a/Source/cmTransformDepfile.h b/Source/cmTransformDepfile.h
index 379e8bc..2626678 100644
--- a/Source/cmTransformDepfile.h
+++ b/Source/cmTransformDepfile.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -13,5 +13,5 @@ enum class cmDepfileFormat
class cmLocalGenerator;
-bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg,
- const std::string& infile, const std::string& outfile);
+bool cmTransformDepfile(cmDepfileFormat format, cmLocalGenerator const& lg,
+ std::string const& infile, std::string const& outfile);
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index d2cc75b..9f42769 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTryCompileCommand.h"
#include <cm/optional>
@@ -22,7 +22,7 @@ void WriteTryCompileEvent(cmConfigureLog& log, cmMakefile const& mf,
cmTryCompileResult const& compileResult)
{
// Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
- static const std::vector<unsigned long> LogVersionsWithTryCompileV1{ 1 };
+ static std::vector<unsigned long> const LogVersionsWithTryCompileV1{ 1 };
if (log.IsAnyLogVersionEnabled(LogVersionsWithTryCompileV1)) {
log.BeginEvent("try_compile-v1", mf);
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 6a3430b..cdab185 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index c24c418..b0d52f8 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmTryRunCommand.h"
#include <stdexcept>
@@ -41,7 +41,7 @@ void WriteTryRunEvent(cmConfigureLog& log, cmMakefile const& mf,
cmTryRunResult const& runResult)
{
// Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
- static const std::vector<unsigned long> LogVersionsWithTryRunV1{ 1 };
+ static std::vector<unsigned long> const LogVersionsWithTryRunV1{ 1 };
if (log.IsAnyLogVersionEnabled(LogVersionsWithTryRunV1)) {
log.BeginEvent("try_run-v1", mf);
@@ -79,12 +79,12 @@ public:
bool TryRunCode(std::vector<std::string> const& args);
- void RunExecutable(const std::string& runArgs,
+ void RunExecutable(std::string const& runArgs,
cm::optional<std::string> const& workDir,
std::string* runOutputContents,
std::string* runOutputStdOutContents,
std::string* runOutputStdErrContents);
- void DoNotRunExecutable(const std::string& runArgs,
+ void DoNotRunExecutable(std::string const& runArgs,
cm::optional<std::string> const& srcFile,
std::string const& compileResultVariable,
std::string* runOutputContents,
@@ -260,7 +260,7 @@ bool TryRunCommandImpl::TryRunCode(std::vector<std::string> const& argv)
return true;
}
-void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
+void TryRunCommandImpl::RunExecutable(std::string const& runArgs,
cm::optional<std::string> const& workDir,
std::string* out, std::string* stdOut,
std::string* stdErr)
@@ -268,19 +268,13 @@ void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
int retVal = -1;
std::string finalCommand;
- const std::string& emulator =
+ std::string const& emulator =
this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
if (!emulator.empty()) {
cmList emulatorWithArgs{ emulator };
- finalCommand +=
- cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]);
- finalCommand += " ";
- for (std::string const& arg : cmMakeRange(emulatorWithArgs).advance(1)) {
- finalCommand += "\"";
- finalCommand += arg;
- finalCommand += "\"";
- finalCommand += " ";
- }
+ finalCommand += cmStrCat(
+ cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]), ' ',
+ cmWrap("\"", cmMakeRange(emulatorWithArgs).advance(1), "\"", " "), ' ');
}
finalCommand += cmSystemTools::ConvertToRunCommandPath(this->OutputFile);
if (!runArgs.empty()) {
@@ -292,12 +286,7 @@ void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
workDir ? workDir->c_str() : nullptr, cmSystemTools::OUTPUT_NONE,
cmDuration::zero());
// set the run var
- std::string retStr;
- if (worked) {
- retStr = std::to_string(retVal);
- } else {
- retStr = "FAILED_TO_RUN";
- }
+ std::string retStr = worked ? std::to_string(retVal) : "FAILED_TO_RUN";
if (this->NoCache) {
this->Makefile->AddDefinition(this->RunResultVariable, retStr);
} else {
@@ -312,7 +301,7 @@ void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
the executable would have produced.
*/
void TryRunCommandImpl::DoNotRunExecutable(
- const std::string& runArgs, cm::optional<std::string> const& srcFile,
+ std::string const& runArgs, cm::optional<std::string> const& srcFile,
std::string const& compileResultVariable, std::string* out,
std::string* stdOut, std::string* stdErr, bool stdOutErrRequired)
{
@@ -454,58 +443,58 @@ void TryRunCommandImpl::DoNotRunExecutable(
"enter \"FAILED_TO_RUN\".\n");
if (stdOut || stdErr) {
if (stdOut) {
- comment += internalRunOutputStdOutName;
- comment +=
- "\n contains the text the executable "
- "would have printed on stdout.\n"
- " If the executable would not have been able to run, set ";
- comment += internalRunOutputStdOutName;
- comment += " empty.\n"
- " Otherwise check if the output is evaluated by the "
- "calling CMake code. If so,\n"
- " check what the source file would have printed when "
- "called with the given arguments.\n";
+ comment += cmStrCat(
+ internalRunOutputStdOutName,
+ "\n contains the text the executable would have printed on "
+ "stdout.\n"
+ " If the executable would not have been able to run, set ",
+ internalRunOutputStdOutName,
+ " empty.\n"
+ " Otherwise check if the output is evaluated by the "
+ "calling CMake code. If so,\n"
+ " check what the source file would have printed when "
+ "called with the given arguments.\n");
}
if (stdErr) {
- comment += internalRunOutputStdErrName;
- comment +=
- "\n contains the text the executable "
- "would have printed on stderr.\n"
- " If the executable would not have been able to run, set ";
- comment += internalRunOutputStdErrName;
- comment += " empty.\n"
- " Otherwise check if the output is evaluated by the "
- "calling CMake code. If so,\n"
- " check what the source file would have printed when "
- "called with the given arguments.\n";
+ comment += cmStrCat(
+ internalRunOutputStdErrName,
+ "\n contains the text the executable would have printed on "
+ "stderr.\n"
+ " If the executable would not have been able to run, set ",
+ internalRunOutputStdErrName,
+ " empty.\n"
+ " Otherwise check if the output is evaluated by the "
+ "calling CMake code. If so,\n"
+ " check what the source file would have printed when "
+ "called with the given arguments.\n");
}
} else if (out) {
- comment += internalRunOutputName;
- comment +=
- "\n contains the text the executable "
- "would have printed on stdout and stderr.\n"
- " If the executable would not have been able to run, set ";
- comment += internalRunOutputName;
- comment += " empty.\n"
- " Otherwise check if the output is evaluated by the "
- "calling CMake code. If so,\n"
- " check what the source file would have printed when "
- "called with the given arguments.\n";
+ comment += cmStrCat(
+ internalRunOutputName,
+ "\n contains the text the executable would have printed on stdout "
+ "and stderr.\n"
+ " If the executable would not have been able to run, set ",
+ internalRunOutputName,
+ " empty.\n"
+ " Otherwise check if the output is evaluated by the "
+ "calling CMake code. If so,\n"
+ " check what the source file would have printed when "
+ "called with the given arguments.\n");
}
- comment += "The ";
- comment += compileResultVariable;
- comment += " variable holds the build result for this try_run().\n\n";
+ comment +=
+ cmStrCat("The ", compileResultVariable,
+ " variable holds the build result for this try_run().\n\n");
if (srcFile) {
- comment += "Source file : ";
- comment += *srcFile + "\n";
+ comment += cmStrCat("Source file : ", *srcFile, '\n');
}
- comment += "Executable : ";
- comment += copyDest + "\n";
- comment += "Run arguments : ";
- comment += runArgs;
- comment += "\n";
- comment += " Called from: " + this->Makefile->FormatListFileStack();
+ comment += cmStrCat("Executable : ", copyDest,
+ "\n"
+ "Run arguments : ",
+ runArgs,
+ "\n"
+ " Called from: ",
+ this->Makefile->FormatListFileStack());
cmsys::SystemTools::ReplaceString(comment, "\n", "\n# ");
file << comment << "\n\n";
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index 38e3638..6b207d4 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index 168f1a6..201e804 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#define cmUVHandlePtr_cxx
#include "cmUVHandlePtr.h"
@@ -332,7 +332,7 @@ void write_req_cb(uv_write_t* req, int status)
}
}
-int uv_write(uv_stream_t* handle, const uv_buf_t bufs[], unsigned int nbufs,
+int uv_write(uv_stream_t* handle, uv_buf_t const bufs[], unsigned int nbufs,
std::weak_ptr<std::function<void(int)>> cb)
{
auto req = cm::make_unique<write_req>(std::move(cb));
diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h
index b8b3491..6c2260e 100644
--- a/Source/cmUVHandlePtr.h
+++ b/Source/cmUVHandlePtr.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -158,10 +158,10 @@ public:
};
template <typename T>
-inline uv_handle_ptr_base_<T>::uv_handle_ptr_base_(
+uv_handle_ptr_base_<T>::uv_handle_ptr_base_(
uv_handle_ptr_base_<T>&&) noexcept = default;
template <typename T>
-inline uv_handle_ptr_base_<T>& uv_handle_ptr_base_<T>::operator=(
+uv_handle_ptr_base_<T>& uv_handle_ptr_base_<T>::operator=(
uv_handle_ptr_base_<T>&&) noexcept = default;
/**
@@ -316,6 +316,6 @@ UV_HANDLE_PTR_INSTANTIATE_EXTERN(tty)
* referenced by the uv_buf_t values must remain alive until the callback
* is made or the stream is closed.
*/
-int uv_write(uv_stream_t* handle, const uv_buf_t bufs[], unsigned int nbufs,
+int uv_write(uv_stream_t* handle, uv_buf_t const bufs[], unsigned int nbufs,
std::weak_ptr<std::function<void(int)>> cb);
}
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index b787f19..4910653 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmUVProcessChain.h"
#include <array>
@@ -36,7 +36,7 @@ struct cmUVProcessChain::InternalData
void Finish();
};
- const cmUVProcessChainBuilder* Builder = nullptr;
+ cmUVProcessChainBuilder const* Builder = nullptr;
bool Valid = false;
@@ -52,10 +52,10 @@ struct cmUVProcessChain::InternalData
unsigned int ProcessesCompleted = 0;
std::vector<std::unique_ptr<ProcessData>> Processes;
- bool Prepare(const cmUVProcessChainBuilder* builder);
+ bool Prepare(cmUVProcessChainBuilder const* builder);
void SpawnProcess(
std::size_t index,
- const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first,
+ cmUVProcessChainBuilder::ProcessConfiguration const& config, bool first,
bool last);
void Finish();
};
@@ -63,11 +63,11 @@ struct cmUVProcessChain::InternalData
cmUVProcessChainBuilder::cmUVProcessChainBuilder() = default;
cmUVProcessChainBuilder& cmUVProcessChainBuilder::AddCommand(
- const std::vector<std::string>& arguments)
+ std::vector<std::string> arguments)
{
if (!arguments.empty()) {
this->Processes.emplace_back();
- this->Processes.back().Arguments = arguments;
+ this->Processes.back().Arguments = std::move(arguments);
}
return *this;
}
@@ -156,6 +156,12 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetWorkingDirectory(
return *this;
}
+cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetDetached()
+{
+ this->Detached = true;
+ return *this;
+}
+
uv_loop_t* cmUVProcessChainBuilder::GetLoop() const
{
return this->Loop;
@@ -180,7 +186,7 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const
}
bool cmUVProcessChain::InternalData::Prepare(
- const cmUVProcessChainBuilder* builder)
+ cmUVProcessChainBuilder const* builder)
{
this->Builder = builder;
@@ -319,7 +325,7 @@ bool cmUVProcessChain::InternalData::Prepare(
void cmUVProcessChain::InternalData::SpawnProcess(
std::size_t index,
- const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first,
+ cmUVProcessChainBuilder::ProcessConfiguration const& config, bool first,
bool last)
{
auto& process = *this->Processes[index];
@@ -329,7 +335,7 @@ void cmUVProcessChain::InternalData::SpawnProcess(
// Bounds were checked at add time, first element is guaranteed to exist
options.file = config.Arguments[0].c_str();
- std::vector<const char*> arguments;
+ std::vector<char const*> arguments;
arguments.reserve(config.Arguments.size());
for (auto const& arg : config.Arguments) {
arguments.push_back(arg.c_str());
@@ -337,11 +343,17 @@ void cmUVProcessChain::InternalData::SpawnProcess(
arguments.push_back(nullptr);
options.args = const_cast<char**>(arguments.data());
options.flags = UV_PROCESS_WINDOWS_HIDE;
+ if (this->Builder->Detached) {
+ options.flags |= UV_PROCESS_DETACHED;
+ }
#if UV_VERSION_MAJOR > 1 || \
(UV_VERSION_MAJOR == 1 && UV_VERSION_MINOR >= 48) || \
!defined(CMAKE_USE_SYSTEM_LIBUV)
options.flags |= UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME;
#endif
+#if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
+ options.flags |= UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
+#endif
if (!this->Builder->WorkingDirectory.empty()) {
options.cwd = this->Builder->WorkingDirectory.c_str();
}
@@ -377,6 +389,9 @@ void cmUVProcessChain::InternalData::SpawnProcess(
process.Process.spawn(*this->Loop, options, &process)) < 0) {
process.Finish();
}
+ if (this->Builder->Detached) {
+ uv_unref((uv_handle_t*)process.Process);
+ }
process.InputPipe.reset();
process.OutputPipe.reset();
}
@@ -450,10 +465,10 @@ bool cmUVProcessChain::Wait(uint64_t milliseconds)
return !timeout;
}
-std::vector<const cmUVProcessChain::Status*> cmUVProcessChain::GetStatus()
+std::vector<cmUVProcessChain::Status const*> cmUVProcessChain::GetStatus()
const
{
- std::vector<const cmUVProcessChain::Status*> statuses(
+ std::vector<cmUVProcessChain::Status const*> statuses(
this->Data->Processes.size(), nullptr);
for (std::size_t i = 0; i < statuses.size(); i++) {
statuses[i] = &this->GetStatus(i);
@@ -461,7 +476,7 @@ std::vector<const cmUVProcessChain::Status*> cmUVProcessChain::GetStatus()
return statuses;
}
-const cmUVProcessChain::Status& cmUVProcessChain::GetStatus(
+cmUVProcessChain::Status const& cmUVProcessChain::GetStatus(
std::size_t index) const
{
return this->Data->Processes[index]->ProcessStatus;
diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h
index 65816e2..ae71010 100644
--- a/Source/cmUVProcessChain.h
+++ b/Source/cmUVProcessChain.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,8 +29,7 @@ public:
cmUVProcessChainBuilder();
- cmUVProcessChainBuilder& AddCommand(
- const std::vector<std::string>& arguments);
+ cmUVProcessChainBuilder& AddCommand(std::vector<std::string> arguments);
cmUVProcessChainBuilder& SetBuiltinLoop();
cmUVProcessChainBuilder& SetExternalLoop(uv_loop_t& loop);
cmUVProcessChainBuilder& SetNoStream(Stream stdio);
@@ -39,6 +38,7 @@ public:
cmUVProcessChainBuilder& SetExternalStream(Stream stdio, int fd);
cmUVProcessChainBuilder& SetExternalStream(Stream stdio, FILE* stream);
cmUVProcessChainBuilder& SetWorkingDirectory(std::string dir);
+ cmUVProcessChainBuilder& SetDetached();
uv_loop_t* GetLoop() const;
@@ -69,6 +69,7 @@ private:
std::vector<ProcessConfiguration> Processes;
std::string WorkingDirectory;
bool MergedBuiltinStreams = false;
+ bool Detached = false;
uv_loop_t* Loop = nullptr;
};
@@ -96,12 +97,12 @@ public:
std::pair<ExceptionCode, std::string> GetException() const;
};
- cmUVProcessChain(const cmUVProcessChain& other) = delete;
+ cmUVProcessChain(cmUVProcessChain const& other) = delete;
cmUVProcessChain(cmUVProcessChain&& other) noexcept;
~cmUVProcessChain();
- cmUVProcessChain& operator=(const cmUVProcessChain& other) = delete;
+ cmUVProcessChain& operator=(cmUVProcessChain const& other) = delete;
cmUVProcessChain& operator=(cmUVProcessChain&& other) noexcept;
uv_loop_t& GetLoop();
@@ -112,8 +113,8 @@ public:
bool Valid() const;
bool Wait(uint64_t milliseconds = 0);
- std::vector<const Status*> GetStatus() const;
- const Status& GetStatus(std::size_t index) const;
+ std::vector<Status const*> GetStatus() const;
+ Status const& GetStatus(std::size_t index) const;
bool Finished() const;
private:
diff --git a/Source/cmUVStream.h b/Source/cmUVStream.h
index db051b8..5c581ca 100644
--- a/Source/cmUVStream.h
+++ b/Source/cmUVStream.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cassert>
@@ -137,7 +137,7 @@ std::unique_ptr<cmUVStreamReadHandle> cmUVStreamRead(uv_stream_t* stream,
buffer->base = data->Buffer.data();
buffer->len = suggestedSize;
},
- [](uv_stream_t* s, ssize_t nread, const uv_buf_t* buffer) {
+ [](uv_stream_t* s, ssize_t nread, uv_buf_t const* buffer) {
auto* data = static_cast<cmUVStreamReadHandle*>(s->data);
if (nread > 0) {
(void)buffer;
diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h
index 4f7b209..9baa7bc 100644
--- a/Source/cmUVStreambuf.h
+++ b/Source/cmUVStreambuf.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <algorithm>
@@ -69,7 +69,7 @@ protected:
private:
uv_stream_t* Stream = nullptr;
void* OldStreamData = nullptr;
- const std::size_t PutBack = 0;
+ std::size_t const PutBack = 0;
std::vector<CharT> InputBuffer;
bool EndOfFile = false;
@@ -172,7 +172,7 @@ void cmBasicUVStreambuf<CharT, Traits>::StreamReadStartStop()
static_cast<cmBasicUVStreambuf<CharT, Traits>*>(handle->data);
streambuf->HandleAlloc(buf);
},
- [](uv_stream_t* stream2, ssize_t nread, const uv_buf_t* /* unused */) {
+ [](uv_stream_t* stream2, ssize_t nread, uv_buf_t const* /* unused */) {
auto streambuf =
static_cast<cmBasicUVStreambuf<CharT, Traits>*>(stream2->data);
streambuf->StreamRead(nread);
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index 3ba95e9..d34627c 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmUnsetCommand.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 3faa053..f7428f5 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
deleted file mode 100644
index 1fd386b..0000000
--- a/Source/cmUseMangledMesaCommand.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmUseMangledMesaCommand.h"
-
-#include "cmsys/FStream.hxx"
-#include "cmsys/RegularExpression.hxx"
-
-#include "cmExecutionStatus.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-
-namespace {
-void CopyAndFullPathMesaHeader(const std::string& source,
- const std::string& outdir);
-}
-
-bool cmUseMangledMesaCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- // expected two arguments:
- // argument one: the full path to gl_mangle.h
- // argument two : directory for output of edited headers
- if (args.size() != 2) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
- const std::string& inputDir = args[0];
- std::string glh = cmStrCat(inputDir, "/gl.h");
- if (!cmSystemTools::FileExists(glh)) {
- std::string e = cmStrCat("Bad path to Mesa, could not find: ", glh, ' ');
- status.SetError(e);
- return false;
- }
- const std::string& destDir = args[1];
- std::vector<std::string> files;
- cmSystemTools::Glob(inputDir, "\\.h$", files);
- if (files.empty()) {
- cmSystemTools::Error("Could not open Mesa Directory " + inputDir);
- return false;
- }
- cmSystemTools::MakeDirectory(destDir);
- for (std::string const& f : files) {
- std::string path = cmStrCat(inputDir, '/', f);
- CopyAndFullPathMesaHeader(path, destDir);
- }
-
- return true;
-}
-
-namespace {
-void CopyAndFullPathMesaHeader(const std::string& source,
- const std::string& outdir)
-{
- std::string dir;
- std::string file;
- cmSystemTools::SplitProgramPath(source, dir, file);
- std::string outFile = cmStrCat(outdir, '/', file);
- std::string tempOutputFile = cmStrCat(outFile, ".tmp");
- cmsys::ofstream fout(tempOutputFile.c_str());
- if (!fout) {
- cmSystemTools::Error("Could not open file for write in copy operation: " +
- tempOutputFile + outdir);
- cmSystemTools::ReportLastSystemError("");
- return;
- }
- cmsys::ifstream fin(source.c_str());
- if (!fin) {
- cmSystemTools::Error("Could not open file for read in copy operation" +
- source);
- return;
- }
- // now copy input to output and expand variables in the
- // input file at the same time
- std::string inLine;
- // regular expression for any #include line
- cmsys::RegularExpression includeLine(
- "^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
- // regular expression for gl/ or GL/ in a file (match(1) of above)
- cmsys::RegularExpression glDirLine(R"((gl|GL)(/|\\)([^<"]+))");
- // regular expression for gl GL or xmesa in a file (match(1) of above)
- cmsys::RegularExpression glLine("(gl|GL|xmesa)");
- while (cmSystemTools::GetLineFromStream(fin, inLine)) {
- if (includeLine.find(inLine)) {
- std::string includeFile = includeLine.match(1);
- if (glDirLine.find(includeFile)) {
- std::string gfile = glDirLine.match(3);
- fout << "#include \"" << outdir << "/" << gfile << "\"\n";
- } else if (glLine.find(includeFile)) {
- fout << "#include \"" << outdir << "/" << includeLine.match(1)
- << "\"\n";
- } else {
- fout << inLine << "\n";
- }
- } else {
- fout << inLine << "\n";
- }
- }
- // close the files before attempting to copy
- fin.close();
- fout.close();
- cmSystemTools::MoveFileIfDifferent(tempOutputFile, outFile);
-}
-}
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
deleted file mode 100644
index 5670c5d..0000000
--- a/Source/cmUseMangledMesaCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmUseMangledMesaCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
deleted file mode 100644
index 2805a33..0000000
--- a/Source/cmUtilitySourceCommand.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmUtilitySourceCommand.h"
-
-#include <cstring>
-
-#include "cmExecutionStatus.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmStateTypes.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-
-// cmUtilitySourceCommand
-bool cmUtilitySourceCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.size() < 3) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- auto arg = args.begin();
-
- // The first argument is the cache entry name.
- std::string const& cacheEntry = *arg++;
- cmValue cacheValue = status.GetMakefile().GetDefinition(cacheEntry);
- // If it exists already and appears up to date then we are done. If
- // the string contains "(IntDir)" but that is not the
- // CMAKE_CFG_INTDIR setting then the value is out of date.
- std::string const& intDir =
- status.GetMakefile().GetRequiredDefinition("CMAKE_CFG_INTDIR");
-
- bool haveCacheValue = false;
- if (status.GetMakefile().IsOn("CMAKE_CROSSCOMPILING")) {
- haveCacheValue = (cacheValue != nullptr);
- if (!haveCacheValue) {
- std::string msg = cmStrCat(
- "UTILITY_SOURCE is used in cross compiling mode for ", cacheEntry,
- ". If your intention is to run this executable, you need to "
- "preload the cache with the full path to a version of that "
- "program, which runs on this build machine.");
- cmSystemTools::Message(msg, "Warning");
- }
- } else {
- cmState* state = status.GetMakefile().GetState();
- haveCacheValue = (cacheValue &&
- (strstr(cacheValue->c_str(), "(IntDir)") == nullptr ||
- (intDir == "$(IntDir)")) &&
- (state->GetCacheMajorVersion() != 0 &&
- state->GetCacheMinorVersion() != 0));
- }
-
- if (haveCacheValue) {
- return true;
- }
-
- // The second argument is the utility's executable name, which will be
- // needed later.
- std::string const& utilityName = *arg++;
-
- // The third argument specifies the relative directory of the source
- // of the utility.
- std::string const& relativeSource = *arg++;
- std::string utilitySource = status.GetMakefile().GetCurrentSourceDirectory();
- utilitySource = utilitySource + "/" + relativeSource;
-
- // If the directory doesn't exist, the source has not been included.
- if (!cmSystemTools::FileExists(utilitySource)) {
- return true;
- }
-
- // Make sure all the files exist in the source directory.
- while (arg != args.end()) {
- std::string file = utilitySource + "/" + *arg++;
- if (!cmSystemTools::FileExists(file)) {
- return true;
- }
- }
-
- // The source exists.
- const std::string& cmakeCFGout =
- status.GetMakefile().GetRequiredDefinition("CMAKE_CFG_INTDIR");
- std::string utilityDirectory =
- status.GetMakefile().GetCurrentBinaryDirectory();
- std::string exePath;
- if (cmValue d =
- status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
- exePath = *d;
- }
- if (!exePath.empty()) {
- utilityDirectory = exePath;
- } else {
- utilityDirectory += "/" + relativeSource;
- }
-
- // Construct the cache entry for the executable's location.
- std::string utilityExecutable = utilityDirectory + "/" + cmakeCFGout + "/" +
- utilityName +
- *status.GetMakefile().GetDefinition("CMAKE_EXECUTABLE_SUFFIX");
-
- // make sure we remove any /./ in the name
- cmSystemTools::ReplaceString(utilityExecutable, "/./", "/");
-
- // Enter the value into the cache.
- status.GetMakefile().AddCacheDefinition(cacheEntry, utilityExecutable,
- "Path to an internal program.",
- cmStateEnums::FILEPATH);
- // add a value into the cache that maps from the
- // full path to the name of the project
- cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
- status.GetMakefile().AddCacheDefinition(utilityExecutable, utilityName,
- "Executable to project name.",
- cmStateEnums::INTERNAL);
-
- return true;
-}
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
deleted file mode 100644
index 8cf7e7f..0000000
--- a/Source/cmUtilitySourceCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmUtilitySourceCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmUtils.hxx b/Source/cmUtils.hxx
index 733e72f..2993d25 100644
--- a/Source/cmUtils.hxx
+++ b/Source/cmUtils.hxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmsys/SystemTools.hxx"
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 5f5d3e4..bc2ff59 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmUuid.h"
#include <array>
@@ -7,7 +7,7 @@
#include "cmCryptoHash.h"
-static const std::array<int, 5> kUuidGroups = { { 4, 2, 2, 2, 6 } };
+static std::array<int, 5> const kUuidGroups = { { 4, 2, 2, 2, 6 } };
std::string cmUuid::FromMd5(std::vector<unsigned char> const& uuidNamespace,
std::string const& name) const
@@ -50,7 +50,7 @@ void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
}
}
-std::string cmUuid::FromDigest(const unsigned char* digest,
+std::string cmUuid::FromDigest(unsigned char const* digest,
unsigned char version) const
{
using byte_t = unsigned char;
@@ -92,7 +92,7 @@ bool cmUuid::StringToBinary(std::string const& input,
return true;
}
-std::string cmUuid::BinaryToString(const unsigned char* input) const
+std::string cmUuid::BinaryToString(unsigned char const* input) const
{
std::string output;
diff --git a/Source/cmUuid.h b/Source/cmUuid.h
index f5f724d..cf51ece 100644
--- a/Source/cmUuid.h
+++ b/Source/cmUuid.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,13 +30,13 @@ private:
std::string const& name,
std::vector<unsigned char>& output) const;
- std::string FromDigest(const unsigned char* digest,
+ std::string FromDigest(unsigned char const* digest,
unsigned char version) const;
bool StringToBinaryImpl(std::string const& input,
std::vector<unsigned char>& output) const;
- std::string BinaryToString(const unsigned char* input) const;
+ std::string BinaryToString(unsigned char const* input) const;
bool IntFromHexDigit(char input, char& output) const;
};
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 9266134..54b301b 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVSSetupHelper.h"
#include <utility>
@@ -306,8 +306,8 @@ namespace {
std::string FindVsWhereCommand()
{
std::string vswhere;
- static const char* programFiles[] = { "ProgramFiles(x86)", "ProgramFiles" };
- for (const char* pf : programFiles) {
+ static char const* programFiles[] = { "ProgramFiles(x86)", "ProgramFiles" };
+ for (char const* pf : programFiles) {
if (cmSystemTools::GetEnv(pf, vswhere)) {
vswhere += "/Microsoft Visual Studio/Installer/vswhere.exe";
if (cmSystemTools::FileExists(vswhere)) {
@@ -350,7 +350,7 @@ bool cmVSSetupAPIHelper::EnumerateVSInstancesWithVswhere(
return false;
}
- for (const auto& item : json) {
+ for (auto const& item : json) {
VSInstanceInfo instance;
instance.Version = item["installationVersion"].asString();
instance.VSInstallLocation = item["installationPath"].asString();
@@ -433,15 +433,12 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
std::string envVSCommonToolsDir;
std::string envVSCommonToolsDirEnvName =
- cmStrCat("VS", std::to_string(this->Version), "0COMNTOOLS");
+ cmStrCat("VS", this->Version, "0COMNTOOLS");
- if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName.c_str(),
- envVSCommonToolsDir)) {
+ if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName, envVSCommonToolsDir)) {
cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir);
}
- std::string const wantVersion = cmStrCat(std::to_string(this->Version), '.');
-
bool specifiedLocationNotSpecifiedVersion = false;
SmartCOMPtr<ISetupInstance> instance;
@@ -455,8 +452,10 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
return false;
}
+ std::string const wantVersion = cmStrCat(this->Version, '.');
+
std::vector<VSInstanceInfo> vecVSInstances;
- for (const auto& instanceInfo : vecVSInstancesAll) {
+ for (auto const& instanceInfo : vecVSInstancesAll) {
// We are looking for a specific major version.
if (instanceInfo.Version.size() < wantVersion.size() ||
instanceInfo.Version.substr(0, wantVersion.size()) != wantVersion) {
@@ -515,7 +514,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
}
int cmVSSetupAPIHelper::ChooseVSInstance(
- const std::vector<VSInstanceInfo>& vecVSInstances)
+ std::vector<VSInstanceInfo> const& vecVSInstances)
{
if (vecVSInstances.empty()) {
return -1;
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index cc4d696..fd01202 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#ifndef NOMINMAX
@@ -25,7 +25,7 @@ public:
ptr->AddRef();
}
}
- SmartCOMPtr(const SmartCOMPtr<T>& sptr)
+ SmartCOMPtr(SmartCOMPtr<T> const& sptr)
{
ptr = sptr.ptr;
if (ptr) {
@@ -75,8 +75,8 @@ class SmartBSTR
{
public:
SmartBSTR() = default;
- SmartBSTR(const SmartBSTR& src) = delete;
- SmartBSTR& operator=(const SmartBSTR& src) = delete;
+ SmartBSTR(SmartBSTR const& src) = delete;
+ SmartBSTR& operator=(SmartBSTR const& src) = delete;
operator BSTR() const { return str; }
BSTR* operator&() throw() { return &str; }
~SmartBSTR() throw() { ::SysFreeString(str); }
@@ -118,7 +118,7 @@ private:
VSInstanceInfo& vsInstanceInfo);
bool CheckInstalledComponent(SmartCOMPtr<ISetupPackageReference> package,
bool& bWin10SDK, bool& bWin81SDK);
- int ChooseVSInstance(const std::vector<VSInstanceInfo>& vecVSInstances);
+ int ChooseVSInstance(std::vector<VSInstanceInfo> const& vecVSInstances);
bool EnumerateAndChooseVSInstance();
bool LoadSpecifiedVSInstanceFromDisk();
bool EnumerateVSInstancesWithVswhere(
diff --git a/Source/cmValue.h b/Source/cmValue.h
index 6b9b795..21ef188 100644
--- a/Source/cmValue.h
+++ b/Source/cmValue.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -14,40 +14,40 @@ class cmValue
public:
cmValue() noexcept = default;
cmValue(std::nullptr_t) noexcept {}
- explicit cmValue(const std::string* value) noexcept
+ explicit cmValue(std::string const* value) noexcept
: Value(value)
{
}
- explicit cmValue(const std::string& value) noexcept
+ explicit cmValue(std::string const& value) noexcept
: Value(&value)
{
}
- cmValue(const cmValue& other) noexcept = default;
+ cmValue(cmValue const& other) noexcept = default;
- cmValue& operator=(const cmValue& other) noexcept = default;
+ cmValue& operator=(cmValue const& other) noexcept = default;
cmValue& operator=(std::nullptr_t) noexcept
{
this->Value = nullptr;
return *this;
}
- const std::string* Get() const noexcept { return this->Value; }
- const char* GetCStr() const noexcept
+ std::string const* Get() const noexcept { return this->Value; }
+ char const* GetCStr() const noexcept
{
return this->Value ? this->Value->c_str() : nullptr;
}
- const std::string* operator->() const noexcept
+ std::string const* operator->() const noexcept
{
return this->Value ? this->Value : &cmValue::Empty;
}
- const std::string& operator*() const noexcept
+ std::string const& operator*() const noexcept
{
return this->Value ? *this->Value : cmValue::Empty;
}
explicit operator bool() const noexcept { return this->Value != nullptr; }
- operator const std::string&() const noexcept { return this->operator*(); }
+ operator std::string const&() const noexcept { return this->operator*(); }
explicit operator cm::string_view() const noexcept
{
return this->operator*();
@@ -100,7 +100,7 @@ public:
/**
* Does a string indicate a true or ON value?
*/
- static bool IsOn(const char* value) noexcept
+ static bool IsOn(char const* value) noexcept
{
return value && IsOn(cm::string_view(value));
}
@@ -119,20 +119,20 @@ public:
* IsOn and IsOff both returning false. Note that the special path
* NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
- static bool IsOff(const char* value) noexcept
+ static bool IsOff(char const* value) noexcept
{
return !value || IsOff(cm::string_view(value));
}
static bool IsOff(cm::string_view) noexcept;
/** Return true if value is NOTFOUND or ends in -NOTFOUND. */
- static bool IsNOTFOUND(const char* value) noexcept
+ static bool IsNOTFOUND(char const* value) noexcept
{
return !value || IsNOTFOUND(cm::string_view(value));
}
static bool IsNOTFOUND(cm::string_view) noexcept;
- static bool IsEmpty(const char* value) noexcept
+ static bool IsEmpty(char const* value) noexcept
{
return !value || *value == '\0';
}
@@ -143,7 +143,7 @@ public:
* forced this value. This is not the same as On, but this
* may be considered as "internally switched on".
*/
- static bool IsInternallyOn(const char* value) noexcept
+ static bool IsInternallyOn(char const* value) noexcept
{
return value && IsInternallyOn(cm::string_view(value));
}
@@ -151,7 +151,7 @@ public:
private:
static std::string Empty;
- const std::string* Value = nullptr;
+ std::string const* Value = nullptr;
};
std::ostream& operator<<(std::ostream& o, cmValue v);
@@ -238,7 +238,7 @@ inline bool cmIsOn(cm::string_view val)
{
return cmValue::IsOn(val);
}
-inline bool cmIsOn(const char* val)
+inline bool cmIsOn(char const* val)
{
return cmValue::IsOn(val);
}
@@ -258,7 +258,7 @@ inline bool cmIsOff(cm::string_view val)
{
return cmValue::IsOff(val);
}
-inline bool cmIsOff(const char* val)
+inline bool cmIsOff(char const* val)
{
return cmValue::IsOff(val);
}
@@ -282,7 +282,7 @@ inline bool cmNonempty(cm::string_view val)
{
return !cmValue::IsEmpty(val);
}
-inline bool cmNonempty(const char* val)
+inline bool cmNonempty(char const* val)
{
return !cmValue::IsEmpty(val);
}
@@ -300,7 +300,7 @@ inline bool cmIsInternallyOn(cm::string_view val)
{
return cmValue::IsInternallyOn(val);
}
-inline bool cmIsInternallyOn(const char* val)
+inline bool cmIsInternallyOn(char const* val)
{
return cmValue::IsInternallyOn(val);
}
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
deleted file mode 100644
index 2b1efba..0000000
--- a/Source/cmVariableRequiresCommand.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmVariableRequiresCommand.h"
-
-#include "cmExecutionStatus.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-
-// cmLibraryCommand
-bool cmVariableRequiresCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.size() < 3) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- std::string const& testVariable = args[0];
- if (!status.GetMakefile().IsOn(testVariable)) {
- return true;
- }
- std::string const& resultVariable = args[1];
- bool requirementsMet = true;
- std::string notSet;
- bool hasAdvanced = false;
- cmState* state = status.GetMakefile().GetState();
- for (unsigned int i = 2; i < args.size(); ++i) {
- if (!status.GetMakefile().IsOn(args[i])) {
- requirementsMet = false;
- notSet += args[i];
- notSet += "\n";
- if (state->GetCacheEntryValue(args[i]) &&
- state->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) {
- hasAdvanced = true;
- }
- }
- }
- cmValue reqVar = status.GetMakefile().GetDefinition(resultVariable);
- // if reqVar is unset, then set it to requirementsMet
- // if reqVar is set to true, but requirementsMet is false , then
- // set reqVar to false.
- if (!reqVar || (!requirementsMet && status.GetMakefile().IsOn(*reqVar))) {
- status.GetMakefile().AddDefinitionBool(resultVariable, requirementsMet);
- }
-
- if (!requirementsMet) {
- std::string message =
- cmStrCat("Variable assertion failed:\n", testVariable,
- " Requires that the following unset variables are set:\n",
- notSet, "\nPlease set them, or set ", testVariable,
- " to false, and re-configure.\n");
- if (hasAdvanced) {
- message +=
- "One or more of the required variables is advanced."
- " To set the variable, you must turn on advanced mode in cmake.";
- }
- cmSystemTools::Error(message);
- }
-
- return true;
-}
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
deleted file mode 100644
index c6bfe8a..0000000
--- a/Source/cmVariableRequiresCommand.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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>
-
-class cmExecutionStatus;
-
-bool cmVariableRequiresCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 35e1c8c..5ad00fe 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVariableWatch.h"
#include <array>
@@ -7,9 +7,9 @@
#include <utility>
#include <vector>
-const std::string& cmVariableWatch::GetAccessAsString(int access_type)
+std::string const& cmVariableWatch::GetAccessAsString(int access_type)
{
- static const std::array<std::string, 6> cmVariableWatchAccessStrings = {
+ static std::array<std::string, 6> const cmVariableWatchAccessStrings = {
{ "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
"MODIFIED_ACCESS", "REMOVED_ACCESS", "NO_ACCESS" }
};
@@ -23,7 +23,7 @@ cmVariableWatch::cmVariableWatch() = default;
cmVariableWatch::~cmVariableWatch() = default;
-bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
+bool cmVariableWatch::AddWatch(std::string const& variable, WatchMethod method,
void* client_data /*=0*/,
DeleteData delete_data /*=0*/)
{
@@ -43,7 +43,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
return true;
}
-void cmVariableWatch::RemoveWatch(const std::string& variable,
+void cmVariableWatch::RemoveWatch(std::string const& variable,
WatchMethod method, void* client_data /*=0*/)
{
if (!this->WatchMap.count(variable)) {
@@ -62,9 +62,9 @@ void cmVariableWatch::RemoveWatch(const std::string& variable,
}
}
-bool cmVariableWatch::VariableAccessed(const std::string& variable,
- int access_type, const char* newValue,
- const cmMakefile* mf) const
+bool cmVariableWatch::VariableAccessed(std::string const& variable,
+ int access_type, char const* newValue,
+ cmMakefile const* mf) const
{
auto mit = this->WatchMap.find(variable);
if (mit != this->WatchMap.end()) {
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 349ce0e..ffd7192 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,8 +19,8 @@ class cmMakefile;
class cmVariableWatch
{
public:
- using WatchMethod = void (*)(const std::string&, int, void*, const char*,
- const cmMakefile*);
+ using WatchMethod = void (*)(std::string const&, int, void*, char const*,
+ cmMakefile const*);
using DeleteData = void (*)(void*);
cmVariableWatch();
@@ -29,16 +29,16 @@ public:
/**
* Add watch to the variable
*/
- bool AddWatch(const std::string& variable, WatchMethod method,
+ bool AddWatch(std::string const& variable, WatchMethod method,
void* client_data = nullptr, DeleteData delete_data = nullptr);
- void RemoveWatch(const std::string& variable, WatchMethod method,
+ void RemoveWatch(std::string const& variable, WatchMethod method,
void* client_data = nullptr);
/**
* This method is called when variable is accessed
*/
- bool VariableAccessed(const std::string& variable, int access_type,
- const char* newValue, const cmMakefile* mf) const;
+ bool VariableAccessed(std::string const& variable, int access_type,
+ char const* newValue, cmMakefile const* mf) const;
/**
* Different access types.
@@ -56,7 +56,7 @@ public:
/**
* Return the access as string
*/
- static const std::string& GetAccessAsString(int access_type);
+ static std::string const& GetAccessAsString(int access_type);
protected:
struct Pair
@@ -71,8 +71,8 @@ protected:
}
}
Pair() = default;
- Pair(const Pair&) = delete;
- Pair& operator=(const Pair&) = delete;
+ Pair(Pair const&) = delete;
+ Pair& operator=(Pair const&) = delete;
};
using VectorOfPairs = std::vector<std::shared_ptr<Pair>>;
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 24394d9..f5d47c6 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVariableWatchCommand.h"
#include <limits>
@@ -25,10 +25,10 @@ struct cmVariableWatchCallbackData
std::string Command;
};
-void cmVariableWatchCommandVariableAccessed(const std::string& variable,
+void cmVariableWatchCommandVariableAccessed(std::string const& variable,
int access_type, void* client_data,
- const char* newValue,
- const cmMakefile* mf)
+ char const* newValue,
+ cmMakefile const* mf)
{
cmVariableWatchCallbackData* data =
static_cast<cmVariableWatchCallbackData*>(client_data);
@@ -47,7 +47,7 @@ void cmVariableWatchCommandVariableAccessed(const std::string& variable,
if (!data->Command.empty()) {
cmValue const currentListFile =
mf->GetDefinition("CMAKE_CURRENT_LIST_FILE");
- const auto fakeLineNo =
+ auto const fakeLineNo =
std::numeric_limits<decltype(cmListFileArgument::Line)>::max();
std::vector<cmListFileArgument> newLFFArgs{
@@ -95,7 +95,7 @@ public:
{
}
- void operator()(cmLocalGenerator&, const cmListFileBacktrace&) const {}
+ void operator()(cmLocalGenerator&, cmListFileBacktrace const&) const {}
private:
struct Impl
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 4477cb7..39fb10d 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx
index a091b91..06c3688 100644
--- a/Source/cmVersion.cxx
+++ b/Source/cmVersion.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVersion.h"
#include "cmVersionConfig.h"
@@ -21,7 +21,7 @@ unsigned int cmVersion::GetTweakVersion()
return 0;
}
-const char* cmVersion::GetCMakeVersion()
+char const* cmVersion::GetCMakeVersion()
{
return CMake_VERSION;
}
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
index 456428c..c3d5b0c 100644
--- a/Source/cmVersion.h
+++ b/Source/cmVersion.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cm3p/kwiml/int.h>
@@ -19,13 +19,13 @@ public:
static unsigned int GetMinorVersion();
static unsigned int GetPatchVersion();
static unsigned int GetTweakVersion();
- static const char* GetCMakeVersion();
+ static char const* GetCMakeVersion();
};
/* Encode with room for up to 1000 minor releases between major releases
and to encode dates until the year 10000 in the patch level. */
#define CMake_VERSION_ENCODE_BASE KWIML_INT_UINT64_C(100000000)
#define CMake_VERSION_ENCODE(major, minor, patch) \
- ((((major)*1000u) * CMake_VERSION_ENCODE_BASE) + \
+ ((((major) * 1000u) * CMake_VERSION_ENCODE_BASE) + \
(((minor) % 1000u) * CMake_VERSION_ENCODE_BASE) + \
(((patch) % CMake_VERSION_ENCODE_BASE)))
diff --git a/Source/cmVersionConfig.h.in b/Source/cmVersionConfig.h.in
index 5d52950..7e30b48 100644
--- a/Source/cmVersionConfig.h.in
+++ b/Source/cmVersionConfig.h.in
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@
diff --git a/Source/cmVersionMacros.h b/Source/cmVersionMacros.h
index f33f0df..f89d8e7 100644
--- a/Source/cmVersionMacros.h
+++ b/Source/cmVersionMacros.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmVersionConfig.h"
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f7515f1..caa541b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVisualStudio10TargetGenerator.h"
#include <algorithm>
@@ -30,6 +30,7 @@
#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorOptions.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalVisualStudio10Generator.h"
@@ -81,7 +82,7 @@ static std::string cmVS10EscapeAttr(std::string arg)
struct cmVisualStudio10TargetGenerator::Elem
{
std::ostream& S;
- const int Indent;
+ int const Indent;
bool HasElements = false;
bool HasContent = false;
std::string Tag;
@@ -93,7 +94,7 @@ struct cmVisualStudio10TargetGenerator::Elem
{
this->StartElement();
}
- Elem(const Elem&) = delete;
+ Elem(Elem const&) = delete;
Elem(Elem& par, cm::string_view tag)
: S(par.S)
, Indent(par.Indent + 1)
@@ -109,13 +110,13 @@ struct cmVisualStudio10TargetGenerator::Elem
HasElements = true;
}
}
- std::ostream& WriteString(const char* line);
+ std::ostream& WriteString(char const* line);
void StartElement() { this->WriteString("<") << this->Tag; }
void Element(cm::string_view tag, std::string val)
{
Elem(*this, tag).Content(std::move(val));
}
- Elem& Attribute(const char* an, std::string av)
+ Elem& Attribute(char const* an, std::string av)
{
this->S << ' ' << an << "=\"" << cmVS10EscapeAttr(std::move(av)) << '"';
return *this;
@@ -144,8 +145,8 @@ struct cmVisualStudio10TargetGenerator::Elem
}
}
- void WritePlatformConfigTag(const std::string& tag, const std::string& cond,
- const std::string& content);
+ void WritePlatformConfigTag(std::string const& tag, std::string const& cond,
+ std::string const& content);
};
class cmVS10GeneratorOptions : public cmVisualStudioGeneratorOptions
@@ -161,12 +162,12 @@ public:
}
void OutputFlag(std::ostream& /*fout*/, int /*indent*/,
- const std::string& tag, const std::string& content) override
+ std::string const& tag, std::string const& content) override
{
if (!this->GetConfiguration().empty()) {
// if there are configuration specific flags, then
// use the configuration specific tag for PreprocessorDefinitions
- const std::string cond =
+ std::string const cond =
this->TargetGenerator->CalcCondition(this->GetConfiguration());
this->Parent->WritePlatformConfigTag(tag, cond, content);
} else {
@@ -190,11 +191,11 @@ struct cmVisualStudio10TargetGenerator::OptionsHelper
}
~OptionsHelper() { O.Parent = nullptr; }
- void OutputPreprocessorDefinitions(const std::string& lang)
+ void OutputPreprocessorDefinitions(std::string const& lang)
{
O.OutputPreprocessorDefinitions(O.Parent->S, O.Parent->Indent + 1, lang);
}
- void OutputAdditionalIncludeDirectories(const std::string& lang)
+ void OutputAdditionalIncludeDirectories(std::string const& lang)
{
O.OutputAdditionalIncludeDirectories(O.Parent->S, O.Parent->Indent + 1,
lang);
@@ -281,6 +282,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
this->NsightTegra = gg->IsNsightTegra();
this->Android = gg->TargetsAndroid();
+ this->WindowsKernelMode = gg->TargetsWindowsKernelModeDriver();
auto scanProp = target->GetProperty("CXX_SCAN_FOR_MODULES");
for (auto const& config : this->Configurations) {
if (scanProp.IsSet()) {
@@ -298,9 +300,6 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
&this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
&this->NsightTegraVersion[2], &this->NsightTegraVersion[3]);
this->MSTools = !this->NsightTegra && !this->Android;
- this->Managed = false;
- this->TargetCompileAsWinRT = false;
- this->IsMissingFiles = false;
this->DefaultArtifactDir =
cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget));
@@ -312,7 +311,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() = default;
std::string cmVisualStudio10TargetGenerator::CalcCondition(
- const std::string& config) const
+ std::string const& config) const
{
std::ostringstream oss;
oss << "'$(Configuration)|$(Platform)'=='" << config << '|' << this->Platform
@@ -330,13 +329,13 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition(
}
void cmVisualStudio10TargetGenerator::Elem::WritePlatformConfigTag(
- const std::string& tag, const std::string& cond, const std::string& content)
+ std::string const& tag, std::string const& cond, std::string const& content)
{
Elem(*this, tag).Attribute("Condition", cond).Content(content);
}
std::ostream& cmVisualStudio10TargetGenerator::Elem::WriteString(
- const char* line)
+ char const* line)
{
this->S << '\n';
this->S.fill(' ');
@@ -383,7 +382,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->ProjectType = computeProjectType(this->GeneratorTarget);
this->Managed = this->ProjectType == VsProjectType::csproj;
- const std::string ProjectFileExtension =
+ std::string const ProjectFileExtension =
computeProjectFileExtension(this->ProjectType);
if (this->ProjectType == VsProjectType::csproj &&
@@ -441,7 +440,7 @@ void cmVisualStudio10TargetGenerator::Generate()
cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
this->Name, ProjectFileExtension);
cmGeneratedFileStream BuildFileStream(path);
- const std::string& PathToProjectFile = path;
+ std::string const& PathToProjectFile = path;
BuildFileStream.SetCopyIfDifferent(true);
// Write the encoding header into the file
@@ -476,7 +475,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
{
Elem e0(BuildFileStream, "Project");
e0.Attribute("DefaultTargets", "Build");
- const char* toolsVersion = this->GlobalGenerator->GetToolsVersion();
+ char const* toolsVersion = this->GlobalGenerator->GetToolsVersion();
e0.Attribute("ToolsVersion", toolsVersion);
e0.Attribute("xmlns",
"http://schemas.microsoft.com/developer/msbuild/2003");
@@ -484,8 +483,8 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
if (this->NsightTegra) {
Elem e1(e0, "PropertyGroup");
e1.Attribute("Label", "NsightTegraProject");
- const unsigned int nsightTegraMajorVersion = this->NsightTegraVersion[0];
- const unsigned int nsightTegraMinorVersion = this->NsightTegraVersion[1];
+ unsigned int const nsightTegraMajorVersion = this->NsightTegraVersion[0];
+ unsigned int const nsightTegraMinorVersion = this->NsightTegraVersion[1];
if (nsightTegraMajorVersion >= 2) {
if (nsightTegraMajorVersion > 3 ||
(nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1)) {
@@ -502,7 +501,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
}
}
- if (const char* hostArch =
+ if (char const* hostArch =
this->GlobalGenerator->GetPlatformToolsetHostArchitecture()) {
Elem e1(e0, "PropertyGroup");
e1.Element("PreferredToolArchitecture", hostArch);
@@ -642,7 +641,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
// the IDE.
e1.Element("VCProjectUpgraderObjectName", "NoUpgrade");
- if (const char* vcTargetsPath =
+ if (char const* vcTargetsPath =
this->GlobalGenerator->GetCustomVCTargetsPath()) {
e1.Element("VCTargetsPath", vcTargetsPath);
}
@@ -985,7 +984,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
}
}
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
Elem e1(e0, "PropertyGroup");
e1.Attribute("Condition",
cmStrCat("'$(Configuration)' == '", config, '\''));
@@ -1003,7 +1002,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
oh.OutputFlagMap();
}
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
this->WriteSdkStyleEvents(e0, config);
}
@@ -1014,6 +1013,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
this->WriteXamlFilesGroup(e0);
this->WriteDotNetReferences(e0);
this->WritePackageReferences(e0);
+ this->WriteImports(e0);
this->WriteProjectReferences(e0);
}
@@ -1025,7 +1025,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1)
cmValue vsProjectTypes =
this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
if (vsProjectTypes) {
- const char* tagName = "ProjectTypes";
+ char const* tagName = "ProjectTypes";
if (this->ProjectType == VsProjectType::csproj) {
tagName = "ProjectTypeGuids";
}
@@ -1052,7 +1052,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1)
std::vector<std::string> keys = this->GeneratorTarget->GetPropertyKeys();
for (std::string const& keyIt : keys) {
- static const cm::string_view prefix = "VS_GLOBAL_";
+ static cm::string_view const prefix = "VS_GLOBAL_";
if (!cmHasPrefix(keyIt, prefix)) {
continue;
}
@@ -1097,7 +1097,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
}
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
for (auto const& i : props.GetList()) {
- static const cm::string_view vsDnRef = "VS_DOTNET_REFERENCE_";
+ static cm::string_view const vsDnRef = "VS_DOTNET_REFERENCE_";
if (cmHasPrefix(i.first, vsDnRef)) {
std::string path = i.second;
if (!cmsys::SystemTools::FileIsFullPath(path)) {
@@ -1125,10 +1125,10 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
this->WriteDotNetReference(e1, ri, "", "");
}
}
- for (const auto& h : this->DotNetHintReferences) {
+ for (auto const& h : this->DotNetHintReferences) {
// DotNetHintReferences is also populated from AddLibraries().
// The configuration specific hint references are added there.
- for (const auto& i : h.second) {
+ for (auto const& i : h.second) {
this->WriteDotNetReference(e1, i.first, i.second, h.first);
}
}
@@ -1150,7 +1150,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference(
e2.Element("CopyLocalSatelliteAssemblies", "true");
e2.Element("ReferenceOutputAssembly", "true");
if (!hint.empty()) {
- const char* privateReference = "True";
+ char const* privateReference = "True";
if (cmValue value = this->GeneratorTarget->GetProperty(
"VS_DOTNET_REFERENCES_COPY_LOCAL")) {
if (value.IsOff()) {
@@ -1200,14 +1200,14 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags(
Elem& e2, std::string const& ref)
{
- static const std::string refpropPrefix = "VS_DOTNET_REFERENCEPROP_";
- static const std::string refpropInfix = "_TAG_";
- const std::string refPropFullPrefix =
+ static std::string const refpropPrefix = "VS_DOTNET_REFERENCEPROP_";
+ static std::string const refpropInfix = "_TAG_";
+ std::string const refPropFullPrefix =
cmStrCat(refpropPrefix, ref, refpropInfix);
using CustomTags = std::map<std::string, std::string>;
CustomTags tags;
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
- for (const auto& i : props.GetList()) {
+ for (auto const& i : props.GetList()) {
if (cmHasPrefix(i.first, refPropFullPrefix) && !i.second.empty()) {
tags[i.first.substr(refPropFullPrefix.length())] = i.second;
}
@@ -1305,9 +1305,9 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
e2.Element("LastGenOutput", designerResource);
}
}
- const cmPropertyMap& props = oi->GetProperties();
- for (const std::string& p : props.GetKeys()) {
- static const cm::string_view propNamePrefix = "VS_CSHARP_";
+ cmPropertyMap const& props = oi->GetProperties();
+ for (std::string const& p : props.GetKeys()) {
+ static cm::string_view const propNamePrefix = "VS_CSHARP_";
if (cmHasPrefix(p, propNamePrefix)) {
cm::string_view tagName =
cm::string_view(p).substr(propNamePrefix.length());
@@ -1436,7 +1436,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0)
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
- configType = "DynamicLibrary";
+ if (this->WindowsKernelMode) {
+ configType = "Driver";
+ } else {
+ configType = "DynamicLibrary";
+ }
break;
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
@@ -1481,6 +1485,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0)
} else if (this->Android) {
this->WriteAndroidConfigurationValues(e1, c);
}
+
+ if (this->WindowsKernelMode) {
+ this->WriteMSDriverConfigurationValues(e1, c);
+ }
}
}
@@ -1607,6 +1615,14 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
oh.OutputFlagMap();
}
+void cmVisualStudio10TargetGenerator::WriteMSDriverConfigurationValues(
+ Elem& e1, std::string const&)
+{
+ // FIXME: Introduce a way for project code to control these.
+ e1.Element("DriverType", "KMDF");
+ e1.Element("DriverTargetPlatform", "Universal");
+}
+
void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesCommon(
Elem& e1, std::string const& config)
{
@@ -1614,7 +1630,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesCommon(
if (cmValue projectToolsetOverride =
this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
e1.Element("PlatformToolset", *projectToolsetOverride);
- } else if (const char* toolset = gg->GetPlatformToolset()) {
+ } else if (char const* toolset = gg->GetPlatformToolset()) {
e1.Element("PlatformToolset", toolset);
}
@@ -1656,7 +1672,7 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
Elem& e1, std::string const&)
{
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
- const char* toolset = gg->GetPlatformToolset();
+ char const* toolset = gg->GetPlatformToolset();
e1.Element("NdkToolchainVersion", toolset ? toolset : "Default");
if (cmValue minApi = this->GeneratorTarget->GetProperty("ANDROID_API_MIN")) {
e1.Element("AndroidMinAPI", cmStrCat("android-", *minApi));
@@ -1682,7 +1698,7 @@ void cmVisualStudio10TargetGenerator::WriteAndroidConfigurationValues(
if (cmValue projectToolsetOverride =
this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
e1.Element("PlatformToolset", *projectToolsetOverride);
- } else if (const char* toolset = gg->GetPlatformToolset()) {
+ } else if (char const* toolset = gg->GetPlatformToolset()) {
e1.Element("PlatformToolset", toolset);
}
if (cmValue stlType =
@@ -1798,7 +1814,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
// input files for custom command
std::stringstream additional_inputs;
{
- const char* sep = "";
+ char const* sep = "";
if (this->ProjectType == VsProjectType::csproj) {
// csproj files do not attach the command to a specific file
// so the primary input must be listed explicitly.
@@ -1845,7 +1861,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
// output files for custom command
std::stringstream outputs;
{
- const char* sep = "";
+ char const* sep = "";
for (std::string const& o : ccg.GetOutputs()) {
std::string out = o;
ConvertToWindowsSlash(out);
@@ -1870,7 +1886,9 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
BuildInParallel buildInParallel = BuildInParallel::No;
if (command.GetCMP0147Status() == cmPolicies::NEW &&
!command.GetUsesTerminal() &&
- !(command.HasMainDependency() && source->GetIsGenerated())) {
+ !(command.HasMainDependency() && source->GetIsGenerated()) &&
+ !source->GetPropertyAsBool(
+ "VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD")) {
buildInParallel = BuildInParallel::Yes;
}
this->WriteCustomRuleCpp(*spe2, c, script, additional_inputs.str(),
@@ -1886,7 +1904,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp(
std::string const& comment, cmCustomCommandGenerator const& ccg,
bool symbolic, BuildInParallel buildInParallel)
{
- const std::string cond = this->CalcCondition(config);
+ std::string const cond = this->CalcCondition(config);
if (buildInParallel == BuildInParallel::Yes &&
this->GlobalGenerator->IsBuildInParallelSupported()) {
e2.WritePlatformConfigTag("BuildInParallel", cond, "true");
@@ -2107,7 +2125,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
// Add to groupsUsed empty source groups that have non-empty children.
void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
std::set<cmSourceGroup const*>& groupsUsed,
- const std::vector<cmSourceGroup>& allGroups)
+ std::vector<cmSourceGroup> const& allGroups)
{
for (cmSourceGroup const& current : allGroups) {
std::vector<cmSourceGroup> const& children = current.GetGroupChildren();
@@ -2177,7 +2195,7 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(
}
void cmVisualStudio10TargetGenerator::ParseSettingsProperty(
- const std::string& settingsPropertyValue, ConfigToSettings& toolSettings)
+ std::string const& settingsPropertyValue, ConfigToSettings& toolSettings)
{
if (!settingsPropertyValue.empty()) {
cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
@@ -2185,15 +2203,15 @@ void cmVisualStudio10TargetGenerator::ParseSettingsProperty(
std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(settingsPropertyValue);
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
std::string evaluated = cge->Evaluate(this->LocalGenerator, config);
cmList settings{ evaluated };
- for (const auto& setting : settings) {
- const std::string::size_type assignment = setting.find('=');
+ for (auto const& setting : settings) {
+ std::string::size_type const assignment = setting.find('=');
if (assignment != std::string::npos) {
- const std::string propName = setting.substr(0, assignment);
- const std::string propValue = setting.substr(assignment + 1);
+ std::string const propName = setting.substr(0, assignment);
+ std::string const propValue = setting.substr(assignment + 1);
if (!propValue.empty()) {
toolSettings[config][propName] = propValue;
@@ -2205,11 +2223,11 @@ void cmVisualStudio10TargetGenerator::ParseSettingsProperty(
}
bool cmVisualStudio10TargetGenerator::PropertyIsSameInAllConfigs(
- const ConfigToSettings& toolSettings, const std::string& propName)
+ ConfigToSettings const& toolSettings, std::string const& propName)
{
std::string firstPropValue;
- for (const auto& configToSettings : toolSettings) {
- const std::unordered_map<std::string, std::string>& settings =
+ for (auto const& configToSettings : toolSettings) {
+ std::unordered_map<std::string, std::string> const& settings =
configToSettings.second;
if (firstPropValue.empty()) {
@@ -2234,7 +2252,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
Elem& e1, cmSourceFile const* sf, ConfigToSettings& toolSettings)
{
bool toolHasSettings = false;
- const char* tool = "None";
+ char const* tool = "None";
std::string settingsGenerator;
std::string settingsLastGenOutput;
std::string sourceLink;
@@ -2250,31 +2268,31 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
tool = "FXCompile";
// Figure out the type of shader compiler to use.
if (cmValue st = sf->GetProperty("VS_SHADER_TYPE")) {
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
toolSettings[config]["ShaderType"] = *st;
}
}
// Figure out which entry point to use if any
if (cmValue se = sf->GetProperty("VS_SHADER_ENTRYPOINT")) {
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
toolSettings[config]["EntryPointName"] = *se;
}
}
// Figure out which shader model to use if any
if (cmValue sm = sf->GetProperty("VS_SHADER_MODEL")) {
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
toolSettings[config]["ShaderModel"] = *sm;
}
}
// Figure out which output header file to use if any
if (cmValue ohf = sf->GetProperty("VS_SHADER_OUTPUT_HEADER_FILE")) {
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
toolSettings[config]["HeaderFileOutput"] = *ohf;
}
}
// Figure out which variable name to use if any
if (cmValue vn = sf->GetProperty("VS_SHADER_VARIABLE_NAME")) {
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
toolSettings[config]["VariableName"] = *vn;
}
}
@@ -2283,7 +2301,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*saf);
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
std::string evaluated = cge->Evaluate(this->LocalGenerator, config);
if (!evaluated.empty()) {
@@ -2296,7 +2314,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*sed);
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
std::string evaluated = cge->Evaluate(this->LocalGenerator, config);
if (!evaluated.empty()) {
@@ -2310,7 +2328,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*sdo);
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
std::string evaluated = cge->Evaluate(this->LocalGenerator, config);
if (!evaluated.empty()) {
@@ -2320,7 +2338,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
}
}
if (cmValue sofn = sf->GetProperty("VS_SHADER_OBJECT_FILE_NAME")) {
- for (const std::string& config : this->Configurations) {
+ for (std::string const& config : this->Configurations) {
toolSettings[config]["ObjectFileOutput"] = *sofn;
}
}
@@ -2403,8 +2421,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
ParsedToolTargetSettings[tool] = toolTargetSettings;
}
- for (const auto& configToSetting : ParsedToolTargetSettings[tool]) {
- for (const auto& setting : configToSetting.second) {
+ for (auto const& configToSetting : ParsedToolTargetSettings[tool]) {
+ for (auto const& setting : configToSetting.second) {
toolSettings[configToSetting.first][setting.first] = setting.second;
}
}
@@ -2507,7 +2525,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
return;
}
- const bool haveUnityBuild =
+ bool const haveUnityBuild =
this->GeneratorTarget->GetPropertyAsBool("UNITY_BUILD");
if (haveUnityBuild && this->GlobalGenerator->GetSupportsUnityBuilds()) {
@@ -2536,15 +2554,15 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
}
ConfigToSettings toolSettings;
- for (const auto& config : this->Configurations) {
+ for (auto const& config : this->Configurations) {
toolSettings[config];
}
if (cmValue p = si.Source->GetProperty("VS_SETTINGS")) {
ParseSettingsProperty(*p, toolSettings);
}
- const char* tool = nullptr;
- const cmValue toolOverride = si.Source->GetProperty("VS_TOOL_OVERRIDE");
+ char const* tool = nullptr;
+ cmValue const toolOverride = si.Source->GetProperty("VS_TOOL_OVERRIDE");
if (cmNonempty(toolOverride)) {
// Custom tool specified: the file will be built in a user-defined way
@@ -2581,7 +2599,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
case cmGeneratorTarget::SourceKindCxxModuleSource:
case cmGeneratorTarget::SourceKindUnityBatched:
case cmGeneratorTarget::SourceKindObjectSource: {
- const std::string& lang = si.Source->GetLanguage();
+ std::string const& lang = si.Source->GetLanguage();
if (lang == "C"_s || lang == "CXX"_s) {
tool = "ClCompile";
} else if (lang == "ASM_MARMASM"_s &&
@@ -2632,7 +2650,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (isCSharp && !exclude_configs.empty()) {
std::stringstream conditions;
bool firstConditionSet{ false };
- for (const auto& ci : include_configs) {
+ for (auto const& ci : include_configs) {
if (firstConditionSet) {
conditions << " Or ";
}
@@ -2648,7 +2666,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
bool useNativeUnityBuild = false;
if (haveUnityBuild && this->GlobalGenerator->GetSupportsUnityBuilds()) {
// Magic value taken from cmGlobalVisualStudioVersionedGenerator.cxx
- static const std::string vs15 = "141";
+ static std::string const vs15 = "141";
std::string toolset =
this->GlobalGenerator->GetPlatformToolsetString();
cmSystemTools::ReplaceString(toolset, "v", "");
@@ -2725,8 +2743,8 @@ void cmVisualStudio10TargetGenerator::FinishWritingSource(
Elem& e2, ConfigToSettings const& toolSettings)
{
std::vector<std::string> writtenSettings;
- for (const auto& configSettings : toolSettings) {
- for (const auto& setting : configSettings.second) {
+ for (auto const& configSettings : toolSettings) {
+ for (auto const& setting : configSettings.second) {
if (std::find(writtenSettings.begin(), writtenSettings.end(),
setting.first) != writtenSettings.end()) {
@@ -2792,7 +2810,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
? "C"
: this->GlobalGenerator->GetLanguageFromExtension(ext.c_str());
std::string lang = this->LocalGenerator->GetSourceFileLanguage(sf);
- const char* compileAs = nullptr;
+ char const* compileAs = nullptr;
if (lang != extLang) {
if (lang == "CXX"_s) {
// force a C++ file type
@@ -2845,7 +2863,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
this->GeneratorTarget->NeedDyndepForSource(lang, config, source);
auto const* fs =
this->GeneratorTarget->GetFileSetForSource(config, source);
- const char* compileAsPerConfig = compileAs;
+ char const* compileAsPerConfig = compileAs;
if (fs && fs->GetType() == "CXX_MODULES"_s) {
if (lang == "CXX"_s) {
if (fs->GetType() == "CXX_MODULES"_s) {
@@ -2881,14 +2899,14 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
this->GeneratorTarget->GetLinkerLanguage(config);
std::string const& pchSource =
this->GeneratorTarget->GetPchSource(config, lang);
- const bool skipPCH =
+ bool const skipPCH =
pchSource.empty() || sf.GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS");
- const bool makePCH = (sf.GetFullPath() == pchSource);
- const bool useSharedPCH = !skipPCH && (lang == linkLanguage);
- const bool useDifferentLangPCH = !skipPCH && (lang != linkLanguage);
- const bool useNoPCH = skipPCH && (lang != linkLanguage) &&
+ bool const makePCH = (sf.GetFullPath() == pchSource);
+ bool const useSharedPCH = !skipPCH && (lang == linkLanguage);
+ bool const useDifferentLangPCH = !skipPCH && (lang != linkLanguage);
+ bool const useNoPCH = skipPCH && (lang != linkLanguage) &&
!this->GeneratorTarget->GetPchHeader(config, linkLanguage).empty();
- const bool needsPCHFlags =
+ bool const needsPCHFlags =
(makePCH || useSharedPCH || useDifferentLangPCH || useNoPCH);
// if we have flags or defines for this config then
@@ -2900,7 +2918,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
this->ScanSourceForModuleDependencies[config])) {
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmIDEFlagTable const* flagtable = nullptr;
- const std::string& srclang = source->GetLanguage();
+ std::string const& srclang = source->GetLanguage();
if (srclang == "C"_s || srclang == "CXX"_s) {
flagtable = gg->GetClFlagTable();
} else if (srclang == "ASM_MARMASM"_s &&
@@ -3019,7 +3037,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
if (this->IsXamlSource(source->GetFullPath())) {
- const std::string& fileName = source->GetFullPath();
+ std::string const& fileName = source->GetFullPath();
e2.Element("DependentUpon",
fileName.substr(0, fileName.find_last_of('.')));
}
@@ -3060,7 +3078,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
Elem e1(e0, "PropertyGroup");
e1.Element("_ProjectFileVersion", "10.0.20506.1");
for (std::string const& config : this->Configurations) {
- const std::string cond = this->CalcCondition(config);
+ std::string const cond = this->CalcCondition(config);
if (ttype >= cmStateEnums::UTILITY) {
e1.WritePlatformConfigTag(
@@ -3150,8 +3168,9 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
}
if (ttype <= cmStateEnums::UTILITY) {
- if (cmValue workingDir = this->GeneratorTarget->GetProperty(
- "VS_DEBUGGER_WORKING_DIRECTORY")) {
+ if (cmValue workingDir =
+ this->GlobalGenerator->GetDebuggerWorkingDirectory(
+ this->GeneratorTarget)) {
std::string genWorkingDir = cmGeneratorExpression::Evaluate(
*workingDir, this->LocalGenerator, config);
e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond,
@@ -3201,7 +3220,7 @@ void cmVisualStudio10TargetGenerator::WritePublicProjectContentOptions(
if (this->GeneratorTarget->HaveCxx20ModuleSources() &&
this->GeneratorTarget->HaveCxxModuleSupport(config) ==
cmGeneratorTarget::Cxx20SupportLevel::Supported) {
- const std::string cond = this->CalcCondition(config);
+ std::string const cond = this->CalcCondition(config);
// For DLL projects, we export all BMIs for now
e1.WritePlatformConfigTag("AllProjectBMIsArePublic", cond, "true");
}
@@ -3214,9 +3233,13 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
if (!this->MSTools) {
return;
}
+ if (this->WindowsKernelMode) {
+ return;
+ }
if (this->ProjectType == VsProjectType::csproj) {
return;
}
+
// static libraries and things greater than modules do not need
// to set this option
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
@@ -3224,29 +3247,29 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
return;
}
Options& linkOptions = *(this->LinkOptions[configName]);
- const std::string cond = this->CalcCondition(configName);
+ std::string const cond = this->CalcCondition(configName);
if (this->IPOEnabledConfigurations.count(configName) > 0) {
// Suppress LinkIncremental in favor of WholeProgramOptimization.
e1.WritePlatformConfigTag("LinkIncremental", cond, "");
} else {
- const char* incremental = linkOptions.GetFlag("LinkIncremental");
+ char const* incremental = linkOptions.GetFlag("LinkIncremental");
e1.WritePlatformConfigTag("LinkIncremental", cond,
(incremental ? incremental : "true"));
}
linkOptions.RemoveFlag("LinkIncremental");
- const char* manifest = linkOptions.GetFlag("GenerateManifest");
+ char const* manifest = linkOptions.GetFlag("GenerateManifest");
e1.WritePlatformConfigTag("GenerateManifest", cond,
(manifest ? manifest : "true"));
linkOptions.RemoveFlag("GenerateManifest");
// Some link options belong here. Use them now and remove them so that
// WriteLinkOptions does not use them.
- static const std::vector<std::string> flags{ "LinkDelaySign",
+ static std::vector<std::string> const flags{ "LinkDelaySign",
"LinkKeyFile" };
- for (const std::string& flag : flags) {
- if (const char* value = linkOptions.GetFlag(flag)) {
+ for (std::string const& flag : flags) {
+ if (char const* value = linkOptions.GetFlag(flag)) {
e1.WritePlatformConfigTag(flag, cond, value);
linkOptions.RemoveFlag(flag);
}
@@ -3271,7 +3294,7 @@ std::string cmVisualStudio10TargetGenerator::GetTargetOutputName() const
if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
- const auto& nameComponents =
+ auto const& nameComponents =
this->GeneratorTarget->GetFullNameComponents(config);
return cmStrCat(nameComponents.prefix, nameComponents.base);
}
@@ -3321,7 +3344,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
Options& clOptions = *pOptions;
std::string flags;
- const std::string& linkLanguage =
+ std::string const& linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(configName);
if (linkLanguage.empty()) {
cmSystemTools::Error(cmStrCat(
@@ -3330,7 +3353,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
// Choose a language whose flags to use for ClCompile.
- static const char* clLangs[] = { "CXX", "C", "Fortran" };
+ static char const* clLangs[] = { "CXX", "C", "Fortran" };
std::string langForClCompile;
if (this->ProjectType == VsProjectType::csproj) {
langForClCompile = "CSharp";
@@ -3339,7 +3362,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
} else {
std::set<std::string> languages;
this->GeneratorTarget->GetLanguages(languages, configName);
- for (const char* l : clLangs) {
+ for (char const* l : clLangs) {
if (languages.count(l)) {
langForClCompile = l;
break;
@@ -3487,7 +3510,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// sources in a single .vcxproj file, so if we have C sources too then we
// cannot use it. Map it back to -std::c++latest, even though that might
// end up enabling C++26 or later, so it does not apply to C sources.
- static const std::string kClangStdCxx23 = "-clang:-std=c++23";
+ static std::string const kClangStdCxx23 = "-clang:-std=c++23";
std::string::size_type p = flags.find(kClangStdCxx23);
if (p != std::string::npos) {
flags.replace(p, kClangStdCxx23.size(), "-std:c++latest");
@@ -3535,7 +3558,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
Options optC(this->LocalGenerator, Options::Compiler,
gg->GetClFlagTable());
optC.Parse(flagsC);
- if (const char* stdC = optC.GetFlag("LanguageStandard_C")) {
+ if (char const* stdC = optC.GetFlag("LanguageStandard_C")) {
clOptions.AddFlag("LanguageStandard_C", stdC);
}
}
@@ -3543,7 +3566,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Add a definition for the configuration name.
std::string configDefine = cmStrCat("CMAKE_INTDIR=\"", configName, '"');
clOptions.AddDefine(configDefine);
- if (const std::string* exportMacro =
+ if (std::string const* exportMacro =
this->GeneratorTarget->GetExportMacro()) {
clOptions.AddDefine(*exportMacro);
}
@@ -3564,7 +3587,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("CompileAsWinRT", "false");
}
}
- if (const char* winRT = clOptions.GetFlag("CompileAsWinRT")) {
+ if (char const* winRT = clOptions.GetFlag("CompileAsWinRT")) {
if (cmIsOn(winRT)) {
this->TargetCompileAsWinRT = true;
}
@@ -3594,7 +3617,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- if (const char* s = clOptions.GetFlag("SpectreMitigation")) {
+ if (char const* s = clOptions.GetFlag("SpectreMitigation")) {
this->SpectreMitigation[configName] = s;
clOptions.RemoveFlag("SpectreMitigation");
}
@@ -3654,7 +3677,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
e2.Element("ObjectFileName", "$(IntDir)%(filename).o");
} else if (this->MSTools) {
cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*");
- const char* toolset = this->GlobalGenerator->GetPlatformToolset();
+ char const* toolset = this->GlobalGenerator->GetPlatformToolset();
cmValue noCompileBatching =
this->GeneratorTarget->GetProperty("VS_NO_COMPILE_BATCHING");
if (noCompileBatching.IsOn() || (toolset && clangToolset.find(toolset))) {
@@ -3702,6 +3725,10 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
e2.Element("ScanSourceForModuleDependencies",
this->ScanSourceForModuleDependencies[configName] ? "true"
: "false");
+ if (this->WindowsKernelMode) {
+ e2.Element("WppEnabled", "true");
+ e2.Element("WppRecorderEnabled", "true");
+ }
}
bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
@@ -3884,7 +3911,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// `CUDA 8.0.targets` places AdditionalCompilerOptions before nvcc!
// Pass them through -Xcompiler in AdditionalOptions instead.
- if (const char* acoPtr = cudaOptions.GetFlag("AdditionalCompilerOptions")) {
+ if (char const* acoPtr = cudaOptions.GetFlag("AdditionalCompilerOptions")) {
std::string aco = acoPtr;
cudaOptions.RemoveFlag("AdditionalCompilerOptions");
if (!aco.empty()) {
@@ -3904,7 +3931,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// Add a definition for the configuration name.
std::string configDefine = cmStrCat("CMAKE_INTDIR=\"", configName, '"');
cudaOptions.AddDefine(configDefine);
- if (const std::string* exportMacro =
+ if (std::string const* exportMacro =
this->GeneratorTarget->GetExportMacro()) {
cudaOptions.AddDefine(*exportMacro);
}
@@ -3973,7 +4000,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
cmGeneratorTarget::DeviceLinkSetter setter(*this->GeneratorTarget);
// Determine if we need to do a device link
- const bool doDeviceLinking = requireDeviceLinking(
+ bool const doDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, configName);
cudaLinkOptions.AddFlag("PerformDeviceLink",
@@ -4016,7 +4043,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
// CMake conversion uses full paths when possible to allow deeper trees.
// However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA
// we must use relative paths.
- const bool forceRelative = true;
+ bool const forceRelative = true;
for (cmGeneratorTarget::SourceAndKind const& si : kinded.Sources) {
switch (si.Kind) {
case cmGeneratorTarget::SourceKindExternalObject: {
@@ -4240,7 +4267,7 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions(
return;
}
- const std::string& linkLanguage =
+ std::string const& linkLanguage =
this->GeneratorTarget->GetLinkClosure(config)->LinkerLanguage;
std::string libflags;
@@ -4427,7 +4454,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
cmGeneratorTarget::LinkClosure const* linkClosure =
this->GeneratorTarget->GetLinkClosure(config);
- const std::string& linkLanguage = linkClosure->LinkerLanguage;
+ std::string const& linkLanguage = linkClosure->LinkerLanguage;
if (linkLanguage.empty()) {
cmSystemTools::Error(cmStrCat(
"CMake can not determine linker language for target: ", this->Name));
@@ -4436,7 +4463,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string CONFIG = cmSystemTools::UpperCase(config);
- const char* linkType = "SHARED";
+ char const* linkType = "SHARED";
if (this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
linkType = "MODULE";
}
@@ -4444,12 +4471,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
linkType = "EXE";
}
std::string flags;
- std::string linkFlagVarBase = cmStrCat("CMAKE_", linkType, "_LINKER_FLAGS");
- flags += ' ';
- flags += this->Makefile->GetRequiredDefinition(linkFlagVarBase);
- std::string linkFlagVar = cmStrCat(linkFlagVarBase, '_', CONFIG);
- flags += ' ';
- flags += this->Makefile->GetRequiredDefinition(linkFlagVar);
+ this->LocalGenerator->AddConfigVariableFlags(
+ flags, cmStrCat("CMAKE_", linkType, "_LINKER_FLAGS"),
+ this->GeneratorTarget, cmBuildStep::Link, linkLanguage, config);
cmValue targetLinkFlags = this->GeneratorTarget->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
flags += ' ';
@@ -4466,6 +4490,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
// LINK_OPTIONS are escaped.
this->LocalGenerator->AppendCompileOptions(flags, opts);
+ this->LocalGenerator->AppendWarningAsErrorLinkerFlags(
+ flags, this->GeneratorTarget, linkLanguage);
+
cmComputeLinkInformation* pcli =
this->GeneratorTarget->GetLinkInformation(config);
if (!pcli) {
@@ -4501,7 +4528,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string const& linkDirsString = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", linkLanguage, "_STANDARD_LINK_DIRECTORIES"));
- for (const std::string& d : cmList(linkDirsString)) {
+ for (std::string const& d : cmList(linkDirsString)) {
linkDirs.push_back(d);
}
@@ -4601,7 +4628,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
// VS 2015 without all updates has a v140 toolset whose
// GenerateDebugInformation expects No/Debug instead of false/true.
if (gg->GetPlatformToolsetNeedsDebugEnum()) {
- if (const char* debug = linkOptions.GetFlag("GenerateDebugInformation")) {
+ if (char const* debug = linkOptions.GetFlag("GenerateDebugInformation")) {
if (strcmp(debug, "false") == 0) {
linkOptions.AddFlag("GenerateDebugInformation", "No");
} else if (strcmp(debug, "true") == 0) {
@@ -4612,7 +4639,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
// Managed code cannot be linked with /DEBUG:FASTLINK
if (this->Managed) {
- if (const char* debug = linkOptions.GetFlag("GenerateDebugInformation")) {
+ if (char const* debug = linkOptions.GetFlag("GenerateDebugInformation")) {
if (strcmp(debug, "DebugFastLink") == 0) {
linkOptions.AddFlag("GenerateDebugInformation", "Debug");
}
@@ -4649,7 +4676,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
cmComputeLinkInformation& cli = *pcli;
using ItemVector = cmComputeLinkInformation::ItemVector;
- const ItemVector& libs = cli.GetItems();
+ ItemVector const& libs = cli.GetItems();
for (cmComputeLinkInformation::Item const& l : libs) {
if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes &&
cmVS10IsTargetsFile(l.Value.Value)) {
@@ -4689,8 +4716,8 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(
}
void cmVisualStudio10TargetGenerator::AddLibraries(
- const cmComputeLinkInformation& cli, std::vector<std::string>& libVec,
- std::vector<std::string>& vsTargetVec, const std::string& config)
+ cmComputeLinkInformation const& cli, std::vector<std::string>& libVec,
+ std::vector<std::string>& vsTargetVec, std::string const& config)
{
using ItemVector = cmComputeLinkInformation::ItemVector;
ItemVector const& libs = cli.GetItems();
@@ -4823,7 +4850,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
if (this->ProjectType == VsProjectType::csproj) {
return;
}
- for (const std::string& c : this->Configurations) {
+ for (std::string const& c : this->Configurations) {
Elem e1(e0, "ItemDefinitionGroup");
e1.Attribute("Condition", this->CalcCondition(c));
@@ -4837,6 +4864,10 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
this->WriteMasmOptions(e1, c);
this->WriteNasmOptions(e1, c);
}
+
+ if (this->WindowsKernelMode) {
+ Elem(e1, "DriverSign").Element("FileDigestAlgorithm", "sha256");
+ }
// output midl flags <Midl></Midl>
this->WriteMidlOptions(e1, c);
// write events
@@ -4882,7 +4913,7 @@ void cmVisualStudio10TargetGenerator::WriteEvents(
}
void cmVisualStudio10TargetGenerator::WriteEvent(
- Elem& e1, const std::string& name,
+ Elem& e1, std::string const& name,
std::vector<cmCustomCommand> const& commands, std::string const& configName)
{
if (commands.empty()) {
@@ -4890,7 +4921,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
}
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::string script;
- const char* pre = "";
+ char const* pre = "";
std::string comment;
bool stdPipesUTF8 = false;
for (cmCustomCommand const& cc : commands) {
@@ -4945,8 +4976,8 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleEvents(
}
void cmVisualStudio10TargetGenerator::WriteSdkStyleEvent(
- Elem& e0, const std::string& name, const std::string& when,
- const std::string& target, std::vector<cmCustomCommand> const& commands,
+ Elem& e0, std::string const& name, std::string const& when,
+ std::string const& target, std::vector<cmCustomCommand> const& commands,
std::string const& configName)
{
if (commands.empty()) {
@@ -4961,7 +4992,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleEvent(
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::string script;
- const char* pre = "";
+ char const* pre = "";
std::string comment;
bool stdPipesUTF8 = false;
for (cmCustomCommand const& cc : commands) {
@@ -5065,7 +5096,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformExtensions(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension(
Elem& e1, std::string const& extension, std::string const& version)
{
- const std::string s =
+ std::string const s =
cmStrCat("$([Microsoft.Build.Utilities.ToolLocationHelper]"
"::GetPlatformExtensionSDKLocation(`",
extension, ", Version=", version,
@@ -5131,7 +5162,7 @@ void cmVisualStudio10TargetGenerator::WriteSingleSDKReference(
}
namespace {
-std::string ComputeCertificateThumbprint(const std::string& source)
+std::string ComputeCertificateThumbprint(std::string const& source)
{
std::string thumbprint;
@@ -5299,19 +5330,19 @@ void cmVisualStudio10TargetGenerator::ClassifyAllConfigSource(
}
bool cmVisualStudio10TargetGenerator::IsResxHeader(
- const std::string& headerFile)
+ std::string const& headerFile)
{
return this->ExpectedResxHeaders.count(headerFile) > 0;
}
bool cmVisualStudio10TargetGenerator::IsXamlHeader(
- const std::string& headerFile)
+ std::string const& headerFile)
{
return this->ExpectedXamlHeaders.count(headerFile) > 0;
}
bool cmVisualStudio10TargetGenerator::IsXamlSource(
- const std::string& sourceFile)
+ std::string const& sourceFile)
{
return this->ExpectedXamlSources.count(sourceFile) > 0;
}
@@ -5473,7 +5504,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
- const std::string& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
+ std::string const& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
@@ -5555,7 +5586,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1)
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
- const std::string& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
+ std::string const& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
@@ -5617,7 +5648,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1)
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
- const std::string& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
+ std::string const& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
@@ -5671,7 +5702,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1)
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
- const std::string& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
+ std::string const& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
@@ -5730,7 +5761,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1)
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
- const std::string& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
+ std::string const& targetNameXML = cmVS10EscapeXML(GetTargetOutputName());
cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
@@ -5783,7 +5814,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1)
}
void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
- Elem& e1, const std::string& manifestFile)
+ Elem& e1, std::string const& manifestFile)
{
std::string templateFolder =
cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows");
@@ -5842,7 +5873,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
}
}
-bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
+bool cmVisualStudio10TargetGenerator::ForceOld(std::string const& source) const
{
HANDLE h =
CreateFileW(cmSystemTools::ConvertToWindowsExtendedPath(source).c_str(),
@@ -5866,9 +5897,9 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
cmSourceFile const* sf, std::map<std::string, std::string>& tags)
{
if (this->ProjectType == VsProjectType::csproj) {
- const cmPropertyMap& props = sf->GetProperties();
- for (const std::string& p : props.GetKeys()) {
- static const cm::string_view propNamePrefix = "VS_CSHARP_";
+ cmPropertyMap const& props = sf->GetProperties();
+ for (std::string const& p : props.GetKeys()) {
+ static cm::string_view const propNamePrefix = "VS_CSHARP_";
if (cmHasPrefix(p, propNamePrefix)) {
std::string tagName = p.substr(propNamePrefix.length());
if (!tagName.empty()) {
@@ -5885,9 +5916,9 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
}
void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties(
- Elem& e2, const std::map<std::string, std::string>& tags)
+ Elem& e2, std::map<std::string, std::string> const& tags)
{
- for (const auto& i : tags) {
+ for (auto const& i : tags) {
e2.Element(i.first, i.second);
}
}
@@ -5934,7 +5965,7 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
}
std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
- const char* relativeFilePath) const
+ char const* relativeFilePath) const
{
// Always search in the standard modules location.
std::string path =
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 9b7ae10..162a140 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -65,7 +65,7 @@ private:
std::unordered_map<std::string, std::string>>;
std::string ConvertPath(std::string const& path, bool forceRelative);
- std::string CalcCondition(const std::string& config) const;
+ std::string CalcCondition(std::string const& config) const;
void WriteProjectConfigurations(Elem& e0);
void WriteProjectConfigurationValues(Elem& e0);
void WriteMSToolConfigurationValues(Elem& e1, std::string const& config);
@@ -74,6 +74,7 @@ private:
std::string const& config);
void WriteMSToolConfigurationValuesCommon(Elem& e1,
std::string const& config);
+ void WriteMSDriverConfigurationValues(Elem& e1, std::string const& config);
void WriteHeaderSource(Elem& e1, cmSourceFile const* sf,
ConfigToSettings const& toolSettings);
void WriteExtraSource(Elem& e1, cmSourceFile const* sf,
@@ -115,7 +116,7 @@ private:
void WriteSDKReferences(Elem& e0);
void WriteSingleSDKReference(Elem& e1, std::string const& extension,
std::string const& version);
- void WriteCommonMissingFiles(Elem& e1, const std::string& manifestFile);
+ void WriteCommonMissingFiles(Elem& e1, std::string const& manifestFile);
void WriteTargetSpecificReferences(Elem& e0);
void WriteTargetsFileReferences(Elem& e1);
@@ -183,10 +184,10 @@ private:
void WriteProjectReferences(Elem& e0);
void WriteApplicationTypeSettings(Elem& e1);
void OutputSourceSpecificFlags(Elem& e2, cmSourceFile const* source);
- void AddLibraries(const cmComputeLinkInformation& cli,
+ void AddLibraries(cmComputeLinkInformation const& cli,
std::vector<std::string>& libVec,
std::vector<std::string>& vsTargetVec,
- const std::string& config);
+ std::string const& config);
void AddTargetsFileAndConfigPair(std::string const& targetsFile,
std::string const& config);
void WriteLibOptions(Elem& e1, std::string const& config);
@@ -196,25 +197,25 @@ private:
std::vector<cmCustomCommand> const& commands,
std::string const& configName);
void WriteSdkStyleEvents(Elem& e0, std::string const& configName);
- void WriteSdkStyleEvent(Elem& e0, const std::string& name,
- const std::string& when, const std::string& target,
+ void WriteSdkStyleEvent(Elem& e0, std::string const& name,
+ std::string const& when, std::string const& target,
std::vector<cmCustomCommand> const& commands,
std::string const& configName);
void WriteGroupSources(Elem& e0, std::string const& name,
ToolSources const& sources,
std::vector<cmSourceGroup>&);
void AddMissingSourceGroups(std::set<cmSourceGroup const*>& groupsUsed,
- const std::vector<cmSourceGroup>& allGroups);
- bool IsResxHeader(const std::string& headerFile);
- bool IsXamlHeader(const std::string& headerFile);
- bool IsXamlSource(const std::string& headerFile);
+ std::vector<cmSourceGroup> const& allGroups);
+ bool IsResxHeader(std::string const& headerFile);
+ bool IsXamlHeader(std::string const& headerFile);
+ bool IsXamlSource(std::string const& headerFile);
- bool ForceOld(const std::string& source) const;
+ bool ForceOld(std::string const& source) const;
void GetCSharpSourceProperties(cmSourceFile const* sf,
std::map<std::string, std::string>& tags);
void WriteCSharpSourceProperties(
- Elem& e2, const std::map<std::string, std::string>& tags);
+ Elem& e2, std::map<std::string, std::string> const& tags);
std::string GetCSharpSourceLink(cmSourceFile const* source);
void WriteStdOutEncodingUtf8(Elem& e1);
@@ -234,7 +235,7 @@ private:
std::string LangForClCompile;
VsProjectType ProjectType;
- bool InSourceBuild;
+ bool InSourceBuild = false;
std::vector<std::string> Configurations;
std::vector<TargetsFileAndConfigs> TargetsFileAndConfigsVec;
cmGeneratorTarget* const GeneratorTarget;
@@ -242,14 +243,15 @@ private:
std::string const Platform;
std::string const Name;
std::string const GUID;
- bool MSTools;
- bool Managed;
- bool NsightTegra;
- bool Android;
+ bool MSTools = false;
+ bool Managed = false;
+ bool NsightTegra = false;
+ bool Android = false;
+ bool WindowsKernelMode = false;
bool HaveCustomCommandDepfile = false;
std::map<std::string, bool> ScanSourceForModuleDependencies;
unsigned int NsightTegraVersion[4];
- bool TargetCompileAsWinRT;
+ bool TargetCompileAsWinRT = false;
std::set<std::string> IPOEnabledConfigurations;
std::set<std::string> ASanEnabledConfigurations;
std::set<std::string> FuzzerEnabledConfigurations;
@@ -257,7 +259,7 @@ private:
cmGlobalVisualStudio10Generator* const GlobalGenerator;
cmLocalVisualStudio10Generator* const LocalGenerator;
std::set<std::string> CSharpCustomCommandNames;
- bool IsMissingFiles;
+ bool IsMissingFiles = false;
std::vector<std::string> AddedFiles;
std::string DefaultArtifactDir;
bool AddedDefaultCertificate = false;
@@ -290,9 +292,9 @@ private:
cmVisualStudio10TargetGenerator::Elem& e1);
std::unordered_map<std::string, ConfigToSettings> ParsedToolTargetSettings;
- bool PropertyIsSameInAllConfigs(const ConfigToSettings& toolSettings,
- const std::string& propName);
- void ParseSettingsProperty(const std::string& settingsPropertyValue,
+ bool PropertyIsSameInAllConfigs(ConfigToSettings const& toolSettings,
+ std::string const& propName);
+ void ParseSettingsProperty(std::string const& settingsPropertyValue,
ConfigToSettings& toolSettings);
- std::string GetCMakeFilePath(const char* name) const;
+ std::string GetCMakeFilePath(char const* name) const;
};
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index a5f2cdf..c39ca57 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -118,7 +118,7 @@ bool cmVisualStudioGeneratorOptions::UsingDebugInfo() const
cm::optional<bool> cmVisualStudioGeneratorOptions::UsingDebugRuntime() const
{
cm::optional<bool> result;
- if (const char* rtl = this->GetFlag("RuntimeLibrary")) {
+ if (char const* rtl = this->GetFlag("RuntimeLibrary")) {
result = strstr(rtl, "Debug") != nullptr;
}
return result;
@@ -168,7 +168,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags()
return;
}
- const std::string uacFlag = GetFlag(ENABLE_UAC);
+ std::string const uacFlag = GetFlag(ENABLE_UAC);
std::vector<std::string> subOptions;
cmsys::SystemTools::Split(uacFlag, subOptions, ' ');
if (subOptions.empty()) {
@@ -228,7 +228,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags()
AddFlag(ENABLE_UAC, "true");
}
-void cmVisualStudioGeneratorOptions::Parse(const std::string& flags)
+void cmVisualStudioGeneratorOptions::Parse(std::string const& flags)
{
// Parse the input string as a windows command line since the string
// is intended for writing directly into the build files.
@@ -342,18 +342,18 @@ cmIDEOptions::FlagValue cmVisualStudioGeneratorOptions::TakeFlag(
}
void cmVisualStudioGeneratorOptions::SetConfiguration(
- const std::string& config)
+ std::string const& config)
{
this->Configuration = config;
}
-const std::string& cmVisualStudioGeneratorOptions::GetConfiguration() const
+std::string const& cmVisualStudioGeneratorOptions::GetConfiguration() const
{
return this->Configuration;
}
void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
- std::ostream& fout, int indent, const std::string& lang)
+ std::ostream& fout, int indent, std::string const& lang)
{
if (this->Defines.empty()) {
return;
@@ -389,7 +389,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
}
void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
- std::ostream& fout, int indent, const std::string& lang)
+ std::ostream& fout, int indent, std::string const& lang)
{
if (this->Includes.empty()) {
return;
@@ -403,7 +403,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
}
std::ostringstream oss;
- const char* sep = "";
+ char const* sep = "";
for (std::string include : this->Includes) {
// first convert all of the slashes
std::string::size_type pos = 0;
@@ -441,7 +441,7 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
{
for (auto const& m : this->FlagMap) {
std::ostringstream oss;
- const char* sep = "";
+ char const* sep = "";
for (std::string i : m.second) {
if (!this->LocalGenerator->IsVFProj()) {
cmVS10EscapeForMSBuild(i);
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 409fd62..935a77b 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,7 +44,7 @@ public:
void ClearTables();
// Store options from command line flags.
- void Parse(const std::string& flags);
+ void Parse(std::string const& flags);
void ParseFinish();
void PrependInheritedString(std::string const& key);
@@ -73,17 +73,17 @@ public:
bool IsManaged() const;
// Write options to output.
void OutputPreprocessorDefinitions(std::ostream& fout, int indent,
- const std::string& lang);
+ std::string const& lang);
void OutputAdditionalIncludeDirectories(std::ostream& fout, int indent,
- const std::string& lang);
+ std::string const& lang);
void OutputFlagMap(std::ostream& fout, int indent);
- void SetConfiguration(const std::string& config);
- const std::string& GetConfiguration() const;
+ void SetConfiguration(std::string const& config);
+ std::string const& GetConfiguration() const;
protected:
virtual void OutputFlag(std::ostream& fout, int indent,
- const std::string& tag,
- const std::string& content) = 0;
+ std::string const& tag,
+ std::string const& content) = 0;
private:
cmLocalVisualStudioGenerator* LocalGenerator;
diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx
index f685158..95e56f8 100644
--- a/Source/cmVisualStudioSlnData.cxx
+++ b/Source/cmVisualStudioSlnData.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVisualStudioSlnData.h"
#include <cstddef>
@@ -9,20 +9,20 @@
#include "cmSystemTools.h"
void cmSlnProjectEntry::AddProjectConfiguration(
- const std::string& solutionConfiguration,
- const std::string& projectConfiguration)
+ std::string const& solutionConfiguration,
+ std::string const& projectConfiguration)
{
projectConfigurationMap[solutionConfiguration] = projectConfiguration;
}
std::string cmSlnProjectEntry::GetProjectConfiguration(
- const std::string& solutionConfiguration)
+ std::string const& solutionConfiguration)
{
return projectConfigurationMap[solutionConfiguration];
}
cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByGUID(
- const std::string& projectGUID) const
+ std::string const& projectGUID) const
{
auto it(ProjectsByGUID.find(projectGUID));
if (it != ProjectsByGUID.end()) {
@@ -32,7 +32,7 @@ cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByGUID(
}
cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByName(
- const std::string& projectName) const
+ std::string const& projectName) const
{
auto it(ProjectNameIndex.find(projectName));
if (it != ProjectNameIndex.end()) {
@@ -53,8 +53,8 @@ std::vector<cmSlnProjectEntry> cmSlnData::GetProjects() const
}
cmSlnProjectEntry* cmSlnData::AddProject(
- const std::string& projectGUID, const std::string& projectName,
- const std::string& projectRelativePath)
+ std::string const& projectGUID, std::string const& projectName,
+ std::string const& projectRelativePath)
{
auto it(ProjectsByGUID.find(projectGUID));
if (it != ProjectsByGUID.end()) {
@@ -70,8 +70,8 @@ cmSlnProjectEntry* cmSlnData::AddProject(
}
std::string cmSlnData::GetConfigurationTarget(
- const std::string& projectName, const std::string& solutionConfiguration,
- const std::string& platformName)
+ std::string const& projectName, std::string const& solutionConfiguration,
+ std::string const& platformName)
{
std::string solutionTarget =
cmStrCat(solutionConfiguration, '|', platformName);
diff --git a/Source/cmVisualStudioSlnData.h b/Source/cmVisualStudioSlnData.h
index 5f03895..3ed185b 100644
--- a/Source/cmVisualStudioSlnData.h
+++ b/Source/cmVisualStudioSlnData.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,11 +26,11 @@ public:
std::string GetName() const { return Name; }
std::string GetRelativePath() const { return RelativePath; }
- void AddProjectConfiguration(const std::string& solutionConfiguration,
- const std::string& projectConfiguration);
+ void AddProjectConfiguration(std::string const& solutionConfiguration,
+ std::string const& projectConfiguration);
std::string GetProjectConfiguration(
- const std::string& solutionConfiguration);
+ std::string const& solutionConfiguration);
private:
std::string Guid, Name, RelativePath;
@@ -41,7 +41,7 @@ class cmSlnData
{
public:
std::string GetVisualStudioVersion() const { return visualStudioVersion; }
- void SetVisualStudioVersion(const std::string& version)
+ void SetVisualStudioVersion(std::string const& version)
{
visualStudioVersion = version;
}
@@ -51,31 +51,31 @@ public:
return minimumVisualStudioVersion;
}
- void SetMinimumVisualStudioVersion(const std::string& version)
+ void SetMinimumVisualStudioVersion(std::string const& version)
{
minimumVisualStudioVersion = version;
}
cm::optional<cmSlnProjectEntry> GetProjectByGUID(
- const std::string& projectGUID) const;
+ std::string const& projectGUID) const;
cm::optional<cmSlnProjectEntry> GetProjectByName(
- const std::string& projectName) const;
+ std::string const& projectName) const;
std::vector<cmSlnProjectEntry> GetProjects() const;
- cmSlnProjectEntry* AddProject(const std::string& projectGUID,
- const std::string& projectName,
- const std::string& projectRelativePath);
+ cmSlnProjectEntry* AddProject(std::string const& projectGUID,
+ std::string const& projectName,
+ std::string const& projectRelativePath);
- void AddConfiguration(const std::string& configuration)
+ void AddConfiguration(std::string const& configuration)
{
solutionConfigurations.push_back(configuration);
}
- std::string GetConfigurationTarget(const std::string& projectName,
- const std::string& solutionConfiguration,
- const std::string& platformName);
+ std::string GetConfigurationTarget(std::string const& projectName,
+ std::string const& solutionConfiguration,
+ std::string const& platformName);
private:
std::string visualStudioVersion, minimumVisualStudioVersion;
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index adfd4c5..878e877 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVisualStudioSlnParser.h"
#include <cassert>
@@ -32,41 +32,41 @@ public:
bool IsComment() const;
bool IsKeyValuePair() const;
- const std::string& GetTag() const { return this->Tag; }
- const std::string& GetArg() const { return this->Arg.first; }
+ std::string const& GetTag() const { return this->Tag; }
+ std::string const& GetArg() const { return this->Arg.first; }
std::string GetArgVerbatim() const;
size_t GetValueCount() const { return this->Values.size(); }
- const std::string& GetValue(size_t idxValue) const;
+ std::string const& GetValue(size_t idxValue) const;
std::string GetValueVerbatim(size_t idxValue) const;
- void SetTag(const std::string& tag) { this->Tag = tag; }
- void SetArg(const std::string& arg) { this->Arg = StringData(arg, false); }
- void SetQuotedArg(const std::string& arg)
+ void SetTag(std::string const& tag) { this->Tag = tag; }
+ void SetArg(std::string const& arg) { this->Arg = StringData(arg, false); }
+ void SetQuotedArg(std::string const& arg)
{
this->Arg = StringData(arg, true);
}
- void AddValue(const std::string& value)
+ void AddValue(std::string const& value)
{
this->Values.push_back(StringData(value, false));
}
- void AddQuotedValue(const std::string& value)
+ void AddQuotedValue(std::string const& value)
{
this->Values.push_back(StringData(value, true));
}
- void CopyVerbatim(const std::string& line) { this->Tag = line; }
+ void CopyVerbatim(std::string const& line) { this->Tag = line; }
private:
using StringData = std::pair<std::string, bool>;
std::string Tag;
StringData Arg;
std::vector<StringData> Values;
- static const std::string BadString;
- static const std::string Quote;
+ static std::string const BadString;
+ static std::string const Quote;
};
-const std::string cmVisualStudioSlnParser::ParsedLine::BadString;
-const std::string cmVisualStudioSlnParser::ParsedLine::Quote("\"");
+std::string const cmVisualStudioSlnParser::ParsedLine::BadString;
+std::string const cmVisualStudioSlnParser::ParsedLine::Quote("\"");
bool cmVisualStudioSlnParser::ParsedLine::IsComment() const
{
@@ -88,7 +88,7 @@ std::string cmVisualStudioSlnParser::ParsedLine::GetArgVerbatim() const
return this->Arg.first;
}
-const std::string& cmVisualStudioSlnParser::ParsedLine::GetValue(
+std::string const& cmVisualStudioSlnParser::ParsedLine::GetValue(
size_t idxValue) const
{
if (idxValue < this->Values.size()) {
@@ -101,7 +101,7 @@ std::string cmVisualStudioSlnParser::ParsedLine::GetValueVerbatim(
size_t idxValue) const
{
if (idxValue < this->Values.size()) {
- const StringData& data = this->Values[idxValue];
+ StringData const& data = this->Values[idxValue];
if (data.second) {
return cmStrCat(Quote, data.first, Quote);
}
@@ -120,7 +120,7 @@ public:
LineFormat NextLineFormat() const;
- bool Process(const cmVisualStudioSlnParser::ParsedLine& line,
+ bool Process(cmVisualStudioSlnParser::ParsedLine const& line,
cmSlnData& output, cmVisualStudioSlnParser::ResultData& result);
bool Finished(cmVisualStudioSlnParser::ResultData& result);
@@ -144,7 +144,7 @@ private:
DataGroupSet RequestedData;
size_t CurrentLine = 0;
- void IgnoreUntilTag(const std::string& endTag);
+ void IgnoreUntilTag(std::string const& endTag);
};
cmVisualStudioSlnParser::State::State(DataGroupSet requestedData)
@@ -188,7 +188,7 @@ LineFormat cmVisualStudioSlnParser::State::NextLineFormat() const
}
bool cmVisualStudioSlnParser::State::Process(
- const cmVisualStudioSlnParser::ParsedLine& line, cmSlnData& output,
+ cmVisualStudioSlnParser::ParsedLine const& line, cmSlnData& output,
cmVisualStudioSlnParser::ResultData& result)
{
assert(!line.IsComment());
@@ -383,7 +383,7 @@ bool cmVisualStudioSlnParser::State::Finished(
return true;
}
-void cmVisualStudioSlnParser::State::IgnoreUntilTag(const std::string& endTag)
+void cmVisualStudioSlnParser::State::IgnoreUntilTag(std::string const& endTag)
{
this->Stack.push(FileStateIgnore);
this->EndIgnoreTag = endTag;
@@ -403,31 +403,31 @@ void cmVisualStudioSlnParser::ResultData::SetError(ParseResult error,
this->ResultLine = line;
}
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupProjects(
1 << cmVisualStudioSlnParser::DataGroupProjectsBit);
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupProjectDependencies(
1 << cmVisualStudioSlnParser::DataGroupProjectDependenciesBit);
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupSolutionConfigurations(
1 << cmVisualStudioSlnParser::DataGroupSolutionConfigurationsBit);
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupProjectConfigurations(
1 << cmVisualStudioSlnParser::DataGroupProjectConfigurationsBit);
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupSolutionFilters(
1 << cmVisualStudioSlnParser::DataGroupSolutionFiltersBit);
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupGenericGlobalSections(
1 << cmVisualStudioSlnParser::DataGroupGenericGlobalSectionsBit);
-const cmVisualStudioSlnParser::DataGroupSet
+cmVisualStudioSlnParser::DataGroupSet const
cmVisualStudioSlnParser::DataGroupAll(~0);
bool cmVisualStudioSlnParser::Parse(std::istream& input, cmSlnData& output,
@@ -442,7 +442,7 @@ bool cmVisualStudioSlnParser::Parse(std::istream& input, cmSlnData& output,
return this->ParseImpl(input, output, state);
}
-bool cmVisualStudioSlnParser::ParseFile(const std::string& file,
+bool cmVisualStudioSlnParser::ParseFile(std::string const& file,
cmSlnData& output,
DataGroupSet dataGroups)
{
@@ -546,7 +546,7 @@ bool cmVisualStudioSlnParser::ParseBOM(std::istream& input, std::string& line,
return true;
}
-bool cmVisualStudioSlnParser::ParseMultiValueTag(const std::string& line,
+bool cmVisualStudioSlnParser::ParseMultiValueTag(std::string const& line,
ParsedLine& parsedLine,
State& state)
{
@@ -593,7 +593,7 @@ bool cmVisualStudioSlnParser::ParseMultiValueTag(const std::string& line,
return true;
}
-bool cmVisualStudioSlnParser::ParseSingleValueTag(const std::string& line,
+bool cmVisualStudioSlnParser::ParseSingleValueTag(std::string const& line,
ParsedLine& parsedLine,
State& state)
{
@@ -610,7 +610,7 @@ bool cmVisualStudioSlnParser::ParseSingleValueTag(const std::string& line,
return true;
}
-bool cmVisualStudioSlnParser::ParseKeyValuePair(const std::string& line,
+bool cmVisualStudioSlnParser::ParseKeyValuePair(std::string const& line,
ParsedLine& parsedLine,
State& /*state*/)
{
@@ -619,9 +619,9 @@ bool cmVisualStudioSlnParser::ParseKeyValuePair(const std::string& line,
parsedLine.CopyVerbatim(line);
return true;
}
- const std::string& key = line.substr(0, idxEqualSign);
+ std::string const& key = line.substr(0, idxEqualSign);
parsedLine.SetTag(cmTrimWhitespace(key));
- const std::string& value = line.substr(idxEqualSign + 1);
+ std::string const& value = line.substr(idxEqualSign + 1);
parsedLine.AddValue(cmTrimWhitespace(value));
return true;
}
@@ -641,7 +641,7 @@ bool cmVisualStudioSlnParser::ParseTag(cm::string_view fullTag,
state.GetCurrentLine());
return false;
}
- const std::string& arg = cmTrimWhitespace(
+ std::string const& arg = cmTrimWhitespace(
fullTag.substr(idxLeftParen + 1, idxRightParen - idxLeftParen - 1));
if (arg.front() == '"') {
if (arg.back() != '"') {
@@ -656,10 +656,10 @@ bool cmVisualStudioSlnParser::ParseTag(cm::string_view fullTag,
return true;
}
-bool cmVisualStudioSlnParser::ParseValue(const std::string& value,
+bool cmVisualStudioSlnParser::ParseValue(std::string const& value,
ParsedLine& parsedLine)
{
- const std::string& trimmed = cmTrimWhitespace(value);
+ std::string const& trimmed = cmTrimWhitespace(value);
if (trimmed.empty()) {
parsedLine.AddValue(trimmed);
} else if (trimmed.front() == '"' && trimmed.back() == '"') {
diff --git a/Source/cmVisualStudioSlnParser.h b/Source/cmVisualStudioSlnParser.h
index 0cac140..dc0ea42 100644
--- a/Source/cmVisualStudioSlnParser.h
+++ b/Source/cmVisualStudioSlnParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -45,18 +45,18 @@ public:
using DataGroupSet = std::bitset<DataGroupCount>;
- static const DataGroupSet DataGroupProjects;
- static const DataGroupSet DataGroupProjectDependencies;
- static const DataGroupSet DataGroupSolutionConfigurations;
- static const DataGroupSet DataGroupProjectConfigurations;
- static const DataGroupSet DataGroupSolutionFilters;
- static const DataGroupSet DataGroupGenericGlobalSections;
- static const DataGroupSet DataGroupAll;
+ static DataGroupSet const DataGroupProjects;
+ static DataGroupSet const DataGroupProjectDependencies;
+ static DataGroupSet const DataGroupSolutionConfigurations;
+ static DataGroupSet const DataGroupProjectConfigurations;
+ static DataGroupSet const DataGroupSolutionFilters;
+ static DataGroupSet const DataGroupGenericGlobalSections;
+ static DataGroupSet const DataGroupAll;
bool Parse(std::istream& input, cmSlnData& output,
DataGroupSet dataGroups = DataGroupAll);
- bool ParseFile(const std::string& file, cmSlnData& output,
+ bool ParseFile(std::string const& file, cmSlnData& output,
DataGroupSet dataGroups = DataGroupAll);
ParseResult GetParseResult() const;
@@ -88,16 +88,16 @@ protected:
bool ParseBOM(std::istream& input, std::string& line, State& state);
- bool ParseMultiValueTag(const std::string& line, ParsedLine& parsedLine,
+ bool ParseMultiValueTag(std::string const& line, ParsedLine& parsedLine,
State& state);
- bool ParseSingleValueTag(const std::string& line, ParsedLine& parsedLine,
+ bool ParseSingleValueTag(std::string const& line, ParsedLine& parsedLine,
State& state);
- bool ParseKeyValuePair(const std::string& line, ParsedLine& parsedLine,
+ bool ParseKeyValuePair(std::string const& line, ParsedLine& parsedLine,
State& state);
bool ParseTag(cm::string_view fullTag, ParsedLine& parsedLine, State& state);
- bool ParseValue(const std::string& value, ParsedLine& parsedLine);
+ bool ParseValue(std::string const& value, ParsedLine& parsedLine);
};
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 8aa5384..8454c99 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmVisualStudioWCEPlatformParser.h"
#include <algorithm>
@@ -10,12 +10,12 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version)
+int cmVisualStudioWCEPlatformParser::ParseVersion(char const* version)
{
- const std::string registryBase =
+ std::string const registryBase =
cmGlobalVisualStudioGenerator::GetRegistryBase(version);
- const std::string vckey = cmStrCat(registryBase, "\\Setup\\VC;ProductDir");
- const std::string vskey = cmStrCat(registryBase, "\\Setup\\VS;ProductDir");
+ std::string const vckey = cmStrCat(registryBase, "\\Setup\\VC;ProductDir");
+ std::string const vskey = cmStrCat(registryBase, "\\Setup\\VS;ProductDir");
if (!cmSystemTools::ReadRegistryValue(vckey, this->VcInstallDir,
cmSystemTools::KeyWOW64_32) ||
@@ -27,7 +27,7 @@ int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version)
cmSystemTools::ConvertToUnixSlashes(this->VsInstallDir);
this->VcInstallDir.append("//");
- const std::string configFilename =
+ std::string const configFilename =
cmStrCat(this->VcInstallDir, "vcpackages/WCE.VCPlatform.config");
return this->ParseFile(configFilename.c_str());
@@ -42,7 +42,7 @@ std::string cmVisualStudioWCEPlatformParser::GetOSVersion() const
return cmStrCat(OSMajorVersion, '.', OSMinorVersion);
}
-const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const
+char const* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const
{
auto it = this->Macros.find("ARCHFAM");
if (it != this->Macros.end()) {
@@ -52,8 +52,8 @@ const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const
return nullptr;
}
-void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name,
- const char** attributes)
+void cmVisualStudioWCEPlatformParser::StartElement(std::string const& name,
+ char const** attributes)
{
if (this->FoundRequiredName) {
return;
@@ -72,7 +72,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name,
std::string macroName;
std::string macroValue;
- for (const char** attr = attributes; *attr; attr += 2) {
+ for (char const** attr = attributes; *attr; attr += 2) {
if (strcmp(attr[0], "Name") == 0) {
macroName = attr[1];
} else if (strcmp(attr[0], "Value") == 0) {
@@ -84,7 +84,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name,
this->Macros[macroName] = macroValue;
}
} else if (name == "Directories"_s) {
- for (const char** attr = attributes; *attr; attr += 2) {
+ for (char const** attr = attributes; *attr; attr += 2) {
if (strcmp(attr[0], "Include") == 0) {
this->Include = attr[1];
} else if (strcmp(attr[0], "Library") == 0) {
@@ -96,7 +96,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name,
}
}
-void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name)
+void cmVisualStudioWCEPlatformParser::EndElement(std::string const& name)
{
if (!this->RequiredName) {
if (name == "PlatformName"_s) {
@@ -122,14 +122,14 @@ void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name)
}
}
-void cmVisualStudioWCEPlatformParser::CharacterDataHandler(const char* data,
+void cmVisualStudioWCEPlatformParser::CharacterDataHandler(char const* data,
int length)
{
this->CharacterData.append(data, length);
}
std::string cmVisualStudioWCEPlatformParser::FixPaths(
- const std::string& paths) const
+ std::string const& paths) const
{
std::string ret = paths;
cmSystemTools::ReplaceString(ret, "$(PATH)", "%PATH%");
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index 895a90d..c0a42a7 100644
--- a/Source/cmVisualStudioWCEPlatformParser.h
+++ b/Source/cmVisualStudioWCEPlatformParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,15 +16,15 @@
class cmVisualStudioWCEPlatformParser : public cmXMLParser
{
public:
- cmVisualStudioWCEPlatformParser(const char* name = nullptr)
+ cmVisualStudioWCEPlatformParser(char const* name = nullptr)
: RequiredName(name)
{
}
- int ParseVersion(const char* version);
+ int ParseVersion(char const* version);
bool Found() const { return this->FoundRequiredName; }
- const char* GetArchitectureFamily() const;
+ char const* GetArchitectureFamily() const;
std::string GetOSVersion() const;
std::string GetIncludeDirectories() const
{
@@ -35,18 +35,18 @@ public:
return this->FixPaths(this->Library);
}
std::string GetPathDirectories() const { return this->FixPaths(this->Path); }
- const std::vector<std::string>& GetAvailablePlatforms() const
+ std::vector<std::string> const& GetAvailablePlatforms() const
{
return this->AvailablePlatforms;
}
protected:
- void StartElement(const std::string& name, const char** attributes) override;
- void EndElement(const std::string& name) override;
- void CharacterDataHandler(const char* data, int length) override;
+ void StartElement(std::string const& name, char const** attributes) override;
+ void EndElement(std::string const& name) override;
+ void CharacterDataHandler(char const* data, int length) override;
private:
- std::string FixPaths(const std::string& paths) const;
+ std::string FixPaths(std::string const& paths) const;
std::string CharacterData;
@@ -59,7 +59,7 @@ private:
std::map<std::string, std::string> Macros;
std::vector<std::string> AvailablePlatforms;
- const char* RequiredName;
+ char const* RequiredName;
bool FoundRequiredName = false;
std::string VcInstallDir;
std::string VsInstallDir;
diff --git a/Source/cmVsProjectType.h b/Source/cmVsProjectType.h
index 04053a0..4a84afb 100644
--- a/Source/cmVsProjectType.h
+++ b/Source/cmVsProjectType.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 6b454d7..43d8975 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWhileCommand.h"
#include <string>
@@ -126,8 +126,6 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
case cmPolicies::OLD:
// OLD behavior is to silently ignore the error.
break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
// NEW behavior is to enforce the error.
enforceError = true;
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 5b8f078..2568e17 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmWindowsRegistry.cxx b/Source/cmWindowsRegistry.cxx
index a4a1ad6..0a0add3 100644
--- a/Source/cmWindowsRegistry.cxx
+++ b/Source/cmWindowsRegistry.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmWindowsRegistry.h"
@@ -97,7 +97,7 @@ public:
}
~registry_error() override = default;
- const char* what() const noexcept override { return What.c_str(); }
+ char const* what() const noexcept override { return What.c_str(); }
private:
std::string What;
@@ -131,7 +131,7 @@ public:
private:
static std::string FormatSystemError(LSTATUS status);
static std::wstring ToWide(cm::string_view str);
- static std::string ToNarrow(const wchar_t* str, int size = -1);
+ static std::string ToNarrow(wchar_t const* str, int size = -1);
HKEY Handler;
};
@@ -214,12 +214,12 @@ std::wstring KeyHandler::ToWide(cm::string_view str)
return wstr;
}
- const auto wlength =
+ auto const wlength =
MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
int(str.size()), nullptr, 0);
if (wlength > 0) {
auto wdata = cm::make_unique<wchar_t[]>(wlength);
- const auto r =
+ auto const r =
MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
int(str.size()), wdata.get(), wlength);
if (r > 0) {
@@ -234,7 +234,7 @@ std::wstring KeyHandler::ToWide(cm::string_view str)
return wstr;
}
-std::string KeyHandler::ToNarrow(const wchar_t* wstr, int size)
+std::string KeyHandler::ToNarrow(wchar_t const* wstr, int size)
{
std::string str;
@@ -242,12 +242,12 @@ std::string KeyHandler::ToNarrow(const wchar_t* wstr, int size)
return str;
}
- const auto length =
+ auto const length =
WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, wstr, size,
nullptr, 0, nullptr, nullptr);
if (length > 0) {
auto data = cm::make_unique<char[]>(length);
- const auto r =
+ auto const r =
WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, wstr, size,
data.get(), length, nullptr, nullptr);
if (r > 0) {
@@ -449,7 +449,7 @@ public:
}
#if defined(_WIN32) && !defined(__CYGWIN__)
- void Replace(const std::string& value)
+ void Replace(std::string const& value)
{
this->Expression.replace(
this->RegistryFormat.start(),
@@ -461,7 +461,7 @@ public:
cm::string_view GetSubKey() const { return this->SubKey; }
cm::string_view GetValueName() const { return this->ValueName; }
- const std::string& GetExpression() const { return this->Expression; }
+ std::string const& GetExpression() const { return this->Expression; }
#endif
private:
@@ -475,16 +475,16 @@ private:
}
// class cmWindowsRegistry
-const cmWindowsRegistry::ValueTypeSet cmWindowsRegistry::SimpleTypes =
+cmWindowsRegistry::ValueTypeSet const cmWindowsRegistry::SimpleTypes =
cmWindowsRegistry::ValueTypeSet{ cmWindowsRegistry::ValueType::Reg_SZ,
cmWindowsRegistry::ValueType::Reg_EXPAND_SZ,
cmWindowsRegistry::ValueType::Reg_DWORD,
cmWindowsRegistry::ValueType::Reg_QWORD };
-const cmWindowsRegistry::ValueTypeSet cmWindowsRegistry::AllTypes =
+cmWindowsRegistry::ValueTypeSet const cmWindowsRegistry::AllTypes =
cmWindowsRegistry::SimpleTypes + cmWindowsRegistry::ValueType::Reg_MULTI_SZ;
cmWindowsRegistry::cmWindowsRegistry(cmMakefile& makefile,
- const ValueTypeSet& supportedTypes)
+ ValueTypeSet const& supportedTypes)
#if defined(_WIN32) && !defined(__CYGWIN__)
: SupportedTypes(supportedTypes)
#else
@@ -625,7 +625,7 @@ cm::optional<std::string> cmWindowsRegistry::ReadValue(
this->LastError.clear();
auto handler = KeyHandler::OpenKey(key, v);
return handler.ReadValue(name, this->SupportedTypes, separator);
- } catch (const registry_error& e) {
+ } catch (registry_error const& e) {
this->LastError = e.what();
continue;
}
@@ -655,7 +655,7 @@ cm::optional<std::vector<std::string>> cmWindowsRegistry::GetValueNames(
auto list = handler.GetValueNames();
std::move(list.begin(), list.end(), std::back_inserter(valueNames));
querySuccessful = true;
- } catch (const registry_error& e) {
+ } catch (registry_error const& e) {
this->LastError = e.what();
continue;
}
@@ -695,7 +695,7 @@ cm::optional<std::vector<std::string>> cmWindowsRegistry::GetSubKeys(
auto list = handler.GetSubKeys();
std::move(list.begin(), list.end(), std::back_inserter(subKeys));
querySuccessful = true;
- } catch (const registry_error& e) {
+ } catch (registry_error const& e) {
this->LastError = e.what();
continue;
}
@@ -740,7 +740,7 @@ cm::optional<std::vector<std::string>> cmWindowsRegistry::ExpandExpression(
auto data = handler.ReadValue(parser.GetValueName(),
this->SupportedTypes, separator);
parser.Replace(data);
- } catch (const registry_error& e) {
+ } catch (registry_error const& e) {
this->LastError = e.what();
parser.Replace(NOTFOUND);
continue;
diff --git a/Source/cmWindowsRegistry.h b/Source/cmWindowsRegistry.h
index 42179ed..1b831ac 100644
--- a/Source/cmWindowsRegistry.h
+++ b/Source/cmWindowsRegistry.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,12 +42,12 @@ public:
using ValueTypeSet = cm::enum_set<ValueType>;
// All types as defined by enum ValueType
- static const ValueTypeSet AllTypes;
- // same as AllTYpes but without type REG_MULTI_SZ
- static const ValueTypeSet SimpleTypes;
+ static ValueTypeSet const AllTypes;
+ // same as AllTypes but without type REG_MULTI_SZ
+ static ValueTypeSet const SimpleTypes;
cmWindowsRegistry(cmMakefile&,
- const ValueTypeSet& supportedTypes = AllTypes);
+ ValueTypeSet const& supportedTypes = AllTypes);
// Helper routine to convert string to enum value
static cm::optional<View> ToView(cm::string_view name);
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index 2fbf657..bf79c86 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWorkerPool.h"
#include <algorithm>
@@ -17,6 +17,7 @@
#include "cmRange.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmUVHandlePtr.h"
/**
@@ -25,7 +26,7 @@
class cmUVPipeBuffer
{
public:
- using DataRange = cmRange<const char*>;
+ using DataRange = cmRange<char const*>;
using DataFunction = std::function<void(DataRange)>;
/// On error the ssize_t argument is a non zero libuv error code
using EndFunction = std::function<void(ssize_t)>;
@@ -61,7 +62,7 @@ private:
// -- Libuv callbacks
static void UVAlloc(uv_handle_t* handle, size_t suggestedSize,
uv_buf_t* buf);
- static void UVData(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf);
+ static void UVData(uv_stream_t* stream, ssize_t nread, uv_buf_t const* buf);
cm::uv_pipe_ptr UVPipe_;
std::vector<char> Buffer_;
@@ -116,7 +117,7 @@ void cmUVPipeBuffer::UVAlloc(uv_handle_t* handle, size_t suggestedSize,
}
void cmUVPipeBuffer::UVData(uv_stream_t* stream, ssize_t nread,
- const uv_buf_t* buf)
+ uv_buf_t const* buf)
{
auto& pipe = *reinterpret_cast<cmUVPipeBuffer*>(stream->data);
if (nread > 0) {
@@ -159,7 +160,7 @@ public:
// -- Runtime
void setup(cmWorkerPool::ProcessResultT* result, bool mergedOutput,
- std::vector<std::string> const& command,
+ std::vector<std::string> command,
std::string const& workingDirectory = std::string());
bool start(uv_loop_t* uv_loop, std::function<void()> finishedCallback);
@@ -178,7 +179,7 @@ private:
bool IsStarted_ = false;
bool IsFinished_ = false;
std::function<void()> FinishedCallback_;
- std::vector<const char*> CommandPtr_;
+ std::vector<char const*> CommandPtr_;
std::array<uv_stdio_container_t, 3> UVOptionsStdIO_;
uv_process_options_t UVOptions_;
cm::uv_process_ptr UVProcess_;
@@ -188,11 +189,12 @@ private:
void cmUVReadOnlyProcess::setup(cmWorkerPool::ProcessResultT* result,
bool mergedOutput,
- std::vector<std::string> const& command,
+ std::vector<std::string> command,
std::string const& workingDirectory)
{
+ cmSystemTools::MaybePrependCmdExe(command);
this->Setup_.WorkingDirectory = workingDirectory;
- this->Setup_.Command = command;
+ this->Setup_.Command = std::move(command);
this->Setup_.Result = result;
this->Setup_.MergedOutput = mergedOutput;
}
@@ -250,6 +252,9 @@ bool cmUVReadOnlyProcess::start(uv_loop_t* uv_loop,
this->UVOptions_.args = const_cast<char**>(this->CommandPtr_.data());
this->UVOptions_.cwd = this->Setup_.WorkingDirectory.c_str();
this->UVOptions_.flags = UV_PROCESS_WINDOWS_HIDE;
+#if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
+ this->UVOptions_.flags |= UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
+#endif
this->UVOptions_.stdio_count =
static_cast<int>(this->UVOptionsStdIO_.size());
this->UVOptions_.stdio = this->UVOptionsStdIO_.data();
@@ -258,7 +263,7 @@ bool cmUVReadOnlyProcess::start(uv_loop_t* uv_loop,
int uvErrorCode = this->UVProcess_.spawn(*uv_loop, this->UVOptions_, this);
if (uvErrorCode != 0) {
this->Result()->ErrorMessage = "libuv process spawn failed";
- if (const char* uvErr = uv_strerror(uvErrorCode)) {
+ if (char const* uvErr = uv_strerror(uvErrorCode)) {
this->Result()->ErrorMessage += ": ";
this->Result()->ErrorMessage += uvErr;
}
@@ -393,7 +398,7 @@ public:
* Run an external process
*/
bool RunProcess(cmWorkerPool::ProcessResultT& result,
- std::vector<std::string> const& command,
+ std::vector<std::string> command,
std::string const& workingDirectory);
private:
@@ -426,7 +431,7 @@ cmWorkerPoolWorker::~cmWorkerPoolWorker()
}
bool cmWorkerPoolWorker::RunProcess(cmWorkerPool::ProcessResultT& result,
- std::vector<std::string> const& command,
+ std::vector<std::string> command,
std::string const& workingDirectory)
{
if (command.empty()) {
@@ -436,7 +441,8 @@ bool cmWorkerPoolWorker::RunProcess(cmWorkerPool::ProcessResultT& result,
{
std::lock_guard<std::mutex> lock(this->Proc_.Mutex);
this->Proc_.ROP = cm::make_unique<cmUVReadOnlyProcess>();
- this->Proc_.ROP->setup(&result, true, command, workingDirectory);
+ this->Proc_.ROP->setup(&result, true, std::move(command),
+ workingDirectory);
}
// Send asynchronous process start request to libuv loop
this->Proc_.Request.send();
@@ -452,19 +458,19 @@ bool cmWorkerPoolWorker::RunProcess(cmWorkerPool::ProcessResultT& result,
void cmWorkerPoolWorker::UVProcessStart(uv_async_t* handle)
{
- auto* wrk = reinterpret_cast<cmWorkerPoolWorker*>(handle->data);
+ auto* worker = reinterpret_cast<cmWorkerPoolWorker*>(handle->data);
bool startFailed = false;
{
- auto& Proc = wrk->Proc_;
+ auto& Proc = worker->Proc_;
std::lock_guard<std::mutex> lock(Proc.Mutex);
if (Proc.ROP && !Proc.ROP->IsStarted()) {
- startFailed =
- !Proc.ROP->start(handle->loop, [wrk] { wrk->UVProcessFinished(); });
+ startFailed = !Proc.ROP->start(
+ handle->loop, [worker] { worker->UVProcessFinished(); });
}
}
// Clean up if starting of the process failed
if (startFailed) {
- wrk->UVProcessFinished();
+ worker->UVProcessFinished();
}
}
@@ -728,12 +734,12 @@ void cmWorkerPoolInternal::Work(unsigned int workerIndex)
cmWorkerPool::JobT::~JobT() = default;
bool cmWorkerPool::JobT::RunProcess(ProcessResultT& result,
- std::vector<std::string> const& command,
+ std::vector<std::string> command,
std::string const& workingDirectory)
{
// Get worker by index
- auto* wrk = this->Pool_->Int_->Workers.at(this->WorkerIndex_).get();
- return wrk->RunProcess(result, command, workingDirectory);
+ auto* worker = this->Pool_->Int_->Workers.at(this->WorkerIndex_).get();
+ return worker->RunProcess(result, std::move(command), workingDirectory);
}
cmWorkerPool::cmWorkerPool()
diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h
index 4035650..e8614a4 100644
--- a/Source/cmWorkerPool.h
+++ b/Source/cmWorkerPool.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -102,8 +102,7 @@ public:
* Run an external read only process.
* Use only during JobT::Process() call!
*/
- bool RunProcess(ProcessResultT& result,
- std::vector<std::string> const& command,
+ bool RunProcess(ProcessResultT& result, std::vector<std::string> command,
std::string const& workingDirectory);
private:
diff --git a/Source/cmWorkingDirectory.cxx b/Source/cmWorkingDirectory.cxx
index 12fae12..f00aca9 100644
--- a/Source/cmWorkingDirectory.cxx
+++ b/Source/cmWorkingDirectory.cxx
@@ -1,14 +1,13 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWorkingDirectory.h"
-#include <cerrno>
-
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmWorkingDirectory::cmWorkingDirectory(std::string const& newdir)
{
- this->OldDir = cmSystemTools::GetCurrentWorkingDirectory();
+ this->OldDir = cmSystemTools::GetLogicalWorkingDirectory();
this->SetDirectory(newdir);
}
@@ -19,11 +18,13 @@ cmWorkingDirectory::~cmWorkingDirectory()
bool cmWorkingDirectory::SetDirectory(std::string const& newdir)
{
- if (cmSystemTools::ChangeDirectory(newdir)) {
- this->ResultCode = 0;
+ cmsys::Status status = cmSystemTools::SetLogicalWorkingDirectory(newdir);
+ if (status) {
+ this->Error.clear();
return true;
}
- this->ResultCode = errno;
+ this->Error = cmStrCat("Failed to change working directory to \"", newdir,
+ "\": ", status.GetString());
return false;
}
diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h
index e593621..96caafa 100644
--- a/Source/cmWorkingDirectory.h
+++ b/Source/cmWorkingDirectory.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,24 +21,16 @@ public:
cmWorkingDirectory(std::string const& newdir);
~cmWorkingDirectory();
- cmWorkingDirectory(const cmWorkingDirectory&) = delete;
- cmWorkingDirectory& operator=(const cmWorkingDirectory&) = delete;
+ cmWorkingDirectory(cmWorkingDirectory const&) = delete;
+ cmWorkingDirectory& operator=(cmWorkingDirectory const&) = delete;
bool SetDirectory(std::string const& newdir);
void Pop();
- bool Failed() const { return this->ResultCode != 0; }
-
- /** \return 0 if the last attempt to set the working directory was
- * successful. If it failed, the value returned will be the
- * \c errno value associated with the failure. A description
- * of the error code can be obtained by passing the result
- * to \c std::strerror().
- */
- int GetLastResult() const { return this->ResultCode; }
-
+ bool Failed() const { return !this->Error.empty(); }
+ std::string const& GetError() const { return this->Error; }
std::string const& GetOldDirectory() const { return this->OldDir; }
private:
std::string OldDir;
- int ResultCode;
+ std::string Error;
};
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index 8ed9ea7..f862c51 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmWriteFileCommand.h"
#include "cmsys/FStream.hxx"
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 0225e4f..262063c 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmXCOFF.cxx b/Source/cmXCOFF.cxx
index e459103..39d190b 100644
--- a/Source/cmXCOFF.cxx
+++ b/Source/cmXCOFF.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXCOFF.h"
#include <algorithm>
@@ -64,7 +64,7 @@ protected:
cmXCOFF::Mode Mode;
// Helper methods for subclasses.
- void SetErrorMessage(const char* msg) { this->External->ErrorMessage = msg; }
+ void SetErrorMessage(char const* msg) { this->External->ErrorMessage = msg; }
};
namespace {
@@ -75,9 +75,9 @@ struct XCOFF32
using aouthdr = struct aouthdr;
using scnhdr = struct scnhdr;
using ldhdr = struct ldhdr;
- static const std::size_t aouthdr_size = _AOUTHSZ_EXEC;
+ static std::size_t const aouthdr_size = _AOUTHSZ_EXEC;
};
-const unsigned char xcoff32_magic[] = { 0x01, 0xDF };
+unsigned char const xcoff32_magic[] = { 0x01, 0xDF };
struct XCOFF64
{
@@ -85,9 +85,9 @@ struct XCOFF64
using aouthdr = struct aouthdr_64;
using scnhdr = struct scnhdr_64;
using ldhdr = struct ldhdr_64;
- static const std::size_t aouthdr_size = _AOUTHSZ_EXEC_64;
+ static std::size_t const aouthdr_size = _AOUTHSZ_EXEC_64;
};
-const unsigned char xcoff64_magic[] = { 0x01, 0xF7 };
+unsigned char const xcoff64_magic[] = { 0x01, 0xF7 };
enum class IsArchive
{
@@ -369,7 +369,7 @@ bool Impl<XCOFF>::RemoveLibPath()
}
}
-IsArchive check_if_big_archive(const char* fname)
+IsArchive check_if_big_archive(char const* fname)
{
int len = std::strlen(fname);
if (len < 2) {
@@ -386,7 +386,7 @@ IsArchive check_if_big_archive(const char* fname)
//============================================================================
// External class implementation.
-cmXCOFF::cmXCOFF(const char* fname, Mode mode)
+cmXCOFF::cmXCOFF(char const* fname, Mode mode)
{
// Try to open the file.
std::ios::openmode fmode = std::ios::in | std::ios::binary;
diff --git a/Source/cmXCOFF.h b/Source/cmXCOFF.h
index f6d9d94..b1a7ef0 100644
--- a/Source/cmXCOFF.h
+++ b/Source/cmXCOFF.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,7 +30,7 @@ public:
};
/** Construct with the name of the XCOFF input file to parse. */
- cmXCOFF(const char* fname, Mode = Mode::ReadOnly);
+ cmXCOFF(char const* fname, Mode = Mode::ReadOnly);
/** Destruct. */
~cmXCOFF();
diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx
index 7a40eaa..74db53d 100644
--- a/Source/cmXCode21Object.cxx
+++ b/Source/cmXCode21Object.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXCode21Object.h"
#include <ostream>
@@ -34,7 +34,7 @@ void cmXCode21Object::PrintList(
PBXType t)
{
bool hasOne = false;
- for (const auto& obj : v) {
+ for (auto const& obj : v) {
if (obj->GetType() == OBJECT && obj->GetIsA() == t) {
hasOne = true;
break;
@@ -44,7 +44,7 @@ void cmXCode21Object::PrintList(
return;
}
out << "\n/* Begin " << PBXTypeNames[t] << " section */\n";
- for (const auto& obj : v) {
+ for (auto const& obj : v) {
if (obj->GetType() == OBJECT && obj->GetIsA() == t) {
obj->Print(out);
}
diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h
index 0c7f22b..5da71f5 100644
--- a/Source/cmXCode21Object.h
+++ b/Source/cmXCode21Object.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index f645f51..5de753f 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -1,12 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXCodeObject.h"
#include <ostream>
#include <cmext/string_view>
-const char* cmXCodeObject::PBXTypeNames[] = {
+char const* cmXCodeObject::PBXTypeNames[] = {
/* clang-format needs this comment to break after the opening brace */
"PBXGroup",
"PBXBuildStyle",
@@ -96,7 +96,7 @@ void cmXCodeObject::Print(std::ostream& out)
}
cmXCodeObject::Indent(3 * indentFactor, out);
out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator;
- for (const auto& keyVal : this->ObjectAttributes) {
+ for (auto const& keyVal : this->ObjectAttributes) {
if (keyVal.first == "isa"_s) {
continue;
}
@@ -109,10 +109,10 @@ void cmXCodeObject::Print(std::ostream& out)
}
void cmXCodeObject::PrintAttribute(std::ostream& out, int level,
- const std::string& separator, int factor,
- const std::string& name,
- const cmXCodeObject* object,
- const cmXCodeObject* parent)
+ std::string const& separator, int factor,
+ std::string const& name,
+ cmXCodeObject const* object,
+ cmXCodeObject const* parent)
{
cmXCodeObject::Indent(level * factor, out);
switch (object->TypeValue) {
@@ -145,7 +145,7 @@ void cmXCodeObject::PrintAttribute(std::ostream& out, int level,
if (separator == "\n"_s) {
out << separator;
}
- for (const auto& keyVal : object->ObjectAttributes) {
+ for (auto const& keyVal : object->ObjectAttributes) {
PrintAttribute(out, (level + 1) * factor, separator, factor,
keyVal.first, keyVal.second, object);
}
@@ -197,7 +197,7 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
this->Object = copy->Object;
}
-void cmXCodeObject::PrintString(std::ostream& os, const std::string& String)
+void cmXCodeObject::PrintString(std::ostream& os, std::string const& String)
{
// The string needs to be quoted if it contains any characters
// considered special by the Xcode project file parser.
@@ -206,7 +206,7 @@ void cmXCodeObject::PrintString(std::ostream& os, const std::string& String)
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"$_./") != std::string::npos);
- const char* quote = needQuote ? "\"" : "";
+ char const* quote = needQuote ? "\"" : "";
// Print the string, quoted and escaped as necessary.
os << quote;
@@ -225,7 +225,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const
cmXCodeObject::PrintString(os, this->String);
}
-void cmXCodeObject::SetString(const std::string& s)
+void cmXCodeObject::SetString(std::string const& s)
{
this->String = s;
}
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index 10a6861..2904a7c 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -56,7 +56,7 @@ public:
class StringVec : public std::vector<std::string>
{
};
- static const char* PBXTypeNames[];
+ static char const* PBXTypeNames[];
virtual ~cmXCodeObject();
cmXCodeObject(PBXType ptype, Type type, std::string id);
Type GetType() const { return this->TypeValue; }
@@ -64,15 +64,15 @@ public:
bool IsEmpty() const;
- void SetString(const std::string& s);
- const std::string& GetString() const { return this->String; }
+ void SetString(std::string const& s);
+ std::string const& GetString() const { return this->String; }
- void AddAttribute(const std::string& name, cmXCodeObject* value)
+ void AddAttribute(std::string const& name, cmXCodeObject* value)
{
this->ObjectAttributes[name] = value;
}
- void AddAttributeIfNotEmpty(const std::string& name, cmXCodeObject* value)
+ void AddAttributeIfNotEmpty(std::string const& name, cmXCodeObject* value)
{
if (value && !value->IsEmpty()) {
AddAttribute(name, value);
@@ -106,19 +106,19 @@ public:
static void Indent(int level, std::ostream& out);
void Print(std::ostream& out);
void PrintAttribute(std::ostream& out, int level,
- const std::string& separator, int factor,
- const std::string& name, const cmXCodeObject* object,
- const cmXCodeObject* parent);
+ std::string const& separator, int factor,
+ std::string const& name, cmXCodeObject const* object,
+ cmXCodeObject const* parent);
virtual void PrintComment(std::ostream&) {}
static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out);
- const std::string& GetId() const { return this->Id; }
- void SetId(const std::string& id) { this->Id = id; }
+ std::string const& GetId() const { return this->Id; }
+ void SetId(std::string const& id) { this->Id = id; }
cmGeneratorTarget* GetTarget() const { return this->Target; }
void SetTarget(cmGeneratorTarget* t) { this->Target = t; }
- const std::string& GetComment() const { return this->Comment; }
+ std::string const& GetComment() const { return this->Comment; }
bool HasComment() const { return (!this->Comment.empty()); }
- cmXCodeObject* GetAttribute(const char* name) const
+ cmXCodeObject* GetAttribute(char const* name) const
{
auto const i = this->ObjectAttributes.find(name);
if (i != this->ObjectAttributes.end()) {
@@ -139,7 +139,7 @@ public:
void CopyAttributes(cmXCodeObject*);
- void AddDependLibrary(const std::string& configName, const std::string& l)
+ void AddDependLibrary(std::string const& configName, std::string const& l)
{
this->DependLibraries[configName].push_back(l);
}
@@ -147,7 +147,7 @@ public:
{
return this->DependLibraries;
}
- void AddDependTarget(const std::string& configName, const std::string& tName)
+ void AddDependTarget(std::string const& configName, std::string const& tName)
{
this->DependTargets[configName].push_back(tName);
}
@@ -159,8 +159,8 @@ public:
{
return this->List;
}
- void SetComment(const std::string& c) { this->Comment = c; }
- static void PrintString(std::ostream& os, const std::string& String);
+ void SetComment(std::string const& c) { this->Comment = c; }
+ static void PrintString(std::ostream& os, std::string const& String);
protected:
void PrintString(std::ostream& os) const;
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index 12272d1..23d007a 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXCodeScheme.h"
#include <iomanip>
@@ -14,6 +14,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
#include "cmList.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -26,7 +27,7 @@ class cmLocalGenerator;
cmXCodeScheme::cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj,
TestObjects tests,
- const std::vector<std::string>& configList,
+ std::vector<std::string> const& configList,
unsigned int xcVersion)
: LocalGenerator(lg)
, Target(xcObj)
@@ -37,8 +38,8 @@ cmXCodeScheme::cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj,
{
}
-void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
- const std::string& container)
+void cmXCodeScheme::WriteXCodeSharedScheme(std::string const& xcProjDir,
+ std::string const& container)
{
// Create shared scheme sub-directory tree
//
@@ -58,7 +59,7 @@ void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
}
void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
- const std::string& container)
+ std::string const& container)
{
cmXMLWriter xout(fout);
xout.SetIndentationElement(std::string(3, ' '));
@@ -74,8 +75,13 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
std::string launchConfiguration =
!propDftCfg.IsEmpty() ? *propDftCfg : "Debug";
+ cmValue propTstCfg =
+ Target->GetTarget()->GetProperty("XCODE_SCHEME_TEST_CONFIGURATION");
+ std::string testConfiguration =
+ !propTstCfg.IsEmpty() ? *propTstCfg : "Debug";
+
WriteBuildAction(xout, container);
- WriteTestAction(xout, FindConfiguration("Debug"), container);
+ WriteTestAction(xout, FindConfiguration(testConfiguration), container);
WriteLaunchAction(xout, FindConfiguration(launchConfiguration), container);
WriteProfileAction(xout, FindConfiguration("Release"), container);
WriteAnalyzeAction(xout, FindConfiguration("Debug"));
@@ -85,7 +91,7 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
}
void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
- const std::string& container)
+ std::string const& container)
{
xout.StartElement("BuildAction");
xout.BreakAttributes();
@@ -109,8 +115,8 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
- const std::string& configuration,
- const std::string& container)
+ std::string const& configuration,
+ std::string const& container)
{
xout.StartElement("TestAction");
xout.BreakAttributes();
@@ -120,6 +126,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
xout.Attribute("selectedLauncherIdentifier",
"Xcode.DebuggerFoundation.Launcher.LLDB");
xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
+ WriteCustomLLDBInitFile(xout, configuration);
xout.StartElement("Testables");
for (auto const* test : this->Tests) {
@@ -144,8 +151,8 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
- const std::string& configuration,
- const std::string& container)
+ std::string const& configuration,
+ std::string const& container)
{
xout.StartElement("LaunchAction");
xout.BreakAttributes();
@@ -164,6 +171,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.Attribute("launchStyle", value);
}
WriteCustomWorkingDirectory(xout, configuration);
+ WriteCustomLLDBInitFile(xout, configuration);
xout.Attribute("ignoresPersistentStateOnLaunch", "NO");
WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
@@ -297,7 +305,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.BreakAttributes();
std::string envValue;
- const auto p = env.find_first_of('=');
+ auto const p = env.find_first_of('=');
if (p != std::string::npos) {
envValue = env.substr(p + 1);
env.resize(p);
@@ -354,8 +362,8 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
}
bool cmXCodeScheme::WriteLaunchActionAttribute(cmXMLWriter& xout,
- const std::string& attrName,
- const std::string& varName)
+ std::string const& attrName,
+ std::string const& varName)
{
if (Target->GetTarget()->GetPropertyAsBool(varName)) {
xout.Attribute(attrName.c_str(), "YES");
@@ -365,7 +373,7 @@ bool cmXCodeScheme::WriteLaunchActionAttribute(cmXMLWriter& xout,
}
bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
- cmXMLWriter& xout, const std::string& attrName, const std::string& varName,
+ cmXMLWriter& xout, std::string const& attrName, std::string const& varName,
bool defaultValue)
{
cmValue property = Target->GetTarget()->GetProperty(varName);
@@ -380,8 +388,8 @@ bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
}
bool cmXCodeScheme::WriteLaunchActionAdditionalOption(
- cmXMLWriter& xout, const std::string& key, const std::string& value,
- const std::string& varName)
+ cmXMLWriter& xout, std::string const& key, std::string const& value,
+ std::string const& varName)
{
if (Target->GetTarget()->GetPropertyAsBool(varName)) {
xout.StartElement("AdditionalOption");
@@ -399,8 +407,8 @@ bool cmXCodeScheme::WriteLaunchActionAdditionalOption(
}
void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
- const std::string& configuration,
- const std::string& container)
+ std::string const& configuration,
+ std::string const& container)
{
xout.StartElement("ProfileAction");
xout.BreakAttributes();
@@ -420,7 +428,7 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout,
- const std::string& configuration)
+ std::string const& configuration)
{
xout.StartElement("AnalyzeAction");
xout.BreakAttributes();
@@ -429,7 +437,7 @@ void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout,
- const std::string& configuration)
+ std::string const& configuration)
{
xout.StartElement("ArchiveAction");
xout.BreakAttributes();
@@ -439,8 +447,8 @@ void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteBuildableProductRunnable(cmXMLWriter& xout,
- const cmXCodeObject* xcObj,
- const std::string& container)
+ cmXCodeObject const* xcObj,
+ std::string const& container)
{
xout.StartElement("BuildableProductRunnable");
xout.BreakAttributes();
@@ -450,8 +458,8 @@ void cmXCodeScheme::WriteBuildableProductRunnable(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
- const cmXCodeObject* xcObj,
- const std::string& container)
+ cmXCodeObject const* xcObj,
+ std::string const& container)
{
xout.StartElement("BuildableReference");
xout.BreakAttributes();
@@ -465,22 +473,35 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteCustomWorkingDirectory(
- cmXMLWriter& xout, const std::string& configuration)
+ cmXMLWriter& xout, std::string const& configuration)
{
- std::string const& propertyValue =
- this->Target->GetTarget()->GetSafeProperty(
- "XCODE_SCHEME_WORKING_DIRECTORY");
- if (propertyValue.empty()) {
+ cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
+
+ cmValue propertyValue =
+ gg->GetDebuggerWorkingDirectory(this->Target->GetTarget());
+ if (!propertyValue) {
xout.Attribute("useCustomWorkingDirectory", "NO");
} else {
xout.Attribute("useCustomWorkingDirectory", "YES");
auto customWorkingDirectory = cmGeneratorExpression::Evaluate(
- propertyValue, this->LocalGenerator, configuration);
+ *propertyValue, this->LocalGenerator, configuration);
xout.Attribute("customWorkingDirectory", customWorkingDirectory);
}
}
+void cmXCodeScheme::WriteCustomLLDBInitFile(cmXMLWriter& xout,
+ std::string const& configuration)
+{
+ std::string const& propertyValue =
+ this->Target->GetTarget()->GetSafeProperty("XCODE_SCHEME_LLDB_INIT_FILE");
+ if (!propertyValue.empty()) {
+ auto customLLDBInitFile = cmGeneratorExpression::Evaluate(
+ propertyValue, this->LocalGenerator, configuration);
+ xout.Attribute("customLLDBInitFile", customLLDBInitFile);
+ }
+}
+
std::string cmXCodeScheme::WriteVersionString()
{
std::ostringstream v;
@@ -488,7 +509,7 @@ std::string cmXCodeScheme::WriteVersionString()
return v.str();
}
-std::string cmXCodeScheme::FindConfiguration(const std::string& name)
+std::string cmXCodeScheme::FindConfiguration(std::string const& name)
{
// Try to find the desired configuration by name,
// and if it's not found return first from the list
@@ -505,7 +526,7 @@ bool cmXCodeScheme::IsTestable() const
return !this->Tests.empty() || IsExecutable(this->Target);
}
-bool cmXCodeScheme::IsExecutable(const cmXCodeObject* target)
+bool cmXCodeScheme::IsExecutable(cmXCodeObject const* target)
{
cmGeneratorTarget* gt = target->GetTarget();
if (!gt) {
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index c933a6e..783d250 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,63 +18,66 @@ class cmXMLWriter;
class cmXCodeScheme
{
public:
- using TestObjects = std::vector<const cmXCodeObject*>;
+ using TestObjects = std::vector<cmXCodeObject const*>;
cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj, TestObjects tests,
- const std::vector<std::string>& configList,
+ std::vector<std::string> const& configList,
unsigned int xcVersion);
- void WriteXCodeSharedScheme(const std::string& xcProjDir,
- const std::string& container);
+ void WriteXCodeSharedScheme(std::string const& xcProjDir,
+ std::string const& container);
private:
cmLocalGenerator* const LocalGenerator;
- const cmXCodeObject* const Target;
- const TestObjects Tests;
- const std::string& TargetName;
- const std::vector<std::string>& ConfigList;
- const unsigned int XcodeVersion;
+ cmXCodeObject const* const Target;
+ TestObjects const Tests;
+ std::string const& TargetName;
+ std::vector<std::string> const& ConfigList;
+ unsigned int const XcodeVersion;
- void WriteXCodeXCScheme(std::ostream& fout, const std::string& container);
+ void WriteXCodeXCScheme(std::ostream& fout, std::string const& container);
- void WriteBuildAction(cmXMLWriter& xout, const std::string& container);
- void WriteTestAction(cmXMLWriter& xout, const std::string& configuration,
- const std::string& container);
- void WriteLaunchAction(cmXMLWriter& xout, const std::string& configuration,
- const std::string& container);
+ void WriteBuildAction(cmXMLWriter& xout, std::string const& container);
+ void WriteTestAction(cmXMLWriter& xout, std::string const& configuration,
+ std::string const& container);
+ void WriteLaunchAction(cmXMLWriter& xout, std::string const& configuration,
+ std::string const& container);
bool WriteLaunchActionAttribute(cmXMLWriter& xout,
- const std::string& attrName,
- const std::string& varName);
+ std::string const& attrName,
+ std::string const& varName);
bool WriteLaunchActionBooleanAttribute(cmXMLWriter& xout,
- const std::string& attrName,
- const std::string& varName,
+ std::string const& attrName,
+ std::string const& varName,
bool defaultValue);
bool WriteLaunchActionAdditionalOption(cmXMLWriter& xout,
- const std::string& attrName,
- const std::string& value,
- const std::string& varName);
+ std::string const& attrName,
+ std::string const& value,
+ std::string const& varName);
- 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 WriteProfileAction(cmXMLWriter& xout, std::string const& configuration,
+ std::string const& container);
+ void WriteAnalyzeAction(cmXMLWriter& xout, std::string const& configuration);
+ void WriteArchiveAction(cmXMLWriter& xout, std::string const& configuration);
void WriteBuildableProductRunnable(cmXMLWriter& xout,
- const cmXCodeObject* xcObj,
- const std::string& container);
- void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj,
- const std::string& container);
+ cmXCodeObject const* xcObj,
+ std::string const& container);
+ void WriteBuildableReference(cmXMLWriter& xout, cmXCodeObject const* xcObj,
+ std::string const& container);
void WriteCustomWorkingDirectory(cmXMLWriter& xout,
- const std::string& configuration);
+ std::string const& configuration);
+
+ void WriteCustomLLDBInitFile(cmXMLWriter& xout,
+ std::string const& configuration);
std::string WriteVersionString();
- std::string FindConfiguration(const std::string& name);
+ std::string FindConfiguration(std::string const& name);
bool IsTestable() const;
- static bool IsExecutable(const cmXCodeObject* target);
+ static bool IsExecutable(cmXCodeObject const* target);
};
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index f4433e3..e5ae69f 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXMLParser.h"
#include <cstring>
@@ -25,13 +25,13 @@ cmXMLParser::~cmXMLParser()
}
}
-int cmXMLParser::Parse(const char* string)
+int cmXMLParser::Parse(char const* string)
{
return this->InitializeParser() &&
this->ParseChunk(string, strlen(string)) && this->CleanupParser();
}
-int cmXMLParser::ParseFile(const char* file)
+int cmXMLParser::ParseFile(char const* file)
{
if (!file) {
return 0;
@@ -66,7 +66,7 @@ int cmXMLParser::InitializeParser()
return 1;
}
-int cmXMLParser::ParseChunk(const char* inputString,
+int cmXMLParser::ParseChunk(char const* inputString,
std::string::size_type length)
{
if (!this->Parser) {
@@ -105,7 +105,7 @@ int cmXMLParser::CleanupParser()
return result;
}
-int cmXMLParser::ParseBuffer(const char* buffer, std::string::size_type count)
+int cmXMLParser::ParseBuffer(char const* buffer, std::string::size_type count)
{
// Pass the buffer to the expat XML parser.
if (!XML_Parse(static_cast<XML_Parser>(this->Parser), buffer,
@@ -116,7 +116,7 @@ int cmXMLParser::ParseBuffer(const char* buffer, std::string::size_type count)
return 1;
}
-int cmXMLParser::ParseBuffer(const char* buffer)
+int cmXMLParser::ParseBuffer(char const* buffer)
{
return this->ParseBuffer(buffer, static_cast<int>(strlen(buffer)));
}
@@ -127,26 +127,26 @@ int cmXMLParser::ParsingComplete()
return 0;
}
-void cmXMLParser::StartElement(const std::string& name, const char** /*atts*/)
+void cmXMLParser::StartElement(std::string const& name, char const** /*atts*/)
{
std::cout << "Start element: " << name << std::endl;
}
-void cmXMLParser::EndElement(const std::string& name)
+void cmXMLParser::EndElement(std::string const& name)
{
std::cout << "End element: " << name << std::endl;
}
-void cmXMLParser::CharacterDataHandler(const char* /*inData*/,
+void cmXMLParser::CharacterDataHandler(char const* /*inData*/,
int /*inLength*/)
{
}
-const char* cmXMLParser::FindAttribute(const char** atts,
- const char* attribute)
+char const* cmXMLParser::FindAttribute(char const** atts,
+ char const* attribute)
{
if (atts && attribute) {
- for (const char** a = atts; *a && *(a + 1); a += 2) {
+ for (char const** a = atts; *a && *(a + 1); a += 2) {
if (strcmp(*a, attribute) == 0) {
return *(a + 1);
}
@@ -155,7 +155,7 @@ const char* cmXMLParser::FindAttribute(const char** atts,
return nullptr;
}
-void cmXMLParserStartElement(void* parser, const char* name, const char** atts)
+void cmXMLParserStartElement(void* parser, char const* name, char const** atts)
{
// Begin element handler that is registered with the XML_Parser.
// This just casts the user data to a cmXMLParser and calls
@@ -163,14 +163,14 @@ void cmXMLParserStartElement(void* parser, const char* name, const char** atts)
static_cast<cmXMLParser*>(parser)->StartElement(name, atts);
}
-void cmXMLParserEndElement(void* parser, const char* name)
+void cmXMLParserEndElement(void* parser, char const* name)
{
// End element handler that is registered with the XML_Parser. This
// just casts the user data to a cmXMLParser and calls EndElement.
static_cast<cmXMLParser*>(parser)->EndElement(name);
}
-void cmXMLParserCharacterDataHandler(void* parser, const char* data,
+void cmXMLParserCharacterDataHandler(void* parser, char const* data,
int length)
{
// Character data handler that is registered with the XML_Parser.
@@ -187,7 +187,7 @@ void cmXMLParser::ReportXmlParseError()
XML_ErrorString(XML_GetErrorCode(parser)));
}
-void cmXMLParser::ReportError(int line, int /*unused*/, const char* msg)
+void cmXMLParser::ReportError(int line, int /*unused*/, char const* msg)
{
if (this->ReportCallback) {
this->ReportCallback(line, msg, this->ReportCallbackData);
diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h
index d35e44f..fe12300 100644
--- a/Source/cmXMLParser.h
+++ b/Source/cmXMLParser.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -7,9 +7,9 @@
#include <string>
extern "C" {
-void cmXMLParserStartElement(void*, const char*, const char**);
-void cmXMLParserEndElement(void*, const char*);
-void cmXMLParserCharacterDataHandler(void*, const char*, int);
+void cmXMLParserStartElement(void*, char const*, char const**);
+void cmXMLParserEndElement(void*, char const*);
+void cmXMLParserCharacterDataHandler(void*, char const*, int);
}
/** \class cmXMLParser
@@ -21,28 +21,28 @@ class cmXMLParser
{
public:
cmXMLParser();
- cmXMLParser(const cmXMLParser& /*other*/) = default;
+ cmXMLParser(cmXMLParser const& /*other*/) = default;
virtual ~cmXMLParser();
//! Parse given XML string
- virtual int Parse(const char* string);
+ virtual int Parse(char const* string);
//! Parse given XML file
- virtual int ParseFile(const char* file);
+ virtual int ParseFile(char const* file);
/**
* When parsing fragments of XML or streaming XML, use the following
* three methods. InitializeParser method initialize parser but does
- * not perform any actual parsing. ParseChunk parses framgent of
+ * not perform any actual parsing. ParseChunk parses fragment of
* XML. This has to match to what was already parsed. CleanupParser
* finishes parsing. If there were errors, CleanupParser will report
* them.
*/
virtual int InitializeParser();
- virtual int ParseChunk(const char* inputString,
+ virtual int ParseChunk(char const* inputString,
std::string::size_type length);
virtual int CleanupParser();
- using ReportFunction = void (*)(int, const char*, void*);
+ using ReportFunction = void (*)(int, char const*, void*);
void SetErrorCallback(ReportFunction f, void* d)
{
this->ReportCallback = f;
@@ -74,32 +74,32 @@ protected:
* element. atts = Null-terminated array of attribute name/value pairs.
* Even indices are attribute names, and odd indices are values.
*/
- virtual void StartElement(const std::string& name, const char** atts);
+ virtual void StartElement(std::string const& name, char const** atts);
//! Called at the end of an element in the XML source opened when
// StartElement was called.
- virtual void EndElement(const std::string& name);
+ virtual void EndElement(std::string const& name);
//! Called when there is character data to handle.
- virtual void CharacterDataHandler(const char* data, int length);
+ virtual void CharacterDataHandler(char const* data, int length);
//! Called by Parse to report an XML syntax error.
virtual void ReportXmlParseError();
/** Called by ReportXmlParseError with basic error info. */
- virtual void ReportError(int line, int column, const char* msg);
+ virtual void ReportError(int line, int column, char const* msg);
//! Send the given buffer to the XML parser.
- virtual int ParseBuffer(const char* buffer, std::string::size_type length);
+ virtual int ParseBuffer(char const* buffer, std::string::size_type length);
//! Send the given c-style string to the XML parser.
- int ParseBuffer(const char* buffer);
+ int ParseBuffer(char const* buffer);
/** Helps subclasses search for attributes on elements. */
- static const char* FindAttribute(const char** atts, const char* attribute);
+ static char const* FindAttribute(char const** atts, char const* attribute);
//! Callbacks for the expat
- friend void cmXMLParserStartElement(void*, const char*, const char**);
- friend void cmXMLParserEndElement(void*, const char*);
- friend void cmXMLParserCharacterDataHandler(void*, const char*, int);
+ friend void cmXMLParserStartElement(void*, char const*, char const**);
+ friend void cmXMLParserEndElement(void*, char const*);
+ friend void cmXMLParserCharacterDataHandler(void*, char const*, int);
};
diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx
index 4014635..fa4d1f0 100644
--- a/Source/cmXMLSafe.cxx
+++ b/Source/cmXMLSafe.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXMLSafe.h"
#include <cstdio>
@@ -8,7 +8,7 @@
#include "cm_utf8.h"
-cmXMLSafe::cmXMLSafe(const char* s)
+cmXMLSafe::cmXMLSafe(char const* s)
: Data(s)
, Size(static_cast<unsigned long>(strlen(s)))
, DoQuotes(true)
@@ -41,7 +41,7 @@ std::ostream& operator<<(std::ostream& os, cmXMLSafe const& self)
char const* last = self.Data + self.Size;
while (first != last) {
unsigned int ch;
- if (const char* next = cm_utf8_decode_character(first, last, &ch)) {
+ if (char const* next = cm_utf8_decode_character(first, last, &ch)) {
// http://www.w3.org/TR/REC-xml/#NT-Char
if ((ch >= 0x20 && ch <= 0xD7FF) || (ch >= 0xE000 && ch <= 0xFFFD) ||
(ch >= 0x10000 && ch <= 0x10FFFF) || ch == 0x9 || ch == 0xA ||
diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h
index 21bd19a..ae5d35b 100644
--- a/Source/cmXMLSafe.h
+++ b/Source/cmXMLSafe.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -15,7 +15,7 @@ class cmXMLSafe
public:
/** Construct with the data to be written. This assumes the data
will exist for the duration of this object's life. */
- cmXMLSafe(const char* s);
+ cmXMLSafe(char const* s);
cmXMLSafe(std::string const& s);
/** Specify whether to escape quotes too. This is needed when
diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx
index e4ad9b4..1457221 100644
--- a/Source/cmXMLWriter.cxx
+++ b/Source/cmXMLWriter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXMLWriter.h"
#include <cassert>
@@ -18,7 +18,7 @@ cmXMLWriter::~cmXMLWriter()
assert(this->Indent == 0);
}
-void cmXMLWriter::StartDocument(const char* encoding)
+void cmXMLWriter::StartDocument(char const* encoding)
{
this->Output << R"(<?xml version="1.0" encoding=")" << encoding << "\"?>";
}
@@ -55,7 +55,7 @@ void cmXMLWriter::EndElement()
this->ElementOpen = false;
}
-void cmXMLWriter::Element(const char* name)
+void cmXMLWriter::Element(char const* name)
{
this->CloseStartElement();
this->ConditionalLineBreak(!this->IsContent);
@@ -67,7 +67,7 @@ void cmXMLWriter::BreakAttributes()
this->BreakAttrib = true;
}
-void cmXMLWriter::Comment(const char* comment)
+void cmXMLWriter::Comment(char const* comment)
{
this->CloseStartElement();
this->ConditionalLineBreak(!this->IsContent);
@@ -80,21 +80,21 @@ void cmXMLWriter::CData(std::string const& data)
this->Output << "<![CDATA[" << data << "]]>";
}
-void cmXMLWriter::Doctype(const char* doctype)
+void cmXMLWriter::Doctype(char const* doctype)
{
this->CloseStartElement();
this->ConditionalLineBreak(!this->IsContent);
this->Output << "<!DOCTYPE " << doctype << ">";
}
-void cmXMLWriter::ProcessingInstruction(const char* target, const char* data)
+void cmXMLWriter::ProcessingInstruction(char const* target, char const* data)
{
this->CloseStartElement();
this->ConditionalLineBreak(!this->IsContent);
this->Output << "<?" << target << ' ' << data << "?>";
}
-void cmXMLWriter::FragmentFile(const char* fname)
+void cmXMLWriter::FragmentFile(char const* fname)
{
this->CloseStartElement();
cmsys::ifstream fin(fname, std::ios::in | std::ios::binary);
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 49fc864..ba4f763 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,7 +23,7 @@ public:
cmXMLWriter(cmXMLWriter const&) = delete;
cmXMLWriter& operator=(cmXMLWriter const&) = delete;
- void StartDocument(const char* encoding = "UTF-8");
+ void StartDocument(char const* encoding = "UTF-8");
void EndDocument();
void StartElement(std::string const& name);
@@ -32,13 +32,13 @@ public:
void BreakAttributes();
template <typename T>
- void Attribute(const char* name, T const& value)
+ void Attribute(char const* name, T const& value)
{
this->PreAttribute();
this->Output << name << "=\"" << SafeAttribute(value) << '"';
}
- void Element(const char* name);
+ void Element(char const* name);
template <typename T>
void Element(std::string const& name, T const& value)
@@ -55,15 +55,15 @@ public:
this->Output << SafeContent(content);
}
- void Comment(const char* comment);
+ void Comment(char const* comment);
void CData(std::string const& data);
- void Doctype(const char* doctype);
+ void Doctype(char const* doctype);
- void ProcessingInstruction(const char* target, const char* data);
+ void ProcessingInstruction(char const* target, char const* data);
- void FragmentFile(const char* fname);
+ void FragmentFile(char const* fname);
void SetIndentationElement(std::string const& element);
@@ -75,7 +75,7 @@ private:
void CloseStartElement();
- static cmXMLSafe SafeAttribute(const char* value) { return { value }; }
+ static cmXMLSafe SafeAttribute(char const* value) { return { value }; }
static cmXMLSafe SafeAttribute(std::string const& value)
{
@@ -88,7 +88,7 @@ private:
return value;
}
- static cmXMLSafe SafeContent(const char* value)
+ static cmXMLSafe SafeContent(char const* value)
{
return cmXMLSafe(value).Quotes(false);
}
@@ -141,8 +141,8 @@ public:
this->xmlwr.StartDocument();
}
~cmXMLDocument() { this->xmlwr.EndDocument(); }
- cmXMLDocument(const cmXMLDocument&) = delete;
- cmXMLDocument& operator=(const cmXMLDocument&) = delete;
+ cmXMLDocument(cmXMLDocument const&) = delete;
+ cmXMLDocument& operator=(cmXMLDocument const&) = delete;
private:
friend class cmXMLElement;
@@ -152,28 +152,28 @@ private:
class cmXMLElement
{
public:
- cmXMLElement(cmXMLWriter& xml, const char* tag)
+ cmXMLElement(cmXMLWriter& xml, char const* tag)
: xmlwr(xml)
{
this->xmlwr.StartElement(tag);
}
- cmXMLElement(cmXMLElement& par, const char* tag)
+ cmXMLElement(cmXMLElement& par, char const* tag)
: xmlwr(par.xmlwr)
{
this->xmlwr.StartElement(tag);
}
- cmXMLElement(cmXMLDocument& doc, const char* tag)
+ cmXMLElement(cmXMLDocument& doc, char const* tag)
: xmlwr(doc.xmlwr)
{
this->xmlwr.StartElement(tag);
}
~cmXMLElement() { this->xmlwr.EndElement(); }
- cmXMLElement(const cmXMLElement&) = delete;
- cmXMLElement& operator=(const cmXMLElement&) = delete;
+ cmXMLElement(cmXMLElement const&) = delete;
+ cmXMLElement& operator=(cmXMLElement const&) = delete;
template <typename T>
- cmXMLElement& Attribute(const char* name, T const& value)
+ cmXMLElement& Attribute(char const* name, T const& value)
{
this->xmlwr.Attribute(name, value);
return *this;
@@ -188,7 +188,7 @@ public:
{
this->xmlwr.Element(name, value);
}
- void Comment(const char* comment) { this->xmlwr.Comment(comment); }
+ void Comment(char const* comment) { this->xmlwr.Comment(comment); }
private:
cmXMLWriter& xmlwr;
diff --git a/Source/cmXcFramework.cxx b/Source/cmXcFramework.cxx
index de99713..a133aa4 100644
--- a/Source/cmXcFramework.cxx
+++ b/Source/cmXcFramework.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmXcFramework.h"
#include <string>
@@ -33,7 +33,7 @@ auto const PlistMetadataHelper =
cmJSONHelperBuilder::String());
bool PlistSupportedPlatformHelper(
- cmXcFrameworkPlistSupportedPlatform& platform, const Json::Value* value,
+ cmXcFrameworkPlistSupportedPlatform& platform, Json::Value const* value,
cmJSONState* /*state*/)
{
if (!value) {
@@ -70,7 +70,7 @@ bool PlistSupportedPlatformHelper(
bool PlistSupportedPlatformVariantHelper(
cmXcFrameworkPlistSupportedPlatformVariant& variant,
- const Json::Value* value, cmJSONState* /*state*/)
+ Json::Value const* value, cmJSONState* /*state*/)
{
if (!value) {
return false;
@@ -121,8 +121,8 @@ auto const PlistHelper =
}
cm::optional<cmXcFrameworkPlist> cmParseXcFrameworkPlist(
- const std::string& xcframeworkPath, const cmMakefile& mf,
- const cmListFileBacktrace& bt)
+ std::string const& xcframeworkPath, cmMakefile const& mf,
+ cmListFileBacktrace const& bt)
{
std::string plistPath = cmStrCat(xcframeworkPath, "/Info.plist");
@@ -165,8 +165,8 @@ cm::optional<cmXcFrameworkPlist> cmParseXcFrameworkPlist(
return cm::optional<cmXcFrameworkPlist>(plist);
}
-const cmXcFrameworkPlistLibrary* cmXcFrameworkPlist::SelectSuitableLibrary(
- const cmMakefile& mf, const cmListFileBacktrace& bt) const
+cmXcFrameworkPlistLibrary const* cmXcFrameworkPlist::SelectSuitableLibrary(
+ cmMakefile const& mf, cmListFileBacktrace const& bt) const
{
auto systemName = mf.GetSafeDefinition("CMAKE_SYSTEM_NAME");
cm::optional<cmXcFrameworkPlistSupportedPlatformVariant> systemVariant;
diff --git a/Source/cmXcFramework.h b/Source/cmXcFramework.h
index 7ca91da..a54fb29 100644
--- a/Source/cmXcFramework.h
+++ b/Source/cmXcFramework.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <string>
@@ -42,11 +42,11 @@ struct cmXcFrameworkPlist
std::string Path;
std::vector<cmXcFrameworkPlistLibrary> AvailableLibraries;
- const cmXcFrameworkPlistLibrary* SelectSuitableLibrary(
- const cmMakefile& mf,
- const cmListFileBacktrace& bt = cmListFileBacktrace{}) const;
+ cmXcFrameworkPlistLibrary const* SelectSuitableLibrary(
+ cmMakefile const& mf,
+ cmListFileBacktrace const& bt = cmListFileBacktrace{}) const;
};
cm::optional<cmXcFrameworkPlist> cmParseXcFrameworkPlist(
- const std::string& xcframeworkPath, const cmMakefile& mf,
- const cmListFileBacktrace& bt = cmListFileBacktrace{});
+ std::string const& xcframeworkPath, cmMakefile const& mf,
+ cmListFileBacktrace const& bt = cmListFileBacktrace{});
diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx
index 60faced..82c76ed 100644
--- a/Source/cm_codecvt.cxx
+++ b/Source/cm_codecvt.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cm_codecvt.hxx"
#if defined(_WIN32)
@@ -52,9 +52,9 @@ bool codecvt::do_always_noconv() const noexcept
return this->m_noconv;
}
-std::codecvt_base::result codecvt::do_out(mbstate_t& state, const char* from,
- const char* from_end,
- const char*& from_next, char* to,
+std::codecvt_base::result codecvt::do_out(mbstate_t& state, char const* from,
+ char const* from_end,
+ char const*& from_next, char* to,
char* to_end, char*& to_next) const
{
from_next = from;
@@ -154,7 +154,7 @@ std::codecvt_base::result codecvt::do_unshift(mbstate_t& state, char* to,
#if defined(_WIN32)
std::codecvt_base::result codecvt::Decode(mbstate_t& state, int size,
- const char*& from_next,
+ char const*& from_next,
char*& to_next, char* to_end) const
{
State& lstate = reinterpret_cast<State&>(state);
@@ -226,7 +226,7 @@ std::codecvt_base::result codecvt::DecodePartial(mbstate_t& state,
}
void codecvt::BufferPartial(mbstate_t& state, int size,
- const char*& from_next) const
+ char const*& from_next) const
{
State& lstate = reinterpret_cast<State&>(state);
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index c25f9ef..037fd14 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,8 +19,8 @@ public:
protected:
~codecvt() override;
bool do_always_noconv() const noexcept override;
- result do_out(mbstate_t& state, const char* from, const char* from_end,
- const char*& from_next, char* to, char* to_end,
+ result do_out(mbstate_t& state, char const* from, char const* from_end,
+ char const*& from_next, char* to, char* to_end,
char*& to_next) const override;
result do_unshift(mbstate_t& state, char* to, char*,
char*& to_next) const override;
@@ -48,10 +48,10 @@ private:
bool m_noconv;
# if defined(_WIN32)
unsigned int m_codepage;
- result Decode(mbstate_t& state, int need, const char*& from_next,
+ result Decode(mbstate_t& state, int need, char const*& from_next,
char*& to_next, char* to_end) const;
result DecodePartial(mbstate_t& state, char*& to_next, char* to_end) const;
- void BufferPartial(mbstate_t& state, int need, const char*& from_next) const;
+ void BufferPartial(mbstate_t& state, int need, char const*& from_next) const;
# endif
#endif
diff --git a/Source/cm_codecvt_Encoding.hxx b/Source/cm_codecvt_Encoding.hxx
index b91ad8f..e90f147 100644
--- a/Source/cm_codecvt_Encoding.hxx
+++ b/Source/cm_codecvt_Encoding.hxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
enum class codecvt_Encoding
diff --git a/Source/cm_fileno.cxx b/Source/cm_fileno.cxx
index a40c5ca..6688140 100644
--- a/Source/cm_fileno.cxx
+++ b/Source/cm_fileno.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#if !defined(_POSIX_C_SOURCE) && !defined(_WIN32) && !defined(__sun) && \
!defined(__OpenBSD__)
/* POSIX APIs are needed */
diff --git a/Source/cm_fileno.hxx b/Source/cm_fileno.hxx
index 3abcdcf..b35456c 100644
--- a/Source/cm_fileno.hxx
+++ b/Source/cm_fileno.hxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <cstdio>
diff --git a/Source/cm_get_date.c b/Source/cm_get_date.c
index 49f5577..700b3e3 100644
--- a/Source/cm_get_date.c
+++ b/Source/cm_get_date.c
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cm_get_date.h"
// FIXME: This suppresses use of localtime_r because archive_getdate.c
diff --git a/Source/cm_get_date.h b/Source/cm_get_date.h
index 65722df..9984ede 100644
--- a/Source/cm_get_date.h
+++ b/Source/cm_get_date.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <time.h> /* NOLINT(modernize-deprecated-headers) */
@@ -9,7 +9,7 @@ extern "C" {
#endif
/** Parse a date/time string. Treat relative times with respect to 'now'. */
-time_t cm_get_date(time_t now, const char* str);
+time_t cm_get_date(time_t now, char const* str);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h
index c4e3d84..234298f 100644
--- a/Source/cm_sys_stat.h
+++ b/Source/cm_sys_stat.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#if defined(_MSC_VER)
diff --git a/Source/cm_utf8.c b/Source/cm_utf8.c
index b046aef..9f68d5e 100644
--- a/Source/cm_utf8.c
+++ b/Source/cm_utf8.c
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cm_utf8.h"
#include <string.h>
@@ -39,7 +39,7 @@ static unsigned int const cm_utf8_min[7] = {
0, 0, 1u << 7, 1u << 11, 1u << 16, 1u << 21, 1u << 26 /*, 1u<<31 */
};
-const char* cm_utf8_decode_character(const char* first, const char* last,
+char const* cm_utf8_decode_character(char const* first, char const* last,
unsigned int* pc)
{
/* We need at least one byte. */
@@ -93,14 +93,14 @@ const char* cm_utf8_decode_character(const char* first, const char* last,
}
}
-int cm_utf8_is_valid(const char* s)
+int cm_utf8_is_valid(char const* s)
{
if (!s) {
return 0;
}
- const char* last = s + strlen(s);
- const char* pos = s;
+ char const* last = s + strlen(s);
+ char const* pos = s;
unsigned int pc;
while (pos != last && (pos = cm_utf8_decode_character(pos, last, &pc))) {
diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h
index 67f3d3f..916a439 100644
--- a/Source/cm_utf8.h
+++ b/Source/cm_utf8.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#ifdef __cplusplus
@@ -11,12 +11,12 @@ extern unsigned char const cm_utf8_ones[256];
/** Decode one UTF-8 character from the input byte range. On success,
stores the unicode character number in *pc and returns the first
position not extracted. On failure, returns 0. */
-const char* cm_utf8_decode_character(const char* first, const char* last,
+char const* cm_utf8_decode_character(char const* first, char const* last,
unsigned int* pc);
/** Returns whether a C string is a sequence of valid UTF-8 encoded Unicode
codepoints. Returns non-zero on success. */
-int cm_utf8_is_valid(const char* s);
+int cm_utf8_is_valid(char const* s);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fcee5e5..40c7e0c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmake.h"
#include <algorithm>
@@ -7,7 +7,6 @@
#include <chrono>
#include <cstdio>
#include <cstdlib>
-#include <cstring>
#include <initializer_list>
#include <iomanip>
#include <iostream>
@@ -15,6 +14,7 @@
#include <stdexcept>
#include <utility>
+#include <cm/filesystem>
#include <cm/memory>
#include <cm/optional>
#include <cm/string_view>
@@ -62,6 +62,9 @@
#include "cmJSONState.h"
#include "cmList.h"
#include "cmMessenger.h"
+#ifndef CMAKE_BOOTSTRAP
+# include "cmSarifLog.h"
+#endif
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStringAlgorithms.h"
@@ -82,6 +85,8 @@
# include "cmConfigureLog.h"
# include "cmFileAPI.h"
# include "cmGraphVizWriter.h"
+# include "cmInstrumentation.h"
+# include "cmInstrumentationQuery.h"
# include "cmVariableWatch.h"
#endif
@@ -157,16 +162,16 @@ using CommandArgument =
cmCommandLineArgument<bool(std::string const& value, cmake* state)>;
#ifndef CMAKE_BOOTSTRAP
-void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
- void* ctx, const char* /*unused*/,
- const cmMakefile* /*unused*/)
+void cmWarnUnusedCliWarning(std::string const& variable, int /*unused*/,
+ void* ctx, char const* /*unused*/,
+ cmMakefile const* /*unused*/)
{
cmake* cm = reinterpret_cast<cmake*>(ctx);
cm->MarkCliAsUsed(variable);
}
#endif
-bool cmakeCheckStampFile(const std::string& stampName)
+bool cmakeCheckStampFile(std::string const& stampName)
{
// The stamp file does not exist. Use the stamp dependencies to
// determine whether it is really out of date. This works in
@@ -212,7 +217,7 @@ bool cmakeCheckStampFile(const std::string& stampName)
// The build system is up to date. The stamp file has been removed
// by the VS IDE due to a "rebuild" request. Restore it atomically.
std::ostringstream stampTempStream;
- stampTempStream << stampName << ".tmp" << cmSystemTools::RandomSeed();
+ stampTempStream << stampName << ".tmp" << cmSystemTools::RandomNumber();
std::string stampTemp = stampTempStream.str();
{
// TODO: Teach cmGeneratedFileStream to use a random temp file (with
@@ -233,7 +238,7 @@ bool cmakeCheckStampFile(const std::string& stampName)
return false;
}
-bool cmakeCheckStampList(const std::string& stampList)
+bool cmakeCheckStampList(std::string const& stampList)
{
// If the stamp list does not exist CMake must rerun to generate it.
if (!cmSystemTools::FileExists(stampList)) {
@@ -260,7 +265,7 @@ bool cmakeCheckStampList(const std::string& stampList)
} // namespace
-cmDocumentationEntry cmake::CMAKE_STANDARD_OPTIONS_TABLE[18] = {
+cmDocumentationEntry cmake::CMAKE_STANDARD_OPTIONS_TABLE[19] = {
{ "-S <path-to-source>", "Explicitly specify a source directory." },
{ "-B <path-to-build>", "Explicitly specify a build directory." },
{ "-C <initial-cache>", "Pre-load a script to populate the cache." },
@@ -272,6 +277,8 @@ cmDocumentationEntry cmake::CMAKE_STANDARD_OPTIONS_TABLE[18] = {
{ "--toolchain <file>", "Specify toolchain file [CMAKE_TOOLCHAIN_FILE]." },
{ "--install-prefix <directory>",
"Specify install directory [CMAKE_INSTALL_PREFIX]." },
+ { "--project-file <project-file-name>",
+ "Specify an alternate project file name." },
{ "-Wdev", "Enable developer warnings." },
{ "-Wno-dev", "Suppress developer warnings." },
{ "-Werror=dev", "Make developer warnings errors." },
@@ -287,7 +294,7 @@ cmDocumentationEntry cmake::CMAKE_STANDARD_OPTIONS_TABLE[18] = {
};
cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind)
- : CMakeWorkingDirectory(cmSystemTools::GetCurrentWorkingDirectory())
+ : CMakeWorkingDirectory(cmSystemTools::GetLogicalWorkingDirectory())
, FileTimeCache(cm::make_unique<cmFileTimeCache>())
#ifndef CMAKE_BOOTSTRAP
, VariableWatch(cm::make_unique<cmVariableWatch>())
@@ -447,9 +454,9 @@ void cmake::CleanupCommandsAndMacros()
}
#ifndef CMAKE_BOOTSTRAP
-void cmake::SetWarningFromPreset(const std::string& name,
- const cm::optional<bool>& warning,
- const cm::optional<bool>& error)
+void cmake::SetWarningFromPreset(std::string const& name,
+ cm::optional<bool> const& warning,
+ cm::optional<bool> const& error)
{
if (warning) {
if (*warning) {
@@ -538,8 +545,23 @@ void cmake::PrintPresetEnvironment()
#endif
// Parse the args
-bool cmake::SetCacheArgs(const std::vector<std::string>& args)
+bool cmake::SetCacheArgs(std::vector<std::string> const& args)
{
+ static std::string const kCMAKE_POLICY_VERSION_MINIMUM =
+ "CMAKE_POLICY_VERSION_MINIMUM";
+ if (!this->State->GetInitializedCacheValue(kCMAKE_POLICY_VERSION_MINIMUM)) {
+ cm::optional<std::string> policyVersion =
+ cmSystemTools::GetEnvVar(kCMAKE_POLICY_VERSION_MINIMUM);
+ if (policyVersion && !policyVersion->empty()) {
+ this->AddCacheEntry(
+ kCMAKE_POLICY_VERSION_MINIMUM, *policyVersion,
+ "Override policy version for cmake_minimum_required calls.",
+ cmStateEnums::STRING);
+ this->State->SetCacheEntryProperty(kCMAKE_POLICY_VERSION_MINIMUM,
+ "ADVANCED", "1");
+ }
+ }
+
auto DefineLambda = [](std::string const& entry, cmake* state) -> bool {
std::string var;
std::string value;
@@ -638,14 +660,14 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
// Documented behavior of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be
// set to $PWD for -P mode.
state->SetWorkingMode(SCRIPT_MODE);
- state->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- state->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ state->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
+ state->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
state->ReadListFile(args, path);
return true;
};
auto PrefixLambda = [&](std::string const& path, cmake* state) -> bool {
- const std::string var = "CMAKE_INSTALL_PREFIX";
+ std::string const var = "CMAKE_INSTALL_PREFIX";
cmStateEnums::CacheEntryType type = cmStateEnums::PATH;
cmCMakePath absolutePath(path);
if (absolutePath.IsAbsolute()) {
@@ -660,7 +682,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
};
auto ToolchainLambda = [&](std::string const& path, cmake* state) -> bool {
- const std::string var = "CMAKE_TOOLCHAIN_FILE";
+ std::string const var = "CMAKE_TOOLCHAIN_FILE";
cmStateEnums::CacheEntryType type = cmStateEnums::FILEPATH;
#ifndef CMAKE_BOOTSTRAP
state->UnprocessedPresetVariables.erase(var);
@@ -690,7 +712,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmSystemTools::Stdout("loading initial cache file " + value + "\n");
// Resolve script path specified on command line
// relative to $PWD.
- auto path = cmSystemTools::CollapseFullPath(value);
+ auto path = cmSystemTools::ToNormalizedPathOnDisk(value);
state->ReadListFile(args, path);
return true;
} },
@@ -716,7 +738,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
for (auto const& m : arguments) {
if (m.matches(arg)) {
- const bool parsedCorrectly = m.parse(arg, i, args, this);
+ bool const parsedCorrectly = m.parse(arg, i, args, this);
if (!parsedCorrectly) {
return false;
}
@@ -731,7 +753,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return true;
}
-void cmake::ProcessCacheArg(const std::string& var, const std::string& value,
+void cmake::ProcessCacheArg(std::string const& var, std::string const& value,
cmStateEnums::CacheEntryType type)
{
// The value is transformed if it is a filepath for example, so
@@ -757,8 +779,8 @@ void cmake::ProcessCacheArg(const std::string& var, const std::string& value,
}
}
-void cmake::ReadListFile(const std::vector<std::string>& args,
- const std::string& path)
+void cmake::ReadListFile(std::vector<std::string> const& args,
+ std::string const& path)
{
// if a generator was not yet created, temporarily create one
cmGlobalGenerator* gg = this->GetGlobalGenerator();
@@ -779,10 +801,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
snapshot.SetDefaultDefinitions();
cmMakefile mf(gg, snapshot);
if (this->GetWorkingMode() != NORMAL_MODE) {
- std::string file(cmSystemTools::CollapseFullPath(path));
- cmSystemTools::ConvertToUnixSlashes(file);
- mf.SetScriptModeFile(file);
-
+ mf.SetScriptModeFile(cmSystemTools::ToNormalizedPathOnDisk(path));
mf.SetArgcArgv(args);
}
if (!cmSystemTools::FileExists(path, true)) {
@@ -794,18 +813,18 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
}
}
-bool cmake::FindPackage(const std::vector<std::string>& args)
+bool cmake::FindPackage(std::vector<std::string> const& args)
{
- this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ this->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
+ this->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
this->SetGlobalGenerator(cm::make_unique<cmGlobalGenerator>(this));
cmStateSnapshot snapshot = this->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(
- cmSystemTools::GetCurrentWorkingDirectory());
+ cmSystemTools::GetLogicalWorkingDirectory());
snapshot.GetDirectory().SetCurrentSource(
- cmSystemTools::GetCurrentWorkingDirectory());
+ cmSystemTools::GetLogicalWorkingDirectory());
// read in the list file to fill the cache
snapshot.SetDefaultDefinitions();
auto mfu = cm::make_unique<cmMakefile>(this->GetGlobalGenerator(), snapshot);
@@ -836,14 +855,14 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmList includeDirs{ includes };
this->GlobalGenerator->CreateGenerationObjects();
- const auto& lg = this->GlobalGenerator->LocalGenerators[0];
+ auto const& lg = this->GlobalGenerator->LocalGenerators[0];
std::string includeFlags =
lg->GetIncludeFlags(includeDirs, nullptr, language, std::string());
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
} else if (mode == "LINK"_s) {
- const char* targetName = "dummy";
+ char const* targetName = "dummy";
std::vector<std::string> srcs;
cmTarget* tgt = mf->AddExecutable(targetName, srcs, true);
tgt->SetProperty("LINKER_LANGUAGE", language);
@@ -929,11 +948,13 @@ enum class ListPresets
}
// Parse the args
-void cmake::SetArgs(const std::vector<std::string>& args)
+void cmake::SetArgs(std::vector<std::string> const& args)
{
+ this->cmdArgs = args;
bool haveToolset = false;
bool havePlatform = false;
bool haveBArg = false;
+ bool haveCMLName = false;
std::string possibleUnknownArg;
std::string extraProvidedPath;
#if !defined(CMAKE_BOOTSTRAP)
@@ -956,10 +977,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
cmSystemTools::Error("No source directory specified for -S");
return false;
}
- std::string path = cmSystemTools::CollapseFullPath(value);
- cmSystemTools::ConvertToUnixSlashes(path);
-
- state->SetHomeDirectoryViaCommandLine(path);
+ state->SetHomeDirectoryViaCommandLine(
+ cmSystemTools::ToNormalizedPathOnDisk(value));
return true;
};
@@ -968,9 +987,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
cmSystemTools::Error("No build directory specified for -B");
return false;
}
- std::string path = cmSystemTools::CollapseFullPath(value);
- cmSystemTools::ConvertToUnixSlashes(path);
- state->SetHomeOutputDirectory(path);
+ state->SetHomeOutputDirectory(
+ cmSystemTools::ToNormalizedPathOnDisk(value));
haveBArg = true;
return true;
};
@@ -995,6 +1013,17 @@ void cmake::SetArgs(const std::vector<std::string>& args)
return true;
};
+ auto CMakeListsFileLambda = [&](std::string const& value,
+ cmake* state) -> bool {
+ if (haveCMLName) {
+ cmSystemTools::Error("Multiple --project-file options not allowed");
+ return false;
+ }
+ state->SetCMakeListName(value);
+ haveCMLName = true;
+ return true;
+ };
+
std::vector<CommandArgument> arguments = {
CommandArgument{ "", CommandArgument::Values::Zero, EmptyStringArgLambda },
CommandArgument{ "-S", "No source directory specified for -S",
@@ -1074,7 +1103,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument{ "--graphviz", "No file specified for --graphviz",
CommandArgument::Values::One,
[](std::string const& value, cmake* state) -> bool {
- state->SetGraphVizFile(value);
+ state->SetGraphVizFile(
+ cmSystemTools::ToNormalizedPathOnDisk(value));
return true;
} },
@@ -1094,7 +1124,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument{ "--log-level", "Invalid level specified for --log-level",
CommandArgument::Values::One,
[](std::string const& value, cmake* state) -> bool {
- const auto logLevel = StringToLogLevel(value);
+ auto const logLevel = StringToLogLevel(value);
if (logLevel == Message::LogLevel::LOG_UNDEFINED) {
cmSystemTools::Error(
"Invalid level specified for --log-level");
@@ -1110,7 +1140,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument{ "--loglevel", "Invalid level specified for --loglevel",
CommandArgument::Values::One,
[](std::string const& value, cmake* state) -> bool {
- const auto logLevel = StringToLogLevel(value);
+ auto const logLevel = StringToLogLevel(value);
if (logLevel == Message::LogLevel::LOG_UNDEFINED) {
cmSystemTools::Error(
"Invalid level specified for --loglevel");
@@ -1126,6 +1156,9 @@ void cmake::SetArgs(const std::vector<std::string>& args)
state->SetShowLogContext(true);
return true;
} },
+ CommandArgument{ "--project-file",
+ "No filename specified for --project-file",
+ CommandArgument::Values::One, CMakeListsFileLambda },
CommandArgument{
"--debug-find", CommandArgument::Values::Zero,
[](std::string const&, cmake* state) -> bool {
@@ -1137,7 +1170,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
"--debug-find-pkg", "Provide a package argument for --debug-find-pkg",
CommandArgument::Values::One, CommandArgument::RequiresSeparator::Yes,
[](std::string const& value, cmake* state) -> bool {
- std::vector<std::string> find_pkgs(cmTokenize(value, ","));
+ std::vector<std::string> find_pkgs(cmTokenize(value, ','));
std::cout << "Running with debug output on for the 'find' commands "
"for package(s)";
for (auto const& v : find_pkgs) {
@@ -1151,7 +1184,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
"--debug-find-var", CommandArgument::Values::One,
CommandArgument::RequiresSeparator::Yes,
[](std::string const& value, cmake* state) -> bool {
- std::vector<std::string> find_vars(cmTokenize(value, ","));
+ std::vector<std::string> find_vars(cmTokenize(value, ','));
std::cout << "Running with debug output on for the variable(s)";
for (auto const& v : find_vars) {
std::cout << ' ' << v;
@@ -1182,7 +1215,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
std::cout << "Put cmake in trace mode and sets the "
"trace output format.\n";
state->SetTrace(true);
- const auto traceFormat = StringToTraceFormat(value);
+ auto const traceFormat = StringToTraceFormat(value);
if (traceFormat == TraceFormat::Undefined) {
cmSystemTools::Error("Invalid format specified for --trace-format. "
"Valid formats are human, json-v1.");
@@ -1247,9 +1280,27 @@ void cmake::SetArgs(const std::vector<std::string>& args)
[](std::string const&, cmake* state) -> bool {
std::cout << "Ignoring COMPILE_WARNING_AS_ERROR target property and "
"CMAKE_COMPILE_WARNING_AS_ERROR variable.\n";
- state->SetIgnoreWarningAsError(true);
+ state->SetIgnoreCompileWarningAsError(true);
+ return true;
+ } },
+ CommandArgument{
+ "--link-no-warning-as-error", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Ignoring LINK_WARNING_AS_ERROR target property and "
+ "CMAKE_LINK_WARNING_AS_ERROR variable.\n";
+ state->SetIgnoreLinkWarningAsError(true);
return true;
} },
+#ifndef CMAKE_BOOTSTRAP
+ CommandArgument{ "--sarif-output", "No file specified for --sarif-output",
+ CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ state->SarifFilePath =
+ cmSystemTools::ToNormalizedPathOnDisk(value);
+ state->SarifFileOutput = true;
+ return true;
+ } },
+#endif
CommandArgument{ "--debugger", CommandArgument::Values::Zero,
[](std::string const&, cmake* state) -> bool {
#ifdef CMake_ENABLE_DEBUGGER
@@ -1278,23 +1329,22 @@ void cmake::SetArgs(const std::vector<std::string>& args)
return false;
#endif
} },
- CommandArgument{
- "--debugger-dap-log", "No file specified for --debugger-dap-log",
- CommandArgument::Values::One,
- [](std::string const& value, cmake* state) -> bool {
+ CommandArgument{ "--debugger-dap-log",
+ "No file specified for --debugger-dap-log",
+ CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
#ifdef CMake_ENABLE_DEBUGGER
- std::string path = cmSystemTools::CollapseFullPath(value);
- cmSystemTools::ConvertToUnixSlashes(path);
- state->DebuggerDapLogFile = path;
- return true;
+ state->DebuggerDapLogFile =
+ cmSystemTools::ToNormalizedPathOnDisk(value);
+ return true;
#else
- static_cast<void>(value);
- static_cast<void>(state);
- cmSystemTools::Error(
- "CMake was not built with support for --debugger-dap-log");
- return false;
+ static_cast<void>(value);
+ static_cast<void>(state);
+ cmSystemTools::Error("CMake was not built with support "
+ "for --debugger-dap-log");
+ return false;
#endif
- } },
+ } },
};
#if defined(CMAKE_HAVE_VS_GENERATORS)
@@ -1316,9 +1366,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
arguments.emplace_back(
"--profiling-output", "No path specified for --profiling-output",
CommandArgument::Values::One,
- [&](std::string const& value, cmake*) -> bool {
- profilingOutput = cmSystemTools::CollapseFullPath(value);
- cmSystemTools::ConvertToUnixSlashes(profilingOutput);
+ [&profilingOutput](std::string const& value, cmake*) -> bool {
+ profilingOutput = cmSystemTools::ToNormalizedPathOnDisk(value);
return true;
});
arguments.emplace_back("--preset", "No preset specified for --preset",
@@ -1360,7 +1409,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
"-G", "No generator specified for -G", CommandArgument::Values::One,
CommandArgument::RequiresSeparator::No,
[&](std::string const& value, cmake* state) -> bool {
- bool valid = state->CreateAndSetGlobalGenerator(value, true);
+ bool valid = state->CreateAndSetGlobalGenerator(value);
badGeneratorName = !valid;
return valid;
});
@@ -1460,9 +1509,9 @@ void cmake::SetArgs(const std::vector<std::string>& args)
}
#endif
- const bool haveSourceDir = !this->GetHomeDirectory().empty();
- const bool haveBinaryDir = !this->GetHomeOutputDirectory().empty();
- const bool havePreset =
+ bool const haveSourceDir = !this->GetHomeDirectory().empty();
+ bool const haveBinaryDir = !this->GetHomeOutputDirectory().empty();
+ bool const havePreset =
#ifdef CMAKE_BOOTSTRAP
false;
#else
@@ -1479,10 +1528,10 @@ void cmake::SetArgs(const std::vector<std::string>& args)
}
if (!haveSourceDir) {
- this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ this->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
}
if (!haveBinaryDir) {
- this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ this->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
}
#if !defined(CMAKE_BOOTSTRAP)
@@ -1549,8 +1598,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->SetHomeOutputDirectory(expandedPreset->BinaryDir);
}
if (!this->GlobalGenerator && !expandedPreset->Generator.empty()) {
- if (!this->CreateAndSetGlobalGenerator(expandedPreset->Generator,
- false)) {
+ if (!this->CreateAndSetGlobalGenerator(expandedPreset->Generator)) {
return;
}
}
@@ -1588,7 +1636,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
if (!expandedPreset->GraphVizFile.empty()) {
if (this->GraphVizFile.empty()) {
- this->SetGraphVizFile(expandedPreset->GraphVizFile);
+ this->SetGraphVizFile(
+ cmSystemTools::CollapseFullPath(expandedPreset->GraphVizFile));
}
}
@@ -1644,9 +1693,9 @@ void cmake::SetArgs(const std::vector<std::string>& args)
namespace {
using LevelsPair = std::pair<cm::string_view, Message::LogLevel>;
using LevelsPairArray = std::array<LevelsPair, 7>;
-const LevelsPairArray& getStringToLogLevelPairs()
+LevelsPairArray const& getStringToLogLevelPairs()
{
- static const LevelsPairArray levels = {
+ static LevelsPairArray const levels = {
{ { "error", Message::LogLevel::LOG_ERROR },
{ "warning", Message::LogLevel::LOG_WARNING },
{ "notice", Message::LogLevel::LOG_NOTICE },
@@ -1661,14 +1710,14 @@ const LevelsPairArray& getStringToLogLevelPairs()
Message::LogLevel cmake::StringToLogLevel(cm::string_view levelStr)
{
- const LevelsPairArray& levels = getStringToLogLevelPairs();
+ LevelsPairArray const& levels = getStringToLogLevelPairs();
- const auto levelStrLowCase =
+ auto const levelStrLowCase =
cmSystemTools::LowerCase(std::string{ levelStr });
// NOLINTNEXTLINE(readability-qualified-auto)
- const auto it = std::find_if(levels.cbegin(), levels.cend(),
- [&levelStrLowCase](const LevelsPair& p) {
+ auto const it = std::find_if(levels.cbegin(), levels.cend(),
+ [&levelStrLowCase](LevelsPair const& p) {
return p.first == levelStrLowCase;
});
return (it != levels.cend()) ? it->second : Message::LogLevel::LOG_UNDEFINED;
@@ -1676,37 +1725,37 @@ Message::LogLevel cmake::StringToLogLevel(cm::string_view levelStr)
std::string cmake::LogLevelToString(Message::LogLevel level)
{
- const LevelsPairArray& levels = getStringToLogLevelPairs();
+ LevelsPairArray const& levels = getStringToLogLevelPairs();
// NOLINTNEXTLINE(readability-qualified-auto)
- const auto it =
+ auto const it =
std::find_if(levels.cbegin(), levels.cend(),
- [&level](const LevelsPair& p) { return p.second == level; });
- const cm::string_view levelStrLowerCase =
+ [&level](LevelsPair const& p) { return p.second == level; });
+ cm::string_view const levelStrLowerCase =
(it != levels.cend()) ? it->first : "undefined";
std::string levelStrUpperCase =
cmSystemTools::UpperCase(std::string{ levelStrLowerCase });
return levelStrUpperCase;
}
-cmake::TraceFormat cmake::StringToTraceFormat(const std::string& traceStr)
+cmake::TraceFormat cmake::StringToTraceFormat(std::string const& traceStr)
{
using TracePair = std::pair<std::string, TraceFormat>;
- static const std::vector<TracePair> levels = {
+ static std::vector<TracePair> const levels = {
{ "human", TraceFormat::Human },
{ "json-v1", TraceFormat::JSONv1 },
};
- const auto traceStrLowCase = cmSystemTools::LowerCase(traceStr);
+ auto const traceStrLowCase = cmSystemTools::LowerCase(traceStr);
- const auto it = std::find_if(levels.cbegin(), levels.cend(),
- [&traceStrLowCase](const TracePair& p) {
+ auto const it = std::find_if(levels.cbegin(), levels.cend(),
+ [&traceStrLowCase](TracePair const& p) {
return p.first == traceStrLowCase;
});
return (it != levels.cend()) ? it->second : TraceFormat::Undefined;
}
-void cmake::SetTraceFile(const std::string& file)
+void cmake::SetTraceFile(std::string const& file)
{
this->TraceFile.close();
this->TraceFile.open(file.c_str());
@@ -1770,19 +1819,19 @@ void cmake::SetTraceRedirect(cmake* other)
this->TraceRedirect = other;
}
-bool cmake::SetDirectoriesFromFile(const std::string& arg)
+bool cmake::SetDirectoriesFromFile(std::string const& arg)
{
- // Check if the argument refers to a CMakeCache.txt or
- // CMakeLists.txt file.
+ // Check if the argument refers to a CMakeCache.txt or CMakeLists.txt file.
+ // Do not check for the custom project filename CMAKE_LIST_FILE_NAME, as it
+ // cannot be determined until after reading the CMakeCache.txt
std::string listPath;
std::string cachePath;
bool is_source_dir = false;
bool is_empty_directory = false;
if (cmSystemTools::FileIsDirectory(arg)) {
- std::string path = cmSystemTools::CollapseFullPath(arg);
- cmSystemTools::ConvertToUnixSlashes(path);
+ std::string path = cmSystemTools::ToNormalizedPathOnDisk(arg);
std::string cacheFile = cmStrCat(path, "/CMakeCache.txt");
- std::string listFile = cmStrCat(path, "/CMakeLists.txt");
+ std::string listFile = this->GetCMakeListFile(path);
is_empty_directory = true;
if (cmSystemTools::FileExists(cacheFile)) {
@@ -1795,7 +1844,7 @@ bool cmake::SetDirectoriesFromFile(const std::string& arg)
is_source_dir = true;
}
} else if (cmSystemTools::FileExists(arg)) {
- std::string fullPath = cmSystemTools::CollapseFullPath(arg);
+ std::string fullPath = cmSystemTools::ToNormalizedPathOnDisk(arg);
std::string name = cmSystemTools::GetFilenameName(fullPath);
name = cmSystemTools::LowerCase(name);
if (name == "cmakecache.txt"_s) {
@@ -1834,7 +1883,7 @@ bool cmake::SetDirectoriesFromFile(const std::string& arg)
// When invoked with a path that points to an existing CMakeCache
// This function is called multiple times with the same path
- const bool passed_same_path = (listPath == this->GetHomeDirectory()) ||
+ bool const passed_same_path = (listPath == this->GetHomeDirectory()) ||
(listPath == this->GetHomeOutputDirectory());
bool used_provided_path =
(passed_same_path || is_source_dir || no_build_tree);
@@ -1846,14 +1895,13 @@ bool cmake::SetDirectoriesFromFile(const std::string& arg)
if (is_source_dir) {
this->SetHomeDirectoryViaCommandLine(listPath);
if (no_build_tree) {
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- this->SetHomeOutputDirectory(cwd);
+ this->SetHomeOutputDirectory(
+ cmSystemTools::GetLogicalWorkingDirectory());
}
} else if (no_source_tree && no_build_tree) {
this->SetHomeDirectory(listPath);
-
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- this->SetHomeOutputDirectory(cwd);
+ this->SetHomeOutputDirectory(
+ cmSystemTools::GetLogicalWorkingDirectory());
} else if (no_build_tree) {
this->SetHomeOutputDirectory(listPath);
}
@@ -1861,18 +1909,16 @@ bool cmake::SetDirectoriesFromFile(const std::string& arg)
if (no_source_tree) {
// We didn't find a CMakeLists.txt and it wasn't specified
// with -S. Assume it is the path to the source tree
- std::string full = cmSystemTools::CollapseFullPath(arg);
- this->SetHomeDirectory(full);
+ this->SetHomeDirectory(cmSystemTools::ToNormalizedPathOnDisk(arg));
}
if (no_build_tree && !no_source_tree && is_empty_directory) {
// passed `-S <path> <build_dir> when build_dir is an empty directory
- std::string full = cmSystemTools::CollapseFullPath(arg);
- this->SetHomeOutputDirectory(full);
+ this->SetHomeOutputDirectory(cmSystemTools::ToNormalizedPathOnDisk(arg));
} else if (no_build_tree) {
// We didn't find a CMakeCache.txt and it wasn't specified
// with -B. Assume the current working directory as the build tree.
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- this->SetHomeOutputDirectory(cwd);
+ this->SetHomeOutputDirectory(
+ cmSystemTools::GetLogicalWorkingDirectory());
used_provided_path = false;
}
}
@@ -1922,16 +1968,12 @@ void cmake::AddDefaultExtraGenerators()
#endif
}
-void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
- bool includeNamesWithPlatform) const
+void cmake::GetRegisteredGenerators(
+ std::vector<GeneratorInfo>& generators) const
{
- for (const auto& gen : this->Generators) {
+ for (auto const& gen : this->Generators) {
std::vector<std::string> names = gen->GetGeneratorNames();
- if (includeNamesWithPlatform) {
- cm::append(names, gen->GetGeneratorNamesWithPlatform());
- }
-
for (std::string const& name : names) {
GeneratorInfo info;
info.supportsToolset = gen->SupportsToolset();
@@ -1946,7 +1988,7 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
}
for (cmExternalMakefileProjectGeneratorFactory* eg : this->ExtraGenerators) {
- const std::vector<std::string> genList =
+ std::vector<std::string> const genList =
eg->GetSupportedGlobalGenerators();
for (std::string const& gen : genList) {
GeneratorInfo info;
@@ -1977,17 +2019,17 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
static std::pair<std::unique_ptr<cmExternalMakefileProjectGenerator>,
std::string>
createExtraGenerator(
- const std::vector<cmExternalMakefileProjectGeneratorFactory*>& in,
- const std::string& name)
+ std::vector<cmExternalMakefileProjectGeneratorFactory*> const& in,
+ std::string const& name)
{
for (cmExternalMakefileProjectGeneratorFactory* i : in) {
- const std::vector<std::string> generators =
+ std::vector<std::string> const generators =
i->GetSupportedGlobalGenerators();
if (i->GetName() == name) { // Match aliases
return { i->CreateExternalMakefileProjectGenerator(), generators.at(0) };
}
for (std::string const& g : generators) {
- const std::string fullName =
+ std::string const fullName =
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
g, i->GetName());
if (fullName == name) {
@@ -1999,17 +2041,17 @@ createExtraGenerator(
}
std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
- const std::string& gname, bool allowArch)
+ std::string const& gname)
{
std::pair<std::unique_ptr<cmExternalMakefileProjectGenerator>, std::string>
extra = createExtraGenerator(this->ExtraGenerators, gname);
std::unique_ptr<cmExternalMakefileProjectGenerator>& extraGenerator =
extra.first;
- const std::string& name = extra.second;
+ std::string const& name = extra.second;
std::unique_ptr<cmGlobalGenerator> generator;
- for (const auto& g : this->Generators) {
- generator = g->CreateGlobalGenerator(name, allowArch, this);
+ for (auto const& g : this->Generators) {
+ generator = g->CreateGlobalGenerator(name, this);
if (generator) {
break;
}
@@ -2022,17 +2064,16 @@ std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
return generator;
}
-bool cmake::CreateAndSetGlobalGenerator(const std::string& name,
- bool allowArch)
+bool cmake::CreateAndSetGlobalGenerator(std::string const& name)
{
- auto gen = this->CreateGlobalGenerator(name, allowArch);
+ auto gen = this->CreateGlobalGenerator(name);
if (!gen) {
std::string kdevError;
std::string vsError;
if (name.find("KDevelop3", 0) != std::string::npos) {
kdevError = "\nThe KDevelop3 generator is not supported anymore.";
}
- if (!allowArch && cmHasLiteralPrefix(name, "Visual Studio ") &&
+ if (cmHasLiteralPrefix(name, "Visual Studio ") &&
name.length() >= cmStrLen("Visual Studio xx xxxx ")) {
vsError = "\nUsing platforms in Visual Studio generator names is not "
"supported in CMakePresets.json.";
@@ -2049,16 +2090,16 @@ bool cmake::CreateAndSetGlobalGenerator(const std::string& name,
}
#ifndef CMAKE_BOOTSTRAP
-void cmake::PrintPresetList(const cmCMakePresetsGraph& graph) const
+void cmake::PrintPresetList(cmCMakePresetsGraph const& graph) const
{
std::vector<GeneratorInfo> generators;
- this->GetRegisteredGenerators(generators, false);
+ this->GetRegisteredGenerators(generators);
auto filter =
- [&generators](const cmCMakePresetsGraph::ConfigurePreset& preset) -> bool {
+ [&generators](cmCMakePresetsGraph::ConfigurePreset const& preset) -> bool {
if (preset.Generator.empty()) {
return true;
}
- auto condition = [&preset](const GeneratorInfo& info) -> bool {
+ auto condition = [&preset](GeneratorInfo const& info) -> bool {
return info.name == preset.Generator;
};
auto it = std::find_if(generators.begin(), generators.end(), condition);
@@ -2085,7 +2126,7 @@ void cmake::SetHomeDirectoryViaCommandLine(std::string const& path)
this->SetHomeDirectory(path);
}
-void cmake::SetHomeDirectory(const std::string& dir)
+void cmake::SetHomeDirectory(std::string const& dir)
{
this->State->SetSourceDirectory(dir);
if (this->CurrentSnapshot.IsValid()) {
@@ -2104,7 +2145,7 @@ std::string const& cmake::GetHomeDirectory() const
return this->State->GetSourceDirectory();
}
-void cmake::SetHomeOutputDirectory(const std::string& dir)
+void cmake::SetHomeOutputDirectory(std::string const& dir)
{
this->State->SetBinaryDirectory(dir);
if (this->CurrentSnapshot.IsValid()) {
@@ -2117,7 +2158,7 @@ std::string const& cmake::GetHomeOutputDirectory() const
return this->State->GetBinaryDirectory();
}
-std::string cmake::FindCacheFile(const std::string& binaryDir)
+std::string cmake::FindCacheFile(std::string const& binaryDir)
{
std::string cachePath = binaryDir;
cmSystemTools::ConvertToUnixSlashes(cachePath);
@@ -2180,12 +2221,13 @@ void cmake::SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator> gg)
int cmake::DoPreConfigureChecks()
{
// Make sure the Source directory contains a CMakeLists.txt file.
- std::string srcList = cmStrCat(this->GetHomeDirectory(), "/CMakeLists.txt");
+ std::string srcList =
+ cmStrCat(this->GetHomeDirectory(), "/", this->CMakeListName);
if (!cmSystemTools::FileExists(srcList)) {
std::ostringstream err;
if (cmSystemTools::FileIsDirectory(this->GetHomeDirectory())) {
err << "The source directory \"" << this->GetHomeDirectory()
- << "\" does not appear to contain CMakeLists.txt.\n";
+ << "\" does not appear to contain " << this->CMakeListName << ".\n";
} else if (cmSystemTools::FileExists(this->GetHomeDirectory())) {
err << "The source directory \"" << this->GetHomeDirectory()
<< "\" is a file, not a directory.\n";
@@ -2203,7 +2245,7 @@ int cmake::DoPreConfigureChecks()
if (this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) {
std::string cacheStart =
cmStrCat(*this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"),
- "/CMakeLists.txt");
+ "/", this->CMakeListName);
if (!cmSystemTools::SameFile(cacheStart, srcList)) {
std::string message =
cmStrCat("The source \"", srcList, "\" does not match the source \"",
@@ -2226,7 +2268,7 @@ struct SaveCacheEntry
cmStateEnums::CacheEntryType type;
};
-int cmake::HandleDeleteCacheVariables(const std::string& var)
+int cmake::HandleDeleteCacheVariables(std::string const& var)
{
cmList argsSplit{ var, cmList::EmptyElements::Yes };
// erase the property to avoid infinite recursion
@@ -2373,12 +2415,38 @@ int cmake::Configure()
int cmake::ActualConfigure()
{
// Construct right now our path conversion table before it's too late:
- this->UpdateConversionPathTable();
this->CleanupCommandsAndMacros();
cmSystemTools::RemoveADirectory(this->GetHomeOutputDirectory() +
"/CMakeFiles/CMakeScratch");
+ std::string cmlNameCache =
+ this->State->GetInitializedCacheValue("CMAKE_LIST_FILE_NAME");
+ if (!cmlNameCache.empty() && !this->CMakeListName.empty() &&
+ cmlNameCache != this->CMakeListName) {
+ std::string message =
+ cmStrCat("CMakeLists filename : \"", this->CMakeListName,
+ "\"\nDoes not match the previous: \"", cmlNameCache,
+ "\"\nEither remove the CMakeCache.txt file and CMakeFiles "
+ "directory or choose a different binary directory.");
+ cmSystemTools::Error(message);
+ return -2;
+ }
+ if (this->CMakeListName.empty()) {
+ this->CMakeListName =
+ cmlNameCache.empty() ? "CMakeLists.txt" : cmlNameCache;
+ }
+ if (this->CMakeListName != "CMakeLists.txt") {
+ this->IssueMessage(
+ MessageType::WARNING,
+ "This project has been configured with a project file other than "
+ "CMakeLists.txt. This feature is intended for temporary use during "
+ "development and not for publication of a final product.");
+ }
+ this->AddCacheEntry("CMAKE_LIST_FILE_NAME", this->CMakeListName,
+ "Name of CMakeLists files to read",
+ cmStateEnums::INTERNAL);
+
int res = this->DoPreConfigureChecks();
if (res < 0) {
return -2;
@@ -2394,7 +2462,7 @@ int cmake::ActualConfigure()
// We want to create the package redirects directory as early as possible,
// but not before pre-configure checks have passed. This ensures we get
// errors about inappropriate source/binary directories first.
- const auto redirectsDir =
+ auto const redirectsDir =
cmStrCat(this->GetHomeOutputDirectory(), "/CMakeFiles/pkgRedirects");
cmSystemTools::RemoveADirectory(redirectsDir);
if (!cmSystemTools::MakeDirectory(redirectsDir)) {
@@ -2552,19 +2620,45 @@ int cmake::ActualConfigure()
this->FileAPI = cm::make_unique<cmFileAPI>(this);
this->FileAPI->ReadQueries();
+ this->Instrumentation = cm::make_unique<cmInstrumentation>(
+ this->State->GetBinaryDirectory(),
+ cmInstrumentation::LoadQueriesAfter::No);
+ this->Instrumentation->ClearGeneratedQueries();
+
if (!this->GetIsInTryCompile()) {
this->TruncateOutputLog("CMakeConfigureLog.yaml");
this->ConfigureLog = cm::make_unique<cmConfigureLog>(
cmStrCat(this->GetHomeOutputDirectory(), "/CMakeFiles"_s),
this->FileAPI->GetConfigureLogVersions());
+ this->Instrumentation->LoadQueries();
}
#endif
// actually do the configure
auto startTime = std::chrono::steady_clock::now();
+#if !defined(CMAKE_BOOTSTRAP)
+ if (!this->Instrumentation->errorMsg.empty()) {
+ cmSystemTools::Error(this->Instrumentation->errorMsg);
+ return 1;
+ }
+ auto doConfigure = [this]() -> int {
+ this->GlobalGenerator->Configure();
+ return 0;
+ };
+ int ret = this->Instrumentation->InstrumentCommand(
+ "configure", this->cmdArgs, [doConfigure]() { return doConfigure(); },
+ cm::nullopt, cm::nullopt,
+ this->GetIsInTryCompile() ? cmInstrumentation::LoadQueriesAfter::No
+ : cmInstrumentation::LoadQueriesAfter::Yes);
+ if (ret != 0) {
+ return ret;
+ }
+#else
this->GlobalGenerator->Configure();
+#endif
auto endTime = std::chrono::steady_clock::now();
+ // configure result
if (this->GetWorkingMode() == cmake::NORMAL_MODE) {
std::ostringstream msg;
if (cmSystemTools::GetErrorOccurredFlag()) {
@@ -2586,36 +2680,48 @@ int cmake::ActualConfigure()
// if the project did not define one of the entries below, add them now
// so users can edit the values in the cache:
- // We used to always present LIBRARY_OUTPUT_PATH and
- // EXECUTABLE_OUTPUT_PATH. They are now documented as old-style and
- // should no longer be used. Therefore we present them only if the
- // project requires compatibility with CMake 2.4. We detect this
- // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
- // variable created when CMP0001 is not set to NEW.
- if (this->State->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) {
- if (!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) {
- this->AddCacheEntry(
- "LIBRARY_OUTPUT_PATH", "",
- "Single output directory for building all libraries.",
- cmStateEnums::PATH);
- }
- if (!this->State->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) {
- this->AddCacheEntry(
- "EXECUTABLE_OUTPUT_PATH", "",
- "Single output directory for building all executables.",
- cmStateEnums::PATH);
- }
- }
+ auto const& mf = this->GlobalGenerator->GetMakefiles()[0];
- const auto& mf = this->GlobalGenerator->GetMakefiles()[0];
if (mf->IsOn("CTEST_USE_LAUNCHERS") &&
!this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) {
- cmSystemTools::Error(
- "CTEST_USE_LAUNCHERS is enabled, but the "
- "RULE_LAUNCH_COMPILE global property is not defined.\n"
- "Did you forget to include(CTest) in the toplevel "
- "CMakeLists.txt ?");
+ this->IssueMessage(MessageType::FATAL_ERROR,
+ "CTEST_USE_LAUNCHERS is enabled, but the "
+ "RULE_LAUNCH_COMPILE global property is not defined.\n"
+ "Did you forget to include(CTest) in the toplevel "
+ "CMakeLists.txt ?");
}
+ // Setup launchers for instrumentation
+#if !defined(CMAKE_BOOTSTRAP)
+ if (this->Instrumentation->HasQuery()) {
+ std::string launcher;
+ if (mf->IsOn("CTEST_USE_LAUNCHERS")) {
+ launcher =
+ cmStrCat("\"", cmSystemTools::GetCTestCommand(), "\" --launch ",
+ "--current-build-dir <CMAKE_CURRENT_BINARY_DIR> ");
+ } else {
+ launcher =
+ cmStrCat("\"", cmSystemTools::GetCTestCommand(), "\" --instrument ");
+ }
+ std::string common_args =
+ cmStrCat(" --target-name <TARGET_NAME> --build-dir \"",
+ this->State->GetBinaryDirectory(), "\" ");
+ this->State->SetGlobalProperty(
+ "RULE_LAUNCH_COMPILE",
+ cmStrCat(
+ launcher, "--command-type compile", common_args, "--config <CONFIG> ",
+ "--output <OBJECT> --source <SOURCE> --language <LANGUAGE> -- "));
+ this->State->SetGlobalProperty(
+ "RULE_LAUNCH_LINK",
+ cmStrCat(
+ launcher, "--command-type link", common_args,
+ "--output <TARGET> --target-type <TARGET_TYPE> --config <CONFIG> ",
+ "--language <LANGUAGE> --target-labels \"<TARGET_LABELS>\" -- "));
+ this->State->SetGlobalProperty(
+ "RULE_LAUNCH_CUSTOM",
+ cmStrCat(launcher, "--command-type custom", common_args,
+ "--output \"<OUTPUT>\" --role <ROLE> -- "));
+ }
+#endif
this->State->SaveVerificationScript(this->GetHomeOutputDirectory(),
this->Messenger.get());
@@ -2641,20 +2747,20 @@ std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator()
std::string found;
// Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified
- const std::string vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
- static const char* const vsVariants[] = {
+ std::string const vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
+ static char const* const vsVariants[] = {
/* clang-format needs this comment to break after the opening brace */
"VisualStudio\\", "VCExpress\\", "WDExpress\\"
};
struct VSVersionedGenerator
{
- const char* MSVersion;
- const char* GeneratorName;
+ char const* MSVersion;
+ char const* GeneratorName;
};
static VSVersionedGenerator const vsGenerators[] = {
{ "14.0", "Visual Studio 14 2015" }, //
};
- static const char* const vsEntries[] = {
+ static char const* const vsEntries[] = {
"\\Setup\\VC;ProductDir", //
";InstallDir" //
};
@@ -2667,9 +2773,9 @@ std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator()
} else {
for (VSVersionedGenerator const* g = cm::cbegin(vsGenerators);
found.empty() && g != cm::cend(vsGenerators); ++g) {
- for (const char* const* v = cm::cbegin(vsVariants);
+ for (char const* const* v = cm::cbegin(vsVariants);
found.empty() && v != cm::cend(vsVariants); ++v) {
- for (const char* const* e = cm::cbegin(vsEntries);
+ for (char const* const* e = cm::cbegin(vsEntries);
found.empty() && e != cm::cend(vsEntries); ++e) {
std::string const reg = vsregBase + *v + g->MSVersion + *e;
std::string dir;
@@ -2745,7 +2851,7 @@ bool cmake::StartDebuggerIfEnabled()
std::make_shared<cmDebugger::cmDebuggerPipeConnection>(
this->GetDebuggerPipe()),
this->GetDebuggerDapLogFile());
- } catch (const std::runtime_error& error) {
+ } catch (std::runtime_error const& error) {
std::cerr << "Error: Failed to create debugger adapter.\n";
std::cerr << error.what() << "\n";
return false;
@@ -2772,7 +2878,7 @@ void cmake::StopDebuggerIfNeeded(int exitCode)
#endif
// handle a command line invocation
-int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
+int cmake::Run(std::vector<std::string> const& args, bool noconfigure)
{
// Process the arguments
this->SetArgs(args);
@@ -2783,6 +2889,15 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
return 0;
}
+#ifndef CMAKE_BOOTSTRAP
+ // Configure the SARIF log for the current run
+ cmSarif::LogFileWriter sarifLogFileWriter(
+ this->GetMessenger()->GetSarifResultsLog());
+ if (!sarifLogFileWriter.ConfigureForCMakeRun(*this)) {
+ return -1;
+ }
+#endif
+
// Log the trace format version to the desired output
if (this->GetTrace()) {
this->PrintTraceFormatVersion();
@@ -2809,6 +2924,17 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
cmSystemTools::Error("Error executing cmake::LoadCache(). Aborting.\n");
return -1;
}
+#ifndef CMAKE_BOOTSTRAP
+ // If no SARIF file has been explicitly specified, use the default path
+ if (!this->SarifFileOutput) {
+ // If no output file is specified, use the default path
+ // Enable parent directory creation for the default path
+ sarifLogFileWriter.SetPath(
+ cm::filesystem::path(this->GetHomeOutputDirectory()) /
+ std::string(cmSarif::PROJECT_DEFAULT_SARIF_FILE),
+ true);
+ }
+#endif
} else {
if (this->FreshCache) {
cmSystemTools::Error("--fresh allowed only when configuring a project");
@@ -2827,8 +2953,12 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
return -1;
}
#ifndef CMAKE_BOOTSTRAP
- this->PrintPresetVariables();
- this->PrintPresetEnvironment();
+ if (this->GetLogLevel() == Message::LogLevel::LOG_VERBOSE ||
+ this->GetLogLevel() == Message::LogLevel::LOG_DEBUG ||
+ this->GetLogLevel() == Message::LogLevel::LOG_TRACE) {
+ this->PrintPresetVariables();
+ this->PrintPresetEnvironment();
+ }
#endif
// In script mode we terminate after running the script.
@@ -2839,6 +2969,11 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
return this->HasScriptModeExitCode() ? this->GetScriptModeExitCode() : 0;
}
+#ifndef CMAKE_BOOTSTRAP
+ // CMake only responds to the SARIF variable in normal mode
+ this->MarkCliAsUsed(cmSarif::PROJECT_SARIF_FILE_VARIABLE);
+#endif
+
// If MAKEFLAGS are given in the environment, remove the environment
// variable. This will prevent try-compile from succeeding when it
// should fail (if "-i" is an option). We cannot simply test
@@ -2903,15 +3038,28 @@ int cmake::Generate()
return -1;
}
+ auto startTime = std::chrono::steady_clock::now();
#if !defined(CMAKE_BOOTSTRAP)
auto profilingRAII = this->CreateProfilingEntry("project", "generate");
-#endif
+ auto doGenerate = [this]() -> int {
+ if (!this->GlobalGenerator->Compute()) {
+ return -1;
+ }
+ this->GlobalGenerator->Generate();
+ return 0;
+ };
- auto startTime = std::chrono::steady_clock::now();
+ int ret = this->Instrumentation->InstrumentCommand(
+ "generate", this->cmdArgs, [doGenerate]() { return doGenerate(); });
+ if (ret != 0) {
+ return ret;
+ }
+#else
if (!this->GlobalGenerator->Compute()) {
return -1;
}
this->GlobalGenerator->Generate();
+#endif
auto endTime = std::chrono::steady_clock::now();
{
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(endTime -
@@ -2921,6 +3069,10 @@ int cmake::Generate()
<< ms.count() / 1000.0L << "s)";
this->UpdateProgress(msg.str(), -1);
}
+#if !defined(CMAKE_BOOTSTRAP)
+ this->Instrumentation->CollectTimingData(
+ cmInstrumentationQuery::Hook::PostGenerate);
+#endif
if (!this->GraphVizFile.empty()) {
std::cout << "Generate graphviz: " << this->GraphVizFile << '\n';
this->GenerateGraphViz(this->GraphVizFile);
@@ -2937,14 +3089,14 @@ int cmake::Generate()
this->SaveCache(this->GetHomeOutputDirectory());
#if !defined(CMAKE_BOOTSTRAP)
- this->GetGlobalGenerator()->WriteInstallJson();
+ this->GlobalGenerator->WriteInstallJson();
this->FileAPI->WriteReplies();
#endif
return 0;
}
-void cmake::AddCacheEntry(const std::string& key, cmValue value,
+void cmake::AddCacheEntry(std::string const& key, cmValue value,
cmValue helpString, int type)
{
this->State->AddCacheEntry(key, value, helpString,
@@ -2977,8 +3129,8 @@ std::string const& cmake::GetGlobVerifyStamp() const
return this->State->GetGlobVerifyStamp();
}
-void cmake::AddGlobCacheEntry(const cmGlobCacheEntry& entry,
- const std::string& variable,
+void cmake::AddGlobCacheEntry(cmGlobCacheEntry const& entry,
+ std::string const& variable,
cmListFileBacktrace const& backtrace)
{
this->State->AddGlobCacheEntry(entry, variable, backtrace,
@@ -3005,7 +3157,7 @@ std::vector<std::string> cmake::GetAllExtensions() const
return allExt;
}
-std::string cmake::StripExtension(const std::string& file) const
+std::string cmake::StripExtension(std::string const& file) const
{
auto dotpos = file.rfind('.');
if (dotpos != std::string::npos) {
@@ -3021,7 +3173,7 @@ std::string cmake::StripExtension(const std::string& file) const
return file;
}
-cmValue cmake::GetCacheDefinition(const std::string& name) const
+cmValue cmake::GetCacheDefinition(std::string const& name) const
{
return this->State->GetInitializedCacheValue(name);
}
@@ -3074,7 +3226,7 @@ void cmake::AddDefaultGenerators()
#endif
}
-bool cmake::ParseCacheEntry(const std::string& entry, std::string& var,
+bool cmake::ParseCacheEntry(std::string const& entry, std::string& var,
std::string& value,
cmStateEnums::CacheEntryType& type)
{
@@ -3104,18 +3256,18 @@ int cmake::LoadCache()
return 0;
}
-bool cmake::LoadCache(const std::string& path)
+bool cmake::LoadCache(std::string const& path)
{
std::set<std::string> emptySet;
return this->LoadCache(path, true, emptySet, emptySet);
}
-bool cmake::LoadCache(const std::string& path, bool internal,
+bool cmake::LoadCache(std::string const& path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes)
{
bool result = this->State->LoadCache(path, internal, excludes, includes);
- static const auto entries = { "CMAKE_CACHE_MAJOR_VERSION",
+ static auto const entries = { "CMAKE_CACHE_MAJOR_VERSION",
"CMAKE_CACHE_MINOR_VERSION" };
for (auto const& entry : entries) {
this->UnwatchUnusedCli(entry);
@@ -3123,10 +3275,10 @@ bool cmake::LoadCache(const std::string& path, bool internal,
return result;
}
-bool cmake::SaveCache(const std::string& path)
+bool cmake::SaveCache(std::string const& path)
{
bool result = this->State->SaveCache(path, this->GetMessenger());
- static const auto entries = { "CMAKE_CACHE_MAJOR_VERSION",
+ static auto const entries = { "CMAKE_CACHE_MAJOR_VERSION",
"CMAKE_CACHE_MINOR_VERSION",
"CMAKE_CACHE_PATCH_VERSION",
"CMAKE_CACHEFILE_DIR" };
@@ -3136,7 +3288,7 @@ bool cmake::SaveCache(const std::string& path)
return result;
}
-bool cmake::DeleteCache(const std::string& path)
+bool cmake::DeleteCache(std::string const& path)
{
return this->State->DeleteCache(path);
}
@@ -3146,7 +3298,7 @@ void cmake::SetProgressCallback(ProgressCallbackType f)
this->ProgressCallback = std::move(f);
}
-void cmake::UpdateProgress(const std::string& msg, float prog)
+void cmake::UpdateProgress(std::string const& msg, float prog)
{
if (this->ProgressCallback && !this->GetIsInTryCompile()) {
this->ProgressCallback(msg, prog);
@@ -3161,11 +3313,11 @@ bool cmake::GetIsInTryCompile() const
void cmake::AppendGlobalGeneratorsDocumentation(
std::vector<cmDocumentationEntry>& v)
{
- const auto defaultGenerator = this->EvaluateDefaultGlobalGenerator();
- const auto defaultName = defaultGenerator->GetName();
+ auto const defaultGenerator = this->EvaluateDefaultGlobalGenerator();
+ auto const defaultName = defaultGenerator->GetName();
auto foundDefaultOne = false;
- for (const auto& g : this->Generators) {
+ for (auto const& g : this->Generators) {
v.emplace_back(g->GetDocumentation());
if (!foundDefaultOne && cmHasPrefix(v.back().Name, defaultName)) {
v.back().CustomNamePrefix = '*';
@@ -3178,8 +3330,8 @@ void cmake::AppendExtraGeneratorsDocumentation(
std::vector<cmDocumentationEntry>& v)
{
for (cmExternalMakefileProjectGeneratorFactory* eg : this->ExtraGenerators) {
- const std::string doc = eg->GetDocumentation();
- const std::string name = eg->GetName();
+ std::string const doc = eg->GetDocumentation();
+ std::string const name = eg->GetName();
// Aliases:
for (std::string const& a : eg->Aliases) {
@@ -3214,35 +3366,10 @@ void cmake::PrintGeneratorList()
#endif
}
-void cmake::UpdateConversionPathTable()
-{
- // Update the path conversion table with any specified file:
- cmValue tablepath =
- this->State->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
-
- if (tablepath) {
- cmsys::ifstream table(tablepath->c_str());
- if (!table) {
- cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to " + *tablepath +
- ". CMake can not open file.");
- cmSystemTools::ReportLastSystemError("CMake can not open file.");
- } else {
- std::string a;
- std::string b;
- while (!table.eof()) {
- // two entries per line
- table >> a;
- table >> b;
- cmSystemTools::AddTranslationPath(a, b);
- }
- }
- }
-}
-
int cmake::CheckBuildSystem()
{
// We do not need to rerun CMake. Check dependency integrity.
- const bool verbose = isCMakeVerbose();
+ bool const verbose = isCMakeVerbose();
// This method will check the integrity of the build system if the
// option was given on the command line. It reads the given file to
@@ -3388,7 +3515,7 @@ int cmake::CheckBuildSystem()
return 0;
}
-void cmake::TruncateOutputLog(const char* fname)
+void cmake::TruncateOutputLog(char const* fname)
{
std::string fullPath = cmStrCat(this->GetHomeOutputDirectory(), '/', fname);
struct stat st;
@@ -3400,19 +3527,19 @@ void cmake::TruncateOutputLog(const char* fname)
return;
}
off_t fsize = st.st_size;
- const off_t maxFileSize = 50 * 1024;
+ off_t const maxFileSize = 50 * 1024;
if (fsize < maxFileSize) {
// TODO: truncate file
return;
}
}
-void cmake::MarkCliAsUsed(const std::string& variable)
+void cmake::MarkCliAsUsed(std::string const& variable)
{
this->UsedCliVariables[variable] = true;
}
-void cmake::GenerateGraphViz(const std::string& fileName) const
+void cmake::GenerateGraphViz(std::string const& fileName) const
{
#ifndef CMAKE_BOOTSTRAP
cmGraphVizWriter gvWriter(fileName, this->GetGlobalGenerator());
@@ -3429,29 +3556,29 @@ void cmake::GenerateGraphViz(const std::string& fileName) const
#endif
}
-void cmake::SetProperty(const std::string& prop, cmValue value)
+void cmake::SetProperty(std::string const& prop, cmValue value)
{
this->State->SetGlobalProperty(prop, value);
}
-void cmake::AppendProperty(const std::string& prop, const std::string& value,
+void cmake::AppendProperty(std::string const& prop, std::string const& value,
bool asString)
{
this->State->AppendGlobalProperty(prop, value, asString);
}
-cmValue cmake::GetProperty(const std::string& prop)
+cmValue cmake::GetProperty(std::string const& prop)
{
return this->State->GetGlobalProperty(prop);
}
-bool cmake::GetPropertyAsBool(const std::string& prop)
+bool cmake::GetPropertyAsBool(std::string const& prop)
{
return this->State->GetGlobalPropertyAsBool(prop);
}
cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
- const std::string& name)
+ std::string const& name)
{
auto i = this->InstalledFiles.find(name);
@@ -3464,7 +3591,7 @@ cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
return &file;
}
-cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
+cmInstalledFile const* cmake::GetInstalledFile(std::string const& name) const
{
auto i = this->InstalledFiles.find(name);
@@ -3479,7 +3606,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
{
// so create the directory
std::string resultFile;
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmSystemTools::GetLogicalWorkingDirectory();
std::string destPath = cwd + "/__cmake_systeminformation";
cmSystemTools::RemoveADirectory(destPath);
if (!cmSystemTools::MakeDirectory(destPath)) {
@@ -3548,8 +3675,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// file to it, so we wouldn't expect to get here unless the default
// permissions are questionable or some other process has deleted the
// directory
- std::cerr << "Failed to change to directory " << destPath << " : "
- << std::strerror(workdir.GetLastResult()) << '\n';
+ std::cerr << workdir.GetError() << '\n';
return 1;
}
std::vector<std::string> args2;
@@ -3568,7 +3694,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
if (writeToStdout) {
FILE* fin = cmsys::SystemTools::Fopen(resultFile, "r");
if (fin) {
- const int bufferSize = 4096;
+ int const bufferSize = 4096;
char buffer[bufferSize];
size_t n;
while ((n = fread(buffer, 1, bufferSize, fin)) > 0) {
@@ -3611,15 +3737,16 @@ std::vector<std::string> cmake::GetDebugConfigs()
int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
std::string config, std::vector<std::string> nativeOptions,
cmBuildOptions& buildOptions, bool verbose,
- const std::string& presetName, bool listPresets)
+ std::string const& presetName, bool listPresets,
+ std::vector<std::string> const& args)
{
this->SetHomeDirectory("");
this->SetHomeOutputDirectory("");
#if !defined(CMAKE_BOOTSTRAP)
if (!presetName.empty() || listPresets) {
- this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ this->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
+ this->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
cmCMakePresetsGraph settingsFile;
auto result = settingsFile.ReadProjectPresets(this->GetHomeDirectory());
@@ -3849,21 +3976,43 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
return 1;
}
+#if !defined(CMAKE_BOOTSTRAP)
+ cmInstrumentation instrumentation(dir);
+ if (!instrumentation.errorMsg.empty()) {
+ cmSystemTools::Error(instrumentation.errorMsg);
+ return 1;
+ }
+ instrumentation.CollectTimingData(
+ cmInstrumentationQuery::Hook::PreCMakeBuild);
+#endif
+
this->GlobalGenerator->PrintBuildCommandAdvice(std::cerr, jobs);
std::stringstream ostr;
// `cmGlobalGenerator::Build` logs metadata about what directory and commands
// are being executed to the `output` parameter. If CMake is verbose, print
// this out.
std::ostream& verbose_ostr = verbose ? std::cout : ostr;
- int buildresult = this->GlobalGenerator->Build(
- jobs, "", dir, projName, targets, verbose_ostr, "", config, buildOptions,
- verbose, cmDuration::zero(), cmSystemTools::OUTPUT_PASSTHROUGH,
- nativeOptions);
+ auto doBuild = [this, jobs, dir, projName, targets, &verbose_ostr, config,
+ buildOptions, verbose, nativeOptions]() -> int {
+ return this->GlobalGenerator->Build(
+ jobs, "", dir, projName, targets, verbose_ostr, "", config, buildOptions,
+ verbose, cmDuration::zero(), cmSystemTools::OUTPUT_PASSTHROUGH,
+ nativeOptions);
+ };
+
+#if !defined(CMAKE_BOOTSTRAP)
+ int buildresult =
+ instrumentation.InstrumentCommand("cmakeBuild", args, doBuild);
+ instrumentation.CollectTimingData(
+ cmInstrumentationQuery::Hook::PostCMakeBuild);
+#else
+ int buildresult = doBuild();
+#endif
return buildresult;
}
-bool cmake::Open(const std::string& dir, bool dryRun)
+bool cmake::Open(std::string const& dir, bool dryRun)
{
this->SetHomeDirectory("");
this->SetHomeOutputDirectory("");
@@ -3908,10 +4057,10 @@ bool cmake::Open(const std::string& dir, bool dryRun)
#if !defined(CMAKE_BOOTSTRAP)
template <typename T>
-const T* cmake::FindPresetForWorkflow(
+T const* cmake::FindPresetForWorkflow(
cm::static_string_view type,
- const std::map<std::string, cmCMakePresetsGraph::PresetPair<T>>& presets,
- const cmCMakePresetsGraph::WorkflowPreset::WorkflowStep& step)
+ std::map<std::string, cmCMakePresetsGraph::PresetPair<T>> const& presets,
+ cmCMakePresetsGraph::WorkflowPreset::WorkflowStep const& step)
{
auto it = presets.find(step.PresetName);
if (it == presets.end()) {
@@ -3946,7 +4095,7 @@ const T* cmake::FindPresetForWorkflow(
}
std::function<int()> cmake::BuildWorkflowStep(
- const std::vector<std::string>& args)
+ std::vector<std::string> const& args)
{
cmUVProcessChainBuilder builder;
builder.AddCommand(args)
@@ -3960,12 +4109,12 @@ std::function<int()> cmake::BuildWorkflowStep(
}
#endif
-int cmake::Workflow(const std::string& presetName,
+int cmake::Workflow(std::string const& presetName,
WorkflowListPresets listPresets, WorkflowFresh fresh)
{
#ifndef CMAKE_BOOTSTRAP
- this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ this->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
+ this->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
cmCMakePresetsGraph settingsFile;
auto result = settingsFile.ReadProjectPresets(this->GetHomeDirectory());
@@ -4108,7 +4257,7 @@ int cmake::Workflow(const std::string& presetName,
return 0;
}
-void cmake::WatchUnusedCli(const std::string& var)
+void cmake::WatchUnusedCli(std::string const& var)
{
#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
@@ -4118,7 +4267,7 @@ void cmake::WatchUnusedCli(const std::string& var)
#endif
}
-void cmake::UnwatchUnusedCli(const std::string& var)
+void cmake::UnwatchUnusedCli(std::string const& var)
{
#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning);
@@ -4260,6 +4409,21 @@ bool cmake::GetDebugFindPkgOutput(std::string const& pkg) const
return this->DebugFindPkgs.count(pkg);
}
+void cmake::SetCMakeListName(std::string const& name)
+{
+ this->CMakeListName = name;
+}
+
+std::string cmake::GetCMakeListFile(std::string const& dir) const
+{
+ std::string listFile = cmStrCat(dir, '/', this->CMakeListName);
+ if (this->CMakeListName.empty() ||
+ !cmSystemTools::FileExists(listFile, true)) {
+ return cmStrCat(dir, "/CMakeLists.txt");
+ }
+ return listFile;
+}
+
#if !defined(CMAKE_BOOTSTRAP)
cmMakefileProfilingData& cmake::GetProfilingOutput()
{
diff --git a/Source/cmake.h b/Source/cmake.h
index cfe4edd..f128a46 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,10 +26,11 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
-#include "cmSystemTools.h"
#include "cmValue.h"
#if !defined(CMAKE_BOOTSTRAP)
+# include <type_traits>
+
# include <cm/optional>
# include <cm3p/json/value.h>
@@ -48,6 +49,7 @@ class cmDebuggerAdapter;
class cmExternalMakefileProjectGeneratorFactory;
class cmFileAPI;
+class cmInstrumentation;
class cmFileTimeCache;
class cmGlobalGenerator;
class cmMakefile;
@@ -154,8 +156,8 @@ public:
using InstalledFilesMap = std::map<std::string, cmInstalledFile>;
- static const int NO_BUILD_PARALLEL_LEVEL = -1;
- static const int DEFAULT_BUILD_PARALLEL_LEVEL = 0;
+ static int const NO_BUILD_PARALLEL_LEVEL = -1;
+ static int const DEFAULT_BUILD_PARALLEL_LEVEL = 0;
/// Default constructor
cmake(Role role, cmState::Mode mode,
@@ -194,9 +196,9 @@ public:
* home directory is the top directory of the project. It is the
* path-to-source cmake was run with.
*/
- void SetHomeDirectory(const std::string& dir);
+ void SetHomeDirectory(std::string const& dir);
std::string const& GetHomeDirectory() const;
- void SetHomeOutputDirectory(const std::string& dir);
+ void SetHomeOutputDirectory(std::string const& dir);
std::string const& GetHomeOutputDirectory() const;
//@}
@@ -211,11 +213,11 @@ public:
/**
* Handle a command line invocation of cmake.
*/
- int Run(const std::vector<std::string>& args)
+ int Run(std::vector<std::string> const& args)
{
return this->Run(args, false);
}
- int Run(const std::vector<std::string>& args, bool noconfigure);
+ int Run(std::vector<std::string> const& args, bool noconfigure);
/**
* Run the global generator Generate step.
@@ -232,29 +234,29 @@ public:
int ActualConfigure();
//! Break up a line like VAR:type="value" into var, type and value
- static bool ParseCacheEntry(const std::string& entry, std::string& var,
+ static bool ParseCacheEntry(std::string const& entry, std::string& var,
std::string& value,
cmStateEnums::CacheEntryType& type);
int LoadCache();
- bool LoadCache(const std::string& path);
- bool LoadCache(const std::string& path, bool internal,
+ bool LoadCache(std::string const& path);
+ bool LoadCache(std::string const& path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes);
- bool SaveCache(const std::string& path);
- bool DeleteCache(const std::string& path);
+ bool SaveCache(std::string const& path);
+ bool DeleteCache(std::string const& path);
void PreLoadCMakeFiles();
//! Create a GlobalGenerator
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool allowArch = true);
+ std::string const& name);
//! Create a GlobalGenerator and set it as our own
- bool CreateAndSetGlobalGenerator(const std::string& name, bool allowArch);
+ bool CreateAndSetGlobalGenerator(std::string const& name);
#ifndef CMAKE_BOOTSTRAP
//! Print list of configure presets
- void PrintPresetList(const cmCMakePresetsGraph& graph) const;
+ void PrintPresetList(cmCMakePresetsGraph const& graph) const;
#endif
//! Return the global generator assigned to this instance of cmake
@@ -263,20 +265,19 @@ public:
return this->GlobalGenerator.get();
}
//! Return the global generator assigned to this instance of cmake, const
- const cmGlobalGenerator* GetGlobalGenerator() const
+ cmGlobalGenerator const* GetGlobalGenerator() const
{
return this->GlobalGenerator.get();
}
//! Return the full path to where the CMakeCache.txt file should be.
- static std::string FindCacheFile(const std::string& binaryDir);
+ static std::string FindCacheFile(std::string const& binaryDir);
//! Return the global generator assigned to this instance of cmake
void SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator>);
//! Get the names of the current registered generators
- void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
- bool includeNamesWithPlatform = true) const;
+ void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) const;
//! Set the name of the selected generator-specific instance.
void SetGeneratorInstance(std::string const& instance)
@@ -300,12 +301,7 @@ public:
}
//! Set the name of the graphviz file.
- void SetGraphVizFile(std::string const& ts)
- {
- std::string path = cmSystemTools::CollapseFullPath(ts);
- cmSystemTools::ConvertToUnixSlashes(path);
- this->GraphVizFile = path;
- }
+ void SetGraphVizFile(std::string const& ts) { this->GraphVizFile = ts; }
bool IsAKnownSourceExtension(cm::string_view ext) const
{
@@ -327,7 +323,7 @@ public:
std::vector<std::string> GetAllExtensions() const;
- const std::vector<std::string>& GetHeaderExtensions() const
+ std::vector<std::string> const& GetHeaderExtensions() const
{
return this->HeaderFileExtensions.ordered;
}
@@ -338,31 +334,31 @@ public:
}
// Strips the extension (if present and known) from a filename
- std::string StripExtension(const std::string& file) const;
+ std::string StripExtension(std::string const& file) const;
/**
* Given a variable name, return its value (as a string).
*/
- cmValue GetCacheDefinition(const std::string&) const;
+ cmValue GetCacheDefinition(std::string const&) const;
//! Add an entry into the cache
- void AddCacheEntry(const std::string& key, const std::string& value,
- const std::string& helpString, int type)
+ void AddCacheEntry(std::string const& key, std::string const& value,
+ std::string const& helpString, int type)
{
this->AddCacheEntry(key, cmValue{ value }, cmValue{ helpString }, type);
}
- void AddCacheEntry(const std::string& key, cmValue value,
- const std::string& helpString, int type)
+ void AddCacheEntry(std::string const& key, cmValue value,
+ std::string const& helpString, int type)
{
this->AddCacheEntry(key, value, cmValue{ helpString }, type);
}
- void AddCacheEntry(const std::string& key, cmValue value, cmValue helpString,
+ void AddCacheEntry(std::string const& key, cmValue value, cmValue helpString,
int type);
bool DoWriteGlobVerifyTarget() const;
std::string const& GetGlobVerifyScript() const;
std::string const& GetGlobVerifyStamp() const;
- void AddGlobCacheEntry(const cmGlobCacheEntry& entry,
- const std::string& variable,
+ void AddGlobCacheEntry(cmGlobCacheEntry const& entry,
+ std::string const& variable,
cmListFileBacktrace const& bt);
std::vector<cmGlobCacheEntry> GetGlobCacheEntries() const;
@@ -375,15 +371,15 @@ public:
void LoadEnvironmentPresets();
//! Parse command line arguments
- void SetArgs(const std::vector<std::string>& args);
+ void SetArgs(std::vector<std::string> const& args);
//! Is this cmake running as a result of a TRY_COMPILE command
bool GetIsInTryCompile() const;
#ifndef CMAKE_BOOTSTRAP
- void SetWarningFromPreset(const std::string& name,
- const cm::optional<bool>& warning,
- const cm::optional<bool>& error);
+ void SetWarningFromPreset(std::string const& name,
+ cm::optional<bool> const& warning,
+ cm::optional<bool> const& error);
void ProcessPresetVariables();
void PrintPresetVariables();
void ProcessPresetEnvironment();
@@ -391,12 +387,12 @@ public:
#endif
//! Parse command line arguments that might set cache values
- bool SetCacheArgs(const std::vector<std::string>&);
+ bool SetCacheArgs(std::vector<std::string> const&);
- void ProcessCacheArg(const std::string& var, const std::string& value,
+ void ProcessCacheArg(std::string const& var, std::string const& value,
cmStateEnums::CacheEntryType type);
- using ProgressCallbackType = std::function<void(const std::string&, float)>;
+ using ProgressCallbackType = std::function<void(std::string const&, float)>;
/**
* Set the function used by GUIs to receive progress updates
* Function gets passed: message as a const char*, a progress
@@ -407,7 +403,7 @@ public:
void SetProgressCallback(ProgressCallbackType f);
//! this is called by generators to update the progress
- void UpdateProgress(const std::string& msg, float prog);
+ void UpdateProgress(std::string const& msg, float prog);
#if !defined(CMAKE_BOOTSTRAP)
//! Get the variable watch object
@@ -417,25 +413,25 @@ public:
std::vector<cmDocumentationEntry> GetGeneratorsDocumentation();
//! Set/Get a property of this target file
- void SetProperty(const std::string& prop, cmValue value);
- void SetProperty(const std::string& prop, std::nullptr_t)
+ void SetProperty(std::string const& prop, cmValue value);
+ void SetProperty(std::string const& prop, std::nullptr_t)
{
this->SetProperty(prop, cmValue{ nullptr });
}
- void SetProperty(const std::string& prop, const std::string& value)
+ void SetProperty(std::string const& prop, std::string const& value)
{
this->SetProperty(prop, cmValue(value));
}
- void AppendProperty(const std::string& prop, const std::string& value,
+ void AppendProperty(std::string const& prop, std::string const& value,
bool asString = false);
- cmValue GetProperty(const std::string& prop);
- bool GetPropertyAsBool(const std::string& prop);
+ cmValue GetProperty(std::string const& prop);
+ bool GetPropertyAsBool(std::string const& prop);
//! Get or create an cmInstalledFile instance and return a pointer to it
cmInstalledFile* GetOrCreateInstalledFile(cmMakefile* mf,
- const std::string& name);
+ std::string const& name);
- cmInstalledFile const* GetInstalledFile(const std::string& name) const;
+ cmInstalledFile const* GetInstalledFile(std::string const& name) const;
InstalledFilesMap const& GetInstalledFiles() const
{
@@ -469,7 +465,7 @@ public:
void SetLogLevel(Message::LogLevel level) { this->MessageLogLevel = level; }
static Message::LogLevel StringToLogLevel(cm::string_view levelStr);
static std::string LogLevelToString(Message::LogLevel level);
- static TraceFormat StringToTraceFormat(const std::string& levelStr);
+ static TraceFormat StringToTraceFormat(std::string const& levelStr);
bool HasCheckInProgress() const
{
@@ -548,10 +544,24 @@ public:
void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; }
bool GetCheckSystemVars() const { return this->CheckSystemVars; }
void SetCheckSystemVars(bool b) { this->CheckSystemVars = b; }
- bool GetIgnoreWarningAsError() const { return this->IgnoreWarningAsError; }
- void SetIgnoreWarningAsError(bool b) { this->IgnoreWarningAsError = b; }
+ bool GetIgnoreCompileWarningAsError() const
+ {
+ return this->IgnoreCompileWarningAsError;
+ }
+ void SetIgnoreCompileWarningAsError(bool b)
+ {
+ this->IgnoreCompileWarningAsError = b;
+ }
+ bool GetIgnoreLinkWarningAsError() const
+ {
+ return this->IgnoreLinkWarningAsError;
+ }
+ void SetIgnoreLinkWarningAsError(bool b)
+ {
+ this->IgnoreLinkWarningAsError = b;
+ }
- void MarkCliAsUsed(const std::string& variable);
+ void MarkCliAsUsed(std::string const& variable);
/** Get the list of configurations (in upper case) considered to be
debugging configurations.*/
@@ -568,6 +578,15 @@ public:
cmMessenger* GetMessenger() const { return this->Messenger.get(); }
+#ifndef CMAKE_BOOTSTRAP
+ /// Get the SARIF file path if set manually for this run
+ cm::optional<std::string> GetSarifFilePath() const
+ {
+ return (this->SarifFileOutput ? cm::make_optional(this->SarifFilePath)
+ : cm::nullopt);
+ }
+#endif
+
/**
* Get the state of the suppression of developer (author) warnings.
* Returns false, by default, if developer warnings should be shown, true
@@ -621,10 +640,11 @@ public:
int Build(int jobs, std::string dir, std::vector<std::string> targets,
std::string config, std::vector<std::string> nativeOptions,
cmBuildOptions& buildOptions, bool verbose,
- const std::string& presetName, bool listPresets);
+ std::string const& presetName, bool listPresets,
+ std::vector<std::string> const& args);
//! run the --open option
- bool Open(const std::string& dir, bool dryRun);
+ bool Open(std::string const& dir, bool dryRun);
//! run the --workflow option
enum class WorkflowListPresets
@@ -637,14 +657,18 @@ public:
No,
Yes,
};
- int Workflow(const std::string& presetName, WorkflowListPresets listPresets,
+ int Workflow(std::string const& presetName, WorkflowListPresets listPresets,
WorkflowFresh fresh);
- void UnwatchUnusedCli(const std::string& var);
- void WatchUnusedCli(const std::string& var);
+ void UnwatchUnusedCli(std::string const& var);
+ void WatchUnusedCli(std::string const& var);
#if !defined(CMAKE_BOOTSTRAP)
cmFileAPI* GetFileAPI() const { return this->FileAPI.get(); }
+ cmInstrumentation* GetInstrumentation() const
+ {
+ return this->Instrumentation.get();
+ }
#endif
cmState* GetState() const { return this->State.get(); }
@@ -656,12 +680,15 @@ public:
bool GetRegenerateDuringBuild() const { return this->RegenerateDuringBuild; }
+ void SetCMakeListName(std::string const& name);
+ std::string GetCMakeListFile(std::string const& dir) const;
+
#if !defined(CMAKE_BOOTSTRAP)
cmMakefileProfilingData& GetProfilingOutput();
bool IsProfilingEnabled() const;
cm::optional<cmMakefileProfilingData::RAII> CreateProfilingEntry(
- const std::string& category, const std::string& name)
+ std::string const& category, std::string const& name)
{
return this->CreateProfilingEntry(
category, name, []() -> cm::nullopt_t { return cm::nullopt; });
@@ -669,7 +696,7 @@ public:
template <typename ArgsFunc>
cm::optional<cmMakefileProfilingData::RAII> CreateProfilingEntry(
- const std::string& category, const std::string& name, ArgsFunc&& argsFunc)
+ std::string const& category, std::string const& name, ArgsFunc&& argsFunc)
{
if (this->IsProfilingEnabled()) {
return cm::make_optional<cmMakefileProfilingData::RAII>(
@@ -698,7 +725,7 @@ public:
protected:
void RunCheckForUnusedVariables();
- int HandleDeleteCacheVariables(const std::string& var);
+ int HandleDeleteCacheVariables(std::string const& var);
using RegisteredGeneratorsVector =
std::vector<std::unique_ptr<cmGlobalGeneratorFactory>>;
@@ -720,13 +747,13 @@ protected:
bool GeneratorToolsetSet = false;
//! read in a cmake list file to initialize the cache
- void ReadListFile(const std::vector<std::string>& args,
- const std::string& path);
- bool FindPackage(const std::vector<std::string>& args);
+ void ReadListFile(std::vector<std::string> const& args,
+ std::string const& path);
+ bool FindPackage(std::vector<std::string> const& args);
//! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
/// If it is set, truncate it to 50kb
- void TruncateOutputLog(const char* fname);
+ void TruncateOutputLog(char const* fname);
/**
* Method called to check build system integrity at build time.
@@ -734,15 +761,16 @@ protected:
*/
int CheckBuildSystem();
- bool SetDirectoriesFromFile(const std::string& arg);
+ bool SetDirectoriesFromFile(std::string const& arg);
//! Make sure all commands are what they say they are and there is no
/// macros.
void CleanupCommandsAndMacros();
- void GenerateGraphViz(const std::string& fileName) const;
+ void GenerateGraphViz(std::string const& fileName) const;
private:
+ std::vector<std::string> cmdArgs;
std::string CMakeWorkingDirectory;
ProgressCallbackType ProgressCallback;
WorkingMode CurrentWorkingMode = NORMAL_MODE;
@@ -759,7 +787,8 @@ private:
bool WarnUninitialized = false;
bool WarnUnusedCli = true;
bool CheckSystemVars = false;
- bool IgnoreWarningAsError = false;
+ bool IgnoreCompileWarningAsError = false;
+ bool IgnoreLinkWarningAsError = false;
std::map<std::string, bool> UsedCliVariables;
std::string CMakeEditCommand;
std::string CXXEnvironment;
@@ -779,6 +808,7 @@ private:
bool DebugTryCompile = false;
bool FreshCache = false;
bool RegenerateDuringBuild = false;
+ std::string CMakeListName;
std::unique_ptr<cmFileTimeCache> FileTimeCache;
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;
@@ -792,12 +822,18 @@ private:
#if !defined(CMAKE_BOOTSTRAP)
std::unique_ptr<cmVariableWatch> VariableWatch;
std::unique_ptr<cmFileAPI> FileAPI;
+ std::unique_ptr<cmInstrumentation> Instrumentation;
#endif
std::unique_ptr<cmState> State;
cmStateSnapshot CurrentSnapshot;
std::unique_ptr<cmMessenger> Messenger;
+#ifndef CMAKE_BOOTSTRAP
+ bool SarifFileOutput = false;
+ std::string SarifFilePath;
+#endif
+
std::vector<std::string> TraceOnlyThisSources;
std::set<std::string> DebugFindPkgs;
@@ -811,8 +847,6 @@ private:
std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
- void UpdateConversionPathTable();
-
//! Print a list of valid generators to stderr.
void PrintGeneratorList();
@@ -824,12 +858,12 @@ private:
#if !defined(CMAKE_BOOTSTRAP)
template <typename T>
- const T* FindPresetForWorkflow(
+ T const* FindPresetForWorkflow(
cm::static_string_view type,
- const std::map<std::string, cmCMakePresetsGraph::PresetPair<T>>& presets,
- const cmCMakePresetsGraph::WorkflowPreset::WorkflowStep& step);
+ std::map<std::string, cmCMakePresetsGraph::PresetPair<T>> const& presets,
+ cmCMakePresetsGraph::WorkflowPreset::WorkflowStep const& step);
- std::function<int()> BuildWorkflowStep(const std::vector<std::string>& args);
+ std::function<int()> BuildWorkflowStep(std::vector<std::string> const& args);
#endif
#if !defined(CMAKE_BOOTSTRAP)
@@ -850,7 +884,7 @@ public:
void SetScriptModeExitCode(int code) { ScriptModeExitCode = code; }
int GetScriptModeExitCode() const { return ScriptModeExitCode.value_or(-1); }
- static cmDocumentationEntry CMAKE_STANDARD_OPTIONS_TABLE[18];
+ static cmDocumentationEntry CMAKE_STANDARD_OPTIONS_TABLE[19];
};
#define FOR_EACH_C90_FEATURE(F) F(c_function_prototypes)
diff --git a/Source/cmake.version.manifest b/Source/cmake.version.manifest
index 79e3d19..03265b6 100644
--- a/Source/cmake.version.manifest
+++ b/Source/cmake.version.manifest
@@ -15,4 +15,9 @@
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
+ <asmv3:application>
+ <asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
+ <ws2:longPathAware>true</ws2:longPathAware>
+ </asmv3:windowsSettings>
+ </asmv3:application>
</assembly>
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index b57cdb3..7c60427 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,6 +28,8 @@
#include "cmDocumentationEntry.h"
#include "cmGlobalGenerator.h"
#include "cmInstallScriptHandler.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageMetadata.h"
@@ -50,12 +52,12 @@
namespace {
#ifndef CMAKE_BOOTSTRAP
-const cmDocumentationEntry cmDocumentationName = {
+cmDocumentationEntry const cmDocumentationName = {
{},
" cmake - Cross-Platform Makefile Generator."
};
-const cmDocumentationEntry cmDocumentationUsage[2] = {
+cmDocumentationEntry const cmDocumentationUsage[2] = {
{ {},
" cmake [options] <path-to-source>\n"
" cmake [options] <path-to-existing-build>\n"
@@ -66,12 +68,12 @@ const cmDocumentationEntry cmDocumentationUsage[2] = {
"directory to re-generate its build system." }
};
-const cmDocumentationEntry cmDocumentationUsageNote = {
+cmDocumentationEntry const cmDocumentationUsageNote = {
{},
"Run 'cmake --help' for more information."
};
-const cmDocumentationEntry cmDocumentationOptions[34] = {
+cmDocumentationEntry const cmDocumentationOptions[35] = {
{ "--preset <preset>,--preset=<preset>", "Specify a configure preset." },
{ "--list-presets[=<type>]", "List available presets." },
{ "--workflow [<options>]", "Run a workflow preset." },
@@ -123,6 +125,9 @@ const cmDocumentationEntry cmDocumentationOptions[34] = {
{ "--compile-no-warning-as-error",
"Ignore COMPILE_WARNING_AS_ERROR property and "
"CMAKE_COMPILE_WARNING_AS_ERROR variable." },
+ { "--link-no-warning-as-error",
+ "Ignore LINK_WARNING_AS_ERROR property and "
+ "CMAKE_LINK_WARNING_AS_ERROR variable." },
{ "--profiling-format=<fmt>",
"Output data for profiling CMake scripts. Supported formats: "
"google-trace" },
@@ -168,8 +173,8 @@ std::string cmakemainGetStack(cmake* cm)
return msg;
}
-void cmakemainMessageCallback(const std::string& m,
- const cmMessageMetadata& md, cmake* cm)
+void cmakemainMessageCallback(std::string const& m,
+ cmMessageMetadata const& md, cmake* cm)
{
#if defined(_WIN32)
// FIXME: On Windows we replace cerr's streambuf with a custom
@@ -187,7 +192,7 @@ void cmakemainMessageCallback(const std::string& m,
#endif
}
-void cmakemainProgressCallback(const std::string& m, float prog, cmake* cm)
+void cmakemainProgressCallback(std::string const& m, float prog, cmake* cm)
{
cmMakefile* mf = cmakemainGetMakefile(cm);
std::string dir;
@@ -219,7 +224,7 @@ std::function<bool(std::string const& value)> getShowCachedCallback(
int do_cmake(int ac, char const* const* av)
{
- if (cmSystemTools::GetCurrentWorkingDirectory().empty()) {
+ if (cmSystemTools::GetLogicalWorkingDirectory().empty()) {
std::cerr << "Current working directory cannot be established."
<< std::endl;
return 1;
@@ -395,10 +400,10 @@ int do_cmake(int ac, char const* const* av)
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmSystemTools::SetMessageCallback(
- [&cm](const std::string& msg, const cmMessageMetadata& md) {
+ [&cm](std::string const& msg, cmMessageMetadata const& md) {
cmakemainMessageCallback(msg, md, &cm);
});
- cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
+ cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
cm.SetWorkingMode(workingMode);
@@ -478,7 +483,7 @@ int extract_job_number(std::string const& command,
return jobs;
}
std::function<bool(std::string const&)> extract_job_number_lambda_builder(
- std::string& dir, int& jobs, const std::string& flag)
+ std::string& dir, int& jobs, std::string const& flag)
{
return [&dir, &jobs, flag](std::string const& value) -> bool {
jobs = extract_job_number(flag, value);
@@ -601,7 +606,7 @@ int do_build(int ac, char const* const* av)
}
}
if (!matched && i == 0) {
- dir = cmSystemTools::CollapseFullPath(arg);
+ dir = cmSystemTools::ToNormalizedPathOnDisk(arg);
matched = true;
parsed = true;
}
@@ -693,22 +698,23 @@ int do_build(int ac, char const* const* av)
cmake cm(cmake::RoleInternal, cmState::Project);
cmSystemTools::SetMessageCallback(
- [&cm](const std::string& msg, const cmMessageMetadata& md) {
+ [&cm](std::string const& msg, cmMessageMetadata const& md) {
cmakemainMessageCallback(msg, md, &cm);
});
- cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
+ cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
cmBuildOptions buildOptions(cleanFirst, false, resolveMode);
-
- return cm.Build(jobs, std::move(dir), std::move(targets), std::move(config),
+ std::vector<std::string> cmd;
+ cm::append(cmd, av, av + ac);
+ return cm.Build(jobs, dir, std::move(targets), std::move(config),
std::move(nativeOptions), buildOptions, verbose, presetName,
- listPresets);
+ listPresets, cmd);
#endif
}
-bool parse_default_directory_permissions(const std::string& permissions,
+bool parse_default_directory_permissions(std::string const& permissions,
std::string& parsedPermissionsVar)
{
std::vector<std::string> parsedPermissions;
@@ -724,7 +730,7 @@ bool parse_default_directory_permissions(const std::string& permissions,
};
Doing doing = DoingNone;
- auto uniquePushBack = [&parsedPermissions](const std::string& e) {
+ auto uniquePushBack = [&parsedPermissions](std::string const& e) {
if (std::find(parsedPermissions.begin(), parsedPermissions.end(), e) ==
parsedPermissions.end()) {
parsedPermissions.push_back(e);
@@ -873,7 +879,7 @@ int do_install(int ac, char const* const* av)
};
if (ac >= 3) {
- dir = cmSystemTools::CollapseFullPath(av[2]);
+ dir = cmSystemTools::ToNormalizedPathOnDisk(av[2]);
std::vector<std::string> inputArgs;
inputArgs.reserve(ac - 3);
@@ -921,20 +927,6 @@ int do_install(int ac, char const* const* av)
return 1;
}
- cmake cm(cmake::RoleScript, cmState::Script);
-
- cmSystemTools::SetMessageCallback(
- [&cm](const std::string& msg, const cmMessageMetadata& md) {
- cmakemainMessageCallback(msg, md, &cm);
- });
- cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
- cmakemainProgressCallback(msg, prog, &cm);
- });
- cm.SetHomeDirectory("");
- cm.SetHomeOutputDirectory("");
- cm.SetDebugOutputOn(verbose);
- cm.SetWorkingMode(cmake::SCRIPT_MODE);
-
std::vector<std::string> args{ av[0] };
if (!prefix.empty()) {
@@ -949,10 +941,6 @@ int do_install(int ac, char const* const* av)
args.emplace_back("-DCMAKE_INSTALL_DO_STRIP=1");
}
- if (!config.empty()) {
- args.emplace_back("-DCMAKE_INSTALL_CONFIG_NAME=" + config);
- }
-
if (!defaultDirectoryPermissions.empty()) {
std::string parsedPermissionsVar;
if (!parse_default_directory_permissions(defaultDirectoryPermissions,
@@ -967,28 +955,52 @@ int do_install(int ac, char const* const* av)
args.emplace_back("-P");
- auto handler = cmInstallScriptHandler(dir, component, args);
+ cmInstrumentation instrumentation(dir);
+ auto handler = cmInstallScriptHandler(dir, component, config, args);
int ret = 0;
- if (!handler.isParallel()) {
- args.emplace_back(cmStrCat(dir, "/cmake_install.cmake"));
- ret = int(bool(cm.Run(args)));
- } else {
- if (!jobs) {
- jobs = 1;
- auto envvar = cmSystemTools::GetEnvVar("CMAKE_INSTALL_PARALLEL_LEVEL");
- if (envvar.has_value()) {
- jobs = extract_job_number("", envvar.value());
- if (jobs < 1) {
- std::cerr << "Value of CMAKE_INSTALL_PARALLEL_LEVEL environment"
- " variable must be a positive integer.\n";
- return 1;
- }
+ if (!jobs && handler.IsParallel()) {
+ jobs = 1;
+ auto envvar = cmSystemTools::GetEnvVar("CMAKE_INSTALL_PARALLEL_LEVEL");
+ if (envvar.has_value()) {
+ jobs = extract_job_number("", envvar.value());
+ if (jobs < 1) {
+ std::cerr << "Value of CMAKE_INSTALL_PARALLEL_LEVEL environment"
+ " variable must be a positive integer.\n";
+ return 1;
}
}
- ret = handler.install(jobs);
}
- return int(ret > 0);
+ auto doInstall = [&handler, &verbose, &jobs, &instrumentation]() -> int {
+ int ret_ = 0;
+ if (handler.IsParallel()) {
+ ret_ = handler.Install(jobs, instrumentation);
+ } else {
+ for (auto const& cmd : handler.GetCommands()) {
+ cmake cm(cmake::RoleScript, cmState::Script);
+ cmSystemTools::SetMessageCallback(
+ [&cm](std::string const& msg, cmMessageMetadata const& md) {
+ cmakemainMessageCallback(msg, md, &cm);
+ });
+ cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
+ cmakemainProgressCallback(msg, prog, &cm);
+ });
+ cm.SetHomeDirectory("");
+ cm.SetHomeOutputDirectory("");
+ cm.SetDebugOutputOn(verbose);
+ cm.SetWorkingMode(cmake::SCRIPT_MODE);
+ ret_ = int(bool(cm.Run(cmd)));
+ }
+ }
+ return int(ret_ > 0);
+ };
+
+ std::vector<std::string> cmd;
+ cm::append(cmd, av, av + ac);
+ ret = instrumentation.InstrumentCommand(
+ "cmakeInstall", cmd, [doInstall]() { return doInstall(); });
+ instrumentation.CollectTimingData(cmInstrumentationQuery::Hook::PostInstall);
+ return ret;
#endif
}
@@ -1011,12 +1023,12 @@ int do_workflow(int ac, char const* const* av)
CommandArgument{ "--preset", CommandArgument::Values::One,
CommandArgument::setToValue(presetName) },
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
- [&listPresets](const std::string&) -> bool {
+ [&listPresets](std::string const&) -> bool {
listPresets = WorkflowListPresets::Yes;
return true;
} },
CommandArgument{ "--fresh", CommandArgument::Values::Zero,
- [&fresh](const std::string&) -> bool {
+ [&fresh](std::string const&) -> bool {
fresh = WorkflowFresh::Yes;
return true;
} },
@@ -1070,10 +1082,10 @@ int do_workflow(int ac, char const* const* av)
cmake cm(cmake::RoleInternal, cmState::Project);
cmSystemTools::SetMessageCallback(
- [&cm](const std::string& msg, const cmMessageMetadata& md) {
+ [&cm](std::string const& msg, cmMessageMetadata const& md) {
cmakemainMessageCallback(msg, md, &cm);
});
- cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
+ cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
@@ -1098,7 +1110,7 @@ int do_open(int ac, char const* const* av)
for (int i = 2; i < ac; ++i) {
switch (doing) {
case DoingDir:
- dir = cmSystemTools::CollapseFullPath(av[i]);
+ dir = cmSystemTools::ToNormalizedPathOnDisk(av[i]);
doing = DoingNone;
break;
default:
@@ -1114,10 +1126,10 @@ int do_open(int ac, char const* const* av)
cmake cm(cmake::RoleInternal, cmState::Unknown);
cmSystemTools::SetMessageCallback(
- [&cm](const std::string& msg, const cmMessageMetadata& md) {
+ [&cm](std::string const& msg, cmMessageMetadata const& md) {
cmakemainMessageCallback(msg, md, &cm);
});
- cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
+ cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
return cm.Open(dir, false) ? 0 : 1;
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 5310166..49e1ddd 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -24,6 +24,7 @@
#include <windows.h>
#include "cmsys/Encoding.hxx"
+#include "cmsys/SystemTools.hxx"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -34,7 +35,7 @@ void _setargv()
{
}
-static void Fatal(const char* msg, ...)
+static void Fatal(char const* msg, ...)
{
va_list ap;
fprintf(stderr, "ninja: FATAL: ");
@@ -49,7 +50,7 @@ static void Fatal(const char* msg, ...)
ExitProcess(1);
}
-static void usage(const char* msg)
+static void usage(char const* msg)
{
Fatal("%s\n\nusage:\n "
"cmcldeps "
@@ -72,8 +73,8 @@ static cm::string_view trimLeadingSpace(cm::string_view cmdline)
return cmdline.substr(i);
}
-static void replaceAll(std::string& str, const std::string& search,
- const std::string& repl)
+static void replaceAll(std::string& str, std::string const& search,
+ std::string const& repl)
{
std::string::size_type pos = 0;
while ((pos = str.find(search, pos)) != std::string::npos) {
@@ -135,7 +136,7 @@ static void escapePath(std::string& path)
replaceAll(path, " ", "\\ ");
}
-static void outputDepFile(const std::string& dfile, const std::string& objfile,
+static void outputDepFile(std::string const& dfile, std::string const& objfile,
std::vector<std::string>& incs)
{
@@ -151,7 +152,7 @@ static void outputDepFile(const std::string& dfile, const std::string& objfile,
// FIXME should this be fatal or not? delete obj? delete d?
if (!out)
return;
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
replaceAll(cwd, "/", "\\");
cwd += "\\";
@@ -176,9 +177,9 @@ static void outputDepFile(const std::string& dfile, const std::string& objfile,
fclose(out);
}
-static int process(cm::string_view srcfilename, const std::string& dfile,
- const std::string& objfile, const std::string& prefix,
- const std::string& cmd, const std::string& dir = "",
+static int process(cm::string_view srcfilename, std::string const& dfile,
+ std::string const& objfile, std::string const& prefix,
+ std::string const& cmd, std::string const& dir = "",
bool quiet = false)
{
std::string output;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index c82cb32..559b7c0 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmcmd.h"
#include <functional>
@@ -85,7 +85,7 @@ int cmcmd_cmake_module_compile_db(
namespace {
// ATTENTION If you add new commands, change here,
// and in `cmakemain.cxx` in the options table
-const char* const HELP_AVAILABLE_COMMANDS = R"(Available commands:
+char const* const HELP_AVAILABLE_COMMANDS = R"(Available commands:
capabilities - Report capabilities built into cmake in JSON format
cat [--] <files>... - concat the files and print them to the standard output
chdir dir cmd [args...] - run command in a given directory
@@ -123,7 +123,7 @@ const char* const HELP_AVAILABLE_COMMANDS = R"(Available commands:
false - do nothing with an exit code of 1
)";
#if defined(_WIN32) && !defined(__CYGWIN__)
-const char* const HELP_AVAILABLE_WINDOWS_COMMANDS =
+char const* const HELP_AVAILABLE_WINDOWS_COMMANDS =
R"(Available on Windows only:
delete_regv key - delete registry value
env_vs8_wince sdkname - displays a batch file which sets the environment for the provided Windows CE SDK installed in VS2005
@@ -186,7 +186,7 @@ bool cmTarFilesFrom(std::string const& file, std::vector<std::string>& files)
return true;
}
-void cmCatFile(const std::string& fileToAppend)
+void cmCatFile(std::string const& fileToAppend)
{
#ifdef _WIN32
_setmode(fileno(stdin), _O_BINARY);
@@ -201,7 +201,7 @@ void cmCatFile(const std::string& fileToAppend)
std::cout << buf;
}
-bool cmRemoveDirectory(const std::string& dir, bool recursive = true)
+bool cmRemoveDirectory(std::string const& dir, bool recursive = true)
{
if (cmSystemTools::FileIsSymlink(dir)) {
if (!cmSystemTools::RemoveFile(dir)) {
@@ -266,7 +266,7 @@ public:
}
};
-int CLCompileAndDependencies(const std::vector<std::string>& args)
+int CLCompileAndDependencies(std::vector<std::string> const& args)
{
std::string depFile;
std::string currentBinaryDir;
@@ -323,8 +323,8 @@ int CLCompileAndDependencies(const std::vector<std::string>& args)
}
#endif
-int HandleIWYU(const std::string& runCmd, const std::string& /* sourceFile */,
- const std::vector<std::string>& orig_cmd)
+int HandleIWYU(std::string const& runCmd, std::string const& /* sourceFile */,
+ std::vector<std::string> const& orig_cmd)
{
// Construct the iwyu command line by taking what was given
// and adding all the arguments we give to the compiler.
@@ -355,8 +355,8 @@ int HandleIWYU(const std::string& runCmd, const std::string& /* sourceFile */,
return errors_enabled ? ret : 0;
}
-int HandleTidy(const std::string& runCmd, const std::string& sourceFile,
- const std::vector<std::string>& orig_cmd)
+int HandleTidy(std::string const& runCmd, std::string const& sourceFile,
+ std::vector<std::string> const& orig_cmd)
{
cmList tidy_cmd{ runCmd, cmList::EmptyElements::Yes };
tidy_cmd.push_back(sourceFile);
@@ -403,8 +403,8 @@ int HandleTidy(const std::string& runCmd, const std::string& sourceFile,
return ret;
}
-int HandleLWYU(const std::string& runCmd, const std::string& sourceFile,
- const std::vector<std::string>&)
+int HandleLWYU(std::string const& runCmd, std::string const& sourceFile,
+ std::vector<std::string> const&)
{
// Construct the ldd -r -u (link what you use lwyu) command line
// ldd -u -r lwuy target
@@ -432,8 +432,8 @@ int HandleLWYU(const std::string& runCmd, const std::string& sourceFile,
return 0;
}
-int HandleCppLint(const std::string& runCmd, const std::string& sourceFile,
- const std::vector<std::string>&)
+int HandleCppLint(std::string const& runCmd, std::string const& sourceFile,
+ std::vector<std::string> const&)
{
// Construct the cpplint command line.
cmList cpplint_cmd{ runCmd, cmList::EmptyElements::Yes };
@@ -459,8 +459,8 @@ int HandleCppLint(const std::string& runCmd, const std::string& sourceFile,
return 0;
}
-int HandleCppCheck(const std::string& runCmd, const std::string& sourceFile,
- const std::vector<std::string>& orig_cmd)
+int HandleCppCheck(std::string const& runCmd, std::string const& sourceFile,
+ std::vector<std::string> const& orig_cmd)
{
// Construct the cpplint command line.
cmList cppcheck_cmd{ runCmd, cmList::EmptyElements::Yes };
@@ -513,17 +513,17 @@ int HandleCppCheck(const std::string& runCmd, const std::string& sourceFile,
return ret;
}
-using CoCompileHandler = int (*)(const std::string&, const std::string&,
- const std::vector<std::string>&);
+using CoCompileHandler = int (*)(std::string const&, std::string const&,
+ std::vector<std::string> const&);
struct CoCompiler
{
- const char* Option;
+ char const* Option;
CoCompileHandler Handler;
bool NoOriginalCommand;
};
-const std::array<CoCompiler, 5> CoCompilers = {
+std::array<CoCompiler, 5> const CoCompilers = {
{ // Table of options and handlers.
{ "--cppcheck=", HandleCppCheck, false },
{ "--cpplint=", HandleCppLint, false },
@@ -645,7 +645,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
// Copy file
if (args[1] == "copy" && args.size() > 3) {
using CommandArgument =
- cmCommandLineArgument<bool(const std::string& value)>;
+ cmCommandLineArgument<bool(std::string const& value)>;
cm::optional<std::string> targetArg;
std::vector<CommandArgument> argParsers{
@@ -655,7 +655,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
std::vector<std::string> files;
for (decltype(args.size()) i = 2; i < args.size(); i++) {
- const std::string& arg = args[i];
+ std::string const& arg = args[i];
bool matched = false;
for (auto const& m : argParsers) {
if (m.matches(arg)) {
@@ -731,7 +731,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
args.size() > 3) {
// If error occurs we want to continue copying next files.
bool return_value = false;
- const bool copy_always = (args[1] == "copy_directory");
+ bool const copy_always = (args[1] == "copy_directory");
for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) {
if (!cmSystemTools::CopyADirectory(arg, args.back(), copy_always)) {
std::cerr << "Error copying directory from \"" << arg << "\" to \""
@@ -1297,7 +1297,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
// Internal CMake dependency scanning support.
if (args[1] == "cmake_depends" && args.size() >= 6) {
- const bool verbose = isCMakeVerbose();
+ bool const verbose = isCMakeVerbose();
// Create a cmake object instance to process dependencies.
// All we need is the `set` command.
@@ -1347,10 +1347,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
// Create a local generator configured for the directory in
// which dependencies will be scanned.
- homeDir = cmSystemTools::CollapseFullPath(homeDir);
- startDir = cmSystemTools::CollapseFullPath(startDir);
- homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir);
- startOutDir = cmSystemTools::CollapseFullPath(startOutDir);
+ homeDir = cmSystemTools::ToNormalizedPathOnDisk(homeDir);
+ startDir = cmSystemTools::ToNormalizedPathOnDisk(startDir);
+ homeOutDir = cmSystemTools::ToNormalizedPathOnDisk(homeOutDir);
+ startOutDir = cmSystemTools::ToNormalizedPathOnDisk(startOutDir);
cm.SetHomeDirectory(homeDir);
cm.SetHomeOutputDirectory(homeOutDir);
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -1449,7 +1449,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
// Tar files
if (args[1] == "tar" && args.size() > 3) {
- const char* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "zip" };
+ char const* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "zip" };
std::string const& flags = args[2];
std::string const& outFile = args[3];
@@ -1643,10 +1643,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
std::string startDir;
std::string homeOutDir;
std::string startOutDir;
- homeDir = cmSystemTools::CollapseFullPath(args[4]);
- startDir = cmSystemTools::CollapseFullPath(args[5]);
- homeOutDir = cmSystemTools::CollapseFullPath(args[6]);
- startOutDir = cmSystemTools::CollapseFullPath(args[7]);
+ homeDir = cmSystemTools::ToNormalizedPathOnDisk(args[4]);
+ startDir = cmSystemTools::ToNormalizedPathOnDisk(args[5]);
+ homeOutDir = cmSystemTools::ToNormalizedPathOnDisk(args[6]);
+ startOutDir = cmSystemTools::ToNormalizedPathOnDisk(args[7]);
cm.SetHomeDirectory(homeDir);
cm.SetHomeOutputDirectory(homeOutDir);
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -1787,8 +1787,8 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num)
}
fclose(progFile);
- const char* last = num.c_str();
- for (const char* c = last;; ++c) {
+ char const* last = num.c_str();
+ for (char const* c = last;; ++c) {
if (*c == ',' || *c == '\0') {
if (c != last) {
fName = cmStrCat(dirName, '/');
@@ -1951,7 +1951,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string> const& args)
return result;
}
-int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
+int cmcmd::WindowsCEEnvironment(char const* version, std::string const& name)
{
#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) && !defined(__CYGWIN__)
cmVisualStudioWCEPlatformParser parser(name.c_str());
@@ -1974,8 +1974,8 @@ int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
return -1;
}
-int cmcmd::RunPreprocessor(const std::vector<std::string>& command,
- const std::string& intermediate_file)
+int cmcmd::RunPreprocessor(std::vector<std::string> const& command,
+ std::string const& intermediate_file)
{
cmUVProcessChainBuilder builder;
@@ -2023,17 +2023,17 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
return 1;
}
- const std::string& intermediate_file = args[3];
- const std::string& source_file = args[2];
+ std::string const& intermediate_file = args[3];
+ std::string const& source_file = args[2];
std::vector<std::string> preprocess;
std::vector<std::string> resource_compile;
std::vector<std::string>* pArgTgt = &preprocess;
- static const cmsys::RegularExpression llvm_rc_only_single_arg("^[-/](N|Y)");
- static const cmsys::RegularExpression llvm_rc_only_double_arg(
+ static cmsys::RegularExpression const llvm_rc_only_single_arg("^[-/](N|Y)");
+ static cmsys::RegularExpression const llvm_rc_only_double_arg(
"^[-/](C|LN|L)(.)?");
- static const cmsys::RegularExpression common_double_arg(
- "^[-/](D|U|I|FO|fo|Fo)(.)?");
+ static cmsys::RegularExpression const common_double_arg(
+ "^[-/](D|U|I|FO|fo|Fo)(.)?"); // noqa: spellcheck disable-line
bool acceptNextArg = false;
bool skipNextArg = false;
for (std::string const& arg : cmMakeRange(args).advance(4)) {
@@ -2180,7 +2180,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string> const& args, int type)
if (args.size() < 2) {
return -1;
}
- const bool verbose = cmSystemTools::HasEnv("VERBOSE");
+ bool const verbose = cmSystemTools::HasEnv("VERBOSE");
std::vector<std::string> expandedArgs;
for (std::string const& i : args) {
// check for nmake temporary files
@@ -2230,7 +2230,7 @@ static std::ostream& operator<<(std::ostream& stream,
return stream;
}
-static bool RunCommand(const char* comment,
+static bool RunCommand(char const* comment,
std::vector<std::string> const& command, bool verbose,
NumberFormat exitFormat, int* retCodeOut = nullptr,
bool (*retCodeOkay)(int) = nullptr)
@@ -2413,7 +2413,7 @@ int cmVSLink::LinkIncremental()
// Create a resource file referencing the manifest.
std::string absManifestFile =
- cmSystemTools::CollapseFullPath(this->ManifestFile);
+ cmSystemTools::ToNormalizedPathOnDisk(this->ManifestFile);
if (this->Verbose) {
std::cout << "Create " << this->ManifestFileRC << '\n';
}
@@ -2448,7 +2448,7 @@ int cmVSLink::LinkIncremental()
// Compile the resource file.
std::vector<std::string> rcCommand;
rcCommand.push_back(this->RcPath.empty() ? "rc" : this->RcPath);
- rcCommand.emplace_back("/fo");
+ rcCommand.emplace_back("/fo"); // noqa: spellcheck disable-line
rcCommand.push_back(this->ManifestFileRes);
rcCommand.push_back(this->ManifestFileRC);
if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) {
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
index ba78edb..f3eeba4 100644
--- a/Source/cmcmd.h
+++ b/Source/cmcmd.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,10 +34,10 @@ protected:
std::string const& link);
static int ExecuteEchoColor(std::vector<std::string> const& args);
static int ExecuteLinkScript(std::vector<std::string> const& args);
- static int WindowsCEEnvironment(const char* version,
- const std::string& name);
- static int RunPreprocessor(const std::vector<std::string>& command,
- const std::string& intermediate_file);
+ static int WindowsCEEnvironment(char const* version,
+ std::string const& name);
+ static int RunPreprocessor(std::vector<std::string> const& command,
+ std::string const& intermediate_file);
static int RunLLVMRC(std::vector<std::string> const& args);
static int VisualStudioLink(std::vector<std::string> const& args, int type);
};
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 68c36df..b25f58b 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstring>
#include <iostream>
@@ -12,20 +12,21 @@
#include "cmConsoleBuf.h"
#include "cmDocumentation.h"
#include "cmDocumentationEntry.h"
+#include "cmInstrumentation.h"
+#include "cmInstrumentationQuery.h"
#include "cmSystemTools.h"
#include "CTest/cmCTestLaunch.h"
-#include "CTest/cmCTestScriptHandler.h"
namespace {
-const cmDocumentationEntry cmDocumentationName = {
+cmDocumentationEntry const cmDocumentationName = {
{},
" ctest - Testing driver provided by CMake."
};
-const cmDocumentationEntry cmDocumentationUsage = { {}, " ctest [options]" };
+cmDocumentationEntry const cmDocumentationUsage = { {}, " ctest [options]" };
-const cmDocumentationEntry cmDocumentationOptions[] = {
+cmDocumentationEntry const cmDocumentationOptions[] = {
{ "--preset <preset>, --preset=<preset>",
"Read arguments from a test preset." },
{ "--list-presets", "List available test presets." },
@@ -147,8 +148,6 @@ const cmDocumentationEntry cmDocumentationOptions[] = {
{ "--overwrite", "Overwrite CTest configuration option." },
{ "--extra-submit <file>[;<file>]", "Submit extra files to the dashboard." },
{ "--http-header <header>", "Append HTTP header when submitting" },
- { "--force-new-ctest-process",
- "Run child CTest instances as new processes" },
{ "--schedule-random", "Use a random order for scheduling tests" },
{ "--submit-index",
"Submit individual dashboard tests with specific index" },
@@ -182,14 +181,34 @@ int main(int argc, char const* const* argv)
// Dispatch 'ctest --launch' mode directly.
if (argc >= 2 && strcmp(argv[1], "--launch") == 0) {
- return cmCTestLaunch::Main(argc, argv);
+ return cmCTestLaunch::Main(argc, argv, cmCTestLaunch::Op::Normal);
}
- cmCTest inst;
+ // Dispatch 'ctest --instrument' mode directly.
+ if (argc >= 2 && strcmp(argv[1], "--instrument") == 0) {
+ return cmCTestLaunch::Main(argc, argv, cmCTestLaunch::Op::Instrument);
+ }
+
+ // Dispatch post-build instrumentation daemon for ninja
+ if (argc == 3 && strcmp(argv[1], "--start-instrumentation") == 0) {
+ return cmInstrumentation(argv[2]).SpawnBuildDaemon();
+ }
- if (cmSystemTools::GetCurrentWorkingDirectory().empty()) {
- cmCTestLog(&inst, ERROR_MESSAGE,
- "Current working directory cannot be established.\n");
+ // Dispatch 'ctest --collect-instrumentation' once given PID finishes
+ if (argc == 4 &&
+ strcmp(argv[1], "--wait-and-collect-instrumentation") == 0) {
+ return cmInstrumentation(argv[2]).CollectTimingAfterBuild(
+ std::stoi(argv[3]));
+ }
+
+ // Dispatch 'ctest --collect-instrumentation' mode directly.
+ if (argc == 3 && strcmp(argv[1], "--collect-instrumentation") == 0) {
+ return cmInstrumentation(argv[2]).CollectTimingData(
+ cmInstrumentationQuery::Hook::Manual);
+ }
+
+ if (cmSystemTools::GetLogicalWorkingDirectory().empty()) {
+ std::cerr << "Current working directory cannot be established.\n";
return 1;
}
@@ -200,18 +219,13 @@ int main(int argc, char const* const* argv)
!(cmSystemTools::FileExists("CTestTestfile.cmake") ||
cmSystemTools::FileExists("DartTestfile.txt"))) {
if (argc == 1) {
- cmCTestLog(&inst, ERROR_MESSAGE,
- "*********************************\n"
- "No test configuration file found!\n"
- "*********************************\n");
+ std::cerr << "*********************************\n"
+ "No test configuration file found!\n"
+ "*********************************\n";
}
cmDocumentation doc;
doc.addCTestStandardDocSections();
if (doc.CheckOptions(argc, argv)) {
- // Construct and print requested documentation.
- cmCTestScriptHandler* ch = inst.GetScriptHandler();
- ch->CreateCMake();
-
doc.SetShowGenerators(false);
doc.SetName("ctest");
doc.SetSection("Name", cmDocumentationName);
@@ -222,15 +236,8 @@ int main(int argc, char const* const* argv)
}
// copy the args to a vector
- std::vector<std::string> args;
- args.reserve(argc);
- for (int i = 0; i < argc; ++i) {
- args.emplace_back(argv[i]);
- }
- // run ctest
- std::string output;
- int res = inst.Run(args, &output);
- cmCTestLog(&inst, OUTPUT, output);
+ auto args = std::vector<std::string>(argv, argv + argc);
- return res;
+ // run ctest
+ return cmCTest{}.Run(args);
}
diff --git a/Source/kwsys/Base64.c b/Source/kwsys/Base64.c
index 4265018..c07eedc 100644
--- a/Source/kwsys/Base64.c
+++ b/Source/kwsys/Base64.c
@@ -9,12 +9,12 @@
# include "Base64.h.in"
#endif
-static const unsigned char kwsysBase64EncodeTable[65] =
+static unsigned char const kwsysBase64EncodeTable[65] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
-static const unsigned char kwsysBase64DecodeTable[256] = {
+static unsigned char const kwsysBase64DecodeTable[256] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -49,7 +49,7 @@ static unsigned char kwsysBase64DecodeChar(unsigned char c)
}
/* Encode 3 bytes into a 4 byte string. */
-void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
+void kwsysBase64_Encode3(unsigned char const* src, unsigned char* dest)
{
dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
dest[1] =
@@ -60,7 +60,7 @@ void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
}
/* Encode 2 bytes into a 4 byte string. */
-void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
+void kwsysBase64_Encode2(unsigned char const* src, unsigned char* dest)
{
dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
dest[1] =
@@ -70,7 +70,7 @@ void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
}
/* Encode 1 bytes into a 4 byte string. */
-void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
+void kwsysBase64_Encode1(unsigned char const* src, unsigned char* dest)
{
dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
dest[1] = kwsysBase64EncodeChar(((src[0] << 4) & 0x30));
@@ -88,11 +88,11 @@ void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
actually knowing how much data to expect (if the input is not a multiple of
3 bytes then the extra padding needed to complete the encode 4 bytes will
stop the decoding anyway). */
-size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
+size_t kwsysBase64_Encode(unsigned char const* input, size_t length,
unsigned char* output, int mark_end)
{
- const unsigned char* ptr = input;
- const unsigned char* end = input + length;
+ unsigned char const* ptr = input;
+ unsigned char const* end = input + length;
unsigned char* optr = output;
/* Encode complete triplet */
@@ -128,7 +128,7 @@ size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
}
/* Decode 4 bytes into a 3 byte string. */
-int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
+int kwsysBase64_Decode3(unsigned char const* src, unsigned char* dest)
{
unsigned char d0;
unsigned char d1;
@@ -172,16 +172,16 @@ int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
'length' parameter is ignored. This enables the caller to decode a stream
without actually knowing how much decoded data to expect (of course, the
buffer must be large enough). */
-size_t kwsysBase64_Decode(const unsigned char* input, size_t length,
+size_t kwsysBase64_Decode(unsigned char const* input, size_t length,
unsigned char* output, size_t max_input_length)
{
- const unsigned char* ptr = input;
+ unsigned char const* ptr = input;
unsigned char* optr = output;
/* Decode complete triplet */
if (max_input_length) {
- const unsigned char* end = input + max_input_length;
+ unsigned char const* end = input + max_input_length;
while (ptr < end) {
int len = kwsysBase64_Decode3(ptr, optr);
optr += len;
diff --git a/Source/kwsys/Base64.h.in b/Source/kwsys/Base64.h.in
index 729f972..da47f2a 100644
--- a/Source/kwsys/Base64.h.in
+++ b/Source/kwsys/Base64.h.in
@@ -32,19 +32,19 @@ extern "C" {
/**
* Encode 3 bytes into a 4 byte string.
*/
-kwsysEXPORT void kwsysBase64_Encode3(const unsigned char* src,
+kwsysEXPORT void kwsysBase64_Encode3(unsigned char const* src,
unsigned char* dest);
/**
* Encode 2 bytes into a 4 byte string.
*/
-kwsysEXPORT void kwsysBase64_Encode2(const unsigned char* src,
+kwsysEXPORT void kwsysBase64_Encode2(unsigned char const* src,
unsigned char* dest);
/**
* Encode 1 bytes into a 4 byte string.
*/
-kwsysEXPORT void kwsysBase64_Encode1(const unsigned char* src,
+kwsysEXPORT void kwsysBase64_Encode1(unsigned char const* src,
unsigned char* dest);
/**
@@ -60,7 +60,7 @@ kwsysEXPORT void kwsysBase64_Encode1(const unsigned char* src,
* the extra padding needed to complete the encode 4 bytes will stop
* the decoding anyway).
*/
-kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char* input,
+kwsysEXPORT size_t kwsysBase64_Encode(unsigned char const* input,
size_t length, unsigned char* output,
int mark_end);
@@ -68,7 +68,7 @@ kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char* input,
* Decode 4 bytes into a 3 byte string. Returns the number of bytes
* actually decoded.
*/
-kwsysEXPORT int kwsysBase64_Decode3(const unsigned char* src,
+kwsysEXPORT int kwsysBase64_Decode3(unsigned char const* src,
unsigned char* dest);
/**
@@ -83,7 +83,7 @@ kwsysEXPORT int kwsysBase64_Decode3(const unsigned char* src,
* much decoded data to expect (of course, the buffer must be large
* enough).
*/
-kwsysEXPORT size_t kwsysBase64_Decode(const unsigned char* input,
+kwsysEXPORT size_t kwsysBase64_Decode(unsigned char const* input,
size_t length, unsigned char* output,
size_t max_input_length);
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 562d5e6..d6d43f5 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -173,6 +173,9 @@ if(KWSYS_USE_Process)
set(KWSYS_USE_System 1)
set(KWSYS_USE_Encoding 1)
endif()
+if(KWSYS_USE_Status)
+ set(KWSYS_USE_Encoding 1)
+endif()
if(KWSYS_USE_SystemInformation)
set(KWSYS_USE_Process 1)
endif()
@@ -410,14 +413,6 @@ if(KWSYS_USE_DynamicLoader)
endif()
if(KWSYS_USE_SystemTools)
- if (NOT DEFINED KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP)
- set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1)
- endif ()
- if (KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP)
- set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1)
- else ()
- set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 0)
- endif ()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV
"Checking whether CXX compiler has setenv" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV
@@ -466,7 +461,7 @@ if(KWSYS_USE_SystemInformation)
COMPILE_DEFINITIONS SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P})
if(NOT CYGWIN)
include(CheckIncludeFiles)
- CHECK_INCLUDE_FILES("sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H)
+ check_include_files("sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H)
if(KWSYS_SYS_HAS_IFADDRS_H)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_SYS_HAS_IFADDRS_H=1)
@@ -475,7 +470,7 @@ if(KWSYS_USE_SystemInformation)
if(WIN32)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_LIBRARIES psapi)
- CHECK_SYMBOL_EXISTS(GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI)
+ check_symbol_exists(GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI)
unset(CMAKE_REQUIRED_LIBRARIES)
if(KWSYS_SYS_HAS_PSAPI)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
@@ -487,14 +482,14 @@ if(KWSYS_USE_SystemInformation)
endif()
endif()
if(CMAKE_SYSTEM MATCHES "HP-UX")
- CHECK_INCLUDE_FILES("sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H)
+ check_include_files("sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H)
if(KWSYS_SYS_HAS_MPCTL_H)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MPCTL_H=1)
endif()
endif()
if(CMAKE_SYSTEM MATCHES "BSD")
- CHECK_INCLUDE_FILES("machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H)
+ check_include_files("machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H)
if(KWSYS_SYS_HAS_MACHINE_CPU_H)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1)
@@ -517,7 +512,7 @@ if(KWSYS_USE_SystemInformation)
if (NOT EXECINFO_LIB)
set(EXECINFO_LIB "")
endif()
- CHECK_INCLUDE_FILE_CXX("execinfo.h" KWSYS_CXX_HAS_EXECINFOH)
+ check_include_file_cxx("execinfo.h" KWSYS_CXX_HAS_EXECINFOH)
if (KWSYS_CXX_HAS_EXECINFOH)
# we have the backtrace header check if it
# can be used with this compiler
@@ -531,7 +526,7 @@ if(KWSYS_USE_SystemInformation)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE=1)
# check for symbol lookup using dladdr
- CHECK_INCLUDE_FILE_CXX("dlfcn.h" KWSYS_CXX_HAS_DLFCNH)
+ check_include_file_cxx("dlfcn.h" KWSYS_CXX_HAS_DLFCNH)
if (KWSYS_CXX_HAS_DLFCNH)
# we have symbol lookup libraries and headers
# check if they can be used with this compiler
@@ -548,7 +543,7 @@ if(KWSYS_USE_SystemInformation)
endif()
# c++ demangling support
# check for cxxabi headers
- CHECK_INCLUDE_FILE_CXX("cxxabi.h" KWSYS_CXX_HAS_CXXABIH)
+ check_include_file_cxx("cxxabi.h" KWSYS_CXX_HAS_CXXABIH)
if (KWSYS_CXX_HAS_CXXABIH)
# check if cxxabi can be used with this
# system and compiler.
@@ -692,7 +687,7 @@ foreach(c IN LISTS KWSYS_CLASSES)
# Configure the header for this class.
configure_file(${PROJECT_SOURCE_DIR}/${c}.hxx.in ${KWSYS_HEADER_DIR}/${c}.hxx
- @ONLY IMMEDIATE)
+ @ONLY)
set(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${KWSYS_HEADER_DIR}/${c}.hxx)
# Create an install target for the header.
@@ -707,7 +702,7 @@ endforeach()
foreach(h IN LISTS KWSYS_H_FILES)
# Configure the header into the given directory.
configure_file(${PROJECT_SOURCE_DIR}/${h}.h.in ${KWSYS_HEADER_DIR}/${h}.h
- @ONLY IMMEDIATE)
+ @ONLY)
set(KWSYS_C_SRCS ${KWSYS_C_SRCS} ${KWSYS_HEADER_DIR}/${h}.h)
# Create an install target for the header.
@@ -722,7 +717,7 @@ endforeach()
foreach(h IN LISTS KWSYS_HXX_FILES)
# Configure the header into the given directory.
configure_file(${PROJECT_SOURCE_DIR}/${h}.hxx.in ${KWSYS_HEADER_DIR}/${h}.hxx
- @ONLY IMMEDIATE)
+ @ONLY)
set(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${KWSYS_HEADER_DIR}/${h}.hxx)
# Create an install target for the header.
diff --git a/Source/kwsys/CONTRIBUTING.rst b/Source/kwsys/CONTRIBUTING.rst
index d62afa5..e9c58a3 100644
--- a/Source/kwsys/CONTRIBUTING.rst
+++ b/Source/kwsys/CONTRIBUTING.rst
@@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes.
Code Style
==========
-We use `clang-format`_ version **15** to define our style for C++ code in
+We use `clang-format`_ version **18** to define our style for C++ code in
the KWSys source tree. See the `.clang-format`_ configuration file for
our style settings. Use the `clang-format.bash`_ script to format source
code. It automatically runs ``clang-format`` on the set of source files
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 61703ad..d39a279 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -42,13 +42,13 @@ namespace KWSYS_NAMESPACE {
struct CommandLineArgumentsCallbackStructure
{
- const char* Argument;
+ char const* Argument;
int ArgumentType;
CommandLineArguments::CallbackType Callback;
void* CallData;
void* Variable;
int VariableType;
- const char* Help;
+ char const* Help;
};
class CommandLineArgumentsVectorOfStrings : public std::vector<std::string>
@@ -97,7 +97,7 @@ CommandLineArguments::~CommandLineArguments()
delete this->Internals;
}
-void CommandLineArguments::Initialize(int argc, const char* const argv[])
+void CommandLineArguments::Initialize(int argc, char const* const argv[])
{
int cc;
@@ -110,7 +110,7 @@ void CommandLineArguments::Initialize(int argc, const char* const argv[])
void CommandLineArguments::Initialize(int argc, char* argv[])
{
- this->Initialize(argc, static_cast<const char* const*>(argv));
+ this->Initialize(argc, static_cast<char const* const*>(argv));
}
void CommandLineArguments::Initialize()
@@ -119,13 +119,13 @@ void CommandLineArguments::Initialize()
this->Internals->LastArgument = 0;
}
-void CommandLineArguments::ProcessArgument(const char* arg)
+void CommandLineArguments::ProcessArgument(char const* arg)
{
this->Internals->Argv.push_back(arg);
}
bool CommandLineArguments::GetMatchedArguments(
- std::vector<std::string>* matches, const std::string& arg)
+ std::vector<std::string>* matches, std::string const& arg)
{
matches->clear();
CommandLineArguments::Internal::CallbacksMap::iterator it;
@@ -133,7 +133,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) {
- const CommandLineArguments::Internal::String& parg = it->first;
+ CommandLineArguments::Internal::String const& parg = it->first;
CommandLineArgumentsCallbackStructure* cs = &it->second;
if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT ||
cs->ArgumentType == CommandLineArguments::SPACE_ARGUMENT) {
@@ -155,7 +155,7 @@ int CommandLineArguments::Parse()
this->Internals->UnusedArguments.clear();
}
for (cc = 0; cc < this->Internals->Argv.size(); cc++) {
- const std::string& arg = this->Internals->Argv[cc];
+ std::string const& arg = this->Internals->Argv[cc];
CommandLineArguments_DEBUG("Process argument: " << arg);
this->Internals->LastArgument = cc;
if (this->GetMatchedArguments(&matches, arg)) {
@@ -174,7 +174,7 @@ int CommandLineArguments::Parse()
// additional value
CommandLineArgumentsCallbackStructure* cs =
&this->Internals->Callbacks[matches[maxidx]];
- const std::string& sarg = matches[maxidx];
+ std::string const& sarg = matches[maxidx];
if (cs->Argument != sarg) {
abort();
}
@@ -220,7 +220,7 @@ int CommandLineArguments::Parse()
// Suck in all the rest of the arguments
CommandLineArguments_DEBUG("This is a multi argument: " << arg);
for (cc++; cc < this->Internals->Argv.size(); ++cc) {
- const std::string& marg = this->Internals->Argv[cc];
+ std::string const& marg = this->Internals->Argv[cc];
CommandLineArguments_DEBUG(
" check multi argument value: " << marg);
if (this->GetMatchedArguments(&matches, marg)) {
@@ -320,13 +320,13 @@ void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv)
for (cc = 0; cc < argc; ++cc) {
delete[] (*argv)[cc];
}
- delete[] * argv;
+ delete[] *argv;
}
-void CommandLineArguments::AddCallback(const char* argument,
+void CommandLineArguments::AddCallback(char const* argument,
ArgumentTypeEnum type,
CallbackType callback, void* call_data,
- const char* help)
+ char const* help)
{
CommandLineArgumentsCallbackStructure s;
s.Argument = argument;
@@ -341,10 +341,10 @@ void CommandLineArguments::AddCallback(const char* argument,
this->GenerateHelp();
}
-void CommandLineArguments::AddArgument(const char* argument,
+void CommandLineArguments::AddArgument(char const* argument,
ArgumentTypeEnum type,
VariableTypeEnum vtype, void* variable,
- const char* help)
+ char const* help)
{
CommandLineArgumentsCallbackStructure s;
s.Argument = argument;
@@ -416,7 +416,7 @@ void CommandLineArguments::SetUnknownArgumentCallback(
this->Internals->UnknownArgumentCallback = callback;
}
-const char* CommandLineArguments::GetHelp(const char* arg)
+char const* CommandLineArguments::GetHelp(char const* arg)
{
auto it = this->Internals->Callbacks.find(arg);
if (it == this->Internals->Callbacks.end()) {
@@ -445,7 +445,7 @@ void CommandLineArguments::SetLineLength(unsigned int ll)
this->GenerateHelp();
}
-const char* CommandLineArguments::GetArgv0()
+char const* CommandLineArguments::GetArgv0()
{
return this->Internals->Argv0.c_str();
}
@@ -547,7 +547,7 @@ void CommandLineArguments::GenerateHelp()
}
str << " " << argument.substr(0, maxstrlen) << " ";
}
- const char* ptr = this->Internals->Callbacks[mpit->first].Help;
+ char const* ptr = this->Internals->Callbacks[mpit->first].Help;
size_t len = strlen(ptr);
int cnt = 0;
while (len > 0) {
@@ -598,7 +598,7 @@ void CommandLineArguments::GenerateHelp()
}
void CommandLineArguments::PopulateVariable(bool* variable,
- const std::string& value)
+ std::string const& value)
{
if (value == "1" || value == "ON" || value == "on" || value == "On" ||
value == "TRUE" || value == "true" || value == "True" ||
@@ -610,7 +610,7 @@ void CommandLineArguments::PopulateVariable(bool* variable,
}
void CommandLineArguments::PopulateVariable(int* variable,
- const std::string& value)
+ std::string const& value)
{
char* res = nullptr;
*variable = static_cast<int>(strtol(value.c_str(), &res, 10));
@@ -621,7 +621,7 @@ void CommandLineArguments::PopulateVariable(int* variable,
}
void CommandLineArguments::PopulateVariable(double* variable,
- const std::string& value)
+ std::string const& value)
{
char* res = nullptr;
*variable = strtod(value.c_str(), &res);
@@ -632,21 +632,21 @@ void CommandLineArguments::PopulateVariable(double* variable,
}
void CommandLineArguments::PopulateVariable(char** variable,
- const std::string& value)
+ std::string const& value)
{
- delete[] * variable;
+ delete[] *variable;
*variable = new char[value.size() + 1];
strcpy(*variable, value.c_str());
}
void CommandLineArguments::PopulateVariable(std::string* variable,
- const std::string& value)
+ std::string const& value)
{
*variable = value;
}
void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
- const std::string& value)
+ std::string const& value)
{
bool val = false;
if (value == "1" || value == "ON" || value == "on" || value == "On" ||
@@ -658,7 +658,7 @@ void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
}
void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
- const std::string& value)
+ std::string const& value)
{
char* res = nullptr;
variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
@@ -669,7 +669,7 @@ void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
}
void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
- const std::string& value)
+ std::string const& value)
{
char* res = nullptr;
variable->push_back(strtod(value.c_str(), &res));
@@ -680,7 +680,7 @@ void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
}
void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
- const std::string& value)
+ std::string const& value)
{
char* var = new char[value.size() + 1];
strcpy(var, value.c_str());
@@ -688,13 +688,13 @@ void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
}
void CommandLineArguments::PopulateVariable(std::vector<std::string>* variable,
- const std::string& value)
+ std::string const& value)
{
variable->push_back(value);
}
bool CommandLineArguments::PopulateVariable(
- CommandLineArgumentsCallbackStructure* cs, const char* value)
+ CommandLineArgumentsCallbackStructure* cs, char const* value)
{
// Call the callback
if (cs->Callback) {
diff --git a/Source/kwsys/CommandLineArguments.hxx.in b/Source/kwsys/CommandLineArguments.hxx.in
index 7db9015..0c06e46 100644
--- a/Source/kwsys/CommandLineArguments.hxx.in
+++ b/Source/kwsys/CommandLineArguments.hxx.in
@@ -62,8 +62,8 @@ public:
CommandLineArguments();
~CommandLineArguments();
- CommandLineArguments(const CommandLineArguments&) = delete;
- CommandLineArguments& operator=(const CommandLineArguments&) = delete;
+ CommandLineArguments(CommandLineArguments const&) = delete;
+ CommandLineArguments& operator=(CommandLineArguments const&) = delete;
/**
* Various argument types.
@@ -100,14 +100,14 @@ public:
/**
* Prototypes for callbacks for callback interface.
*/
- typedef int (*CallbackType)(const char* argument, const char* value,
+ typedef int (*CallbackType)(char const* argument, char const* value,
void* call_data);
- typedef int (*ErrorCallbackType)(const char* argument, void* client_data);
+ typedef int (*ErrorCallbackType)(char const* argument, void* client_data);
/**
* Initialize internal data structures. This should be called before parsing.
*/
- void Initialize(int argc, const char* const argv[]);
+ void Initialize(int argc, char const* const argv[]);
void Initialize(int argc, char* argv[]);
/**
@@ -116,7 +116,7 @@ public:
* are not available.
*/
void Initialize();
- void ProcessArgument(const char* arg);
+ void ProcessArgument(char const* arg);
/**
* This method will parse arguments and call appropriate methods.
@@ -129,56 +129,56 @@ public:
* argument help specifies the help string used with this option. The
* callback and call_data can be skipped.
*/
- void AddCallback(const char* argument, ArgumentTypeEnum type,
- CallbackType callback, void* call_data, const char* help);
+ void AddCallback(char const* argument, ArgumentTypeEnum type,
+ CallbackType callback, void* call_data, char const* help);
/**
* Add handler for argument which is going to set the variable to the
* specified value. If the argument is specified, the option is casted to the
* appropriate type.
*/
- void AddArgument(const char* argument, ArgumentTypeEnum type, bool* variable,
- const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type, int* variable,
- const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- double* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- char** variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::string* variable, const char* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type, bool* variable,
+ char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type, int* variable,
+ char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ double* variable, char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ char** variable, char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ std::string* variable, char const* help);
/**
* Add handler for argument which is going to set the variable to the
* specified value. If the argument is specified, the option is casted to the
* appropriate type. This will handle the multi argument values.
*/
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<bool>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<int>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<double>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<char*>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<std::string>* variable, const char* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ std::vector<bool>* variable, char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ std::vector<int>* variable, char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ std::vector<double>* variable, char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ std::vector<char*>* variable, char const* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ std::vector<std::string>* variable, char const* help);
/**
* Add handler for boolean argument. The argument does not take any option
* and if it is specified, the value of the variable is true/1, otherwise it
* is false/0.
*/
- void AddBooleanArgument(const char* argument, bool* variable,
- const char* help);
- void AddBooleanArgument(const char* argument, int* variable,
- const char* help);
- void AddBooleanArgument(const char* argument, double* variable,
- const char* help);
- void AddBooleanArgument(const char* argument, char** variable,
- const char* help);
- void AddBooleanArgument(const char* argument, std::string* variable,
- const char* help);
+ void AddBooleanArgument(char const* argument, bool* variable,
+ char const* help);
+ void AddBooleanArgument(char const* argument, int* variable,
+ char const* help);
+ void AddBooleanArgument(char const* argument, double* variable,
+ char const* help);
+ void AddBooleanArgument(char const* argument, char** variable,
+ char const* help);
+ void AddBooleanArgument(char const* argument, std::string* variable,
+ char const* help);
/**
* Set the callbacks for error handling.
@@ -205,8 +205,8 @@ public:
* Return string containing help. If the argument is specified, only return
* help for that argument.
*/
- const char* GetHelp() { return this->Help.c_str(); }
- const char* GetHelp(const char* arg);
+ char const* GetHelp() { return this->Help.c_str(); }
+ char const* GetHelp(char const* arg);
/**
* Get / Set the help line length. This length is used when generating the
@@ -219,7 +219,7 @@ public:
* Get the executable name (argv0). This is only available when using
* Initialize with argc/argv.
*/
- const char* GetArgv0();
+ char const* GetArgv0();
/**
* Get index of the last argument parsed. This is the last argument that was
@@ -231,30 +231,30 @@ protected:
void GenerateHelp();
//! This is internal method that registers variable with argument
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- VariableTypeEnum vtype, void* variable, const char* help);
+ void AddArgument(char const* argument, ArgumentTypeEnum type,
+ VariableTypeEnum vtype, void* variable, char const* help);
bool GetMatchedArguments(std::vector<std::string>* matches,
- const std::string& arg);
+ std::string const& arg);
//! Populate individual variables
bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
- const char* value);
+ char const* value);
//! Populate individual variables of type ...
- void PopulateVariable(bool* variable, const std::string& value);
- void PopulateVariable(int* variable, const std::string& value);
- void PopulateVariable(double* variable, const std::string& value);
- void PopulateVariable(char** variable, const std::string& value);
- void PopulateVariable(std::string* variable, const std::string& value);
- void PopulateVariable(std::vector<bool>* variable, const std::string& value);
- void PopulateVariable(std::vector<int>* variable, const std::string& value);
+ void PopulateVariable(bool* variable, std::string const& value);
+ void PopulateVariable(int* variable, std::string const& value);
+ void PopulateVariable(double* variable, std::string const& value);
+ void PopulateVariable(char** variable, std::string const& value);
+ void PopulateVariable(std::string* variable, std::string const& value);
+ void PopulateVariable(std::vector<bool>* variable, std::string const& value);
+ void PopulateVariable(std::vector<int>* variable, std::string const& value);
void PopulateVariable(std::vector<double>* variable,
- const std::string& value);
+ std::string const& value);
void PopulateVariable(std::vector<char*>* variable,
- const std::string& value);
+ std::string const& value);
void PopulateVariable(std::vector<std::string>* variable,
- const std::string& value);
+ std::string const& value);
typedef CommandLineArgumentsInternal Internal;
Internal* Internals;
diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in
index 8d47340..b4b0efa 100644
--- a/Source/kwsys/Configure.hxx.in
+++ b/Source/kwsys/Configure.hxx.in
@@ -11,9 +11,6 @@
/* Whether <ext/stdio_filebuf.h> is available. */
#define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H \
@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@
-/* Whether the translation map is available or not. */
-#define @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP \
- @KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@
#if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute)
# define @KWSYS_NAMESPACE@_has_cpp_attribute(x) __has_attribute(x)
@@ -58,8 +55,6 @@
# define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \
@KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
# define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH
-# define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP \
- @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP
#endif
#endif
diff --git a/Source/kwsys/ConsoleBuf.hxx.in b/Source/kwsys/ConsoleBuf.hxx.in
index 49dbdf7..b0e3cd5 100644
--- a/Source/kwsys/ConsoleBuf.hxx.in
+++ b/Source/kwsys/ConsoleBuf.hxx.in
@@ -34,14 +34,14 @@ public:
class Manager
{
public:
- Manager(std::basic_ios<CharT, Traits>& ios, const bool err = false)
+ Manager(std::basic_ios<CharT, Traits>& ios, bool const err = false)
: m_consolebuf(0)
{
m_ios = &ios;
try {
m_consolebuf = new BasicConsoleBuf<CharT, Traits>(err);
m_streambuf = m_ios->rdbuf(m_consolebuf);
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
std::cerr << "Failed to create ConsoleBuf!" << std::endl
<< ex.what() << std::endl;
};
@@ -72,7 +72,7 @@ public:
BasicConsoleBuf<CharT, Traits>* m_consolebuf;
};
- BasicConsoleBuf(const bool err = false)
+ BasicConsoleBuf(bool const err = false)
: flush_on_newline(true)
, input_pipe_codepage(0)
, output_pipe_codepage(0)
@@ -111,7 +111,7 @@ protected:
success = false;
}
if (m_hOutput && !m_obuffer.empty()) {
- const std::wstring wbuffer = getBuffer(m_obuffer);
+ std::wstring const wbuffer = getBuffer(m_obuffer);
if (m_isConsoleOutput) {
DWORD charsWritten;
success =
@@ -320,17 +320,17 @@ private:
this->setp((char_type*)m_obuffer.data(),
(char_type*)m_obuffer.data() + m_obuffer.size());
}
- bool encodeOutputBuffer(const std::wstring wbuffer, std::string& buffer)
+ bool encodeOutputBuffer(std::wstring const wbuffer, std::string& buffer)
{
if (wbuffer.size() == 0) {
buffer = std::string();
return true;
}
- const int length =
+ int const length =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), nullptr, 0, nullptr, nullptr);
char* buf = new char[length];
- const bool success =
+ bool const success =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), buf, length, nullptr,
nullptr) > 0
@@ -340,7 +340,7 @@ private:
delete[] buf;
return success;
}
- bool decodeInputBuffer(const std::string buffer, std::wstring& wbuffer)
+ bool decodeInputBuffer(std::string const buffer, std::wstring& wbuffer)
{
size_t length = buffer.length();
if (length == 0) {
@@ -348,19 +348,19 @@ private:
return true;
}
int actualCodepage = m_activeInputCodepage;
- const char BOM_UTF8[] = { char(0xEF), char(0xBB), char(0xBF) };
- const char* data = buffer.data();
- const size_t BOMsize = sizeof(BOM_UTF8);
+ char const BOM_UTF8[] = { char(0xEF), char(0xBB), char(0xBF) };
+ char const* data = buffer.data();
+ size_t const BOMsize = sizeof(BOM_UTF8);
if (length >= BOMsize && std::memcmp(data, BOM_UTF8, BOMsize) == 0) {
// PowerShell uses UTF-8 with BOM for pipes
actualCodepage = CP_UTF8;
data += BOMsize;
length -= BOMsize;
}
- const size_t wlength = static_cast<size_t>(MultiByteToWideChar(
+ size_t const wlength = static_cast<size_t>(MultiByteToWideChar(
actualCodepage, 0, data, static_cast<int>(length), nullptr, 0));
wchar_t* wbuf = new wchar_t[wlength];
- const bool success =
+ bool const success =
MultiByteToWideChar(actualCodepage, 0, data, static_cast<int>(length),
wbuf, static_cast<int>(wlength)) > 0
? true
@@ -369,19 +369,19 @@ private:
delete[] wbuf;
return success;
}
- std::wstring getBuffer(const std::basic_string<char> buffer)
+ std::wstring getBuffer(std::basic_string<char> const buffer)
{
return Encoding::ToWide(buffer);
}
- std::wstring getBuffer(const std::basic_string<wchar_t> buffer)
+ std::wstring getBuffer(std::basic_string<wchar_t> const buffer)
{
return buffer;
}
- void setBuffer(const std::wstring wbuffer, std::basic_string<char>& target)
+ void setBuffer(std::wstring const wbuffer, std::basic_string<char>& target)
{
target = Encoding::ToNarrow(wbuffer);
}
- void setBuffer(const std::wstring wbuffer,
+ void setBuffer(std::wstring const wbuffer,
std::basic_string<wchar_t>& target)
{
target = wbuffer;
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 6e4f0a8..b23c624 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -92,7 +92,7 @@ unsigned long Directory::GetNumberOfFiles() const
return static_cast<unsigned long>(this->Internal->Files.size());
}
-const char* Directory::GetFile(unsigned long dindex) const
+char const* Directory::GetFile(unsigned long dindex) const
{
return this->Internal->Files[dindex].Name.c_str();
}
@@ -135,7 +135,7 @@ bool Directory::FileIsSymlink(std::size_t i) const
#endif
}
-const char* Directory::GetPath() const
+char const* Directory::GetPath() const
{
return this->Internal->Path.c_str();
}
@@ -207,7 +207,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
return Status::Success();
}
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
+unsigned long Directory::GetNumberOfFilesInDirectory(std::string const& name,
std::string* errorMessage)
{
HANDLE srchHandle;
@@ -314,7 +314,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
return Status::Success();
}
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
+unsigned long Directory::GetNumberOfFilesInDirectory(std::string const& name,
std::string* errorMessage)
{
errno = 0;
diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in
index 9d0f462..c264fff 100644
--- a/Source/kwsys/Directory.hxx.in
+++ b/Source/kwsys/Directory.hxx.in
@@ -26,10 +26,10 @@ class @KWSYS_NAMESPACE@_EXPORT Directory
public:
Directory();
Directory(Directory&& other);
- Directory(const Directory&) = delete;
- Directory& operator=(const Directory&) = delete;
+ Directory(Directory const&) = delete;
+ Directory& operator=(Directory const&) = delete;
Directory& operator=(Directory&& other);
- bool operator==(const Directory&) = delete;
+ bool operator==(Directory const&) = delete;
~Directory();
/**
@@ -48,12 +48,12 @@ public:
* A higher performance static method.
*/
static unsigned long GetNumberOfFilesInDirectory(
- const std::string&, std::string* errorMessage = nullptr);
+ std::string const&, std::string* errorMessage = nullptr);
/**
* Return the file at the given index, the indexing is 0 based
*/
- const char* GetFile(unsigned long) const;
+ char const* GetFile(unsigned long) const;
/**
* Return the name of the file at the given 0-based index.
@@ -78,7 +78,7 @@ public:
/**
* Return the path to Open'ed directory
*/
- const char* GetPath() const;
+ char const* GetPath() const;
/**
* Clear the internal structure. Used internally at beginning of Load(...)
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx
index 8afc2e8..c39bc0b 100644
--- a/Source/kwsys/DynamicLoader.cxx
+++ b/Source/kwsys/DynamicLoader.cxx
@@ -46,7 +46,7 @@
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
return DynamicLoader::OpenLibrary(libname, 0);
}
@@ -59,7 +59,7 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
return 0;
}
@@ -74,12 +74,12 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
return 0;
}
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
return "General error";
}
@@ -94,7 +94,7 @@ const char* DynamicLoader::LastError()
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, 0, 0);
@@ -110,7 +110,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
void* addr;
int status;
@@ -127,7 +127,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
}
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
// TODO: Need implementation with errno/strerror
/* If successful, shl_findsym returns an integer (int) value zero. If
@@ -159,7 +159,7 @@ const char* DynamicLoader::LastError()
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, 0, 0);
@@ -190,7 +190,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
void* result = 0;
// Need to prepend symbols with '_' on Apple-gcc compilers
@@ -205,7 +205,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
}
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
return 0;
}
@@ -221,7 +221,7 @@ const char* DynamicLoader::LastError()
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, nullptr);
@@ -240,7 +240,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// TODO: The calling convention affects the name of the symbol. We
// should have a tool to help get the symbol with the desired
@@ -254,14 +254,14 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
// Note that the "@X" part of the name above is the total size (in
// bytes) of the arguments on the stack.
void* result;
- const char* rsym = sym.c_str();
+ char const* rsym = sym.c_str();
result = (void*)GetProcAddress(lib, rsym);
return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
}
# define DYNLOAD_ERROR_BUFFER_SIZE 1024
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
wchar_t lpMsgBuf[DYNLOAD_ERROR_BUFFER_SIZE + 1];
@@ -308,7 +308,7 @@ namespace KWSYS_NAMESPACE {
static image_id last_dynamic_err = B_OK;
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, 0, 0);
@@ -341,7 +341,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -368,9 +368,9 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return result.psym;
}
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
- const char* retval = strerror(last_dynamic_err);
+ char const* retval = strerror(last_dynamic_err);
last_dynamic_err = B_OK;
return retval;
}
@@ -388,7 +388,7 @@ const char* DynamicLoader::LastError()
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, 0, nullptr);
@@ -407,7 +407,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -419,7 +419,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return result.psym;
}
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
return dld_strerror(dld_errno);
}
@@ -434,7 +434,7 @@ const char* DynamicLoader::LastError()
namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
+ std::string const& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, RTLDGlobal, nullptr);
@@ -457,7 +457,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -469,7 +469,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return result.psym;
}
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
{
return dlerror();
}
diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in
index 4edd31c..966996e 100644
--- a/Source/kwsys/DynamicLoader.hxx.in
+++ b/Source/kwsys/DynamicLoader.hxx.in
@@ -86,24 +86,24 @@ public:
* library. The optional second argument is a set of flags to use when
* opening the library. If unrecognized or unsupported flags are specified,
* the library is not opened. */
- static LibraryHandle OpenLibrary(const std::string&);
- static LibraryHandle OpenLibrary(const std::string&, int);
+ static LibraryHandle OpenLibrary(std::string const&);
+ static LibraryHandle OpenLibrary(std::string const&, int);
/** Attempt to detach a dynamic library from the
* process. A value of true is returned if it is successful. */
static int CloseLibrary(LibraryHandle);
/** Find the address of the symbol in the given library. */
- static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
+ static SymbolPointer GetSymbolAddress(LibraryHandle, std::string const&);
/** Return the default module prefix for the current platform. */
- static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
+ static char const* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
/** Return the default module suffix for the current platform. */
- static const char* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; }
+ static char const* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; }
/** Return the last error produced from a calls made on this class. */
- static const char* LastError();
+ static char const* LastError();
}; // End Class: DynamicLoader
} // namespace @KWSYS_NAMESPACE@
diff --git a/Source/kwsys/Encoding.h.in b/Source/kwsys/Encoding.h.in
index 86a2669..2ce67e5 100644
--- a/Source/kwsys/Encoding.h.in
+++ b/Source/kwsys/Encoding.h.in
@@ -31,22 +31,22 @@ extern "C" {
On Windows, UTF-8 is assumed, and on other platforms,
the current locale is assumed.
*/
-kwsysEXPORT size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* src,
+kwsysEXPORT size_t kwsysEncoding_mbstowcs(wchar_t* dest, char const* src,
size_t n);
/* Convert a narrow string to a wide string.
This can return NULL if the conversion fails. */
-kwsysEXPORT wchar_t* kwsysEncoding_DupToWide(const char* src);
+kwsysEXPORT wchar_t* kwsysEncoding_DupToWide(char const* src);
/* Convert a wide string to a narrow string.
On Windows, UTF-8 is assumed, and on other platforms,
the current locale is assumed. */
-kwsysEXPORT size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* src,
+kwsysEXPORT size_t kwsysEncoding_wcstombs(char* dest, wchar_t const* src,
size_t n);
/* Convert a wide string to a narrow string.
This can return NULL if the conversion fails. */
-kwsysEXPORT char* kwsysEncoding_DupToNarrow(const wchar_t* str);
+kwsysEXPORT char* kwsysEncoding_DupToNarrow(wchar_t const* str);
#if defined(__cplusplus)
} /* extern "C" */
diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in
index 75a2d4d..0353db3 100644
--- a/Source/kwsys/Encoding.hxx.in
+++ b/Source/kwsys/Encoding.hxx.in
@@ -31,8 +31,8 @@ public:
// argc and wide argv. This is useful if wmain() is used.
CommandLineArguments(int argc, wchar_t const* const* argv);
~CommandLineArguments();
- CommandLineArguments(const CommandLineArguments&);
- CommandLineArguments& operator=(const CommandLineArguments&);
+ CommandLineArguments(CommandLineArguments const&);
+ CommandLineArguments& operator=(CommandLineArguments const&);
int argc() const;
char const* const* argv() const;
@@ -50,14 +50,14 @@ public:
// Convert a narrow string to a wide string.
// On Windows, UTF-8 is assumed, and on other platforms,
// the current locale is assumed.
- static std::wstring ToWide(const std::string& str);
- static std::wstring ToWide(const char* str);
+ static std::wstring ToWide(std::string const& str);
+ static std::wstring ToWide(char const* str);
// Convert a wide string to a narrow string.
// On Windows, UTF-8 is assumed, and on other platforms,
// the current locale is assumed.
- static std::string ToNarrow(const std::wstring& str);
- static std::string ToNarrow(const wchar_t* str);
+ static std::string ToNarrow(std::wstring const& str);
+ static std::string ToNarrow(wchar_t const* str);
# if defined(_WIN32)
/**
@@ -68,7 +68,7 @@ public:
* absolute paths with Windows-style backslashes.
**/
static std::wstring ToWindowsExtendedPath(std::string const&);
- static std::wstring ToWindowsExtendedPath(const char* source);
+ static std::wstring ToWindowsExtendedPath(char const* source);
static std::wstring ToWindowsExtendedPath(std::wstring const& wsource);
# endif
diff --git a/Source/kwsys/EncodingC.c b/Source/kwsys/EncodingC.c
index 13127f1..3dbb9c5 100644
--- a/Source/kwsys/EncodingC.c
+++ b/Source/kwsys/EncodingC.c
@@ -15,7 +15,7 @@
# include <windows.h>
#endif
-size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* str, size_t n)
+size_t kwsysEncoding_mbstowcs(wchar_t* dest, char const* str, size_t n)
{
if (str == 0) {
return (size_t)-1;
@@ -29,7 +29,7 @@ size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* str, size_t n)
#endif
}
-wchar_t* kwsysEncoding_DupToWide(const char* str)
+wchar_t* kwsysEncoding_DupToWide(char const* str)
{
wchar_t* ret = NULL;
size_t length = kwsysEncoding_mbstowcs(NULL, str, 0) + 1;
@@ -43,7 +43,7 @@ wchar_t* kwsysEncoding_DupToWide(const char* str)
return ret;
}
-size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
+size_t kwsysEncoding_wcstombs(char* dest, wchar_t const* str, size_t n)
{
if (str == 0) {
return (size_t)-1;
@@ -57,7 +57,7 @@ size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
#endif
}
-char* kwsysEncoding_DupToNarrow(const wchar_t* str)
+char* kwsysEncoding_DupToNarrow(wchar_t const* str)
{
char* ret = NULL;
size_t length = kwsysEncoding_wcstombs(NULL, str, 0) + 1;
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index c68c73c..922dffd 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -86,7 +86,7 @@ Encoding::CommandLineArguments::~CommandLineArguments()
}
Encoding::CommandLineArguments::CommandLineArguments(
- const CommandLineArguments& other)
+ CommandLineArguments const& other)
{
this->argv_.resize(other.argv_.size());
for (size_t i = 0; i < this->argv_.size(); i++) {
@@ -95,7 +95,7 @@ Encoding::CommandLineArguments::CommandLineArguments(
}
Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(
- const CommandLineArguments& other)
+ CommandLineArguments const& other)
{
if (this != &other) {
size_t i;
@@ -124,11 +124,11 @@ char const* const* Encoding::CommandLineArguments::argv() const
#if KWSYS_STL_HAS_WSTRING
-std::wstring Encoding::ToWide(const std::string& str)
+std::wstring Encoding::ToWide(std::string const& str)
{
std::wstring wstr;
# if defined(_WIN32)
- const int wlength =
+ int const wlength =
MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
int(str.size()), nullptr, 0);
if (wlength > 0) {
@@ -157,7 +157,7 @@ std::wstring Encoding::ToWide(const std::string& str)
return wstr;
}
-std::string Encoding::ToNarrow(const std::wstring& str)
+std::string Encoding::ToNarrow(std::wstring const& str)
{
std::string nstr;
# if defined(_WIN32)
@@ -191,28 +191,32 @@ std::string Encoding::ToNarrow(const std::wstring& str)
return nstr;
}
-std::wstring Encoding::ToWide(const char* cstr)
+std::wstring Encoding::ToWide(char const* cstr)
{
std::wstring wstr;
- size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0) + 1;
- if (length > 0) {
- std::vector<wchar_t> wchars(length);
- if (kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) {
- wstr = &wchars[0];
- }
+ size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0);
+ if (length == 0 || length == static_cast<size_t>(-1)) {
+ return wstr;
+ }
+ ++length;
+ std::vector<wchar_t> wchars(length);
+ if (kwsysEncoding_mbstowcs(wchars.data(), cstr, length) > 0) {
+ wstr = wchars.data();
}
return wstr;
}
-std::string Encoding::ToNarrow(const wchar_t* wcstr)
+std::string Encoding::ToNarrow(wchar_t const* wcstr)
{
std::string str;
- size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0) + 1;
- if (length > 0) {
- std::vector<char> chars(length);
- if (kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0) {
- str = &chars[0];
- }
+ size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0);
+ if (length == 0 || length == static_cast<size_t>(-1)) {
+ return str;
+ }
+ ++length;
+ std::vector<char> chars(length);
+ if (kwsysEncoding_wcstombs(chars.data(), wcstr, length) > 0) {
+ str = chars.data();
}
return str;
}
@@ -225,7 +229,7 @@ std::wstring Encoding::ToWindowsExtendedPath(std::string const& source)
}
// Convert local paths to UNC style paths
-std::wstring Encoding::ToWindowsExtendedPath(const char* source)
+std::wstring Encoding::ToWindowsExtendedPath(char const* source)
{
return ToWindowsExtendedPath(ToWide(source));
}
diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in
index 55a7fb1..d6d6f84 100644
--- a/Source/kwsys/FStream.hxx.in
+++ b/Source/kwsys/FStream.hxx.in
@@ -33,7 +33,7 @@ public:
typedef std::basic_filebuf<CharType, Traits> my_base_type;
basic_filebuf* open(char const* s, std::ios_base::openmode mode)
{
- const std::wstring wstr = Encoding::ToWindowsExtendedPath(s);
+ std::wstring const wstr = Encoding::ToWindowsExtendedPath(s);
return static_cast<basic_filebuf*>(my_base_type::open(wstr.c_str(), mode));
}
# endif
@@ -41,7 +41,7 @@ public:
# else
-inline std::wstring getcmode(const std::ios_base::openmode mode)
+inline std::wstring getcmode(std::ios_base::openmode const mode)
{
std::wstring cmode;
bool plus = false;
@@ -91,9 +91,9 @@ public:
return false;
}
# if defined(_MSC_VER)
- const bool success = buf_->open(file_name, mode) != 0;
+ bool const success = buf_->open(file_name, mode) != 0;
# else
- const std::wstring wstr = Encoding::ToWindowsExtendedPath(file_name);
+ std::wstring const wstr = Encoding::ToWindowsExtendedPath(file_name);
bool success = false;
std::wstring cmode = getcmode(mode);
file_ = _wfopen(wstr.c_str(), cmode.c_str());
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 92eae41..e2af4ec 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -27,7 +27,7 @@
#include <cstdio>
#include <cstring>
namespace KWSYS_NAMESPACE {
-#if defined(_WIN32) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__APPLE__)
// On Windows and Apple, no difference between lower and upper case
# define KWSYS_GLOB_CASE_INDEPENDENT
#endif
@@ -70,7 +70,7 @@ std::vector<std::string>& Glob::GetFiles()
return this->Internals->Files;
}
-std::string Glob::PatternToRegex(const std::string& pattern,
+std::string Glob::PatternToRegex(std::string const& pattern,
bool require_whole_string, bool preserve_case)
{
// Incrementally build the regular expression from the pattern.
@@ -179,7 +179,7 @@ std::string Glob::PatternToRegex(const std::string& pattern,
}
bool Glob::RecurseDirectory(std::string::size_type start,
- const std::string& dir, GlobMessages* messages)
+ std::string const& dir, GlobMessages* messages)
{
kwsys::Directory d;
std::string errorMessage;
@@ -281,7 +281,7 @@ bool Glob::RecurseDirectory(std::string::size_type start,
}
void Glob::ProcessDirectory(std::string::size_type start,
- const std::string& dir, GlobMessages* messages)
+ std::string const& dir, GlobMessages* messages)
{
// std::cout << "ProcessDirectory: " << dir << std::endl;
bool last = (start == this->Internals->Expressions.size() - 1);
@@ -341,7 +341,7 @@ void Glob::ProcessDirectory(std::string::size_type start,
}
}
-bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
+bool Glob::FindFiles(std::string const& inexpr, GlobMessages* messages)
{
std::string cexpr;
std::string::size_type cc;
@@ -422,12 +422,12 @@ bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
return true;
}
-void Glob::AddExpression(const std::string& expr)
+void Glob::AddExpression(std::string const& expr)
{
this->Internals->Expressions.emplace_back(this->PatternToRegex(expr));
}
-void Glob::SetRelative(const char* dir)
+void Glob::SetRelative(char const* dir)
{
if (!dir) {
this->Relative = "";
@@ -436,7 +436,7 @@ void Glob::SetRelative(const char* dir)
this->Relative = dir;
}
-const char* Glob::GetRelative()
+char const* Glob::GetRelative()
{
if (this->Relative.empty()) {
return nullptr;
@@ -444,7 +444,7 @@ const char* Glob::GetRelative()
return this->Relative.c_str();
}
-void Glob::AddFile(std::vector<std::string>& files, const std::string& file)
+void Glob::AddFile(std::vector<std::string>& files, std::string const& file)
{
if (!this->Relative.empty()) {
files.push_back(kwsys::SystemTools::RelativePath(this->Relative, file));
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index fd39775..6a33bda 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -37,13 +37,13 @@ public:
MessageType type;
std::string content;
- Message(MessageType t, const std::string& c)
+ Message(MessageType t, std::string const& c)
: type(t)
, content(c)
{
}
~Message() = default;
- Message(const Message& msg) = default;
+ Message(Message const& msg) = default;
Message& operator=(Message const& msg) = default;
};
@@ -54,11 +54,11 @@ public:
Glob();
~Glob();
- Glob(const Glob&) = delete;
- void operator=(const Glob&) = delete;
+ Glob(Glob const&) = delete;
+ void operator=(Glob const&) = delete;
//! Find all files that match the pattern.
- bool FindFiles(const std::string& inexpr, GlobMessages* messages = nullptr);
+ bool FindFiles(std::string const& inexpr, GlobMessages* messages = nullptr);
//! Return the list of files that matched.
std::vector<std::string>& GetFiles();
@@ -80,8 +80,8 @@ public:
unsigned int GetFollowedSymlinkCount() { return this->FollowedSymlinkCount; }
//! Set relative to true to only show relative path to files.
- void SetRelative(const char* dir);
- const char* GetRelative();
+ void SetRelative(char const* dir);
+ char const* GetRelative();
/** Convert the given globbing pattern to a regular expression.
There is no way to quote meta-characters. The
@@ -90,7 +90,7 @@ public:
string. This is on by default because patterns always match
whole strings, but may be disabled to support concatenating
expressions more easily (regex1|regex2|etc). */
- static std::string PatternToRegex(const std::string& pattern,
+ static std::string PatternToRegex(std::string const& pattern,
bool require_whole_string = true,
bool preserve_case = false);
@@ -105,19 +105,19 @@ public:
protected:
//! Process directory
- void ProcessDirectory(std::string::size_type start, const std::string& dir,
+ void ProcessDirectory(std::string::size_type start, std::string const& dir,
GlobMessages* messages);
//! Process last directory, but only when recurse flags is on. That is
// effectively like saying: /path/to/file/**/file
- bool RecurseDirectory(std::string::size_type start, const std::string& dir,
+ bool RecurseDirectory(std::string::size_type start, std::string const& dir,
GlobMessages* messages);
//! Add regular expression
- void AddExpression(const std::string& expr);
+ void AddExpression(std::string const& expr);
//! Add a file to the list
- void AddFile(std::vector<std::string>& files, const std::string& file);
+ void AddFile(std::vector<std::string>& files, std::string const& file);
GlobInternals* Internals;
bool Recurse;
diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c
index b0faa0e..d7f196a 100644
--- a/Source/kwsys/MD5.c
+++ b/Source/kwsys/MD5.c
@@ -170,7 +170,7 @@ typedef struct md5_state_s
#define T63 0x2ad7d2bb
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
-static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
+static void md5_process(md5_state_t* pms, md5_byte_t const* data /*[64]*/)
{
md5_word_t a = pms->abcd[0];
md5_word_t b = pms->abcd[1];
@@ -183,7 +183,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
#else
/* Define storage for little-endian or both types of CPUs. */
md5_word_t xbuf[16];
- const md5_word_t* X;
+ md5_word_t const* X;
#endif
{
@@ -193,9 +193,9 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
* little-endian machine, since we can use a more efficient
* algorithm on the latter.
*/
- static const int w = 1;
+ static int const w = 1;
- if (*((const md5_byte_t*)&w)) /* dynamic little-endian */
+ if (*((md5_byte_t const*)&w)) /* dynamic little-endian */
#endif
#if BYTE_ORDER <= 0 /* little-endian */
{
@@ -205,7 +205,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
*/
if (!((uintptr_t)data & 3)) {
/* data are properly aligned */
- X = (const md5_word_t*)data;
+ X = (md5_word_t const*)data;
} else {
/* not aligned */
memcpy(xbuf, data, 64);
@@ -222,7 +222,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
* On big-endian machines, we must arrange the bytes in the
* right order.
*/
- const md5_byte_t* xp = data;
+ md5_byte_t const* xp = data;
int i;
# if BYTE_ORDER == 0
@@ -364,9 +364,9 @@ static void md5_init(md5_state_t* pms)
}
/* Append a string to the message. */
-static void md5_append(md5_state_t* pms, const md5_byte_t* data, size_t nbytes)
+static void md5_append(md5_state_t* pms, md5_byte_t const* data, size_t nbytes)
{
- const md5_byte_t* p = data;
+ md5_byte_t const* p = data;
size_t left = nbytes;
size_t offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
@@ -409,7 +409,7 @@ static void md5_append(md5_state_t* pms, const md5_byte_t* data, size_t nbytes)
/* Finish the message and return the digest. */
static void md5_finish(md5_state_t* pms, md5_byte_t digest[16])
{
- static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ static md5_byte_t const pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/Source/kwsys/Process.h.in b/Source/kwsys/Process.h.in
index 9f2162b..2017d78 100644
--- a/Source/kwsys/Process.h.in
+++ b/Source/kwsys/Process.h.in
@@ -145,14 +145,14 @@ kwsysEXPORT void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout);
* Returns 1 for success and 0 for failure.
*/
kwsysEXPORT int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp,
- const char* dir);
+ char const* dir);
/**
* Set the name of a file to be attached to the given pipe. Returns 1
* for success and 0 for failure.
*/
kwsysEXPORT int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe,
- const char* file);
+ char const* file);
/**
* Set whether the given pipe in the child is shared with the parent
@@ -181,7 +181,7 @@ kwsysEXPORT void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe,
* read end will be closed in the child process.
*/
kwsysEXPORT void kwsysProcess_SetPipeNative(
- kwsysProcess* cp, int pipe, const kwsysProcess_Pipe_Handle p[2]);
+ kwsysProcess* cp, int pipe, kwsysProcess_Pipe_Handle const p[2]);
/**
* Get/Set a possibly platform-specific option. Possible options are:
@@ -537,6 +537,7 @@ kwsysEXPORT void kwsysProcess_ResetStartTime(kwsysProcess* cp);
# undef kwsysProcess_WaitForExit
# undef kwsysProcess_Interrupt
# undef kwsysProcess_Kill
+# undef kwsysProcess_KillPID
# undef kwsysProcess_ResetStartTime
# endif
#endif
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index efe2233..ce6bb7b 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -155,7 +155,7 @@ typedef struct kwsysProcessCreateInformation_s
int ErrorPipe[2];
} kwsysProcessCreateInformation;
-static void kwsysProcessVolatileFree(volatile void* p);
+static void kwsysProcessVolatileFree(void volatile* p);
static int kwsysProcessInitialize(kwsysProcess* cp);
static void kwsysProcessCleanup(kwsysProcess* cp, int error);
static void kwsysProcessCleanupDescriptor(int* pfd);
@@ -164,13 +164,13 @@ static int kwsysProcessSetNonBlocking(int fd);
static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
kwsysProcessCreateInformation* si);
static void kwsysProcessDestroy(kwsysProcess* cp);
-static int kwsysProcessSetupOutputPipeFile(int* p, const char* name);
+static int kwsysProcessSetupOutputPipeFile(int* p, char const* name);
static int kwsysProcessSetupOutputPipeNative(int* p, int des[2]);
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp,
- const double* userTimeout,
+ double const* userTimeout,
kwsysProcessTime* timeoutTime);
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
- const double* userTimeout,
+ double const* userTimeout,
kwsysProcessTimeNative* timeoutLength,
int zeroIsExpired);
static kwsysProcessTime kwsysProcessTimeGetCurrent(void);
@@ -189,7 +189,7 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
kwsysProcessCreateInformation* si);
static void kwsysProcessKill(pid_t process_id);
#if defined(__VMS)
-static int kwsysProcessSetVMSFeature(const char* name, int value);
+static int kwsysProcessSetVMSFeature(char const* name, int value);
#endif
static int kwsysProcessesAdd(kwsysProcess* cp);
static void kwsysProcessesRemove(kwsysProcess* cp);
@@ -225,7 +225,7 @@ struct kwsysProcess_s
{
/* The command lines to execute. */
char*** Commands;
- volatile int NumberOfCommands;
+ int volatile NumberOfCommands;
/* Descriptors for the read ends of the child's output pipes and
the signal pipe. */
@@ -244,7 +244,7 @@ struct kwsysProcess_s
/* Process IDs returned by the calls to fork. Everything is volatile
because the signal handler accesses them. You must be very careful
when reaping PIDs or modifying this array to avoid race conditions. */
- volatile pid_t* volatile ForkPIDs;
+ pid_t volatile* volatile ForkPIDs;
/* Flag for whether the children were terminated by a failed select. */
int SelectError;
@@ -268,7 +268,7 @@ struct kwsysProcess_s
int MergeOutput;
/* Whether to create the process in a new process group. */
- volatile sig_atomic_t CreateProcessGroup;
+ sig_atomic_t volatile CreateProcessGroup;
/* Time at which the child started. Negative for no timeout. */
kwsysProcessTime StartTime;
@@ -292,10 +292,10 @@ struct kwsysProcess_s
/* The status of the process structure. Must be atomic because
the signal handler checks this to avoid a race. */
- volatile sig_atomic_t State;
+ sig_atomic_t volatile State;
/* Whether the process was killed. */
- volatile sig_atomic_t Killed;
+ sig_atomic_t volatile Killed;
/* Buffer for error message in case of failure. */
char ErrorMessage[KWSYSPE_PIPE_BUFFER_SIZE + 1];
@@ -495,7 +495,7 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
cp->TimeoutTime.tv_sec = -1;
}
-int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
+int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, char const* dir)
{
if (!cp) {
return 0;
@@ -519,7 +519,7 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
return 1;
}
-int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
+int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, char const* file)
{
char** pfile;
if (!cp) {
@@ -586,7 +586,7 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared)
}
}
-void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, const int p[2])
+void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, int const p[2])
{
int* pPipeNative = 0;
@@ -695,7 +695,7 @@ int kwsysProcess_GetExitValue(kwsysProcess* cp)
: -1;
}
-const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
+char const* kwsysProcess_GetErrorString(kwsysProcess* cp)
{
if (!cp) {
return "Process management structure could not be allocated";
@@ -706,7 +706,7 @@ const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
return "Success";
}
-const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
+char const* kwsysProcess_GetExceptionString(kwsysProcess* cp)
{
if (!(cp && cp->ProcessResults && (cp->NumberOfCommands > 0))) {
return "GetExceptionString called with NULL process management structure";
@@ -747,7 +747,7 @@ int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx)
return cp->CommandExitCodes[idx];
}
-const char* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
+char const* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
{
KWSYSPE_IDX_CHK("GetExceptionString called with NULL process management "
"structure or index out of bound")
@@ -1260,7 +1260,7 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
/* Poll pipes for data since we do not have select. */
for (i = 0; i < KWSYSPE_PIPE_COUNT; ++i) {
if (cp->PipeReadEnds[i] >= 0) {
- const int fd = cp->PipeReadEnds[i];
+ int const fd = cp->PipeReadEnds[i];
int n = read(fd, cp->PipeBuffer, KWSYSPE_PIPE_BUFFER_SIZE);
if (n > 0) {
/* We have data on this pipe. */
@@ -1486,7 +1486,7 @@ void kwsysProcess_Kill(kwsysProcess* cp)
/* Call the free() function with a pointer to volatile without causing
compiler warnings. */
-static void kwsysProcessVolatileFree(volatile void* p)
+static void kwsysProcessVolatileFree(void volatile* p)
{
/* clang has made it impossible to free memory that points to volatile
without first using special pragmas to disable a warning... */
@@ -1504,7 +1504,7 @@ static void kwsysProcessVolatileFree(volatile void* p)
static int kwsysProcessInitialize(kwsysProcess* cp)
{
int i;
- volatile pid_t* oldForkPIDs;
+ pid_t volatile* oldForkPIDs;
for (i = 0; i < KWSYSPE_PIPE_COUNT; ++i) {
cp->PipeReadEnds[i] = -1;
}
@@ -1528,7 +1528,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
cp->ErrorMessage[0] = 0;
oldForkPIDs = cp->ForkPIDs;
- cp->ForkPIDs = (volatile pid_t*)malloc(sizeof(volatile pid_t) *
+ cp->ForkPIDs = (pid_t volatile*)malloc(sizeof(pid_t volatile) *
(size_t)(cp->NumberOfCommands));
kwsysProcessVolatileFree(oldForkPIDs);
if (!cp->ForkPIDs) {
@@ -1935,7 +1935,7 @@ static void kwsysProcessDestroy(kwsysProcess* cp)
sigprocmask(SIG_SETMASK, &old_mask, 0);
}
-static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
+static int kwsysProcessSetupOutputPipeFile(int* p, char const* name)
{
int fout;
if (!name) {
@@ -1982,7 +1982,7 @@ static int kwsysProcessSetupOutputPipeNative(int* p, int des[2])
/* Get the time at which either the process or user timeout will
expire. Returns 1 if the user timeout is first, and 0 otherwise. */
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp,
- const double* userTimeout,
+ double const* userTimeout,
kwsysProcessTime* timeoutTime)
{
/* The first time this is called, we need to calculate the time at
@@ -2022,7 +2022,7 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp,
/* Get the length of time before the given timeout time arrives.
Returns 1 if the time has already arrived, and 0 otherwise. */
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
- const double* userTimeout,
+ double const* userTimeout,
kwsysProcessTimeNative* timeoutLength,
int zeroIsExpired)
{
@@ -2572,7 +2572,7 @@ static void kwsysProcessKill(pid_t process_id)
fclose(f);
buffer[nread] = '\0';
if (nread > 0) {
- const char* rparen = strrchr(buffer, ')');
+ char const* rparen = strrchr(buffer, ')');
int ppid;
if (rparen && (sscanf(rparen + 1, "%*s %d", &ppid) == 1)) {
if (ppid == process_id) {
@@ -2628,9 +2628,9 @@ static void kwsysProcessKill(pid_t process_id)
}
#if defined(__VMS)
-int decc$feature_get_index(const char* name);
+int decc$feature_get_index(char const* name);
int decc$feature_set_value(int index, int mode, int value);
-static int kwsysProcessSetVMSFeature(const char* name, int value)
+static int kwsysProcessSetVMSFeature(char const* name, int value)
{
int i;
errno = 0;
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index 0b43b4a..39357f6 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -89,7 +89,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp);
static DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
kwsysProcessCreateInformation* si);
static void kwsysProcessDestroy(kwsysProcess* cp, int event);
-static DWORD kwsysProcessSetupOutputPipeFile(PHANDLE handle, const char* name);
+static DWORD kwsysProcessSetupOutputPipeFile(PHANDLE handle, char const* name);
static void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle);
static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle);
static void kwsysProcessCleanupHandle(PHANDLE h);
@@ -654,7 +654,7 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
cp->TimeoutTime.QuadPart = -1;
}
-int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
+int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, char const* dir)
{
if (!cp) {
return 0;
@@ -666,14 +666,14 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
if (dir && dir[0]) {
wchar_t* wdir = kwsysEncoding_DupToWide(dir);
/* We must convert the working directory to a full path. */
- DWORD length = GetFullPathNameW(wdir, 0, 0, 0);
+ DWORD length = GetFullPathNameW(wdir, 0, NULL, NULL);
if (length > 0) {
wchar_t* work_dir = malloc(length * sizeof(wchar_t));
if (!work_dir) {
free(wdir);
return 0;
}
- if (!GetFullPathNameW(wdir, length, work_dir, 0)) {
+ if (!GetFullPathNameW(wdir, length, work_dir, NULL)) {
free(work_dir);
free(wdir);
return 0;
@@ -685,7 +685,7 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
return 1;
}
-int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
+int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, char const* file)
{
char** pfile;
if (!cp) {
@@ -867,7 +867,7 @@ int kwsysProcess_GetExitCode(kwsysProcess* cp)
: 0;
}
-const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
+char const* kwsysProcess_GetErrorString(kwsysProcess* cp)
{
if (!cp) {
return "Process management structure could not be allocated";
@@ -877,7 +877,7 @@ const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
return "Success";
}
-const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
+char const* kwsysProcess_GetExceptionString(kwsysProcess* cp)
{
if (!(cp && cp->ProcessResults && (cp->NumberOfCommands > 0))) {
return "GetExceptionString called with NULL process management structure";
@@ -918,7 +918,7 @@ int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx)
return cp->CommandExitCodes[idx];
}
-const char* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
+char const* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
{
KWSYSPE_IDX_CHK("GetExceptionString called with NULL process management "
"structure or index out of bound")
@@ -1796,7 +1796,7 @@ void kwsysProcessDestroy(kwsysProcess* cp, int event)
}
}
-DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name)
+DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, char const* name)
{
HANDLE fout;
wchar_t* wname;
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index 75e7442..b9850d4 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -34,7 +34,7 @@
namespace KWSYS_NAMESPACE {
// RegularExpression -- Copies the given regular expression.
-RegularExpression::RegularExpression(const RegularExpression& rxp)
+RegularExpression::RegularExpression(RegularExpression const& rxp)
{
if (!rxp.program) {
this->program = nullptr;
@@ -60,10 +60,11 @@ RegularExpression::RegularExpression(const RegularExpression& rxp)
this->regstart = rxp.regstart; // Copy starting index
this->reganch = rxp.reganch; // Copy remaining private data
this->regmlen = rxp.regmlen; // Copy remaining private data
+ this->regnpar = rxp.regnpar;
}
// operator= -- Copies the given regular expression.
-RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
+RegularExpression& RegularExpression::operator=(RegularExpression const& rxp)
{
if (this == &rxp) {
return *this;
@@ -93,13 +94,14 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
this->regstart = rxp.regstart; // Copy starting index
this->reganch = rxp.reganch; // Copy remaining private data
this->regmlen = rxp.regmlen; // Copy remaining private data
+ this->regnpar = rxp.regnpar;
return *this;
}
// operator== -- Returns true if two regular expressions have the same
// compiled program for pattern matching.
-bool RegularExpression::operator==(const RegularExpression& rxp) const
+bool RegularExpression::operator==(RegularExpression const& rxp) const
{
if (this != &rxp) { // Same address?
int ind = this->progsize; // Get regular expression size
@@ -115,7 +117,7 @@ bool RegularExpression::operator==(const RegularExpression& rxp) const
// deep_equal -- Returns true if have the same compiled regular expressions
// and the same start and end pointers.
-bool RegularExpression::deep_equal(const RegularExpression& rxp) const
+bool RegularExpression::deep_equal(RegularExpression const& rxp) const
{
int ind = this->progsize; // Get regular expression size
if (ind != rxp.progsize) // If different size regexp
@@ -257,7 +259,7 @@ bool RegularExpression::deep_equal(const RegularExpression& rxp) const
#define NEXT(p) (((*((p) + 1) & 0377) << 8) + (*((p) + 2) & 0377))
#define OPERAND(p) ((p) + 3)
-const unsigned char MAGIC = 0234;
+unsigned char const MAGIC = 0234;
/*
* Utility definitions.
*/
@@ -293,7 +295,7 @@ static char* const regdummyptr = &regdummy;
class RegExpCompile
{
public:
- const char* regparse; // Input-scan pointer.
+ char const* regparse; // Input-scan pointer.
int regnpar; // () count.
char* regcode; // Code-emit pointer; regdummyptr = don't.
long regsize; // Code size.
@@ -305,11 +307,11 @@ public:
char* regnode(char);
void regc(char);
void reginsert(char, char*);
- static void regtail(char*, const char*);
- static void regoptail(char*, const char*);
+ static void regtail(char*, char const*);
+ static void regoptail(char*, char const*);
};
-static const char* regnext(const char*);
+static char const* regnext(char const*);
static char* regnext(char*);
#ifdef STRCSPN
@@ -333,10 +335,10 @@ static int strcspn();
// compile -- compile a regular expression into internal code
// for later pattern matching.
-bool RegularExpression::compile(const char* exp)
+bool RegularExpression::compile(char const* exp)
{
- const char* scan;
- const char* longest;
+ char const* scan;
+ char const* longest;
int flags;
if (!exp) {
@@ -371,6 +373,7 @@ bool RegularExpression::compile(const char* exp)
// #endif
this->program = new char[comp.regsize];
this->progsize = static_cast<int>(comp.regsize);
+ this->regnpar = comp.regnpar;
if (!this->program) {
// RAISE Error, SYM(RegularExpression), SYM(Out_Of_Memory),
@@ -799,7 +802,7 @@ void RegExpCompile::reginsert(char op, char* opnd)
/*
- regtail - set the next-pointer at the end of a node chain
*/
-void RegExpCompile::regtail(char* p, const char* val)
+void RegExpCompile::regtail(char* p, char const* val)
{
char* scan;
char* temp;
@@ -828,7 +831,7 @@ void RegExpCompile::regtail(char* p, const char* val)
/*
- regoptail - regtail on operand of first argument; nop if operandless
*/
-void RegExpCompile::regoptail(char* p, const char* val)
+void RegExpCompile::regoptail(char* p, char const* val)
{
// "Operandless" and "op != BRANCH" are synonymous in practice.
if (!p || p == regdummyptr || OP(p) != BRANCH)
@@ -848,22 +851,25 @@ void RegExpCompile::regoptail(char* p, const char* val)
class RegExpFind
{
public:
- const char* reginput; // String-input pointer.
- const char* regbol; // Beginning of input, for ^ check.
- const char** regstartp; // Pointer to startp array.
- const char** regendp; // Ditto for endp.
-
- int regtry(const char*, const char**, const char**, const char*);
- int regmatch(const char*);
- int regrepeat(const char*);
+ char const* reginput; // String-input pointer.
+ char const* regbol; // Beginning of input, for ^ check.
+ char const** regstartp; // Pointer to startp array.
+ char const** regendp; // Ditto for endp.
+ char const* regreject; // Reject matches ending here, for NONEMPTY_AT_OFFSET.
+
+ int regtry(char const*, char const**, char const**, char const*);
+ int regmatch(char const*);
+ int regrepeat(char const*);
};
// find -- Matches the regular expression to the given string.
// Returns true if found, and sets start and end indexes accordingly.
bool RegularExpression::find(char const* string,
- RegularExpressionMatch& rmatch) const
+ RegularExpressionMatch& rmatch,
+ std::string::size_type offset,
+ unsigned options) const
{
- const char* s;
+ char const* s;
rmatch.clear();
rmatch.searchstring = string;
@@ -882,7 +888,7 @@ bool RegularExpression::find(char const* string,
// If there is a "must appear" string, look for it.
if (this->regmust) {
- s = string;
+ s = string + offset;
while ((s = strchr(s, this->regmust[0]))) {
if (strncmp(s, this->regmust, this->regmlen) == 0)
break; // Found it.
@@ -893,17 +899,17 @@ bool RegularExpression::find(char const* string,
}
RegExpFind regFind;
+ s = string + offset;
// Mark beginning of line for ^ .
- regFind.regbol = string;
+ regFind.regbol = (options & BOL_AT_OFFSET) ? s : string;
+ regFind.regreject = (options & NONEMPTY_AT_OFFSET) ? s : nullptr;
// Simplest case: anchored match need be tried only once.
if (this->reganch)
- return (
- regFind.regtry(string, rmatch.startp, rmatch.endp, this->program) != 0);
+ return (regFind.regtry(s, rmatch.startp, rmatch.endp, this->program) != 0);
// Messy cases: unanchored match.
- s = string;
if (this->regstart != '\0')
// We know what char it must start with.
while ((s = strchr(s, this->regstart))) {
@@ -926,12 +932,12 @@ bool RegularExpression::find(char const* string,
- regtry - try match at specific point
0 failure, 1 success
*/
-int RegExpFind::regtry(const char* string, const char** start,
- const char** end, const char* prog)
+int RegExpFind::regtry(char const* string, char const** start,
+ char const** end, char const* prog)
{
int i;
- const char** sp1;
- const char** ep;
+ char const** sp1;
+ char const** ep;
reginput = string;
regstartp = start;
@@ -962,10 +968,10 @@ int RegExpFind::regtry(const char* string, const char** start,
* by recursion.
* 0 failure, 1 success
*/
-int RegExpFind::regmatch(const char* prog)
+int RegExpFind::regmatch(char const* prog)
{
- const char* scan; // Current node.
- const char* next; // Next node.
+ char const* scan; // Current node.
+ char const* next; // Next node.
scan = prog;
@@ -989,7 +995,7 @@ int RegExpFind::regmatch(const char* prog)
break;
case EXACTLY: {
size_t len;
- const char* opnd;
+ char const* opnd;
opnd = OPERAND(scan);
// Inline the first character, for speed.
@@ -1047,7 +1053,7 @@ int RegExpFind::regmatch(const char* prog)
case OPEN + 31:
case OPEN + 32: {
int no;
- const char* save;
+ char const* save;
no = OP(scan) - OPEN;
save = reginput;
@@ -1098,7 +1104,7 @@ int RegExpFind::regmatch(const char* prog)
case CLOSE + 31:
case CLOSE + 32: {
int no;
- const char* save;
+ char const* save;
no = OP(scan) - CLOSE;
save = reginput;
@@ -1118,7 +1124,7 @@ int RegExpFind::regmatch(const char* prog)
// break;
case BRANCH: {
- const char* save;
+ char const* save;
if (OP(next) != BRANCH) // No choice.
next = OPERAND(scan); // Avoid recursion.
@@ -1138,7 +1144,7 @@ int RegExpFind::regmatch(const char* prog)
case PLUS: {
char nextch;
int no;
- const char* save;
+ char const* save;
int min_no;
//
@@ -1164,7 +1170,9 @@ int RegExpFind::regmatch(const char* prog)
}
// break;
case END:
- return (1); // Success!
+ if (reginput == regreject)
+ return (0); // Can't end a match here
+ return (1); // Success!
default:
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
@@ -1187,11 +1195,11 @@ int RegExpFind::regmatch(const char* prog)
/*
- regrepeat - repeatedly match something simple, report how many
*/
-int RegExpFind::regrepeat(const char* p)
+int RegExpFind::regrepeat(char const* p)
{
int count = 0;
- const char* scan;
- const char* opnd;
+ char const* scan;
+ char const* opnd;
scan = reginput;
opnd = OPERAND(p);
@@ -1230,7 +1238,7 @@ int RegExpFind::regrepeat(const char* p)
/*
- regnext - dig the "next" pointer out of a node
*/
-static const char* regnext(const char* p)
+static char const* regnext(char const* p)
{
int offset;
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index d73482b..9d3325b 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -42,11 +42,9 @@ public:
bool isValid() const;
void clear();
- std::string::size_type start() const;
- std::string::size_type end() const;
- std::string::size_type start(int n) const;
- std::string::size_type end(int n) const;
- std::string match(int n) const;
+ std::string::size_type start(int n = 0) const;
+ std::string::size_type end(int n = 0) const;
+ std::string match(int n = 0) const;
enum
{
@@ -55,9 +53,9 @@ public:
private:
friend class RegularExpression;
- const char* startp[NSUBEXP];
- const char* endp[NSUBEXP];
- const char* searchstring;
+ char const* startp[NSUBEXP];
+ char const* endp[NSUBEXP];
+ char const* searchstring;
};
#ifdef _MSC_VER
@@ -100,27 +98,14 @@ inline void RegularExpressionMatch::clear()
}
/**
- * \brief Returns the start index of the full match.
- */
-inline std::string::size_type RegularExpressionMatch::start() const
-{
- return static_cast<std::string::size_type>(this->startp[0] - searchstring);
-}
-
-/**
- * \brief Returns the end index of the full match.
- */
-inline std::string::size_type RegularExpressionMatch::end() const
-{
- return static_cast<std::string::size_type>(this->endp[0] - searchstring);
-}
-
-/**
* \brief Returns the start index of nth submatch.
* start(0) is the start of the full match.
*/
inline std::string::size_type RegularExpressionMatch::start(int n) const
{
+ if (!this->startp[n]) {
+ return std::string::npos;
+ }
return static_cast<std::string::size_type>(this->startp[n] -
this->searchstring);
}
@@ -131,6 +116,9 @@ inline std::string::size_type RegularExpressionMatch::start(int n) const
*/
inline std::string::size_type RegularExpressionMatch::end(int n) const
{
+ if (!this->endp[n]) {
+ return std::string::npos;
+ }
return static_cast<std::string::size_type>(this->endp[n] -
this->searchstring);
}
@@ -293,6 +281,14 @@ inline std::string RegularExpressionMatch::match(int n) const
class @KWSYS_NAMESPACE@_EXPORT RegularExpression
{
public:
+ enum Options : unsigned
+ {
+ // Match ^ at offset instead of the input start.
+ BOL_AT_OFFSET = 1,
+ // If an empty match is found at offset, continue searching.
+ NONEMPTY_AT_OFFSET = 2,
+ };
+
/**
* Instantiate RegularExpression with program=nullptr.
*/
@@ -338,38 +334,39 @@ public:
* This method is thread safe when called with different
* RegularExpressionMatch instances.
*/
- bool find(char const*, RegularExpressionMatch&) const;
+ bool find(char const*, RegularExpressionMatch&,
+ std::string::size_type offset = 0, unsigned options = 0) const;
/**
* Matches the regular expression to the given string.
* Returns true if found, and sets start and end indexes accordingly.
*/
- inline bool find(char const*);
+ inline bool find(char const*, std::string::size_type offset = 0,
+ unsigned options = 0);
/**
* Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly.
*/
- inline bool find(std::string const&);
+ inline bool find(std::string const&, std::string::size_type offset = 0,
+ unsigned options = 0);
/**
* Match indices
*/
inline RegularExpressionMatch const& regMatch() const;
- inline std::string::size_type start() const;
- inline std::string::size_type end() const;
- inline std::string::size_type start(int n) const;
- inline std::string::size_type end(int n) const;
+ inline std::string::size_type start(int n = 0) const;
+ inline std::string::size_type end(int n = 0) const;
/**
* Match strings
*/
- inline std::string match(int n) const;
+ inline std::string match(int n = 0) const;
/**
* Copy the given regular expression.
*/
- RegularExpression& operator=(const RegularExpression& rxp);
+ RegularExpression& operator=(RegularExpression const& rxp);
/**
* Returns true if two regular expressions have the same
@@ -399,14 +396,20 @@ public:
*/
inline void set_invalid();
+ /**
+ * The number of capture groups.
+ */
+ inline int num_groups();
+
private:
RegularExpressionMatch regmatch;
char regstart; // Internal use only
char reganch; // Internal use only
- const char* regmust; // Internal use only
+ char const* regmust; // Internal use only
std::string::size_type regmlen; // Internal use only
char* program;
int progsize;
+ int regnpar;
};
/**
@@ -418,6 +421,7 @@ inline RegularExpression::RegularExpression()
, regmust{}
, program{ nullptr }
, progsize{}
+ , regnpar{}
{
}
@@ -425,12 +429,13 @@ inline RegularExpression::RegularExpression()
* Creates a regular expression from string s, and
* compiles s.
*/
-inline RegularExpression::RegularExpression(const char* s)
+inline RegularExpression::RegularExpression(char const* s)
: regstart{}
, reganch{}
, regmust{}
, program{ nullptr }
, progsize{}
+ , regnpar{}
{
if (s) {
this->compile(s);
@@ -441,12 +446,13 @@ inline RegularExpression::RegularExpression(const char* s)
* Creates a regular expression from string s, and
* compiles s.
*/
-inline RegularExpression::RegularExpression(const std::string& s)
+inline RegularExpression::RegularExpression(std::string const& s)
: regstart{}
, reganch{}
, regmust{}
, program{ nullptr }
, progsize{}
+ , regnpar{}
{
this->compile(s);
}
@@ -474,18 +480,22 @@ inline bool RegularExpression::compile(std::string const& s)
* Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly.
*/
-inline bool RegularExpression::find(const char* s)
+inline bool RegularExpression::find(char const* s,
+ std::string::size_type offset,
+ unsigned options)
{
- return this->find(s, this->regmatch);
+ return this->find(s, this->regmatch, offset, options);
}
/**
* Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly.
*/
-inline bool RegularExpression::find(std::string const& s)
+inline bool RegularExpression::find(std::string const& s,
+ std::string::size_type offset,
+ unsigned options)
{
- return this->find(s.c_str());
+ return this->find(s.c_str(), this->regmatch, offset, options);
}
/**
@@ -497,22 +507,6 @@ inline RegularExpressionMatch const& RegularExpression::regMatch() const
}
/**
- * Returns the start index of the full match.
- */
-inline std::string::size_type RegularExpression::start() const
-{
- return regmatch.start();
-}
-
-/**
- * Returns the end index of the full match.
- */
-inline std::string::size_type RegularExpression::end() const
-{
- return regmatch.end();
-}
-
-/**
* Return start index of nth submatch. start(0) is the start of the full match.
*/
inline std::string::size_type RegularExpression::start(int n) const
@@ -540,7 +534,7 @@ inline std::string RegularExpression::match(int n) const
* Returns true if two regular expressions have different
* compiled program for pattern matching.
*/
-inline bool RegularExpression::operator!=(const RegularExpression& r) const
+inline bool RegularExpression::operator!=(RegularExpression const& r) const
{
return (!(*this == r));
}
@@ -562,6 +556,11 @@ inline void RegularExpression::set_invalid()
this->program = nullptr;
}
+inline int RegularExpression::num_groups()
+{
+ return this->regnpar - 1;
+}
+
} // namespace @KWSYS_NAMESPACE@
#endif
diff --git a/Source/kwsys/Status.cxx b/Source/kwsys/Status.cxx
index edda7a0..17cb0eb 100644
--- a/Source/kwsys/Status.cxx
+++ b/Source/kwsys/Status.cxx
@@ -2,10 +2,12 @@
file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Status.hxx)
+#include KWSYS_HEADER(Encoding.hxx)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
+# include "Encoding.hxx.in"
# include "Status.hxx.in"
#endif
@@ -43,13 +45,13 @@ std::string Status::GetString() const
break;
#ifdef _WIN32
case Kind::Windows: {
- LPSTR message = NULL;
- DWORD size = FormatMessageA(
+ LPWSTR message = NULL;
+ DWORD size = FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, this->Windows_, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPSTR)&message, 0, NULL);
- err = std::string(message, size);
+ (LPWSTR)&message, 0, NULL);
+ err = kwsys::Encoding::ToNarrow(message);
LocalFree(message);
} break;
#endif
diff --git a/Source/kwsys/String.c b/Source/kwsys/String.c
index daf7ad1..7fd159b 100644
--- a/Source/kwsys/String.c
+++ b/Source/kwsys/String.c
@@ -61,14 +61,14 @@ static char kwsysString_strcasecmp_tolower[] = {
# endif
/*--------------------------------------------------------------------------*/
-int kwsysString_strcasecmp(const char* lhs, const char* rhs)
+int kwsysString_strcasecmp(char const* lhs, char const* rhs)
{
# if defined(KWSYS_STRING_USE_STRICMP)
return _stricmp(lhs, rhs);
# elif defined(KWSYS_STRING_USE_STRCASECMP)
return strcasecmp(lhs, rhs);
# else
- const char* const lower = kwsysString_strcasecmp_tolower;
+ char const* const lower = kwsysString_strcasecmp_tolower;
unsigned char const* us1 = (unsigned char const*)lhs;
unsigned char const* us2 = (unsigned char const*)rhs;
int result;
@@ -79,14 +79,14 @@ int kwsysString_strcasecmp(const char* lhs, const char* rhs)
}
/*--------------------------------------------------------------------------*/
-int kwsysString_strncasecmp(const char* lhs, const char* rhs, size_t n)
+int kwsysString_strncasecmp(char const* lhs, char const* rhs, size_t n)
{
# if defined(KWSYS_STRING_USE_STRICMP)
return _strnicmp(lhs, rhs, n);
# elif defined(KWSYS_STRING_USE_STRCASECMP)
return strncasecmp(lhs, rhs, n);
# else
- const char* const lower = kwsysString_strcasecmp_tolower;
+ char const* const lower = kwsysString_strcasecmp_tolower;
unsigned char const* us1 = (unsigned char const*)lhs;
unsigned char const* us2 = (unsigned char const*)rhs;
int result = 0;
diff --git a/Source/kwsys/String.h.in b/Source/kwsys/String.h.in
index 7c9348a..6931051 100644
--- a/Source/kwsys/String.h.in
+++ b/Source/kwsys/String.h.in
@@ -30,13 +30,13 @@ extern "C" {
* is found to be less than, equal to, or greater than the second
* string, respectively.
*/
-kwsysEXPORT int kwsysString_strcasecmp(const char* lhs, const char* rhs);
+kwsysEXPORT int kwsysString_strcasecmp(char const* lhs, char const* rhs);
/**
* Identical to String_strcasecmp except that only the first n
* characters are considered.
*/
-kwsysEXPORT int kwsysString_strncasecmp(const char* lhs, const char* rhs,
+kwsysEXPORT int kwsysString_strncasecmp(char const* lhs, char const* rhs,
size_t n);
#if defined(__cplusplus)
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index dbfd2fd..11257cd 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -22,7 +22,7 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t;
typedef int kwsysSystem_ptrdiff_t;
#endif
-static int kwsysSystem__AppendByte(const char* local, char** begin, char** end,
+static int kwsysSystem__AppendByte(char const* local, char** begin, char** end,
int* size, char c)
{
/* Allocate space for the character. */
@@ -91,7 +91,7 @@ static int kwsysSystem__AppendArgument(char** local, char*** begin,
#define KWSYSPE_LOCAL_BYTE_COUNT 1024
#define KWSYSPE_LOCAL_ARGS_COUNT 32
-static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
+static char** kwsysSystem__ParseUnixCommand(char const* command, int flags)
{
/* Create a buffer for argument pointers during parsing. */
char* local_pointers[KWSYSPE_LOCAL_ARGS_COUNT];
@@ -107,7 +107,7 @@ static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
/* Parse the command string. Try to behave like a UNIX shell. */
char** newCommand = 0;
- const char* c = command;
+ char const* c = command;
int in_argument = 0;
int in_escape = 0;
int in_single = 0;
@@ -224,7 +224,7 @@ static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
return newCommand;
}
-char** kwsysSystem_Parse_CommandForUnix(const char* command, int flags)
+char** kwsysSystem_Parse_CommandForUnix(char const* command, int flags)
{
/* Validate the flags. */
if (flags != 0) {
diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in
index a9d4f5e..21b1964 100644
--- a/Source/kwsys/System.h.in
+++ b/Source/kwsys/System.h.in
@@ -40,7 +40,7 @@ extern "C" {
* any character may be escaped by a backslash. The flags argument is
* reserved for future use, and must be zero (or the call will fail).
*/
-kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command,
+kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(char const* command,
int flags);
#if defined(__cplusplus)
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index c79058e..aca0324 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -272,15 +272,15 @@ public:
SystemInformationImplementation();
~SystemInformationImplementation() = default;
- const char* GetVendorString() const;
- const char* GetVendorID();
+ char const* GetVendorString() const;
+ char const* GetVendorID();
std::string GetTypeID() const;
std::string GetFamilyID() const;
std::string GetModelID() const;
std::string GetModelName() const;
std::string GetSteppingCode() const;
- const char* GetExtendedProcessorName() const;
- const char* GetProcessorSerialNumber() const;
+ char const* GetExtendedProcessorName() const;
+ char const* GetProcessorSerialNumber() const;
int GetProcessorCacheSize() const;
unsigned int GetLogicalProcessorsPerPhysical() const;
float GetProcessorClockFrequency() const;
@@ -288,12 +288,12 @@ public:
int GetProcessorCacheXSize(long int) const;
bool DoesCPUSupportFeature(long int) const;
- const char* GetOSName();
- const char* GetHostname();
+ char const* GetOSName();
+ char const* GetHostname();
int GetFullyQualifiedDomainName(std::string& fqdn);
- const char* GetOSRelease();
- const char* GetOSVersion();
- const char* GetOSPlatform();
+ char const* GetOSRelease();
+ char const* GetOSVersion();
+ char const* GetOSPlatform();
bool Is64Bits() const;
@@ -312,11 +312,11 @@ public:
// Retrieve memory information in KiB.
long long GetHostMemoryTotal();
- long long GetHostMemoryAvailable(const char* hostLimitEnvVarName);
+ long long GetHostMemoryAvailable(char const* hostLimitEnvVarName);
long long GetHostMemoryUsed();
- long long GetProcMemoryAvailable(const char* hostLimitEnvVarName,
- const char* procLimitEnvVarName);
+ long long GetProcMemoryAvailable(char const* hostLimitEnvVarName,
+ char const* procLimitEnvVarName);
long long GetProcMemoryUsed();
double GetLoadAverage();
@@ -440,7 +440,7 @@ protected:
// For Linux and Cygwin, /proc/cpuinfo formats are slightly different
bool RetrieveInformationFromCpuInfoFile();
- std::string ExtractValueFromCpuInfoFile(std::string buffer, const char* word,
+ std::string ExtractValueFromCpuInfoFile(std::string buffer, char const* word,
size_t init = 0);
bool QueryLinuxMemory();
@@ -449,20 +449,20 @@ protected:
static void Delay(unsigned int);
static void DelayOverhead(unsigned int);
- void FindManufacturer(const std::string& family = "");
+ void FindManufacturer(std::string const& family = "");
// For Mac
bool ParseSysCtl();
- int CallSwVers(const char* arg, std::string& ver);
+ int CallSwVers(char const* arg, std::string& ver);
void TrimNewline(std::string&);
- std::string ExtractValueFromSysCtl(const char* word);
+ std::string ExtractValueFromSysCtl(char const* word);
std::string SysCtlBuffer;
// For Solaris
bool QuerySolarisMemory();
bool QuerySolarisProcessor();
- std::string ParseValueFromKStat(const char* arguments);
- std::string RunProcess(std::vector<const char*> args);
+ std::string ParseValueFromKStat(char const* arguments);
+ std::string RunProcess(std::vector<char const*> args);
// For Haiku OS
bool QueryHaikuInfo();
@@ -518,12 +518,12 @@ SystemInformation::~SystemInformation()
delete this->Implementation;
}
-const char* SystemInformation::GetVendorString()
+char const* SystemInformation::GetVendorString()
{
return this->Implementation->GetVendorString();
}
-const char* SystemInformation::GetVendorID()
+char const* SystemInformation::GetVendorID()
{
return this->Implementation->GetVendorID();
}
@@ -553,12 +553,12 @@ std::string SystemInformation::GetSteppingCode()
return this->Implementation->GetSteppingCode();
}
-const char* SystemInformation::GetExtendedProcessorName()
+char const* SystemInformation::GetExtendedProcessorName()
{
return this->Implementation->GetExtendedProcessorName();
}
-const char* SystemInformation::GetProcessorSerialNumber()
+char const* SystemInformation::GetProcessorSerialNumber()
{
return this->Implementation->GetProcessorSerialNumber();
}
@@ -614,12 +614,12 @@ std::string SystemInformation::GetCPUDescription()
return tmp;
}
-const char* SystemInformation::GetOSName()
+char const* SystemInformation::GetOSName()
{
return this->Implementation->GetOSName();
}
-const char* SystemInformation::GetHostname()
+char const* SystemInformation::GetHostname()
{
return this->Implementation->GetHostname();
}
@@ -631,17 +631,17 @@ std::string SystemInformation::GetFullyQualifiedDomainName()
return fqdn;
}
-const char* SystemInformation::GetOSRelease()
+char const* SystemInformation::GetOSRelease()
{
return this->Implementation->GetOSRelease();
}
-const char* SystemInformation::GetOSVersion()
+char const* SystemInformation::GetOSVersion()
{
return this->Implementation->GetOSVersion();
}
-const char* SystemInformation::GetOSPlatform()
+char const* SystemInformation::GetOSPlatform()
{
return this->Implementation->GetOSPlatform();
}
@@ -724,7 +724,7 @@ size_t SystemInformation::GetAvailablePhysicalMemory()
}
std::string SystemInformation::GetMemoryDescription(
- const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
+ char const* hostLimitEnvVarName, char const* procLimitEnvVarName)
{
std::ostringstream oss;
oss << "Host Total: " << this->GetHostMemoryTotal()
@@ -743,7 +743,7 @@ long long SystemInformation::GetHostMemoryTotal()
}
long long SystemInformation::GetHostMemoryAvailable(
- const char* hostLimitEnvVarName)
+ char const* hostLimitEnvVarName)
{
return this->Implementation->GetHostMemoryAvailable(hostLimitEnvVarName);
}
@@ -755,7 +755,7 @@ long long SystemInformation::GetHostMemoryUsed()
// process memory info in units of KiB.
long long SystemInformation::GetProcMemoryAvailable(
- const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
+ char const* hostLimitEnvVarName, char const* procLimitEnvVarName)
{
return this->Implementation->GetProcMemoryAvailable(hostLimitEnvVarName,
procLimitEnvVarName);
@@ -827,7 +827,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
{
// Load each line in the given file into a the vector.
int nRead = 0;
- const int bufSize = 1024;
+ int const bufSize = 1024;
char buf[bufSize] = { '\0' };
while (!feof(file) && !ferror(file)) {
errno = 0;
@@ -854,7 +854,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
# if defined(__linux) || defined(__CYGWIN__)
// *****************************************************************************
-int LoadLines(const char* fileName, std::vector<std::string>& lines)
+int LoadLines(char const* fileName, std::vector<std::string>& lines)
{
FILE* file = fopen(fileName, "r");
if (!file) {
@@ -888,7 +888,7 @@ int NameValue(std::vector<std::string> const& lines, std::string const& name,
#if defined(__linux) || defined(__CYGWIN__)
// ****************************************************************************
template <typename T>
-int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
+int GetFieldsFromFile(char const* fileName, char const** fieldNames, T* values)
{
std::vector<std::string> fields;
if (!LoadLines(fileName, fields)) {
@@ -907,9 +907,9 @@ int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
// ****************************************************************************
template <typename T>
-int GetFieldFromFile(const char* fileName, const char* fieldName, T& value)
+int GetFieldFromFile(char const* fileName, char const* fieldName, T& value)
{
- const char* fieldNames[2] = { fieldName, nullptr };
+ char const* fieldNames[2] = { fieldName, nullptr };
T values[1] = { T(0) };
int ierr = GetFieldsFromFile(fileName, fieldNames, values);
if (ierr) {
@@ -923,7 +923,7 @@ int GetFieldFromFile(const char* fileName, const char* fieldName, T& value)
// ****************************************************************************
#if defined(__APPLE__)
template <typename T>
-int GetFieldsFromCommand(const char* command, const char** fieldNames,
+int GetFieldsFromCommand(char const* command, char const** fieldNames,
T* values)
{
FILE* file = popen(command, "r");
@@ -1181,14 +1181,14 @@ public:
// Description:
// Set/Get the name of the binary file that the symbol
// is found in.
- void SetBinary(const char* binary) { this->Binary = safes(binary); }
+ void SetBinary(char const* binary) { this->Binary = safes(binary); }
std::string GetBinary() const;
// Description:
// Set the name of the function that the symbol is found in.
// If c++ demangling is supported it will be demangled.
- void SetFunction(const char* function)
+ void SetFunction(char const* function)
{
this->Function = this->Demangle(function);
}
@@ -1198,7 +1198,7 @@ public:
// Description:
// Set/Get the name of the source file where the symbol
// is defined.
- void SetSourceFile(const char* sourcefile)
+ void SetSourceFile(char const* sourcefile)
{
this->SourceFile = safes(sourcefile);
}
@@ -1228,8 +1228,8 @@ private:
static_cast<char*>(this->BinaryBaseAddress));
}
- std::string GetFileName(const std::string& path) const;
- std::string Demangle(const char* symbol) const;
+ std::string GetFileName(std::string const& path) const;
+ std::string Demangle(char const* symbol) const;
private:
std::string Binary;
@@ -1241,7 +1241,7 @@ private:
int ReportPath;
};
-std::ostream& operator<<(std::ostream& os, const SymbolProperties& sp)
+std::ostream& operator<<(std::ostream& os, SymbolProperties const& sp)
{
# if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
os << std::hex << sp.GetAddress() << " : " << sp.GetFunction() << " [("
@@ -1277,7 +1277,7 @@ SymbolProperties::SymbolProperties()
this->GetLineNumber();
}
-std::string SymbolProperties::GetFileName(const std::string& path) const
+std::string SymbolProperties::GetFileName(std::string const& path) const
{
std::string file(path);
if (!this->ReportPath) {
@@ -1309,7 +1309,7 @@ std::string SymbolProperties::GetBinary() const
return this->GetFileName(this->Binary);
}
-std::string SymbolProperties::Demangle(const char* symbol) const
+std::string SymbolProperties::Demangle(char const* symbol) const
{
std::string result = safes(symbol);
# if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
@@ -1517,19 +1517,19 @@ void SystemInformationImplementation::RunMemoryCheck()
}
/** Get the vendor string */
-const char* SystemInformationImplementation::GetVendorString() const
+char const* SystemInformationImplementation::GetVendorString() const
{
return this->ChipID.Vendor.c_str();
}
/** Get the OS Name */
-const char* SystemInformationImplementation::GetOSName()
+char const* SystemInformationImplementation::GetOSName()
{
return this->OSName.c_str();
}
/** Get the hostname */
-const char* SystemInformationImplementation::GetHostname()
+char const* SystemInformationImplementation::GetHostname()
{
if (this->Hostname.empty()) {
this->Hostname = "localhost";
@@ -1623,7 +1623,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
!(ifa->ifa_flags & IFF_LOOPBACK)) {
char host[NI_MAXHOST] = { '\0' };
- const size_t addrlen = (fam == AF_INET ? sizeof(struct sockaddr_in)
+ size_t const addrlen = (fam == AF_INET ? sizeof(struct sockaddr_in)
: sizeof(struct sockaddr_in6));
ierr = getnameinfo(ifa->ifa_addr, static_cast<socklen_t>(addrlen), host,
@@ -1656,25 +1656,25 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
}
/** Get the OS release */
-const char* SystemInformationImplementation::GetOSRelease()
+char const* SystemInformationImplementation::GetOSRelease()
{
return this->OSRelease.c_str();
}
/** Get the OS version */
-const char* SystemInformationImplementation::GetOSVersion()
+char const* SystemInformationImplementation::GetOSVersion()
{
return this->OSVersion.c_str();
}
/** Get the OS platform */
-const char* SystemInformationImplementation::GetOSPlatform()
+char const* SystemInformationImplementation::GetOSPlatform()
{
return this->OSPlatform.c_str();
}
/** Get the vendor ID */
-const char* SystemInformationImplementation::GetVendorID()
+char const* SystemInformationImplementation::GetVendorID()
{
// Return the vendor ID.
switch (this->ChipManufacturer) {
@@ -1756,14 +1756,14 @@ std::string SystemInformationImplementation::GetSteppingCode() const
}
/** Return the stepping code of the CPU present. */
-const char* SystemInformationImplementation::GetExtendedProcessorName() const
+char const* SystemInformationImplementation::GetExtendedProcessorName() const
{
return this->ChipID.ProcessorName.c_str();
}
/** Return the serial number of the processor
* in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
-const char* SystemInformationImplementation::GetProcessorSerialNumber() const
+char const* SystemInformationImplementation::GetProcessorSerialNumber() const
{
return this->ChipID.SerialNumber.c_str();
}
@@ -2055,7 +2055,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
/** Find the manufacturer given the vendor id */
void SystemInformationImplementation::FindManufacturer(
- const std::string& family)
+ std::string const& family)
{
if (this->ChipID.Vendor == "GenuineIntel")
this->ChipManufacturer = Intel; // Intel Corp.
@@ -3363,7 +3363,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
/** Extract a value from the CPUInfo file */
std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(
- std::string buffer, const char* word, size_t init)
+ std::string buffer, char const* word, size_t init)
{
size_t pos = buffer.find(word, init);
if (pos != std::string::npos) {
@@ -3441,7 +3441,6 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile()
this->CurrentPositionInFile + 1);
}
uint64_t NumberOfSockets = PhysicalIDs.size();
- NumberOfSockets = std::max(NumberOfSockets, (uint64_t)1);
// Physical ids returned by Linux don't distinguish cores.
// We want to record the total number of cores in this->NumberOfPhysicalCPU
// (checking only the first proc)
@@ -3451,9 +3450,11 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile()
Cores = this->ExtractValueFromCpuInfoFile(buffer, "ncpus probed");
}
auto NumberOfCoresPerSocket = (unsigned int)atoi(Cores.c_str());
- NumberOfCoresPerSocket = std::max(NumberOfCoresPerSocket, 1u);
- this->NumberOfPhysicalCPU =
- NumberOfCoresPerSocket * (unsigned int)NumberOfSockets;
+ // If either one is 0, will be assigned with NumberOfLogicalCPU or 1 below.
+ if (NumberOfSockets > 0 && NumberOfCoresPerSocket > 0) {
+ this->NumberOfPhysicalCPU =
+ NumberOfCoresPerSocket * (unsigned int)NumberOfSockets;
+ }
#else
// For systems which do not have "physical id" entries, neither "cpu cores"
@@ -3465,10 +3466,11 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile()
#endif
// gotta have one, and if this is 0 then we get a / by 0n
// better to have a bad answer than a crash
- if (this->NumberOfPhysicalCPU <= 0) {
- this->NumberOfPhysicalCPU = 1;
- }
- if (this->NumberOfLogicalCPU == 0) {
+ if (this->NumberOfPhysicalCPU == 0 && this->NumberOfLogicalCPU == 0) {
+ this->NumberOfPhysicalCPU = this->NumberOfLogicalCPU = 1;
+ } else if (this->NumberOfPhysicalCPU == 0) {
+ this->NumberOfPhysicalCPU = this->NumberOfLogicalCPU;
+ } else if (this->NumberOfLogicalCPU == 0) {
this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
}
// LogicalProcessorsPerPhysical>1 => SMT.
@@ -3548,7 +3550,7 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile()
// L1 Cache size
// Different architectures may show different names for the caches.
// Sum up everything we find.
- std::vector<const char*> cachename;
+ std::vector<char const*> cachename;
cachename.clear();
cachename.push_back("cache size"); // e.g. x86
@@ -3676,7 +3678,7 @@ Get total system RAM in units of KiB. This may differ from the
host total if a host-wide resource limit is applied.
*/
long long SystemInformationImplementation::GetHostMemoryAvailable(
- const char* hostLimitEnvVarName)
+ char const* hostLimitEnvVarName)
{
long long memTotal = this->GetHostMemoryTotal();
@@ -3687,7 +3689,7 @@ long long SystemInformationImplementation::GetHostMemoryAvailable(
// access to it is severely restricted. The system will
// apply a limit across a set of processes. Units are in KiB.
if (hostLimitEnvVarName) {
- const char* hostLimitEnvVarValue = getenv(hostLimitEnvVarName);
+ char const* hostLimitEnvVarValue = getenv(hostLimitEnvVarName);
if (hostLimitEnvVarValue) {
long long hostLimit = std::atoll(hostLimitEnvVarValue);
if (hostLimit > 0) {
@@ -3704,14 +3706,14 @@ Get total system RAM in units of KiB. This may differ from the
host total if a per-process resource limit is applied.
*/
long long SystemInformationImplementation::GetProcMemoryAvailable(
- const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
+ char const* hostLimitEnvVarName, char const* procLimitEnvVarName)
{
long long memAvail = this->GetHostMemoryAvailable(hostLimitEnvVarName);
// the following mechanism is provide for systems where rlimits
// are not employed. Units are in KiB.
if (procLimitEnvVarName) {
- const char* procLimitEnvVarValue = getenv(procLimitEnvVarName);
+ char const* procLimitEnvVarValue = getenv(procLimitEnvVarName);
if (procLimitEnvVarValue) {
long long procLimit = std::atoll(procLimitEnvVarValue);
if (procLimit > 0) {
@@ -3767,7 +3769,7 @@ long long SystemInformationImplementation::GetHostMemoryUsed()
return (statex.ullTotalPhys - statex.ullAvailPhys) / 1024;
# endif
#elif defined(__CYGWIN__)
- const char* names[3] = { "MemTotal:", "MemFree:", nullptr };
+ char const* names[3] = { "MemTotal:", "MemFree:", nullptr };
long long values[2] = { 0 };
int ierr = GetFieldsFromFile("/proc/meminfo", names, values);
if (ierr) {
@@ -3778,11 +3780,11 @@ long long SystemInformationImplementation::GetHostMemoryUsed()
return memTotal - memFree;
#elif defined(__linux)
// First try to use MemAvailable, but it only works on newer kernels
- const char* names2[3] = { "MemTotal:", "MemAvailable:", nullptr };
+ char const* names2[3] = { "MemTotal:", "MemAvailable:", nullptr };
long long values2[2] = { 0 };
int ierr = GetFieldsFromFile("/proc/meminfo", names2, values2);
if (ierr) {
- const char* names4[5] = { "MemTotal:", "MemFree:", "Buffers:", "Cached:",
+ char const* names4[5] = { "MemTotal:", "MemFree:", "Buffers:", "Cached:",
nullptr };
long long values4[4] = { 0 };
ierr = GetFieldsFromFile("/proc/meminfo", names4, values4);
@@ -3803,7 +3805,7 @@ long long SystemInformationImplementation::GetHostMemoryUsed()
if (psz < 1) {
return -1;
}
- const char* names[3] = { "Pages wired down:", "Pages active:", nullptr };
+ char const* names[3] = { "Pages wired down:", "Pages active:", nullptr };
long long values[2] = { 0 };
int ierr = GetFieldsFromCommand("vm_stat", names, values);
if (ierr) {
@@ -4163,7 +4165,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
mSwapTotal,
mSwapFree
};
- const char* format[6] = { "MemTotal:%lu kB", "MemFree:%lu kB",
+ char const* format[6] = { "MemTotal:%lu kB", "MemFree:%lu kB",
"Buffers:%lu kB", "Cached:%lu kB",
"SwapTotal:%lu kB", "SwapFree:%lu kB" };
bool have[6] = { false, false, false, false, false, false };
@@ -4418,7 +4420,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
#if USE_CPUID
if (!this->IsSMTSupported()) {
return static_cast<unsigned char>(-1); // HT not supported
- } // Logical processor = 1
+ } // Logical processor = 1
call_cpuid(1, Regs);
#endif
@@ -4496,7 +4498,7 @@ unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU() const
}
#if defined(__APPLE__)
-static int kw_sysctlbyname_int32(const char* name, int32_t* value)
+static int kw_sysctlbyname_int32(char const* name, int32_t* value)
{
size_t len = sizeof(int32_t);
int err = sysctlbyname(name, value, &len, nullptr, 0);
@@ -4506,7 +4508,7 @@ static int kw_sysctlbyname_int32(const char* name, int32_t* value)
return err;
}
-static int kw_sysctlbyname_int64(const char* name, int64_t* value)
+static int kw_sysctlbyname_int64(char const* name, int64_t* value)
{
size_t len = sizeof(int64_t);
int err = sysctlbyname(name, value, &len, nullptr, 0);
@@ -4748,7 +4750,7 @@ bool SystemInformationImplementation::ParseSysCtl()
/** Extract a value from sysctl command */
std::string SystemInformationImplementation::ExtractValueFromSysCtl(
- const char* word)
+ char const* word)
{
size_t pos = this->SysCtlBuffer.find(word);
if (pos != std::string::npos) {
@@ -4763,9 +4765,9 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
/** Run a given process */
std::string SystemInformationImplementation::RunProcess(
- std::vector<const char*> args)
+ std::vector<char const*> args)
{
- std::string buffer;
+ std::string out;
// Run the application
kwsysProcess* gp = kwsysProcess_New();
@@ -4784,7 +4786,10 @@ std::string SystemInformationImplementation::RunProcess(
(pipe == kwsysProcess_Pipe_STDOUT ||
pipe == kwsysProcess_Pipe_STDERR))) // wait for 1s
{
- buffer.append(data, length);
+ // Keep stdout, ignore stderr.
+ if (pipe == kwsysProcess_Pipe_STDOUT) {
+ out.append(data, length);
+ }
}
kwsysProcess_WaitForExit(gp, nullptr);
@@ -4814,11 +4819,11 @@ std::string SystemInformationImplementation::RunProcess(
if (result) {
std::cerr << "Error " << args[0] << " returned :" << result << "\n";
}
- return buffer;
+ return out;
}
std::string SystemInformationImplementation::ParseValueFromKStat(
- const char* arguments)
+ char const* arguments)
{
std::vector<std::string> args_string;
std::string command = arguments;
@@ -4851,11 +4856,11 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
command.erase(0, start + 1);
args_string.push_back(command);
- std::vector<const char*> args;
+ std::vector<char const*> args;
args.reserve(3 + args_string.size());
args.push_back("kstat");
args.push_back("-p");
- for (const auto& i : args_string) {
+ for (auto const& i : args_string) {
args.push_back(i.c_str());
}
args.push_back(nullptr);
@@ -5017,7 +5022,7 @@ bool SystemInformationImplementation::QueryQNXMemory()
{
#if defined(__QNX__)
std::string buffer;
- std::vector<const char*> args;
+ std::vector<char const*> args;
args.clear();
args.push_back("showmem");
@@ -5077,7 +5082,7 @@ bool SystemInformationImplementation::QueryQNXProcessor()
// the output on my QNX 6.4.1 looks like this:
// Processor1: 686 Pentium II Stepping 3 2175MHz FPU
std::string buffer;
- std::vector<const char*> args;
+ std::vector<char const*> args;
args.clear();
args.push_back("pidin");
@@ -5128,7 +5133,11 @@ bool SystemInformationImplementation::QueryBSDProcessor()
defined(__DragonFly__)
int k;
size_t sz = sizeof(k);
+# ifdef HW_NCPUONLINE
+ int ctrl[2] = { CTL_HW, HW_NCPUONLINE };
+# else
int ctrl[2] = { CTL_HW, HW_NCPU };
+# endif
if (sysctl(ctrl, 2, &k, &sz, nullptr, 0) != 0) {
return false;
@@ -5496,8 +5505,8 @@ bool SystemInformationImplementation::QueryOSInformation()
}
this->Hostname = name;
- const char* arch = getenv("PROCESSOR_ARCHITECTURE");
- const char* wow64 = getenv("PROCESSOR_ARCHITEW6432");
+ char const* arch = getenv("PROCESSOR_ARCHITECTURE");
+ char const* wow64 = getenv("PROCESSOR_ARCHITEW6432");
if (arch) {
this->OSPlatform = arch;
}
@@ -5544,11 +5553,11 @@ bool SystemInformationImplementation::QueryOSInformation()
return true;
}
-int SystemInformationImplementation::CallSwVers(const char* arg,
+int SystemInformationImplementation::CallSwVers(char const* arg,
std::string& ver)
{
#ifdef __APPLE__
- std::vector<const char*> args;
+ std::vector<char const*> args;
args.push_back("sw_vers");
args.push_back(arg);
args.push_back(nullptr);
diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in
index c8efd51..cb8c214 100644
--- a/Source/kwsys/SystemInformation.hxx.in
+++ b/Source/kwsys/SystemInformation.hxx.in
@@ -20,47 +20,47 @@ class @KWSYS_NAMESPACE@_EXPORT SystemInformation
public:
// possible parameter values for DoesCPUSupportFeature()
- static const long int CPU_FEATURE_MMX = 1 << 0;
- static const long int CPU_FEATURE_MMX_PLUS = 1 << 1;
- static const long int CPU_FEATURE_SSE = 1 << 2;
- static const long int CPU_FEATURE_SSE2 = 1 << 3;
- static const long int CPU_FEATURE_AMD_3DNOW = 1 << 4;
- static const long int CPU_FEATURE_AMD_3DNOW_PLUS = 1 << 5;
- static const long int CPU_FEATURE_IA64 = 1 << 6;
- static const long int CPU_FEATURE_MP_CAPABLE = 1 << 7;
- static const long int CPU_FEATURE_HYPERTHREAD = 1 << 8;
- static const long int CPU_FEATURE_SERIALNUMBER = 1 << 9;
- static const long int CPU_FEATURE_APIC = 1 << 10;
- static const long int CPU_FEATURE_SSE_FP = 1 << 11;
- static const long int CPU_FEATURE_SSE_MMX = 1 << 12;
- static const long int CPU_FEATURE_CMOV = 1 << 13;
- static const long int CPU_FEATURE_MTRR = 1 << 14;
- static const long int CPU_FEATURE_L1CACHE = 1 << 15;
- static const long int CPU_FEATURE_L2CACHE = 1 << 16;
- static const long int CPU_FEATURE_L3CACHE = 1 << 17;
- static const long int CPU_FEATURE_ACPI = 1 << 18;
- static const long int CPU_FEATURE_THERMALMONITOR = 1 << 19;
- static const long int CPU_FEATURE_TEMPSENSEDIODE = 1 << 20;
- static const long int CPU_FEATURE_FREQUENCYID = 1 << 21;
- static const long int CPU_FEATURE_VOLTAGEID_FREQUENCY = 1 << 22;
- static const long int CPU_FEATURE_FPU = 1 << 23;
+ static long int const CPU_FEATURE_MMX = 1 << 0;
+ static long int const CPU_FEATURE_MMX_PLUS = 1 << 1;
+ static long int const CPU_FEATURE_SSE = 1 << 2;
+ static long int const CPU_FEATURE_SSE2 = 1 << 3;
+ static long int const CPU_FEATURE_AMD_3DNOW = 1 << 4;
+ static long int const CPU_FEATURE_AMD_3DNOW_PLUS = 1 << 5;
+ static long int const CPU_FEATURE_IA64 = 1 << 6;
+ static long int const CPU_FEATURE_MP_CAPABLE = 1 << 7;
+ static long int const CPU_FEATURE_HYPERTHREAD = 1 << 8;
+ static long int const CPU_FEATURE_SERIALNUMBER = 1 << 9;
+ static long int const CPU_FEATURE_APIC = 1 << 10;
+ static long int const CPU_FEATURE_SSE_FP = 1 << 11;
+ static long int const CPU_FEATURE_SSE_MMX = 1 << 12;
+ static long int const CPU_FEATURE_CMOV = 1 << 13;
+ static long int const CPU_FEATURE_MTRR = 1 << 14;
+ static long int const CPU_FEATURE_L1CACHE = 1 << 15;
+ static long int const CPU_FEATURE_L2CACHE = 1 << 16;
+ static long int const CPU_FEATURE_L3CACHE = 1 << 17;
+ static long int const CPU_FEATURE_ACPI = 1 << 18;
+ static long int const CPU_FEATURE_THERMALMONITOR = 1 << 19;
+ static long int const CPU_FEATURE_TEMPSENSEDIODE = 1 << 20;
+ static long int const CPU_FEATURE_FREQUENCYID = 1 << 21;
+ static long int const CPU_FEATURE_VOLTAGEID_FREQUENCY = 1 << 22;
+ static long int const CPU_FEATURE_FPU = 1 << 23;
public:
SystemInformation();
~SystemInformation();
- SystemInformation(const SystemInformation&) = delete;
- SystemInformation& operator=(const SystemInformation&) = delete;
+ SystemInformation(SystemInformation const&) = delete;
+ SystemInformation& operator=(SystemInformation const&) = delete;
- const char* GetVendorString();
- const char* GetVendorID();
+ char const* GetVendorString();
+ char const* GetVendorID();
std::string GetTypeID();
std::string GetFamilyID();
std::string GetModelID();
std::string GetModelName();
std::string GetSteppingCode();
- const char* GetExtendedProcessorName();
- const char* GetProcessorSerialNumber();
+ char const* GetExtendedProcessorName();
+ char const* GetProcessorSerialNumber();
int GetProcessorCacheSize();
unsigned int GetLogicalProcessorsPerPhysical();
float GetProcessorClockFrequency();
@@ -72,13 +72,13 @@ public:
// on this system.
std::string GetCPUDescription();
- const char* GetHostname();
+ char const* GetHostname();
std::string GetFullyQualifiedDomainName();
- const char* GetOSName();
- const char* GetOSRelease();
- const char* GetOSVersion();
- const char* GetOSPlatform();
+ char const* GetOSName();
+ char const* GetOSRelease();
+ char const* GetOSVersion();
+ char const* GetOSPlatform();
int GetOSIsWindows();
int GetOSIsLinux();
@@ -108,8 +108,8 @@ public:
// returns an informative general description if the installed and
// available ram on this system. See the GetHostMemoryTotal, and
// Get{Host,Proc}MemoryAvailable methods for more information.
- std::string GetMemoryDescription(const char* hostLimitEnvVarName = nullptr,
- const char* procLimitEnvVarName = nullptr);
+ std::string GetMemoryDescription(char const* hostLimitEnvVarName = nullptr,
+ char const* procLimitEnvVarName = nullptr);
// Retrieve amount of physical memory installed on the system in KiB
// units.
@@ -121,7 +121,7 @@ public:
// parallel. The amount of memory reported may differ from the host
// total if a host wide resource limit is applied. Such reource limits
// are reported to us via an application specified environment variable.
- long long GetHostMemoryAvailable(const char* hostLimitEnvVarName = nullptr);
+ long long GetHostMemoryAvailable(char const* hostLimitEnvVarName = nullptr);
// Get total system RAM in units of KiB available to this process.
// This may differ from the host available if a per-process resource
@@ -129,8 +129,8 @@ public:
// system via rlimit API. Resource limits that are not imposed via
// rlimit API may be reported to us via an application specified
// environment variable.
- long long GetProcMemoryAvailable(const char* hostLimitEnvVarName = nullptr,
- const char* procLimitEnvVarName = nullptr);
+ long long GetProcMemoryAvailable(char const* hostLimitEnvVarName = nullptr,
+ char const* procLimitEnvVarName = nullptr);
// Get the system RAM used by all processes on the host, in units of KiB.
long long GetHostMemoryUsed();
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 6cc103d..ef16256 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -59,9 +59,6 @@
#include <cctype>
#include <cerrno>
-#ifdef __QNX__
-# include <malloc.h> /* for malloc/free on QNX */
-#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -107,7 +104,7 @@
# include <windows.h>
# include <winioctl.h>
# ifndef INVALID_FILE_ATTRIBUTES
-# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+# define INVALID_FILE_ATTRIBUTES ((DWORD) - 1)
# endif
# ifndef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
# define SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE (0x2)
@@ -262,12 +259,12 @@ static inline void usleep(unsigned int msec)
}
// BeOS 5 also doesn't have realpath(), but its C++ API offers something close.
-static inline char* realpath(const char* path, char* resolved_path)
+static inline char* realpath(char const* path, char* resolved_path)
{
- const size_t maxlen = KWSYS_SYSTEMTOOLS_MAXPATH;
+ size_t const maxlen = KWSYS_SYSTEMTOOLS_MAXPATH;
snprintf(resolved_path, maxlen, "%s", path);
BPath normalized(resolved_path, nullptr, true);
- const char* resolved = normalized.Path();
+ char const* resolved = normalized.Path();
if (resolved) // nullptr == No such file.
{
if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) {
@@ -299,7 +296,7 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft)
typedef KWSYS_NAMESPACE::SystemTools::mode_t mode_t;
# endif
-inline int Mkdir(const std::string& dir, const mode_t* mode)
+inline int Mkdir(std::string const& dir, mode_t const* mode)
{
int ret =
_wmkdir(KWSYS_NAMESPACE::Encoding::ToWindowsExtendedPath(dir).c_str());
@@ -307,12 +304,12 @@ inline int Mkdir(const std::string& dir, const mode_t* mode)
KWSYS_NAMESPACE::SystemTools::SetPermissions(dir, *mode);
return ret;
}
-inline int Rmdir(const std::string& dir)
+inline int Rmdir(std::string const& dir)
{
return _wrmdir(
KWSYS_NAMESPACE::Encoding::ToWindowsExtendedPath(dir).c_str());
}
-inline const char* Getcwd(char* buf, unsigned int len)
+inline char const* Getcwd(char* buf, unsigned int len)
{
std::vector<wchar_t> w_buf(len);
if (_wgetcwd(&w_buf[0], len)) {
@@ -330,18 +327,17 @@ inline const char* Getcwd(char* buf, unsigned int len)
}
return 0;
}
-inline int Chdir(const std::string& dir)
+inline int Chdir(std::string const& dir)
{
return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
}
-inline void Realpath(const std::string& path, std::string& resolved_path,
+inline void Realpath(std::string const& path, std::string& resolved_path,
std::string* errorMessage = nullptr)
{
std::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
- wchar_t* ptemp;
wchar_t fullpath[MAX_PATH];
DWORD bufferLen = GetFullPathNameW(
- tmp.c_str(), sizeof(fullpath) / sizeof(fullpath[0]), fullpath, &ptemp);
+ tmp.c_str(), sizeof(fullpath) / sizeof(fullpath[0]), fullpath, nullptr);
if (bufferLen < sizeof(fullpath) / sizeof(fullpath[0])) {
resolved_path = KWSYS_NAMESPACE::Encoding::ToNarrow(fullpath);
KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path);
@@ -371,24 +367,24 @@ inline void Realpath(const std::string& path, std::string& resolved_path,
# include <fcntl.h>
# include <unistd.h>
-inline int Mkdir(const std::string& dir, const mode_t* mode)
+inline int Mkdir(std::string const& dir, mode_t const* mode)
{
return mkdir(dir.c_str(), mode ? *mode : 00777);
}
-inline int Rmdir(const std::string& dir)
+inline int Rmdir(std::string const& dir)
{
return rmdir(dir.c_str());
}
-inline const char* Getcwd(char* buf, unsigned int len)
+inline char const* Getcwd(char* buf, unsigned int len)
{
return getcwd(buf, len);
}
-inline int Chdir(const std::string& dir)
+inline int Chdir(std::string const& dir)
{
return chdir(dir.c_str());
}
-inline void Realpath(const std::string& path, std::string& resolved_path,
+inline void Realpath(std::string const& path, std::string& resolved_path,
std::string* errorMessage = nullptr)
{
char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
@@ -438,11 +434,11 @@ using envchar = char;
/* Order by environment key only (VAR from VAR=VALUE). */
struct kwsysEnvCompare
{
- bool operator()(const envchar* l, const envchar* r) const
+ bool operator()(envchar const* l, envchar const* r) const
{
#if defined(_WIN32)
- const wchar_t* leq = wcschr(l, L'=');
- const wchar_t* req = wcschr(r, L'=');
+ wchar_t const* leq = wcschr(l, L'=');
+ wchar_t const* req = wcschr(r, L'=');
size_t llen = leq ? (leq - l) : wcslen(l);
size_t rlen = req ? (req - r) : wcslen(r);
if (llen == rlen) {
@@ -451,8 +447,8 @@ struct kwsysEnvCompare
return wcscmp(l, r) < 0;
}
#else
- const char* leq = strchr(l, '=');
- const char* req = strchr(r, '=');
+ char const* leq = strchr(l, '=');
+ char const* req = strchr(r, '=');
size_t llen = leq ? static_cast<size_t>(leq - l) : strlen(l);
size_t rlen = req ? static_cast<size_t>(req - r) : strlen(r);
if (llen == rlen) {
@@ -464,27 +460,27 @@ struct kwsysEnvCompare
}
};
-class kwsysEnvSet : public std::set<const envchar*, kwsysEnvCompare>
+class kwsysEnvSet : public std::set<envchar const*, kwsysEnvCompare>
{
public:
class Free
{
- const envchar* Env;
+ envchar const* Env;
public:
- Free(const envchar* env)
+ Free(envchar const* env)
: Env(env)
{
}
~Free() { free(const_cast<envchar*>(this->Env)); }
- Free(const Free&) = delete;
- Free& operator=(const Free&) = delete;
+ Free(Free const&) = delete;
+ Free& operator=(Free const&) = delete;
};
- const envchar* Release(const envchar* env)
+ envchar const* Release(envchar const* env)
{
- const envchar* old = nullptr;
+ envchar const* old = nullptr;
auto i = this->find(env);
if (i != this->end()) {
old = *i;
@@ -494,94 +490,36 @@ public:
}
};
-#ifdef _WIN32
-# if defined(_WIN64)
-static constexpr size_t FNV_OFFSET_BASIS = 14695981039346656037ULL;
-static constexpr size_t FNV_PRIME = 1099511628211ULL;
-# else
-static constexpr size_t FNV_OFFSET_BASIS = 2166136261U;
-static constexpr size_t FNV_PRIME = 16777619U;
-# endif
-
-// Case insensitive Fnv1a hash
-struct SystemToolsPathCaseHash
-{
- size_t operator()(std::string const& path) const
- {
- size_t hash = FNV_OFFSET_BASIS;
- for (auto c : path) {
- hash ^= static_cast<size_t>(std::tolower(c));
- hash *= FNV_PRIME;
- }
-
- return hash;
- }
-};
-
-struct SystemToolsPathCaseEqual
-{
- bool operator()(std::string const& l, std::string const& r) const
- {
-# ifdef _MSC_VER
- return _stricmp(l.c_str(), r.c_str()) == 0;
-# elif defined(__GNUC__)
- return strcasecmp(l.c_str(), r.c_str()) == 0;
-# else
- return SystemTools::Strucmp(l.c_str(), r.c_str()) == 0;
-# endif
- }
-};
-#endif
-
/**
* SystemTools static variables singleton class.
*/
class SystemToolsStatic
{
public:
- using StringMap = std::map<std::string, std::string>;
-#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP
- /**
- * Path translation table from dir to refdir
- * Each time 'dir' will be found it will be replace by 'refdir'
- */
- StringMap TranslationMap;
-#endif
#ifdef _WIN32
- static std::string GetCasePathName(std::string const& pathIn,
- bool const cache);
- static std::string GetActualCaseForPathCached(std::string const& path);
- static const char* GetEnvBuffered(const char* key);
- std::unordered_map<std::string, std::string, SystemToolsPathCaseHash,
- SystemToolsPathCaseEqual>
- FindFileMap;
- std::unordered_map<std::string, std::string, SystemToolsPathCaseHash,
- SystemToolsPathCaseEqual>
- PathCaseMap;
+ static std::string GetCasePathName(std::string const& pathIn);
+ static char const* GetEnvBuffered(char const* key);
std::map<std::string, std::string> EnvMap;
#endif
-#ifdef __CYGWIN__
- StringMap Cyg2Win32Map;
-#endif
/**
* Actual implementation of ReplaceString.
*/
- static void ReplaceString(std::string& source, const char* replace,
- size_t replaceSize, const std::string& with);
+ static void ReplaceString(std::string& source, char const* replace,
+ size_t replaceSize, std::string const& with);
/**
* Actual implementation of FileIsFullPath.
*/
- static bool FileIsFullPath(const char*, size_t);
+ static bool FileIsFullPath(char const*, size_t);
/**
* Find a filename (file or directory) in the system PATH, with
* optional extra paths.
*/
static std::string FindName(
- const std::string& name,
- const std::vector<std::string>& userPaths = std::vector<std::string>(),
+ std::string const& name,
+ std::vector<std::string> const& userPaths = std::vector<std::string>(),
bool no_system_path = false);
};
@@ -589,8 +527,7 @@ public:
static SystemToolsStatic* SystemToolsStatics;
#ifdef _WIN32
-std::string SystemToolsStatic::GetCasePathName(std::string const& pathIn,
- bool const cache)
+std::string SystemToolsStatic::GetCasePathName(std::string const& pathIn)
{
std::string casePath;
@@ -614,7 +551,7 @@ std::string SystemToolsStatic::GetCasePathName(std::string const& pathIn,
if (casePath.size() > 1 && casePath[1] == ':') {
casePath[0] = toupper(casePath[0]);
}
- const char* sep = "";
+ char const* sep = "";
// If network path, fill casePath with server/share so FindFirstFile
// will work after that. Maybe someday call other APIs to get
@@ -643,30 +580,15 @@ std::string SystemToolsStatic::GetCasePathName(std::string const& pathIn,
std::string test_str = casePath;
test_str += path_components[idx];
- bool found_in_cache = false;
- if (cache) {
- auto const it = SystemToolsStatics->FindFileMap.find(test_str);
- if (it != SystemToolsStatics->FindFileMap.end()) {
- path_components[idx] = it->second;
- found_in_cache = true;
- }
- }
-
- if (!found_in_cache) {
- WIN32_FIND_DATAW findData;
- HANDLE hFind =
- ::FindFirstFileW(Encoding::ToWide(test_str).c_str(), &findData);
- if (INVALID_HANDLE_VALUE != hFind) {
- auto case_file_name = Encoding::ToNarrow(findData.cFileName);
- if (cache) {
- SystemToolsStatics->FindFileMap.emplace(test_str,
- case_file_name);
- }
- path_components[idx] = std::move(case_file_name);
- ::FindClose(hFind);
- } else {
- converting = false;
- }
+ WIN32_FIND_DATAW findData;
+ HANDLE hFind =
+ ::FindFirstFileW(Encoding::ToWide(test_str).c_str(), &findData);
+ if (INVALID_HANDLE_VALUE != hFind) {
+ auto case_file_name = Encoding::ToNarrow(findData.cFileName);
+ path_components[idx] = std::move(case_file_name);
+ ::FindClose(hFind);
+ } else {
+ converting = false;
}
}
}
@@ -675,31 +597,16 @@ std::string SystemToolsStatic::GetCasePathName(std::string const& pathIn,
}
return casePath;
}
-
-std::string SystemToolsStatic::GetActualCaseForPathCached(std::string const& p)
-{
- std::string casePath;
-
- auto it = SystemToolsStatics->PathCaseMap.find(p);
- if (it != SystemToolsStatics->PathCaseMap.end()) {
- casePath = it->second;
- } else {
- casePath = SystemToolsStatic::GetCasePathName(p, true);
- SystemToolsStatics->PathCaseMap.emplace(p, casePath);
- }
-
- return casePath;
-}
#endif
// adds the elements of the env variable path to the arg passed in
-void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
+void SystemTools::GetPath(std::vector<std::string>& path, char const* env)
{
size_t const old_size = path.size();
#if defined(_WIN32) && !defined(__CYGWIN__)
- const char pathSep = ';';
+ char const pathSep = ';';
#else
- const char pathSep = ':';
+ char const pathSep = ':';
#endif
if (!env) {
env = "PATH";
@@ -730,7 +637,7 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
}
#if defined(_WIN32)
-const char* SystemToolsStatic::GetEnvBuffered(const char* key)
+char const* SystemToolsStatic::GetEnvBuffered(char const* key)
{
std::string env;
if (SystemTools::GetEnv(key, env)) {
@@ -744,7 +651,7 @@ const char* SystemToolsStatic::GetEnvBuffered(const char* key)
}
#endif
-const char* SystemTools::GetEnv(const char* key)
+char const* SystemTools::GetEnv(char const* key)
{
#if defined(_WIN32)
return SystemToolsStatic::GetEnvBuffered(key);
@@ -753,7 +660,7 @@ const char* SystemTools::GetEnv(const char* key)
#endif
}
-const char* SystemTools::GetEnv(const std::string& key)
+char const* SystemTools::GetEnv(std::string const& key)
{
#if defined(_WIN32)
return SystemToolsStatic::GetEnvBuffered(key.c_str());
@@ -762,7 +669,7 @@ const char* SystemTools::GetEnv(const std::string& key)
#endif
}
-bool SystemTools::GetEnv(const char* key, std::string& result)
+bool SystemTools::GetEnv(char const* key, std::string& result)
{
#if defined(_WIN32)
auto wide_key = Encoding::ToWide(key);
@@ -776,7 +683,7 @@ bool SystemTools::GetEnv(const char* key, std::string& result)
result = Encoding::ToNarrow(wide_result);
return true;
#else
- const char* v = getenv(key);
+ char const* v = getenv(key);
if (v) {
result = v;
return true;
@@ -785,23 +692,23 @@ bool SystemTools::GetEnv(const char* key, std::string& result)
return false;
}
-bool SystemTools::GetEnv(const std::string& key, std::string& result)
+bool SystemTools::GetEnv(std::string const& key, std::string& result)
{
return SystemTools::GetEnv(key.c_str(), result);
}
-bool SystemTools::HasEnv(const char* key)
+bool SystemTools::HasEnv(char const* key)
{
#if defined(_WIN32)
- const std::wstring wkey = Encoding::ToWide(key);
- const wchar_t* v = _wgetenv(wkey.c_str());
+ std::wstring const wkey = Encoding::ToWide(key);
+ wchar_t const* v = _wgetenv(wkey.c_str());
#else
- const char* v = getenv(key);
+ char const* v = getenv(key);
#endif
return v;
}
-bool SystemTools::HasEnv(const std::string& key)
+bool SystemTools::HasEnv(std::string const& key)
{
return SystemTools::HasEnv(key.c_str());
}
@@ -809,7 +716,7 @@ bool SystemTools::HasEnv(const std::string& key)
#if KWSYS_CXX_HAS_UNSETENV
/* unsetenv("A") removes A from the environment.
On older platforms it returns void instead of int. */
-static int kwsysUnPutEnv(const std::string& env)
+static int kwsysUnPutEnv(std::string const& env)
{
size_t pos = env.find('=');
if (pos != std::string::npos) {
@@ -824,25 +731,14 @@ static int kwsysUnPutEnv(const std::string& env)
#elif defined(__CYGWIN__) || defined(__GLIBC__)
/* putenv("A") removes A from the environment. It must not put the
memory in the environment because it does not have any "=" syntax. */
-static int kwsysUnPutEnv(const std::string& env)
+
+static int kwsysUnPutEnv(std::string const& env)
{
int err = 0;
- size_t pos = env.find('=');
- size_t const len = pos == std::string::npos ? env.size() : pos;
- size_t const sz = len + 1;
- char local_buf[256];
- char* buf = sz > sizeof(local_buf) ? (char*)malloc(sz) : local_buf;
- if (!buf) {
- return -1;
- }
- strncpy(buf, env.c_str(), len);
- buf[len] = 0;
- if (putenv(buf) < 0 && errno != EINVAL) {
+ std::string buf = env.substr(0, env.find('='));
+ if (putenv(&buf[0]) < 0 && errno != EINVAL) {
err = errno;
}
- if (buf != local_buf) {
- free(buf);
- }
if (err) {
errno = err;
return -1;
@@ -875,7 +771,7 @@ static int kwsysUnPutEnv(std::string const& env)
#else
/* Manipulate the "environ" global directly. */
-static int kwsysUnPutEnv(const std::string& env)
+static int kwsysUnPutEnv(std::string const& env)
{
size_t pos = env.find('=');
size_t const len = pos == std::string::npos ? env.size() : pos;
@@ -900,7 +796,7 @@ static int kwsysUnPutEnv(const std::string& env)
/* setenv("A", "B", 1) will set A=B in the environment and makes its
own copies of the strings. */
-bool SystemTools::PutEnv(const std::string& env)
+bool SystemTools::PutEnv(std::string const& env)
{
size_t pos = env.find('=');
if (pos != std::string::npos) {
@@ -911,7 +807,7 @@ bool SystemTools::PutEnv(const std::string& env)
}
}
-bool SystemTools::UnPutEnv(const std::string& env)
+bool SystemTools::UnPutEnv(std::string const& env)
{
return kwsysUnPutEnv(env) == 0;
}
@@ -936,7 +832,7 @@ public:
{
for (iterator i = this->begin(); i != this->end(); ++i) {
# if defined(_WIN32)
- const std::string s = Encoding::ToNarrow(*i);
+ std::string const s = Encoding::ToNarrow(*i);
kwsysUnPutEnv(s);
# else
kwsysUnPutEnv(*i);
@@ -944,10 +840,10 @@ public:
free(const_cast<envchar*>(*i));
}
}
- bool Put(const char* env)
+ bool Put(char const* env)
{
# if defined(_WIN32)
- const std::wstring wEnv = Encoding::ToWide(env);
+ std::wstring const wEnv = Encoding::ToWide(env);
wchar_t* newEnv = _wcsdup(wEnv.c_str());
# else
char* newEnv = strdup(env);
@@ -960,10 +856,10 @@ public:
return putenv(newEnv) == 0;
# endif
}
- bool UnPut(const char* env)
+ bool UnPut(char const* env)
{
# if defined(_WIN32)
- const std::wstring wEnv = Encoding::ToWide(env);
+ std::wstring const wEnv = Encoding::ToWide(env);
Free oldEnv(this->Release(wEnv.c_str()));
# else
Free oldEnv(this->Release(env));
@@ -974,19 +870,19 @@ public:
static kwsysEnv kwsysEnvInstance;
-bool SystemTools::PutEnv(const std::string& env)
+bool SystemTools::PutEnv(std::string const& env)
{
return kwsysEnvInstance.Put(env.c_str());
}
-bool SystemTools::UnPutEnv(const std::string& env)
+bool SystemTools::UnPutEnv(std::string const& env)
{
return kwsysEnvInstance.UnPut(env.c_str());
}
#endif
-const char* SystemTools::GetExecutableExtension()
+char const* SystemTools::GetExecutableExtension()
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
return ".exe";
@@ -995,7 +891,7 @@ const char* SystemTools::GetExecutableExtension()
#endif
}
-FILE* SystemTools::Fopen(const std::string& file, const char* mode)
+FILE* SystemTools::Fopen(std::string const& file, char const* mode)
{
#ifdef _WIN32
// Remove any 'e', which is supported on UNIX, but not Windows.
@@ -1009,7 +905,7 @@ FILE* SystemTools::Fopen(const std::string& file, const char* mode)
#endif
}
-Status SystemTools::MakeDirectory(const char* path, const mode_t* mode)
+Status SystemTools::MakeDirectory(char const* path, mode_t const* mode)
{
if (!path) {
return Status::POSIX(EINVAL);
@@ -1017,7 +913,7 @@ Status SystemTools::MakeDirectory(const char* path, const mode_t* mode)
return SystemTools::MakeDirectory(std::string(path), mode);
}
-Status SystemTools::MakeDirectory(std::string const& path, const mode_t* mode)
+Status SystemTools::MakeDirectory(std::string const& path, mode_t const* mode)
{
if (path.empty()) {
return Status::POSIX(EINVAL);
@@ -1054,8 +950,8 @@ Status SystemTools::MakeDirectory(std::string const& path, const mode_t* mode)
// replace replace with with as many times as it shows up in source.
// write the result into source.
void SystemTools::ReplaceString(std::string& source,
- const std::string& replace,
- const std::string& with)
+ std::string const& replace,
+ std::string const& with)
{
// do while hangs if replaceSize is 0
if (replace.empty()) {
@@ -1066,8 +962,8 @@ void SystemTools::ReplaceString(std::string& source,
with);
}
-void SystemTools::ReplaceString(std::string& source, const char* replace,
- const char* with)
+void SystemTools::ReplaceString(std::string& source, char const* replace,
+ char const* with)
{
// do while hangs if replaceSize is 0
if (!*replace) {
@@ -1078,11 +974,11 @@ void SystemTools::ReplaceString(std::string& source, const char* replace,
with ? with : "");
}
-void SystemToolsStatic::ReplaceString(std::string& source, const char* replace,
+void SystemToolsStatic::ReplaceString(std::string& source, char const* replace,
size_t replaceSize,
- const std::string& with)
+ std::string const& with)
{
- const char* src = source.c_str();
+ char const* src = source.c_str();
char* searchPos = const_cast<char*>(strstr(src, replace));
// get out quick if string is not found
@@ -1121,7 +1017,7 @@ void SystemToolsStatic::ReplaceString(std::string& source, const char* replace,
# define KWSYS_ST_KEY_WOW64_64KEY 0x0100
# endif
-static bool hasPrefix(const std::string& s, const char* pattern,
+static bool hasPrefix(std::string const& s, char const* pattern,
std::string::size_type spos)
{
size_t plen = strlen(pattern);
@@ -1130,7 +1026,7 @@ static bool hasPrefix(const std::string& s, const char* pattern,
return s.compare(0, plen, pattern) == 0;
}
-static bool SystemToolsParseRegistryKey(const std::string& key,
+static bool SystemToolsParseRegistryKey(std::string const& key,
HKEY& primaryKey, std::wstring& second,
std::string* valuename)
{
@@ -1181,7 +1077,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::GetRegistrySubKeys(const std::string& key,
+bool SystemTools::GetRegistrySubKeys(std::string const& key,
std::vector<std::string>& subkeys,
KeyWOW64 view)
{
@@ -1212,7 +1108,7 @@ bool SystemTools::GetRegistrySubKeys(const std::string& key,
return true;
}
#else
-bool SystemTools::GetRegistrySubKeys(const std::string&,
+bool SystemTools::GetRegistrySubKeys(std::string const&,
std::vector<std::string>&, KeyWOW64)
{
return false;
@@ -1227,7 +1123,7 @@ bool SystemTools::GetRegistrySubKeys(const std::string&,
// => will return the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::ReadRegistryValue(const std::string& key, std::string& value,
+bool SystemTools::ReadRegistryValue(std::string const& key, std::string& value,
KeyWOW64 view)
{
bool valueset = false;
@@ -1268,7 +1164,7 @@ bool SystemTools::ReadRegistryValue(const std::string& key, std::string& value,
return valueset;
}
#else
-bool SystemTools::ReadRegistryValue(const std::string&, std::string&, KeyWOW64)
+bool SystemTools::ReadRegistryValue(std::string const&, std::string&, KeyWOW64)
{
return false;
}
@@ -1282,8 +1178,8 @@ bool SystemTools::ReadRegistryValue(const std::string&, std::string&, KeyWOW64)
// => will set the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::WriteRegistryValue(const std::string& key,
- const std::string& value, KeyWOW64 view)
+bool SystemTools::WriteRegistryValue(std::string const& key,
+ std::string const& value, KeyWOW64 view)
{
HKEY primaryKey = HKEY_CURRENT_USER;
std::wstring second;
@@ -1312,7 +1208,7 @@ bool SystemTools::WriteRegistryValue(const std::string& key,
return false;
}
#else
-bool SystemTools::WriteRegistryValue(const std::string&, const std::string&,
+bool SystemTools::WriteRegistryValue(std::string const&, std::string const&,
KeyWOW64)
{
return false;
@@ -1327,7 +1223,7 @@ bool SystemTools::WriteRegistryValue(const std::string&, const std::string&,
// => will delete the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::DeleteRegistryValue(const std::string& key, KeyWOW64 view)
+bool SystemTools::DeleteRegistryValue(std::string const& key, KeyWOW64 view)
{
HKEY primaryKey = HKEY_CURRENT_USER;
std::wstring second;
@@ -1350,7 +1246,7 @@ bool SystemTools::DeleteRegistryValue(const std::string& key, KeyWOW64 view)
return false;
}
#else
-bool SystemTools::DeleteRegistryValue(const std::string&, KeyWOW64)
+bool SystemTools::DeleteRegistryValue(std::string const&, KeyWOW64)
{
return false;
}
@@ -1366,14 +1262,14 @@ SystemTools::WindowsFileId::WindowsFileId(unsigned long volumeSerialNumber,
{
}
-bool SystemTools::WindowsFileId::operator==(const WindowsFileId& o) const
+bool SystemTools::WindowsFileId::operator==(WindowsFileId const& o) const
{
return (m_volumeSerialNumber == o.m_volumeSerialNumber &&
m_fileIndexHigh == o.m_fileIndexHigh &&
m_fileIndexLow == o.m_fileIndexLow);
}
-bool SystemTools::WindowsFileId::operator!=(const WindowsFileId& o) const
+bool SystemTools::WindowsFileId::operator!=(WindowsFileId const& o) const
{
return !(*this == o);
}
@@ -1386,20 +1282,20 @@ SystemTools::UnixFileId::UnixFileId(dev_t volumeSerialNumber,
{
}
-bool SystemTools::UnixFileId::operator==(const UnixFileId& o) const
+bool SystemTools::UnixFileId::operator==(UnixFileId const& o) const
{
return (m_volumeSerialNumber == o.m_volumeSerialNumber &&
m_fileSerialNumber == o.m_fileSerialNumber &&
m_fileSize == o.m_fileSize);
}
-bool SystemTools::UnixFileId::operator!=(const UnixFileId& o) const
+bool SystemTools::UnixFileId::operator!=(UnixFileId const& o) const
{
return !(*this == o);
}
#endif
-bool SystemTools::GetFileId(const std::string& file, FileId& id)
+bool SystemTools::GetFileId(std::string const& file, FileId& id)
{
#ifdef _WIN32
HANDLE hFile =
@@ -1425,7 +1321,7 @@ bool SystemTools::GetFileId(const std::string& file, FileId& id)
#endif
}
-bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
+bool SystemTools::SameFile(std::string const& file1, std::string const& file2)
{
#ifdef _WIN32
HANDLE hFile1, hFile2;
@@ -1473,7 +1369,7 @@ bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
#endif
}
-bool SystemTools::PathExists(const std::string& path)
+bool SystemTools::PathExists(std::string const& path)
{
if (path.empty()) {
return false;
@@ -1487,7 +1383,7 @@ bool SystemTools::PathExists(const std::string& path)
#endif
}
-bool SystemTools::FileExists(const char* filename)
+bool SystemTools::FileExists(char const* filename)
{
if (!filename) {
return false;
@@ -1495,13 +1391,13 @@ bool SystemTools::FileExists(const char* filename)
return SystemTools::FileExists(std::string(filename));
}
-bool SystemTools::FileExists(const std::string& filename)
+bool SystemTools::FileExists(std::string const& filename)
{
if (filename.empty()) {
return false;
}
#if defined(_WIN32)
- const std::wstring path = Encoding::ToWindowsExtendedPath(filename);
+ std::wstring const path = Encoding::ToWindowsExtendedPath(filename);
DWORD attr = GetFileAttributesW(path.c_str());
if (attr == INVALID_FILE_ATTRIBUTES) {
return false;
@@ -1558,7 +1454,7 @@ bool SystemTools::FileExists(const std::string& filename)
#endif
}
-bool SystemTools::FileExists(const char* filename, bool isFile)
+bool SystemTools::FileExists(char const* filename, bool isFile)
{
if (!filename) {
return false;
@@ -1566,7 +1462,7 @@ bool SystemTools::FileExists(const char* filename, bool isFile)
return SystemTools::FileExists(std::string(filename), isFile);
}
-bool SystemTools::FileExists(const std::string& filename, bool isFile)
+bool SystemTools::FileExists(std::string const& filename, bool isFile)
{
if (SystemTools::FileExists(filename)) {
// If isFile is set return not FileIsDirectory,
@@ -1576,7 +1472,7 @@ bool SystemTools::FileExists(const std::string& filename, bool isFile)
return false;
}
-bool SystemTools::TestFileAccess(const char* filename,
+bool SystemTools::TestFileAccess(char const* filename,
TestFilePermissions permissions)
{
if (!filename) {
@@ -1585,7 +1481,7 @@ bool SystemTools::TestFileAccess(const char* filename,
return SystemTools::TestFileAccess(std::string(filename), permissions);
}
-bool SystemTools::TestFileAccess(const std::string& filename,
+bool SystemTools::TestFileAccess(std::string const& filename,
TestFilePermissions permissions)
{
if (filename.empty()) {
@@ -1606,7 +1502,7 @@ bool SystemTools::TestFileAccess(const std::string& filename,
#endif
}
-int SystemTools::Stat(const char* path, SystemTools::Stat_t* buf)
+int SystemTools::Stat(char const* path, SystemTools::Stat_t* buf)
{
if (!path) {
errno = EFAULT;
@@ -1615,7 +1511,7 @@ int SystemTools::Stat(const char* path, SystemTools::Stat_t* buf)
return SystemTools::Stat(std::string(path), buf);
}
-int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf)
+int SystemTools::Stat(std::string const& path, SystemTools::Stat_t* buf)
{
if (path.empty()) {
errno = ENOENT;
@@ -1741,7 +1637,7 @@ Status SystemTools::FileTimeCompare(std::string const& f1,
// Return a capitalized string (i.e the first letter is uppercased, all other
// are lowercased)
-std::string SystemTools::Capitalized(const std::string& s)
+std::string SystemTools::Capitalized(std::string const& s)
{
std::string n;
if (s.empty()) {
@@ -1756,7 +1652,7 @@ std::string SystemTools::Capitalized(const std::string& s)
}
// Return capitalized words
-std::string SystemTools::CapitalizedWords(const std::string& s)
+std::string SystemTools::CapitalizedWords(std::string const& s)
{
std::string n(s);
for (size_t i = 0; i < s.size(); i++) {
@@ -1776,7 +1672,7 @@ std::string SystemTools::CapitalizedWords(const std::string& s)
}
// Return uncapitalized words
-std::string SystemTools::UnCapitalizedWords(const std::string& s)
+std::string SystemTools::UnCapitalizedWords(std::string const& s)
{
std::string n(s);
for (size_t i = 0; i < s.size(); i++) {
@@ -1796,7 +1692,7 @@ std::string SystemTools::UnCapitalizedWords(const std::string& s)
}
// only works for words with at least two letters
-std::string SystemTools::AddSpaceBetweenCapitalizedWords(const std::string& s)
+std::string SystemTools::AddSpaceBetweenCapitalizedWords(std::string const& s)
{
std::string n;
if (!s.empty()) {
@@ -1812,7 +1708,7 @@ std::string SystemTools::AddSpaceBetweenCapitalizedWords(const std::string& s)
return n;
}
-char* SystemTools::AppendStrings(const char* str1, const char* str2)
+char* SystemTools::AppendStrings(char const* str1, char const* str2)
{
if (!str1) {
return SystemTools::DuplicateString(str2);
@@ -1830,8 +1726,8 @@ char* SystemTools::AppendStrings(const char* str1, const char* str2)
return newstr;
}
-char* SystemTools::AppendStrings(const char* str1, const char* str2,
- const char* str3)
+char* SystemTools::AppendStrings(char const* str1, char const* str2,
+ char const* str3)
{
if (!str1) {
return SystemTools::AppendStrings(str2, str3);
@@ -1855,7 +1751,7 @@ char* SystemTools::AppendStrings(const char* str1, const char* str2,
}
// Return a lower case string
-std::string SystemTools::LowerCase(const std::string& s)
+std::string SystemTools::LowerCase(std::string const& s)
{
std::string n;
n.resize(s.size());
@@ -1866,7 +1762,7 @@ std::string SystemTools::LowerCase(const std::string& s)
}
// Return a lower case string
-std::string SystemTools::UpperCase(const std::string& s)
+std::string SystemTools::UpperCase(std::string const& s)
{
std::string n;
n.resize(s.size());
@@ -1877,7 +1773,7 @@ std::string SystemTools::UpperCase(const std::string& s)
}
// Count char in string
-size_t SystemTools::CountChar(const char* str, char c)
+size_t SystemTools::CountChar(char const* str, char c)
{
size_t count = 0;
@@ -1893,7 +1789,7 @@ size_t SystemTools::CountChar(const char* str, char c)
}
// Remove chars in string
-char* SystemTools::RemoveChars(const char* str, const char* toremove)
+char* SystemTools::RemoveChars(char const* str, char const* toremove)
{
if (!str) {
return nullptr;
@@ -1901,7 +1797,7 @@ char* SystemTools::RemoveChars(const char* str, const char* toremove)
char* clean_str = new char[strlen(str) + 1];
char* ptr = clean_str;
while (*str) {
- const char* str2 = toremove;
+ char const* str2 = toremove;
while (*str2 && *str != *str2) {
++str2;
}
@@ -1915,7 +1811,7 @@ char* SystemTools::RemoveChars(const char* str, const char* toremove)
}
// Remove chars in string
-char* SystemTools::RemoveCharsButUpperHex(const char* str)
+char* SystemTools::RemoveCharsButUpperHex(char const* str)
{
if (!str) {
return nullptr;
@@ -1933,13 +1829,13 @@ char* SystemTools::RemoveCharsButUpperHex(const char* str)
}
// Replace chars in string
-char* SystemTools::ReplaceChars(char* str, const char* toreplace,
+char* SystemTools::ReplaceChars(char* str, char const* toreplace,
char replacement)
{
if (str) {
char* ptr = str;
while (*ptr) {
- const char* ptr2 = toreplace;
+ char const* ptr2 = toreplace;
while (*ptr2) {
if (*ptr == *ptr2) {
*ptr = replacement;
@@ -1953,7 +1849,7 @@ char* SystemTools::ReplaceChars(char* str, const char* toreplace,
}
// Returns if string starts with another string
-bool SystemTools::StringStartsWith(const char* str1, const char* str2)
+bool SystemTools::StringStartsWith(char const* str1, char const* str2)
{
if (!str1 || !str2) {
return false;
@@ -1963,7 +1859,7 @@ bool SystemTools::StringStartsWith(const char* str1, const char* str2)
}
// Returns if string starts with another string
-bool SystemTools::StringStartsWith(const std::string& str1, const char* str2)
+bool SystemTools::StringStartsWith(std::string const& str1, char const* str2)
{
if (!str2) {
return false;
@@ -1973,7 +1869,7 @@ bool SystemTools::StringStartsWith(const std::string& str1, const char* str2)
}
// Returns if string ends with another string
-bool SystemTools::StringEndsWith(const char* str1, const char* str2)
+bool SystemTools::StringEndsWith(char const* str1, char const* str2)
{
if (!str1 || !str2) {
return false;
@@ -1984,7 +1880,7 @@ bool SystemTools::StringEndsWith(const char* str1, const char* str2)
}
// Returns if string ends with another string
-bool SystemTools::StringEndsWith(const std::string& str1, const char* str2)
+bool SystemTools::StringEndsWith(std::string const& str1, char const* str2)
{
if (!str2) {
return false;
@@ -1996,7 +1892,7 @@ bool SystemTools::StringEndsWith(const std::string& str1, const char* str2)
}
// Returns a pointer to the last occurrence of str2 in str1
-const char* SystemTools::FindLastString(const char* str1, const char* str2)
+char const* SystemTools::FindLastString(char const* str1, char const* str2)
{
if (!str1 || !str2) {
return nullptr;
@@ -2004,7 +1900,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
size_t len1 = strlen(str1), len2 = strlen(str2);
if (len1 >= len2) {
- const char* ptr = str1 + len1 - len2;
+ char const* ptr = str1 + len1 - len2;
do {
if (!strncmp(ptr, str2, len2)) {
return ptr;
@@ -2016,7 +1912,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
}
// Duplicate string
-char* SystemTools::DuplicateString(const char* str)
+char* SystemTools::DuplicateString(char const* str)
{
if (str) {
char* newstr = new char[strlen(str) + 1];
@@ -2026,7 +1922,7 @@ char* SystemTools::DuplicateString(const char* str)
}
// Return a cropped string
-std::string SystemTools::CropString(const std::string& s, size_t max_len)
+std::string SystemTools::CropString(std::string const& s, size_t max_len)
{
if (s.empty() || max_len == 0 || max_len >= s.size()) {
return s;
@@ -2053,7 +1949,7 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len)
return n;
}
-std::vector<std::string> SystemTools::SplitString(const std::string& p,
+std::vector<std::string> SystemTools::SplitString(std::string const& p,
char sep, bool isPath)
{
std::string path = p;
@@ -2077,7 +1973,7 @@ std::vector<std::string> SystemTools::SplitString(const std::string& p,
return paths;
}
-int SystemTools::EstimateFormatLength(const char* format, va_list ap)
+int SystemTools::EstimateFormatLength(char const* format, va_list ap)
{
if (!format) {
return 0;
@@ -2092,7 +1988,7 @@ int SystemTools::EstimateFormatLength(const char* format, va_list ap)
// Increase the length for every argument in the format.
- const char* cur = format;
+ char const* cur = format;
while (*cur) {
if (*cur++ == '%') {
// Skip "%%" since it doesn't correspond to a va_arg.
@@ -2135,8 +2031,8 @@ int SystemTools::EstimateFormatLength(const char* format, va_list ap)
return static_cast<int>(length);
}
-std::string SystemTools::EscapeChars(const char* str,
- const char* chars_to_escape,
+std::string SystemTools::EscapeChars(char const* str,
+ char const* chars_to_escape,
char escape_char)
{
std::string n;
@@ -2146,7 +2042,7 @@ std::string SystemTools::EscapeChars(const char* str,
} else {
n.reserve(strlen(str));
while (*str) {
- const char* ptr = chars_to_escape;
+ char const* ptr = chars_to_escape;
while (*ptr) {
if (*str == *ptr) {
n += escape_char;
@@ -2170,8 +2066,8 @@ static void ConvertVMSToUnix(std::string& path)
if (rootEnd != std::string::npos) {
std::string root = path.substr(0, rootEnd);
std::string pathPart = path.substr(rootEnd + 2, pathEnd - rootEnd - 2);
- const char* pathCString = pathPart.c_str();
- const char* pos0 = pathCString;
+ char const* pathCString = pathPart.c_str();
+ char const* pos0 = pathCString;
for (std::string::size_type pos = 0; *pos0; ++pos) {
if (*pos0 == '.') {
pathPart[pos] = '/';
@@ -2190,67 +2086,43 @@ void SystemTools::ConvertToUnixSlashes(std::string& path)
return;
}
- const char* pathCString = path.c_str();
- bool hasDoubleSlash = false;
#ifdef __VMS
ConvertVMSToUnix(path);
#else
- const char* pos0 = pathCString;
- for (std::string::size_type pos = 0; *pos0; ++pos) {
- if (*pos0 == '\\') {
- path[pos] = '/';
- }
-
- // Also, reuse the loop to check for slash followed by another slash
- if (!hasDoubleSlash && *(pos0 + 1) == '/' && *(pos0 + 2) == '/') {
-# ifdef _WIN32
- // However, on windows if the first characters are both slashes,
- // then keep them that way, so that network paths can be handled.
- if (pos > 0) {
- hasDoubleSlash = true;
- }
-# else
- hasDoubleSlash = true;
-# endif
- }
-
- pos0++;
- }
-
- if (hasDoubleSlash) {
- SystemTools::ReplaceString(path, "//", "/");
- }
+ // replace backslashes
+ std::replace(path.begin(), path.end(), '\\', '/');
+
+ // collapse repeated slashes, except exactly two leading slashes are
+ // meaningful and must be preserved.
+ bool hasDoubleSlash = path[0] == '/' && path[1] == '/' && path[2] != '/';
+ auto uniqueEnd = std::unique(
+ path.begin() + hasDoubleSlash, path.end(),
+ [](char c1, char c2) -> bool { return c1 == '/' && c1 == c2; });
+ path.erase(uniqueEnd, path.end());
#endif
- // remove any trailing slash
// if there is a tilda ~ then replace it with HOME
- pathCString = path.c_str();
- if (pathCString[0] == '~' &&
- (pathCString[1] == '/' || pathCString[1] == '\0')) {
+ if (path[0] == '~' && (path[1] == '/' || path[1] == '\0')) {
std::string homeEnv;
if (SystemTools::GetEnv("HOME", homeEnv)) {
path.replace(0, 1, homeEnv);
}
}
#ifdef HAVE_GETPWNAM
- else if (pathCString[0] == '~') {
- std::string::size_type idx = path.find_first_of("/\0");
- char oldch = path[idx];
- path[idx] = '\0';
- passwd* pw = getpwnam(path.c_str() + 1);
- path[idx] = oldch;
+ else if (path[0] == '~') {
+ std::string::size_type idx = path.find('/');
+ std::string user = path.substr(1, idx - 1);
+ passwd* pw = getpwnam(user.c_str());
if (pw) {
path.replace(0, idx, pw->pw_dir);
}
}
#endif
- // remove trailing slash if the path is more than
- // a single /
- pathCString = path.c_str();
+ // remove trailing slash, but preserve the root slash and the slash
+ // after windows drive letter (c:/).
size_t size = path.size();
if (size > 1 && path.back() == '/') {
- // if it is c:/ then do not remove the trailing slash
- if (!((size == 3 && pathCString[1] == ':'))) {
+ if (!(size == 3 && path[1] == ':') && path[size - 2] != '/') {
path.resize(size - 1);
}
}
@@ -2258,14 +2130,14 @@ void SystemTools::ConvertToUnixSlashes(std::string& path)
#ifdef _WIN32
std::wstring SystemTools::ConvertToWindowsExtendedPath(
- const std::string& source)
+ std::string const& source)
{
return Encoding::ToWindowsExtendedPath(source);
}
#endif
// change // to /, and escape any spaces in the path
-std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
+std::string SystemTools::ConvertToUnixOutputPath(std::string const& path)
{
std::string ret = path;
@@ -2278,7 +2150,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
if (ret.find_first_of(' ') != std::string::npos) {
std::string result;
char lastch = 1;
- for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) {
+ for (char const* ch = ret.c_str(); *ch != '\0'; ++ch) {
// if it is already escaped then don't try to escape it again
if ((*ch == ' ') && lastch != '\\') {
result += '\\';
@@ -2291,7 +2163,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
return ret;
}
-std::string SystemTools::ConvertToOutputPath(const std::string& path)
+std::string SystemTools::ConvertToOutputPath(std::string const& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
return SystemTools::ConvertToWindowsOutputPath(path);
@@ -2301,7 +2173,7 @@ std::string SystemTools::ConvertToOutputPath(const std::string& path)
}
// remove double slashes not at the start
-std::string SystemTools::ConvertToWindowsOutputPath(const std::string& path)
+std::string SystemTools::ConvertToWindowsOutputPath(std::string const& path)
{
std::string ret;
// make it big enough for all of path and double quotes
@@ -2344,7 +2216,7 @@ std::string SystemTools::ConvertToWindowsOutputPath(const std::string& path)
/**
* Append the filename from the path source to the directory name dir.
*/
-static std::string FileInDir(const std::string& source, const std::string& dir)
+static std::string FileInDir(std::string const& source, std::string const& dir)
{
std::string new_destination = dir;
SystemTools::ConvertToUnixSlashes(new_destination);
@@ -2357,7 +2229,7 @@ SystemTools::CopyStatus SystemTools::CopyFileIfDifferent(
// special check for a destination that is a directory
// FilesDiffer does not handle file to directory compare
if (SystemTools::FileIsDirectory(destination)) {
- const std::string new_destination = FileInDir(source, destination);
+ std::string const new_destination = FileInDir(source, destination);
if (!SystemTools::ComparePath(new_destination, destination)) {
return SystemTools::CopyFileIfDifferent(source, new_destination);
}
@@ -2374,8 +2246,8 @@ SystemTools::CopyStatus SystemTools::CopyFileIfDifferent(
#define KWSYS_ST_BUFFER 4096
-bool SystemTools::FilesDiffer(const std::string& source,
- const std::string& destination)
+bool SystemTools::FilesDiffer(std::string const& source,
+ std::string const& destination)
{
#if defined(_WIN32)
@@ -2455,8 +2327,8 @@ bool SystemTools::FilesDiffer(const std::string& source,
}
// If this block differs the file differs.
- if (memcmp(static_cast<const void*>(source_buf),
- static_cast<const void*>(dest_buf),
+ if (memcmp(static_cast<void const*>(source_buf),
+ static_cast<void const*>(dest_buf),
static_cast<size_t>(nnext)) != 0) {
return true;
}
@@ -2469,8 +2341,8 @@ bool SystemTools::FilesDiffer(const std::string& source,
return false;
}
-bool SystemTools::TextFilesDiffer(const std::string& path1,
- const std::string& path2)
+bool SystemTools::TextFilesDiffer(std::string const& path1,
+ std::string const& path2)
{
kwsys::ifstream if1(path1.c_str());
kwsys::ifstream if2(path2.c_str());
@@ -2522,7 +2394,7 @@ SystemTools::CopyStatus SystemTools::CopyFileContentBlockwise(
// before using the data, but the fin.gcount() will be zero if an
// error occurred. Therefore, the loop should be safe everywhere.
while (fin) {
- const int bufferSize = 4096;
+ int const bufferSize = 4096;
char buffer[bufferSize];
fin.read(buffer, bufferSize);
@@ -2549,16 +2421,25 @@ SystemTools::CopyStatus SystemTools::CopyFileContentBlockwise(
}
/**
- * Clone the source file to the destination file
+ * Attempt to copy source file to the destination file using
+ * operating system mechanisms.
+ *
+ * If available, copy-on-write/clone will be used.
+ * On Linux, the FICLONE ioctl is used to create a clone of the source file.
+ * On macOS, the copyfile() call is used to make a clone of the file, and
+ * it will fall back to a regular copy if that's not possible.
*
- * If available, the Linux FICLONE ioctl is used to create a check
- * copy-on-write clone of the source file.
+ * This function will follow symlinks (ie copy the file being
+ * pointed-to, not the symlink itself), and the resultant
+ * file will be owned by the uid of this process. It will overwrite
+ * an existing destination file.
*
- * The method returns false for the following cases:
- * - The code has not been compiled on Linux or the ioctl was unknown
- * - The source and destination is on different file systems
- * - The underlying filesystem does not support file cloning
- * - An unspecified error occurred
+ * Examples of why this method may fail -
+ * - We're running on an OS for which this method is not implemented.
+ * - The underlying OS won't do a copy for us, and -
+ * - The source and destination are on different file systems
+ * thus a clone is not possible.
+ * - The underlying filesystem does not support file cloning.
*/
SystemTools::CopyStatus SystemTools::CloneFileContent(
std::string const& source, std::string const& destination)
@@ -2597,12 +2478,26 @@ SystemTools::CopyStatus SystemTools::CloneFileContent(
// NOTE: we cannot use `clonefile` as the {a,c,m}time for the file needs to
// be updated by `copy_file_if_different` and `copy_file`.
- // These flags are meant to be COPYFILE_METADATA | COPYFILE_CLONE, but CLONE
- // forces COPYFILE_NOFOLLOW_SRC and that violates the invariant that this
- // should result in a file.
+ //
+ // COPYFILE_CLONE forces COPYFILE_NOFOLLOW_SRC and that violates the
+ // invariant that this should result in a file. We used to manually specify
+ // COPYFILE_EXCL | COPYFILE_STAT | COPYFILE_XATTR | COPYFILE_DATA here, but
+ // what the copyfile() manpage does not tell you is that COPYFILE_DATA
+ // appears to disable cloning all together. Instead, explicitly reject
+ // copying symlinks here.
+ //
+ // COPYFILE_CLONE implies a few flags, including COPYFILE_EXCL.
+ // We add COPYFILE_UNLINK to be consistent with the Linux implementation
+ // above, as well as CopyFileContentBlockwise(). This will remove the
+ // destination file before cloning, allowing this call to complete
+ // if the destination file already exists.
+ //
+ if (SystemTools::FileIsSymlink(source)) {
+ return CopyStatus{ Status::POSIX(ENOSYS), CopyStatus::NoPath };
+ }
+
if (copyfile(source.c_str(), destination.c_str(), nullptr,
- COPYFILE_METADATA | COPYFILE_EXCL | COPYFILE_STAT |
- COPYFILE_XATTR | COPYFILE_DATA) < 0) {
+ COPYFILE_METADATA | COPYFILE_CLONE | COPYFILE_UNLINK) < 0) {
return CopyStatus{ Status::POSIX_errno(), CopyStatus::NoPath };
}
# if KWSYS_CXX_HAS_UTIMENSAT
@@ -2741,7 +2636,7 @@ Status SystemTools::CopyADirectory(std::string const& source,
}
// return size of file; also returns zero if no file exists
-unsigned long SystemTools::FileLength(const std::string& filename)
+unsigned long SystemTools::FileLength(std::string const& filename)
{
unsigned long length = 0;
#ifdef _WIN32
@@ -2764,7 +2659,7 @@ unsigned long SystemTools::FileLength(const std::string& filename)
return length;
}
-int SystemTools::Strucmp(const char* l, const char* r)
+int SystemTools::Strucmp(char const* l, char const* r)
{
int lc;
int rc;
@@ -2776,7 +2671,7 @@ int SystemTools::Strucmp(const char* l, const char* r)
}
// return file's modified time
-long int SystemTools::ModifiedTime(const std::string& filename)
+long int SystemTools::ModifiedTime(std::string const& filename)
{
long int mt = 0;
#ifdef _WIN32
@@ -2795,7 +2690,7 @@ long int SystemTools::ModifiedTime(const std::string& filename)
}
// return file's creation time
-long int SystemTools::CreationTime(const std::string& filename)
+long int SystemTools::CreationTime(std::string const& filename)
{
long int ct = 0;
#ifdef _WIN32
@@ -2927,7 +2822,7 @@ size_t SystemTools::GetMaximumFilePathLength()
* found. Otherwise, the empty string is returned.
*/
std::string SystemToolsStatic::FindName(
- const std::string& name, const std::vector<std::string>& userPaths,
+ std::string const& name, std::vector<std::string> const& userPaths,
bool no_system_path)
{
// Add the system search path to our path first
@@ -2959,8 +2854,8 @@ std::string SystemToolsStatic::FindName(
* the system search path. Returns the full path to the file if it is
* found. Otherwise, the empty string is returned.
*/
-std::string SystemTools::FindFile(const std::string& name,
- const std::vector<std::string>& userPaths,
+std::string SystemTools::FindFile(std::string const& name,
+ std::vector<std::string> const& userPaths,
bool no_system_path)
{
std::string tryPath =
@@ -2978,7 +2873,7 @@ std::string SystemTools::FindFile(const std::string& name,
* found. Otherwise, the empty string is returned.
*/
std::string SystemTools::FindDirectory(
- const std::string& name, const std::vector<std::string>& userPaths,
+ std::string const& name, std::vector<std::string> const& userPaths,
bool no_system_path)
{
std::string tryPath =
@@ -2995,8 +2890,8 @@ std::string SystemTools::FindDirectory(
* the system search path. Returns the full path to the executable if it is
* found. Otherwise, the empty string is returned.
*/
-std::string SystemTools::FindProgram(const char* nameIn,
- const std::vector<std::string>& userPaths,
+std::string SystemTools::FindProgram(char const* nameIn,
+ std::vector<std::string> const& userPaths,
bool no_system_path)
{
if (!nameIn || !*nameIn) {
@@ -3006,8 +2901,8 @@ std::string SystemTools::FindProgram(const char* nameIn,
no_system_path);
}
-std::string SystemTools::FindProgram(const std::string& name,
- const std::vector<std::string>& userPaths,
+std::string SystemTools::FindProgram(std::string const& name,
+ std::vector<std::string> const& userPaths,
bool no_system_path)
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
@@ -3077,8 +2972,8 @@ std::string SystemTools::FindProgram(const std::string& name,
return "";
}
-std::string SystemTools::FindProgram(const std::vector<std::string>& names,
- const std::vector<std::string>& path,
+std::string SystemTools::FindProgram(std::vector<std::string> const& names,
+ std::vector<std::string> const& path,
bool noSystemPath)
{
for (std::string const& name : names) {
@@ -3096,8 +2991,8 @@ std::string SystemTools::FindProgram(const std::vector<std::string>& names,
* the system search path. Returns the full path to the library if it is
* found. Otherwise, the empty string is returned.
*/
-std::string SystemTools::FindLibrary(const std::string& name,
- const std::vector<std::string>& userPaths)
+std::string SystemTools::FindLibrary(std::string const& name,
+ std::vector<std::string> const& userPaths)
{
// See if the executable exists as written.
if (SystemTools::FileExists(name, true)) {
@@ -3176,7 +3071,7 @@ std::string SystemTools::FindLibrary(const std::string& name,
return "";
}
-std::string SystemTools::GetRealPath(const std::string& path,
+std::string SystemTools::GetRealPath(std::string const& path,
std::string* errorMessage)
{
std::string ret;
@@ -3185,12 +3080,12 @@ std::string SystemTools::GetRealPath(const std::string& path,
}
// Remove any trailing slash from the name except in a root component.
-static const char* RemoveTrailingSlashes(
- const std::string& inName, char (&local_buffer)[KWSYS_SYSTEMTOOLS_MAXPATH],
+static char const* RemoveTrailingSlashes(
+ std::string const& inName, char (&local_buffer)[KWSYS_SYSTEMTOOLS_MAXPATH],
std::string& string_buffer)
{
size_t length = inName.size();
- const char* name = inName.c_str();
+ char const* name = inName.c_str();
size_t last = length - 1;
if (last > 0 && (name[last] == '/' || name[last] == '\\') &&
@@ -3208,7 +3103,7 @@ static const char* RemoveTrailingSlashes(
return name;
}
-bool SystemTools::FileIsDirectory(const std::string& inName)
+bool SystemTools::FileIsDirectory(std::string const& inName)
{
if (inName.empty()) {
return false;
@@ -3216,7 +3111,7 @@ bool SystemTools::FileIsDirectory(const std::string& inName)
char local_buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
std::string string_buffer;
- const auto name = RemoveTrailingSlashes(inName, local_buffer, string_buffer);
+ auto const name = RemoveTrailingSlashes(inName, local_buffer, string_buffer);
// Now check the file node type.
#if defined(_WIN32)
@@ -3231,13 +3126,13 @@ bool SystemTools::FileIsDirectory(const std::string& inName)
#endif
}
-bool SystemTools::FileIsExecutable(const std::string& inName)
+bool SystemTools::FileIsExecutable(std::string const& inName)
{
#ifdef _WIN32
char local_buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
std::string string_buffer;
- const auto name = RemoveTrailingSlashes(inName, local_buffer, string_buffer);
- const auto attr =
+ auto const name = RemoveTrailingSlashes(inName, local_buffer, string_buffer);
+ auto const attr =
GetFileAttributesW(Encoding::ToWindowsExtendedPath(name).c_str());
// On Windows any file that exists and is not a directory is considered
@@ -3249,7 +3144,7 @@ bool SystemTools::FileIsExecutable(const std::string& inName)
}
#if defined(_WIN32)
-bool SystemTools::FileIsSymlinkWithAttr(const std::wstring& path,
+bool SystemTools::FileIsSymlinkWithAttr(std::wstring const& path,
unsigned long attr)
{
if (attr != INVALID_FILE_ATTRIBUTES) {
@@ -3286,7 +3181,7 @@ bool SystemTools::FileIsSymlinkWithAttr(const std::wstring& path,
}
#endif
-bool SystemTools::FileIsSymlink(const std::string& name)
+bool SystemTools::FileIsSymlink(std::string const& name)
{
#if defined(_WIN32)
std::wstring path = Encoding::ToWindowsExtendedPath(name);
@@ -3297,7 +3192,7 @@ bool SystemTools::FileIsSymlink(const std::string& name)
#endif
}
-bool SystemTools::FileIsFIFO(const std::string& name)
+bool SystemTools::FileIsFIFO(std::string const& name)
{
#if defined(_WIN32)
HANDLE hFile =
@@ -3407,6 +3302,14 @@ Status SystemTools::ReadSymlink(std::string const& newName,
}
std::wstring substituteName(substituteNameData, substituteNameLength);
origName = Encoding::ToNarrow(substituteName);
+ // Symbolic links to absolute paths may use a NT Object Path prefix.
+ // If the path begins with "\??\UNC\", replace it with "\\".
+ // Otherwise, if the path begins with "\??\", remove the prefix.
+ if (origName.compare(0, 8, "\\??\\UNC\\") == 0) {
+ origName.erase(1, 6);
+ } else if (origName.compare(0, 4, "\\??\\") == 0) {
+ origName.erase(0, 4);
+ }
#else
char buf[KWSYS_SYSTEMTOOLS_MAXPATH + 1];
int count = static_cast<int>(
@@ -3432,7 +3335,7 @@ Status SystemTools::ChangeDirectory(std::string const& dir)
std::string SystemTools::GetCurrentWorkingDirectory()
{
char buf[2048];
- const char* cwd = Getcwd(buf, 2048);
+ char const* cwd = Getcwd(buf, 2048);
std::string path;
if (cwd) {
path = cwd;
@@ -3441,14 +3344,14 @@ std::string SystemTools::GetCurrentWorkingDirectory()
return path;
}
-std::string SystemTools::GetProgramPath(const std::string& in_name)
+std::string SystemTools::GetProgramPath(std::string const& in_name)
{
std::string dir, file;
SystemTools::SplitProgramPath(in_name, dir, file);
return dir;
}
-bool SystemTools::SplitProgramPath(const std::string& in_name,
+bool SystemTools::SplitProgramPath(std::string const& in_name,
std::string& dir, std::string& file, bool)
{
dir = in_name;
@@ -3474,7 +3377,7 @@ bool SystemTools::SplitProgramPath(const std::string& in_name,
return true;
}
-bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut,
+bool SystemTools::FindProgramPath(char const* argv0, std::string& pathOut,
std::string& errorMsg)
{
std::vector<std::string> failures;
@@ -3501,79 +3404,13 @@ bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut,
return true;
}
-#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP
-void SystemTools::AddTranslationPath(const std::string& a,
- const std::string& b)
-{
- std::string path_a = a;
- std::string path_b = b;
- SystemTools::ConvertToUnixSlashes(path_a);
- SystemTools::ConvertToUnixSlashes(path_b);
- // First check this is a directory path, since we don't want the table to
- // grow too fat
- if (SystemTools::FileIsDirectory(path_a)) {
- // Make sure the path is a full path and does not contain no '..'
- // Ken--the following code is incorrect. .. can be in a valid path
- // for example /home/martink/MyHubba...Hubba/Src
- if (SystemTools::FileIsFullPath(path_b) &&
- path_b.find("..") == std::string::npos) {
- // Before inserting make sure path ends with '/'
- if (!path_a.empty() && path_a.back() != '/') {
- path_a += '/';
- }
- if (!path_b.empty() && path_b.back() != '/') {
- path_b += '/';
- }
- if (!(path_a == path_b)) {
- SystemToolsStatics->TranslationMap.insert(
- SystemToolsStatic::StringMap::value_type(std::move(path_a),
- std::move(path_b)));
- }
- }
- }
-}
-
-void SystemTools::AddKeepPath(const std::string& dir)
-{
- std::string cdir;
- Realpath(SystemTools::CollapseFullPath(dir), cdir);
- SystemTools::AddTranslationPath(cdir, dir);
-}
-
-void SystemTools::CheckTranslationPath(std::string& path)
-{
- // Do not translate paths that are too short to have meaningful
- // translations.
- if (path.size() < 2) {
- return;
- }
-
- // Always add a trailing slash before translation. It does not
- // matter if this adds an extra slash, but we do not want to
- // translate part of a directory (like the foo part of foo-dir).
- path += '/';
-
- // In case a file was specified we still have to go through this:
- // Now convert any path found in the table back to the one desired:
- for (auto const& pair : SystemToolsStatics->TranslationMap) {
- // We need to check of the path is a substring of the other path
- if (path.compare(0, pair.first.size(), pair.first) == 0) {
- path = path.replace(0, pair.first.size(), pair.second);
- }
- }
-
- // Remove the trailing slash we added before.
- path.pop_back();
-}
-#endif
-
static void SystemToolsAppendComponents(
std::vector<std::string>& out_components,
std::vector<std::string>::iterator first,
std::vector<std::string>::iterator last)
{
- static const std::string up = "..";
- static const std::string cur = ".";
+ static std::string const up = "..";
+ static std::string const cur = ".";
for (std::vector<std::string>::const_iterator i = first; i != last; ++i) {
if (*i == up) {
// Remove the previous component if possible. Ignore ../ components
@@ -3629,25 +3466,7 @@ std::string CollapseFullPathImpl(std::string const& in_path,
// Transform the path back to a string.
std::string newPath = SystemTools::JoinPath(out_components);
-#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP
- // Update the translation table with this potentially new path. I am not
- // sure why this line is here, it seems really questionable, but yet I
- // would put good money that if I remove it something will break, basically
- // from what I can see it created a mapping from the collapsed path, to be
- // replaced by the input path, which almost completely does the opposite of
- // this function, the only thing preventing this from happening a lot is
- // that if the in_path has a .. in it, then it is not added to the
- // translation table. So for most calls this either does nothing due to the
- // .. or it adds a translation between identical paths as nothing was
- // collapsed, so I am going to try to comment it out, and see what hits the
- // fan, hopefully quickly.
- // Commented out line below:
- // SystemTools::AddTranslationPath(newPath, in_path);
-
- SystemTools::CheckTranslationPath(newPath);
-#endif
#ifdef _WIN32
- newPath = SystemToolsStatics->GetActualCaseForPathCached(newPath);
SystemTools::ConvertToUnixSlashes(newPath);
#endif
// Return the reconstructed path.
@@ -3661,7 +3480,7 @@ std::string SystemTools::CollapseFullPath(std::string const& in_path)
}
std::string SystemTools::CollapseFullPath(std::string const& in_path,
- const char* in_base)
+ char const* in_base)
{
if (!in_base) {
return CollapseFullPathImpl(in_path, nullptr);
@@ -3677,8 +3496,8 @@ std::string SystemTools::CollapseFullPath(std::string const& in_path,
}
// compute the relative path from here to there
-std::string SystemTools::RelativePath(const std::string& local,
- const std::string& remote)
+std::string SystemTools::RelativePath(std::string const& local,
+ std::string const& remote)
{
if (!SystemTools::FileIsFullPath(local)) {
return "";
@@ -3753,20 +3572,20 @@ std::string SystemTools::RelativePath(const std::string& local,
return relativePath;
}
-std::string SystemTools::GetActualCaseForPath(const std::string& p)
+std::string SystemTools::GetActualCaseForPath(std::string const& p)
{
#ifdef _WIN32
- return SystemToolsStatic::GetCasePathName(p, false);
+ return SystemToolsStatic::GetCasePathName(p);
#else
return p;
#endif
}
-const char* SystemTools::SplitPathRootComponent(const std::string& p,
+char const* SystemTools::SplitPathRootComponent(std::string const& p,
std::string* root)
{
// Identify the root component.
- const char* c = p.c_str();
+ char const* c = p.c_str();
if ((c[0] == '/' && c[1] == '/') || (c[0] == '\\' && c[1] == '\\')) {
// Network path.
if (root) {
@@ -3828,11 +3647,11 @@ const char* SystemTools::SplitPathRootComponent(const std::string& p,
return c;
}
-void SystemTools::SplitPath(const std::string& p,
+void SystemTools::SplitPath(std::string const& p,
std::vector<std::string>& components,
bool expand_home_dir)
{
- const char* c;
+ char const* c;
components.clear();
// Identify the root component.
@@ -3868,8 +3687,8 @@ void SystemTools::SplitPath(const std::string& p,
}
// Parse the remaining components.
- const char* first = c;
- const char* last = first;
+ char const* first = c;
+ char const* last = first;
for (; *last; ++last) {
if (*last == '/' || *last == '\\') {
// End of a component. Save it.
@@ -3884,7 +3703,7 @@ void SystemTools::SplitPath(const std::string& p,
}
}
-std::string SystemTools::JoinPath(const std::vector<std::string>& components)
+std::string SystemTools::JoinPath(std::vector<std::string> const& components)
{
return SystemTools::JoinPath(components.begin(), components.end());
}
@@ -3919,7 +3738,7 @@ std::string SystemTools::JoinPath(
return result;
}
-bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
+bool SystemTools::ComparePath(std::string const& c1, std::string const& c2)
{
#if defined(_WIN32) || defined(__APPLE__)
# ifdef _MSC_VER
@@ -3934,7 +3753,7 @@ bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
#endif
}
-bool SystemTools::Split(const std::string& str,
+bool SystemTools::Split(std::string const& str,
std::vector<std::string>& lines, char separator)
{
std::string data(str);
@@ -3954,7 +3773,7 @@ bool SystemTools::Split(const std::string& str,
return true;
}
-bool SystemTools::Split(const std::string& str,
+bool SystemTools::Split(std::string const& str,
std::vector<std::string>& lines)
{
std::string data(str);
@@ -3978,8 +3797,8 @@ bool SystemTools::Split(const std::string& str,
return true;
}
-std::string SystemTools::Join(const std::vector<std::string>& list,
- const std::string& separator)
+std::string SystemTools::Join(std::vector<std::string> const& list,
+ std::string const& separator)
{
std::string result;
if (list.empty()) {
@@ -3987,13 +3806,13 @@ std::string SystemTools::Join(const std::vector<std::string>& list,
}
size_t total_size = separator.size() * (list.size() - 1);
- for (const std::string& string : list) {
+ for (std::string const& string : list) {
total_size += string.size();
}
result.reserve(total_size);
bool needs_separator = false;
- for (const std::string& string : list) {
+ for (std::string const& string : list) {
if (needs_separator) {
result += separator;
}
@@ -4008,7 +3827,7 @@ std::string SystemTools::Join(const std::vector<std::string>& list,
* Return path of a full filename (no trailing slashes).
* Warning: returned path is converted to Unix slashes format.
*/
-std::string SystemTools::GetFilenamePath(const std::string& filename)
+std::string SystemTools::GetFilenamePath(std::string const& filename)
{
std::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
@@ -4032,10 +3851,10 @@ std::string SystemTools::GetFilenamePath(const std::string& filename)
/**
* Return file name of a full filename (i.e. file name without path).
*/
-std::string SystemTools::GetFilenameName(const std::string& filename)
+std::string SystemTools::GetFilenameName(std::string const& filename)
{
#if defined(_WIN32) || defined(KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES)
- const char* separators = "/\\";
+ char const* separators = "/\\";
#else
char separators = '/';
#endif
@@ -4051,7 +3870,7 @@ std::string SystemTools::GetFilenameName(const std::string& filename)
* Return file extension of a full filename (dot included).
* Warning: this is the longest extension (for example: .tar.gz)
*/
-std::string SystemTools::GetFilenameExtension(const std::string& filename)
+std::string SystemTools::GetFilenameExtension(std::string const& filename)
{
std::string name = SystemTools::GetFilenameName(filename);
std::string::size_type dot_pos = name.find('.');
@@ -4067,7 +3886,7 @@ std::string SystemTools::GetFilenameExtension(const std::string& filename)
* Return file extension of a full filename (dot included).
* Warning: this is the shortest extension (for example: .gz of .tar.gz)
*/
-std::string SystemTools::GetFilenameLastExtension(const std::string& filename)
+std::string SystemTools::GetFilenameLastExtension(std::string const& filename)
{
std::string name = SystemTools::GetFilenameName(filename);
std::string::size_type dot_pos = name.rfind('.');
@@ -4084,7 +3903,7 @@ std::string SystemTools::GetFilenameLastExtension(const std::string& filename)
* Warning: it considers the longest extension (for example: .tar.gz)
*/
std::string SystemTools::GetFilenameWithoutExtension(
- const std::string& filename)
+ std::string const& filename)
{
std::string name = SystemTools::GetFilenameName(filename);
std::string::size_type dot_pos = name.find('.');
@@ -4100,7 +3919,7 @@ std::string SystemTools::GetFilenameWithoutExtension(
* from .tar.gz)
*/
std::string SystemTools::GetFilenameWithoutLastExtension(
- const std::string& filename)
+ std::string const& filename)
{
std::string name = SystemTools::GetFilenameName(filename);
std::string::size_type dot_pos = name.rfind('.');
@@ -4110,7 +3929,7 @@ std::string SystemTools::GetFilenameWithoutLastExtension(
return name;
}
-bool SystemTools::FileHasSignature(const char* filename, const char* signature,
+bool SystemTools::FileHasSignature(char const* filename, char const* signature,
long offset)
{
if (!filename || !signature) {
@@ -4138,7 +3957,7 @@ bool SystemTools::FileHasSignature(const char* filename, const char* signature,
return res;
}
-SystemTools::FileTypeEnum SystemTools::DetectFileType(const char* filename,
+SystemTools::FileTypeEnum SystemTools::DetectFileType(char const* filename,
unsigned long length,
double percent_bin)
{
@@ -4169,8 +3988,8 @@ SystemTools::FileTypeEnum SystemTools::DetectFileType(const char* filename,
size_t text_count = 0;
- const unsigned char* ptr = buffer;
- const unsigned char* buffer_end = buffer + read_length;
+ unsigned char const* ptr = buffer;
+ unsigned char const* buffer_end = buffer + read_length;
while (ptr != buffer_end) {
if ((*ptr >= 0x20 && *ptr <= 0x7F) || *ptr == '\n' || *ptr == '\r' ||
@@ -4192,7 +4011,7 @@ SystemTools::FileTypeEnum SystemTools::DetectFileType(const char* filename,
return SystemTools::FileTypeText;
}
-bool SystemTools::LocateFileInDir(const char* filename, const char* dir,
+bool SystemTools::LocateFileInDir(char const* filename, char const* dir,
std::string& filename_found,
int try_filename_dirs)
{
@@ -4278,18 +4097,18 @@ bool SystemTools::LocateFileInDir(const char* filename, const char* dir,
return res;
}
-bool SystemTools::FileIsFullPath(const std::string& in_name)
+bool SystemTools::FileIsFullPath(std::string const& in_name)
{
return SystemToolsStatic::FileIsFullPath(in_name.c_str(), in_name.size());
}
-bool SystemTools::FileIsFullPath(const char* in_name)
+bool SystemTools::FileIsFullPath(char const* in_name)
{
return SystemToolsStatic::FileIsFullPath(
in_name, in_name[0] ? (in_name[1] ? 2 : 1) : 0);
}
-bool SystemToolsStatic::FileIsFullPath(const char* in_name, size_t len)
+bool SystemToolsStatic::FileIsFullPath(char const* in_name, size_t len)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
// On Windows, the name must be at least two characters long.
@@ -4354,7 +4173,7 @@ Status SystemTools::GetShortPath(std::string const& path,
#endif
}
-std::string SystemTools::GetCurrentDateTime(const char* format)
+std::string SystemTools::GetCurrentDateTime(char const* format)
{
char buf[1024];
time_t t;
@@ -4363,7 +4182,7 @@ std::string SystemTools::GetCurrentDateTime(const char* format)
return std::string(buf);
}
-std::string SystemTools::MakeCidentifier(const std::string& s)
+std::string SystemTools::MakeCidentifier(std::string const& s)
{
std::string str(s);
if (str.find_first_of("0123456789") == 0) {
@@ -4451,7 +4270,7 @@ int SystemTools::GetTerminalWidth()
return width;
}
-Status SystemTools::GetPermissions(const char* file, mode_t& mode)
+Status SystemTools::GetPermissions(char const* file, mode_t& mode)
{
if (!file) {
return Status::POSIX(EINVAL);
@@ -4479,7 +4298,7 @@ Status SystemTools::GetPermissions(std::string const& file, mode_t& mode)
mode |= S_IFREG;
}
size_t dotPos = file.rfind('.');
- const char* ext = dotPos == std::string::npos ? 0 : (file.c_str() + dotPos);
+ char const* ext = dotPos == std::string::npos ? 0 : (file.c_str() + dotPos);
if (ext &&
(Strucmp(ext, ".exe") == 0 || Strucmp(ext, ".com") == 0 ||
Strucmp(ext, ".cmd") == 0 || Strucmp(ext, ".bat") == 0)) {
@@ -4495,7 +4314,7 @@ Status SystemTools::GetPermissions(std::string const& file, mode_t& mode)
return Status::Success();
}
-Status SystemTools::SetPermissions(const char* file, mode_t mode,
+Status SystemTools::SetPermissions(char const* file, mode_t mode,
bool honor_umask)
{
if (!file) {
@@ -4527,13 +4346,13 @@ Status SystemTools::SetPermissions(std::string const& file, mode_t mode,
return Status::Success();
}
-std::string SystemTools::GetParentDirectory(const std::string& fileOrDir)
+std::string SystemTools::GetParentDirectory(std::string const& fileOrDir)
{
return SystemTools::GetFilenamePath(fileOrDir);
}
-bool SystemTools::IsSubDirectory(const std::string& cSubdir,
- const std::string& cDir)
+bool SystemTools::IsSubDirectory(std::string const& cSubdir,
+ std::string const& cDir)
{
if (cDir.empty()) {
return false;
@@ -4845,7 +4664,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
return res;
}
-bool SystemTools::ParseURLProtocol(const std::string& URL,
+bool SystemTools::ParseURLProtocol(std::string const& URL,
std::string& protocol,
std::string& dataglom, bool decode)
{
@@ -4867,7 +4686,7 @@ bool SystemTools::ParseURLProtocol(const std::string& URL,
return true;
}
-bool SystemTools::ParseURL(const std::string& URL, std::string& protocol,
+bool SystemTools::ParseURL(std::string const& URL, std::string& protocol,
std::string& username, std::string& password,
std::string& hostname, std::string& dataport,
std::string& database, bool decode)
@@ -4906,7 +4725,7 @@ bool SystemTools::ParseURL(const std::string& URL, std::string& protocol,
}
// ----------------------------------------------------------------------
-std::string SystemTools::DecodeURL(const std::string& url)
+std::string SystemTools::DecodeURL(std::string const& url)
{
kwsys::RegularExpression urlByteRe(VTK_URL_BYTE_REGEX);
std::string ret;
@@ -4968,51 +4787,6 @@ void SystemTools::ClassInitialize()
// Create statics singleton instance
SystemToolsStatics = new SystemToolsStatic;
-
-#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP
-// Add some special translation paths for unix. These are not added
-// for windows because drive letters need to be maintained. Also,
-// there are not sym-links and mount points on windows anyway.
-# if !defined(_WIN32) || defined(__CYGWIN__)
- // The tmp path is frequently a logical path so always keep it:
- SystemTools::AddKeepPath("/tmp/");
-
- // If the current working directory is a logical path then keep the
- // logical name.
- std::string pwd_str;
- if (SystemTools::GetEnv("PWD", pwd_str)) {
- char buf[2048];
- if (const char* cwd = Getcwd(buf, 2048)) {
- // The current working directory may be a logical path. Find
- // the shortest logical path that still produces the correct
- // physical path.
- std::string cwd_changed;
- std::string pwd_changed;
-
- // Test progressively shorter logical-to-physical mappings.
- std::string cwd_str = cwd;
- std::string pwd_path;
- Realpath(pwd_str, pwd_path);
- while (cwd_str == pwd_path && cwd_str != pwd_str) {
- // The current pair of paths is a working logical mapping.
- cwd_changed = cwd_str;
- pwd_changed = pwd_str;
-
- // Strip off one directory level and see if the logical
- // mapping still works.
- pwd_str = SystemTools::GetFilenamePath(pwd_str);
- cwd_str = SystemTools::GetFilenamePath(cwd_str);
- Realpath(pwd_str, pwd_path);
- }
-
- // Add the translation to keep the logical path name.
- if (!cwd_changed.empty() && !pwd_changed.empty()) {
- SystemTools::AddTranslationPath(cwd_changed, pwd_changed);
- }
- }
- }
-# endif
-#endif
}
void SystemTools::ClassFinalize()
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 294ffca..c47888e 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -54,8 +54,8 @@ public:
SystemToolsManager();
~SystemToolsManager();
- SystemToolsManager(const SystemToolsManager&) = delete;
- SystemToolsManager& operator=(const SystemToolsManager&) = delete;
+ SystemToolsManager(SystemToolsManager const&) = delete;
+ SystemToolsManager& operator=(SystemToolsManager const&) = delete;
};
// This instance will show up in any translation unit that uses
@@ -69,16 +69,16 @@ static SystemToolsManager SystemToolsManagerInstance;
typedef int TestFilePermissions;
#if defined(_WIN32) && !defined(__CYGWIN__)
// On Windows (VC), no system header defines these constants...
-static const TestFilePermissions TEST_FILE_OK = 0;
-static const TestFilePermissions TEST_FILE_READ = 4;
-static const TestFilePermissions TEST_FILE_WRITE = 2;
-static const TestFilePermissions TEST_FILE_EXECUTE = 1;
+static TestFilePermissions const TEST_FILE_OK = 0;
+static TestFilePermissions const TEST_FILE_READ = 4;
+static TestFilePermissions const TEST_FILE_WRITE = 2;
+static TestFilePermissions const TEST_FILE_EXECUTE = 1;
#else
// Standard POSIX constants
-static const TestFilePermissions TEST_FILE_OK = F_OK;
-static const TestFilePermissions TEST_FILE_READ = R_OK;
-static const TestFilePermissions TEST_FILE_WRITE = W_OK;
-static const TestFilePermissions TEST_FILE_EXECUTE = X_OK;
+static TestFilePermissions const TEST_FILE_OK = F_OK;
+static TestFilePermissions const TEST_FILE_READ = R_OK;
+static TestFilePermissions const TEST_FILE_WRITE = W_OK;
+static TestFilePermissions const TEST_FILE_EXECUTE = X_OK;
#endif
/** \class SystemTools
@@ -99,9 +99,9 @@ public:
* then an underscore is prepended. Note that this can produce
* identifiers that the standard reserves (_[A-Z].* and __.*).
*/
- static std::string MakeCidentifier(const std::string& s);
+ static std::string MakeCidentifier(std::string const& s);
- static std::string MakeCindentifier(const std::string& s)
+ static std::string MakeCindentifier(std::string const& s)
{
return MakeCidentifier(s);
}
@@ -109,123 +109,123 @@ public:
/**
* Replace replace all occurrences of the string in the source string.
*/
- static void ReplaceString(std::string& source, const char* replace,
- const char* with);
- static void ReplaceString(std::string& source, const std::string& replace,
- const std::string& with);
+ static void ReplaceString(std::string& source, char const* replace,
+ char const* with);
+ static void ReplaceString(std::string& source, std::string const& replace,
+ std::string const& with);
/**
* Return a capitalized string (i.e the first letter is uppercased,
* all other are lowercased).
*/
- static std::string Capitalized(const std::string&);
+ static std::string Capitalized(std::string const&);
/**
* Return a 'capitalized words' string (i.e the first letter of each word
* is uppercased all other are left untouched though).
*/
- static std::string CapitalizedWords(const std::string&);
+ static std::string CapitalizedWords(std::string const&);
/**
* Return a 'uncapitalized words' string (i.e the first letter of each word
* is lowercased all other are left untouched though).
*/
- static std::string UnCapitalizedWords(const std::string&);
+ static std::string UnCapitalizedWords(std::string const&);
/**
* Return a lower case string
*/
- static std::string LowerCase(const std::string&);
+ static std::string LowerCase(std::string const&);
/**
* Return a lower case string
*/
- static std::string UpperCase(const std::string&);
+ static std::string UpperCase(std::string const&);
/**
* Count char in string
*/
- static size_t CountChar(const char* str, char c);
+ static size_t CountChar(char const* str, char c);
/**
* Remove some characters from a string.
* Return a pointer to the new resulting string (allocated with 'new')
*/
- static char* RemoveChars(const char* str, const char* toremove);
+ static char* RemoveChars(char const* str, char const* toremove);
/**
* Remove remove all but 0->9, A->F characters from a string.
* Return a pointer to the new resulting string (allocated with 'new')
*/
- static char* RemoveCharsButUpperHex(const char* str);
+ static char* RemoveCharsButUpperHex(char const* str);
/**
* Replace some characters by another character in a string (in-place)
* Return a pointer to string
*/
- static char* ReplaceChars(char* str, const char* toreplace,
+ static char* ReplaceChars(char* str, char const* toreplace,
char replacement);
/**
* Returns true if str1 starts (respectively ends) with str2
*/
- static bool StringStartsWith(const char* str1, const char* str2);
- static bool StringStartsWith(const std::string& str1, const char* str2);
- static bool StringEndsWith(const char* str1, const char* str2);
- static bool StringEndsWith(const std::string& str1, const char* str2);
+ static bool StringStartsWith(char const* str1, char const* str2);
+ static bool StringStartsWith(std::string const& str1, char const* str2);
+ static bool StringEndsWith(char const* str1, char const* str2);
+ static bool StringEndsWith(std::string const& str1, char const* str2);
/**
* Returns a pointer to the last occurrence of str2 in str1
*/
- static const char* FindLastString(const char* str1, const char* str2);
+ static char const* FindLastString(char const* str1, char const* str2);
/**
* Make a duplicate of the string similar to the strdup C function
* but use new to create the 'new' string, so one can use
* 'delete' to remove it. Returns 0 if the input is empty.
*/
- static char* DuplicateString(const char* str);
+ static char* DuplicateString(char const* str);
/**
* Return the string cropped to a given length by removing chars in the
* center of the string and replacing them with an ellipsis (...)
*/
- static std::string CropString(const std::string&, size_t max_len);
+ static std::string CropString(std::string const&, size_t max_len);
/** split a path by separator into an array of strings, default is /.
If isPath is true then the string is treated like a path and if
s starts with a / then the first element of the returned array will
be /, so /foo/bar will be [/, foo, bar]
*/
- static std::vector<std::string> SplitString(const std::string& s,
+ static std::vector<std::string> SplitString(std::string const& s,
char separator = '/',
bool isPath = false);
/**
* Perform a case-independent string comparison
*/
- static int Strucmp(const char* s1, const char* s2);
+ static int Strucmp(char const* s1, char const* s2);
/**
* Split a string on its newlines into multiple lines
* Return false only if the last line stored had no newline
*/
- static bool Split(const std::string& s, std::vector<std::string>& l);
- static bool Split(const std::string& s, std::vector<std::string>& l,
+ static bool Split(std::string const& s, std::vector<std::string>& l);
+ static bool Split(std::string const& s, std::vector<std::string>& l,
char separator);
/**
* Joins a vector of strings into a single string, with separator in between
* each string.
*/
- static std::string Join(const std::vector<std::string>& list,
- const std::string& separator);
+ static std::string Join(std::vector<std::string> const& list,
+ std::string const& separator);
/**
* Return string with space added between capitalized words
* (i.e. EatMyShorts becomes Eat My Shorts )
* (note that IEatShorts becomes IEat Shorts)
*/
- static std::string AddSpaceBetweenCapitalizedWords(const std::string&);
+ static std::string AddSpaceBetweenCapitalizedWords(std::string const&);
/**
* Append two or more strings and produce new one.
@@ -233,9 +233,9 @@ public:
* with 'new'.
* Return 0 if inputs are empty or there was an error
*/
- static char* AppendStrings(const char* str1, const char* str2);
- static char* AppendStrings(const char* str1, const char* str2,
- const char* str3);
+ static char* AppendStrings(char const* str1, char const* str2);
+ static char* AppendStrings(char const* str1, char const* str2,
+ char const* str3);
/**
* Estimate the length of the string that will be produced
@@ -246,12 +246,12 @@ public:
* you will not be able to use this 'ap' anymore from the beginning.
* It's up to you to call va_end though.
*/
- static int EstimateFormatLength(const char* format, va_list ap);
+ static int EstimateFormatLength(char const* format, va_list ap);
/**
* Escape specific characters in 'str'.
*/
- static std::string EscapeChars(const char* str, const char* chars_to_escape,
+ static std::string EscapeChars(char const* str, char const* chars_to_escape,
char escape_char = '\\');
/** -----------------------------------------------------------------
@@ -266,20 +266,20 @@ public:
#ifdef _WIN32
/** Calls Encoding::ToWindowsExtendedPath. */
- static std::wstring ConvertToWindowsExtendedPath(const std::string&);
+ static std::wstring ConvertToWindowsExtendedPath(std::string const&);
#endif
/**
* For windows this calls ConvertToWindowsOutputPath and for unix
* it calls ConvertToUnixOutputPath
*/
- static std::string ConvertToOutputPath(const std::string&);
+ static std::string ConvertToOutputPath(std::string const&);
/**
* Convert the path to a string that can be used in a unix makefile.
* double slashes are removed, and spaces are escaped.
*/
- static std::string ConvertToUnixOutputPath(const std::string&);
+ static std::string ConvertToUnixOutputPath(std::string const&);
/**
* Convert the path to string that can be used in a windows project or
@@ -287,12 +287,12 @@ public:
* the string, the slashes are converted to windows style backslashes, and
* if there are spaces in the string it is double quoted.
*/
- static std::string ConvertToWindowsOutputPath(const std::string&);
+ static std::string ConvertToWindowsOutputPath(std::string const&);
/**
* Return true if a path with the given name exists in the current directory.
*/
- static bool PathExists(const std::string& path);
+ static bool PathExists(std::string const& path);
/**
* Return true if a file exists in the current directory.
@@ -302,10 +302,10 @@ public:
* also be checked for read access. (Currently, this check
* for read access is only done on POSIX systems.)
*/
- static bool FileExists(const char* filename, bool isFile);
- static bool FileExists(const std::string& filename, bool isFile);
- static bool FileExists(const char* filename);
- static bool FileExists(const std::string& filename);
+ static bool FileExists(char const* filename, bool isFile);
+ static bool FileExists(std::string const& filename, bool isFile);
+ static bool FileExists(char const* filename);
+ static bool FileExists(std::string const& filename);
/**
* Test if a file exists and can be accessed with the requested
@@ -317,9 +317,9 @@ public:
* considered readable, and writable files are considered to
* have the read-only file attribute cleared.
*/
- static bool TestFileAccess(const char* filename,
+ static bool TestFileAccess(char const* filename,
TestFilePermissions permissions);
- static bool TestFileAccess(const std::string& filename,
+ static bool TestFileAccess(std::string const& filename,
TestFilePermissions permissions);
/**
* Cross platform wrapper for stat struct
@@ -336,13 +336,13 @@ public:
* On Windows this may not work for paths longer than 250 characters
* due to limitations of the underlying '_wstat64' call.
*/
- static int Stat(const char* path, Stat_t* buf);
- static int Stat(const std::string& path, Stat_t* buf);
+ static int Stat(char const* path, Stat_t* buf);
+ static int Stat(std::string const& path, Stat_t* buf);
/**
* Return file length
*/
- static unsigned long FileLength(const std::string& filename);
+ static unsigned long FileLength(std::string const& filename);
/**
Change the modification time or create a file
@@ -362,7 +362,7 @@ public:
* Get the file extension (including ".") needed for an executable
* on the current platform ("" for unix, ".exe" for Windows).
*/
- static const char* GetExecutableExtension();
+ static char const* GetExecutableExtension();
/**
* Given a path on a Windows machine, return the actual case of
@@ -371,15 +371,15 @@ public:
* returned unchanged. Drive letters are always made upper case.
* This does nothing on non-Windows systems but return the path.
*/
- static std::string GetActualCaseForPath(const std::string& path);
+ static std::string GetActualCaseForPath(std::string const& path);
/**
* Given the path to a program executable, get the directory part of
* the path with the file stripped off. If there is no directory
* part, the empty string is returned.
*/
- static std::string GetProgramPath(const std::string&);
- static bool SplitProgramPath(const std::string& in_name, std::string& dir,
+ static std::string GetProgramPath(std::string const&);
+ static bool SplitProgramPath(std::string const& in_name, std::string& dir,
std::string& file, bool errorReport = true);
/**
@@ -394,7 +394,7 @@ public:
* buildDir is a possibly null path to the build directory.
* installPrefix is a possibly null pointer to the install directory.
*/
- static bool FindProgramPath(const char* argv0, std::string& pathOut,
+ static bool FindProgramPath(char const* argv0, std::string& pathOut,
std::string& errorMsg);
/**
@@ -405,7 +405,7 @@ public:
*/
static std::string CollapseFullPath(std::string const& in_path);
static std::string CollapseFullPath(std::string const& in_path,
- const char* in_base);
+ char const* in_base);
static std::string CollapseFullPath(std::string const& in_path,
std::string const& in_base);
@@ -416,7 +416,7 @@ public:
* nullptr. Otherwise empty string is returned and errorMessage
* contains error description.
*/
- static std::string GetRealPath(const std::string& path,
+ static std::string GetRealPath(std::string const& path,
std::string* errorMessage = nullptr);
/**
@@ -434,7 +434,7 @@ public:
* returned. The root component is stored in the "root" string if
* given.
*/
- static const char* SplitPathRootComponent(const std::string& p,
+ static char const* SplitPathRootComponent(std::string const& p,
std::string* root = nullptr);
/**
@@ -451,7 +451,7 @@ public:
* preserved, including empty ones. Typically callers should use
* this only on paths that have already been normalized.
*/
- static void SplitPath(const std::string& p,
+ static void SplitPath(std::string const& p,
std::vector<std::string>& components,
bool expand_home_dir = true);
@@ -463,50 +463,50 @@ public:
* preserved, including empty ones. Typically callers should use
* this only on paths that have already been normalized.
*/
- static std::string JoinPath(const std::vector<std::string>& components);
+ static std::string JoinPath(std::vector<std::string> const& components);
static std::string JoinPath(std::vector<std::string>::const_iterator first,
std::vector<std::string>::const_iterator last);
/**
* Compare a path or components of a path.
*/
- static bool ComparePath(const std::string& c1, const std::string& c2);
+ static bool ComparePath(std::string const& c1, std::string const& c2);
/**
* Return path of a full filename (no trailing slashes)
*/
- static std::string GetFilenamePath(const std::string&);
+ static std::string GetFilenamePath(std::string const&);
/**
* Return file name of a full filename (i.e. file name without path)
*/
- static std::string GetFilenameName(const std::string&);
+ static std::string GetFilenameName(std::string const&);
/**
* Return longest file extension of a full filename (dot included)
*/
- static std::string GetFilenameExtension(const std::string&);
+ static std::string GetFilenameExtension(std::string const&);
/**
* Return shortest file extension of a full filename (dot included)
*/
- static std::string GetFilenameLastExtension(const std::string& filename);
+ static std::string GetFilenameLastExtension(std::string const& filename);
/**
* Return file name without extension of a full filename
*/
- static std::string GetFilenameWithoutExtension(const std::string&);
+ static std::string GetFilenameWithoutExtension(std::string const&);
/**
* Return file name without its last (shortest) extension
*/
- static std::string GetFilenameWithoutLastExtension(const std::string&);
+ static std::string GetFilenameWithoutLastExtension(std::string const&);
/**
* Return whether the path represents a full path (not relative)
*/
- static bool FileIsFullPath(const std::string&);
- static bool FileIsFullPath(const char*);
+ static bool FileIsFullPath(std::string const&);
+ static bool FileIsFullPath(char const*);
/**
* For windows return the short path for the given path,
@@ -527,13 +527,13 @@ public:
/**
* Get the parent directory of the directory or file
*/
- static std::string GetParentDirectory(const std::string& fileOrDir);
+ static std::string GetParentDirectory(std::string const& fileOrDir);
/**
* Check if the given file or directory is in subdirectory of dir
*/
- static bool IsSubDirectory(const std::string& fileOrDir,
- const std::string& dir);
+ static bool IsSubDirectory(std::string const& fileOrDir,
+ std::string const& dir);
/** -----------------------------------------------------------------
* File Manipulation Routines
@@ -544,7 +544,7 @@ public:
* Open a file considering unicode. On Windows, if 'e' is present in
* mode it is first discarded.
*/
- static FILE* Fopen(const std::string& file, const char* mode);
+ static FILE* Fopen(std::string const& file, char const* mode);
/**
* Visual C++ does not define mode_t.
@@ -558,9 +558,9 @@ public:
* can make a full path even if none of the directories existed
* prior to calling this function.
*/
- static Status MakeDirectory(const char* path, const mode_t* mode = nullptr);
+ static Status MakeDirectory(char const* path, mode_t const* mode = nullptr);
static Status MakeDirectory(std::string const& path,
- const mode_t* mode = nullptr);
+ mode_t const* mode = nullptr);
/**
* Represent the result of a file copy operation.
@@ -595,15 +595,15 @@ public:
/**
* Compare the contents of two files. Return true if different
*/
- static bool FilesDiffer(const std::string& source,
- const std::string& destination);
+ static bool FilesDiffer(std::string const& source,
+ std::string const& destination);
/**
* Compare the contents of two files, ignoring line ending differences.
* Return true if different
*/
- static bool TextFilesDiffer(const std::string& path1,
- const std::string& path2);
+ static bool TextFilesDiffer(std::string const& path1,
+ std::string const& path2);
/**
* Blockwise copy source to destination file
@@ -628,8 +628,8 @@ public:
WindowsFileId(unsigned long volumeSerialNumber,
unsigned long fileIndexHigh, unsigned long fileIndexLow);
- bool operator==(const WindowsFileId& o) const;
- bool operator!=(const WindowsFileId& o) const;
+ bool operator==(WindowsFileId const& o) const;
+ bool operator!=(WindowsFileId const& o) const;
private:
unsigned long m_volumeSerialNumber;
@@ -645,8 +645,8 @@ public:
UnixFileId(dev_t volumeSerialNumber, ino_t fileSerialNumber,
off_t fileSize);
- bool operator==(const UnixFileId& o) const;
- bool operator!=(const UnixFileId& o) const;
+ bool operator==(UnixFileId const& o) const;
+ bool operator!=(UnixFileId const& o) const;
private:
dev_t m_volumeSerialNumber;
@@ -660,12 +660,12 @@ public:
* Outputs a FileId for the given file or directory.
* Returns true on success, false on failure
*/
- static bool GetFileId(const std::string& file, FileId& id);
+ static bool GetFileId(std::string const& file, FileId& id);
/**
* Return true if the two files are the same file
*/
- static bool SameFile(const std::string& file1, const std::string& file2);
+ static bool SameFile(std::string const& file1, std::string const& file2);
/**
* Copy a file.
@@ -711,49 +711,49 @@ public:
* Find a file in the system PATH, with optional extra paths
*/
static std::string FindFile(
- const std::string& name,
- const std::vector<std::string>& path = std::vector<std::string>(),
+ std::string const& name,
+ std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
/**
* Find a directory in the system PATH, with optional extra paths
*/
static std::string FindDirectory(
- const std::string& name,
- const std::vector<std::string>& path = std::vector<std::string>(),
+ std::string const& name,
+ std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
/**
* Find an executable in the system PATH, with optional extra paths
*/
static std::string FindProgram(
- const char* name,
- const std::vector<std::string>& path = std::vector<std::string>(),
+ char const* name,
+ std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
static std::string FindProgram(
- const std::string& name,
- const std::vector<std::string>& path = std::vector<std::string>(),
+ std::string const& name,
+ std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
static std::string FindProgram(
- const std::vector<std::string>& names,
- const std::vector<std::string>& path = std::vector<std::string>(),
+ std::vector<std::string> const& names,
+ std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
/**
* Find a library in the system PATH, with optional extra paths
*/
- static std::string FindLibrary(const std::string& name,
- const std::vector<std::string>& path);
+ static std::string FindLibrary(std::string const& name,
+ std::vector<std::string> const& path);
/**
* Return true if the file is a directory
*/
- static bool FileIsDirectory(const std::string& name);
+ static bool FileIsDirectory(std::string const& name);
/**
* Return true if the file is an executable
*/
- static bool FileIsExecutable(const std::string& name);
+ static bool FileIsExecutable(std::string const& name);
#if defined(_WIN32)
/**
@@ -761,24 +761,24 @@ public:
* Only available on Windows. This avoids an expensive `GetFileAttributesW`
* call.
*/
- static bool FileIsSymlinkWithAttr(const std::wstring& path,
+ static bool FileIsSymlinkWithAttr(std::wstring const& path,
unsigned long attr);
#endif
/**
* Return true if the file is a symlink
*/
- static bool FileIsSymlink(const std::string& name);
+ static bool FileIsSymlink(std::string const& name);
/**
* Return true if the file is a FIFO
*/
- static bool FileIsFIFO(const std::string& name);
+ static bool FileIsFIFO(std::string const& name);
/**
* Return true if the file has a given signature (first set of bytes)
*/
- static bool FileHasSignature(const char* filename, const char* signature,
+ static bool FileHasSignature(char const* filename, char const* signature,
long offset = 0);
/**
@@ -796,7 +796,7 @@ public:
FileTypeBinary,
FileTypeText
};
- static SystemTools::FileTypeEnum DetectFileType(const char* filename,
+ static SystemTools::FileTypeEnum DetectFileType(char const* filename,
unsigned long length = 256,
double percent_bin = 0.05);
@@ -828,7 +828,7 @@ public:
* etc.
* Return true if the file was found, false otherwise.
*/
- static bool LocateFileInDir(const char* filename, const char* dir,
+ static bool LocateFileInDir(char const* filename, char const* dir,
std::string& filename_found,
int try_filename_dirs = 0);
@@ -840,18 +840,18 @@ public:
/a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
*/
- static std::string RelativePath(const std::string& local,
- const std::string& remote);
+ static std::string RelativePath(std::string const& local,
+ std::string const& remote);
/**
* Return file's modified time
*/
- static long int ModifiedTime(const std::string& filename);
+ static long int ModifiedTime(std::string const& filename);
/**
* Return file's creation time (Win32: works only for NTFS, not FAT)
*/
- static long int CreationTime(const std::string& filename);
+ static long int CreationTime(std::string const& filename);
/**
* Get and set permissions of the file. If honor_umask is set, the umask
@@ -861,9 +861,9 @@ public:
* WARNING: A non-thread-safe method is currently used to get the umask
* if a honor_umask parameter is set to true.
*/
- static Status GetPermissions(const char* file, mode_t& mode);
+ static Status GetPermissions(char const* file, mode_t& mode);
static Status GetPermissions(std::string const& file, mode_t& mode);
- static Status SetPermissions(const char* file, mode_t mode,
+ static Status SetPermissions(char const* file, mode_t mode,
bool honor_umask = false);
static Status SetPermissions(std::string const& file, mode_t mode,
bool honor_umask = false);
@@ -879,7 +879,7 @@ public:
/**
* Get current date/time
*/
- static std::string GetCurrentDateTime(const char* format);
+ static std::string GetCurrentDateTime(char const* format);
/** -----------------------------------------------------------------
* Registry Manipulation Routines
@@ -901,27 +901,27 @@ public:
/**
* Get a list of subkeys.
*/
- static bool GetRegistrySubKeys(const std::string& key,
+ static bool GetRegistrySubKeys(std::string const& key,
std::vector<std::string>& subkeys,
KeyWOW64 view = KeyWOW64_Default);
/**
* Read a registry value
*/
- static bool ReadRegistryValue(const std::string& key, std::string& value,
+ static bool ReadRegistryValue(std::string const& key, std::string& value,
KeyWOW64 view = KeyWOW64_Default);
/**
* Write a registry value
*/
- static bool WriteRegistryValue(const std::string& key,
- const std::string& value,
+ static bool WriteRegistryValue(std::string const& key,
+ std::string const& value,
KeyWOW64 view = KeyWOW64_Default);
/**
* Delete a registry value
*/
- static bool DeleteRegistryValue(const std::string& key,
+ static bool DeleteRegistryValue(std::string const& key,
KeyWOW64 view = KeyWOW64_Default);
/** -----------------------------------------------------------------
@@ -935,25 +935,25 @@ public:
* of env will be used instead of PATH.
*/
static void GetPath(std::vector<std::string>& path,
- const char* env = nullptr);
+ char const* env = nullptr);
/**
* Read an environment variable
*/
- static const char* GetEnv(const char* key);
- static const char* GetEnv(const std::string& key);
- static bool GetEnv(const char* key, std::string& result);
- static bool GetEnv(const std::string& key, std::string& result);
- static bool HasEnv(const char* key);
- static bool HasEnv(const std::string& key);
+ static char const* GetEnv(char const* key);
+ static char const* GetEnv(std::string const& key);
+ static bool GetEnv(char const* key, std::string& result);
+ static bool GetEnv(std::string const& key, std::string& result);
+ static bool HasEnv(char const* key);
+ static bool HasEnv(std::string const& key);
/** Put a string into the environment
of the form var=value */
- static bool PutEnv(const std::string& env);
+ static bool PutEnv(std::string const& env);
/** Remove a string from the environment.
Input is of the form "var" or "var=value" (value is ignored). */
- static bool UnPutEnv(const std::string& env);
+ static bool UnPutEnv(std::string const& env);
/**
* Get current working directory CWD
@@ -984,25 +984,6 @@ public:
*/
static int GetTerminalWidth();
-#if @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP
- /**
- * Add an entry in the path translation table.
- */
- static void AddTranslationPath(const std::string& dir,
- const std::string& refdir);
-
- /**
- * If dir is different after CollapseFullPath is called,
- * Then insert it into the path translation table
- */
- static void AddKeepPath(const std::string& dir);
-
- /**
- * Update path by going through the Path Translation table;
- */
- static void CheckTranslationPath(std::string& path);
-#endif
-
/**
* Delay the execution for a specified amount of time specified
* in milliseconds
@@ -1027,7 +1008,7 @@ public:
* decode the dataglom using DecodeURL if set to true.
* Return false if the URL does not have the required form, true otherwise.
*/
- static bool ParseURLProtocol(const std::string& URL, std::string& protocol,
+ static bool ParseURLProtocol(std::string const& URL, std::string& protocol,
std::string& dataglom, bool decode = false);
/**
@@ -1038,7 +1019,7 @@ public:
* decode all string except the protocol using DecodeUrl if set to true.
* Return true if the string matches the format; false otherwise.
*/
- static bool ParseURL(const std::string& URL, std::string& protocol,
+ static bool ParseURL(std::string const& URL, std::string& protocol,
std::string& username, std::string& password,
std::string& hostname, std::string& dataport,
std::string& datapath, bool decode = false);
@@ -1049,17 +1030,10 @@ public:
* Does not perform any other sort of validation.
* Return the decoded string
*/
- static std::string DecodeURL(const std::string& url);
+ static std::string DecodeURL(std::string const& url);
private:
- /**
- * Allocate the stl map that serve as the Path Translation table.
- */
static void ClassInitialize();
-
- /**
- * Deallocate the stl map that serve as the Path Translation table.
- */
static void ClassFinalize();
/**
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index eb6e01b..2e62779 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -48,7 +48,7 @@ static void kwsysTerminalSetConsoleColor(HANDLE hOut,
FILE* stream, int color);
#endif
-void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...)
+void kwsysTerminal_cfprintf(int color, FILE* stream, char const* format, ...)
{
/* Setup the stream with the given color if possible. */
int pipeIsConsole = 0;
@@ -106,7 +106,7 @@ static int kwsysTerminalStreamIsNotInteractive(FILE* stream)
#endif
/* List of terminal names known to support VT100 color escape sequences. */
-static const char* kwsysTerminalVT100Names[] = { "Eterm",
+static char const* kwsysTerminalVT100Names[] = { "Eterm",
"alacritty",
"alacritty-direct",
"ansi",
@@ -170,7 +170,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
{
/* Force color according to https://bixense.com/clicolors/ convention. */
{
- const char* clicolor_force = getenv("CLICOLOR_FORCE");
+ char const* clicolor_force = getenv("CLICOLOR_FORCE");
if (clicolor_force && *clicolor_force &&
strcmp(clicolor_force, "0") != 0) {
return 1;
@@ -179,7 +179,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
/* Disable color according to https://bixense.com/clicolors/ convention. */
{
- const char* clicolor = getenv("CLICOLOR");
+ char const* clicolor = getenv("CLICOLOR");
if (clicolor && strcmp(clicolor, "0") == 0) {
return 0;
}
@@ -187,7 +187,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
/* GNU make 4.1+ may tell us that its output is destined for a TTY. */
{
- const char* termout = getenv("MAKE_TERMOUT");
+ char const* termout = getenv("MAKE_TERMOUT");
if (termout && *termout != '\0') {
return 1;
}
@@ -197,7 +197,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
seem to claim the TERM is xterm even though they do not support
VT100 escapes. */
{
- const char* emacs = getenv("EMACS");
+ char const* emacs = getenv("EMACS");
if (emacs && *emacs == 't') {
return 0;
}
@@ -205,8 +205,8 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
/* Check for a valid terminal. */
if (!default_vt100) {
- const char** t = 0;
- const char* term = getenv("TERM");
+ char const** t = 0;
+ char const* term = getenv("TERM");
if (term) {
for (t = kwsysTerminalVT100Names; *t && strcmp(term, *t) != 0; ++t) {
}
diff --git a/Source/kwsys/Terminal.h.in b/Source/kwsys/Terminal.h.in
index 1a2c745..ec8e31d 100644
--- a/Source/kwsys/Terminal.h.in
+++ b/Source/kwsys/Terminal.h.in
@@ -92,7 +92,7 @@ extern "C" {
* color specification.
*/
kwsysEXPORT void kwsysTerminal_cfprintf(int color, FILE* stream,
- const char* format, ...);
+ char const* format, ...);
enum kwsysTerminal_Color_e
{
/* Normal Text */
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index 0bfa20e..07e6f6d 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -147,7 +147,7 @@ int main()
int status = 0;
size_t bufferLen = 512;
char buffer[512] = { '\0' };
- const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
+ char const* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
char* demangledFunction =
abi::__cxa_demangle(function, buffer, &bufferLen, &status);
return status;
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index 0786751..880f7eb 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -17,7 +17,7 @@
static void* random_ptr = reinterpret_cast<void*>(0x123);
-static int argument(const char* arg, const char* value, void* call_data)
+static int argument(char const* arg, char const* value, void* call_data)
{
std::cout << "Got argument: \"" << arg << "\" value: \""
<< (value ? value : "(null)") << "\"" << std::endl;
@@ -28,7 +28,7 @@ static int argument(const char* arg, const char* value, void* call_data)
return 1;
}
-static int unknown_argument(const char* argument, void* call_data)
+static int unknown_argument(char const* argument, void* call_data)
{
std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl;
if (call_data != random_ptr) {
@@ -50,11 +50,11 @@ static bool CompareTwoItemsOnList(double i1, double i2)
{
return i1 == i2;
}
-static bool CompareTwoItemsOnList(const char* i1, const char* i2)
+static bool CompareTwoItemsOnList(char const* i1, char const* i2)
{
return strcmp(i1, i2) == 0;
}
-static bool CompareTwoItemsOnList(const std::string& i1, const std::string& i2)
+static bool CompareTwoItemsOnList(std::string const& i1, std::string const& i2)
{
return i1 == i2;
}
@@ -93,7 +93,7 @@ int testCommandLineArguments(int argc, char* argv[])
bool valid_bools[] = { true, true, false };
std::vector<char*> strings_argument;
- const char* valid_strings[] = { "andy", "bill", "brad", "ken" };
+ char const* valid_strings[] = { "andy", "bill", "brad", "ken" };
std::vector<std::string> stl_strings_argument;
std::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" };
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index 2f6b735..9fb7776 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -57,7 +57,7 @@ int testCommandLineArguments1(int argc, char* argv[])
int newArgc = 0;
arg.GetUnusedArguments(&newArgc, &newArgv);
int cc;
- const char* valid_unused_args[9] = { nullptr,
+ char const* valid_unused_args[9] = { nullptr,
"--ignored",
"--second-ignored",
"third-ignored",
diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx
index 64c61e2..46687b2 100644
--- a/Source/kwsys/testConsoleBuf.cxx
+++ b/Source/kwsys/testConsoleBuf.cxx
@@ -62,20 +62,20 @@ static void displayError(DWORD errorCode)
std::cerr.unsetf(std::ios::hex);
}
-std::basic_streambuf<char>* errstream(const char* unused)
+std::basic_streambuf<char>* errstream(char const* unused)
{
static_cast<void>(unused);
return std::cerr.rdbuf();
}
-std::basic_streambuf<wchar_t>* errstream(const wchar_t* unused)
+std::basic_streambuf<wchar_t>* errstream(wchar_t const* unused)
{
static_cast<void>(unused);
return std::wcerr.rdbuf();
}
template <typename T>
-static void dumpBuffers(const T* expected, const T* received, size_t size)
+static void dumpBuffers(T const* expected, T const* received, size_t size)
{
std::basic_ostream<T> err(errstream(expected));
err << "Expected output: '" << std::basic_string<T>(expected, size) << "'"
@@ -346,7 +346,7 @@ static int testPipe()
dumpBuffers<char>(encodedTestString.c_str(), buffer2,
encodedTestString.size());
}
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
DWORD lastError = GetLastError();
std::cerr << "In function testPipe, line " << __LINE__ << ": "
<< ex.what() << std::endl;
@@ -354,7 +354,7 @@ static int testPipe()
}
finishProcess(didFail == 0);
}
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
DWORD lastError = GetLastError();
std::cerr << "In function testPipe, line " << __LINE__ << ": " << ex.what()
<< std::endl;
@@ -452,7 +452,7 @@ static int testFile()
dumpBuffers<char>(encodedTestString.c_str(), buffer2,
encodedTestString.size());
}
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
DWORD lastError = GetLastError();
std::cerr << "In function testFile, line " << __LINE__ << ": "
<< ex.what() << std::endl;
@@ -460,7 +460,7 @@ static int testFile()
}
finishProcess(didFail == 0);
}
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
DWORD lastError = GetLastError();
std::cerr << "In function testFile, line " << __LINE__ << ": " << ex.what()
<< std::endl;
@@ -524,7 +524,7 @@ static int testConsole()
# pragma warning(disable : 4996)
# endif
# endif
- const bool isVistaOrGreater =
+ bool const isVistaOrGreater =
LOBYTE(LOWORD(GetVersion())) >= HIBYTE(_WIN32_WINNT_VISTA);
# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersion
# ifdef __clang__
@@ -746,7 +746,7 @@ static int testConsole()
wideInputTestString.size() - 1);
}
delete[] outputBuffer;
- } catch (const std::runtime_error& ex) {
+ } catch (std::runtime_error const& ex) {
DWORD lastError = GetLastError();
std::cerr << "In function testConsole, line " << __LINE__ << ": "
<< ex.what() << std::endl;
diff --git a/Source/kwsys/testConsoleBuf.hxx b/Source/kwsys/testConsoleBuf.hxx
index e93cb4f..b38e4b3 100644
--- a/Source/kwsys/testConsoleBuf.hxx
+++ b/Source/kwsys/testConsoleBuf.hxx
@@ -3,13 +3,13 @@
#ifndef testConsoleBuf_hxx
#define testConsoleBuf_hxx
-static const wchar_t cmdConsoleBufChild[] = L"testConsoleBufChild";
+static wchar_t const cmdConsoleBufChild[] = L"testConsoleBufChild";
-static const wchar_t BeforeInputEventName[] = L"BeforeInputEvent";
-static const wchar_t AfterOutputEventName[] = L"AfterOutputEvent";
+static wchar_t const BeforeInputEventName[] = L"BeforeInputEvent";
+static wchar_t const AfterOutputEventName[] = L"AfterOutputEvent";
// यूनिकोड είναι здорово!
-static const wchar_t UnicodeTestString[] =
+static wchar_t const UnicodeTestString[] =
L"\u092F\u0942\u0928\u093F\u0915\u094B\u0921 "
L"\u03B5\u03AF\u03BD\0\u03B1\u03B9 "
L"\u0437\u0434\u043E\u0440\u043E\u0432\u043E!";
diff --git a/Source/kwsys/testConsoleBufChild.cxx b/Source/kwsys/testConsoleBufChild.cxx
index 3c8fdc2..f3c309e 100644
--- a/Source/kwsys/testConsoleBufChild.cxx
+++ b/Source/kwsys/testConsoleBufChild.cxx
@@ -16,7 +16,7 @@
#include "testConsoleBuf.hxx"
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
#if defined(_WIN32)
kwsys::ConsoleBuf::Manager out(std::cout);
diff --git a/Source/kwsys/testDirectory.cxx b/Source/kwsys/testDirectory.cxx
index 8c73af2..83ac55d 100644
--- a/Source/kwsys/testDirectory.cxx
+++ b/Source/kwsys/testDirectory.cxx
@@ -22,7 +22,7 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
static int doLongPathTest()
{
using namespace kwsys;
- static const int LONG_PATH_THRESHOLD = 512;
+ static int const LONG_PATH_THRESHOLD = 512;
int res = 0;
std::string topdir(TEST_SYSTEMTOOLS_BINARY_DIR "/directory_testing/");
std::stringstream testpathstrm;
@@ -108,20 +108,20 @@ static int nonExistentDirectoryTest()
static int copyDirectoryTest()
{
using namespace kwsys;
- const std::string source(TEST_SYSTEMTOOLS_BINARY_DIR
+ std::string const source(TEST_SYSTEMTOOLS_BINARY_DIR
"/directory_testing/copyDirectoryTestSrc");
if (SystemTools::PathExists(source)) {
std::cerr << source << " shouldn't exist before test" << std::endl;
return 1;
}
- const std::string destination(TEST_SYSTEMTOOLS_BINARY_DIR
+ std::string const destination(TEST_SYSTEMTOOLS_BINARY_DIR
"/directory_testing/copyDirectoryTestDst");
if (SystemTools::PathExists(destination)) {
std::cerr << destination << " shouldn't exist before test" << std::endl;
return 2;
}
- const Status copysuccess = SystemTools::CopyADirectory(source, destination);
- const bool destinationexists = SystemTools::PathExists(destination);
+ Status const copysuccess = SystemTools::CopyADirectory(source, destination);
+ bool const destinationexists = SystemTools::PathExists(destination);
if (copysuccess.IsSuccess()) {
std::cerr << "CopyADirectory should have returned false" << std::endl;
SystemTools::RemoveADirectory(destination);
diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx
index a5095a5..e893075 100644
--- a/Source/kwsys/testDynamicLoader.cxx
+++ b/Source/kwsys/testDynamicLoader.cxx
@@ -44,7 +44,7 @@
// is referenced semantically.
#include "testDynload.h"
-static std::string GetLibName(const char* lname, const char* subdir = nullptr)
+static std::string GetLibName(char const* lname, char const* subdir = nullptr)
{
// Construct proper name of lib
std::string slname;
@@ -71,7 +71,7 @@ static std::string GetLibName(const char* lname, const char* subdir = nullptr)
* r2: should GetSymbolAddress succeed ?
* r3: should CloseLibrary succeed ?
*/
-static int TestDynamicLoader(const char* libname, const char* symbol, int r1,
+static int TestDynamicLoader(char const* libname, char const* symbol, int r1,
int r2, int r3, int flags = 0)
{
std::cerr << "Testing: " << libname << std::endl;
diff --git a/Source/kwsys/testEncode.c b/Source/kwsys/testEncode.c
index b7b6dd8..1e81615 100644
--- a/Source/kwsys/testEncode.c
+++ b/Source/kwsys/testEncode.c
@@ -12,14 +12,14 @@
#include <stdio.h>
#include <string.h>
-static const unsigned char testMD5input1[] =
+static unsigned char const testMD5input1[] =
" A quick brown fox jumps over the lazy dog.\n"
" This is sample text for MD5 sum input.\n";
-static const char testMD5output1[] = "8f146af46ed4f267921bb937d4d3500c";
+static char const testMD5output1[] = "8f146af46ed4f267921bb937d4d3500c";
-static const int testMD5input2len = 28;
-static const unsigned char testMD5input2[] = "the cow jumped over the moon";
-static const char testMD5output2[] = "a2ad137b746138fae4e5adca9c85d3ae";
+static int const testMD5input2len = 28;
+static unsigned char const testMD5input2[] = "the cow jumped over the moon";
+static char const testMD5output2[] = "a2ad137b746138fae4e5adca9c85d3ae";
static int testMD5_1(kwsysMD5* md5)
{
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index 3acb6c8..c65e85a 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -22,7 +22,7 @@
# include "Encoding.hxx.in"
#endif
-static const unsigned char helloWorldStrings[][32] = {
+static unsigned char const helloWorldStrings[][32] = {
// English
{ 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', 0 },
// Japanese
@@ -53,7 +53,7 @@ static int testHelloWorldEncoding()
{
int ret = 0;
for (int i = 0; helloWorldStrings[i][0] != 0; i++) {
- std::string str = reinterpret_cast<const char*>(helloWorldStrings[i]);
+ std::string str = reinterpret_cast<char const*>(helloWorldStrings[i]);
std::cout << str << std::endl;
std::wstring wstr = kwsys::Encoding::ToWide(str);
std::string str2 = kwsys::Encoding::ToNarrow(wstr);
@@ -86,7 +86,7 @@ static int testRobustEncoding()
wstr = kwsys::Encoding::ToWide(nullptr);
if (!wstr.empty()) {
- const wchar_t* wcstr = wstr.c_str();
+ wchar_t const* wcstr = wstr.c_str();
std::cout << "ToWide(NULL) returned";
for (size_t i = 0; i < wstr.size(); i++) {
std::cout << " " << std::hex << static_cast<int>(wcstr[i]);
@@ -96,7 +96,7 @@ static int testRobustEncoding()
}
wstr = kwsys::Encoding::ToWide("");
if (!wstr.empty()) {
- const wchar_t* wcstr = wstr.c_str();
+ wchar_t const* wcstr = wstr.c_str();
std::cout << "ToWide(\"\") returned";
for (size_t i = 0; i < wstr.size(); i++) {
std::cout << " " << std::hex << static_cast<int>(wcstr[i]);
@@ -268,7 +268,7 @@ static int testToWindowsExtendedPath()
int testEncoding(int, char*[])
{
- const char* loc = setlocale(LC_ALL, "");
+ char const* loc = setlocale(LC_ALL, "");
if (loc) {
std::cout << "Locale: " << loc << std::endl;
} else {
diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx
index 9897a58..eea7f4b 100644
--- a/Source/kwsys/testFStream.cxx
+++ b/Source/kwsys/testFStream.cxx
@@ -27,8 +27,8 @@ static int testNoFile()
return 0;
}
-static const int num_test_files = 7;
-static const int max_test_file_size = 45;
+static int const num_test_files = 7;
+static int const max_test_file_size = 45;
static kwsys::FStream::BOM expected_bom[num_test_files] = {
kwsys::FStream::BOM_None, kwsys::FStream::BOM_None,
@@ -71,9 +71,9 @@ static int testBOM()
for (int i = 0; i < num_test_files; i++) {
{
kwsys::ofstream out("bom.txt", kwsys::ofstream::binary);
- out.write(reinterpret_cast<const char*>(expected_bom_data[i] + 1),
+ out.write(reinterpret_cast<char const*>(expected_bom_data[i] + 1),
*expected_bom_data[i]);
- out.write(reinterpret_cast<const char*>(file_data[i] + 1),
+ out.write(reinterpret_cast<char const*>(file_data[i] + 1),
file_data[i][0]);
}
@@ -106,9 +106,9 @@ static int testBOMIO()
kwsys::fstream f("bomio.txt",
kwsys::fstream::in | kwsys::fstream::out |
kwsys::fstream::binary | kwsys::fstream::trunc);
- f.write(reinterpret_cast<const char*>(expected_bom_data[i] + 1),
+ f.write(reinterpret_cast<char const*>(expected_bom_data[i] + 1),
*expected_bom_data[i]);
- f.write(reinterpret_cast<const char*>(file_data[i] + 1), file_data[i][0]);
+ f.write(reinterpret_cast<char const*>(file_data[i] + 1), file_data[i][0]);
if (!f.good()) {
std::cout << "Unable to write data " << i << std::endl;
return 1;
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index fcc31da..137bd4b 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -59,11 +59,11 @@ static void testProcess_sleep(unsigned int sec)
}
#endif
-int runChild(const char* cmd[], int state, int exception, int value, int share,
+int runChild(char const* cmd[], int state, int exception, int value, int share,
int output, int delay, double timeout, int poll, int repeat,
int disown, int createNewGroup, unsigned int interruptDelay);
-static int test1(int argc, const char* argv[])
+static int test1(int argc, char const* argv[])
{
/* This is a very basic functional test of kwsysProcess. It is repeated
numerous times to verify that there are no resource leaks in kwsysProcess
@@ -82,7 +82,7 @@ static int test1(int argc, const char* argv[])
return 0;
}
-static int test2(int argc, const char* argv[])
+static int test2(int argc, char const* argv[])
{
(void)argc;
(void)argv;
@@ -91,7 +91,7 @@ static int test2(int argc, const char* argv[])
return 123;
}
-static int test3(int argc, const char* argv[])
+static int test3(int argc, char const* argv[])
{
(void)argc;
(void)argv;
@@ -105,7 +105,7 @@ static int test3(int argc, const char* argv[])
return 0;
}
-static int test4(int argc, const char* argv[])
+static int test4(int argc, char const* argv[])
{
#ifndef CRASH_USING_ABORT
/* Prepare a pointer to an invalid address. Don't use null, because
@@ -113,7 +113,7 @@ static int test4(int argc, const char* argv[])
do whatever they want. ex: Clang will warn at compile time, or even
optimize away the write. We hope to 'outsmart' them by using
'volatile' and a slightly larger address, based on a runtime value. */
- volatile int* invalidAddress = 0;
+ int volatile* invalidAddress = 0;
invalidAddress += argc ? 1 : 2;
#endif
@@ -142,10 +142,10 @@ static int test4(int argc, const char* argv[])
return 0;
}
-static int test5(int argc, const char* argv[])
+static int test5(int argc, char const* argv[])
{
int r;
- const char* cmd[4];
+ char const* cmd[4];
(void)argc;
cmd[0] = argv[0];
cmd[1] = "run";
@@ -170,7 +170,7 @@ static int test5(int argc, const char* argv[])
}
#define TEST6_SIZE (4096 * 2)
-static void test6(int argc, const char* argv[])
+static void test6(int argc, char const* argv[])
{
int i;
char runaway[TEST6_SIZE + 1];
@@ -193,7 +193,7 @@ static void test6(int argc, const char* argv[])
delaying 1/10th of a second should ever have to poll. */
#define MINPOLL 5
#define MAXPOLL 20
-static int test7(int argc, const char* argv[])
+static int test7(int argc, char const* argv[])
{
(void)argc;
(void)argv;
@@ -210,12 +210,12 @@ static int test7(int argc, const char* argv[])
return 0;
}
-static int test8(int argc, const char* argv[])
+static int test8(int argc, char const* argv[])
{
/* Create a disowned grandchild to test handling of processes
that exit before their children. */
int r;
- const char* cmd[4];
+ char const* cmd[4];
(void)argc;
cmd[0] = argv[0];
cmd[1] = "run";
@@ -234,7 +234,7 @@ static int test8(int argc, const char* argv[])
return r;
}
-static int test8_grandchild(int argc, const char* argv[])
+static int test8_grandchild(int argc, char const* argv[])
{
(void)argc;
(void)argv;
@@ -252,7 +252,7 @@ static int test8_grandchild(int argc, const char* argv[])
return 0;
}
-static int test9(int argc, const char* argv[])
+static int test9(int argc, char const* argv[])
{
/* Test Ctrl+C behavior: the root test program will send a Ctrl+C to this
process. Here, we start a child process that sleeps for a long time
@@ -262,7 +262,7 @@ static int test9(int argc, const char* argv[])
WARNING: This test will falsely pass if the share parameter of runChild
was set to 0 when invoking the test9 process. */
int r;
- const char* cmd[4];
+ char const* cmd[4];
(void)argc;
cmd[0] = argv[0];
cmd[1] = "run";
@@ -296,7 +296,7 @@ static BOOL WINAPI test9_grandchild_handler(DWORD dwCtrlType)
}
#endif
-static int test9_grandchild(int argc, const char* argv[])
+static int test9_grandchild(int argc, char const* argv[])
{
/* The grandchild just sleeps for a few seconds while ignoring signals. */
(void)argc;
@@ -327,7 +327,7 @@ static int test9_grandchild(int argc, const char* argv[])
return 0;
}
-static int test10(int argc, const char* argv[])
+static int test10(int argc, char const* argv[])
{
/* Test Ctrl+C behavior: the root test program will send a Ctrl+C to this
process. Here, we start a child process that sleeps for a long time and
@@ -335,7 +335,7 @@ static int test10(int argc, const char* argv[])
process group - ensuring that Ctrl+C we receive is sent to our process
groups. We make sure it exits anyway. */
int r;
- const char* cmd[4];
+ char const* cmd[4];
(void)argc;
cmd[0] = argv[0];
cmd[1] = "run";
@@ -355,7 +355,7 @@ static int test10(int argc, const char* argv[])
return r;
}
-static int test10_grandchild(int argc, const char* argv[])
+static int test10_grandchild(int argc, char const* argv[])
{
/* The grandchild just sleeps for a few seconds and handles signals. */
(void)argc;
@@ -373,7 +373,7 @@ static int test10_grandchild(int argc, const char* argv[])
return 0;
}
-static int runChild2(kwsysProcess* kp, const char* cmd[], int state,
+static int runChild2(kwsysProcess* kp, char const* cmd[], int state,
int exception, int value, int share, int output,
int delay, double timeout, int poll, int disown,
int createNewGroup, unsigned int interruptDelay)
@@ -541,7 +541,7 @@ static int runChild2(kwsysProcess* kp, const char* cmd[], int state,
* BEFORE any reading/polling of pipes occurs and before any
* detachment occurs.
*/
-int runChild(const char* cmd[], int state, int exception, int value, int share,
+int runChild(char const* cmd[], int state, int exception, int value, int share,
int output, int delay, double timeout, int poll, int repeat,
int disown, int createNewGroup, unsigned int interruptDelay)
{
@@ -562,7 +562,7 @@ int runChild(const char* cmd[], int state, int exception, int value, int share,
return result;
}
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
int n = 0;
@@ -665,7 +665,7 @@ int main(int argc, const char* argv[])
int createNewGroups[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 };
unsigned int interruptDelays[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 3, 2 };
int r;
- const char* cmd[4];
+ char const* cmd[4];
#ifdef _WIN32
char* argv0 = 0;
#endif
@@ -715,7 +715,7 @@ int main(int argc, const char* argv[])
if (argc > 2 && strcmp(argv[1], "0") == 0) {
/* This is the special debugging test to run a given command
line. */
- const char** cmd = argv + 2;
+ char const** cmd = argv + 2;
int state = kwsysProcess_State_Exited;
int exception = kwsysProcess_Exception_None;
int value = 0;
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 9275043..5070df4 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -37,7 +37,7 @@
typedef unsigned short mode_t;
#endif
-static const char* toUnixPaths[][2] = {
+static char const* toUnixPaths[][2] = {
{ "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
{ "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
{ "/usr/lo\\ cal/bin/pa\\ sswd", "/usr/lo/ cal/bin/pa/ sswd" },
@@ -53,6 +53,21 @@ static const char* toUnixPaths[][2] = {
{ "\\\\usr\\local\\bin\\passwd", "//usr/local/bin/passwd" },
{ "\\\\usr\\lo cal\\bin\\pa sswd", "//usr/lo cal/bin/pa sswd" },
{ "\\\\usr\\lo\\ cal\\bin\\pa\\ sswd", "//usr/lo/ cal/bin/pa/ sswd" },
+ { "\\", "/" },
+ { "/", "/" },
+ { "\\\\", "//" },
+ { "//", "//" },
+ { "\\\\\\", "/" },
+ { "///", "/" },
+ { "C:\\", "C:/" },
+ { "C:\\\\", "C:/" },
+ { "C:\\\\\\", "C:/" },
+ { "\\\\UNC\\path", "//UNC/path" },
+ { "//UNC/path", "//UNC/path" },
+ { "\\\\\\triple\\\\back\\\\\\slash\\\\\\", "/triple/back/slash" },
+ { "///triple//back///slash///", "/triple/back/slash" },
+ { "///////ex treme/////////", "/ex treme" },
+ { "~__nonexistent_username__", "~__nonexistent_username__" },
{ nullptr, nullptr }
};
@@ -69,14 +84,14 @@ static bool CheckConvertToUnixSlashes(std::string const& input,
return true;
}
-static const char* checkEscapeChars[][4] = {
+static char const* checkEscapeChars[][4] = {
{ "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2" },
{ " {} ", "{}", "#", " #{#} " },
{ nullptr, nullptr, nullptr, nullptr }
};
static bool CheckEscapeChars(std::string const& input,
- const char* chars_to_escape, char escape_char,
+ char const* chars_to_escape, char escape_char,
std::string const& output)
{
std::string result = kwsys::SystemTools::EscapeChars(
@@ -92,16 +107,16 @@ static bool CheckEscapeChars(std::string const& input,
static bool CheckFileOperations()
{
bool res = true;
- const std::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ std::string const testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemToolsNonExistingFile");
- const std::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR "/.");
- const std::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ std::string const testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR "/.");
+ std::string const testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemTools.bin");
- const std::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ std::string const testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemTools.cxx");
- const std::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
+ std::string const testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
"/testSystemToolsNewDir");
- const std::string testNewFile(testNewDir + "/testNewFile.txt");
+ std::string const testNewFile(testNewDir + "/testNewFile.txt");
if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) !=
kwsys::SystemTools::FileTypeUnknown) {
@@ -470,7 +485,7 @@ static bool CheckFileOperations()
// Perform the same file and directory creation and deletion tests but
// with paths > 256 characters in length.
- const std::string testNewLongDir(
+ std::string const testNewLongDir(
TEST_SYSTEMTOOLS_BINARY_DIR
"/"
"012345678901234567890123456789012345678901234567890123456789"
@@ -478,7 +493,7 @@ static bool CheckFileOperations()
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
"01234567890123");
- const std::string testNewLongFile(
+ std::string const testNewLongFile(
testNewLongDir +
"/"
"012345678901234567890123456789012345678901234567890123456789"
@@ -667,8 +682,8 @@ static bool CheckStringOperations()
return res;
}
-static bool CheckPutEnv(const std::string& env, const char* name,
- const char* value)
+static bool CheckPutEnv(std::string const& env, char const* name,
+ char const* value)
{
if (!kwsys::SystemTools::PutEnv(env)) {
std::cerr << "PutEnv(\"" << env << "\") failed!" << std::endl;
@@ -684,7 +699,7 @@ static bool CheckPutEnv(const std::string& env, const char* name,
return true;
}
-static bool CheckUnPutEnv(const char* env, const char* name)
+static bool CheckUnPutEnv(char const* env, char const* name)
{
if (!kwsys::SystemTools::UnPutEnv(env)) {
std::cerr << "UnPutEnv(\"" << env << "\") failed!" << std::endl;
@@ -713,9 +728,9 @@ static bool CheckEnvironmentOperations()
return res;
}
-static bool CheckRelativePath(const std::string& local,
- const std::string& remote,
- const std::string& expected)
+static bool CheckRelativePath(std::string const& local,
+ std::string const& remote,
+ std::string const& expected)
{
std::string result = kwsys::SystemTools::RelativePath(local, remote);
if (!kwsys::SystemTools::ComparePath(expected, result)) {
@@ -738,9 +753,9 @@ static bool CheckRelativePaths()
return res;
}
-static bool CheckCollapsePath(const std::string& path,
- const std::string& expected,
- const char* base = nullptr)
+static bool CheckCollapsePath(std::string const& path,
+ std::string const& expected,
+ char const* base = nullptr)
{
std::string result = kwsys::SystemTools::CollapseFullPath(path, base);
if (!kwsys::SystemTools::ComparePath(expected, result)) {
@@ -772,7 +787,7 @@ static bool CheckCollapsePath()
return res;
}
-static std::string StringVectorToString(const std::vector<std::string>& vec)
+static std::string StringVectorToString(std::vector<std::string> const& vec)
{
std::stringstream ss;
ss << "vector(";
@@ -788,13 +803,13 @@ static std::string StringVectorToString(const std::vector<std::string>& vec)
static bool CheckGetPath()
{
- const char* envName = "S";
+ char const* envName = "S";
#ifdef _WIN32
- const char* envValue = "C:\\Somewhere\\something;D:\\Temp";
+ char const* envValue = "C:\\Somewhere\\something;D:\\Temp";
#else
- const char* envValue = "/Somewhere/something:/tmp";
+ char const* envValue = "/Somewhere/something:/tmp";
#endif
- const char* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
+ char const* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
std::vector<std::string> originalPaths;
originalPaths.emplace_back(registryPath);
@@ -829,8 +844,8 @@ static bool CheckGetPath()
static bool CheckGetFilenameName()
{
- const char* windowsFilepath = "C:\\somewhere\\something";
- const char* unixFilepath = "/somewhere/something";
+ char const* windowsFilepath = "C:\\somewhere\\something";
+ char const* unixFilepath = "/somewhere/something";
#if defined(_WIN32) || defined(KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES)
std::string expectedWindowsFilename = "something";
@@ -860,8 +875,8 @@ static bool CheckGetFilenameName()
static bool CheckFind()
{
bool res = true;
- const std::string testFindFileName("testFindFile.txt");
- const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" +
+ std::string const testFindFileName("testFindFile.txt");
+ std::string const testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" +
testFindFileName);
if (!kwsys::SystemTools::Touch(testFindFile, true)) {
@@ -923,7 +938,7 @@ static bool CheckIsSubDirectory()
static bool CheckGetLineFromStream()
{
- const std::string fileWithFiveCharsOnFirstLine(TEST_SYSTEMTOOLS_SOURCE_DIR
+ std::string const fileWithFiveCharsOnFirstLine(TEST_SYSTEMTOOLS_SOURCE_DIR
"/README.rst");
kwsys::ifstream file(fileWithFiveCharsOnFirstLine.c_str(), std::ios::in);
@@ -974,7 +989,7 @@ static bool CheckGetLineFromStream()
static bool CheckGetLineFromStreamLongLine()
{
- const std::string fileWithLongLine("longlines.txt");
+ std::string const fileWithLongLine("longlines.txt");
std::string firstLine, secondLine;
// First line: large buffer, containing a carriage return for some reason.
firstLine.assign(2050, ' ');
@@ -1047,7 +1062,7 @@ static bool CheckGetLineFromStreamLongLine()
return true;
}
-static bool writeFile(const char* fileName, const char* data)
+static bool writeFile(char const* fileName, char const* data)
{
kwsys::ofstream out(fileName, std::ios::binary);
out << data;
@@ -1058,7 +1073,7 @@ static bool writeFile(const char* fileName, const char* data)
return true;
}
-static std::string readFile(const char* fileName)
+static std::string readFile(char const* fileName)
{
kwsys::ifstream in(fileName, std::ios::binary);
std::stringstream sstr;
@@ -1073,8 +1088,8 @@ static std::string readFile(const char* fileName)
struct
{
- const char* a;
- const char* b;
+ char const* a;
+ char const* b;
bool differ;
} diff_test_cases[] = { { "one", "one", false },
{ "one", "two", true },
@@ -1088,7 +1103,7 @@ struct
static bool CheckTextFilesDiffer()
{
- const int num_test_cases =
+ int const num_test_cases =
sizeof(diff_test_cases) / sizeof(diff_test_cases[0]);
for (int i = 0; i < num_test_cases; ++i) {
if (!writeFile("file_a", diff_test_cases[i].a) ||
@@ -1109,14 +1124,14 @@ static bool CheckTextFilesDiffer()
static bool CheckCopyFileIfDifferent()
{
bool ret = true;
- const int num_test_cases =
+ int const num_test_cases =
sizeof(diff_test_cases) / sizeof(diff_test_cases[0]);
for (int i = 0; i < num_test_cases; ++i) {
if (!writeFile("file_a", diff_test_cases[i].a) ||
!writeFile("file_b", diff_test_cases[i].b)) {
return false;
}
- const char* cptarget =
+ char const* cptarget =
i < 4 ? TEST_SYSTEMTOOLS_BINARY_DIR "/file_b" : "file_b";
if (!kwsys::SystemTools::CopyFileIfDifferent("file_a", cptarget)) {
std::cerr << "CopyFileIfDifferent() returned false for test case "
@@ -1178,7 +1193,7 @@ static bool CheckSplitString()
bool ret = true;
auto check_split = [](std::string const& input,
- std::initializer_list<const char*> expected) -> bool {
+ std::initializer_list<char const*> expected) -> bool {
auto const components = kwsys::SystemTools::SplitString(input, '/');
if (components.size() != expected.size()) {
std::cerr << "Incorrect split count for " << input << ": "
diff --git a/Templates/.gitattributes b/Templates/.gitattributes
new file mode 100644
index 0000000..11b4621
--- /dev/null
+++ b/Templates/.gitattributes
@@ -0,0 +1 @@
+CPack.GenericLicense.txt conflict-marker-size=79
diff --git a/Templates/CPack.GenericDescription.txt b/Templates/CPack.GenericDescription.txt
index 712ee14..43c83e5 100644
--- a/Templates/CPack.GenericDescription.txt
+++ b/Templates/CPack.GenericDescription.txt
@@ -2,4 +2,3 @@ DESCRIPTION
===========
This is an installer created using CPack (https://cmake.org). No additional installation instructions provided.
-
diff --git a/Templates/CPack.GenericLicense.txt b/Templates/CPack.GenericLicense.txt
index 09c6218..50861ea 100644
--- a/Templates/CPack.GenericLicense.txt
+++ b/Templates/CPack.GenericLicense.txt
@@ -2,4 +2,3 @@ LICENSE
=======
This is an installer created using CPack (https://cmake.org). No license provided.
-
diff --git a/Tests/BuildDepends/Project/generator.cxx b/Tests/BuildDepends/Project/generator.cxx
index 5a83a7f..354403e 100644
--- a/Tests/BuildDepends/Project/generator.cxx
+++ b/Tests/BuildDepends/Project/generator.cxx
@@ -1,8 +1,8 @@
#include <stdio.h>
-extern const char* foo();
+extern char const* foo();
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
if (argc < 3) {
fprintf(stderr, "Must specify output file and symbol prefix!");
diff --git a/Tests/BuildDepends/Project/zot.cxx b/Tests/BuildDepends/Project/zot.cxx
index 2d08c4b..1b3b903 100644
--- a/Tests/BuildDepends/Project/zot.cxx
+++ b/Tests/BuildDepends/Project/zot.cxx
@@ -2,9 +2,9 @@
#include <zot.hxx>
#include <zot_custom.hxx>
-const char* zot_macro_dir_f();
-const char* zot_macro_tgt_f();
-const char* zot_pch_f();
+char const* zot_macro_dir_f();
+char const* zot_macro_tgt_f();
+char const* zot_pch_f();
int main()
{
diff --git a/Tests/BuildDepends/Project/zot_macro_dir.cxx b/Tests/BuildDepends/Project/zot_macro_dir.cxx
index 733a4b3..2908fcd 100644
--- a/Tests/BuildDepends/Project/zot_macro_dir.cxx
+++ b/Tests/BuildDepends/Project/zot_macro_dir.cxx
@@ -1,7 +1,7 @@
#define ZOT_DIR(x) <zot_##x##_dir.hxx>
#include ZOT_DIR(macro)
-const char* zot_macro_dir_f()
+char const* zot_macro_dir_f()
{
return zot_macro_dir;
}
diff --git a/Tests/BuildDepends/Project/zot_macro_tgt.cxx b/Tests/BuildDepends/Project/zot_macro_tgt.cxx
index 182ee16..9b51cb8 100644
--- a/Tests/BuildDepends/Project/zot_macro_tgt.cxx
+++ b/Tests/BuildDepends/Project/zot_macro_tgt.cxx
@@ -1,7 +1,7 @@
#define ZOT_TGT(x) <zot_##x##_tgt.hxx>
#include ZOT_TGT(macro)
-const char* zot_macro_tgt_f()
+char const* zot_macro_tgt_f()
{
return zot_macro_tgt;
}
diff --git a/Tests/BuildDepends/Project/zot_pch.cxx b/Tests/BuildDepends/Project/zot_pch.cxx
index d9d04c7..372e852 100644
--- a/Tests/BuildDepends/Project/zot_pch.cxx
+++ b/Tests/BuildDepends/Project/zot_pch.cxx
@@ -1,6 +1,6 @@
#include <zot_pch.hxx>
-const char* zot_pch_f()
+char const* zot_pch_f()
{
return zot_pch;
}
diff --git a/Tests/BundleGeneratorTest/Executable.cxx b/Tests/BundleGeneratorTest/Executable.cxx
index 3d7e0d7..97bccca 100644
--- a/Tests/BundleGeneratorTest/Executable.cxx
+++ b/Tests/BundleGeneratorTest/Executable.cxx
@@ -1,4 +1,4 @@
-extern void print_message(const char* const Message);
+extern void print_message(char const* const Message);
int main(int argc, char* argv[])
{
diff --git a/Tests/BundleGeneratorTest/Library.cxx b/Tests/BundleGeneratorTest/Library.cxx
index c4f40c4..a4cc08e 100644
--- a/Tests/BundleGeneratorTest/Library.cxx
+++ b/Tests/BundleGeneratorTest/Library.cxx
@@ -1,6 +1,6 @@
#include <iostream>
-void print_message(const char* const Message)
+void print_message(char const* const Message)
{
std::cout << Message;
}
diff --git a/Tests/BundleGeneratorTest/StartupCommand b/Tests/BundleGeneratorTest/StartupCommand
index 5bc5ad2..9776772 100755
--- a/Tests/BundleGeneratorTest/StartupCommand
+++ b/Tests/BundleGeneratorTest/StartupCommand
@@ -9,4 +9,3 @@ echo "RESOURCES: $RESOURCES"
export DYLD_LIBRARY_PATH=$RESOURCES/lib
exec "$RESOURCES/bin/Executable"
-
diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx
index cfb5f7d..896e734 100644
--- a/Tests/BundleTest/BundleLib.cxx
+++ b/Tests/BundleTest/BundleLib.cxx
@@ -16,7 +16,7 @@ int fileExists(char* filename)
return 1;
}
-int findBundleFile(char* exec, const char* file)
+int findBundleFile(char* exec, char const* file)
{
int res;
char* nexec = strdup(exec);
diff --git a/Tests/BundleTest/randomResourceFile.plist.in b/Tests/BundleTest/randomResourceFile.plist.in
index cfe3222..10e02d2 100644
--- a/Tests/BundleTest/randomResourceFile.plist.in
+++ b/Tests/BundleTest/randomResourceFile.plist.in
@@ -6,4 +6,3 @@
<string>CMake</string>
</dict>
</plist>
-
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index 9eeb532..220ef39 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -1,7 +1,4 @@
-# Using 2.8 will trigger a deprecation warning. In this case it's explicitly
-# intentional since the tests checks various policy implementations prior to
-# 3.10
-cmake_minimum_required(VERSION 2.8.10) # old enough to not set CMP0022
+cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
@@ -53,38 +50,38 @@ generate_export_header(depC)
target_link_libraries(depC LINK_PUBLIC depA LINK_PUBLIC depA)
-assert_property(depA LINK_INTERFACE_LIBRARIES "")
-assert_property(depB LINK_INTERFACE_LIBRARIES "")
-assert_property(depC LINK_INTERFACE_LIBRARIES "depA;depA")
+assert_property(depA INTERFACE_LINK_LIBRARIES "")
+assert_property(depB INTERFACE_LINK_LIBRARIES "")
+assert_property(depC INTERFACE_LINK_LIBRARIES "depA;depA")
add_executable(targetA targetA.cpp)
target_link_libraries(targetA LINK_INTERFACE_LIBRARIES depA depB)
-assert_property(targetA LINK_INTERFACE_LIBRARIES "depA;depB")
+assert_property(targetA INTERFACE_LINK_LIBRARIES "depA;depB")
-set_target_properties(targetA PROPERTIES LINK_INTERFACE_LIBRARIES "")
+set_target_properties(targetA PROPERTIES INTERFACE_LINK_LIBRARIES "")
-assert_property(targetA LINK_INTERFACE_LIBRARIES "")
+assert_property(targetA INTERFACE_LINK_LIBRARIES "")
add_subdirectory(subdir)
target_link_libraries(targetA subdirlib)
target_link_libraries(targetA depB depC)
-assert_property(targetA LINK_INTERFACE_LIBRARIES "")
+assert_property(targetA INTERFACE_LINK_LIBRARIES ";subdirlib;depB;depC")
# Exclude depIfaceOnly from ALL so that it will only be built if something
# depends on it. As it is in the link interface of depB, targetA
# will depend on it. That dependency is what is being tested here.
add_library(depIfaceOnly SHARED EXCLUDE_FROM_ALL depIfaceOnly.cpp)
generate_export_header(depIfaceOnly)
-set_property(TARGET depB APPEND PROPERTY LINK_INTERFACE_LIBRARIES depIfaceOnly)
+set_property(TARGET depB APPEND PROPERTY INTERFACE_LINK_LIBRARIES depIfaceOnly)
add_library(depD SHARED depD.cpp)
generate_export_header(depD)
set_property(TARGET depD APPEND PROPERTY
- LINK_INTERFACE_LIBRARIES
+ INTERFACE_LINK_LIBRARIES
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:depA>
)
@@ -151,7 +148,7 @@ add_subdirectory(SubDirB)
target_link_libraries(SubDirB TopDirImported)
add_subdirectory(SubDirC)
target_link_libraries(SubDirC PRIVATE SubDirC2)
-target_link_libraries(TopDir SubDirC)
+target_link_libraries(TopDir PRIVATE SubDirC)
add_library(TopDirImported IMPORTED INTERFACE)
target_compile_definitions(TopDirImported INTERFACE DEF_TopDirImported)
cmake_policy(POP)
@@ -160,7 +157,7 @@ cmake_policy(POP)
# Test $<COMPILE_ONLY:> genex.
cmake_policy(SET CMP0099 NEW)
add_library(dont_link_too SHARED compile_only.cpp)
-target_compile_definitions(dont_link_too PUBLIC USE_EXAMPLE)
+target_compile_definitions(dont_link_too PUBLIC USE_EXAMPLE PRIVATE HAVE_FUNCTION)
target_link_options(dont_link_too INTERFACE invalid_link_option)
target_link_libraries(dont_link_too INTERFACE invalid_link_library)
@@ -171,3 +168,15 @@ add_library(uses_compile_only_genex_static STATIC compile_only.cpp)
target_link_libraries(uses_compile_only_genex_static PRIVATE $<COMPILE_ONLY:dont_link_too>)
add_executable(uses_via_static_linking main.cxx)
target_link_libraries(uses_via_static_linking PRIVATE uses_compile_only_genex_static)
+
+add_library(uses_compile_only_genex_obj SHARED compile_only.cpp)
+target_compile_definitions(uses_compile_only_genex_obj PRIVATE HAVE_FUNCTION)
+target_link_libraries(uses_compile_only_genex_obj PRIVATE $<COMPILE_ONLY:dont_link_too>)
+
+cmake_policy(SET CMP0131 NEW)
+add_library(only_link_too OBJECT link_only.cpp)
+target_compile_options(only_link_too INTERFACE INVALID_COMPILER_FLAG_ARRRRGH)
+
+add_executable(uses_link_only_genex_obj compile_only.cpp)
+target_compile_definitions(uses_link_only_genex_obj PUBLIC USE_EXAMPLE)
+target_link_libraries(uses_link_only_genex_obj PRIVATE $<LINK_ONLY:only_link_too>)
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
index ebade02..59e94ae 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0028 NEW)
-
include(GenerateExportHeader)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h
index 2bc04ee..69a730e 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h
@@ -3,7 +3,7 @@ struct
#ifdef _WIN32
__declspec(dllexport)
#endif
- OnlyPlainLib1
+ OnlyPlainLib1
{
OnlyPlainLib1();
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h
index 6f18d20..e144b63 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h
@@ -4,4 +4,5 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
- OnlyPlainLib1 onlyPlainLib2();
+OnlyPlainLib1
+onlyPlainLib2();
diff --git a/Tests/CMakeCommands/target_link_libraries/compile_only.cpp b/Tests/CMakeCommands/target_link_libraries/compile_only.cpp
index 7519bd0..b4e3a43 100644
--- a/Tests/CMakeCommands/target_link_libraries/compile_only.cpp
+++ b/Tests/CMakeCommands/target_link_libraries/compile_only.cpp
@@ -3,6 +3,13 @@
# error "Missing propagated define"
#endif
+#ifdef HAVE_FUNCTION
+int non_duplicate_function()
+{
+ return 42;
+}
+#endif
+
// Solaris needs non-empty content so ensure
// we have at least one symbol
int Solaris_requires_a_symbol_here = 0;
diff --git a/Tests/FindPackageTest/FindPackageTest.cxx b/Tests/CMakeCommands/target_link_libraries/link_only.cpp
index f8b643a..f8b643a 100644
--- a/Tests/FindPackageTest/FindPackageTest.cxx
+++ b/Tests/CMakeCommands/target_link_libraries/link_only.cpp
diff --git a/Tests/CMakeCopyright.cmake b/Tests/CMakeCopyright.cmake
index a7201e9..2c3c95d 100644
--- a/Tests/CMakeCopyright.cmake
+++ b/Tests/CMakeCopyright.cmake
@@ -1,21 +1,21 @@
if(CMAKE_VERSION MATCHES "\\.(20[0-9][0-9])[0-9][0-9][0-9][0-9](-|$)")
set(version_year "${CMAKE_MATCH_1}")
set(copyright_line_regex "^Copyright 2000-(20[0-9][0-9]) Kitware")
- file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../Copyright.txt" copyright_line
+ file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../LICENSE.rst" copyright_line
LIMIT_COUNT 1 REGEX "${copyright_line_regex}")
if(copyright_line MATCHES "${copyright_line_regex}")
set(copyright_year "${CMAKE_MATCH_1}")
if(copyright_year LESS version_year)
- message(FATAL_ERROR "Copyright.txt contains\n"
+ message(FATAL_ERROR "LICENSE.rst contains\n"
" ${copyright_line}\n"
"but the current version year is ${version_year}.")
else()
- message(STATUS "PASSED: Copyright.txt contains\n"
+ message(STATUS "PASSED: LICENSE.rst contains\n"
" ${copyright_line}\n"
"and the current version year is ${version_year}.")
endif()
else()
- message(FATAL_ERROR "Copyright.txt has no Copyright line of expected format!")
+ message(FATAL_ERROR "LICENSE.rst has no Copyright line of expected format!")
endif()
else()
message(STATUS "SKIPPED: CMAKE_VERSION does not know the year: ${CMAKE_VERSION}")
diff --git a/Tests/CMakeGUI/CMakeGUITest.cxx b/Tests/CMakeGUI/CMakeGUITest.cxx
index 2b5d973..69855e7 100644
--- a/Tests/CMakeGUI/CMakeGUITest.cxx
+++ b/Tests/CMakeGUI/CMakeGUITest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "CMakeGUITest.h"
#include "QCMake.h"
@@ -210,7 +210,7 @@ void CMakeGUITest::presetArg()
}
namespace {
-QCMakePropertyList makePresetProperties(const QString& name)
+QCMakePropertyList makePresetProperties(QString const& name)
{
return QCMakePropertyList{
QCMakeProperty{
@@ -313,7 +313,7 @@ void CMakeGUITest::presetArg_data()
}
namespace {
-void writePresets(const QString& buildDir, const QStringList& names)
+void writePresets(QString const& buildDir, QStringList const& names)
{
QJsonArray presets{
QJsonObject{
diff --git a/Tests/CMakeGUI/CMakeGUITest.h b/Tests/CMakeGUI/CMakeGUITest.h
index e6293a4..829e608 100644
--- a/Tests/CMakeGUI/CMakeGUITest.h
+++ b/Tests/CMakeGUI/CMakeGUITest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <QObject>
diff --git a/Tests/CMakeGUI/CatchShow.cxx b/Tests/CMakeGUI/CatchShow.cxx
index aee2d9d..e958126 100644
--- a/Tests/CMakeGUI/CatchShow.cxx
+++ b/Tests/CMakeGUI/CatchShow.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "CatchShow.h"
#include <QCoreApplication>
diff --git a/Tests/CMakeGUI/CatchShow.h b/Tests/CMakeGUI/CatchShow.h
index 7d370b6..ca70e4e 100644
--- a/Tests/CMakeGUI/CatchShow.h
+++ b/Tests/CMakeGUI/CatchShow.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <functional>
diff --git a/Tests/CMakeGUI/CatchShowTest.cxx b/Tests/CMakeGUI/CatchShowTest.cxx
index acea8ea..0cf7dac 100644
--- a/Tests/CMakeGUI/CatchShowTest.cxx
+++ b/Tests/CMakeGUI/CatchShowTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "CatchShowTest.h"
#include <QMessageBox>
diff --git a/Tests/CMakeGUI/CatchShowTest.h b/Tests/CMakeGUI/CatchShowTest.h
index 6da2163..3e85d6b 100644
--- a/Tests/CMakeGUI/CatchShowTest.h
+++ b/Tests/CMakeGUI/CatchShowTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <QObject>
diff --git a/Tests/CMakeGUI/EnvironmentDialogTest.cxx b/Tests/CMakeGUI/EnvironmentDialogTest.cxx
index 9ec4996..26fca7d 100644
--- a/Tests/CMakeGUI/EnvironmentDialogTest.cxx
+++ b/Tests/CMakeGUI/EnvironmentDialogTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "EnvironmentDialogTest.h"
#include <QDialogButtonBox>
diff --git a/Tests/CMakeGUI/EnvironmentDialogTest.h b/Tests/CMakeGUI/EnvironmentDialogTest.h
index bcba2c5..0548115 100644
--- a/Tests/CMakeGUI/EnvironmentDialogTest.h
+++ b/Tests/CMakeGUI/EnvironmentDialogTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <QObject>
diff --git a/Tests/CMakeGUI/QCMakeCacheModelTest.cxx b/Tests/CMakeGUI/QCMakeCacheModelTest.cxx
index f9bc6ae..4bf6fa5 100644
--- a/Tests/CMakeGUI/QCMakeCacheModelTest.cxx
+++ b/Tests/CMakeGUI/QCMakeCacheModelTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakeCacheModelTest.h"
#include <algorithm>
@@ -10,7 +10,7 @@
namespace {
QCMakeProperty makeProperty(
- const QString& name, const QString& value,
+ QString const& name, QString const& value,
QCMakeProperty::PropertyType type = QCMakeProperty::STRING,
bool advanced = false)
{
diff --git a/Tests/CMakeGUI/QCMakeCacheModelTest.h b/Tests/CMakeGUI/QCMakeCacheModelTest.h
index e88db94..c014afe 100644
--- a/Tests/CMakeGUI/QCMakeCacheModelTest.h
+++ b/Tests/CMakeGUI/QCMakeCacheModelTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMakeCacheView.h"
diff --git a/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx b/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx
index a95d008..84fac16 100644
--- a/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakePresetComboBoxTest.h"
#include <QtTest>
diff --git a/Tests/CMakeGUI/QCMakePresetComboBoxTest.h b/Tests/CMakeGUI/QCMakePresetComboBoxTest.h
index 433adbb..d1e0770 100644
--- a/Tests/CMakeGUI/QCMakePresetComboBoxTest.h
+++ b/Tests/CMakeGUI/QCMakePresetComboBoxTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMakePresetComboBox.h"
diff --git a/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx b/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
index 97dbb30..5d5401b 100644
--- a/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakePresetItemModelTest.h"
#include <utility>
diff --git a/Tests/CMakeGUI/QCMakePresetItemModelTest.h b/Tests/CMakeGUI/QCMakePresetItemModelTest.h
index ff6efae..ef6c7337 100644
--- a/Tests/CMakeGUI/QCMakePresetItemModelTest.h
+++ b/Tests/CMakeGUI/QCMakePresetItemModelTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMakePresetItemModel.h"
diff --git a/Tests/CMakeGUI/QCMakePresetTest.cxx b/Tests/CMakeGUI/QCMakePresetTest.cxx
index 2081055..4856488 100644
--- a/Tests/CMakeGUI/QCMakePresetTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetTest.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "QCMakePresetTest.h"
#include <utility>
diff --git a/Tests/CMakeGUI/QCMakePresetTest.h b/Tests/CMakeGUI/QCMakePresetTest.h
index 5eac88d..650dfc4 100644
--- a/Tests/CMakeGUI/QCMakePresetTest.h
+++ b/Tests/CMakeGUI/QCMakePresetTest.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "QCMakePreset.h"
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 5b189e7..19794b8 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -16,12 +16,14 @@ set(CMakeLib_TESTS
testCTestResourceSpec.cxx
testCTestResourceGroups.cxx
testDebug.cxx
+ testDocumentationFormatter.cxx
testGccDepfileReader.cxx
testGeneratedFileStream.cxx
testJSONHelpers.cxx
testRST.cxx
testRange.cxx
testOptional.cxx
+ testPathResolver.cxx
testString.cxx
testStringAlgorithms.cxx
testSystemTools.cxx
@@ -31,6 +33,7 @@ set(CMakeLib_TESTS
testFindPackageCommand.cxx
testUVHandlePtr.cxx
testUVJobServerClient.cxx
+ testUVPatches.cxx
testUVProcessChain.cxx
testUVRAII.cxx
testUVStreambuf.cxx
@@ -109,10 +112,20 @@ if(CMake_ENABLE_DEBUGGER)
add_executable(testDebuggerNamedPipe testDebuggerNamedPipe.cxx)
target_link_libraries(testDebuggerNamedPipe PRIVATE CMakeLib)
set(testDebuggerNamedPipe_Project_ARGS
- "$<TARGET_FILE:cmake>" ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample ${CMAKE_CURRENT_BINARY_DIR}/DebuggerSample
+ "$<TARGET_FILE:cmake>" -S ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample -B ${CMAKE_CURRENT_BINARY_DIR}/DebuggerSample
+ --fresh -G ${CMAKE_GENERATOR}
)
+ if(CMAKE_GENERATOR_PLATFORM)
+ list(APPEND testDebuggerNamedPipe_Project_ARGS -A "${CMAKE_GENERATOR_PLATFORM}")
+ endif()
+ if(CMAKE_GENERATOR_TOOLSET)
+ list(APPEND testDebuggerNamedPipe_Project_ARGS -T "${CMAKE_GENERATOR_TOOLSET}")
+ endif()
+ if(CMAKE_GENERATOR_INSTANCE)
+ list(APPEND testDebuggerNamedPipe_Project_ARGS "-DCMAKE_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}")
+ endif()
set(testDebuggerNamedPipe_Script_ARGS
- "$<TARGET_FILE:cmake>" ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample/script.cmake
+ "$<TARGET_FILE:cmake>" -P ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample/script.cmake
)
foreach(case Project Script)
add_test(NAME CMakeLib.testDebuggerNamedPipe-${case} COMMAND testDebuggerNamedPipe ${testDebuggerNamedPipe_${case}_ARGS})
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 0585774..c46ab91 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -40,7 +40,7 @@ public:
this->ParseTranslationUnits();
}
- const TranslationUnitsType& GetTranslationUnits()
+ TranslationUnitsType const& GetTranslationUnits()
{
return this->TranslationUnits;
}
@@ -99,7 +99,7 @@ private:
return false;
}
- void ExpectOrDie(char c, const std::string& message)
+ void ExpectOrDie(char c, std::string const& message)
{
if (!this->Expect(c)) {
this->ErrorExit(std::string("'") + c + "' expected " + message + ".");
@@ -121,7 +121,7 @@ private:
}
}
- void ErrorExit(const std::string& message)
+ void ErrorExit(std::string const& message)
{
std::cout << "ERROR: " << message;
exit(1);
diff --git a/Tests/CMakeLib/testAffinity.cxx b/Tests/CMakeLib/testAffinity.cxx
index 6c68570..18bd8a9 100644
--- a/Tests/CMakeLib/testAffinity.cxx
+++ b/Tests/CMakeLib/testAffinity.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstddef>
#include <iostream>
#include <set>
diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx
index d4e2bd2..1bdad59 100644
--- a/Tests/CMakeLib/testArgumentParser.cxx
+++ b/Tests/CMakeLib/testArgumentParser.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <map>
#include <string>
diff --git a/Tests/CMakeLib/testAssert.cxx b/Tests/CMakeLib/testAssert.cxx
index 3d2e839..98a729e 100644
--- a/Tests/CMakeLib/testAssert.cxx
+++ b/Tests/CMakeLib/testAssert.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <string>
@@ -35,12 +35,12 @@ bool testASSERT_EQUALFail()
WrapFailureInBlockFixture fx;
static_cast<void>(fx);
- auto fail_int = [](const int unexpected) -> bool {
+ auto fail_int = [](int const unexpected) -> bool {
ASSERT_EQUAL(unexpected, 42);
return true;
};
- auto fail_string = [](const std::string& unexpected) -> bool {
+ auto fail_string = [](std::string const& unexpected) -> bool {
ASSERT_EQUAL(unexpected, "Hello Africa!");
return true;
};
diff --git a/Tests/CMakeLib/testCMExtEnumSet.cxx b/Tests/CMakeLib/testCMExtEnumSet.cxx
index ecf6d11..218b837 100644
--- a/Tests/CMakeLib/testCMExtEnumSet.cxx
+++ b/Tests/CMakeLib/testCMExtEnumSet.cxx
@@ -3,7 +3,9 @@
#include <initializer_list>
#include <iostream>
#include <iterator>
+#include <limits>
#include <set>
+#include <type_traits>
#include <utility>
#include <cmext/enum_set>
@@ -16,25 +18,55 @@ void testDeclaration()
{
std::cout << "testDeclaration()" << std::endl;
- enum class Test : std::uint8_t
{
- A,
- B,
- C,
- D
- };
- cm::enum_set<Test> testSet1;
- cm::enum_set<Test> testSet2{ Test::A, Test::C };
- cm::enum_set<Test> testSet3 = testSet2;
+ enum class Test : std::uint8_t
+ {
+ A,
+ B,
+ C,
+ D
+ };
+ cm::enum_set<Test> testSet1;
+ cm::enum_set<Test> testSet2 = Test::A;
+ cm::enum_set<Test> testSet3 = Test::A | Test::C;
+ cm::enum_set<Test> testSet4 = Test::A + Test::C;
+ cm::enum_set<Test> testSet5{ Test::A, Test::C };
+ cm::enum_set<Test> testSet6 = testSet3;
- if (!testSet1.empty()) {
- ++failed;
- }
- if (testSet2.size() != 2) {
- ++failed;
+ if (!testSet1.empty()) {
+ ++failed;
+ }
+ if (testSet2.size() != 1) {
+ ++failed;
+ }
+ if (testSet3.size() != 2 || testSet4.size() != 2 || testSet5.size() != 2 ||
+ testSet6.size() != 2) {
+ ++failed;
+ }
+ if (testSet3 != testSet4 || testSet4 != testSet5 || testSet5 != testSet6) {
+ ++failed;
+ }
}
- if (testSet3.size() != 2) {
- ++failed;
+ {
+ enum class Test : std::uint8_t
+ {
+ A,
+ B,
+ C,
+ D
+ };
+ cm::enum_set<Test> testSet1;
+ cm::enum_set<Test, 4> testSet2;
+
+ if (testSet1.size() != 0 ||
+ testSet1.max_size() !=
+ std::numeric_limits<
+ typename std::underlying_type<Test>::type>::digits) {
+ ++failed;
+ }
+ if (testSet2.size() != 0 || testSet2.max_size() != 4) {
+ ++failed;
+ }
}
}
@@ -49,7 +81,7 @@ void testIteration()
C,
D
};
- cm::enum_set<Test> testSet{ Test::A, Test::C, Test::B };
+ cm::enum_set<Test, 4> testSet{ Test::A, Test::C, Test::B };
if (testSet.size() != 3) {
++failed;
@@ -193,12 +225,176 @@ void testEdition()
}
{
cm::enum_set<Test> testSet1;
- cm::enum_set<Test> testSet2{ Test::A, Test::C, Test::B };
+ auto testSet2 = Test::A + Test::C + Test::B;
+ testSet1.set({ Test::A, Test::C, Test::B });
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.reset();
+ testSet1.set(Test::A | Test::C | Test::B);
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.reset();
+ testSet1.set(Test::A + Test::C + Test::B);
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.reset();
testSet1 = { Test::A, Test::C, Test::B };
if (testSet1.size() != 3 || testSet1 != testSet2) {
++failed;
}
+ testSet1.reset();
+ testSet1 = Test::A | Test::C | Test::B;
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.clear();
+ testSet1 = Test::A + Test::C + Test::B;
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.clear();
+ testSet1 |= Test::A;
+ testSet1 |= Test::C | Test::B;
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ }
+ {
+ using ESet = cm::enum_set<Test, 5>;
+ ESet testSet1;
+ ESet testSet2{ Test::A, Test::C, Test::B };
+
+ testSet1.set();
+ if (testSet1.size() != 5 || testSet1.size() != testSet1.max_size()) {
+ ++failed;
+ }
+ testSet1.flip({ Test::D, Test::E });
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.flip(Test::D | Test::E);
+ testSet2 += Test::D + Test::E;
+ if (testSet1.size() != 5 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1.flip(Test::E);
+ testSet2 -= Test::E;
+ if (testSet1.size() != 4 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1 ^= { Test::A, Test::B, Test::E, Test::D };
+ testSet2 = { Test::C, Test::E };
+ if (testSet1.size() != 2 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet1 ^= { Test::A, Test::B, Test::E };
+ testSet2 = { Test::A, Test::B, Test::C };
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ testSet2 = Test::A | Test::B | Test::C;
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ }
+}
+
+void testChecks()
+{
+ std::cout << "testChecks()" << std::endl;
+
+ {
+ enum class Test : std::uint8_t
+ {
+ A,
+ B,
+ C,
+ D
+ };
+
+ cm::enum_set<Test> testSet;
+
+ if (!testSet.empty()) {
+ ++failed;
+ }
+
+ testSet = Test::A;
+ if (testSet.empty()) {
+ ++failed;
+ }
+ if (!testSet) {
+ ++failed;
+ }
+ if (!testSet.contains(Test::A)) {
+ ++failed;
+ }
+ if (testSet.find(Test::A) == testSet.end()) {
+ ++failed;
+ }
+ if (testSet.find(Test::C) != testSet.end()) {
+ ++failed;
+ }
+ }
+ {
+ enum class Test : std::uint8_t
+ {
+ A,
+ B,
+ C,
+ D
+ };
+
+ cm::enum_set<Test, 4> testSet;
+
+ if (!testSet.none()) {
+ ++failed;
+ }
+ if (testSet.any() || testSet.all()) {
+ ++failed;
+ }
+
+ testSet = Test::A;
+ if (!testSet.any() || testSet.none() || testSet.all()) {
+ ++failed;
+ }
+
+ testSet.set();
+ if (!testSet.all() || !testSet.any() || testSet.none()) {
+ ++failed;
+ }
+ }
+ {
+ enum class Test : std::uint8_t
+ {
+ A,
+ B,
+ C,
+ D
+ };
+
+ cm::enum_set<Test> testSet1;
+ cm::enum_set<Test> testSet2{ Test::A, Test::C };
+
+ if (!testSet1.none_of(testSet2) || testSet1.any_of(testSet2) ||
+ testSet1.all_of(testSet2)) {
+ ++failed;
+ }
+
+ testSet1 = Test::A | Test::D;
+ if (testSet1.none_of(testSet2) || !testSet1.any_of(testSet2) ||
+ testSet1.all_of(testSet2)) {
+ ++failed;
+ }
+
+ testSet1 |= Test::C;
+ if (testSet1.none_of(testSet2) || !testSet1.any_of(testSet2) ||
+ !testSet1.all_of(testSet2)) {
+ ++failed;
+ }
}
}
}
@@ -208,6 +404,7 @@ int testCMExtEnumSet(int /*unused*/, char* /*unused*/[])
testDeclaration();
testIteration();
testEdition();
+ testChecks();
return failed;
}
diff --git a/Tests/CMakeLib/testCMFilesystemPath.cxx b/Tests/CMakeLib/testCMFilesystemPath.cxx
index 66d2c18..a8d3be8 100644
--- a/Tests/CMakeLib/testCMFilesystemPath.cxx
+++ b/Tests/CMakeLib/testCMFilesystemPath.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <algorithm>
#include <sstream>
@@ -874,7 +874,7 @@ bool testIterators()
result = false;
}
res.clear();
- for (const auto& e : p) {
+ for (auto const& e : p) {
res.push_back(e);
}
if (res != ref) {
diff --git a/Tests/CMakeLib/testCMakePath.cxx b/Tests/CMakeLib/testCMakePath.cxx
index d2f6661..1b7ee6c 100644
--- a/Tests/CMakeLib/testCMakePath.cxx
+++ b/Tests/CMakeLib/testCMakePath.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx
index 038ceea..1c0cf13 100644
--- a/Tests/CMakeLib/testCTestBinPacker.cxx
+++ b/Tests/CMakeLib/testCTestBinPacker.cxx
@@ -16,8 +16,7 @@ struct ExpectedPackResult
std::vector<cmCTestBinPackerAllocation> ExpectedBlockAllocations;
};
-static const std::vector<ExpectedPackResult> expectedResults
-{
+static std::vector<ExpectedPackResult> const expectedResults{
/* clang-format off */
{
{ 2, 2, 2, 2 },
@@ -215,7 +214,7 @@ struct AllocationComparison
bool Equal;
};
-static const std::vector<AllocationComparison> comparisons{
+static std::vector<AllocationComparison> const comparisons{
/* clang-format off */
{ { 0, 1, "0" }, { 0, 1, "0" }, true },
{ { 0, 1, "0" }, { 1, 1, "0" }, false },
@@ -224,7 +223,7 @@ static const std::vector<AllocationComparison> comparisons{
/* clang-format on */
};
-static bool TestExpectedPackResult(const ExpectedPackResult& expected)
+static bool TestExpectedPackResult(ExpectedPackResult const& expected)
{
std::vector<cmCTestBinPackerAllocation> roundRobinAllocations;
roundRobinAllocations.reserve(expected.SlotsNeeded.size());
diff --git a/Tests/CMakeLib/testCTestResourceAllocator.cxx b/Tests/CMakeLib/testCTestResourceAllocator.cxx
index 3a2e524..78adeb9 100644
--- a/Tests/CMakeLib/testCTestResourceAllocator.cxx
+++ b/Tests/CMakeLib/testCTestResourceAllocator.cxx
@@ -7,14 +7,12 @@
#include "cmCTestResourceSpec.h"
#include "cmJSONState.h"
-static const cmCTestResourceSpec spec{
- { {
- /* clang-format off */
+static cmCTestResourceSpec const spec{ { {
+ /* clang-format off */
{ "gpus", { { "0", 4 }, { "1", 8 }, { "2", 0 }, { "3", 8 } }, },
- /* clang-format on */
- } },
- cmJSONState()
-};
+ /* clang-format on */
+ } },
+ cmJSONState() };
static bool testInitializeFromResourceSpec()
{
@@ -23,18 +21,18 @@ static bool testInitializeFromResourceSpec()
cmCTestResourceAllocator allocator;
allocator.InitializeFromResourceSpec(spec);
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 0 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.GetResources() != expected) {
std::cout << "GetResources() did not return expected value\n";
retval = false;
@@ -50,18 +48,18 @@ static bool testAllocateResource()
cmCTestResourceAllocator allocator;
allocator.InitializeFromResourceSpec(spec);
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected1{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected1{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 2 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (!allocator.AllocateResource("gpus", "0", 2)) {
std::cout
<< "AllocateResource(\"gpus\", \"0\", 2) returned false, should be "
@@ -73,18 +71,18 @@ static bool testAllocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected2{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected2{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 4 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (!allocator.AllocateResource("gpus", "0", 2)) {
std::cout
<< "AllocateResource(\"gpus\", \"0\", 2) returned false, should be "
@@ -96,18 +94,18 @@ static bool testAllocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected3{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected3{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 4 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.AllocateResource("gpus", "0", 1)) {
std::cout
<< "AllocateResource(\"gpus\", \"0\", 1) returned true, should be "
@@ -119,18 +117,18 @@ static bool testAllocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected4{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected4{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 4 } },
{ "1", { 8, 7 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (!allocator.AllocateResource("gpus", "1", 7)) {
std::cout
<< "AllocateResource(\"gpus\", \"1\", 7) returned false, should be "
@@ -148,18 +146,18 @@ static bool testAllocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected5{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected5{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 4 } },
{ "1", { 8, 7 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.AllocateResource("gpus", "2", 1)) {
std::cout
<< "AllocateResource(\"gpus\", \"2\", 1) returned true, should be "
@@ -171,18 +169,18 @@ static bool testAllocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected6{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected6{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 4 } },
{ "1", { 8, 7 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.AllocateResource("gpus", "4", 1)) {
std::cout
<< "AllocateResource(\"gpus\", \"4\", 1) returned true, should be "
@@ -194,18 +192,18 @@ static bool testAllocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected7{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected7{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 4 } },
{ "1", { 8, 7 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.AllocateResource("threads", "0", 1)) {
std::cout
<< "AllocateResource(\"threads\", \"0\", 1) returned true, should be"
@@ -227,18 +225,18 @@ static bool testDeallocateResource()
cmCTestResourceAllocator allocator;
allocator.InitializeFromResourceSpec(spec);
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected1{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected1{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 1 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (!allocator.AllocateResource("gpus", "0", 2)) {
std::cout
<< "AllocateResource(\"gpus\", \"0\", 2) returned false, should be "
@@ -256,18 +254,18 @@ static bool testDeallocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected2{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected2{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 1 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.DeallocateResource("gpus", "0", 2)) {
std::cout
<< "DeallocateResource(\"gpus\", \"0\", 2) returned true, should be"
@@ -279,18 +277,18 @@ static bool testDeallocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected3{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected3{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 0 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (!allocator.DeallocateResource("gpus", "0", 1)) {
std::cout
<< "DeallocateResource(\"gpus\", \"0\", 1) returned false, should be"
@@ -302,18 +300,18 @@ static bool testDeallocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected4{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected4{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 0 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.DeallocateResource("gpus", "0", 1)) {
std::cout
<< "DeallocateResource(\"gpus\", \"0\", 1) returned true, should be"
@@ -325,18 +323,18 @@ static bool testDeallocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected5{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected5{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 0 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.DeallocateResource("gpus", "4", 1)) {
std::cout
<< "DeallocateResource(\"gpus\", \"4\", 1) returned true, should be"
@@ -348,18 +346,18 @@ static bool testDeallocateResource()
retval = false;
}
- static const std::map<
- std::string, std::map<std::string, cmCTestResourceAllocator::Resource>>
- expected6{
- /* clang-format off */
+ static std::map<
+ std::string,
+ std::map<std::string, cmCTestResourceAllocator::Resource>> const expected6{
+ /* clang-format off */
{ "gpus", {
{ "0", { 4, 0 } },
{ "1", { 8, 0 } },
{ "2", { 0, 0 } },
{ "3", { 8, 0 } },
} },
- /* clang-format on */
- };
+ /* clang-format on */
+ };
if (allocator.DeallocateResource("threads", "0", 1)) {
std::cout
<< "DeallocateResource(\"threads\", \"0\", 1) returned true, should be"
@@ -378,21 +376,21 @@ static bool testResourceFree()
{
bool retval = true;
- const cmCTestResourceAllocator::Resource r1{ 5, 0 };
+ cmCTestResourceAllocator::Resource const r1{ 5, 0 };
if (r1.Free() != 5) {
std::cout << "cmCTestResourceAllocator::Resource::Free() did not return "
"expected value for { 5, 0 }\n";
retval = false;
}
- const cmCTestResourceAllocator::Resource r2{ 3, 2 };
+ cmCTestResourceAllocator::Resource const r2{ 3, 2 };
if (r2.Free() != 1) {
std::cout << "cmCTestResourceAllocator::Resource::Free() did not return "
"expected value for { 3, 2 }\n";
retval = false;
}
- const cmCTestResourceAllocator::Resource r3{ 4, 4 };
+ cmCTestResourceAllocator::Resource const r3{ 4, 4 };
if (r3.Free() != 0) {
std::cout << "cmCTestResourceAllocator::Resource::Free() did not return "
"expected value for { 4, 4 }\n";
diff --git a/Tests/CMakeLib/testCTestResourceGroups.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx
index b68301f..acdb50e 100644
--- a/Tests/CMakeLib/testCTestResourceGroups.cxx
+++ b/Tests/CMakeLib/testCTestResourceGroups.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <iostream>
#include <string>
@@ -15,7 +15,7 @@ struct ExpectedParseResult
ExpectedValue;
};
-static const std::vector<ExpectedParseResult> expectedResults{
+static std::vector<ExpectedParseResult> const expectedResults{
/* clang-format off */
{ "threads:2", true, {
{ { "threads", 2, 1 } },
@@ -104,7 +104,7 @@ static const std::vector<ExpectedParseResult> expectedResults{
/* clang-format on */
};
-static bool TestExpectedParseResult(const ExpectedParseResult& expected)
+static bool TestExpectedParseResult(ExpectedParseResult const& expected)
{
std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>
result;
diff --git a/Tests/CMakeLib/testCTestResourceSpec.cxx b/Tests/CMakeLib/testCTestResourceSpec.cxx
index 4a0021f..dae810f 100644
--- a/Tests/CMakeLib/testCTestResourceSpec.cxx
+++ b/Tests/CMakeLib/testCTestResourceSpec.cxx
@@ -12,7 +12,7 @@ struct ExpectedSpec
cmCTestResourceSpec Expected;
};
-static const std::vector<ExpectedSpec> expectedResourceSpecs = {
+static std::vector<ExpectedSpec> const expectedResourceSpecs = {
{ "spec1.json",
true,
{ { {
@@ -62,8 +62,8 @@ static const std::vector<ExpectedSpec> expectedResourceSpecs = {
{ "noexist.json", false, {} },
};
-static bool testSpec(const std::string& path, bool expectedResult,
- const cmCTestResourceSpec& expected)
+static bool testSpec(std::string const& path, bool expectedResult,
+ cmCTestResourceSpec const& expected)
{
cmCTestResourceSpec actual;
auto result = actual.ReadFromJSONFile(path);
diff --git a/Tests/CMakeLib/testCommon.h b/Tests/CMakeLib/testCommon.h
index de4a689..b7379d5 100644
--- a/Tests/CMakeLib/testCommon.h
+++ b/Tests/CMakeLib/testCommon.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <functional> // IWYU pragma: export
@@ -30,7 +30,7 @@
namespace {
inline int runTests(std::initializer_list<std::function<bool()>> const& tests,
- const bool fail_fast = true)
+ bool const fail_fast = true)
{
int result = 0;
for (auto const& test : tests) {
@@ -40,10 +40,9 @@ inline int runTests(std::initializer_list<std::function<bool()>> const& tests,
break;
}
}
- std::cout << '.';
}
- if (!result) {
- std::cout << " Passed\n";
+ if (result == 0) {
+ std::cout << "Passed\n";
}
return result;
}
diff --git a/Tests/CMakeLib/testConfig.h.in b/Tests/CMakeLib/testConfig.h.in
index f57f97e..15bc12f 100644
--- a/Tests/CMakeLib/testConfig.h.in
+++ b/Tests/CMakeLib/testConfig.h.in
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
diff --git a/Tests/CMakeLib/testDebugger.h b/Tests/CMakeLib/testDebugger.h
index df67278..c27086d 100644
--- a/Tests/CMakeLib/testDebugger.h
+++ b/Tests/CMakeLib/testDebugger.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include <memory>
@@ -72,8 +72,8 @@ public:
Client->bind(server2client, client2server);
Debugger->bind(client2server, server2client);
}
- std::vector<cmListFileFunction> CreateListFileFunctions(const char* str,
- const char* filename)
+ std::vector<cmListFileFunction> CreateListFileFunctions(char const* str,
+ char const* filename)
{
cmMessenger messenger;
cmListFileBacktrace backtrace;
diff --git a/Tests/CMakeLib/testDebuggerAdapter.cxx b/Tests/CMakeLib/testDebuggerAdapter.cxx
index a055cb7..c5ad8b3 100644
--- a/Tests/CMakeLib/testDebuggerAdapter.cxx
+++ b/Tests/CMakeLib/testDebuggerAdapter.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <chrono>
#include <cstdio>
@@ -83,19 +83,19 @@ bool runTest(std::function<bool(dap::Session&)> onThreadExitedEvent)
auto connection = std::make_shared<DebuggerLocalConnection>();
std::unique_ptr<dap::Session> client = dap::Session::create();
- client->registerHandler([&](const dap::InitializedEvent& e) {
+ client->registerHandler([&](dap::InitializedEvent const& e) {
(void)e;
initializedEventReceivedPromise.set_value(true);
});
- client->registerHandler([&](const dap::ExitedEvent& e) {
+ client->registerHandler([&](dap::ExitedEvent const& e) {
(void)e;
exitedEventReceivedPromise.set_value(true);
});
- client->registerHandler([&](const dap::TerminatedEvent& e) {
+ client->registerHandler([&](dap::TerminatedEvent const& e) {
(void)e;
terminatedEventReceivedPromise.set_value(true);
});
- client->registerHandler([&](const dap::ThreadEvent& e) {
+ client->registerHandler([&](dap::ThreadEvent const& e) {
if (e.reason == "started") {
threadStartedPromise.set_value(true);
} else if (e.reason == "exited") {
@@ -132,6 +132,7 @@ bool runTest(std::function<bool(dap::Session&)> onThreadExitedEvent)
ASSERT_TRUE(initializeResponse.response.supportsExceptionInfoRequest);
ASSERT_TRUE(
initializeResponse.response.exceptionBreakpointFilters.has_value());
+ ASSERT_TRUE(initializeResponse.response.supportsValueFormattingOptions);
dap::LaunchRequest launchRequest;
auto launchResponse = client->send(launchRequest).get();
diff --git a/Tests/CMakeLib/testDebuggerAdapterPipe.cxx b/Tests/CMakeLib/testDebuggerAdapterPipe.cxx
index 3647088..15dc32b 100644
--- a/Tests/CMakeLib/testDebuggerAdapterPipe.cxx
+++ b/Tests/CMakeLib/testDebuggerAdapterPipe.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <chrono>
#include <cstdio>
@@ -20,9 +20,10 @@
#include "cmVersionConfig.h"
#ifdef _WIN32
+# include "cmsys/SystemTools.hxx"
+
# include "cmCryptoHash.h"
# include "cmDebuggerWindowsPipeConnection.h"
-# include "cmSystemTools.h"
#else
# include "cmDebuggerPosixPipeConnection.h"
#endif
@@ -69,25 +70,25 @@ bool testProtocolWithPipes()
#ifdef _WIN32
std::string namedPipe = R"(\\.\pipe\LOCAL\CMakeDebuggerPipe2_)" +
cmCryptoHash(cmCryptoHash::AlgoSHA256)
- .HashString(cmSystemTools::GetCurrentWorkingDirectory());
+ .HashString(cmsys::SystemTools::GetCurrentWorkingDirectory());
#else
std::string namedPipe = "CMakeDebuggerPipe2";
#endif
std::unique_ptr<dap::Session> client = dap::Session::create();
- client->registerHandler([&](const dap::InitializedEvent& e) {
+ client->registerHandler([&](dap::InitializedEvent const& e) {
(void)e;
initializedEventReceivedPromise.set_value(true);
});
- client->registerHandler([&](const dap::ExitedEvent& e) {
+ client->registerHandler([&](dap::ExitedEvent const& e) {
(void)e;
exitedEventReceivedPromise.set_value(true);
});
- client->registerHandler([&](const dap::TerminatedEvent& e) {
+ client->registerHandler([&](dap::TerminatedEvent const& e) {
(void)e;
terminatedEventReceivedPromise.set_value(true);
});
- client->registerHandler([&](const dap::ThreadEvent& e) {
+ client->registerHandler([&](dap::ThreadEvent const& e) {
if (e.reason == "started") {
threadStartedPromise.set_value(true);
} else if (e.reason == "exited") {
@@ -113,7 +114,7 @@ bool testProtocolWithPipes()
ASSERT_TRUE(disconnectResponseReceivedFuture.wait_for(futureTimeout) ==
std::future_status::ready);
return 0;
- } catch (const std::runtime_error& error) {
+ } catch (std::runtime_error const& error) {
std::cerr << "Error: Failed to create debugger adapter.\n";
std::cerr << error.what() << "\n";
return -1;
diff --git a/Tests/CMakeLib/testDebuggerBreakpointManager.cxx b/Tests/CMakeLib/testDebuggerBreakpointManager.cxx
index 3973826..e1e86af 100644
--- a/Tests/CMakeLib/testDebuggerBreakpointManager.cxx
+++ b/Tests/CMakeLib/testDebuggerBreakpointManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <atomic>
#include <chrono>
@@ -65,7 +65,7 @@ static bool testHandleBreakpointRequestAfterFileIsLoaded()
// Arrange
DebuggerTestHelper helper;
std::atomic<bool> notExpectBreakpointEvents(true);
- helper.Client->registerHandler([&](const dap::BreakpointEvent&) {
+ helper.Client->registerHandler([&](dap::BreakpointEvent const&) {
notExpectBreakpointEvents.store(false);
});
@@ -128,7 +128,7 @@ static bool testSourceFileLoadedAfterHandleBreakpointRequest()
std::promise<void> allBreakpointEventsReceivedPromise;
std::future<void> allBreakpointEventsReceivedFuture =
allBreakpointEventsReceivedPromise.get_future();
- helper.Client->registerHandler([&](const dap::BreakpointEvent& event) {
+ helper.Client->registerHandler([&](dap::BreakpointEvent const& event) {
breakpointEvents.emplace_back(event);
if (--remainingBreakpointEvents == 0) {
allBreakpointEventsReceivedPromise.set_value();
diff --git a/Tests/CMakeLib/testDebuggerNamedPipe.cxx b/Tests/CMakeLib/testDebuggerNamedPipe.cxx
index 67e1372..69c8de2 100644
--- a/Tests/CMakeLib/testDebuggerNamedPipe.cxx
+++ b/Tests/CMakeLib/testDebuggerNamedPipe.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <chrono>
#include <cstdio>
@@ -12,6 +12,9 @@
#include <thread>
#include <vector>
+#include <cm/string_view>
+#include <cmext/string_view>
+
#include <cm3p/cppdap/io.h>
#include "cmsys/RegularExpression.hxx"
@@ -32,7 +35,7 @@ static void sendCommands(std::shared_ptr<dap::ReaderWriter> const& debugger,
int delayMs,
std::vector<std::string> const& initCommands)
{
- for (const auto& command : initCommands) {
+ for (auto const& command : initCommands) {
std::string contentLength = "Content-Length:";
contentLength += std::to_string(command.size()) + "\r\n\r\n";
debugger->write(contentLength.c_str(), contentLength.size());
@@ -60,22 +63,20 @@ static void sendCommands(std::shared_ptr<dap::ReaderWriter> const& debugger,
*/
int runTest(int argc, char* argv[])
{
- if (argc < 3) {
+ if (argc < 4) {
std::cout << "Usage:\n";
- std::cout << "\t(project mode) TestDebuggerNamedPipe <CMakePath> "
- "<SourceFolder> <OutputFolder>\n";
- std::cout << "\t(script mode) TestDebuggerNamedPipe <CMakePath> "
+ std::cout << "\t(project mode) TestDebuggerNamedPipe <CMakePath> -S "
+ "<SourceFolder> -B <OutputFolder> ...\n";
+ std::cout << "\t(script mode) TestDebuggerNamedPipe <CMakePath> -P "
"<ScriptPath>\n";
return 1;
}
- bool scriptMode = argc == 3;
-
#ifdef _WIN32
std::string namedPipe = R"(\\.\pipe\LOCAL\CMakeDebuggerPipe_)" +
- cmCryptoHash(cmCryptoHash::AlgoSHA256)
- .HashString(scriptMode ? argv[2] : argv[3]);
+ cmCryptoHash(cmCryptoHash::AlgoSHA256).HashString(argv[2]);
#else
+ bool const scriptMode = argv[2] == "-P"_s;
std::string namedPipe =
std::string("CMakeDebuggerPipe") + (scriptMode ? "Script" : "Project");
#endif
@@ -85,16 +86,7 @@ int runTest(int argc, char* argv[])
cmakeCommand.emplace_back("--debugger");
cmakeCommand.emplace_back("--debugger-pipe");
cmakeCommand.emplace_back(namedPipe);
-
- if (scriptMode) {
- cmakeCommand.emplace_back("-P");
- cmakeCommand.emplace_back(argv[2]);
- } else {
- cmakeCommand.emplace_back("-S");
- cmakeCommand.emplace_back(argv[2]);
- cmakeCommand.emplace_back("-B");
- cmakeCommand.emplace_back(argv[3]);
- }
+ cmakeCommand.insert(cmakeCommand.end(), argv + 2, argv + argc);
// Capture debugger response stream.
std::stringstream debuggerResponseStream;
@@ -194,7 +186,7 @@ int runTest(int argc, char* argv[])
R"("command" *: *"disconnect".*"success" *: *true.*"type" *: *"response")"
};
- for (const auto& regexString : expectedResponses) {
+ for (auto const& regexString : expectedResponses) {
cmsys::RegularExpression regex(regexString);
if (!regex.find(debuggerResponse)) {
std::cout << "Expected response not found: " << regexString << std::endl;
@@ -210,10 +202,10 @@ int main(int argc, char* argv[])
{
try {
return runTest(argc, argv);
- } catch (const std::exception& ex) {
+ } catch (std::exception const& ex) {
std::cout << "An exception occurred: " << ex.what() << std::endl;
return -1;
- } catch (const std::string& ex) {
+ } catch (std::string const& ex) {
std::cout << "An exception occurred: " << ex << std::endl;
return -1;
} catch (...) {
diff --git a/Tests/CMakeLib/testDebuggerThread.cxx b/Tests/CMakeLib/testDebuggerThread.cxx
index 3b7fe6e..cf47459 100644
--- a/Tests/CMakeLib/testDebuggerThread.cxx
+++ b/Tests/CMakeLib/testDebuggerThread.cxx
@@ -2,6 +2,7 @@
#include <string>
#include <vector>
+#include <cm3p/cppdap/optional.h>
#include <cm3p/cppdap/protocol.h>
#include <cm3p/cppdap/types.h>
@@ -10,21 +11,52 @@
#include "testCommon.h"
-static bool testStackFrameFunctionName()
+static bool testStackFrameFunctionName(
+ dap::optional<dap::StackFrameFormat> format, char const* expectedName)
{
auto thread = std::make_shared<cmDebugger::cmDebuggerThread>(0, "name");
- const auto* functionName = "function_name";
- auto arguments = std::vector<cmListFileArgument>{};
+ auto const* functionName = "function_name";
+ auto arguments = std::vector<cmListFileArgument>{ cmListFileArgument(
+ "arg", cmListFileArgument::Delimiter::Unquoted, 0) };
cmListFileFunction func(functionName, 10, 20, arguments);
thread->PushStackFrame(nullptr, "CMakeLists.txt", func);
- auto stackTrace = GetStackTraceResponse(thread);
+ auto stackTrace = GetStackTraceResponse(thread, format);
- ASSERT_TRUE(stackTrace.stackFrames[0].name == functionName);
+ ASSERT_TRUE(stackTrace.stackFrames[0].name == expectedName);
return true;
}
+bool testStackFrameNoFormatting()
+{
+ return testStackFrameFunctionName({}, "function_name");
+}
+
+bool testStackFrameFormatParameters()
+{
+ dap::StackFrameFormat format;
+ format.parameters = true;
+ return testStackFrameFunctionName(format, "function_name()");
+}
+
+bool testStackFrameFormatParameterValues()
+{
+ dap::StackFrameFormat format;
+ format.parameters = true;
+ format.parameterValues = true;
+ return testStackFrameFunctionName(format, "function_name(arg)");
+}
+
+bool testStackFrameFormatLine()
+{
+ dap::StackFrameFormat format;
+ format.line = true;
+ return testStackFrameFunctionName(format, "function_name Line: 10");
+}
+
int testDebuggerThread(int, char*[])
{
- return runTests({ testStackFrameFunctionName });
+ return runTests({ testStackFrameNoFormatting, testStackFrameFormatParameters,
+ testStackFrameFormatParameterValues,
+ testStackFrameFormatLine });
}
diff --git a/Tests/CMakeLib/testDebuggerVariables.cxx b/Tests/CMakeLib/testDebuggerVariables.cxx
index ca8bf39..03ceec5 100644
--- a/Tests/CMakeLib/testDebuggerVariables.cxx
+++ b/Tests/CMakeLib/testDebuggerVariables.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstdint>
#include <memory>
diff --git a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx
index 5fe1c63..7359231 100644
--- a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx
+++ b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <memory>
#include <set>
@@ -74,9 +74,9 @@ static bool testCreateFromPolicyMap()
std::make_shared<cmDebugger::cmDebuggerVariablesManager>();
cmPolicies::PolicyMap policyMap;
- policyMap.Set(cmPolicies::CMP0000, cmPolicies::NEW);
- policyMap.Set(cmPolicies::CMP0003, cmPolicies::WARN);
- policyMap.Set(cmPolicies::CMP0005, cmPolicies::OLD);
+ policyMap.Set(cmPolicies::CMP0178, cmPolicies::NEW);
+ policyMap.Set(cmPolicies::CMP0179, cmPolicies::WARN);
+ policyMap.Set(cmPolicies::CMP0180, cmPolicies::OLD);
auto vars = cmDebugger::cmDebuggerVariablesHelper::Create(
variablesManager, "Locals", true, policyMap);
@@ -84,9 +84,9 @@ static bool testCreateFromPolicyMap()
variablesManager->HandleVariablesRequest(
CreateVariablesRequest(vars->GetId()));
ASSERT_TRUE(variables.size() == 3);
- ASSERT_VARIABLE(variables[0], "CMP0000", "NEW", "string");
- ASSERT_VARIABLE(variables[1], "CMP0003", "WARN", "string");
- ASSERT_VARIABLE(variables[2], "CMP0005", "OLD", "string");
+ ASSERT_VARIABLE(variables[0], "CMP0178", "NEW", "string");
+ ASSERT_VARIABLE(variables[1], "CMP0179", "WARN", "string");
+ ASSERT_VARIABLE(variables[2], "CMP0180", "OLD", "string");
return true;
}
diff --git a/Tests/CMakeLib/testDebuggerVariablesManager.cxx b/Tests/CMakeLib/testDebuggerVariablesManager.cxx
index a1881c0..bccff2f 100644
--- a/Tests/CMakeLib/testDebuggerVariablesManager.cxx
+++ b/Tests/CMakeLib/testDebuggerVariablesManager.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <memory>
#include <vector>
diff --git a/Tests/CMakeLib/testDocumentationFormatter.cxx b/Tests/CMakeLib/testDocumentationFormatter.cxx
new file mode 100644
index 0000000..a0324c1
--- /dev/null
+++ b/Tests/CMakeLib/testDocumentationFormatter.cxx
@@ -0,0 +1,184 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+
+#include <sstream>
+#include <string>
+#include <utility>
+
+#include <cmDocumentationFormatter.h>
+
+#include "testCommon.h"
+
+namespace {
+using TestCases = std::initializer_list<std::pair<std::string, std::string>>;
+
+bool testPrintFormattedNoIndent()
+{
+ TestCases const testCases = {
+ { "", "" },
+ { "\n\n", "\n\n\n\n" },
+ { "\n \n\n", "\n\n \n\n\n\n" },
+ { "One line no EOL text", "One line no EOL text\n" },
+ { "One line with trailing spaces and no EOL ",
+ "One line with trailing spaces and no EOL\n" },
+ { "Short text. Two sentences.", "Short text. Two sentences.\n" },
+ { "Short text\non\nmultiple\nlines\n",
+ "Short text\n\non\n\nmultiple\n\nlines\n\n" },
+ { "Just one a very long word: "
+ "01234567890123456789012345678901234567890123456789012345"
+ "678901234567890123456789",
+ "Just one a very long "
+ "word:\n01234567890123456789012345678901234567890123456789012345"
+ "678901234567890123456789\n" },
+ { " Pre-formatted paragraph with the very long word stays the same: "
+ "0123456789012345678901234567890123456789012345678901234567890123456789",
+ " Pre-formatted paragraph with the very long word stays the same: "
+ "0123456789012345678901234567890123456789012345678901234567890123456789"
+ "\n" },
+ { " Two pre-formatted\n paragraphs w/o EOL",
+ " Two pre-formatted\n paragraphs w/o EOL\n" },
+ { " Two pre-formatted\n paragraphs w/ EOL\n",
+ " Two pre-formatted\n paragraphs w/ EOL\n\n" },
+ { "Extra spaces are removed. However, \n not in a "
+ "pre-formatted\n "
+ "paragraph",
+ "Extra spaces are removed. However,\n\n not in a pre-formatted\n "
+ "paragraph\n" },
+ { "This is the text paragraph longer than a pre-defined wrapping position "
+ "of the `cmDocumentationFormatter` class. And it's gonna be wrapped "
+ "over multiple lines!",
+ "This is the text paragraph longer than a pre-defined wrapping position "
+ "of the\n`cmDocumentationFormatter` class. And it's gonna be wrapped "
+ "over multiple\nlines!\n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces ",
+ "A normal paragraph, followed by ...\n\n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \nAnd another paragraph w/o EOL",
+ "A normal paragraph, followed by ...\n\n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \n\nAnd another paragraph w/o EOL\n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \nAnd another paragraph w/ EOL\n",
+ "A normal paragraph, followed by ...\n\n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \n\nAnd another paragraph w/ EOL\n\n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \nAnd another two\nparagraphs w/ EOL\n",
+ "A normal paragraph, followed by ...\n\n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \n\nAnd another two\n\nparagraphs w/ "
+ "EOL\n\n" }
+ };
+
+ cmDocumentationFormatter formatter;
+
+ for (auto& test : testCases) {
+ std::ostringstream out;
+ formatter.PrintFormatted(out, test.first);
+ auto actual = out.str();
+ ASSERT_EQUAL(actual, test.second);
+ }
+
+ return true;
+}
+
+bool testPrintFormattedIndent2()
+{
+ TestCases const testCases = {
+ { "", "" },
+ // BEGIN NOTE Empty lines are not indented.
+ { "\n\n", "\n\n\n\n" },
+ { "\n \n\n", "\n\n \n\n\n\n" },
+ // END NOTE
+ { "One line no EOL text", " One line no EOL text\n" },
+ { "Short text. Two sentences.", " Short text. Two sentences.\n" },
+ { "Short text\non\nmultiple\nlines\n",
+ " Short text\n\n on\n\n multiple\n\n lines\n\n" },
+ { "Just one a very long word: "
+ "01234567890123456789012345678901234567890123456789012345"
+ "678901234567890123456789",
+ " Just one a very long "
+ "word:\n 01234567890123456789012345678901234567890123456789012345"
+ "678901234567890123456789\n" },
+ { " Pre-formatted paragraph with the very long word stays the same: "
+ "0123456789012345678901234567890123456789012345678901234567890123456789",
+ " Pre-formatted paragraph with the very long word stays the same: "
+ "0123456789012345678901234567890123456789012345678901234567890123456789"
+ "\n" },
+ { "Extra spaces are removed. However, \n not in a "
+ "pre-formatted\n "
+ "paragraph",
+ " Extra spaces are removed. However,\n\n not in a "
+ "pre-formatted\n "
+ "paragraph\n" },
+ { "This is the text paragraph longer than a pre-defined wrapping position "
+ "of the `cmDocumentationFormatter` class. And it's gonna be wrapped "
+ "over multiple lines!",
+ " This is the text paragraph longer than a pre-defined wrapping "
+ "position of\n"
+ " the `cmDocumentationFormatter` class. And it's gonna be wrapped "
+ "over\n multiple lines!\n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces ",
+ " A normal paragraph, followed by ...\n\n Pre-formatted\n "
+ "paragraphs "
+ "with trailing whitespaces \n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \nAnd another paragraph w/o EOL",
+ " A normal paragraph, followed by ...\n\n Pre-formatted\n "
+ "paragraphs with trailing whitespaces \n\n And another paragraph "
+ "w/o EOL\n" },
+ { "A normal paragraph, followed by ... \n Pre-formatted\n paragraphs "
+ "with trailing whitespaces \nAnd another paragraph w/ EOL\n",
+ " A normal paragraph, followed by ...\n\n Pre-formatted\n "
+ "paragraphs with trailing whitespaces \n\n And another paragraph "
+ "w/ EOL\n\n" }
+ };
+
+ cmDocumentationFormatter formatter;
+ formatter.SetIndent(2);
+
+ for (auto& test : testCases) {
+ std::ostringstream out;
+ formatter.PrintFormatted(out, test.first);
+ auto actual = out.str();
+ ASSERT_EQUAL(actual, test.second);
+ }
+
+ return true;
+}
+
+bool testPrintFormattedIndent10()
+{
+ TestCases const testCases = {
+ { "", "" },
+ { "One line no EOL text", " One line no EOL text\n" },
+ { "This is the text paragraph longer than a pre-defined wrapping position "
+ "of the `cmDocumentationFormatter` class. And it's gonna be wrapped "
+ "over multiple lines!",
+ " This is the text paragraph longer than a pre-defined "
+ "wrapping\n"
+ " position of the `cmDocumentationFormatter` class. "
+ "And it's gonna\n"
+ " be wrapped over multiple lines!\n" }
+ };
+
+ cmDocumentationFormatter formatter;
+ formatter.SetIndent(10);
+
+ for (auto& test : testCases) {
+ std::ostringstream out;
+ formatter.PrintFormatted(out, test.first);
+ auto actual = out.str();
+ ASSERT_EQUAL(actual, test.second);
+ }
+
+ return true;
+}
+}
+
+int testDocumentationFormatter(int /*unused*/, char* /*unused*/[])
+{
+ return runTests({ testPrintFormattedNoIndent, testPrintFormattedIndent2,
+ testPrintFormattedIndent10 },
+ false);
+}
diff --git a/Tests/CMakeLib/testEncoding.cxx b/Tests/CMakeLib/testEncoding.cxx
index 460d845..a42895e 100644
--- a/Tests/CMakeLib/testEncoding.cxx
+++ b/Tests/CMakeLib/testEncoding.cxx
@@ -31,7 +31,7 @@ int main(int argc, char* argv[])
std::cout << "Usage: testEncoding <encoding> <file>" << std::endl;
return 1;
}
- const std::string encoding(argv[1]);
+ std::string const encoding(argv[1]);
#ifdef _WIN32
if ((encoding == "UTF8") || (encoding == "UTF-8")) {
setEncoding(consoleOut, CP_UTF8);
diff --git a/Tests/CMakeLib/testFindPackageCommand.cxx b/Tests/CMakeLib/testFindPackageCommand.cxx
index 30749be..e3148b8 100644
--- a/Tests/CMakeLib/testFindPackageCommand.cxx
+++ b/Tests/CMakeLib/testFindPackageCommand.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cmConfigure.h> // IWYU pragma: keep
diff --git a/Tests/CMakeLib/testGccDepfileReader.cxx b/Tests/CMakeLib/testGccDepfileReader.cxx
index fb19c14..befcbda 100644
--- a/Tests/CMakeLib/testGccDepfileReader.cxx
+++ b/Tests/CMakeLib/testGccDepfileReader.cxx
@@ -14,7 +14,7 @@
namespace {
-cmGccDepfileContent readPlainDepfile(const char* filePath)
+cmGccDepfileContent readPlainDepfile(char const* filePath)
{
cmGccDepfileContent result;
cmsys::ifstream is(filePath);
@@ -47,8 +47,8 @@ cmGccDepfileContent readPlainDepfile(const char* filePath)
return result;
}
-bool compare(const std::vector<std::string>& actual,
- const std::vector<std::string>& expected, const char* msg)
+bool compare(std::vector<std::string> const& actual,
+ std::vector<std::string> const& expected, char const* msg)
{
if (actual.size() != expected.size()) {
std::cerr << msg << "expected " << expected.size() << " entries."
@@ -67,8 +67,8 @@ bool compare(const std::vector<std::string>& actual,
return true;
}
-bool compare(const cmGccDepfileContent& actual,
- const cmGccDepfileContent& expected)
+bool compare(cmGccDepfileContent const& actual,
+ cmGccDepfileContent const& expected)
{
if (actual.size() != expected.size()) {
std::cerr << "Expected " << expected.size() << " entries." << std::endl
@@ -84,10 +84,10 @@ bool compare(const cmGccDepfileContent& actual,
return true;
}
-void dump(const char* label, const cmGccDepfileContent& dfc)
+void dump(char const* label, cmGccDepfileContent const& dfc)
{
std::cerr << label << std::endl;
- for (const auto& entry : dfc) {
+ for (auto const& entry : dfc) {
auto rit = entry.rules.cbegin();
if (rit != entry.rules.cend()) {
std::cerr << *rit;
@@ -96,7 +96,7 @@ void dump(const char* label, const cmGccDepfileContent& dfc)
}
std::cerr << ": " << std::endl;
}
- for (const auto& path : entry.paths) {
+ for (auto const& path : entry.paths) {
std::cerr << " " << path << std::endl;
}
}
@@ -113,19 +113,19 @@ int testGccDepfileReader(int argc, char* argv[])
std::string dataDirPath = argv[1];
dataDirPath += "/testGccDepfileReader_data";
- const int numberOfTestFiles = 7; // 6th file doesn't exist
+ int const numberOfTestFiles = 7; // 6th file doesn't exist
for (int i = 1; i <= numberOfTestFiles; ++i) {
- const std::string base = dataDirPath + "/deps" + std::to_string(i);
- const std::string depfile = base + ".d";
- const std::string plainDepfile = base + ".txt";
+ std::string const base = dataDirPath + "/deps" + std::to_string(i);
+ std::string const depfile = base + ".d";
+ std::string const plainDepfile = base + ".txt";
std::cout << "Comparing " << base << " with " << plainDepfile << std::endl;
- const auto actual = cmReadGccDepfile(depfile.c_str());
+ auto const actual = cmReadGccDepfile(depfile.c_str());
if (cmSystemTools::FileExists(plainDepfile)) {
if (!actual) {
std::cerr << "Reading " << depfile << " should have succeeded\n";
return 1;
}
- const auto expected = readPlainDepfile(plainDepfile.c_str());
+ auto const expected = readPlainDepfile(plainDepfile.c_str());
if (!compare(*actual, expected)) {
dump("actual", *actual);
dump("expected", expected);
diff --git a/Tests/CMakeLib/testGeneratedFileStream.cxx b/Tests/CMakeLib/testGeneratedFileStream.cxx
index ad1c9e5..1c1b694 100644
--- a/Tests/CMakeLib/testGeneratedFileStream.cxx
+++ b/Tests/CMakeLib/testGeneratedFileStream.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <iostream>
#include <string>
diff --git a/Tests/CMakeLib/testJSONHelpers.cxx b/Tests/CMakeLib/testJSONHelpers.cxx
index 7de58bc..ef7da75 100644
--- a/Tests/CMakeLib/testJSONHelpers.cxx
+++ b/Tests/CMakeLib/testJSONHelpers.cxx
@@ -29,10 +29,10 @@ struct InheritedStruct : public ObjectStruct
namespace ErrorMessages {
using ErrorGenerator =
- std::function<void(const Json::Value*, cmJSONState* state)>;
+ std::function<void(Json::Value const*, cmJSONState* state)>;
ErrorGenerator ErrorGeneratorBuilder(std::string errorMessage)
{
- return [errorMessage](const Json::Value* value, cmJSONState* state) -> void {
+ return [errorMessage](Json::Value const* value, cmJSONState* state) -> void {
state->AddErrorAtValue(errorMessage, value);
};
};
@@ -42,9 +42,9 @@ ErrorGenerator InvalidMap = ErrorGeneratorBuilder("Invalid Map");
ErrorGenerator FaultyObjectProperty =
ErrorGeneratorBuilder("Faulty Object Property");
ErrorGenerator InvalidObject(JsonErrors::ObjectError /*errorType*/,
- const Json::Value::Members& extraFields)
+ Json::Value::Members const& extraFields)
{
- return [extraFields](const Json::Value* value, cmJSONState* state) -> void {
+ return [extraFields](Json::Value const* value, cmJSONState* state) -> void {
state->AddErrorAtValue("Invalid Object", value);
};
};
@@ -65,12 +65,12 @@ auto const StringVectorHelper = JSONHelperBuilder::Vector<std::string>(
auto const StringVectorFilterHelper =
JSONHelperBuilder::VectorFilter<std::string>(
ErrorMessages::InvalidArray, StringHelper,
- [](const std::string& value) { return value != "ignore"; });
+ [](std::string const& value) { return value != "ignore"; });
auto const StringMapHelper =
JSONHelperBuilder::Map<std::string>(ErrorMessages::InvalidMap, StringHelper);
auto const StringMapFilterHelper = JSONHelperBuilder::MapFilter<std::string>(
ErrorMessages::InvalidMap, StringHelper,
- [](const std::string& key) { return key != "ignore"; });
+ [](std::string const& key) { return key != "ignore"; });
auto const OptionalStringHelper =
JSONHelperBuilder::Optional<std::string>(StringHelper);
@@ -466,8 +466,8 @@ bool testRequired()
return true;
}
-JSONHelperBuilder::FilterResult ObjectPropsFilter(const std::string& key,
- const Json::Value* value,
+JSONHelperBuilder::FilterResult ObjectPropsFilter(std::string const& key,
+ Json::Value const* value,
cmJSONState* state)
{
if (key == "ignore") {
diff --git a/Tests/CMakeLib/testList.cxx b/Tests/CMakeLib/testList.cxx
index 2864c91..ef15a6b 100644
--- a/Tests/CMakeLib/testList.cxx
+++ b/Tests/CMakeLib/testList.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <stdexcept>
#include <string>
@@ -573,7 +573,7 @@ bool testFilter()
if (list.size() != 1) {
result = false;
}
- } catch (const std::invalid_argument&) {
+ } catch (std::invalid_argument const&) {
}
}
diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx
index 0276ed3..b1ab503 100644
--- a/Tests/CMakeLib/testOptional.cxx
+++ b/Tests/CMakeLib/testOptional.cxx
@@ -39,21 +39,21 @@ public:
};
EventType Type;
- const EventLogger* Logger1;
- const EventLogger* Logger2;
+ EventLogger const* Logger1;
+ EventLogger const* Logger2;
int Value;
- bool operator==(const Event& other) const;
- bool operator!=(const Event& other) const;
+ bool operator==(Event const& other) const;
+ bool operator!=(Event const& other) const;
};
-bool Event::operator==(const Event& other) const
+bool Event::operator==(Event const& other) const
{
return this->Type == other.Type && this->Logger1 == other.Logger1 &&
this->Logger2 == other.Logger2 && this->Value == other.Value;
}
-bool Event::operator!=(const Event& other) const
+bool Event::operator!=(Event const& other) const
{
return !(*this == other);
}
@@ -64,13 +64,13 @@ class EventLogger
{
public:
EventLogger();
- EventLogger(const EventLogger& other);
+ EventLogger(EventLogger const& other);
EventLogger(EventLogger&& other);
EventLogger(int value);
~EventLogger();
- EventLogger& operator=(const EventLogger& other);
+ EventLogger& operator=(EventLogger const& other);
EventLogger& operator=(EventLogger&& other);
EventLogger& operator=(int value);
@@ -87,10 +87,10 @@ class NoMoveAssignEventLogger : public EventLogger
public:
using EventLogger::EventLogger;
- NoMoveAssignEventLogger(const NoMoveAssignEventLogger&) = default;
+ NoMoveAssignEventLogger(NoMoveAssignEventLogger const&) = default;
NoMoveAssignEventLogger(NoMoveAssignEventLogger&&) = default;
- NoMoveAssignEventLogger& operator=(const NoMoveAssignEventLogger&) = default;
+ NoMoveAssignEventLogger& operator=(NoMoveAssignEventLogger const&) = default;
NoMoveAssignEventLogger& operator=(NoMoveAssignEventLogger&&) = delete;
};
@@ -124,7 +124,7 @@ EventLogger::EventLogger()
events.push_back({ Event::DEFAULT_CONSTRUCT, this, nullptr, 0 });
}
-EventLogger::EventLogger(const EventLogger& other)
+EventLogger::EventLogger(EventLogger const& other)
: Value(other.Value)
{
events.push_back({ Event::COPY_CONSTRUCT, this, &other, other.Value });
@@ -151,7 +151,7 @@ EventLogger::~EventLogger()
END_IGNORE_UNINITIALIZED
}
-EventLogger& EventLogger::operator=(const EventLogger& other)
+EventLogger& EventLogger::operator=(EventLogger const& other)
{
events.push_back({ Event::COPY_ASSIGN, this, &other, other.Value });
this->Value = other.Value;
@@ -172,37 +172,37 @@ EventLogger& EventLogger::operator=(int value)
return *this;
}
-static bool operator==(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator==(EventLogger const& lhs, EventLogger const& rhs)
{
events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value });
return lhs.Value == rhs.Value;
}
-static bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator!=(EventLogger const& lhs, EventLogger const& rhs)
{
events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value });
return lhs.Value != rhs.Value;
}
-static bool operator<(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator<(EventLogger const& lhs, EventLogger const& rhs)
{
events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value });
return lhs.Value < rhs.Value;
}
-static bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator<=(EventLogger const& lhs, EventLogger const& rhs)
{
events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value });
return lhs.Value <= rhs.Value;
}
-static bool operator>(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator>(EventLogger const& lhs, EventLogger const& rhs)
{
events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value });
return lhs.Value > rhs.Value;
}
-static bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator>=(EventLogger const& lhs, EventLogger const& rhs)
{
events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value });
return lhs.Value >= rhs.Value;
@@ -231,7 +231,7 @@ void EventLogger::Reference() const&&
static bool testDefaultConstruct(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o{};
+ cm::optional<EventLogger> const o{};
expected = {};
return true;
@@ -239,7 +239,7 @@ static bool testDefaultConstruct(std::vector<Event>& expected)
static bool testNulloptConstruct(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o{ cm::nullopt };
+ cm::optional<EventLogger> const o{ cm::nullopt };
expected = {};
return true;
@@ -247,7 +247,7 @@ static bool testNulloptConstruct(std::vector<Event>& expected)
static bool testValueConstruct(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o{ 4 };
+ cm::optional<EventLogger> const o{ 4 };
expected = {
{ Event::VALUE_CONSTRUCT, &*o, nullptr, 4 },
@@ -258,8 +258,8 @@ static bool testValueConstruct(std::vector<Event>& expected)
static bool testInPlaceConstruct(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o1{ cm::in_place, 4 };
- const cm::optional<EventLogger> o2{ cm::in_place_t{}, 4 };
+ cm::optional<EventLogger> const o1{ cm::in_place, 4 };
+ cm::optional<EventLogger> const o2{ cm::in_place_t{}, 4 };
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
@@ -272,10 +272,10 @@ static bool testInPlaceConstruct(std::vector<Event>& expected)
static bool testCopyConstruct(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o1{ 4 };
- const cm::optional<EventLogger> o2{ o1 };
- const cm::optional<EventLogger> o3{};
- const cm::optional<EventLogger> o4{ o3 };
+ cm::optional<EventLogger> const o1{ 4 };
+ cm::optional<EventLogger> const o2{ o1 };
+ cm::optional<EventLogger> const o3{};
+ cm::optional<EventLogger> const o4{ o3 };
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
@@ -289,9 +289,9 @@ static bool testCopyConstruct(std::vector<Event>& expected)
static bool testMoveConstruct(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{ 4 };
- const cm::optional<EventLogger> o2{ std::move(o1) };
+ cm::optional<EventLogger> const o2{ std::move(o1) };
cm::optional<EventLogger> o3{};
- const cm::optional<EventLogger> o4{ std::move(o3) };
+ cm::optional<EventLogger> const o4{ std::move(o3) };
#ifndef __clang_analyzer__ /* cplusplus.Move */
expected = {
@@ -322,24 +322,24 @@ static bool testNulloptAssign(std::vector<Event>& expected)
static bool testCopyAssign(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{};
- const cm::optional<EventLogger> o2{ 4 };
+ cm::optional<EventLogger> const o2{ 4 };
auto const* v2 = &*o2;
o1 = o2;
auto const* v1 = &*o1;
- const cm::optional<EventLogger> o3{ 5 };
+ cm::optional<EventLogger> const o3{ 5 };
auto const* v3 = &*o3;
o1 = o3;
- const cm::optional<EventLogger> o4{};
+ cm::optional<EventLogger> const o4{};
o1 = o4;
o1 = o4; // Intentionally duplicated to test assigning an empty optional to
// an empty optional
cm::optional<NoMoveAssignEventLogger> o5{ 1 };
auto const* v5 = &*o5;
- const cm::optional<NoMoveAssignEventLogger> o6{ 2 };
+ cm::optional<NoMoveAssignEventLogger> const o6{ 2 };
auto const* v6 = &*o6;
o5 = std::move(o6);
- const NoMoveAssignEventLogger e7{ 3 };
+ NoMoveAssignEventLogger const e7{ 3 };
o5 = std::move(e7);
expected = {
@@ -390,7 +390,7 @@ static bool testMoveAssign(std::vector<Event>& expected)
static bool testPointer(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{ 4 };
- const cm::optional<EventLogger> o2{ 5 };
+ cm::optional<EventLogger> const o2{ 5 };
o1->Reference();
o2->Reference();
@@ -414,7 +414,7 @@ static bool testDereference(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{ 4 };
auto const* v1 = &*o1;
- const cm::optional<EventLogger> o2{ 5 };
+ cm::optional<EventLogger> const o2{ 5 };
auto const* v2 = &*o2;
(*o1).Reference();
@@ -441,8 +441,8 @@ static bool testDereference(std::vector<Event>& expected)
static bool testHasValue(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o1{ 4 };
- const cm::optional<EventLogger> o2{};
+ cm::optional<EventLogger> const o1{ 4 };
+ cm::optional<EventLogger> const o2{};
ASSERT_TRUE(o1.has_value());
ASSERT_TRUE(o1);
@@ -459,9 +459,9 @@ static bool testHasValue(std::vector<Event>& expected)
static bool testValue(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{ 4 };
- const cm::optional<EventLogger> o2{ 5 };
+ cm::optional<EventLogger> const o2{ 5 };
cm::optional<EventLogger> o3{};
- const cm::optional<EventLogger> o4{};
+ cm::optional<EventLogger> const o4{};
o1.value().Reference();
o2.value().Reference();
@@ -495,9 +495,9 @@ static bool testValue(std::vector<Event>& expected)
static bool testValueOr()
{
- const cm::optional<EventLogger> o1{ 4 };
+ cm::optional<EventLogger> const o1{ 4 };
cm::optional<EventLogger> o2{ 5 };
- const cm::optional<EventLogger> o3{};
+ cm::optional<EventLogger> const o3{};
cm::optional<EventLogger> o4{};
EventLogger e1{ 6 };
@@ -519,12 +519,12 @@ static bool testValueOr()
static bool testComparison(std::vector<Event>& expected)
{
- const cm::optional<EventLogger> o1{ 1 };
- const cm::optional<EventLogger> o2{ 2 };
- const cm::optional<EventLogger> o3{ 2 };
- const cm::optional<EventLogger> o4{};
- const cm::optional<EventLogger> o5{};
- const EventLogger e1{ 2 };
+ cm::optional<EventLogger> const o1{ 1 };
+ cm::optional<EventLogger> const o2{ 2 };
+ cm::optional<EventLogger> const o3{ 2 };
+ cm::optional<EventLogger> const o4{};
+ cm::optional<EventLogger> const o5{};
+ EventLogger const e1{ 2 };
ASSERT_TRUE(!(o1 == o2) && o1 != o2);
ASSERT_TRUE(o1 < o2 && !(o1 >= o2));
diff --git a/Tests/CMakeLib/testPathResolver.cxx b/Tests/CMakeLib/testPathResolver.cxx
new file mode 100644
index 0000000..d5cee74
--- /dev/null
+++ b/Tests/CMakeLib/testPathResolver.cxx
@@ -0,0 +1,599 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <cerrno>
+#include <map>
+#include <string>
+#include <utility>
+
+#ifdef _WIN32
+# include <cctype>
+#endif
+
+#include <cmsys/Status.hxx>
+
+#include "cmPathResolver.h"
+
+#if defined(_WIN32) || defined(__APPLE__)
+# include "cmSystemTools.h"
+#endif
+
+#include "testCommon.h"
+
+// IWYU pragma: no_forward_declare cm::PathResolver::Policies::LogicalPath
+// IWYU pragma: no_forward_declare cm::PathResolver::Policies::NaivePath
+// IWYU pragma: no_forward_declare cm::PathResolver::Policies::CasePath
+// IWYU pragma: no_forward_declare cm::PathResolver::Policies::RealPath
+
+namespace {
+
+class MockSystem : public cm::PathResolver::System
+{
+public:
+ ~MockSystem() override = default;
+
+ struct Path
+ {
+ std::string Name;
+ std::string Link;
+ };
+
+ std::map<std::string, Path> Paths;
+
+ void SetPaths(std::map<std::string, Path> paths)
+ {
+ this->Paths = std::move(paths);
+ }
+
+ static std::string AdjustCase(std::string const& path)
+ {
+#if defined(_WIN32) || defined(__APPLE__)
+ return cmSystemTools::LowerCase(path);
+#else
+ return path;
+#endif
+ }
+
+ cmsys::Status ReadSymlink(std::string const& path,
+ std::string& link) override
+ {
+ auto i = this->Paths.find(AdjustCase(path));
+ if (i == this->Paths.end()) {
+ return cmsys::Status::POSIX(ENOENT);
+ }
+ if (i->second.Link.empty()) {
+ return cmsys::Status::POSIX(EINVAL);
+ }
+ link = i->second.Link;
+ return cmsys::Status::Success();
+ }
+
+ bool PathExists(std::string const& path) override
+ {
+ return this->Paths.find(AdjustCase(path)) != this->Paths.end();
+ }
+
+ std::string WorkDir;
+
+ void SetWorkDir(std::string wd) { this->WorkDir = std::move(wd); }
+
+ std::string GetWorkingDirectory() override { return this->WorkDir; }
+
+#ifdef _WIN32
+ std::map<char, std::string> WorkDirOnDrive;
+
+ void SetWorkDirOnDrive(std::map<char, std::string> wd)
+ {
+ this->WorkDirOnDrive = std::move(wd);
+ }
+
+ std::string GetWorkingDirectoryOnDrive(char letter) override
+ {
+ std::string result;
+ auto i = this->WorkDirOnDrive.find(std::tolower(letter));
+ if (i != this->WorkDirOnDrive.end()) {
+ result = i->second;
+ }
+ return result;
+ }
+#endif
+
+#if defined(_WIN32) || defined(__APPLE__)
+ cmsys::Status ReadName(std::string const& path, std::string& name) override
+ {
+ auto i = this->Paths.find(AdjustCase(path));
+ if (i == this->Paths.end()) {
+ return cmsys::Status::POSIX(ENOENT);
+ }
+ name = i->second.Name;
+ return cmsys::Status::Success();
+ }
+#endif
+};
+
+#define EXPECT_RESOLVE(_in, _expect) \
+ do { \
+ std::string out; \
+ ASSERT_TRUE(r.Resolve(_in, out)); \
+ ASSERT_EQUAL(out, _expect); \
+ } while (false)
+
+#define EXPECT_ENOENT(_in, _expect) \
+ do { \
+ std::string out; \
+ ASSERT_EQUAL(r.Resolve(_in, out).GetPOSIX(), ENOENT); \
+ ASSERT_EQUAL(out, _expect); \
+ } while (false)
+
+using namespace cm::PathResolver;
+
+bool posixRoot()
+{
+ std::cout << "posixRoot()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "/", { {}, {} } },
+ });
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("/", "/");
+ EXPECT_RESOLVE("//", "/");
+ EXPECT_RESOLVE("/.", "/");
+ EXPECT_RESOLVE("/./", "/");
+ EXPECT_RESOLVE("/..", "/");
+ EXPECT_RESOLVE("/../", "/");
+ return true;
+}
+
+bool posixAbsolutePath()
+{
+ std::cout << "posixAbsolutePath()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "/", { {}, {} } },
+ { "/a", { {}, {} } },
+ });
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("/a", "/a");
+ EXPECT_RESOLVE("/a/", "/a");
+ EXPECT_RESOLVE("/a//", "/a");
+ EXPECT_RESOLVE("/a/.", "/a");
+ EXPECT_RESOLVE("/a/./", "/a");
+ EXPECT_RESOLVE("/a/..", "/");
+ EXPECT_RESOLVE("/a/../", "/");
+ EXPECT_RESOLVE("/a/../..", "/");
+#ifndef _WIN32
+ EXPECT_RESOLVE("//a", "/a");
+#endif
+ return true;
+}
+
+bool posixWorkingDirectory()
+{
+ std::cout << "posixWorkingDirectory()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "/", { {}, {} } },
+ { "/a", { {}, {} } },
+ { "/cwd", { {}, {} } },
+ { "/cwd/a", { {}, {} } },
+ });
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("", "/");
+ EXPECT_RESOLVE(".", "/");
+ EXPECT_RESOLVE("..", "/");
+ EXPECT_RESOLVE("a", "/a");
+ os.SetWorkDir("/cwd");
+ EXPECT_RESOLVE("", "/cwd");
+ EXPECT_RESOLVE(".", "/cwd");
+ EXPECT_RESOLVE("..", "/");
+ EXPECT_RESOLVE("a", "/cwd/a");
+ return true;
+}
+
+bool posixSymlink()
+{
+ std::cout << "posixSymlink()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "/", { {}, {} } },
+ { "/link-a", { {}, "a" } },
+ { "/link-a-excess", { {}, "a//." } },
+ { "/link-broken", { {}, "link-broken-dest" } },
+ { "/a", { {}, {} } },
+ { "/a/b", { {}, {} } },
+ { "/a/link-b", { {}, "b" } },
+ { "/a/b/link-c", { {}, "c" } },
+ { "/a/b/c", { {}, {} } },
+ { "/a/b/c/link-..|..", { {}, "../.." } },
+ { "/a/link-|1|2", { {}, "/1/2" } },
+ { "/1", { {}, {} } },
+ { "/1/2", { {}, {} } },
+ { "/1/2/3", { {}, {} } },
+ });
+
+ {
+ Resolver<Policies::CasePath> const r(os);
+ EXPECT_RESOLVE("/link-a", "/link-a");
+ EXPECT_RESOLVE("/link-a-excess", "/link-a-excess");
+ EXPECT_RESOLVE("/link-a-excess/b", "/link-a-excess/b");
+ EXPECT_RESOLVE("/link-broken", "/link-broken");
+ EXPECT_RESOLVE("/link-a/../missing", "/missing");
+ EXPECT_RESOLVE("/a/b/link-c", "/a/b/link-c");
+ EXPECT_RESOLVE("/a/link-b/c", "/a/link-b/c");
+ EXPECT_RESOLVE("/a/link-b/link-c/..", "/a/link-b");
+ EXPECT_RESOLVE("/a/b/c/link-..|..", "/a/b/c/link-..|..");
+ EXPECT_RESOLVE("/a/b/c/link-..|../link-b", "/a/b/c/link-..|../link-b");
+ EXPECT_RESOLVE("/a/link-|1|2/3", "/a/link-|1|2/3");
+ EXPECT_RESOLVE("/a/link-|1|2/../2/3", "/a/2/3");
+ }
+
+ {
+ Resolver<Policies::LogicalPath> const r(os);
+ EXPECT_RESOLVE("/link-a", "/link-a");
+ EXPECT_RESOLVE("/link-a-excess", "/link-a-excess");
+ EXPECT_RESOLVE("/link-a-excess/b", "/link-a-excess/b");
+ EXPECT_RESOLVE("/link-broken", "/link-broken");
+ EXPECT_RESOLVE("/link-a/../missing", "/missing");
+ EXPECT_RESOLVE("/a/b/link-c", "/a/b/link-c");
+ EXPECT_RESOLVE("/a/link-b/c", "/a/link-b/c");
+ EXPECT_RESOLVE("/a/link-b/link-c/..", "/a/link-b");
+ EXPECT_RESOLVE("/a/b/c/link-..|..", "/a/b/c/link-..|..");
+ EXPECT_RESOLVE("/a/b/c/link-..|../link-b", "/a/b/c/link-..|../link-b");
+ EXPECT_RESOLVE("/a/link-|1|2/3", "/a/link-|1|2/3");
+ EXPECT_RESOLVE("/a/link-|1|2/../2/3", "/1/2/3");
+ }
+
+ {
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("/link-a", "/a");
+ EXPECT_RESOLVE("/link-a-excess", "/a");
+ EXPECT_RESOLVE("/link-a-excess/b", "/a/b");
+ EXPECT_ENOENT("/link-broken", "/link-broken-dest");
+ EXPECT_ENOENT("/link-a/../missing", "/missing");
+ EXPECT_RESOLVE("/a/b/link-c", "/a/b/c");
+ EXPECT_RESOLVE("/a/link-b/c", "/a/b/c");
+ EXPECT_RESOLVE("/a/link-b/link-c/..", "/a/b");
+ EXPECT_RESOLVE("/a/b/c/link-..|..", "/a");
+ EXPECT_RESOLVE("/a/b/c/link-..|../link-b", "/a/b");
+ EXPECT_RESOLVE("/a/link-|1|2/3", "/1/2/3");
+ }
+
+ return true;
+}
+
+#ifdef __APPLE__
+bool macosActualCase()
+{
+ std::cout << "macosActualCase()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "/", { {}, {} } },
+ { "/mixed", { "MiXeD", {} } },
+ { "/mixed/link-mixed", { "LiNk-MiXeD", "mixed" } },
+ { "/mixed/mixed", { "MiXeD", {} } },
+ { "/mixed/link-c-mixed", { "LiNk-C-MiXeD", "/mIxEd" } },
+ { "/upper", { "UPPER", {} } },
+ { "/upper/link-upper", { "LINK-UPPER", "upper" } },
+ { "/upper/upper", { "UPPER", {} } },
+ { "/upper/link-c-upper", { "LINK-C-UPPER", "/upper" } },
+ });
+
+ {
+ Resolver<Policies::CasePath> const r(os);
+ EXPECT_RESOLVE("/mIxEd/MiSsInG", "/MiXeD/MiSsInG");
+ EXPECT_RESOLVE("/mIxEd/link-MiXeD", "/MiXeD/LiNk-MiXeD");
+ EXPECT_RESOLVE("/mIxEd/link-c-MiXeD", "/MiXeD/LiNk-C-MiXeD");
+ EXPECT_RESOLVE("/upper/mIsSiNg", "/UPPER/mIsSiNg");
+ EXPECT_RESOLVE("/upper/link-upper", "/UPPER/LINK-UPPER");
+ EXPECT_RESOLVE("/upper/link-c-upper", "/UPPER/LINK-C-UPPER");
+ }
+
+ {
+ Resolver<Policies::LogicalPath> const r(os);
+ EXPECT_RESOLVE("/mIxEd/MiSsInG", "/MiXeD/MiSsInG");
+ EXPECT_RESOLVE("/mIxEd/link-MiXeD", "/MiXeD/LiNk-MiXeD");
+ EXPECT_RESOLVE("/mIxEd/link-c-MiXeD", "/MiXeD/LiNk-C-MiXeD");
+ EXPECT_RESOLVE("/upper/mIsSiNg", "/UPPER/mIsSiNg");
+ EXPECT_RESOLVE("/upper/link-upper", "/UPPER/LINK-UPPER");
+ EXPECT_RESOLVE("/upper/link-c-upper", "/UPPER/LINK-C-UPPER");
+ }
+
+ {
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_ENOENT("/mIxEd/MiSsInG", "/MiXeD/MiSsInG");
+ EXPECT_RESOLVE("/mIxEd/link-MiXeD", "/MiXeD/MiXeD");
+ EXPECT_RESOLVE("/mIxEd/link-c-MiXeD", "/MiXeD");
+ EXPECT_ENOENT("/upper/mIsSiNg", "/UPPER/mIsSiNg");
+ EXPECT_RESOLVE("/upper/link-upper", "/UPPER/UPPER");
+ EXPECT_RESOLVE("/upper/link-c-upper", "/UPPER");
+ }
+
+ return true;
+}
+#endif
+
+#ifdef _WIN32
+bool windowsRoot()
+{
+ std::cout << "windowsRoot()\n";
+ MockSystem os;
+ {
+ Resolver<Policies::NaivePath> const r(os);
+ EXPECT_RESOLVE("c:/", "c:/");
+ EXPECT_RESOLVE("C:/", "C:/");
+ EXPECT_RESOLVE("c://", "c:/");
+ EXPECT_RESOLVE("C:/.", "C:/");
+ EXPECT_RESOLVE("c:/./", "c:/");
+ EXPECT_RESOLVE("C:/..", "C:/");
+ EXPECT_RESOLVE("c:/../", "c:/");
+ }
+ {
+ Resolver<Policies::CasePath> const r(os);
+ EXPECT_RESOLVE("c:/", "C:/");
+ EXPECT_RESOLVE("C:/", "C:/");
+ EXPECT_RESOLVE("c://", "C:/");
+ EXPECT_RESOLVE("C:/.", "C:/");
+ EXPECT_RESOLVE("c:/./", "C:/");
+ EXPECT_RESOLVE("C:/..", "C:/");
+ EXPECT_RESOLVE("c:/../", "C:/");
+ }
+ os.SetPaths({
+ { "c:/", { {}, {} } },
+ { "//host/", { {}, {} } },
+ });
+ {
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("c:/", "C:/");
+ EXPECT_RESOLVE("C:/", "C:/");
+ EXPECT_RESOLVE("c://", "C:/");
+ EXPECT_RESOLVE("C:/.", "C:/");
+ EXPECT_RESOLVE("c:/./", "C:/");
+ EXPECT_RESOLVE("C:/..", "C:/");
+ EXPECT_RESOLVE("c:/../", "C:/");
+ EXPECT_RESOLVE("//host", "//host/");
+ EXPECT_RESOLVE("//host/.", "//host/");
+ EXPECT_RESOLVE("//host/./", "//host/");
+ EXPECT_RESOLVE("//host/..", "//host/");
+ EXPECT_RESOLVE("//host/../", "//host/");
+ }
+ return true;
+}
+
+bool windowsAbsolutePath()
+{
+ std::cout << "windowsAbsolutePath()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "c:/", { {}, {} } },
+ { "c:/a", { {}, {} } },
+ });
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("c:/a", "C:/a");
+ EXPECT_RESOLVE("c:/a/", "C:/a");
+ EXPECT_RESOLVE("c:/a//", "C:/a");
+ EXPECT_RESOLVE("c:/a/.", "C:/a");
+ EXPECT_RESOLVE("c:/a/./", "C:/a");
+ EXPECT_RESOLVE("c:/a/..", "C:/");
+ EXPECT_RESOLVE("c:/a/../", "C:/");
+ EXPECT_RESOLVE("c:/a/../..", "C:/");
+ return true;
+}
+
+bool windowsActualCase()
+{
+ std::cout << "windowsActualCase()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "c:/", { {}, {} } },
+ { "c:/mixed", { "MiXeD", {} } },
+ { "c:/mixed/link-mixed", { "LiNk-MiXeD", "mixed" } },
+ { "c:/mixed/mixed", { "MiXeD", {} } },
+ { "c:/mixed/link-c-mixed", { "LiNk-C-MiXeD", "C:/mIxEd" } },
+ { "c:/upper", { "UPPER", {} } },
+ { "c:/upper/link-upper", { "LINK-UPPER", "upper" } },
+ { "c:/upper/upper", { "UPPER", {} } },
+ { "c:/upper/link-c-upper", { "LINK-C-UPPER", "c:/upper" } },
+ });
+
+ {
+ Resolver<Policies::CasePath> const r(os);
+ EXPECT_RESOLVE("c:/mIxEd/MiSsInG", "C:/MiXeD/MiSsInG");
+ EXPECT_RESOLVE("c:/mIxEd/link-MiXeD", "C:/MiXeD/LiNk-MiXeD");
+ EXPECT_RESOLVE("c:/mIxEd/link-c-MiXeD", "C:/MiXeD/LiNk-C-MiXeD");
+ EXPECT_RESOLVE("c:/upper/mIsSiNg", "C:/UPPER/mIsSiNg");
+ EXPECT_RESOLVE("c:/upper/link-upper", "C:/UPPER/LINK-UPPER");
+ EXPECT_RESOLVE("c:/upper/link-c-upper", "C:/UPPER/LINK-C-UPPER");
+ }
+
+ {
+ Resolver<Policies::LogicalPath> const r(os);
+ EXPECT_RESOLVE("c:/mIxEd/MiSsInG", "C:/MiXeD/MiSsInG");
+ EXPECT_RESOLVE("c:/mIxEd/link-MiXeD", "C:/MiXeD/LiNk-MiXeD");
+ EXPECT_RESOLVE("c:/mIxEd/link-c-MiXeD", "C:/MiXeD/LiNk-C-MiXeD");
+ EXPECT_RESOLVE("c:/upper/mIsSiNg", "C:/UPPER/mIsSiNg");
+ EXPECT_RESOLVE("c:/upper/link-upper", "C:/UPPER/LINK-UPPER");
+ EXPECT_RESOLVE("c:/upper/link-c-upper", "C:/UPPER/LINK-C-UPPER");
+ }
+
+ {
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_ENOENT("c:/mIxEd/MiSsInG", "C:/MiXeD/MiSsInG");
+ EXPECT_RESOLVE("c:/mIxEd/link-MiXeD", "C:/MiXeD/MiXeD");
+ EXPECT_RESOLVE("c:/mIxEd/link-c-MiXeD", "C:/MiXeD");
+ EXPECT_ENOENT("c:/upper/mIsSiNg", "C:/UPPER/mIsSiNg");
+ EXPECT_RESOLVE("c:/upper/link-upper", "C:/UPPER/UPPER");
+ EXPECT_RESOLVE("c:/upper/link-c-upper", "C:/UPPER");
+ }
+
+ return true;
+}
+
+bool windowsWorkingDirectory()
+{
+ std::cout << "windowsWorkingDirectory()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "c:/", { {}, {} } },
+ { "c:/a", { {}, {} } },
+ { "c:/cwd", { {}, {} } },
+ { "c:/cwd/a", { {}, {} } },
+ });
+ {
+ Resolver<Policies::LogicalPath> const r(os);
+ EXPECT_RESOLVE("", "/");
+ EXPECT_RESOLVE(".", "/");
+ EXPECT_RESOLVE("..", "/");
+ EXPECT_RESOLVE("a", "/a");
+ }
+ {
+ Resolver<Policies::RealPath> const r(os);
+ os.SetWorkDir("c:/cwd");
+ EXPECT_RESOLVE("", "C:/cwd");
+ EXPECT_RESOLVE(".", "C:/cwd");
+ EXPECT_RESOLVE("..", "C:/");
+ EXPECT_RESOLVE("a", "C:/cwd/a");
+ EXPECT_ENOENT("missing", "C:/cwd/missing");
+ }
+ return true;
+}
+
+bool windowsWorkingDirectoryOnDrive()
+{
+ std::cout << "windowsWorkingDirectoryOnDrive()\n";
+ MockSystem os;
+ os.SetWorkDir("c:/cwd");
+ os.SetWorkDirOnDrive({
+ { 'd', "d:/cwd-d" },
+ });
+ {
+ Resolver<Policies::NaivePath> const r(os);
+ EXPECT_RESOLVE("c:", "c:/cwd");
+ EXPECT_RESOLVE("c:.", "c:/cwd");
+ EXPECT_RESOLVE("c:..", "c:/");
+ EXPECT_RESOLVE("C:", "C:/cwd");
+ EXPECT_RESOLVE("C:.", "C:/cwd");
+ EXPECT_RESOLVE("C:..", "C:/");
+ EXPECT_RESOLVE("d:", "d:/cwd-d");
+ EXPECT_RESOLVE("d:.", "d:/cwd-d");
+ EXPECT_RESOLVE("d:..", "d:/");
+ EXPECT_RESOLVE("D:", "D:/cwd-d");
+ EXPECT_RESOLVE("D:.", "D:/cwd-d");
+ EXPECT_RESOLVE("D:..", "D:/");
+ EXPECT_RESOLVE("e:", "e:/");
+ EXPECT_RESOLVE("e:.", "e:/");
+ EXPECT_RESOLVE("e:..", "e:/");
+ EXPECT_RESOLVE("E:", "E:/");
+ EXPECT_RESOLVE("E:.", "E:/");
+ EXPECT_RESOLVE("E:..", "E:/");
+ }
+ {
+ Resolver<Policies::CasePath> const r(os);
+ EXPECT_RESOLVE("c:", "C:/cwd");
+ EXPECT_RESOLVE("c:.", "C:/cwd");
+ EXPECT_RESOLVE("c:..", "C:/");
+ EXPECT_RESOLVE("C:", "C:/cwd");
+ EXPECT_RESOLVE("C:.", "C:/cwd");
+ EXPECT_RESOLVE("C:..", "C:/");
+ EXPECT_RESOLVE("d:", "D:/cwd-d");
+ EXPECT_RESOLVE("d:.", "D:/cwd-d");
+ EXPECT_RESOLVE("d:..", "D:/");
+ EXPECT_RESOLVE("D:", "D:/cwd-d");
+ EXPECT_RESOLVE("D:.", "D:/cwd-d");
+ EXPECT_RESOLVE("D:..", "D:/");
+ EXPECT_RESOLVE("e:", "E:/");
+ EXPECT_RESOLVE("e:.", "E:/");
+ EXPECT_RESOLVE("e:..", "E:/");
+ EXPECT_RESOLVE("E:", "E:/");
+ EXPECT_RESOLVE("E:.", "E:/");
+ EXPECT_RESOLVE("E:..", "E:/");
+ }
+ os.SetPaths({
+ { "c:/", { {}, {} } },
+ { "c:/cwd", { {}, {} } },
+ { "c:/cwd/existing", { {}, {} } },
+ { "d:/", { {}, {} } },
+ { "d:/cwd-d", { {}, {} } },
+ { "d:/cwd-d/existing", { {}, {} } },
+ { "e:/", { {}, {} } },
+ });
+ {
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("c:existing", "C:/cwd/existing");
+ EXPECT_ENOENT("c:missing", "C:/cwd/missing");
+ EXPECT_RESOLVE("C:existing", "C:/cwd/existing");
+ EXPECT_ENOENT("C:missing", "C:/cwd/missing");
+ EXPECT_RESOLVE("d:existing", "D:/cwd-d/existing");
+ EXPECT_ENOENT("d:missing", "D:/cwd-d/missing");
+ EXPECT_ENOENT("e:missing", "E:/missing");
+ EXPECT_ENOENT("f:", "F:/");
+ }
+ return true;
+}
+
+bool windowsNetworkShare()
+{
+ std::cout << "windowsNetworkShare()\n";
+ MockSystem os;
+ os.SetPaths({
+ { "c:/", { {}, {} } },
+ { "c:/cwd", { {}, {} } },
+ { "c:/cwd/link-to-host-share", { {}, "//host/share" } },
+ { "//host/", { {}, {} } },
+ { "//host/share", { {}, {} } },
+ });
+ os.SetWorkDir("c:/cwd");
+ {
+ Resolver<Policies::RealPath> const r(os);
+ EXPECT_RESOLVE("//host/share", "//host/share");
+ EXPECT_RESOLVE("//host/share/", "//host/share");
+ EXPECT_RESOLVE("//host/share/.", "//host/share");
+ EXPECT_RESOLVE("//host/share/./", "//host/share");
+ EXPECT_RESOLVE("//host/share/..", "//host/");
+ EXPECT_RESOLVE("//host/share/../", "//host/");
+ EXPECT_RESOLVE("//host/share/../..", "//host/");
+ EXPECT_RESOLVE("link-to-host-share", "//host/share");
+ EXPECT_RESOLVE("link-to-host-share/..", "//host/");
+ EXPECT_ENOENT("link-to-host-share/../missing", "//host/missing");
+ }
+
+ {
+ Resolver<Policies::LogicalPath> const r(os);
+ EXPECT_RESOLVE("link-to-host-share", "C:/cwd/link-to-host-share");
+ EXPECT_RESOLVE("link-to-host-share/..", "//host/");
+ EXPECT_RESOLVE("link-to-host-share/../missing", "//host/missing");
+ }
+
+ {
+ Resolver<Policies::CasePath> const r(os);
+ EXPECT_RESOLVE("link-to-host-share", "C:/cwd/link-to-host-share");
+ EXPECT_RESOLVE("link-to-host-share/..", "C:/cwd");
+ EXPECT_RESOLVE("link-to-host-share/../missing", "C:/cwd/missing");
+ }
+ return true;
+}
+#endif
+
+}
+
+int testPathResolver(int /*unused*/, char* /*unused*/[])
+{
+ return runTests({
+ posixRoot,
+ posixAbsolutePath,
+ posixWorkingDirectory,
+ posixSymlink,
+#ifdef __APPLE__
+ macosActualCase,
+#endif
+#ifdef _WIN32
+ windowsRoot,
+ windowsAbsolutePath,
+ windowsActualCase,
+ windowsWorkingDirectory,
+ windowsWorkingDirectoryOnDrive,
+ windowsNetworkShare,
+#endif
+ });
+}
diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx
index 77f2a66..930ffd6 100644
--- a/Tests/CMakeLib/testRST.cxx
+++ b/Tests/CMakeLib/testRST.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <iostream>
#include <string>
diff --git a/Tests/CMakeLib/testRange.cxx b/Tests/CMakeLib/testRange.cxx
index 64bc3d7..11e95fe 100644
--- a/Tests/CMakeLib/testRange.cxx
+++ b/Tests/CMakeLib/testRange.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <string>
#include <vector>
diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx
index b6723f5..b796eb7 100644
--- a/Tests/CMakeLib/testString.cxx
+++ b/Tests/CMakeLib/testString.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cstring>
#include <iterator>
@@ -76,14 +76,14 @@ static bool testFromCStrNull(cm::String str)
static bool testConstructFromCStrNull()
{
std::cout << "testConstructFromCStrNull()\n";
- const char* null = nullptr;
+ char const* null = nullptr;
return testFromCStrNull(null);
}
static bool testAssignFromCStrNull()
{
std::cout << "testAssignFromCStrNull()\n";
- const char* null = nullptr;
+ char const* null = nullptr;
cm::String str;
str = null;
return testFromCStrNull(str);
@@ -123,7 +123,7 @@ static bool testAssignFromCharArray()
return testFromCharArray(str);
}
-static const char* cstr = "abc";
+static char const* cstr = "abc";
static bool testFromCStr(cm::String const& str)
{
@@ -148,7 +148,7 @@ static bool testAssignFromCStr()
return testFromCStr(str);
}
-static const std::string stdstr = "abc";
+static std::string const stdstr = "abc";
static bool testFromStdString(cm::String const& str)
{
@@ -264,7 +264,7 @@ static bool testConstructFromN()
return true;
}
-static const auto staticStringView = "abc"_s;
+static auto const staticStringView = "abc"_s;
static bool testFromStaticStringView(cm::String str)
{
@@ -367,7 +367,7 @@ static bool testOperatorBool()
ASSERT_TRUE(!str);
str = "";
ASSERT_TRUE(str);
- str = static_cast<const char*>(nullptr);
+ str = static_cast<char const*>(nullptr);
ASSERT_TRUE(!str);
str = std::string();
ASSERT_TRUE(str);
@@ -392,7 +392,7 @@ static bool testOperatorPlusEqual()
cm::String str = "a";
str += "b";
{
- const char* c = "c";
+ char const* c = "c";
str += c;
}
str += 'd';
@@ -424,9 +424,9 @@ static bool testOperatorCompare()
ASSERT_TRUE("b" >= str);
}
{
- const char* a = "a";
- const char* b = "b";
- const char* c = "c";
+ char const* a = "a";
+ char const* b = "b";
+ char const* c = "c";
ASSERT_TRUE(str == b);
ASSERT_TRUE(b == str);
ASSERT_TRUE(str != a);
@@ -682,7 +682,7 @@ static bool testMethod_replace()
std::cout << "testMethod_replace()\n";
{
cm::String str = "abcd";
- const char* bc = "bc";
+ char const* bc = "bc";
ASSERT_TRUE(str.replace(1, 2, "BC") == "aBCd");
ASSERT_TRUE(str.replace(1, 2, bc) == "abcd");
ASSERT_TRUE(str.replace(1, 2, 'x') == "axd");
@@ -692,7 +692,7 @@ static bool testMethod_replace()
}
{
cm::String str = "abcd";
- const char* bc = "bc";
+ char const* bc = "bc";
ASSERT_TRUE(str.replace(str.begin() + 1, str.begin() + 3, "BC") == "aBCd");
ASSERT_TRUE(str.replace(str.begin() + 1, str.begin() + 3, bc) == "abcd");
ASSERT_TRUE(str.replace(str.begin() + 1, str.begin() + 3, 'x') == "axd");
@@ -705,7 +705,7 @@ static bool testMethod_replace()
}
{
cm::String str = "abcd";
- const char* bc = "_bc";
+ char const* bc = "_bc";
ASSERT_TRUE(str.replace(1, 2, "_BC_", 1, 2) == "aBCd");
ASSERT_TRUE(str.replace(1, 2, bc, 1) == "abcd");
ASSERT_TRUE(str.replace(1, 2, 'x', 0) == "axd");
@@ -715,7 +715,7 @@ static bool testMethod_replace()
}
{
cm::String str = "abcd";
- const char* bc = "_bc_";
+ char const* bc = "_bc_";
ASSERT_TRUE(str.replace(1, 2, 2, 'x') == "axxd");
ASSERT_TRUE(str.replace(str.begin() + 1, str.begin() + 3, 2, 'y') ==
"ayyd");
@@ -807,7 +807,7 @@ static bool testMethod_substr_AtStart(cm::String str)
ASSERT_TRUE(substr.size() == 2);
// c_str() not at the end of the buffer internally mutates.
- const char* substr_c = substr.c_str();
+ char const* substr_c = substr.c_str();
ASSERT_TRUE(std::strcmp(substr_c, "ab") == 0);
ASSERT_TRUE(substr_c != str.data());
ASSERT_TRUE(substr.data() != str.data());
@@ -836,7 +836,7 @@ static bool testMethod_substr_AtStart(cm::String str)
ASSERT_TRUE(substr.c_str() != str.data());
// c_str() does not internally after str() did so
- const char* substr_c = substr.c_str();
+ char const* substr_c = substr.c_str();
ASSERT_TRUE(std::strcmp(substr_c, "ab") == 0);
ASSERT_TRUE(substr_c == substr.data());
ASSERT_TRUE(substr.size() == 2);
@@ -866,9 +866,9 @@ static bool testMethod_compare()
ASSERT_TRUE(str.compare("b") == 0);
ASSERT_TRUE(str.compare("c") < 0);
{
- const char* a = "a";
- const char* b = "b";
- const char* c = "c";
+ char const* a = "a";
+ char const* b = "b";
+ char const* c = "c";
ASSERT_TRUE(str.compare(a) > 0);
ASSERT_TRUE(str.compare(b) == 0);
ASSERT_TRUE(str.compare(c) < 0);
@@ -900,7 +900,7 @@ static bool testMethod_find()
ASSERT_TRUE(str.find("a") == 0);
ASSERT_TRUE(str.find("a", 1) == 3);
{
- const char* a = "a";
+ char const* a = "a";
ASSERT_TRUE(str.find(a) == 0);
ASSERT_TRUE(str.find(a, 1) == 3);
}
@@ -923,7 +923,7 @@ static bool testMethod_rfind()
ASSERT_TRUE(str.rfind("a") == 3);
ASSERT_TRUE(str.rfind("a", 1) == 0);
{
- const char* a = "a";
+ char const* a = "a";
ASSERT_TRUE(str.rfind(a) == 3);
ASSERT_TRUE(str.rfind(a, 1) == 0);
}
@@ -946,7 +946,7 @@ static bool testMethod_find_first_of()
ASSERT_TRUE(str.find_first_of("_a") == 0);
ASSERT_TRUE(str.find_first_of("_a", 1) == 3);
{
- const char* a = "_a";
+ char const* a = "_a";
ASSERT_TRUE(str.find_first_of(a) == 0);
ASSERT_TRUE(str.find_first_of(a, 1) == 3);
}
@@ -969,7 +969,7 @@ static bool testMethod_find_first_not_of()
ASSERT_TRUE(str.find_first_not_of("_a") == 1);
ASSERT_TRUE(str.find_first_not_of("_a", 2) == 2);
{
- const char* a = "_a";
+ char const* a = "_a";
ASSERT_TRUE(str.find_first_not_of(a) == 1);
ASSERT_TRUE(str.find_first_not_of(a, 2) == 2);
}
@@ -992,7 +992,7 @@ static bool testMethod_find_last_of()
ASSERT_TRUE(str.find_last_of("_a") == 3);
ASSERT_TRUE(str.find_last_of("_a", 1) == 0);
{
- const char* a = "_a";
+ char const* a = "_a";
ASSERT_TRUE(str.find_last_of(a) == 3);
ASSERT_TRUE(str.find_last_of(a, 1) == 0);
}
@@ -1015,7 +1015,7 @@ static bool testMethod_find_last_not_of()
ASSERT_TRUE(str.find_last_not_of("_a") == 5);
ASSERT_TRUE(str.find_last_not_of("_a", 1) == 1);
{
- const char* a = "_a";
+ char const* a = "_a";
ASSERT_TRUE(str.find_last_not_of(a) == 5);
ASSERT_TRUE(str.find_last_not_of(a, 1) == 1);
}
@@ -1051,17 +1051,17 @@ static bool testAddition()
ASSERT_TRUE("abcd"_s == "a"_s + (cm::String("b"_s) + "c"_s) + "d"_s);
}
{
- const char* a = "a";
- const char* b = "b";
- const char* ab = "ab";
+ char const* a = "a";
+ char const* b = "b";
+ char const* ab = "ab";
ASSERT_TRUE(cm::String(a) + b == ab);
ASSERT_TRUE(ab == a + cm::String(b));
- const char* c = "c";
- const char* abc = "abc";
+ char const* c = "c";
+ char const* abc = "abc";
ASSERT_TRUE(a + cm::String(b) + c == abc);
ASSERT_TRUE(abc == a + cm::String(b) + c);
- const char* d = "d";
- const char* abcd = "abcd";
+ char const* d = "d";
+ char const* abcd = "abcd";
ASSERT_TRUE(a + (cm::String(b) + c) + d == abcd);
ASSERT_TRUE(abcd == a + (cm::String(b) + c) + d);
}
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index 78442ba..8b0eb69 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
@@ -10,6 +10,7 @@
#include <vector>
#include <cm/string_view>
+#include <cmext/string_view>
#include "cmStringAlgorithms.h"
@@ -103,7 +104,9 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/[])
{
typedef std::vector<std::string> VT;
assert_ok(cmTokenize("", ";") == VT{ "" }, "cmTokenize empty");
- assert_ok(cmTokenize(";", ";") == VT{ "" }, "cmTokenize sep");
+ assert_ok(cmTokenize(";", ";") == VT{ "" }, "cmTokenize sep (char*)");
+ assert_ok(cmTokenize(";", ";"_s) == VT{ "" },
+ "cmTokenize sep (string_view)");
assert_ok(cmTokenize("abc", ";") == VT{ "abc" }, "cmTokenize item");
assert_ok(cmTokenize("abc;", ";") == VT{ "abc" }, "cmTokenize item sep");
assert_ok(cmTokenize(";abc", ";") == VT{ "abc" }, "cmTokenize sep item");
@@ -112,6 +115,22 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/[])
assert_ok(cmTokenize("a1;a2;a3;a4", ";") == VT{ "a1", "a2", "a3", "a4" },
"cmTokenize multiple items");
}
+ {
+ typedef std::vector<cm::string_view> VT;
+ assert_ok(cmTokenizedView("", ';') == VT{ "" }, "cmTokenizedView empty");
+ assert_ok(cmTokenizedView(";", ';') == VT{ "" }, "cmTokenizedView sep");
+ assert_ok(cmTokenizedView("abc", ';') == VT{ "abc" },
+ "cmTokenizedView item");
+ assert_ok(cmTokenizedView("abc;", ';') == VT{ "abc" },
+ "cmTokenizedView item sep");
+ assert_ok(cmTokenizedView(";abc", ';') == VT{ "abc" },
+ "cmTokenizedView sep item");
+ assert_ok(cmTokenizedView("abc;;efg", ';') == VT{ "abc", "efg" },
+ "cmTokenizedView item sep sep item");
+ assert_ok(cmTokenizedView("a1;a2;a3;a4", ';') ==
+ VT{ "a1", "a2", "a3", "a4" },
+ "cmTokenizedView multiple items");
+ }
// ----------------------------------------------------------------------
// Test cmStrCat
diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx
index 0f0c025..3581474 100644
--- a/Tests/CMakeLib/testSystemTools.cxx
+++ b/Tests/CMakeLib/testSystemTools.cxx
@@ -1,9 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cmConfigure.h> // IWYU pragma: keep
-#include <iostream>
#include <string>
#include <vector>
@@ -11,110 +10,66 @@
#include "cmSystemTools.h"
-#define cmPassed(m) std::cout << "Passed: " << (m) << "\n"
-#define cmFailed(m) \
- std::cout << "FAILED: " << (m) << "\n"; \
- failed = 1
+#include "testCommon.h"
-#define cmAssert(exp, m) \
- do { \
- if ((exp)) { \
- cmPassed(m); \
- } else { \
- cmFailed(m); \
- } \
- } while (false)
-
-int testSystemTools(int /*unused*/, char* /*unused*/[])
+static bool testUpperCase()
{
- int failed = 0;
- // ----------------------------------------------------------------------
- // Test cmSystemTools::UpperCase
- std::string str = "abc";
- std::string strupper = "ABC";
- cmAssert(cmSystemTools::UpperCase(str) == strupper,
- "cmSystemTools::UpperCase");
+ std::cout << "testUpperCase()\n";
+ ASSERT_EQUAL(cmSystemTools::UpperCase("abc"), "ABC");
+ return true;
+}
- // ----------------------------------------------------------------------
- // Test cmSystemTools::VersionCompare
- cmAssert(cmSystemTools::VersionCompareEqual("", ""),
- "VersionCompareEqual empty string");
- cmAssert(!cmSystemTools::VersionCompareGreater("", ""),
- "VersionCompareGreater empty string");
- cmAssert(cmSystemTools::VersionCompareEqual("1", "1a"),
- "VersionCompareEqual letters");
- cmAssert(!cmSystemTools::VersionCompareGreater("1", "1a"),
- "VersionCompareGreater letters");
- cmAssert(cmSystemTools::VersionCompareEqual("001", "1"),
- "VersionCompareEqual leading zeros equal");
- cmAssert(!cmSystemTools::VersionCompareGreater("001", "1"),
- "VersionCompareGreater leading zeros equal");
- cmAssert(!cmSystemTools::VersionCompareEqual("002", "1"),
- "VersionCompareEqual leading zeros greater");
- cmAssert(cmSystemTools::VersionCompareGreater("002", "1"),
- "VersionCompareGreater leading zeros greater");
- cmAssert(!cmSystemTools::VersionCompareEqual("6.2.1", "6.3.1"),
- "VersionCompareEqual components less");
- cmAssert(!cmSystemTools::VersionCompareGreater("6.2.1", "6.3.1"),
- "VersionCompareGreater components less");
- cmAssert(!cmSystemTools::VersionCompareEqual("6.2.1", "6.2"),
- "VersionCompareEqual different length");
- cmAssert(cmSystemTools::VersionCompareGreater("6.2.1", "6.2"),
- "VersionCompareGreater different length");
- cmAssert(
- !cmSystemTools::VersionCompareEqual(
- "3.14159265358979323846264338327950288419716939937510582097494459230",
- "3.14159265358979323846264338327950288419716939937510582097494459231"),
- "VersionCompareEqual long number");
- cmAssert(
- !cmSystemTools::VersionCompareGreater(
- "3.14159265358979323846264338327950288419716939937510582097494459230",
- "3.14159265358979323846264338327950288419716939937510582097494459231"),
- "VersionCompareGreater long number");
- cmAssert(
- !cmSystemTools::VersionCompareEqual(
- "3.141592653589793238462643383279502884197169399375105820974944592307",
- "3.14159265358979323846264338327950288419716939937510582097494459231"),
- "VersionCompareEqual more digits");
- cmAssert(
- cmSystemTools::VersionCompareGreater(
- "3.141592653589793238462643383279502884197169399375105820974944592307",
- "3.14159265358979323846264338327950288419716939937510582097494459231"),
- "VersionCompareGreater more digits");
+static bool testVersionCompare()
+{
+ std::cout << "testVersionCompare()\n";
+ ASSERT_TRUE(cmSystemTools::VersionCompareEqual("", ""));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareGreater("", ""));
+ ASSERT_TRUE(cmSystemTools::VersionCompareEqual("1", "1a"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareGreater("1", "1a"));
+ ASSERT_TRUE(cmSystemTools::VersionCompareEqual("001", "1"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareGreater("001", "1"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareEqual("002", "1"));
+ ASSERT_TRUE(cmSystemTools::VersionCompareGreater("002", "1"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareEqual("6.2.1", "6.3.1"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareGreater("6.2.1", "6.3.1"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareEqual("6.2.1", "6.2"));
+ ASSERT_TRUE(cmSystemTools::VersionCompareGreater("6.2.1", "6.2"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareEqual(
+ "3.14159265358979323846264338327950288419716939937510582097494459230",
+ "3.14159265358979323846264338327950288419716939937510582097494459231"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareGreater(
+ "3.14159265358979323846264338327950288419716939937510582097494459230",
+ "3.14159265358979323846264338327950288419716939937510582097494459231"));
+ ASSERT_TRUE(!cmSystemTools::VersionCompareEqual(
+ "3.141592653589793238462643383279502884197169399375105820974944592307",
+ "3.14159265358979323846264338327950288419716939937510582097494459231"));
+ ASSERT_TRUE(cmSystemTools::VersionCompareGreater(
+ "3.141592653589793238462643383279502884197169399375105820974944592307",
+ "3.14159265358979323846264338327950288419716939937510582097494459231"));
+ return true;
+}
- // ----------------------------------------------------------------------
- // Test cmSystemTools::strverscmp
- cmAssert(cmSystemTools::strverscmp("", "") == 0, "strverscmp empty string");
- cmAssert(cmSystemTools::strverscmp("abc", "") > 0,
- "strverscmp string vs empty string");
- cmAssert(cmSystemTools::strverscmp("abc", "abc") == 0,
- "strverscmp same string");
- cmAssert(cmSystemTools::strverscmp("abd", "abc") > 0,
- "strverscmp character string");
- cmAssert(cmSystemTools::strverscmp("abc", "abd") < 0,
- "strverscmp symmetric");
- cmAssert(cmSystemTools::strverscmp("12345", "12344") > 0,
- "strverscmp natural numbers");
- cmAssert(cmSystemTools::strverscmp("100", "99") > 0,
- "strverscmp natural numbers different digits");
- cmAssert(cmSystemTools::strverscmp("12345", "00345") > 0,
- "strverscmp natural against decimal (same length)");
- cmAssert(cmSystemTools::strverscmp("99999999999999", "99999999999991") > 0,
- "strverscmp natural overflow");
- cmAssert(cmSystemTools::strverscmp("00000000000009", "00000000000001") > 0,
- "strverscmp decimal precision");
- cmAssert(cmSystemTools::strverscmp("a.b.c.0", "a.b.c.000") > 0,
- "strverscmp multiple zeros");
- cmAssert(cmSystemTools::strverscmp("lib_1.2_10", "lib_1.2_2") > 0,
- "strverscmp last number ");
- cmAssert(cmSystemTools::strverscmp("12lib", "2lib") > 0,
- "strverscmp first number ");
- cmAssert(cmSystemTools::strverscmp("02lib", "002lib") > 0,
- "strverscmp first number decimal ");
- cmAssert(cmSystemTools::strverscmp("10", "9a") > 0,
- "strverscmp letter filler ");
- cmAssert(cmSystemTools::strverscmp("000", "0001") > 0,
- "strverscmp zero and leading zeros ");
+static bool testStrVersCmp()
+{
+ std::cout << "testStrVersCmp()\n";
+ ASSERT_TRUE(cmSystemTools::strverscmp("", "") == 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("abc", "") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("abc", "abc") == 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("abd", "abc") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("abc", "abd") < 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("12345", "12344") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("100", "99") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("12345", "00345") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("99999999999999", "99999999999991") >
+ 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("00000000000009", "00000000000001") >
+ 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("a.b.c.0", "a.b.c.000") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("lib_1.2_10", "lib_1.2_2") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("12lib", "2lib") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("02lib", "002lib") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("10", "9a") > 0);
+ ASSERT_TRUE(cmSystemTools::strverscmp("000", "0001") > 0);
// test sorting using standard strvercmp input
std::vector<std::string> testString;
@@ -132,15 +87,43 @@ int testSystemTools(int /*unused*/, char* /*unused*/[])
for (size_t i = 0; i < testString.size() - 1; i++) {
for (size_t j = i + 1; j < testString.size(); j++) {
if (cmSystemTools::strverscmp(testString[i], testString[j]) >= 0) {
- cmFailed("cmSystemTools::strverscmp error in comparing strings " +
- testString[i] + " " + testString[j]);
+ std::cout << "cmSystemTools::strverscmp error in comparing strings "
+ << testString[i] << ' ' << testString[j] << '\n';
+ return false;
}
}
}
+ return true;
+}
- if (!failed) {
- cmPassed("cmSystemTools::strverscmp working");
+static bool testMakeTempDirectory()
+{
+ std::cout << "testMakeTempDirectory()\n";
+
+ static std::string const kTemplate = "testMakeTempDirectory-XXXXXX";
+ std::string tempDir = kTemplate;
+ cmsys::Status status = cmSystemTools::MakeTempDirectory(tempDir);
+ if (!status) {
+ std::cout << "cmSystemTools::MakeTempDirectory failed on \"" << tempDir
+ << "\": " << status.GetString() << '\n';
+ return false;
+ }
+ if (!cmSystemTools::FileIsDirectory(tempDir)) {
+ std::cout << "cmSystemTools::MakeTempDirectory did not create \""
+ << tempDir << '\n';
+ return false;
}
+ cmSystemTools::RemoveADirectory(tempDir);
+ ASSERT_TRUE(tempDir != kTemplate);
+ return true;
+}
- return failed;
+int testSystemTools(int /*unused*/, char* /*unused*/[])
+{
+ return runTests({
+ testUpperCase,
+ testVersionCompare,
+ testStrVersCmp,
+ testMakeTempDirectory,
+ });
}
diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx
index 180d29d..2268ebd 100644
--- a/Tests/CMakeLib/testUTF8.cxx
+++ b/Tests/CMakeLib/testUTF8.cxx
@@ -1,12 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cm/string_view>
#include <stdio.h>
#include <cm_utf8.h>
-using test_utf8_char = const cm::string_view;
+using test_utf8_char = cm::string_view const;
static void byte_array_print(test_utf8_char s)
{
@@ -77,9 +77,9 @@ static void report_bad(bool passed, test_utf8_char c)
static bool decode_good(test_utf8_entry const& entry)
{
- const auto& s = entry.str;
+ auto const& s = entry.str;
unsigned int uc;
- if (const char* e =
+ if (char const* e =
cm_utf8_decode_character(s.data(), s.data() + s.size(), &uc)) {
int used = static_cast<int>(e - s.data());
if (uc != entry.chr) {
@@ -104,7 +104,7 @@ static bool decode_good(test_utf8_entry const& entry)
static bool decode_bad(test_utf8_char s)
{
unsigned int uc = 0xFFFFu;
- const char* e = cm_utf8_decode_character(s.data(), s.data() + s.size(), &uc);
+ char const* e = cm_utf8_decode_character(s.data(), s.data() + s.size(), &uc);
if (e) {
report_bad(false, s);
printf("expected failure, got 0x%04X\n", uc);
diff --git a/Tests/CMakeLib/testUVJobServerClient.cxx b/Tests/CMakeLib/testUVJobServerClient.cxx
index 13f0f40..e9a567c 100644
--- a/Tests/CMakeLib/testUVJobServerClient.cxx
+++ b/Tests/CMakeLib/testUVJobServerClient.cxx
@@ -20,8 +20,8 @@
namespace {
-const std::size_t kTOTAL_JOBS = 10;
-const std::size_t kTOTAL_TOKENS = 3;
+std::size_t const kTOTAL_JOBS = 10;
+std::size_t const kTOTAL_TOKENS = 3;
struct Job
{
diff --git a/Tests/CMakeLib/testUVPatches.cxx b/Tests/CMakeLib/testUVPatches.cxx
new file mode 100644
index 0000000..f602179
--- /dev/null
+++ b/Tests/CMakeLib/testUVPatches.cxx
@@ -0,0 +1,47 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file LICENSE.rst or https://cmake.org/licensing for details. */
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+
+#include <cm3p/uv.h>
+
+#include "cmSystemTools.h"
+
+#include "testCommon.h"
+
+static bool test_uv_fs_mkdtemp()
+{
+ std::cout << "test_uv_fs_mkdtemp()\n";
+ static std::string const kTemplate = "test-uv_fs_mkdtemp-XXXXXX";
+ std::string tempDir;
+ uv_fs_t tempDirReq;
+ tempDirReq.data = &tempDir;
+ uv_loop_t* loop = uv_default_loop();
+ int r =
+ uv_fs_mkdtemp(loop, &tempDirReq, kTemplate.c_str(), [](uv_fs_t* req) {
+ if (req->data && req->path) {
+ *static_cast<std::string*>(req->data) = req->path;
+ }
+ });
+ ASSERT_EQUAL(r, 0);
+ uv_run(loop, UV_RUN_DEFAULT);
+ uv_fs_req_cleanup(&tempDirReq);
+ uv_loop_close(loop);
+ if (!cmSystemTools::FileIsDirectory(tempDir)) {
+ std::cout << "cmSystemTools::MakeTempDirectory did not create \""
+ << tempDir << '\n';
+ return false;
+ }
+ cmSystemTools::RemoveADirectory(tempDir);
+ ASSERT_TRUE(tempDir != kTemplate);
+ return true;
+}
+
+int testUVPatches(int /*unused*/, char* /*unused*/[])
+{
+ return runTests({
+ test_uv_fs_mkdtemp,
+ });
+}
diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx
index b669f65..8ac16b2 100644
--- a/Tests/CMakeLib/testUVProcessChain.cxx
+++ b/Tests/CMakeLib/testUVProcessChain.cxx
@@ -28,7 +28,7 @@ struct ExpectedStatus
std::string ExceptionString;
};
-static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code)
+static char const* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code)
{
switch (code) {
case cmUVProcessChain::ExceptionCode::None:
@@ -50,8 +50,8 @@ static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code)
}
}
-bool operator==(const cmUVProcessChain::Status* actual,
- const ExpectedStatus& expected)
+bool operator==(cmUVProcessChain::Status const* actual,
+ ExpectedStatus const& expected)
{
if (expected.Status.SpawnResult != actual->SpawnResult) {
return false;
@@ -76,8 +76,8 @@ bool operator==(const cmUVProcessChain::Status* actual,
}
static bool resultsMatch(
- const std::vector<const cmUVProcessChain::Status*>& actual,
- const std::vector<ExpectedStatus>& expected)
+ std::vector<cmUVProcessChain::Status const*> const& actual,
+ std::vector<ExpectedStatus> const& expected)
{
return actual.size() == expected.size() &&
std::equal(actual.begin(), actual.end(), expected.begin());
@@ -96,7 +96,7 @@ static std::string getInput(std::istream& input)
template <typename T>
std::function<std::ostream&(std::ostream&)> printExpected(bool match,
- const T& value)
+ T const& value)
{
return [match, value](std::ostream& stream) -> std::ostream& {
if (match) {
@@ -110,14 +110,14 @@ std::function<std::ostream&(std::ostream&)> printExpected(bool match,
std::ostream& operator<<(
std::ostream& stream,
- const std::function<std::ostream&(std::ostream&)>& func)
+ std::function<std::ostream&(std::ostream&)> const& func)
{
return func(stream);
}
static void printResults(
- const std::vector<const cmUVProcessChain::Status*>& actual,
- const std::vector<ExpectedStatus>& expected)
+ std::vector<cmUVProcessChain::Status const*> const& actual,
+ std::vector<ExpectedStatus> const& expected)
{
std::cout << "Expected: " << std::endl;
for (auto const& e : expected) {
@@ -149,7 +149,7 @@ static void printResults(
static bool checkExecution(cmUVProcessChainBuilder& builder,
std::unique_ptr<cmUVProcessChain>& chain)
{
- static const std::vector<ExpectedStatus> status1 = {
+ static std::vector<ExpectedStatus> const status1 = {
{ false,
false,
{ 0, false, 0, 0 },
@@ -167,7 +167,7 @@ static bool checkExecution(cmUVProcessChainBuilder& builder,
"" },
};
- static const std::vector<ExpectedStatus> status2 = {
+ static std::vector<ExpectedStatus> const status2 = {
{ true,
true,
{ 0, true, 0, 0 },
@@ -185,7 +185,7 @@ static bool checkExecution(cmUVProcessChainBuilder& builder,
"" },
};
- static const std::vector<ExpectedStatus> status3 = {
+ static std::vector<ExpectedStatus> const status3 = {
{ true,
true,
{ 0, true, 0, 0 },
@@ -211,7 +211,7 @@ static bool checkExecution(cmUVProcessChainBuilder& builder,
#endif
};
- std::vector<const cmUVProcessChain::Status*> status;
+ std::vector<cmUVProcessChain::Status const*> status;
chain = cm::make_unique<cmUVProcessChain>(builder.Start());
if (!chain->Valid()) {
@@ -287,7 +287,7 @@ static bool checkOutput(std::istream& outputStream, std::istream& errorStream)
return true;
}
-bool testUVProcessChainBuiltin(const char* helperCommand)
+bool testUVProcessChainBuiltin(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
std::unique_ptr<cmUVProcessChain> chain;
@@ -325,7 +325,7 @@ bool testUVProcessChainBuiltin(const char* helperCommand)
return true;
}
-bool testUVProcessChainBuiltinMerged(const char* helperCommand)
+bool testUVProcessChainBuiltinMerged(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
std::unique_ptr<cmUVProcessChain> chain;
@@ -382,7 +382,7 @@ bool testUVProcessChainBuiltinMerged(const char* helperCommand)
return true;
}
-bool testUVProcessChainExternal(const char* helperCommand)
+bool testUVProcessChainExternal(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
std::unique_ptr<cmUVProcessChain> chain;
@@ -448,7 +448,7 @@ bool testUVProcessChainExternal(const char* helperCommand)
return true;
}
-bool testUVProcessChainNone(const char* helperCommand)
+bool testUVProcessChainNone(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
std::unique_ptr<cmUVProcessChain> chain;
@@ -472,7 +472,7 @@ bool testUVProcessChainNone(const char* helperCommand)
return true;
}
-bool testUVProcessChainCwdUnchanged(const char* helperCommand)
+bool testUVProcessChainCwdUnchanged(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
builder.AddCommand({ helperCommand, "pwd" })
@@ -498,7 +498,7 @@ bool testUVProcessChainCwdUnchanged(const char* helperCommand)
return true;
}
-bool testUVProcessChainCwdChanged(const char* helperCommand)
+bool testUVProcessChainCwdChanged(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
builder.AddCommand({ helperCommand, "pwd" })
@@ -525,9 +525,9 @@ bool testUVProcessChainCwdChanged(const char* helperCommand)
return true;
}
-bool testUVProcessChainSpawnFail(const char* helperCommand)
+bool testUVProcessChainSpawnFail(char const* helperCommand)
{
- static const std::vector<ExpectedStatus> status1 = {
+ static std::vector<ExpectedStatus> const status1 = {
{ false,
false,
{ 0, false, 0, 0 },
@@ -553,7 +553,7 @@ bool testUVProcessChainSpawnFail(const char* helperCommand)
#endif
};
- static const std::vector<ExpectedStatus> status2 = {
+ static std::vector<ExpectedStatus> const status2 = {
#ifdef _WIN32
{ true,
true,
@@ -587,7 +587,7 @@ bool testUVProcessChainSpawnFail(const char* helperCommand)
#endif
};
- std::vector<const cmUVProcessChain::Status*> status;
+ std::vector<cmUVProcessChain::Status const*> status;
cmUVProcessChainBuilder builder;
builder.AddCommand({ helperCommand, "echo" })
@@ -632,7 +632,7 @@ bool testUVProcessChainSpawnFail(const char* helperCommand)
return true;
}
-bool testUVProcessChainInputFile(const char* helperCommand)
+bool testUVProcessChainInputFile(char const* helperCommand)
{
std::unique_ptr<FILE, int (*)(FILE*)> f(
fopen("testUVProcessChainInput.txt", "rb"), fclose);
@@ -660,7 +660,7 @@ bool testUVProcessChainInputFile(const char* helperCommand)
return true;
}
-bool testUVProcessChainWait0(const char* helperCommand)
+bool testUVProcessChainWait0(char const* helperCommand)
{
cmUVProcessChainBuilder builder;
builder.AddCommand({ helperCommand, "echo" });
@@ -674,7 +674,7 @@ bool testUVProcessChainWait0(const char* helperCommand)
return true;
}
-bool testUVProcessChainExternalLoop(const char* helperCommand)
+bool testUVProcessChainExternalLoop(char const* helperCommand)
{
cm::uv_loop_ptr loop;
loop.init();
diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx
index 1b4adb7..29ee765 100644
--- a/Tests/CMakeLib/testUVProcessChainHelper.cxx
+++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx
@@ -7,7 +7,7 @@
#include <string>
#include <thread>
-#include "cmSystemTools.h"
+#include "cmsys/SystemTools.hxx"
#ifdef _WIN32
# include <windows.h>
@@ -73,7 +73,7 @@ int main(int argc, char** argv)
#endif
}
if (command == "pwd") {
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
std::cout << cwd << std::flush;
return 0;
}
diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx
index af06a8e..d53eab3 100644
--- a/Tests/CMakeLib/testUVStreambuf.cxx
+++ b/Tests/CMakeLib/testUVStreambuf.cxx
@@ -21,7 +21,7 @@
static bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
char* outputData,
unsigned int outputDataLength,
- const char* /* unused */)
+ char const* /* unused */)
{
int err;
@@ -74,14 +74,14 @@ static bool writeDataToStreamProcess(uv_loop_t& loop,
cm::uv_pipe_ptr& inputPipe,
char* outputData,
unsigned int /* unused */,
- const char* cmakeCommand)
+ char const* cmakeCommand)
{
int err;
inputPipe.init(loop, 0);
std::vector<std::string> arguments = { cmakeCommand, "-E", "echo_append",
outputData };
- std::vector<const char*> processArgs;
+ std::vector<char const*> processArgs;
for (auto const& arg : arguments) {
processArgs.push_back(arg.c_str());
}
@@ -106,6 +106,9 @@ static bool writeDataToStreamProcess(uv_loop_t& loop,
options.file = cmakeCommand;
options.args = const_cast<char**>(processArgs.data());
options.flags = UV_PROCESS_WINDOWS_HIDE;
+#if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
+ options.flags |= UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
+#endif
options.stdio = stdio.data();
options.stdio_count = static_cast<int>(stdio.size());
options.exit_cb = [](uv_process_t* handle, int64_t exitStatus,
@@ -138,8 +141,8 @@ static bool writeDataToStreamProcess(uv_loop_t& loop,
static bool testUVStreambufRead(
bool (*cb)(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, char* outputData,
- unsigned int outputDataLength, const char* cmakeCommand),
- const char* cmakeCommand)
+ unsigned int outputDataLength, char const* cmakeCommand),
+ char const* cmakeCommand)
{
char outputData[] = TEST_STR;
bool success = false;
diff --git a/Tests/CMakeLib/testVisualStudioSlnParser.cxx b/Tests/CMakeLib/testVisualStudioSlnParser.cxx
index 3bab2ba..a0c8bd6 100644
--- a/Tests/CMakeLib/testVisualStudioSlnParser.cxx
+++ b/Tests/CMakeLib/testVisualStudioSlnParser.cxx
@@ -8,7 +8,7 @@
#define SLN_EXTENSION "sln-file"
static bool parsedRight(cmVisualStudioSlnParser& parser,
- const std::string& file, cmSlnData& data,
+ std::string const& file, cmSlnData& data,
cmVisualStudioSlnParser::ParseResult expected =
cmVisualStudioSlnParser::ResultOK)
{
@@ -45,8 +45,8 @@ int testVisualStudioSlnParser(int, char*[])
if (!parsedRight(parser, "valid", data)) {
return 1;
}
- const std::vector<cmSlnProjectEntry>& projects = data.GetProjects();
- const char* const names[] = {
+ std::vector<cmSlnProjectEntry> const& projects = data.GetProjects();
+ char const* const names[] = {
"3rdParty",
"ALL_BUILD",
"CMakeLib",
@@ -98,7 +98,7 @@ int testVisualStudioSlnParser(int, char*[])
"uninstall"
/* clang-format needs this comment to break after the opening brace */
};
- const size_t expectedProjectCount = sizeof(names) / sizeof(*names);
+ size_t const expectedProjectCount = sizeof(names) / sizeof(*names);
if (projects.size() != expectedProjectCount) {
std::cerr << "cmVisualStudioSlnParser returned bad number of "
<< "projects (" << projects.size() << " instead of "
@@ -168,7 +168,7 @@ int testVisualStudioSlnParser(int, char*[])
return 1;
}
}
- const char* const files[] = {
+ char const* const files[] = {
"header", "projectArgs", "topLevel", "projectContents",
"projectSection", "global", "unclosed", "strayQuote",
"strayParen", "strayQuote2"
diff --git a/Tests/CMakeLib/testVisualStudioSlnParser_data/.gitattributes b/Tests/CMakeLib/testVisualStudioSlnParser_data/.gitattributes
index 08b4ac4..f8e68b5 100644
--- a/Tests/CMakeLib/testVisualStudioSlnParser_data/.gitattributes
+++ b/Tests/CMakeLib/testVisualStudioSlnParser_data/.gitattributes
@@ -1 +1 @@
-*.sln-file eol=crlf
+*.sln-file eol=crlf tab-indent
diff --git a/Tests/CMakeLib/testXMLSafe.cxx b/Tests/CMakeLib/testXMLSafe.cxx
index f0bd9c9..68f6a03 100644
--- a/Tests/CMakeLib/testXMLSafe.cxx
+++ b/Tests/CMakeLib/testXMLSafe.cxx
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,8 +12,8 @@
struct test_pair
{
- const char* in;
- const char* out;
+ char const* in;
+ char const* out;
};
static test_pair const pairs[] = {
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 428ec8b..6617455 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -351,7 +351,8 @@ if(BUILD_TESTING)
# add a bunch of standard build-and-test style tests
ADD_TEST_MACRO(CommandLineTest CommandLineTest)
- ADD_TEST_MACRO(FindPackageTest FindPackageTest)
+ ADD_TEST_MACRO(FindPackageCMakeTest FindPackageCMakeTest)
+ ADD_TEST_MACRO(FindPackageCpsTest FindPackageCpsTest)
ADD_TEST_MACRO(StringFileTest StringFileTest)
ADD_TEST_MACRO(TryCompile TryCompile)
ADD_TEST_MACRO(SystemInformation SystemInformation)
@@ -467,9 +468,6 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(SetLang SetLangX)
ADD_TEST_MACRO(EmptyProperty EmptyProperty)
ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
- if(NOT CMake_TEST_EXTERNAL_CMAKE)
- ADD_TEST_MACRO(LoadCommand LoadedCommand)
- endif()
ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory)
ADD_TEST_MACRO(LinkLanguage LinkLanguage)
ADD_TEST_MACRO(LinkLine LinkLine)
@@ -544,9 +542,6 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(CrossCompile CrossCompile)
set_tests_properties(CrossCompile PROPERTIES
PASS_REGULAR_EXPRESSION "try_run.. invoked in cross-compiling mode")
- if("${CMAKE_GENERATOR}" MATCHES "Make")
- ADD_TEST_MACRO(Policy0002 Policy0002)
- endif()
if(CMake_TEST_XCODE_VERSION)
set(Architecture_BUILD_OPTIONS -DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION})
ADD_TEST_MACRO(Architecture Architecture)
@@ -577,7 +572,7 @@ if(BUILD_TESTING)
set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES})
- CHECK_CXX_SOURCE_COMPILES("#include <QCoreApplication>\n int main() {return (qApp == 0 ? 0 : 1); }\n"
+ check_cxx_source_compiles("#include <QCoreApplication>\n int main() {return (qApp == 0 ? 0 : 1); }\n"
QT4_WORKS)
set(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}")
@@ -663,7 +658,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project ExternalDataTest
--build-noclean
- --force-new-ctest-process
--build-options
-DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
@@ -1337,18 +1331,6 @@ if(BUILD_TESTING)
set_property(TEST CMakeTestAllGenerators PROPERTY RUN_SERIAL 1)
endif()
- if(NOT CMake_TEST_EXTERNAL_CMAKE)
- add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
- "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
- ${build_generator_args}
- --build-project LoadCommand
- --test-command LoadedCommand
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
- endif()
-
add_test(complex ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Complex"
@@ -1383,7 +1365,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project EnvironmentProj
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
@@ -1422,7 +1403,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project Qt4Targets
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets"
- --force-new-ctest-process
--build-options
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
--test-command ${CMAKE_CTEST_COMMAND} -V
@@ -1437,7 +1417,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project Qt4And5Automoc
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocForward"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocForward")
@@ -1448,7 +1427,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project Qt4And5Automoc
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocReverse"
- --force-new-ctest-process
--build-options -DQT_REVERSE_FIND_ORDER=1
--test-command ${CMAKE_CTEST_COMMAND} -V
)
@@ -1645,7 +1623,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project ExternalProjectTest
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject"
- --force-new-ctest-process
--build-options ${ExternalProject_BUILD_OPTIONS}
--test-command ${CMAKE_CTEST_COMMAND} -V
)
@@ -1662,7 +1639,6 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/ExternalProjectSubdir"
${build_generator_args}
--build-project ExternalProjectSubdir
- --force-new-ctest-process
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSubdir")
@@ -1673,7 +1649,6 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdir"
${build_generator_args}
--build-project ExternalProjectSourceSubdir
- --force-new-ctest-process
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdir")
@@ -1684,7 +1659,6 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdirNotCMake"
${build_generator_args}
--build-project ExternalProjectSourceSubdirNotCMake
- --force-new-ctest-process
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdirNotCMake")
@@ -1695,7 +1669,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project ExternalProjectLocalTest
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal")
@@ -1710,7 +1683,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project ExternalProjectUpdateTest
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate")
@@ -1766,7 +1738,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project superpro
--build-exe-dir "${CMake_BINARY_DIR}/Tests/InstallMode-${_mode}"
- --force-new-ctest-process
--build-options
${_maybe_BUILD_OPTIONS}
"-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/InstallMode-${_mode}/install"
@@ -2157,6 +2128,14 @@ if(BUILD_TESTING)
set_property(TEST MSVCDebugInformationFormat APPEND
PROPERTY LABELS "CUDA" "Fortran")
+ set(MSVCRuntimeChecks_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+ if(CMAKE_Fortran_COMPILER)
+ list(APPEND MSVCRuntimeChecks_BUILD_OPTIONS -DCMake_TEST_Fortran=1)
+ endif()
+ ADD_TEST_MACRO(MSVCRuntimeChecks)
+ set_property(TEST MSVCRuntimeChecks APPEND
+ PROPERTY LABELS "CUDA" "Fortran")
+
set(MSVCRuntimeLibrary_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
ADD_TEST_MACRO(MSVCRuntimeLibrary)
set_property(TEST MSVCRuntimeLibrary APPEND
@@ -2363,7 +2342,6 @@ if(BUILD_TESTING)
--build-generator "Green Hills MULTI"
--build-project test
--build-config $<CONFIGURATION>
- --force-new-ctest-process
--build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform}
${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_ghs_build_opts} ${_ghs_toolset_extra}
${_ghs_test_command}
@@ -2577,7 +2555,6 @@ if(BUILD_TESTING)
${build_generator_args}
--build-project TestsWorkingDirectoryProj
--build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE}
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory")
@@ -2589,9 +2566,9 @@ if(BUILD_TESTING)
# A simple test for ctest in script mode
configure_file("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" @ONLY)
-# add_test(CTest.ScriptMode ${CMAKE_CTEST_COMMAND}
-# -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake"
-# )
+ add_test(CTest.ScriptMode ${CMAKE_CTEST_COMMAND}
+ -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake"
+ )
# Test CTest Update with Subversion
if(NOT DEFINED CMake_TEST_CTestUpdate_SVN OR CMake_TEST_CTestUpdate_SVN)
@@ -3032,7 +3009,6 @@ if(BUILD_TESTING)
)
if(NOT BORLAND)
- set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process)
add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4
--output-on-failure -C "\${CTestTest_CONFIG}")
endif()
diff --git a/Tests/CMakeTests/.gitattributes b/Tests/CMakeTests/.gitattributes
index c6148fb..d32296d 100644
--- a/Tests/CMakeTests/.gitattributes
+++ b/Tests/CMakeTests/.gitattributes
@@ -1 +1,2 @@
File-HASH-Input.txt eol=lf
+ImplicitLinkInfoTest.cmake.in tab-indent
diff --git a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in
index 22f6afd..4701fab 100644
--- a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in
+++ b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in
@@ -13,6 +13,22 @@ if(NOT nonexistent2 STREQUAL "${bindir}/THIS_IS_A_NONEXISTENT_FILE")
endif()
#
+# Test treatment of .. after file name
+#
+foreach(c REALPATH ABSOLUTE)
+ get_filename_component(dir "${CMAKE_CURRENT_LIST_DIR}" ${c})
+ get_filename_component(fileDotDot "${CMAKE_CURRENT_LIST_FILE}/.." ${c})
+ if(NOT "${fileDotDot}" STREQUAL "${dir}")
+ message(FATAL_ERROR
+ "${c} did not resolve\n"
+ " ${CMAKE_CURRENT_LIST_FILE}/..\n"
+ "lexically:\n"
+ " ${fileDotDot}"
+ )
+ endif()
+endforeach()
+
+#
# Test treatment of relative paths
#
foreach(c REALPATH ABSOLUTE)
diff --git a/Tests/CMakeTests/IfTest.cmake.in b/Tests/CMakeTests/IfTest.cmake.in
index e5211b4..e783d8d 100644
--- a/Tests/CMakeTests/IfTest.cmake.in
+++ b/Tests/CMakeTests/IfTest.cmake.in
@@ -40,60 +40,6 @@ macro(test_vars _old)
endmacro()
#-----------------------------------------------------------------------------
-# Test the OLD behavior of CMP0012.
-cmake_policy(SET CMP0012 OLD)
-
-# False constants not recognized (still false).
-foreach(_false "" ${FALSE_NAMES})
- if("${_false}")
- message(FATAL_ERROR "OLD if(${_false}) is true!")
- else()
- message(STATUS "OLD if(${_false}) is false")
- endif()
-
- if(NOT "${_false}")
- message(STATUS "OLD if(NOT ${_false}) is true")
- else()
- message(FATAL_ERROR "OLD if(NOT ${_false}) is false!")
- endif()
-endforeach()
-
-# True constants not recognized.
-foreach(_false ${TRUE_NAMES})
- if(${_false})
- message(FATAL_ERROR "OLD if(${_false}) is true!")
- else()
- message(STATUS "OLD if(${_false}) is false")
- endif()
-
- if(NOT ${_false})
- message(STATUS "OLD if(NOT ${_false}) is true")
- else()
- message(FATAL_ERROR "OLD if(NOT ${_false}) is false!")
- endif()
-endforeach()
-
-# Numbers not recognized properly.
-foreach(_num 2 -2 2.0 -2.0 2x -2x)
- if(${_num})
- message(FATAL_ERROR "OLD if(${_num}) is true!")
- else()
- message(STATUS "OLD if(${_num}) is false")
- endif()
-
- if(NOT ${_num})
- message(FATAL_ERROR "OLD if(NOT ${_num}) is true!")
- else()
- message(STATUS "OLD if(NOT ${_num}) is false")
- endif()
-endforeach()
-
-test_vars("OLD ")
-
-#-----------------------------------------------------------------------------
-
-# Test the NEW behavior of CMP0012.
-cmake_policy(SET CMP0012 NEW)
# Test false constants.
foreach(_false "" 0 ${FALSE_NAMES})
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index 0120c84..118be6c 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -152,33 +152,10 @@ foreach(cmd IN ITEMS Find Get Insert Length Remove_At)
check_cmake_test_single(List "${cmd}-List-Only" "${_test_file_name}")
endforeach()
-set(thelist "" NEW OLD)
-
-foreach (_pol ${thelist})
- cmake_policy(SET CMP0007 ${_pol})
- list(GET thelist 1 thevalue)
- if (NOT thevalue STREQUAL _pol)
- message(SEND_ERROR "returned element '${thevalue}', but expected '${_pol}'")
- endif()
-endforeach (_pol)
-
-block(SCOPE_FOR POLICIES)
- cmake_policy(SET CMP0007 NEW)
- set(result andy bill brad ken bob)
- list(INSERT result 1 "")
- TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob")
- list(INSERT result 4 ";")
- TEST("INSERT result 1 ;" "andy;;bill;brad;;;ken;bob")
- list(INSERT result 0 "x")
- TEST("INSERT result 1 x" "x;andy;;bill;brad;;;ken;bob")
-endblock()
-block(SCOPE_FOR POLICIES)
- cmake_policy(SET CMP0007 OLD)
- set(result andy bill brad ken bob)
- list(INSERT result 1 "")
- TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob")
- list(INSERT result 4 ";")
- TEST("INSERT result 1 ;" "andy;bill;brad;ken;;;bob")
- list(INSERT result 0 "x")
- TEST("INSERT result 1 x" "x;andy;bill;brad;ken;bob")
-endblock()
+set(result andy bill brad ken bob)
+list(INSERT result 1 "")
+TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob")
+list(INSERT result 4 ";")
+TEST("INSERT result 1 ;" "andy;;bill;brad;;;ken;bob")
+list(INSERT result 0 "x")
+TEST("INSERT result 1 x" "x;andy;;bill;brad;;;ken;bob")
diff --git a/Tests/CMakeTests/ModuleNoticesTest.cmake.in b/Tests/CMakeTests/ModuleNoticesTest.cmake.in
index 7ae6607..a9efd50 100644
--- a/Tests/CMakeTests/ModuleNoticesTest.cmake.in
+++ b/Tests/CMakeTests/ModuleNoticesTest.cmake.in
@@ -1,6 +1,6 @@
# Regex to match license notices at the top of module files.
set(notice_regex [[^# Distributed under the OSI-approved BSD 3-Clause License\. See accompanying
-# file Copyright\.txt or https://cmake\.org/licensing for details\.
+# file LICENSE\.rst or https://cmake\.org/licensing for details\.
]])
string(REPLACE "\n" "\r?\n" notice_regex "${notice_regex}")
diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in
index 5f8b111..6a94cc5 100644
--- a/Tests/CMakeTests/StringTest.cmake.in
+++ b/Tests/CMakeTests/StringTest.cmake.in
@@ -84,7 +84,7 @@ check_cmake_test(String
# Execute each test listed in StringTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake")
-set(number_of_tests_expected 74)
+set(number_of_tests_expected 72)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake
index e069897..7c45857 100644
--- a/Tests/CMakeTests/StringTestScript.cmake
+++ b/Tests/CMakeTests/StringTestScript.cmake
@@ -1,8 +1,6 @@
message(STATUS "testname='${testname}'")
-function(test_configure_line_number EXPRESSION POLICY)
- cmake_policy(PUSH)
- cmake_policy(SET CMP0053 ${POLICY})
+function(test_configure_line_number EXPRESSION)
string(CONFIGURE
"${EXPRESSION}" v) # line should indicate string() call
math(EXPR vplus3 "${v} + 3")
@@ -10,7 +8,6 @@ function(test_configure_line_number EXPRESSION POLICY)
message(SEND_ERROR "Couldn't configure CMAKE_CURRENT_LIST_LINE, evaluated into '${v}'")
endif()
message(STATUS "v='${v}'")
- cmake_policy(POP)
endfunction()
if(testname STREQUAL empty) # fail
@@ -45,16 +42,10 @@ elseif(testname STREQUAL configure_escape_quotes) # pass
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES)
message(STATUS "v='${v}'")
-elseif(testname STREQUAL configure_line_number_CMP0053_old) # pass
- test_configure_line_number("\${CMAKE_CURRENT_LIST_LINE}" OLD)
-
-elseif(testname STREQUAL configure_line_number_CMP0053_new) # pass
+elseif(testname STREQUAL configure_line_number_curly) # pass
test_configure_line_number("\${CMAKE_CURRENT_LIST_LINE}" NEW)
-elseif(testname STREQUAL configure_line_number_CMP0053_old_use_at) # pass
- test_configure_line_number("\@CMAKE_CURRENT_LIST_LINE\@" OLD)
-
-elseif(testname STREQUAL configure_line_number_CMP0053_new_use_at) # pass
+elseif(testname STREQUAL configure_line_number_at) # pass
test_configure_line_number("\@CMAKE_CURRENT_LIST_LINE\@" NEW)
elseif(testname STREQUAL configure_bogus) # fail
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
index a1a9709..253a035 100644
--- a/Tests/CPackComponentsForAll/CMakeLists.txt
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -7,7 +7,7 @@
# Depending on the CPack generator and on some CPACK_xxx var values
# the generator may produce a single (NSIS, productbuild)
# or several package files (Archive Generators, RPM, DEB)
-cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(CPackComponentsForAll)
# Use GNUInstallDirs in order to enforce lib64 if needed
diff --git a/Tests/CTestConfig/CTestConfig.cxx b/Tests/CTestConfig/CTestConfig.cxx
index 45c6c06..4ec8543 100644
--- a/Tests/CTestConfig/CTestConfig.cxx
+++ b/Tests/CTestConfig/CTestConfig.cxx
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
int i = 0;
for (; i < argc; ++i) {
diff --git a/Tests/CTestConfig/ScriptWithArgs.cmake b/Tests/CTestConfig/ScriptWithArgs.cmake
index 79896a7..4d63e22 100644
--- a/Tests/CTestConfig/ScriptWithArgs.cmake
+++ b/Tests/CTestConfig/ScriptWithArgs.cmake
@@ -1,5 +1,3 @@
-set(CTEST_RUN_CURRENT_SCRIPT 0)
-
macro(check_arg name expected_value)
message("${name}='${${name}}'")
if(NOT "${${name}}" STREQUAL "${expected_value}")
diff --git a/Tests/CTestLimitDashJ/CreateSleepDelete.cmake b/Tests/CTestLimitDashJ/CreateSleepDelete.cmake
index b09307f..f16deaa 100644
--- a/Tests/CTestLimitDashJ/CreateSleepDelete.cmake
+++ b/Tests/CTestLimitDashJ/CreateSleepDelete.cmake
@@ -1,5 +1,3 @@
-set(CTEST_RUN_CURRENT_SCRIPT 0)
-
if(NOT DEFINED basefilename)
message(FATAL_ERROR "pass -Dbasefilename=f1")
endif()
diff --git a/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in b/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in
index 45f0e37..5ff1bf2 100644
--- a/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in
+++ b/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in
@@ -6,9 +6,3 @@ set(CMAKE_CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_CMAKE_SYSTEM_NAME}")
message(FATAL_ERROR "Error: CMAKE_SYSTEM_NAME is \"${CMAKE_SYSTEM_NAME}\", but should be \"@CMAKE_SYSTEM_NAME@\"")
endif()
-
-# this seems to be necessary, otherwise ctest complains that these
-# variables are not set:
-set(CTEST_COMMAND "\"@CMAKE_CTEST_COMMAND@\"")
-set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestScriptMode/")
-set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestScriptMode/")
diff --git a/Tests/CTestTest/SmallAndFast/echoargs.c b/Tests/CTestTest/SmallAndFast/echoargs.c
index 19063b4..26c6349 100644
--- a/Tests/CTestTest/SmallAndFast/echoargs.c
+++ b/Tests/CTestTest/SmallAndFast/echoargs.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
int i = 0;
for (; i < argc; ++i) {
diff --git a/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx
index d2396b7..7cdee5f 100644
--- a/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx
+++ b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
unsigned int i =
0; // "i<argc" should produce a "signed/unsigned comparison" warning
diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in
index 23166a7..61d30a6 100644
--- a/Tests/CTestTest/test.cmake.in
+++ b/Tests/CTestTest/test.cmake.in
@@ -43,12 +43,6 @@ BUILDNAME:STRING=SmallAndFast-@BUILDNAME@
CMAKE_GENERATOR:INTERNAL=@CMAKE_GENERATOR@
CMAKE_GENERATOR_PLATFORM:INTERNAL=@CMAKE_GENERATOR_PLATFORM@
CMAKE_GENERATOR_TOOLSET:INTERNAL=@CMAKE_GENERATOR_TOOLSET@
-CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@
-CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@
-CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@
-CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@
-CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@
-CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@
DART_ROOT:PATH=
MEMORYCHECK_COMMAND:STRING=@MEMORYCHECK_COMMAND@
MEMORYCHECK_SUPPRESSIONS_FILE:FILEPATH=@MEMORYCHECK_SUPPRESSIONS_FILE@
diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in
index 6d833fe..9132396 100644
--- a/Tests/CTestTest2/test.cmake.in
+++ b/Tests/CTestTest2/test.cmake.in
@@ -28,12 +28,6 @@ endif()
#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY})
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
-CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@
-CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@
-CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@
-CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@
-CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@
-CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@
KWSYS_ENCODING_DEFAULT_CODEPAGE:STRING=CP_UTF8
# This one is needed for testing advanced ctest features
@@ -62,7 +56,13 @@ set(CTEST_DROP_LOCATION "@path@/submit.php?project=PublicDashboard")
CTEST_SUBMIT(RETURN_VALUE res)
-# Test submission of a subset of parts.
-set(CTEST_EXTRA_SUBMIT_FILES ${CTEST_NOTES_FILES})
-CTEST_SUBMIT(RETURN_VALUE res PARTS ExtraFiles)
-set(CTEST_EXTRA_SUBMIT_FILES)
+set(notes_glob "${CTEST_BINARY_DIRECTORY}/Testing/20[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/Notes.xml")
+file(GLOB notes_xml "${notes_glob}")
+if(notes_xml)
+ list(GET notes_xml -1 notes_xml)
+ set(CTEST_EXTRA_SUBMIT_FILES ${notes_xml})
+ CTEST_SUBMIT(RETURN_VALUE res PARTS ExtraFiles)
+ set(CTEST_EXTRA_SUBMIT_FILES)
+else()
+ message(SEND_ERROR "Notes.xml not found:\n ${notes_glob}")
+endif()
diff --git a/Tests/CTestTestCrash/crash.cxx b/Tests/CTestTestCrash/crash.cxx
index 88d4b1d..cd50f02 100644
--- a/Tests/CTestTestCrash/crash.cxx
+++ b/Tests/CTestTestCrash/crash.cxx
@@ -1,6 +1,6 @@
// causes a segfault
int main()
{
- volatile int* ptr = 0;
+ int volatile* ptr = 0;
*ptr = 1;
}
diff --git a/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in
index 3f8437c..e71d514 100644
--- a/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in
+++ b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.10)
-set(CTEST_RUN_CURRENT_SCRIPT 0)
-
set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestEmptyBinaryDirectory")
set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestEmptyBinaryDirectory")
diff --git a/Tests/CTestTestLabelRegExp/test.cmake.in b/Tests/CTestTestLabelRegExp/test.cmake.in
index dd40c3b..f1ccd3a 100644
--- a/Tests/CTestTestLabelRegExp/test.cmake.in
+++ b/Tests/CTestTestLabelRegExp/test.cmake.in
@@ -5,8 +5,8 @@ function(get_test_list TEST_LIST)
execute_process(COMMAND ${QUERY_COMMAND}
RESULT_VARIABLE RESULT
- OUTPUT_VARIABLE OUTPUT
- ERROR_VARIABLE ERROR)
+ OUTPUT_VARIABLE OUTPUT
+ ERROR_VARIABLE ERROR)
if(NOT ${RESULT} STREQUAL "0")
message(FATAL_ERROR "command [${QUERY_COMMAND}] failed: RESULT[${RESULT}] OUTPUT[${OUTPUT}] ERROR[${ERROR}]")
diff --git a/Tests/CTestTestLaunchers/test.cmake.in b/Tests/CTestTestLaunchers/test.cmake.in
index 21a3ed4..3c99857 100644
--- a/Tests/CTestTestLaunchers/test.cmake.in
+++ b/Tests/CTestTestLaunchers/test.cmake.in
@@ -22,15 +22,6 @@ function(run_test_case NAME WHAT)
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
- file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
- CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@
- CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@
- CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@
- CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@
- CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@
- CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@
- ")
-
ctest_start(Experimental)
ctest_configure(OPTIONS "-DCTEST_USE_LAUNCHERS=1")
ctest_build(NUMBER_ERRORS error_count)
diff --git a/Tests/CTestTestParallel/lockFile.c b/Tests/CTestTestParallel/lockFile.c
index a515107..d5e78ab 100644
--- a/Tests/CTestTestParallel/lockFile.c
+++ b/Tests/CTestTestParallel/lockFile.c
@@ -7,7 +7,7 @@ int main(void)
{
FILE* file;
int i;
- const char* fname = "lockedFile.txt";
+ char const* fname = "lockedFile.txt";
file = fopen(fname, "w");
for (i = 0; i < 10000; i++) {
diff --git a/Tests/CTestTestRunScript/hello.cmake.in b/Tests/CTestTestRunScript/hello.cmake.in
index 37905e3..4fa6446 100644
--- a/Tests/CTestTestRunScript/hello.cmake.in
+++ b/Tests/CTestTestRunScript/hello.cmake.in
@@ -1,2 +1 @@
-set(CTEST_RUN_CURRENT_SCRIPT 0)
message("hello world")
diff --git a/Tests/CTestTestRunScript/test.cmake.in b/Tests/CTestTestRunScript/test.cmake.in
index 3074a51..9e50f7f 100644
--- a/Tests/CTestTestRunScript/test.cmake.in
+++ b/Tests/CTestTestRunScript/test.cmake.in
@@ -1,2 +1 @@
-set(CTEST_RUN_CURRENT_SCRIPT 0)
CTEST_RUN_SCRIPT("CTestTestRunScript/hello.cmake" RETURN_VALUE res RETURN_VALUE)
diff --git a/Tests/CTestTestScheduler/CMakeLists.txt b/Tests/CTestTestScheduler/CMakeLists.txt
index 6f8cb4d..daf6ce2 100644
--- a/Tests/CTestTestScheduler/CMakeLists.txt
+++ b/Tests/CTestTestScheduler/CMakeLists.txt
@@ -1,9 +1,9 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.19)
project (CTestTestScheduler)
include (CTest)
add_executable (Sleep sleep.c)
foreach (time RANGE 1 4)
- add_test (TestSleep${time} Sleep ${time})
+ add_test ("TestSleep ${time}" Sleep ${time})
endforeach ()
diff --git a/Tests/CTestTestSerialInDepends/test.ctest b/Tests/CTestTestSerialInDepends/test.ctest
index cf0d314..a3e79f6 100644
--- a/Tests/CTestTestSerialInDepends/test.ctest
+++ b/Tests/CTestTestSerialInDepends/test.ctest
@@ -1,15 +1,13 @@
-set(CTEST_RUN_CURRENT_SCRIPT 0)
-
set(LOCK_FILE "${TEST_NAME}.lock")
# Delete the old lock file in case it's lingering from a previous failed test run
file(REMOVE "${LOCK_FILE}")
if("${TEST_NAME}" STREQUAL "i_want_to_be_alone")
- file(GLOB LOCK_FILES *.lock)
- if(LOCK_FILES)
- message(FATAL_ERROR "found lock files of other tests even though this test should be running by itself: ${LOCK_FILES}")
- endif()
+ file(GLOB LOCK_FILES *.lock)
+ if(LOCK_FILES)
+ message(FATAL_ERROR "found lock files of other tests even though this test should be running by itself: ${LOCK_FILES}")
+ endif()
endif()
file(WRITE "${LOCK_FILE}")
diff --git a/Tests/CTestTestUpload/sleep.c b/Tests/CTestTestUpload/sleep.c
index b9b6e89..2d69f7f 100644
--- a/Tests/CTestTestUpload/sleep.c
+++ b/Tests/CTestTestUpload/sleep.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+
#if defined(_WIN32)
# include <windows.h>
#else
diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake
index 467b41a..2ecc088 100644
--- a/Tests/CTestUpdateCommon.cmake
+++ b/Tests/CTestUpdateCommon.cmake
@@ -241,16 +241,16 @@ function(check_no_update bin_dir)
file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_REVISIONS
REGEX "^\t<(${rev_regex})>[^<\n]+</(${rev_regex})>$"
)
- set(found_revisons FALSE)
+ set(found_revisions FALSE)
foreach(r IN LISTS UPDATE_XML_REVISIONS)
if("${r}" MATCHES "PriorRevision")
message(FATAL_ERROR "Found PriorRevision in no update test")
endif()
if("${r}" MATCHES "<Revision>")
- set(found_revisons TRUE)
+ set(found_revisions TRUE)
endif()
endforeach()
- if(found_revisons)
+ if(found_revisions)
message(" found <Revision> in no update test")
else()
message(FATAL_ERROR " missing <Revision> in no update test")
diff --git a/Tests/CheckFortran.cmake b/Tests/CheckFortran.cmake
index 0dfeb5a..dcd4a78 100644
--- a/Tests/CheckFortran.cmake
+++ b/Tests/CheckFortran.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(NOT DEFINED CMAKE_Fortran_COMPILER)
diff --git a/Tests/CommandLineTest/CMakeLists.txt b/Tests/CommandLineTest/CMakeLists.txt
index 0d7b748..6c88574 100644
--- a/Tests/CommandLineTest/CMakeLists.txt
+++ b/Tests/CommandLineTest/CMakeLists.txt
@@ -19,9 +19,7 @@ EXEC_CMAKE_COMMAND(--help-command-list)
EXEC_CMAKE_COMMAND(--help add_executable)
EXEC_CMAKE_COMMAND(--help-command add_executable)
EXEC_CMAKE_COMMAND(--help-full "${CMAKE_CURRENT_BINARY_DIR}/cmake.txt")
-EXEC_CMAKE_COMMAND(--help-man "${CMAKE_CURRENT_BINARY_DIR}/cmake.man")
-EXEC_CMAKE_COMMAND(--help-html "${CMAKE_CURRENT_BINARY_DIR}/cmake.html")
-EXEC_CMAKE_COMMAND(--copyright "${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt")
+EXEC_CMAKE_COMMAND(--help-manual "cmake(1)" "${CMAKE_CURRENT_BINARY_DIR}/cmake.man")
EXEC_CMAKE_COMMAND(--version "${CMAKE_CURRENT_BINARY_DIR}/version.txt")
add_executable(CommandLineTest CommandLineTest.cxx)
@@ -49,10 +47,8 @@ EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N -I -10)
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N -I 10-)
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N -I 3,4)
EXEC_CTEST_COMMAND(--help)
-EXEC_CTEST_COMMAND(--copyright)
EXEC_CTEST_COMMAND(--help-full "${CMAKE_CURRENT_BINARY_DIR}/ctest.txt")
-EXEC_CTEST_COMMAND(--help-man "${CMAKE_CURRENT_BINARY_DIR}/ctest.man")
-EXEC_CTEST_COMMAND(--help-html "${CMAKE_CURRENT_BINARY_DIR}/ctest.html")
+EXEC_CTEST_COMMAND(--help-manual "ctest(1)" "${CMAKE_CURRENT_BINARY_DIR}/ctest.man")
EXEC_CTEST_COMMAND(--version)
if(THIS_SHOULD_BE_SET)
diff --git a/Tests/CompileDefinitions/compiletest.c b/Tests/CompileDefinitions/compiletest.c
index 6624866..764161e 100644
--- a/Tests/CompileDefinitions/compiletest.c
+++ b/Tests/CompileDefinitions/compiletest.c
@@ -13,10 +13,6 @@
# error Unexpected LINK_LANGUAGE_IS_CXX
#endif
-#ifdef DEBUG_MODE
-# error Unexpected DEBUG_MODE
-#endif
-
int main(void)
{
return 0;
diff --git a/Tests/CompileDefinitions/compiletest.cpp b/Tests/CompileDefinitions/compiletest.cpp
index 328e72e..109e4d2 100644
--- a/Tests/CompileDefinitions/compiletest.cpp
+++ b/Tests/CompileDefinitions/compiletest.cpp
@@ -15,9 +15,9 @@ struct CMakeStaticAssert<true>
{
};
-static const char fun_string[] = CMAKE_IS_;
+static char const fun_string[] = CMAKE_IS_;
#ifndef NO_SPACES_IN_DEFINE_VALUES
-static const char very_fun_string[] = CMAKE_IS_REALLY;
+static char const very_fun_string[] = CMAKE_IS_REALLY;
#endif
enum
diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
index 311975c..f47f7f0 100644
--- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt
+++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
@@ -35,9 +35,6 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
add_executable(target_prop_c_executable ../compiletest.c)
-cmake_policy(SET CMP0043 NEW)
-set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG_MODE)
-
set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 29174e5..5bbefe4 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0057 NEW)
project(CompileFeatures)
diff --git a/Tests/CompileFeatures/cxx_deleted_functions.cpp b/Tests/CompileFeatures/cxx_deleted_functions.cpp
index 4ecb1e9..4282cf7 100644
--- a/Tests/CompileFeatures/cxx_deleted_functions.cpp
+++ b/Tests/CompileFeatures/cxx_deleted_functions.cpp
@@ -1,6 +1,6 @@
struct A
{
- A(const A&) = delete;
- A& operator=(const A&) = delete;
+ A(A const&) = delete;
+ A& operator=(A const&) = delete;
};
diff --git a/Tests/CompileFeatures/cxx_raw_string_literals.cpp b/Tests/CompileFeatures/cxx_raw_string_literals.cpp
index 0f83a7c..0fa6929 100644
--- a/Tests/CompileFeatures/cxx_raw_string_literals.cpp
+++ b/Tests/CompileFeatures/cxx_raw_string_literals.cpp
@@ -1,7 +1,7 @@
void someFunc()
{
- const char p[] = R"(a\
+ char const p[] = R"(a\
b
c)";
}
diff --git a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp
index 953148d..ce2d7b5 100644
--- a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp
+++ b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp
@@ -9,7 +9,7 @@ struct X
int n;
};
-constexpr int g(const int (&is)[4])
+constexpr int g(int const (&is)[4])
{
X x;
int r = x.n;
diff --git a/Tests/CompileFeatures/cxx_unrestricted_unions.cpp b/Tests/CompileFeatures/cxx_unrestricted_unions.cpp
index f6d64f6..03bdd7c 100644
--- a/Tests/CompileFeatures/cxx_unrestricted_unions.cpp
+++ b/Tests/CompileFeatures/cxx_unrestricted_unions.cpp
@@ -13,5 +13,5 @@ union u
{
point p_;
int i_;
- const char* s_;
+ char const* s_;
};
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 3c1f995..ce27bde 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -19,31 +19,6 @@ function(message)
endfunction()
message("message")
-# Try setting a new policy. The IF test is for coverage.
-if(POLICY CMP0003)
- cmake_policy(SET CMP0003 NEW)
-
- cmake_policy(GET CMP0003 P3)
- if(NOT "${P3}" STREQUAL "NEW")
- message(FATAL_ERROR "cmake_policy(GET) did not report NEW!")
- endif()
-endif()
-
-# It is not recommended to set a policy to OLD, but this test
-# covers the OLD behavior of some policies.
-foreach(p
- CMP0029
- CMP0032
- CMP0033
- CMP0034
- CMP0043
- CMP0050
- )
- if(POLICY ${p})
- cmake_policy(SET ${p} OLD)
- endif()
-endforeach()
-
# Test building without per-rule echo lines in Makefiles.
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
@@ -115,18 +90,6 @@ endif()
add_definitions(-DCMAKE_IS_FUN)
add_definitions(-DCMAKE_IS_REALLY_FUN)
-set_property(DIRECTORY
- PROPERTY COMPILE_DEFINITIONS_RELEASE
- CMAKE_IS_FUN_IN_RELEASE_MODE
- )
-set_property(DIRECTORY
- PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO
- CMAKE_IS_FUN_IN_RELEASE_MODE
- )
-set_property(DIRECTORY
- PROPERTY COMPILE_DEFINITIONS_MINSIZEREL
- CMAKE_IS_FUN_IN_RELEASE_MODE
- )
set(TEST_SEP "a b c")
separate_arguments(TEST_SEP)
@@ -449,6 +412,3 @@ endif()
#
add_subdirectory(Library)
add_subdirectory(Executable)
-subdir_depends(Executable Library)
-export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake)
-include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL)
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index c8668b9..c382dd1 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -110,14 +110,14 @@ set_source_files_properties(complex
)
set_target_properties(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG")
add_custom_command(
- TARGET complex
- SOURCE ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
+ MAIN_DEPENDENCY ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
- OUTPUTS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
+ OUTPUT ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
DEPENDS ${CMAKE_COMMAND}
)
+target_sources(complex PRIVATE ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h)
# Test creating an executable that is not built by default.
add_executable(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
@@ -133,15 +133,6 @@ endif()
add_custom_target(notInAllCustom)
add_dependencies(notInAllCustom notInAllExe)
-#
-# Output the files required by 'complex' to a file.
-#
-# This test has been moved to the 'required' subdir so that it
-# has no side-effects on the current Makefile (duplicated source file
-# due to source list expansion done twice).
-#
-add_subdirectory(Temp)
-
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX
AND NOT XCODE) # XCODE is excluded due to #15687
add_executable(testSystemDir testSystemDir.cxx)
diff --git a/Tests/Complex/Executable/Included.cmake b/Tests/Complex/Executable/Included.cmake
index 520a68b..3c7ec8b 100644
--- a/Tests/Complex/Executable/Included.cmake
+++ b/Tests/Complex/Executable/Included.cmake
@@ -1,2 +1 @@
get_directory_property(LF_VALUE LISTFILE_STACK)
-
diff --git a/Tests/Complex/Executable/Temp/CMakeLists.txt b/Tests/Complex/Executable/Temp/CMakeLists.txt
deleted file mode 100644
index 041fcff..0000000
--- a/Tests/Complex/Executable/Temp/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Output the files required by 'complex' to a file.
-# The 'complex' executable will then test if this file exists and remove it.
-# The contents of this file is not tested (absolute paths).
-#
-output_required_files(
- ${Complex_SOURCE_DIR}/Executable/complex.cxx
- ${Complex_BINARY_DIR}/Executable/Temp/complex-required.txt)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 50f9932..9fa84ce 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -19,7 +19,7 @@ extern "C" {
#include <sys/stat.h>
#if !defined(S_ISDIR)
-# define S_ISDIR(mode) ((mode)&_S_IFDIR)
+# define S_ISDIR(mode) ((mode) & _S_IFDIR)
#endif
#ifdef COMPLEX_TEST_LINK_STATIC
@@ -32,7 +32,7 @@ int cm_passed = 0;
int cm_failed = 0;
// ======================================================================
-void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "")
+void cmFailed(char const* Message, char const* m2 = "", char const* m3 = "")
{
std::cout << "FAILED: " << Message << m2 << m3 << "\n";
cm_failed++;
@@ -40,7 +40,7 @@ void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "")
// ======================================================================
-void cmPassed(const char* Message, const char* m2 = "")
+void cmPassed(char const* Message, char const* m2 = "")
{
std::cout << "Passed: " << Message << m2 << "\n";
cm_passed++;
@@ -62,13 +62,9 @@ void cmPassed(const char* Message, const char* m2 = "")
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
#endif
-#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
-# error Per-configuration directory-level definition not inherited.
-#endif
-
// ======================================================================
-void TestAndRemoveFile(const char* filename)
+void TestAndRemoveFile(char const* filename)
{
struct stat st;
if (stat(filename, &st) < 0) {
@@ -87,7 +83,7 @@ void TestAndRemoveFile(const char* filename)
// ======================================================================
-void TestDir(const char* filename)
+void TestDir(char const* filename)
{
struct stat st;
if (stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) {
@@ -243,7 +239,7 @@ int main()
#endif
// ----------------------------------------------------------------------
- // Test SET, VARIABLE_REQUIRES
+ // Test SET
#ifdef SHOULD_NOT_BE_DEFINED
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined.");
@@ -269,13 +265,6 @@ int main()
cmPassed("ONE_VAR_AND_INDENTED is defined.");
#endif
-#ifndef ONE_VAR_IS_DEFINED
- cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, "
- "ONE_VAR_IS_DEFINED is not defined.");
-#else
- cmPassed("ONE_VAR_IS_DEFINED is defined.");
-#endif
-
#ifdef ZERO_VAR
cmFailed("cmakedefine is broken, ZERO_VAR is defined.");
#else
@@ -893,17 +882,6 @@ int main()
TestDir("make_dir");
// ----------------------------------------------------------------------
- // Test OUTPUT_REQUIRED_FILES
- // The files required by 'complex' have been output to a file.
- // The contents of this file is not tested (absolute paths).
- //
- // WARNING: if you run 'complex' manually, this *will* fail, because
- // the file was removed the last time 'complex' was run, and it is
- // only created during a build.
-
- TestAndRemoveFile("Executable/Temp/complex-required.txt");
-
- // ----------------------------------------------------------------------
// Test FIND_LIBRARY
#ifndef FIND_DUMMY_LIB
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
index 5ffb673..f70b557 100644
--- a/Tests/Complex/Library/CMakeLists.txt
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -1,11 +1,6 @@
remove_definitions(-DCMAKE_IS_REALLY_FUN)
-#
-# Small utility used to create file
-# UTILITY_SOURCE is used for coverage and for getting the exact name
-# of the executable.
-#
-utility_source(CREATE_FILE_EXE create_file "." create_file.cxx)
+set(CREATE_FILE_EXE create_file CACHE INTERNAL "") # make globally visible
add_executable(create_file create_file.cxx)
set_target_properties(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".")
diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake
index eacf84b..5dcf7a5 100644
--- a/Tests/Complex/VarTests.cmake
+++ b/Tests/Complex/VarTests.cmake
@@ -17,15 +17,6 @@ set(ONE_VAR2 1)
set(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
#
-# Test VARIABLE_REQUIRES
-#
-block(SCOPE_FOR POLICIES)
-cmake_policy(VERSION 2.8.12) # old enough to not set CMP0035
-variable_requires(ONE_VAR
- ONE_VAR_IS_DEFINED ONE_VAR)
-endblock()
-
-#
# Test various IF/ELSE combinations
#
if(NOT ZERO_VAR)
diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in
index 72317bc..63d47eb 100644
--- a/Tests/Complex/cmTestConfigure.h.in
+++ b/Tests/Complex/cmTestConfigure.h.in
@@ -1,8 +1,7 @@
-// Test SET, VARIABLE_REQUIRES
+// Test SET
#cmakedefine ONE_VAR
# cmakedefine ONE_VAR_AND_INDENTED
-#cmakedefine ONE_VAR_IS_DEFINED
#cmakedefine ZERO_VAR
# cmakedefine ZERO_VAR_AND_INDENTED
@@ -77,4 +76,3 @@
// test parenthesis in conditionals
#cmakedefine CONDITIONAL_PARENTHESES
-
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index e0e9289..8725980 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -12,31 +12,6 @@ string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
-# Try setting a new policy. The IF test is for coverage.
-if(POLICY CMP0003)
- cmake_policy(SET CMP0003 NEW)
-
- cmake_policy(GET CMP0003 P3)
- if(NOT "${P3}" STREQUAL "NEW")
- message(FATAL_ERROR "cmake_policy(GET) did not report NEW!")
- endif()
-endif()
-
-# It is not recommended to set a policy to OLD, but this test
-# covers the OLD behavior of some policies.
-foreach(p
- CMP0029
- CMP0032
- CMP0033
- CMP0034
- CMP0043
- CMP0050
- )
- if(POLICY ${p})
- cmake_policy(SET ${p} OLD)
- endif()
-endforeach()
-
# Test building without per-rule echo lines in Makefiles.
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
@@ -102,18 +77,6 @@ endif()
add_definitions(-DCMAKE_IS_FUN)
add_definitions(-DCMAKE_IS_REALLY_FUN)
-set_property(DIRECTORY
- PROPERTY COMPILE_DEFINITIONS_RELEASE
- CMAKE_IS_FUN_IN_RELEASE_MODE
- )
-set_property(DIRECTORY
- PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO
- CMAKE_IS_FUN_IN_RELEASE_MODE
- )
-set_property(DIRECTORY
- PROPERTY COMPILE_DEFINITIONS_MINSIZEREL
- CMAKE_IS_FUN_IN_RELEASE_MODE
- )
set(TEST_SEP "a b c")
separate_arguments(TEST_SEP)
@@ -406,6 +369,3 @@ endif()
#
add_subdirectory(Library)
add_subdirectory(Executable)
-subdir_depends(Executable Library)
-export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake)
-include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL)
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index a8ab17b..66c45e5 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -110,14 +110,14 @@ set_source_files_properties(complex
)
set_target_properties(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG")
add_custom_command(
- TARGET complex
- SOURCE ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
+ MAIN_DEPENDENCY ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
- OUTPUTS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
+ OUTPUT ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
DEPENDS ${CMAKE_COMMAND}
)
+target_sources(complex PRIVATE ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h)
# Test creating an executable that is not built by default.
add_executable(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
@@ -133,15 +133,6 @@ endif()
add_custom_target(notInAllCustom)
add_dependencies(notInAllCustom notInAllExe)
-#
-# Output the files required by 'complex' to a file.
-#
-# This test has been moved to the 'required' subdir so that it
-# has no side-effects on the current Makefile (duplicated source file
-# due to source list expansion done twice).
-#
-add_subdirectory(Temp)
-
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX
AND NOT XCODE) # XCODE is excluded due to #15687
add_executable(testSystemDir testSystemDir.cxx)
diff --git a/Tests/ComplexOneConfig/Executable/Included.cmake b/Tests/ComplexOneConfig/Executable/Included.cmake
index 520a68b..3c7ec8b 100644
--- a/Tests/ComplexOneConfig/Executable/Included.cmake
+++ b/Tests/ComplexOneConfig/Executable/Included.cmake
@@ -1,2 +1 @@
get_directory_property(LF_VALUE LISTFILE_STACK)
-
diff --git a/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt
deleted file mode 100644
index 041fcff..0000000
--- a/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Output the files required by 'complex' to a file.
-# The 'complex' executable will then test if this file exists and remove it.
-# The contents of this file is not tested (absolute paths).
-#
-output_required_files(
- ${Complex_SOURCE_DIR}/Executable/complex.cxx
- ${Complex_BINARY_DIR}/Executable/Temp/complex-required.txt)
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index f0fc2fe..92c921f 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -19,7 +19,7 @@ extern "C" {
#include <sys/stat.h>
#if !defined(S_ISDIR)
-# define S_ISDIR(mode) ((mode)&_S_IFDIR)
+# define S_ISDIR(mode) ((mode) & _S_IFDIR)
#endif
#ifdef COMPLEX_TEST_LINK_STATIC
@@ -32,7 +32,7 @@ int cm_passed = 0;
int cm_failed = 0;
// ======================================================================
-void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "")
+void cmFailed(char const* Message, char const* m2 = "", char const* m3 = "")
{
std::cout << "FAILED: " << Message << m2 << m3 << "\n";
cm_failed++;
@@ -40,7 +40,7 @@ void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "")
// ======================================================================
-void cmPassed(const char* Message, const char* m2 = "")
+void cmPassed(char const* Message, char const* m2 = "")
{
std::cout << "Passed: " << Message << m2 << "\n";
cm_passed++;
@@ -62,13 +62,9 @@ void cmPassed(const char* Message, const char* m2 = "")
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
#endif
-#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
-# error Per-configuration directory-level definition not inherited.
-#endif
-
// ======================================================================
-void TestAndRemoveFile(const char* filename)
+void TestAndRemoveFile(char const* filename)
{
struct stat st;
if (stat(filename, &st) < 0) {
@@ -87,7 +83,7 @@ void TestAndRemoveFile(const char* filename)
// ======================================================================
-void TestDir(const char* filename)
+void TestDir(char const* filename)
{
struct stat st;
if (stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) {
@@ -243,7 +239,7 @@ int main()
#endif
// ----------------------------------------------------------------------
- // Test SET, VARIABLE_REQUIRES
+ // Test SET
#ifdef SHOULD_NOT_BE_DEFINED
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined.");
@@ -269,13 +265,6 @@ int main()
cmPassed("ONE_VAR_AND_INDENTED is defined.");
#endif
-#ifndef ONE_VAR_IS_DEFINED
- cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, "
- "ONE_VAR_IS_DEFINED is not defined.");
-#else
- cmPassed("ONE_VAR_IS_DEFINED is defined.");
-#endif
-
#ifdef ZERO_VAR
cmFailed("cmakedefine is broken, ZERO_VAR is defined.");
#else
@@ -893,17 +882,6 @@ int main()
TestDir("make_dir");
// ----------------------------------------------------------------------
- // Test OUTPUT_REQUIRED_FILES
- // The files required by 'complex' have been output to a file.
- // The contents of this file is not tested (absolute paths).
- //
- // WARNING: if you run 'complex' manually, this *will* fail, because
- // the file was removed the last time 'complex' was run, and it is
- // only created during a build.
-
- TestAndRemoveFile("Executable/Temp/complex-required.txt");
-
- // ----------------------------------------------------------------------
// Test FIND_LIBRARY
#ifndef FIND_DUMMY_LIB
diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt
index 5ffb673..f70b557 100644
--- a/Tests/ComplexOneConfig/Library/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt
@@ -1,11 +1,6 @@
remove_definitions(-DCMAKE_IS_REALLY_FUN)
-#
-# Small utility used to create file
-# UTILITY_SOURCE is used for coverage and for getting the exact name
-# of the executable.
-#
-utility_source(CREATE_FILE_EXE create_file "." create_file.cxx)
+set(CREATE_FILE_EXE create_file CACHE INTERNAL "") # make globally visible
add_executable(create_file create_file.cxx)
set_target_properties(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".")
diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake
index 1e3a74f..e28d01b 100644
--- a/Tests/ComplexOneConfig/VarTests.cmake
+++ b/Tests/ComplexOneConfig/VarTests.cmake
@@ -17,15 +17,6 @@ set(ONE_VAR2 1)
set(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
#
-# Test VARIABLE_REQUIRES
-#
-block(SCOPE_FOR POLICIES)
-cmake_policy(VERSION 2.8.12) # old enough to not set CMP0035
-variable_requires(ONE_VAR
- ONE_VAR_IS_DEFINED ONE_VAR)
-endblock()
-
-#
# Test various IF/ELSE combinations
#
if(NOT ZERO_VAR)
diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in
index 72317bc..63d47eb 100644
--- a/Tests/ComplexOneConfig/cmTestConfigure.h.in
+++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in
@@ -1,8 +1,7 @@
-// Test SET, VARIABLE_REQUIRES
+// Test SET
#cmakedefine ONE_VAR
# cmakedefine ONE_VAR_AND_INDENTED
-#cmakedefine ONE_VAR_IS_DEFINED
#cmakedefine ZERO_VAR
# cmakedefine ZERO_VAR_AND_INDENTED
@@ -77,4 +76,3 @@
// test parenthesis in conditionals
#cmakedefine CONDITIONAL_PARENTHESES
-
diff --git a/Tests/Cuda/Complex/file2.cu b/Tests/Cuda/Complex/file2.cu
index 74f3558..ded4fa3 100644
--- a/Tests/Cuda/Complex/file2.cu
+++ b/Tests/Cuda/Complex/file2.cu
@@ -6,11 +6,11 @@ result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x)
{
if (x != 42) {
- const result_type r = file1_func(x);
- const result_type_dynamic rd{ r.input, r.sum, true };
+ result_type const r = file1_func(x);
+ result_type_dynamic const rd{ r.input, r.sum, true };
return rd;
} else {
- const result_type_dynamic rd{ x, x * x * x, false };
+ result_type_dynamic const rd{ x, x * x * x, false };
return rd;
}
}
diff --git a/Tests/Cuda/ProperDeviceLibraries/main.cu b/Tests/Cuda/ProperDeviceLibraries/main.cu
index 397804c..d0d570c 100644
--- a/Tests/Cuda/ProperDeviceLibraries/main.cu
+++ b/Tests/Cuda/ProperDeviceLibraries/main.cu
@@ -17,7 +17,7 @@ static int verify_linking_to_pthread()
// static libraries that have separable compilation device symbols
#if __CUDACC_VER_MAJOR__ <= 9
__global__ void deviceCublasSgemm(int n, float alpha, float beta,
- const float* d_A, const float* d_B,
+ float const* d_A, float const* d_B,
float* d_C)
{
cublasHandle_t cnpHandle;
diff --git a/Tests/Cuda/SharedRuntimePlusToolkit/nppif.cpp b/Tests/Cuda/SharedRuntimePlusToolkit/nppif.cpp
index 1e7350a..bdf4ea2 100644
--- a/Tests/Cuda/SharedRuntimePlusToolkit/nppif.cpp
+++ b/Tests/Cuda/SharedRuntimePlusToolkit/nppif.cpp
@@ -18,24 +18,24 @@ EXPORT int nppif_main()
/**
* 8-bit unsigned single-channel 1D row convolution.
*/
- const int simgrows = 32;
- const int simgcols = 32;
+ int const simgrows = 32;
+ int const simgcols = 32;
Npp8u *d_pSrc, *d_pDst;
- const int nMaskSize = 3;
+ int const nMaskSize = 3;
NppiSize oROI;
oROI.width = simgcols - nMaskSize;
oROI.height = simgrows;
- const int simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
- const int dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
- const int simgpix = simgrows * simgcols;
- const int dimgpix = oROI.width * oROI.height;
- const int nSrcStep = simgcols * sizeof(d_pSrc[0]);
- const int nDstStep = oROI.width * sizeof(d_pDst[0]);
- const int pixval = 1;
- const int nDivisor = 1;
- const Npp32s h_pKernel[nMaskSize] = { pixval, pixval, pixval };
+ int const simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
+ int const dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
+ int const simgpix = simgrows * simgcols;
+ int const dimgpix = oROI.width * oROI.height;
+ int const nSrcStep = simgcols * sizeof(d_pSrc[0]);
+ int const nDstStep = oROI.width * sizeof(d_pDst[0]);
+ int const pixval = 1;
+ int const nDivisor = 1;
+ Npp32s const h_pKernel[nMaskSize] = { pixval, pixval, pixval };
Npp32s* d_pKernel;
- const Npp32s nAnchor = 2;
+ Npp32s const nAnchor = 2;
cudaError_t err = cudaMalloc((void**)&d_pSrc, simgsize);
if (err != cudaSuccess) {
fprintf(stderr, "Cuda error %d\n", __LINE__);
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp
index 1e7350a..bdf4ea2 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp
@@ -18,24 +18,24 @@ EXPORT int nppif_main()
/**
* 8-bit unsigned single-channel 1D row convolution.
*/
- const int simgrows = 32;
- const int simgcols = 32;
+ int const simgrows = 32;
+ int const simgcols = 32;
Npp8u *d_pSrc, *d_pDst;
- const int nMaskSize = 3;
+ int const nMaskSize = 3;
NppiSize oROI;
oROI.width = simgcols - nMaskSize;
oROI.height = simgrows;
- const int simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
- const int dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
- const int simgpix = simgrows * simgcols;
- const int dimgpix = oROI.width * oROI.height;
- const int nSrcStep = simgcols * sizeof(d_pSrc[0]);
- const int nDstStep = oROI.width * sizeof(d_pDst[0]);
- const int pixval = 1;
- const int nDivisor = 1;
- const Npp32s h_pKernel[nMaskSize] = { pixval, pixval, pixval };
+ int const simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
+ int const dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
+ int const simgpix = simgrows * simgcols;
+ int const dimgpix = oROI.width * oROI.height;
+ int const nSrcStep = simgcols * sizeof(d_pSrc[0]);
+ int const nDstStep = oROI.width * sizeof(d_pDst[0]);
+ int const pixval = 1;
+ int const nDivisor = 1;
+ Npp32s const h_pKernel[nMaskSize] = { pixval, pixval, pixval };
Npp32s* d_pKernel;
- const Npp32s nAnchor = 2;
+ Npp32s const nAnchor = 2;
cudaError_t err = cudaMalloc((void**)&d_pSrc, simgsize);
if (err != cudaSuccess) {
fprintf(stderr, "Cuda error %d\n", __LINE__);
diff --git a/Tests/CudaOnly/CUBIN/main.cu b/Tests/CudaOnly/CUBIN/main.cu
index 1eb88b0..afc828e 100644
--- a/Tests/CudaOnly/CUBIN/main.cu
+++ b/Tests/CudaOnly/CUBIN/main.cu
@@ -11,7 +11,7 @@ static std::string input_paths = { CUBIN_FILE_PATHS };
int main()
{
- const std::string delimiter = "~_~";
+ std::string const delimiter = "~_~";
input_paths += delimiter;
size_t end = 0;
diff --git a/Tests/CudaOnly/Fatbin/main.cu b/Tests/CudaOnly/Fatbin/main.cu
index 627c9d6..55f2f6f 100644
--- a/Tests/CudaOnly/Fatbin/main.cu
+++ b/Tests/CudaOnly/Fatbin/main.cu
@@ -11,7 +11,7 @@ static std::string input_paths = { FATBIN_FILE_PATHS };
int main()
{
- const std::string delimiter = "~_~";
+ std::string const delimiter = "~_~";
input_paths += delimiter;
size_t end = 0;
diff --git a/Tests/CudaOnly/OptixIR/main.cu b/Tests/CudaOnly/OptixIR/main.cu
index 1238cbe..a2acf29 100644
--- a/Tests/CudaOnly/OptixIR/main.cu
+++ b/Tests/CudaOnly/OptixIR/main.cu
@@ -17,7 +17,7 @@ int main()
return 0;
}
- const std::string delimiter = "~_~";
+ std::string const delimiter = "~_~";
input_paths += delimiter;
size_t end = 0;
@@ -35,7 +35,7 @@ int main()
return 1;
}
- const std::uint32_t optix_magic_value = 0x7f4e43ed;
+ std::uint32_t const optix_magic_value = 0x7f4e43ed;
for (auto p : actual_paths) {
if (p.find(".optixir") == std::string::npos) {
std::cout << p << " Doesn't have the .optixir suffix" << p << std::endl;
diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/file2.cu b/Tests/CudaOnly/ResolveDeviceSymbols/file2.cu
index 0e5e7aa..1b56503 100644
--- a/Tests/CudaOnly/ResolveDeviceSymbols/file2.cu
+++ b/Tests/CudaOnly/ResolveDeviceSymbols/file2.cu
@@ -3,7 +3,7 @@
result_type_dynamic __device__ file2_func(int x)
{
- const result_type r = file1_func(x);
- const result_type_dynamic rd{ r.input, r.sum, true };
+ result_type const r = file1_func(x);
+ result_type_dynamic const rd{ r.input, r.sum, true };
return rd;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file2.cu b/Tests/CudaOnly/SeparateCompilation/file2.cu
index 74f3558..ded4fa3 100644
--- a/Tests/CudaOnly/SeparateCompilation/file2.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file2.cu
@@ -6,11 +6,11 @@ result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x)
{
if (x != 42) {
- const result_type r = file1_func(x);
- const result_type_dynamic rd{ r.input, r.sum, true };
+ result_type const r = file1_func(x);
+ result_type_dynamic const rd{ r.input, r.sum, true };
return rd;
} else {
- const result_type_dynamic rd{ x, x * x * x, false };
+ result_type_dynamic const rd{ x, x * x * x, false };
return rd;
}
}
diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu
index 1e7350a..bdf4ea2 100644
--- a/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu
+++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu
@@ -18,24 +18,24 @@ EXPORT int nppif_main()
/**
* 8-bit unsigned single-channel 1D row convolution.
*/
- const int simgrows = 32;
- const int simgcols = 32;
+ int const simgrows = 32;
+ int const simgcols = 32;
Npp8u *d_pSrc, *d_pDst;
- const int nMaskSize = 3;
+ int const nMaskSize = 3;
NppiSize oROI;
oROI.width = simgcols - nMaskSize;
oROI.height = simgrows;
- const int simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
- const int dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
- const int simgpix = simgrows * simgcols;
- const int dimgpix = oROI.width * oROI.height;
- const int nSrcStep = simgcols * sizeof(d_pSrc[0]);
- const int nDstStep = oROI.width * sizeof(d_pDst[0]);
- const int pixval = 1;
- const int nDivisor = 1;
- const Npp32s h_pKernel[nMaskSize] = { pixval, pixval, pixval };
+ int const simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
+ int const dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
+ int const simgpix = simgrows * simgcols;
+ int const dimgpix = oROI.width * oROI.height;
+ int const nSrcStep = simgcols * sizeof(d_pSrc[0]);
+ int const nDstStep = oROI.width * sizeof(d_pDst[0]);
+ int const pixval = 1;
+ int const nDivisor = 1;
+ Npp32s const h_pKernel[nMaskSize] = { pixval, pixval, pixval };
Npp32s* d_pKernel;
- const Npp32s nAnchor = 2;
+ Npp32s const nAnchor = 2;
cudaError_t err = cudaMalloc((void**)&d_pSrc, simgsize);
if (err != cudaSuccess) {
fprintf(stderr, "Cuda error %d\n", __LINE__);
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu
index 1e7350a..bdf4ea2 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu
@@ -18,24 +18,24 @@ EXPORT int nppif_main()
/**
* 8-bit unsigned single-channel 1D row convolution.
*/
- const int simgrows = 32;
- const int simgcols = 32;
+ int const simgrows = 32;
+ int const simgcols = 32;
Npp8u *d_pSrc, *d_pDst;
- const int nMaskSize = 3;
+ int const nMaskSize = 3;
NppiSize oROI;
oROI.width = simgcols - nMaskSize;
oROI.height = simgrows;
- const int simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
- const int dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
- const int simgpix = simgrows * simgcols;
- const int dimgpix = oROI.width * oROI.height;
- const int nSrcStep = simgcols * sizeof(d_pSrc[0]);
- const int nDstStep = oROI.width * sizeof(d_pDst[0]);
- const int pixval = 1;
- const int nDivisor = 1;
- const Npp32s h_pKernel[nMaskSize] = { pixval, pixval, pixval };
+ int const simgsize = simgrows * simgcols * sizeof(d_pSrc[0]);
+ int const dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]);
+ int const simgpix = simgrows * simgcols;
+ int const dimgpix = oROI.width * oROI.height;
+ int const nSrcStep = simgcols * sizeof(d_pSrc[0]);
+ int const nDstStep = oROI.width * sizeof(d_pDst[0]);
+ int const pixval = 1;
+ int const nDivisor = 1;
+ Npp32s const h_pKernel[nMaskSize] = { pixval, pixval, pixval };
Npp32s* d_pKernel;
- const Npp32s nAnchor = 2;
+ Npp32s const nAnchor = 2;
cudaError_t err = cudaMalloc((void**)&d_pSrc, simgsize);
if (err != cudaSuccess) {
fprintf(stderr, "Cuda error %d\n", __LINE__);
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 39bcd91..def6e86 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -6,7 +6,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(release_compile_defs DEFREL)
#Goal for this example:
-#build a executable that needs to be passed a complex define through add_defintions
+#build a executable that needs to be passed a complex define through add_definitions
#this verifies we can pass things such as '_','(' to nvcc
add_definitions("-DPACKED_DEFINE=__attribute__((packed))")
diff --git a/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt b/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt
index f7308e8..d1c6046 100644
--- a/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt
+++ b/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt
@@ -10,4 +10,3 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.h
)
add_library(GeneratedHeader main.cpp ${CMAKE_CURRENT_BINARY_DIR}/generated.h)
-
diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in
index 15d2d2c..69bb6cb 100644
--- a/Tests/CustomCommand/foo.in
+++ b/Tests/CustomCommand/foo.in
@@ -29,4 +29,3 @@ int main ()
return -1;
}
-
diff --git a/Tests/CustomCommand/wrapper.cxx b/Tests/CustomCommand/wrapper.cxx
index 33412f8..5b3311c 100644
--- a/Tests/CustomCommand/wrapper.cxx
+++ b/Tests/CustomCommand/wrapper.cxx
@@ -15,7 +15,7 @@ int main(int argc, char* argv[])
fprintf(fp, "int wrapped_help() { return 5; }\n");
fclose(fp);
#ifdef CMAKE_INTDIR
- const char* cfg = (argc >= 4) ? argv[3] : "";
+ char const* cfg = (argc >= 4) ? argv[3] : "";
if (strcmp(cfg, CMAKE_INTDIR) != 0) {
fprintf(stderr,
"Did not receive expected configuration argument:\n"
diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt
index 73a7fcc..24d9a7d 100644
--- a/Tests/CustomCommandByproducts/CMakeLists.txt
+++ b/Tests/CustomCommandByproducts/CMakeLists.txt
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0058 OLD)
project(CustomCommandByproducts C)
# Generate a byproduct in a rule that runs in the target consuming it.
@@ -203,10 +202,3 @@ target_link_libraries(
ExternalLibraryByproducts_WithInstallDirSubstitution
ExternalLibraryWithInstallDirSubstitution
)
-
-if(CMAKE_GENERATOR STREQUAL "Ninja")
- add_custom_target(CheckNinja ALL
- COMMENT "Checking build.ninja"
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/ninja-check.cmake
- )
-endif()
diff --git a/Tests/CustomCommandByproducts/ninja-check.cmake b/Tests/CustomCommandByproducts/ninja-check.cmake
deleted file mode 100644
index a7beb3d..0000000
--- a/Tests/CustomCommandByproducts/ninja-check.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-file(READ build.ninja build_ninja)
-if("${build_ninja}" MATCHES [====[
-# Unknown Build Time Dependencies.
-# Tell Ninja that they may appear as side effects of build rules
-# otherwise ordered by order-only dependencies.
-
-((build [^:]*: phony[^\n]*
-)*)# ========]====])
- set(phony "${CMAKE_MATCH_1}")
- if(NOT phony)
- message(STATUS "build.ninja correctly does not have extra phony rules")
- else()
- string(REGEX REPLACE "\n+$" "" phony "${phony}")
- string(REGEX REPLACE "\n" "\n " phony " ${phony}")
- message(FATAL_ERROR "build.ninja incorrectly has extra phony rules:\n"
- "${phony}")
- endif()
-else()
- message(FATAL_ERROR "build.ninja is incorrectly missing expected block")
-endif()
diff --git a/Tests/CustomCommandWorkingDirectory/working.c.in b/Tests/CustomCommandWorkingDirectory/working.c.in
index cf75bd1..e026ff1 100644
--- a/Tests/CustomCommandWorkingDirectory/working.c.in
+++ b/Tests/CustomCommandWorkingDirectory/working.c.in
@@ -4,4 +4,3 @@ int main()
{
return customTarget();
}
-
diff --git a/Tests/Dependency/Case1/CMakeLists.txt b/Tests/Dependency/Case1/CMakeLists.txt
index 4c5fc20..da9f54c 100644
--- a/Tests/Dependency/Case1/CMakeLists.txt
+++ b/Tests/Dependency/Case1/CMakeLists.txt
@@ -16,4 +16,3 @@ target_link_libraries(case1d case1c)
add_executable(hello main.c)
target_link_libraries(hello case1c case1b case1d case1c)
-
diff --git a/Tests/Dependency/Eight/CMakeLists.txt b/Tests/Dependency/Eight/CMakeLists.txt
index db5e2df..6e761d6 100644
--- a/Tests/Dependency/Eight/CMakeLists.txt
+++ b/Tests/Dependency/Eight/CMakeLists.txt
@@ -1,3 +1,2 @@
add_library( Eight EightSrc.c )
target_link_libraries( Eight Seven )
-
diff --git a/Tests/Dependency/Exec/CMakeLists.txt b/Tests/Dependency/Exec/CMakeLists.txt
index a920685..417477a 100644
--- a/Tests/Dependency/Exec/CMakeLists.txt
+++ b/Tests/Dependency/Exec/CMakeLists.txt
@@ -4,4 +4,3 @@
link_libraries( NoDepB NoDepC NoDepA SixB SixA )
add_executable( exec ExecMain.c )
-
diff --git a/Tests/Dependency/Exec2/CMakeLists.txt b/Tests/Dependency/Exec2/CMakeLists.txt
index 04d6fe8..ae439c5 100644
--- a/Tests/Dependency/Exec2/CMakeLists.txt
+++ b/Tests/Dependency/Exec2/CMakeLists.txt
@@ -9,4 +9,3 @@
link_libraries( Eight Five )
add_executable( exec2 ExecMain.c )
-
diff --git a/Tests/Dependency/Exec3/CMakeLists.txt b/Tests/Dependency/Exec3/CMakeLists.txt
index 605fbc9..7f981d6 100644
--- a/Tests/Dependency/Exec3/CMakeLists.txt
+++ b/Tests/Dependency/Exec3/CMakeLists.txt
@@ -3,4 +3,3 @@
link_libraries( Five Two Eight Five )
add_executable( exec3 ExecMain.c )
-
diff --git a/Tests/Dependency/Exec4/CMakeLists.txt b/Tests/Dependency/Exec4/CMakeLists.txt
index 94c6bf5..036d5e8 100644
--- a/Tests/Dependency/Exec4/CMakeLists.txt
+++ b/Tests/Dependency/Exec4/CMakeLists.txt
@@ -3,4 +3,3 @@
link_libraries( Five Two Five )
add_executable( exec4 ExecMain.c )
-
diff --git a/Tests/Dependency/Five/CMakeLists.txt b/Tests/Dependency/Five/CMakeLists.txt
index 19c1c77..03b3d01 100644
--- a/Tests/Dependency/Five/CMakeLists.txt
+++ b/Tests/Dependency/Five/CMakeLists.txt
@@ -1,3 +1,2 @@
add_library( Five FiveSrc.c )
target_link_libraries( Five Two )
-
diff --git a/Tests/Dependency/Seven/CMakeLists.txt b/Tests/Dependency/Seven/CMakeLists.txt
index 7fba55c..c5c585b 100644
--- a/Tests/Dependency/Seven/CMakeLists.txt
+++ b/Tests/Dependency/Seven/CMakeLists.txt
@@ -1,3 +1,2 @@
add_library( Seven SevenSrc.c )
target_link_libraries( Seven Two )
-
diff --git a/Tests/Dependency/Six/CMakeLists.txt b/Tests/Dependency/Six/CMakeLists.txt
index db12051..05eecdb 100644
--- a/Tests/Dependency/Six/CMakeLists.txt
+++ b/Tests/Dependency/Six/CMakeLists.txt
@@ -9,4 +9,3 @@ add_library( SixA SixASrc.c )
add_library( SixB SixBSrc.c )
target_link_libraries( SixB Four )
-
diff --git a/Tests/Dependency/Three/CMakeLists.txt b/Tests/Dependency/Three/CMakeLists.txt
index 3897f0c..4880243 100644
--- a/Tests/Dependency/Three/CMakeLists.txt
+++ b/Tests/Dependency/Three/CMakeLists.txt
@@ -1,3 +1,2 @@
add_library( Three ThreeSrc.c )
target_link_libraries( Three One Four )
-
diff --git a/Tests/EmptyProperty/CMakeLists.txt b/Tests/EmptyProperty/CMakeLists.txt
index 39e75f3..b6f393c 100644
--- a/Tests/EmptyProperty/CMakeLists.txt
+++ b/Tests/EmptyProperty/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.10)
project (EmptyProperty)
set_property(DIRECTORY APPEND
diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in
index f151dfd..f9f476d 100644
--- a/Tests/EnforceConfig.cmake.in
+++ b/Tests/EnforceConfig.cmake.in
@@ -29,11 +29,14 @@ if(NOT CTEST_CONFIGURATION_TYPE)
endif()
# Isolate tests from user configuration in the environment.
+unset(ENV{CLICOLOR})
+unset(ENV{CLICOLOR_FORCE})
unset(ENV{CMAKE_GENERATOR})
unset(ENV{CMAKE_GENERATOR_INSTANCE})
unset(ENV{CMAKE_GENERATOR_PLATFORM})
unset(ENV{CMAKE_GENERATOR_TOOLSET})
unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS})
+unset(ENV{CMAKE_POLICY_VERSION_MINIMUM})
# Verify that our module implementations do not recurse too much.
set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} 100)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index f6d32b8..3a6a0eb 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -1,5 +1,5 @@
set(CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_DEPENDENCIES "1942b4fa-b2c5-4546-9385-83f254070067")
-cmake_minimum_required(VERSION 2.8.11) # old enough to not set CMP0022
+cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
endif()
@@ -22,10 +22,9 @@ add_library(testExe2libImp SHARED testExe2libImp.c)
set_property(TARGET testExe2libImp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
add_library(testExe2lib SHARED testExe2lib.c)
target_link_libraries(testExe2lib testExe2libImp)
-set_property(TARGET testExe2lib PROPERTY LINK_INTERFACE_LIBRARIES "")
add_executable(testExe2 testExe2.c)
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)
-set_property(TARGET testExe2 PROPERTY LINK_INTERFACE_LIBRARIES testExe2lib)
+set_property(TARGET testExe2 PROPERTY INTERFACE_LINK_LIBRARIES testExe2lib)
add_library(compileOnly INTERFACE)
target_compile_definitions(compileOnly INTERFACE FROM_compileOnly)
@@ -36,7 +35,6 @@ target_link_libraries(noUses INTERFACE this::target_does_not_exist)
add_library(testLib1 STATIC testLib1.c)
add_library(testLib2 STATIC testLib2.c)
-target_link_libraries(testLib2 testLib1)
target_link_libraries(testLib2
PRIVATE
testLib1
@@ -68,7 +66,6 @@ set_property(TARGET testLib3Imp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
target_link_libraries(testLib3Imp testLib3ImpDep)
add_library(testLib3 SHARED testLib3.c)
target_link_libraries(testLib3 testLib3Imp)
-set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "")
set_property(TARGET testLib3 PROPERTY VERSION 1.2)
set_property(TARGET testLib3 PROPERTY SOVERSION 3)
@@ -108,8 +105,6 @@ else()
set(maybe_OBJECTS_DESTINATION "")
endif()
-cmake_policy(PUSH)
-cmake_policy(SET CMP0022 NEW)
add_library(testLib9ObjPub OBJECT testLib9ObjPub.c)
target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED)
add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c)
@@ -119,41 +114,37 @@ target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED)
add_library(testLib9 STATIC testLib9.c)
target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv)
target_link_libraries(testLib9 PUBLIC Foo::Foo)
-cmake_policy(POP)
-block()
- cmake_policy(SET CMP0022 NEW)
- add_library(testLib10 STATIC testLib10.c)
- set_target_properties(testLib10 PROPERTIES
- TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
- TRANSITIVE_LINK_PROPERTIES "CUSTOM_L"
- INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C"
- INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L"
- )
- target_compile_definitions(testLib10 INTERFACE
- "$<TARGET_PROPERTY:CUSTOM_C>"
- "$<TARGET_PROPERTY:CUSTOM_L>"
- )
- add_library(testLib11 STATIC testLib11.c)
- target_link_libraries(testLib11 PRIVATE testLib10)
- set_target_properties(testLib11 PROPERTIES
- INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C"
- INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L"
- TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D"
- TRANSITIVE_LINK_PROPERTIES "CUSTOM_M"
- INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D"
- INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M"
- )
- target_compile_definitions(testLib11 INTERFACE
- "$<TARGET_PROPERTY:CUSTOM_C>"
- "$<TARGET_PROPERTY:CUSTOM_D>"
- "$<TARGET_PROPERTY:CUSTOM_L>"
- "$<TARGET_PROPERTY:CUSTOM_M>"
- )
-endblock()
+add_library(testLib10 STATIC testLib10.c)
+set_target_properties(testLib10 PROPERTIES
+ TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
+ TRANSITIVE_LINK_PROPERTIES "CUSTOM_L"
+ INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C"
+ INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L"
+ )
+target_compile_definitions(testLib10 INTERFACE
+ "$<TARGET_PROPERTY:CUSTOM_C>"
+ "$<TARGET_PROPERTY:CUSTOM_L>"
+ )
+add_library(testLib11 STATIC testLib11.c)
+target_link_libraries(testLib11 PRIVATE testLib10)
+set_target_properties(testLib11 PROPERTIES
+ INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C"
+ INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L"
+ TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D"
+ TRANSITIVE_LINK_PROPERTIES "CUSTOM_M"
+ INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D"
+ INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M"
+ )
+target_compile_definitions(testLib11 INTERFACE
+ "$<TARGET_PROPERTY:CUSTOM_C>"
+ "$<TARGET_PROPERTY:CUSTOM_D>"
+ "$<TARGET_PROPERTY:CUSTOM_L>"
+ "$<TARGET_PROPERTY:CUSTOM_M>"
+ )
# Test using the target_link_libraries command to set the
-# LINK_INTERFACE_LIBRARIES* properties. We construct two libraries
+# INTERFACE_LINK_LIBRARIES properties. We construct two libraries
# providing the same two symbols. In each library one of the symbols
# will work and the other one will fail to link. The import part of
# this test will try to use the symbol corresponding to the
@@ -166,7 +157,7 @@ set_property(TARGET testLib4libdbg PROPERTY COMPILE_DEFINITIONS LIB_DBG)
set_property(TARGET testLib4libopt PROPERTY COMPILE_DEFINITIONS LIB_OPT)
target_link_libraries(testLib4
LINK_INTERFACE_LIBRARIES
- testLib4lib debug testLib4libdbg optimized testLib4libopt
+ testLib4lib debug $<TARGET_NAME:testLib4libdbg> optimized $<TARGET_NAME:testLib4libopt>
)
add_executable(testExe3 testExe3.c)
@@ -219,9 +210,6 @@ install(
DESTINATION include/testInterfaceIncludeUser
)
-cmake_policy(PUSH)
-cmake_policy(SET CMP0022 NEW)
-
# Test control over direct linking.
include(../../InterfaceLinkLibrariesDirect/testStaticLibPlugin.cmake)
include(../../InterfaceLinkLibrariesDirect/testSharedLibWithHelper.cmake)
@@ -237,10 +225,8 @@ add_library(testLibDepends testLibDepends.c)
target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired)
add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c)
target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate)
-cmake_policy(POP)
cmake_policy(PUSH)
-cmake_policy(SET CMP0022 NEW)
cmake_policy(SET CMP0079 NEW)
add_library(TopDirLib STATIC testTopDirLib.c)
add_subdirectory(SubDirLinkA)
@@ -387,8 +373,6 @@ install(FILES
DESTINATION include/testSharedLibRequiredUser
)
-cmake_policy(PUSH)
-cmake_policy(SET CMP0022 NEW)
add_library(testSharedLibRequiredUser2 SHARED testSharedLibRequiredUser2.cpp)
generate_export_header(testSharedLibRequiredUser2)
set_property(TARGET testSharedLibRequiredUser2 APPEND PROPERTY
@@ -401,7 +385,6 @@ install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequireduser2_export.h"
DESTINATION include/testSharedLibRequiredUser2
)
-cmake_policy(POP)
cmake_policy(PUSH)
cmake_policy(SET CMP0041 NEW)
@@ -426,28 +409,17 @@ set_property(TARGET testSharedLibDepends APPEND PROPERTY
)
cmake_policy(POP)
-# LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above.
target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired)
target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export)
-target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES
+target_link_libraries(testSharedLibDepends INTERFACE
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>)
-cmake_policy(PUSH)
-cmake_policy(SET CMP0022 OLD)
-add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp)
-generate_export_header(cmp0022OLD BASE_NAME cmp0022)
-target_include_directories(cmp0022OLD PUBLIC
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
- "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
-)
-cmake_policy(SET CMP0022 NEW)
add_library(cmp0022NEW SHARED cmp0022_vs6_1.cpp)
-set_property(TARGET cmp0022NEW PROPERTY DEFINE_SYMBOL cmp0022OLD_EXPORTS)
+generate_export_header(cmp0022NEW BASE_NAME cmp0022)
target_include_directories(cmp0022NEW PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
)
-cmake_policy(POP)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h"
"${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h"
@@ -466,9 +438,6 @@ set_property(TARGET testLib4 PROPERTY
EXPORT_PROPERTIES EXPORTED_PROPERTY2 EXPORTED_PROPERTY3)
set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
-# set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error
-set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
-set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3)
add_library(noIncludesInterface empty.cpp)
@@ -622,7 +591,7 @@ install(
testSharedLibWithHelper testSharedLibHelperObj
testExeWithPluginHelper testExePluginHelperObj
testMod1 testMod2
- cmp0022NEW cmp0022OLD
+ cmp0022NEW
TopDirLib SubDirLinkA
systemlib
testInterfaceIncludeUser
@@ -684,7 +653,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
testExe2libImp testLib3Imp testLib3ImpDep subdirlib
testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2
testSharedLibDepends renamed_on_export
- cmp0022NEW cmp0022OLD
+ cmp0022NEW
TopDirLib SubDirLinkA
systemlib noUses
testInterfaceIncludeUser
diff --git a/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c
index e5da196..4063cde 100644
--- a/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c
+++ b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep1(void);
+extern void
+dep1(void);
#ifdef _WIN32
__declspec(dllexport)
diff --git a/Tests/ExportImport/Export/testExe1.c b/Tests/ExportImport/Export/testExe1.c
index 5fbb892..fce40b3 100644
--- a/Tests/ExportImport/Export/testExe1.c
+++ b/Tests/ExportImport/Export/testExe1.c
@@ -2,7 +2,7 @@
extern int testExe1lib(void);
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
if (argc < 2) {
fprintf(stderr, "Must specify output file.\n");
diff --git a/Tests/ExportImport/Export/testExe3.c b/Tests/ExportImport/Export/testExe3.c
index 2b07576..249f4ff 100644
--- a/Tests/ExportImport/Export/testExe3.c
+++ b/Tests/ExportImport/Export/testExe3.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
if (argc < 2) {
fprintf(stderr, "Must specify output file.\n");
diff --git a/Tests/ExportImport/Export/testExe4.c b/Tests/ExportImport/Export/testExe4.c
index 422ab3d..46c5635 100644
--- a/Tests/ExportImport/Export/testExe4.c
+++ b/Tests/ExportImport/Export/testExe4.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
if (argc < 2) {
fprintf(stderr, "Must specify output file.\n");
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 7d933a4..8b1c11a 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -186,13 +186,9 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND
endforeach()
endif()
-add_executable(cmp0022OLD_test cmp0022OLD_test_vs6_1.cpp)
-target_link_libraries(cmp0022OLD_test bld_cmp0022OLD)
add_executable(cmp0022NEW_test cmp0022NEW_test_vs6_1.cpp)
target_link_libraries(cmp0022NEW_test bld_cmp0022NEW)
-add_executable(cmp0022OLD_exp_test cmp0022OLD_test_vs6_2.cpp)
-target_link_libraries(cmp0022OLD_exp_test exp_cmp0022OLD)
add_executable(cmp0022NEW_exp_test cmp0022NEW_test_vs6_2.cpp)
target_link_libraries(cmp0022NEW_exp_test exp_cmp0022NEW)
@@ -213,10 +209,8 @@ target_link_libraries(imp_ExePlugin1b PRIVATE bld_testExeWithPluginHelper testEx
# Export/CMakeLists.txt pretends the RelWithDebInfo (as well as Debug)
# configuration should link to debug libs.
-foreach(c DEBUG RELWITHDEBINFO)
- set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
- set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
-endforeach()
+target_compile_definitions(imp_testExe1 PRIVATE "$<$<CONFIG:Debug,RelWithDebInfo>:EXE_DBG>")
+target_compile_definitions(imp_testExe1b PRIVATE "$<$<CONFIG:Debug,RelWithDebInfo>:EXE_DBG>")
#-----------------------------------------------------------------------------
include(${CMAKE_INSTALL_PREFIX}/lib/expAbs/expAbs.cmake)
@@ -427,32 +421,16 @@ target_link_libraries(iface_test_bld bld_testSharedLibDepends)
set_property(TARGET iface_test_bld PROPERTY NO_SYSTEM_FROM_IMPORTED 1)
set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
- LINK_INTERFACE_LIBRARIES
+ INTERFACE_LINK_LIBRARIES
excludedFromAll
)
-get_target_property(_configs bld_testSharedLibRequired IMPORTED_CONFIGURATIONS)
-foreach(_config ${_configs})
- set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
- IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
- excludedFromAll
- )
-endforeach()
-unset(_configs)
add_executable(iface_test_exp iface_test.cpp)
target_link_libraries(iface_test_exp testSharedLibDepends)
set_property(TARGET testSharedLibDepends APPEND PROPERTY
- LINK_INTERFACE_LIBRARIES
+ INTERFACE_LINK_LIBRARIES
excludedFromAll
)
-get_target_property(_configs testSharedLibDepends IMPORTED_CONFIGURATIONS)
-foreach(_config ${_configs})
- set_property(TARGET testSharedLibDepends APPEND PROPERTY
- IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
- excludedFromAll
- )
-endforeach()
-unset(_configs)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
OR CMAKE_C_COMPILER_ID MATCHES "LCC"
diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp
deleted file mode 100644
index 9eaaee9..0000000
--- a/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#ifdef USING_TESTLIB2
-# error Unexpected USING_TESTLIB2
-#endif
-#ifndef USING_TESTLIB3
-# error Expected USING_TESTLIB3
-#endif
-
-int main(void)
-{
- return 0;
-}
diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp
deleted file mode 100644
index 90d804c..0000000
--- a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "cmp0022OLD_test.cpp"
diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp
deleted file mode 100644
index 90d804c..0000000
--- a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "cmp0022OLD_test.cpp"
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt
index f3fff53..fdc07ed 100644
--- a/Tests/ExportImport/Import/CMakeLists.txt
+++ b/Tests/ExportImport/Import/CMakeLists.txt
@@ -1,5 +1,4 @@
cmake_minimum_required (VERSION 3.10)
-cmake_policy(SET CMP0043 OLD)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
endif()
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake
index 447a5b6..8b193f6 100644
--- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake
@@ -4,7 +4,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
check_installed([[^lib;lib/libdep8\.so;lib/liblib\.so;subdir;subdir/bin;subdir/bin/exe1;subdir/bin/exe2;subdir/lib;subdir/lib/libdep10\.so;subdir/lib/libdep11\.so;subdir/lib/libdep2\.so\.1;subdir/lib/libdep2\.so\.1\.2\.3;subdir/lib/libdep3\.so;subdir/lib/libdep5\.so;subdir/lib/libdep6\.so;subdir/lib/libdep8\.so;subdir/lib/libdep9\.so;subdir/lib/liblib\.so;subdir/lib/libmod\.so;subdir/lib/libsublib1\.so$]])
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(_msvc_check [[bin;bin/dep8\.dll;bin/lib\.dll;lib;lib/lib\.(lib|l);subdir;subdir/bin;subdir/bin/dep10\.dll;subdir/bin/dep11\.dll;subdir/bin/dep2\.dll;subdir/bin/dep3\.dll;subdir/bin/dep5\.dll;subdir/bin/dep6\.dll;subdir/bin/dep8\.dll;subdir/bin/dep9\.dll;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/lib\.dll;subdir/bin/sublib1\.dll;subdir/lib;subdir/lib/mod\.dll]])
- set(_mingw_check [[bin;bin/libdep8\.dll;bin/liblib\.dll;lib;lib/liblib\.dll\.a;lib/liblib\.lib;subdir;subdir/bin;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/libdep10\.dll;subdir/bin/libdep11\.dll;subdir/bin/libdep2\.dll;subdir/bin/libdep3\.dll;subdir/bin/libdep5\.dll;subdir/bin/libdep6\.dll;subdir/bin/libdep8\.dll;subdir/bin/libdep9\.dll;subdir/bin/liblib\.dll;subdir/bin/libsublib1\.dll;subdir/lib;subdir/lib/libmod\.dll]])
+ set(_mingw_check [[bin;bin/libdep8\.dll;bin/liblib\.dll;lib;lib/liblib\.dll\.a(;lib/liblib\.lib)?;subdir;subdir/bin;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/libdep10\.dll;subdir/bin/libdep11\.dll;subdir/bin/libdep2\.dll;subdir/bin/libdep3\.dll;subdir/bin/libdep5\.dll;subdir/bin/libdep6\.dll;subdir/bin/libdep8\.dll;subdir/bin/libdep9\.dll;subdir/bin/liblib\.dll;subdir/bin/libsublib1\.dll;subdir/lib;subdir/lib/libmod\.dll]])
check_installed("^(${_msvc_check}|${_mingw_check})$")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
check_installed([[^lib;lib/libdep8\.dylib;lib/liblib\.dylib;subdir;subdir/bin;subdir/bin/exe1;subdir/bin/exe2;subdir/frameworks;subdir/frameworks/dep9\.framework;subdir/frameworks/dep9\.framework/Resources;subdir/frameworks/dep9\.framework/Versions;subdir/frameworks/dep9\.framework/Versions/A;subdir/frameworks/dep9\.framework/Versions/A/Resources;subdir/frameworks/dep9\.framework/Versions/A/Resources/Info\.plist(;subdir/frameworks/dep9.framework/Versions/A/_CodeSignature;subdir/frameworks/dep9.framework/Versions/A/_CodeSignature/CodeResources)?;subdir/frameworks/dep9\.framework/Versions/A/dep9;subdir/frameworks/dep9\.framework/Versions/Current;subdir/frameworks/dep9\.framework/dep9;subdir/lib;subdir/lib/libdep10\.dylib;subdir/lib/libdep11\.dylib;subdir/lib/libdep2\.1\.2\.3\.dylib;subdir/lib/libdep2\.1\.dylib;subdir/lib/libdep3\.dylib;subdir/lib/libdep5\.dylib;subdir/lib/libdep6\.dylib;subdir/lib/libdep8\.dylib;subdir/lib/liblib\.dylib;subdir/lib/libmod\.so;subdir/lib/libsublib1\.dylib$]])
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c
index 9a64887..ff542d3 100644
--- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep8(void);
+extern void
+dep8(void);
#ifdef _WIN32
__declspec(dllexport)
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c
index d001299..ab4a878 100644
--- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep9(void);
+extern void
+dep9(void);
#ifdef _WIN32
__declspec(dllexport)
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c
index f17b902..c763116 100644
--- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep6(void);
+extern void
+dep6(void);
#ifdef _WIN32
__declspec(dllexport)
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c
index 61b5c83..5c303fe 100644
--- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep7(void);
+extern void
+dep7(void);
#ifdef _WIN32
__declspec(dllexport)
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c
index b359498..caeda76 100644
--- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c
@@ -1,11 +1,13 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep3(void);
+extern void
+dep3(void);
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void dep4(void);
+extern void
+dep4(void);
int main(void)
{
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 3d00673..1208152 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -168,7 +168,7 @@ if(EP_TEST_CVS)
ExternalProject_Add(${proj}
SOURCE_DIR ${local_cvs_repo}
URL ${CMAKE_CURRENT_SOURCE_DIR}/cvsrepo.tgz
- URL_MD5 55fc85825ffdd9ed2597123c68b79f7e
+ URL_MD5 287399370738adfe932e036cbe38d5b0
BUILD_COMMAND ""
CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version
INSTALL_COMMAND ""
@@ -190,11 +190,11 @@ if(EP_TEST_CVS)
# CVS by date stamp:
#
- set(proj TutorialStep1-CVS-20090626)
+ set(proj TutorialStep1-CVS-20241115)
ExternalProject_Add(${proj}
CVS_REPOSITORY ":local:${local_cvs_repo}"
CVS_MODULE "TutorialStep1"
- CVS_TAG "-D2009-06-26 16:50:00 UTC"
+ CVS_TAG "-D2024-11-15 23:11:00 UTC"
UPDATE_COMMAND ""
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
@@ -229,7 +229,7 @@ if(EP_TEST_CVS)
INSTALL_COMMAND ""
DEPENDS "SetupLocalCVSRepository"
DEPENDS "EmptyNoOpProject"
- DEPENDS "TutorialStep1-CVS-20090626"
+ DEPENDS "TutorialStep1-CVS-20241115"
DEPENDS "TutorialStep1-CVS-testtag1"
)
set_property(TARGET ${proj} PROPERTY FOLDER "CVS")
@@ -248,7 +248,7 @@ if(EP_TEST_SVN)
ExternalProject_Add(${proj}
SOURCE_DIR ${local_svn_repo}
URL ${CMAKE_CURRENT_SOURCE_DIR}/svnrepo.tgz
- URL_MD5 2f468be4ed1fa96377fca0cc830819c4
+ URL_MD5 0d75c80611c998e36c36f4a9e1e739d0
BUILD_COMMAND ""
CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version
INSTALL_COMMAND ""
@@ -258,10 +258,10 @@ if(EP_TEST_SVN)
# SVN by date stamp:
#
- set(proj TutorialStep1-SVN-20090626)
+ set(proj TutorialStep1-SVN-20241115)
ExternalProject_Add(${proj}
SVN_REPOSITORY "${local_svn_repo_url}"
- SVN_REVISION "-r{2009-06-26 16:50:00 +0000}"
+ SVN_REVISION "-r{2024-11-15 23:23:00 +0000}"
UPDATE_COMMAND ""
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
@@ -272,10 +272,10 @@ if(EP_TEST_SVN)
# SVN by revision number:
#
- set(proj TutorialStep1-SVN-r2)
+ set(proj TutorialStep1-SVN-r3)
ExternalProject_Add(${proj}
SVN_REPOSITORY "${local_svn_repo_url}"
- SVN_REVISION "-r2"
+ SVN_REVISION "-r3"
UPDATE_COMMAND ""
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
@@ -320,7 +320,7 @@ if(EP_TEST_GIT)
set(proj TutorialStep1-GIT-byhash)
ExternalProject_Add(${proj}
GIT_REPOSITORY "${local_git_repo}"
- GIT_TAG 57418671a0a0e371e7bac532337152595fbe0df5 # generated by gitrepo.bash
+ GIT_TAG 4ed00009457732fc8b6d75f6159bbc384119c3d1 # generated by gitrepo.bash
UPDATE_COMMAND ""
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
@@ -568,7 +568,7 @@ if(EP_TEST_HG)
set(proj TutorialStep1-HG-byhash)
ExternalProject_Add(${proj}
HG_REPOSITORY "${local_hg_repo}"
- HG_TAG dd2ce38a6b8a
+ HG_TAG fc5a0c915390
UPDATE_COMMAND ""
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
@@ -621,8 +621,8 @@ enable_testing()
# BuildTree tests:
#
if(EP_TEST_CVS)
- add_test(TutorialStep1-CVS-20090626-BuildTreeTest
- "${binary_base}/TutorialStep1-CVS-20090626/Tutorial" 4)
+ add_test(TutorialStep1-CVS-20241115-BuildTreeTest
+ "${binary_base}/TutorialStep1-CVS-20241115/Tutorial" 4)
add_test(TutorialStep1-CVS-testtag1-BuildTreeTest
"${binary_base}/TutorialStep1-CVS-testtag1/Tutorial" 64)
@@ -632,11 +632,11 @@ if(EP_TEST_CVS)
endif()
if(EP_TEST_SVN)
- add_test(TutorialStep1-SVN-20090626-BuildTreeTest
- "${binary_base}/TutorialStep1-SVN-20090626/Tutorial" 100)
+ add_test(TutorialStep1-SVN-20241115-BuildTreeTest
+ "${binary_base}/TutorialStep1-SVN-20241115/Tutorial" 100)
- add_test(TutorialStep1-SVN-r2-BuildTreeTest
- "${binary_base}/TutorialStep1-SVN-r2/Tutorial" 99)
+ add_test(TutorialStep1-SVN-r3-BuildTreeTest
+ "${binary_base}/TutorialStep1-SVN-r3/Tutorial" 99)
add_test(TutorialStep1-SVN-trunk-BuildTreeTest
"${binary_base}/TutorialStep1-SVN-trunk/Tutorial" 98)
diff --git a/Tests/ExternalProject/cvsrepo.tgz b/Tests/ExternalProject/cvsrepo.tgz
index baba6d3..25bb7c3 100644
--- a/Tests/ExternalProject/cvsrepo.tgz
+++ b/Tests/ExternalProject/cvsrepo.tgz
Binary files differ
diff --git a/Tests/ExternalProject/gitrepo-sub-rec.tgz b/Tests/ExternalProject/gitrepo-sub-rec.tgz
index 0e63651..838d212 100644
--- a/Tests/ExternalProject/gitrepo-sub-rec.tgz
+++ b/Tests/ExternalProject/gitrepo-sub-rec.tgz
Binary files differ
diff --git a/Tests/ExternalProject/gitrepo-sub.tgz b/Tests/ExternalProject/gitrepo-sub.tgz
index ab34fff..20ec5b8 100644
--- a/Tests/ExternalProject/gitrepo-sub.tgz
+++ b/Tests/ExternalProject/gitrepo-sub.tgz
Binary files differ
diff --git a/Tests/ExternalProject/gitrepo.bash b/Tests/ExternalProject/gitrepo.bash
index c341f28..fd03c81 100755
--- a/Tests/ExternalProject/gitrepo.bash
+++ b/Tests/ExternalProject/gitrepo.bash
@@ -13,6 +13,9 @@ export GIT_AUTHOR_NAME='testauthor'
export GIT_AUTHOR_EMAIL='testauthor@cmake.org'
export GIT_COMMITTER_NAME='testauthor'
export GIT_COMMITTER_EMAIL='testauthor@cmake.org'
+export GIT_CONFIG_NOSYSTEM=1
+export GIT_CONFIG_GLOBAL="$tmpdir/.gitconfig"
+git config --global protocol.file.allow always
(
cd "$tmpdir"
@@ -23,7 +26,7 @@ rm -f gitrepo.git/hooks/*.sample
mkdir gitrepo
cd gitrepo
git init -b "$defaultBranch"
-echo 'cmake_minimum_required(VERSION 3.19)
+echo 'cmake_minimum_required(VERSION 3.31)
project(Example NONE)
add_custom_target(example ALL
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/example.cmake.in example.cmake
@@ -43,7 +46,7 @@ rm -f gitrepo-sub.git/hooks/*.sample
mkdir gitrepo-sub
cd gitrepo-sub
git init -b "$defaultBranch"
-echo 'cmake_minimum_required(VERSION 3.19)
+echo 'cmake_minimum_required(VERSION 3.31)
project(ExampleWithSub NONE)
file(STRINGS "${CMAKE_SOURCE_DIR}/.git/config" git_config_strings
REGEX "^\\[submodule")
diff --git a/Tests/ExternalProject/gitrepo.tgz b/Tests/ExternalProject/gitrepo.tgz
index 8d2d144..63a6ddc 100644
--- a/Tests/ExternalProject/gitrepo.tgz
+++ b/Tests/ExternalProject/gitrepo.tgz
Binary files differ
diff --git a/Tests/ExternalProject/hgrepo.tgz b/Tests/ExternalProject/hgrepo.tgz
index 0d75ce2..aebbcc0 100644
--- a/Tests/ExternalProject/hgrepo.tgz
+++ b/Tests/ExternalProject/hgrepo.tgz
Binary files differ
diff --git a/Tests/ExternalProject/svnrepo.tgz b/Tests/ExternalProject/svnrepo.tgz
index b848416..da5350f 100644
--- a/Tests/ExternalProject/svnrepo.tgz
+++ b/Tests/ExternalProject/svnrepo.tgz
Binary files differ
diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt
index f9abe11..7caefae 100644
--- a/Tests/ExternalProjectLocal/CMakeLists.txt
+++ b/Tests/ExternalProjectLocal/CMakeLists.txt
@@ -79,7 +79,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local")
set(proj TutorialStep1-LocalTAR)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar"
- URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3
+ URL_MD5 e3774630066d0df5b9074cb777d72802
LIST_SEPARATOR ::
PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
@@ -94,7 +94,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR")
set(proj TutorialStep1-LocalNoDirTAR)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar"
- URL_MD5 d09e3d370c5c908fa035c30939ee438e
+ URL_MD5 a7357d2e8a52cc807957634ea135eb31
LIST_SEPARATOR @@
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
-DTEST_LIST:STRING=1@@2@@3
@@ -115,7 +115,7 @@ ExternalProject_Add_Step(${proj} mypatch
set(proj TutorialStep1-LocalTGZ)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz"
- URL_MD5 38c648e817339c356f6be00eeed79bd0
+ URL_MD5 c04edffa0520d5468d51ecd13a971828
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
INSTALL_COMMAND ""
LOG_BUILD 1
@@ -126,7 +126,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ")
set(proj TutorialStep1-LocalNoDirTGZ)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz"
- URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383
+ URL_HASH SHA256=b9aff8a865842b21cb3bc2ec8bed426b46ef560518962a81242c7f2e089c00de
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_COMMAND ""
diff --git a/Tests/ExternalProjectLocal/Step1.tar b/Tests/ExternalProjectLocal/Step1.tar
index 3711f07..e99effb 100644
--- a/Tests/ExternalProjectLocal/Step1.tar
+++ b/Tests/ExternalProjectLocal/Step1.tar
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1.tar.bz2 b/Tests/ExternalProjectLocal/Step1.tar.bz2
index 49b5f23..3aa9e2a 100644
--- a/Tests/ExternalProjectLocal/Step1.tar.bz2
+++ b/Tests/ExternalProjectLocal/Step1.tar.bz2
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1.tgz b/Tests/ExternalProjectLocal/Step1.tgz
index d9b4cd2..c1f36a3 100644
--- a/Tests/ExternalProjectLocal/Step1.tgz
+++ b/Tests/ExternalProjectLocal/Step1.tgz
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1.zip b/Tests/ExternalProjectLocal/Step1.zip
index 49dac24..c1fe9ed 100644
--- a/Tests/ExternalProjectLocal/Step1.zip
+++ b/Tests/ExternalProjectLocal/Step1.zip
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1NoDir.tar b/Tests/ExternalProjectLocal/Step1NoDir.tar
index 03664b8..c60961c 100644
--- a/Tests/ExternalProjectLocal/Step1NoDir.tar
+++ b/Tests/ExternalProjectLocal/Step1NoDir.tar
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2
index 92eb480..f4edfa8 100644
--- a/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2
+++ b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1NoDir.tgz b/Tests/ExternalProjectLocal/Step1NoDir.tgz
index 71a2d81..66facf6 100644
--- a/Tests/ExternalProjectLocal/Step1NoDir.tgz
+++ b/Tests/ExternalProjectLocal/Step1NoDir.tgz
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step1NoDir.zip b/Tests/ExternalProjectLocal/Step1NoDir.zip
index b42d318..6717202 100644
--- a/Tests/ExternalProjectLocal/Step1NoDir.zip
+++ b/Tests/ExternalProjectLocal/Step1NoDir.zip
Binary files differ
diff --git a/Tests/ExternalProjectLocal/Step5/CMakeLists.txt b/Tests/ExternalProjectLocal/Step5/CMakeLists.txt
index bde2641..94845fe 100644
--- a/Tests/ExternalProjectLocal/Step5/CMakeLists.txt
+++ b/Tests/ExternalProjectLocal/Step5/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.31)
project (Tutorial)
# The version number.
diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
index 08e533b..96dca38 100644
--- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
+++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
@@ -189,16 +189,16 @@ endif()
file(REMOVE_RECURSE ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals)
if(do_git_tests)
- check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE)
- check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 1 0 REBASE)
+ check_a_tag(origin/master b5f0fc2d442b72dd29e655c329af0062e1f8d129 1 1 REBASE)
+ check_a_tag(tag1 4209914b424925d6f1b558d79454d60967d4b0f3 1 0 REBASE)
# With the Git UPDATE_COMMAND performance patch, this will not require a
# 'git fetch'
- check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 0 0 REBASE)
- check_a_tag(tag2 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 0 REBASE)
- check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 0 0 REBASE)
- check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE)
+ check_a_tag(tag1 4209914b424925d6f1b558d79454d60967d4b0f3 0 0 REBASE)
+ check_a_tag(tag2 ae72641040f1c9512f152d08afb6909f0498f958 1 0 REBASE)
+ check_a_tag(4209914b42 4209914b424925d6f1b558d79454d60967d4b0f3 0 0 REBASE)
+ check_a_tag(origin/master b5f0fc2d442b72dd29e655c329af0062e1f8d129 1 1 REBASE)
# This is a remote symbolic ref, so it will always trigger a 'git fetch'
- check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE)
+ check_a_tag(origin/master b5f0fc2d442b72dd29e655c329af0062e1f8d129 1 1 REBASE)
foreach(strategy IN ITEMS CHECKOUT REBASE_CHECKOUT)
# Move local master back, then apply a change that will cause a conflict
@@ -232,7 +232,7 @@ if(do_git_tests)
message(FATAL_ERROR "Could not commit conflicting change.")
endif()
# This should discard our commit but leave behind an annotated tag
- check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 ${strategy})
+ check_a_tag(origin/master b5f0fc2d442b72dd29e655c329af0062e1f8d129 1 1 ${strategy})
endforeach()
# This file matches a .gitignore rule that the last commit defines. We can't
@@ -242,7 +242,7 @@ if(do_git_tests)
# doesn't choke on it.
set(ignoredFile ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT/ignored_item)
file(TOUCH ${ignoredFile})
- check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 1 REBASE)
+ check_a_tag(origin/master b5f0fc2d442b72dd29e655c329af0062e1f8d129 1 1 REBASE)
if(NOT EXISTS ${ignoredFile})
message(FATAL_ERROR "Ignored file is missing")
endif()
diff --git a/Tests/ExternalProjectUpdate/gitrepo.tgz b/Tests/ExternalProjectUpdate/gitrepo.tgz
index 4dab56b..be00071 100644
--- a/Tests/ExternalProjectUpdate/gitrepo.tgz
+++ b/Tests/ExternalProjectUpdate/gitrepo.tgz
Binary files differ
diff --git a/Tests/FindCURL/Test/CMakeLists.txt b/Tests/FindCURL/Test/CMakeLists.txt
index cbf2866..660cfa9 100644
--- a/Tests/FindCURL/Test/CMakeLists.txt
+++ b/Tests/FindCURL/Test/CMakeLists.txt
@@ -4,7 +4,12 @@ include(CTest)
find_package(CURL REQUIRED COMPONENTS HTTP)
-add_definitions(-DCMAKE_EXPECTED_CURL_VERSION="${CURL_VERSION_STRING}")
+if(NOT CURL_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.|$)")
+ message(FATAL_ERROR "CURL_VERSION not set")
+endif()
+if(NOT CURL_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+(\\.|$)")
+ message(FATAL_ERROR "CURL_VERSION_STRING not set")
+endif()
add_executable(test_tgt main.c)
target_link_libraries(test_tgt CURL::libcurl)
diff --git a/Tests/FindGTK2/CMakeLists.txt b/Tests/FindGTK2/CMakeLists.txt
index 0105fae..15a7c29 100644
--- a/Tests/FindGTK2/CMakeLists.txt
+++ b/Tests/FindGTK2/CMakeLists.txt
@@ -11,7 +11,6 @@ if(GTK2_GTK_FOUND)
--build-target gtk-all-libs
--build-project gtk
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -25,7 +24,6 @@ if(GTK2_GTKMM_FOUND)
--build-target gtkmm-all-libs
--build-project gtkmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -40,7 +38,6 @@ if(TARGET GTK2::glib)
${build_generator_args}
--build-project glib
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glib"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -53,7 +50,6 @@ if(TARGET GTK2::gobject)
${build_generator_args}
--build-project gobject
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gobject"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -66,7 +62,6 @@ if(TARGET GTK2::gio)
${build_generator_args}
--build-project gio
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gio"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -79,7 +74,6 @@ if(TARGET GTK2::gmodule)
${build_generator_args}
--build-project gmodule
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gmodule"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -92,7 +86,6 @@ if(TARGET GTK2::gthread)
${build_generator_args}
--build-project gthread
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gthread"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -105,7 +98,6 @@ if(TARGET GTK2::atk)
${build_generator_args}
--build-project atk
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atk"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -118,7 +110,6 @@ if(TARGET GTK2::gdk_pixbuf)
${build_generator_args}
--build-project gdk_pixbuf
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk_pixbuf"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -131,7 +122,6 @@ if(TARGET GTK2::cairo)
${build_generator_args}
--build-project cairo
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairo"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -144,7 +134,6 @@ if(TARGET GTK2::pango)
${build_generator_args}
--build-project pango
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pango"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -157,7 +146,6 @@ if(TARGET GTK2::pangocairo)
${build_generator_args}
--build-project pangocairo
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangocairo"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -170,7 +158,6 @@ if(TARGET GTK2::pangoxft)
${build_generator_args}
--build-project pangoxft
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoxft"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -183,7 +170,6 @@ if(TARGET GTK2::pangoft2)
${build_generator_args}
--build-project pangoft2
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoft2"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -196,7 +182,6 @@ if(TARGET GTK2::gdk)
${build_generator_args}
--build-project gdk
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -209,7 +194,6 @@ if(TARGET GTK2::gtk)
${build_generator_args}
--build-project gtk
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtk"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -222,7 +206,6 @@ if(TARGET GTK2::sigc++)
${build_generator_args}
--build-project sigc++
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/sigc++"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -235,7 +218,6 @@ if(TARGET GTK2::glibmm)
${build_generator_args}
--build-project glibmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glibmm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -248,7 +230,6 @@ if(TARGET GTK2::giomm)
${build_generator_args}
--build-project giomm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/giomm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -261,7 +242,6 @@ if(TARGET GTK2::atkmm)
${build_generator_args}
--build-project atkmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atkmm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -274,7 +254,6 @@ if(TARGET GTK2::cairomm)
${build_generator_args}
--build-project cairomm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairomm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -287,7 +266,6 @@ if(TARGET GTK2::pangomm)
${build_generator_args}
--build-project pangomm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangomm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -300,7 +278,6 @@ if(TARGET GTK2::gdkmm)
${build_generator_args}
--build-project gdkmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/GTK2Targets/gdkmm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
@@ -314,7 +291,6 @@ if(TARGET GTK2::gtkmm)
--build-target gtkmm-target
--build-project gtkmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm"
- --force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endif()
diff --git a/Tests/FindGTK2/atk/main.c b/Tests/FindGTK2/atk/main.c
index 4dc8d4d..e5ff63c 100644
--- a/Tests/FindGTK2/atk/main.c
+++ b/Tests/FindGTK2/atk/main.c
@@ -2,6 +2,6 @@
int main(int argc, char* argv[])
{
- const gchar* name = atk_get_toolkit_name();
+ gchar const* name = atk_get_toolkit_name();
return 0;
}
diff --git a/Tests/FindGTK2/gdk_pixbuf/main.c b/Tests/FindGTK2/gdk_pixbuf/main.c
index ed9f564..9b49a67 100644
--- a/Tests/FindGTK2/gdk_pixbuf/main.c
+++ b/Tests/FindGTK2/gdk_pixbuf/main.c
@@ -2,9 +2,9 @@
int main(int argc, char* argv[])
{
- const char* version = gdk_pixbuf_version;
- const guint major = gdk_pixbuf_major_version;
- const guint minor = gdk_pixbuf_minor_version;
- const guint micro = gdk_pixbuf_micro_version;
+ char const* version = gdk_pixbuf_version;
+ guint const major = gdk_pixbuf_major_version;
+ guint const minor = gdk_pixbuf_minor_version;
+ guint const micro = gdk_pixbuf_micro_version;
return 0;
}
diff --git a/Tests/FindHDF5/Test/test_C.c b/Tests/FindHDF5/Test/test_C.c
index 4c18364..2aac8cd 100644
--- a/Tests/FindHDF5/Test/test_C.c
+++ b/Tests/FindHDF5/Test/test_C.c
@@ -1,6 +1,6 @@
#include <hdf5.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
hid_t fid;
if (argc != 2) {
diff --git a/Tests/FindHDF5/Test/test_CXX.cxx b/Tests/FindHDF5/Test/test_CXX.cxx
index 93fb462..98c9006 100644
--- a/Tests/FindHDF5/Test/test_CXX.cxx
+++ b/Tests/FindHDF5/Test/test_CXX.cxx
@@ -4,7 +4,7 @@
using namespace H5;
#endif
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
if (argc != 2) {
return 1;
diff --git a/Tests/FindICU/Test/main.cpp b/Tests/FindICU/Test/main.cpp
index 606e94e..c9a5762 100644
--- a/Tests/FindICU/Test/main.cpp
+++ b/Tests/FindICU/Test/main.cpp
@@ -12,7 +12,7 @@ int main()
ucnv_open(NULL, &status);
UChar uchars[100];
- const char* chars = "Test";
+ char const* chars = "Test";
if (cnv && U_SUCCESS(status)) {
int32_t len = ucnv_toUChars(cnv, uchars, 100, chars, -1, &status);
}
diff --git a/Tests/FindIconv/Test/main.cxx b/Tests/FindIconv/Test/main.cxx
index 415ee37..6280f03 100644
--- a/Tests/FindIconv/Test/main.cxx
+++ b/Tests/FindIconv/Test/main.cxx
@@ -14,7 +14,7 @@ private:
iconv_t iconvd_;
public:
- iconv_desc(const std::string& tocode, const std::string& fromcode)
+ iconv_desc(std::string const& tocode, std::string const& fromcode)
{
iconvd_ = iconv_open(tocode.c_str(), fromcode.c_str());
if (iconvd_ == reinterpret_cast<iconv_t>(-1))
@@ -37,14 +37,14 @@ int main()
auto from_len = from_str.size();
auto to_str_ptr = to_str.data();
auto to_len = to_str.size();
- const auto iconv_ret =
+ auto const iconv_ret =
iconv(conv_d, &from_str_ptr, &from_len, &to_str_ptr, &to_len);
if (iconv_ret == static_cast<std::size_t>(-1))
throw std::system_error(errno, std::system_category());
std::cout << '\'' << from_str.data() << "\' converted to \'"
<< to_str.data() << '\'' << std::endl;
return EXIT_SUCCESS;
- } catch (const std::system_error& ex) {
+ } catch (std::system_error const& ex) {
std::cerr << "ERROR: " << ex.code() << '\n'
<< ex.code().message() << std::endl;
}
diff --git a/Tests/FindLibLZMA/Test/main.c b/Tests/FindLibLZMA/Test/main.c
index 0b3de31..3da5a37 100644
--- a/Tests/FindLibLZMA/Test/main.c
+++ b/Tests/FindLibLZMA/Test/main.c
@@ -2,11 +2,11 @@
#include <lzma.h>
#include <string.h>
-static const uint8_t test_string[9] = "123456789";
+static uint8_t const test_string[9] = "123456789";
int main(void)
{
- static const uint32_t test_vector = 0xCBF43926;
+ static uint32_t const test_vector = 0xCBF43926;
uint32_t crc = lzma_crc32(test_string, sizeof(test_string), 0);
assert(crc == test_vector);
diff --git a/Tests/FindMatlab/matlab_wrapper1.cpp b/Tests/FindMatlab/matlab_wrapper1.cpp
index ebf1b87..9b170b0 100644
--- a/Tests/FindMatlab/matlab_wrapper1.cpp
+++ b/Tests/FindMatlab/matlab_wrapper1.cpp
@@ -9,8 +9,8 @@
// this test should return a matrix of 10 x 10 and should check some of the
// arguments
-void mexFunction(const int nlhs, mxArray* plhs[], const int nrhs,
- const mxArray* prhs[])
+void mexFunction(int const nlhs, mxArray* plhs[], int const nrhs,
+ mxArray const* prhs[])
{
if (nrhs != 1) {
mexErrMsgTxt("Incorrect arguments");
diff --git a/Tests/FindMatlab/matlab_wrapper2.cpp b/Tests/FindMatlab/matlab_wrapper2.cpp
index e768fbf..3e85d13 100644
--- a/Tests/FindMatlab/matlab_wrapper2.cpp
+++ b/Tests/FindMatlab/matlab_wrapper2.cpp
@@ -12,8 +12,8 @@
// bytes in a matrix element. For the old (R2017b) API, this is 8. For the new
// (R2018a) API, this is 16.
-void mexFunction(const int nlhs, mxArray* plhs[], const int nrhs,
- const mxArray* prhs[])
+void mexFunction(int const nlhs, mxArray* plhs[], int const nrhs,
+ mxArray const* prhs[])
{
if (nrhs != 1 || !mxIsComplex(prhs[0])) {
mexErrMsgTxt("Incorrect arguments");
diff --git a/Tests/FindMatlab/matlab_wrapper_failure.cpp b/Tests/FindMatlab/matlab_wrapper_failure.cpp
index 3fe437b..5e3f8ca 100644
--- a/Tests/FindMatlab/matlab_wrapper_failure.cpp
+++ b/Tests/FindMatlab/matlab_wrapper_failure.cpp
@@ -6,8 +6,8 @@
#include "mex.h"
-void mexFunctionXX(const int nlhs, mxArray* plhs[], const int nrhs,
- const mxArray* prhs[])
+void mexFunctionXX(int const nlhs, mxArray* plhs[], int const nrhs,
+ mxArray const* prhs[])
{
mexErrMsgTxt("Should not be running");
}
diff --git a/Tests/FindOpenACC/CTest/main.c b/Tests/FindOpenACC/CTest/main.c
index 6c005c1..20c6be1 100644
--- a/Tests/FindOpenACC/CTest/main.c
+++ b/Tests/FindOpenACC/CTest/main.c
@@ -26,7 +26,7 @@ int main(void)
b[i] = (float)(1000 * i);
}
/* compute on the GPU */
-#pragma acc data copyin(a [0:n], b [0:n]) copyout(r [0:n])
+#pragma acc data copyin(a[0 : n], b[0 : n]) copyout(r[0 : n])
{
vecaddgpu(r, a, b, n);
}
diff --git a/Tests/FindOpenACC/CXXTest/main.cxx b/Tests/FindOpenACC/CXXTest/main.cxx
index 14b912b..8943d4a 100644
--- a/Tests/FindOpenACC/CXXTest/main.cxx
+++ b/Tests/FindOpenACC/CXXTest/main.cxx
@@ -10,7 +10,7 @@ void vecaddgpu(float* r, float* a, float* b, std::size_t n)
int main(int, char*[])
{
- const std::size_t n = 100000; /* vector length */
+ std::size_t const n = 100000; /* vector length */
std::vector<float> a(n); /* input vector 1 */
std::vector<float> b(n); /* input vector 2 */
std::vector<float> r(n); /* output vector */
@@ -25,7 +25,7 @@ int main(int, char*[])
auto a_ptr = a.data();
auto b_ptr = b.data();
auto r_ptr = r.data();
-#pragma acc data copyin(a_ptr [0:n], b_ptr [0:n]) copyout(r_ptr [0:n])
+#pragma acc data copyin(a_ptr[0 : n], b_ptr[0 : n]) copyout(r_ptr[0 : n])
{
vecaddgpu(r_ptr, a_ptr, b_ptr, n);
}
diff --git a/Tests/FindOpenSP/Test/main.cxx b/Tests/FindOpenSP/Test/main.cxx
index ef8aa2c..8e8a60f 100644
--- a/Tests/FindOpenSP/Test/main.cxx
+++ b/Tests/FindOpenSP/Test/main.cxx
@@ -3,7 +3,7 @@
#include "ParserEventGeneratorKit.h"
-std::string CharStringtostring(const SGMLApplication::CharString source)
+std::string CharStringtostring(SGMLApplication::CharString const source)
{
// The CharString type might have multi-byte characters if SP_MULTI_BYTE was
// defined
@@ -22,14 +22,14 @@ public:
: depth_(0)
{
}
- void startElement(const StartElementEvent& event)
+ void startElement(StartElementEvent const& event)
{
for (unsigned i = 0; i < depth_; i++)
parsedOutput += "\t";
parsedOutput += CharStringtostring(event.gi);
depth_++;
}
- void endElement(const EndElementEvent&) { depth_--; }
+ void endElement(EndElementEvent const&) { depth_--; }
std::string parsedOutput;
private:
diff --git a/Tests/FindPackageTest/.gitignore b/Tests/FindPackageCMakeTest/.gitignore
index 3aaef13..3aaef13 100644
--- a/Tests/FindPackageTest/.gitignore
+++ b/Tests/FindPackageCMakeTest/.gitignore
diff --git a/Tests/FindPackageTest/B/wibble-config.cmake b/Tests/FindPackageCMakeTest/A/wibble-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/B/wibble-config.cmake
+++ b/Tests/FindPackageCMakeTest/A/wibble-config.cmake
diff --git a/Tests/FindPackageTest/A/wibble-config.cmake b/Tests/FindPackageCMakeTest/B/wibble-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/A/wibble-config.cmake
+++ b/Tests/FindPackageCMakeTest/B/wibble-config.cmake
diff --git a/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake b/Tests/FindPackageCMakeTest/Baz 1.1/BazConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 1.1/BazConfig.cmake
diff --git a/Tests/FindPackageCMakeTest/Baz 1.1/BazConfigVersion.cmake b/Tests/FindPackageCMakeTest/Baz 1.1/BazConfigVersion.cmake
new file mode 100644
index 0000000..5b0261a
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/Baz 1.1/BazConfigVersion.cmake
@@ -0,0 +1,7 @@
+set(PACKAGE_VERSION 1.1)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfig.cmake b/Tests/FindPackageCMakeTest/Baz 1.2/CMake/BazConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfig.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 1.2/CMake/BazConfig.cmake
diff --git a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake b/Tests/FindPackageCMakeTest/Baz 1.2/CMake/BazConfigVersion.cmake
index b37bc8e..b37bc8e 100644
--- a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 1.2/CMake/BazConfigVersion.cmake
diff --git a/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake b/Tests/FindPackageCMakeTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake
diff --git a/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake b/Tests/FindPackageCMakeTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake
index d8cac77..d8cac77 100644
--- a/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake
diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake b/Tests/FindPackageCMakeTest/Baz 2.0/share/Baz 2/BazConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 2.0/share/Baz 2/BazConfig.cmake
diff --git a/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake b/Tests/FindPackageCMakeTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake
index 5026fad..5026fad 100644
--- a/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake
diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake b/Tests/FindPackageCMakeTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake
diff --git a/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake b/Tests/FindPackageCMakeTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake
index a180143..a180143 100644
--- a/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake
diff --git a/Tests/FindPackageCMakeTest/CMakeLists.txt b/Tests/FindPackageCMakeTest/CMakeLists.txt
new file mode 100644
index 0000000..3e01029
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/CMakeLists.txt
@@ -0,0 +1,696 @@
+cmake_minimum_required(VERSION 3.10)
+project(FindPackageCMakeTest)
+
+# Protect tests from running inside the default install prefix.
+set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/NotDefaultPrefix")
+
+# Disable built-in search paths.
+set(CMAKE_FIND_USE_PACKAGE_ROOT_PATH OFF)
+set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF)
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+set(CMAKE_FIND_USE_INSTALL_PREFIX OFF)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+find_package(ZLIB QUIET)
+
+# Look for a package that has a find module and may be found.
+find_package(OpenGL QUIET)
+
+# Look for a package that has no find module and will not be found.
+find_package(NotAPackage QUIET)
+
+# Look for a package that has an advanced find module.
+find_package(Boost QUIET)
+
+add_executable(FindPackageCMakeTest FindPackageTest.cxx)
+
+# test behavior of cmFindBase wrt. the CMAKE_PREFIX_PATH variable
+# foo.h should be found in ${CMAKE_CURRENT_SOURCE_DIR}/include:
+
+set(CMAKE_PREFIX_PATH /blub /blah "${CMAKE_CURRENT_SOURCE_DIR}")
+find_path(FOO_DIR foo.h)
+
+if(NOT FOO_DIR)
+ message(FATAL_ERROR "Did not find foo.h which is in ${CMAKE_CURRENT_SOURCE_DIR}/include
+ CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
+endif()
+
+find_package(VersionTestA 1)
+find_package(VersionTestB 1.2)
+find_package(VersionTestC 1.2.3)
+find_package(VersionTestD 1.2.3.4)
+
+
+find_package(LotsOfComponents COMPONENTS AComp OPTIONAL_COMPONENTS BComp CComp)
+if(NOT LOTSOFCOMPONENTS_FOUND)
+ message(SEND_ERROR "LotsOfComponents not found !")
+endif()
+
+find_package(SomePackage)
+if(NOT SomePackage_FOUND)
+ message(SEND_ERROR "SomePackage not found !")
+endif()
+if(NOT SOMEPACKAGE_FOUND)
+ message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!")
+endif()
+
+find_package(UpperCasePackage)
+if(NOT UpperCasePackage_FOUND)
+ message(SEND_ERROR "UpperCasePackage not found!")
+endif()
+if(NOT UPPERCASEPACKAGE_FOUND)
+ message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!")
+endif()
+
+#-----------------------------------------------------------------------------
+# Test system package registry if possible.
+set(CMakeTestSystemPackage "")
+if(WIN32 AND NOT CYGWIN)
+ # Try writing a value to the system package registry.
+ set(_data "${FindPackageCMakeTest_SOURCE_DIR}/SystemPackage")
+ set(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage")
+ set(_file "${FindPackageCMakeTest_BINARY_DIR}/CMakeTestSystemPackage.data")
+ file(WRITE ${_file} "${_data}\n")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E md5sum ${_file}
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _error RESULT_VARIABLE _failed
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ string(REGEX REPLACE " .*" "" _value "${_output}")
+ if(NOT _failed AND _value)
+ execute_process(
+ COMMAND reg add "${_key}" /v "${_value}" /t REG_SZ /d "${_data}" /f
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _failed
+ )
+ endif()
+ # If the above worked, add the rest of the test and a rule to
+ # cleanup the value.
+ if(NOT _failed)
+ message(STATUS "HKLM is writable: enabling CMakeTestSystemPackage")
+ set(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f)
+ set(CMakeTestSystemPackage CMakeTestSystemPackage)
+ else()
+ message(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage")
+ endif()
+endif()
+
+#-----------------------------------------------------------------------------
+
+#set(CMAKE_FIND_DEBUG_MODE 1)
+
+# For purposes of the test wipe out previous find results.
+set(PACKAGES
+ foo Foo Bar Blub TFramework Tframework TApp Tapp Special
+ VersionedA VersionedB VersionedC VersionedD VersionedE
+ VersionedF VersionedG VersionedH
+ WrongA WrongB WrongC WrongD
+ wibbleA wibbleB
+ RecursiveA RecursiveB RecursiveC
+ ArchA ArchB ArchC ArchD
+ EnvA EnvB
+ SetFoundTRUE SetFoundFALSE
+ ${CMakeTestSystemPackage}
+ )
+foreach(p ${PACKAGES})
+ set(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+endforeach()
+
+# Enable framework and bundle searching. Make sure bundles are found
+# before unix-syle packages.
+set(CMAKE_FIND_FRAMEWORK LAST)
+set(CMAKE_FIND_APPBUNDLE FIRST)
+
+# Set the wrong answer for a find to make sure it re-finds.
+set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0)
+
+# Test that CMAKE_IGNORE_PATH can ignore the purposely bad package
+# files in the lib/cmake/zot-3.1 directory.
+set(CMAKE_IGNORE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-3.1)
+
+# Look for packages with new-style signatures.
+find_package(foo NO_MODULE)
+find_package(Foo CONFIGS FooConfig.cmake)
+find_package(Bar)
+set(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE)
+find_package(Blub NO_MODULE)
+find_package(TFramework CONFIGS TFrameworkConfig.cmake)
+find_package(Tframework)
+find_package(TApp)
+find_package(Tapp CONFIGS tapp-config.cmake)
+find_package(Special NAMES Suffix SuffixTest PATH_SUFFIXES test)
+find_package(VersionedA 2 NAMES zot)
+find_package(VersionedB 3.1 EXACT NAMES zot)
+find_package(VersionedC 4.0 EXACT NAMES zot)
+find_package(VersionedD 1.1 EXACT NAMES Baz)
+find_package(VersionedE 1.2 EXACT NAMES Baz)
+find_package(VersionedF 1.3 EXACT NAMES Baz)
+find_package(VersionedG 2.0 EXACT NAMES Baz)
+find_package(VersionedH 2.1 EXACT NAMES Baz)
+
+
+# Test Config files which set Xyz_FOUND themselves:
+find_package(SetFoundTRUE NO_MODULE)
+find_package(SetFoundFALSE NO_MODULE)
+
+# Test wrong initial path when result is present.
+set(WrongA_DIR "${VersionedD_DIR}")
+find_package(WrongA 1.2 EXACT NAMES Baz)
+
+# Test wrong initial cache entry of UNINITIALIZED type when result is present.
+set(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
+get_property(type CACHE WrongB_DIR PROPERTY TYPE)
+find_package(WrongB 1.2 EXACT NAMES Baz)
+
+# Test wrong initial path when result is missing.
+set(WrongC_DIR "${VersionedD_DIR}")
+find_package(WrongC 1.4 EXACT QUIET NAMES Baz)
+
+# Test wrong initial cache entry of UNINITIALIZED type when result is missing.
+set(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
+get_property(type CACHE WrongD_DIR PROPERTY TYPE)
+find_package(WrongD 1.4 EXACT QUIET NAMES Baz)
+
+# HINTS should override the system but PATHS should not
+list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A")
+find_package(wibbleA NAMES wibble PATHS B)
+find_package(wibbleB NAMES wibble HINTS B)
+
+# Look for package with recursive find-modules.
+find_package(RecursiveA COMPONENTS A)
+find_package(RecursiveB 2)
+find_package(RecursiveC 3.1 EXACT)
+
+# Test architecture-specific search directories.
+set(CMAKE_LIBRARY_ARCHITECTURE arch)
+find_package(ArchA NAMES Bar)
+find_package(ArchB NAMES Foo CONFIGS FooConfig.cmake)
+find_package(ArchC 3.1 EXACT NAMES zot)
+find_package(ArchD 4.0 EXACT NAMES zot)
+unset(CMAKE_LIBRARY_ARCHITECTURE)
+
+# Test find_package() with CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS enabled
+if(UNIX
+ AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS
+ )
+ # Create ./symlink pointing back here.
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+ . "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
+ # Make find_package search through the symlink
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
+
+ # First, test the default behavior where symlinks are preserved.
+ set(SetFoundResolved_DIR "")
+ find_package(SetFoundResolved)
+ # The result must preserve the /symlink/ path.
+ set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/symlink/cmake")
+ if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}")
+ message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to\n \"${SetFoundResolved_DIR}\"\nnot the expected\n \"${SetFoundResolved_EXPECTED}\"")
+ endif()
+
+ # This part of the test only works if there are no symlinks in our path.
+ get_filename_component(real_src_dir "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH)
+ if(real_src_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ # Resolve symlinks when finding the package.
+ set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE)
+ set(SetFoundResolved_DIR "")
+ find_package(SetFoundResolved)
+ # ./symlink points back here so it should be gone when resolved.
+ set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+ if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}")
+ message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to\n \"${SetFoundResolved_DIR}\"\nnot the expected\n \"${SetFoundResolved_EXPECTED}\"")
+ endif()
+ endif()
+
+ # Cleanup.
+ unset(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS)
+ file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
+endif()
+
+# Test <PackageName>_DIR environment variable.
+# We erase the main prefix path to ensure the env var is used.
+set(CMAKE_PREFIX_PATH)
+set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH ON)
+set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
+find_package(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work
+find_package(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail
+set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF)
+
+# Test system package registry if available.
+if(CMakeTestSystemPackage)
+ find_package(CMakeTestSystemPackage)
+ execute_process(COMMAND ${CMakeTestSystemPackage_CLEANUP}
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _error)
+endif()
+
+# Expected locations at which packages should be found.
+set(foo_EXPECTED "lib/foo-1.2/foo-config.cmake")
+set(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake")
+set(Bar_EXPECTED "lib/Bar/BarConfig.cmake")
+set(Blub_MISSING "")
+set(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake")
+set(TFramework_EXPECTED
+ "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake")
+set(Tframework_EXPECTED
+ "TFramework.framework/Versions/A/Resources/tframework-config.cmake")
+set(TApp_EXPECTED
+ "TApp.app/Contents/Resources/TAppConfig.cmake")
+set(Tapp_EXPECTED
+ "TApp.app/Contents/Resources/cmake/tapp-config.cmake")
+set(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
+set(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
+set(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake")
+set(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake")
+set(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake")
+set(VersionedF_EXPECTED "Baz 1.3/lib/cmake/Baz/BazConfig.cmake")
+set(VersionedG_EXPECTED "Baz 2.0/share/Baz 2/BazConfig.cmake")
+set(VersionedH_EXPECTED "Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake")
+set(WrongA_EXPECTED "${VersionedE_EXPECTED}")
+set(WrongB_EXPECTED "${VersionedE_EXPECTED}")
+set(WrongC_MISSING "WrongC_DIR-NOTFOUND")
+set(WrongD_MISSING "WrongD_DIR-NOTFOUND")
+set(wibbleA_EXPECTED "A/wibble-config.cmake")
+set(wibbleB_EXPECTED "B/wibble-config.cmake")
+set(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
+set(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
+set(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
+set(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake")
+set(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake")
+set(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake")
+set(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake")
+set(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake")
+set(EnvB_MISSING "EnvB_DIR-NOTFOUND")
+set(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake")
+set(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+set(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake")
+
+# Check the results.
+foreach(p ${PACKAGES})
+ if(DEFINED ${p}_MISSING)
+ # Check and report failure.
+ if(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}")
+ message(SEND_ERROR
+ "Package ${p} should have been [${${p}_MISSING}] but "
+ "was [${${p}_DIR}]")
+ endif()
+ if(${p}_FOUND)
+ message(SEND_ERROR
+ "Package ${p} should not have been found, but ${p}_FOUND is set to "
+ "\"${${p}_FOUND}\"")
+ endif()
+ elseif(${p}_FOUND)
+ # Convert to relative path for comparison to expected location.
+ file(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${${p}_CONFIG}")
+
+ # Debugging output.
+ if(CMAKE_FIND_DEBUG_MODE)
+ message("Package ${p} found [${REL_${p}_CONFIG}]")
+ endif()
+
+ # Check and report failure.
+ if(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}")
+ message(SEND_ERROR
+ "Package ${p} should have been [${${p}_EXPECTED}] but "
+ "was [${REL_${p}_CONFIG}]")
+ endif()
+ else()
+ message(SEND_ERROR "Package ${p} not found!")
+ endif()
+endforeach()
+
+# Check that version information was extracted.
+if(NOT "${VersionedA_VERSION}" STREQUAL "2.0")
+ message(SEND_ERROR
+ "Package VersionedA is version [${VersionedA_VERSION}], not [2.0]")
+endif()
+if(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2")
+ message(SEND_ERROR
+ "Package VersionedA is major version [${VersionedA_VERSION_MAJOR}], not [2]")
+endif()
+if(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0")
+ message(SEND_ERROR
+ "Package VersionedA is minor version [${VersionedA_VERSION_MINOR}], not [0]")
+endif()
+
+if(NOT "${VersionedB_VERSION}" STREQUAL "3.1")
+ message(SEND_ERROR
+ "Package VersionedB is version [${VersionedB_VERSION}], not [3.1]")
+endif()
+if(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3")
+ message(SEND_ERROR
+ "Package VersionedB is major version [${VersionedB_VERSION_MAJOR}], not [3]")
+endif()
+if(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1")
+ message(SEND_ERROR
+ "Package VersionedB is minor version [${VersionedB_VERSION_MINOR}], not [1]")
+endif()
+
+if(NOT "${Special_VERSION}" STREQUAL "1.2")
+ message(SEND_ERROR
+ "Package Special is version [${Special_VERSION}], not [1.2]")
+endif()
+if(NOT "${Special_VERSION_MAJOR}" STREQUAL "1")
+ message(SEND_ERROR
+ "Package Special is major version [${Special_VERSION_MAJOR}], not [1]")
+endif()
+if(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
+ message(SEND_ERROR
+ "Package Special is minor version [${Special_VERSION_MINOR}], not [2]")
+endif()
+
+# Test version number comparison.
+if(NOT "1.2.3.4" VERSION_LESS "1.2.3.5")
+ message(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!")
+endif()
+if(NOT "1.2" VERSION_LESS "1.10")
+ message(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!")
+endif()
+if(NOT "1.02" VERSION_GREATER "1.1")
+ message(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!")
+endif()
+if("1.2.3" VERSION_GREATER "1.2.3.4")
+ message(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!")
+endif()
+if(NOT "1.2" VERSION_EQUAL "1.2.0.0")
+ message(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
+endif()
+
+#-----------------------------------------------------------------------------
+# Test export(PACKAGE) with find_package.
+
+# Choose a unique version.
+string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
+string(RANDOM LENGTH 4 ALPHABET "0123456789" v)
+string(APPEND version ".${v}")
+
+message(STATUS "Preparing export(PACKAGE) test project")
+try_compile(EXPORTER_COMPILED
+ ${FindPackageCMakeTest_BINARY_DIR}/Exporter-build
+ ${FindPackageCMakeTest_SOURCE_DIR}/Exporter
+ CMakeTestExportPackage dummy
+ CMAKE_FLAGS "-UCMAKE_EXPORT_NO_PACKAGE_REGISTRY"
+ "-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=OLD"
+ -Dversion=${version}
+ OUTPUT_VARIABLE output)
+message(STATUS "Searching for export(PACKAGE) test project")
+set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
+ "Wipe out find results for testing." FORCE)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=TRUE")
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY TRUE)
+find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+if(NOT CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
+endif()
+unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=FALSE")
+set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY FALSE)
+find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+if(NOT CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
+endif()
+unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=TRUE and CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE")
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY TRUE)
+set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY TRUE)
+set(CMakeTestExportPackage_DIR FALSE)
+find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+if(NOT CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
+endif()
+unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
+unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=FALSE and CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=FALSE")
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY FALSE)
+set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY FALSE)
+set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
+ "Wipe out find results for testing." FORCE)
+find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
+if(CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be not FOUND!")
+endif()
+unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
+unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
+
+message(STATUS "Remove export(PACKAGE) test project")
+file(REMOVE_RECURSE ${FindPackageCMakeTest_BINARY_DIR}/Exporter-build)
+set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
+ "Wipe out find results for testing." FORCE)
+find_package(CMakeTestExportPackage QUIET) # Should clean the user package cache
+#
+message(STATUS "Preparing export(PACKAGE) test project with CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE")
+try_compile(EXPORTER_COMPILED
+ ${FindPackageCMakeTest_BINARY_DIR}/Exporter-build
+ ${FindPackageCMakeTest_SOURCE_DIR}/Exporter
+ CMakeTestExportPackage dummy
+ CMAKE_FLAGS "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE"
+ -Dversion=${version}
+ OUTPUT_VARIABLE output)
+message(STATUS "Searching for export(PACKAGE) test project")
+find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
+if(CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!")
+endif()
+
+message(STATUS "Remove export(PACKAGE) test project")
+file(REMOVE_RECURSE ${FindPackageCMakeTest_BINARY_DIR}/Exporter-build)
+
+message(STATUS "Preparing export(PACKAGE) test project with POLICY CMP0090=NEW")
+try_compile(EXPORTER_COMPILED
+ ${FindPackageCMakeTest_BINARY_DIR}/Exporter-build
+ ${FindPackageCMakeTest_SOURCE_DIR}/Exporter
+ CMakeTestExportPackage dummy
+ CMAKE_FLAGS
+ "-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=NEW"
+ -Dversion=${version}
+ OUTPUT_VARIABLE output)
+message(STATUS "Searching for export(PACKAGE) test project")
+find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
+if(CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!")
+endif()
+
+
+#-----------------------------------------------------------------------------
+# Test configure_package_config_file().
+
+include(CMakePackageConfigHelpers)
+
+# Generate a config file ready to be installed.
+set(INCLUDE_INSTALL_DIR include )
+set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" )
+set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
+
+configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
+ INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
+ PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
+ )
+
+set(Relocatable_FIND_COMPONENTS AComp BComp CComp)
+set(Relocatable_FIND_REQUIRED_BComp 1)
+include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
+
+if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
+ message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to\n \"${RELOC_INCLUDE_DIR}\"\nnot the expected\n \"${CMAKE_CURRENT_BINARY_DIR}/include\"")
+endif()
+
+if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
+ message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to\n \"${RELOC_SHARE_DIR}\"\nnot the expected\n \"${CMAKE_CURRENT_BINARY_DIR}/share/\"")
+endif()
+
+if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to\n \"${RELOC_BUILD_DIR}\"\nnot the expected\n \"${CMAKE_CURRENT_BINARY_DIR}\"")
+endif()
+
+if(NOT DEFINED Relocatable_FOUND)
+ message(SEND_ERROR "Relocatable_FOUND not defined !")
+endif()
+
+if(Relocatable_FOUND)
+ message(SEND_ERROR "Relocatable_FOUND set to TRUE !")
+endif()
+
+# Generate a config file for the build tree.
+set(INCLUDE_INSTALL_DIR include )
+set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/share/" )
+set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
+
+configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
+ INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
+ PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
+ INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
+ )
+
+set(Relocatable_FIND_COMPONENTS AComp BComp CComp)
+set(Relocatable_FIND_REQUIRED_BComp 1)
+include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
+
+if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
+ message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to\n \"${RELOC_INCLUDE_DIR}\"\nnot the expected\n \"${CMAKE_CURRENT_BINARY_DIR}/include\"")
+endif()
+
+if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
+ message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to\n \"${RELOC_SHARE_DIR}\"\nnot the expected\n \"${CMAKE_CURRENT_BINARY_DIR}/share/\"")
+endif()
+
+if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to\n \"${RELOC_BUILD_DIR}\"\nnot the expected\n \"${CMAKE_CURRENT_BINARY_DIR}\"")
+endif()
+
+if(NOT DEFINED Relocatable_FOUND)
+ message(SEND_ERROR "Relocatable_FOUND not defined !")
+endif()
+
+if(Relocatable_FOUND)
+ message(SEND_ERROR "Relocatable_FOUND set to TRUE !")
+endif()
+
+
+############################################################################
+##Test FIND_PACKAGE using sorting
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+SET(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
+FIND_PACKAGE(SortLib CONFIG)
+IF (NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
+endif()
+unset(SortLib_VERSION)
+
+
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+FIND_PACKAGE(SortLib CONFIG)
+IF (NOT "${SortLib_VERSION}" STREQUAL "3.10.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Natural! Dec ${SortLib_VERSION}")
+endif()
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+unset(SortLib_VERSION)
+
+
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+FIND_PACKAGE(SortLib 4.0 CONFIG)
+IF (NOT "${SortLib_VERSION}" STREQUAL "4.0.0")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER gave up too soon! ${SortLib_VERSION}")
+endif()
+unset(SortLib_VERSION)
+
+
+set(SortFramework_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+SET(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
+FIND_PACKAGE(SortFramework CONFIG)
+IF (NOT "${SortFramework_VERSION}" STREQUAL "3.1.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Framework Name Asc! ${SortFramework_VERSION}")
+endif()
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+unset(SortFramework_VERSION)
+
+
+set(SortFramework_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+FIND_PACKAGE(SortFramework CONFIG)
+IF (NOT "${SortFramework_VERSION}" STREQUAL "3.10.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Framework Natural! Dec ${SortFramework_VERSION}")
+endif()
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+unset(SortFramework_VERSION)
+
+unset(CMAKE_FIND_PACKAGE_SORT_ORDER)
+unset(CMAKE_FIND_PACKAGE_SORT_DIRECTION)
+set(CMAKE_PREFIX_PATH )
+
+############################################################################
+##Test FIND_PACKAGE CMAKE_FIND_PACKAGE_PREFER_CONFIG
+
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfig)
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfig)
+
+# prefer module mode
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
+unset(ABC_FOUND)
+unset(ABC_CONFIG)
+
+find_package(ABC)
+if(NOT ABC_FOUND)
+ message(SEND_ERROR "Did not find ABC package")
+endif()
+if(ABC_CONFIG)
+ message(SEND_ERROR "Incorrectly found ABC in CONFIG mode, expected to find it with MODULE mode")
+endif()
+
+# Now prefer config mode
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+unset(ABC_FOUND)
+unset(ABC_CONFIG)
+
+find_package(ABC)
+if(NOT ABC_FOUND)
+ message(SEND_ERROR "Did not find ABC package")
+endif()
+if(NOT ABC_CONFIG)
+ message(SEND_ERROR "Incorrectly found ABC in MODULE mode, expected to find it with CONFIG mode")
+endif()
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
+set(CMAKE_PREFIX_PATH)
+set(CMAKE_MODULE_PATH)
+
+############################################################################
+##Test FIND_PACKAGE CMAKE_FIND_PACKAGE_PREFER_CONFIG - Do not recurse
+
+# No CMAKE_PREFIX_PATH
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigRecurse)
+
+# Now prefer config mode
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+unset(ACME_FOUND)
+unset(ACME_CONFIG)
+
+find_package(ACME)
+if(ACME_FOUND AND ACME_CONFIG)
+ message(SEND_ERROR "Incorrectly found ACME in CONFIG mode, from the MODULE package")
+endif()
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
+set(CMAKE_MODULE_PATH)
+
+############################################################################
+##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with module fallback
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigOnlyModule)
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+
+find_package(ACME REQUIRED)
+
+if(NOT ACME_FOUND)
+ message(SEND_ERROR "Did not find ACME package")
+endif()
+
+############################################################################
+##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with NO_MODULE
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigOnlyModule)
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+
+find_package(ACME NO_MODULE)
+
+if(ACME_FOUND)
+ message(SEND_ERROR "Should not find ACME package")
+endif()
+
+############################################################################
+##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with unknown package
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+find_package(DoesNotExist)
diff --git a/Tests/FindPackageTest/Exporter/CMakeLists.txt b/Tests/FindPackageCMakeTest/Exporter/CMakeLists.txt
index 57cd4c9..57cd4c9 100644
--- a/Tests/FindPackageTest/Exporter/CMakeLists.txt
+++ b/Tests/FindPackageCMakeTest/Exporter/CMakeLists.txt
diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in b/Tests/FindPackageCMakeTest/Exporter/CMakeTestExportPackageConfig.cmake.in
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in
+++ b/Tests/FindPackageCMakeTest/Exporter/CMakeTestExportPackageConfig.cmake.in
diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in b/Tests/FindPackageCMakeTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
index 6eac6e6..6eac6e6 100644
--- a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
+++ b/Tests/FindPackageCMakeTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
diff --git a/Tests/FindPackageTest/Exporter/dummy.c b/Tests/FindPackageCMakeTest/Exporter/dummy.c
index 8488f4e..8488f4e 100644
--- a/Tests/FindPackageTest/Exporter/dummy.c
+++ b/Tests/FindPackageCMakeTest/Exporter/dummy.c
diff --git a/Tests/FindPackageTest/FindLotsOfComponents.cmake b/Tests/FindPackageCMakeTest/FindLotsOfComponents.cmake
index 5d959c5..5d959c5 100644
--- a/Tests/FindPackageTest/FindLotsOfComponents.cmake
+++ b/Tests/FindPackageCMakeTest/FindLotsOfComponents.cmake
diff --git a/Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake b/Tests/FindPackageCMakeTest/FindPackageHandleStandardArgs.cmake
index 7e41c96..7e41c96 100644
--- a/Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake
+++ b/Tests/FindPackageCMakeTest/FindPackageHandleStandardArgs.cmake
diff --git a/Tests/FindPackageCMakeTest/FindPackageTest.cxx b/Tests/FindPackageCMakeTest/FindPackageTest.cxx
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/FindPackageTest.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/FindPackageTest/FindRecursiveA.cmake b/Tests/FindPackageCMakeTest/FindRecursiveA.cmake
index a6d25dc..a6d25dc 100644
--- a/Tests/FindPackageTest/FindRecursiveA.cmake
+++ b/Tests/FindPackageCMakeTest/FindRecursiveA.cmake
diff --git a/Tests/FindPackageTest/FindRecursiveB.cmake b/Tests/FindPackageCMakeTest/FindRecursiveB.cmake
index 9e28f2c..9e28f2c 100644
--- a/Tests/FindPackageTest/FindRecursiveB.cmake
+++ b/Tests/FindPackageCMakeTest/FindRecursiveB.cmake
diff --git a/Tests/FindPackageTest/FindRecursiveC.cmake b/Tests/FindPackageCMakeTest/FindRecursiveC.cmake
index cd4400c..cd4400c 100644
--- a/Tests/FindPackageTest/FindRecursiveC.cmake
+++ b/Tests/FindPackageCMakeTest/FindRecursiveC.cmake
diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageCMakeTest/FindSomePackage.cmake
index 746c087..746c087 100644
--- a/Tests/FindPackageTest/FindSomePackage.cmake
+++ b/Tests/FindPackageCMakeTest/FindSomePackage.cmake
diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageCMakeTest/FindUpperCasePackage.cmake
index 5e349da..5e349da 100644
--- a/Tests/FindPackageTest/FindUpperCasePackage.cmake
+++ b/Tests/FindPackageCMakeTest/FindUpperCasePackage.cmake
diff --git a/Tests/FindPackageTest/FindVersionTestA.cmake b/Tests/FindPackageCMakeTest/FindVersionTestA.cmake
index 9828593..9828593 100644
--- a/Tests/FindPackageTest/FindVersionTestA.cmake
+++ b/Tests/FindPackageCMakeTest/FindVersionTestA.cmake
diff --git a/Tests/FindPackageTest/FindVersionTestB.cmake b/Tests/FindPackageCMakeTest/FindVersionTestB.cmake
index 1ebb823..1ebb823 100644
--- a/Tests/FindPackageTest/FindVersionTestB.cmake
+++ b/Tests/FindPackageCMakeTest/FindVersionTestB.cmake
diff --git a/Tests/FindPackageTest/FindVersionTestC.cmake b/Tests/FindPackageCMakeTest/FindVersionTestC.cmake
index 450c2e9..450c2e9 100644
--- a/Tests/FindPackageTest/FindVersionTestC.cmake
+++ b/Tests/FindPackageCMakeTest/FindVersionTestC.cmake
diff --git a/Tests/FindPackageTest/FindVersionTestD.cmake b/Tests/FindPackageCMakeTest/FindVersionTestD.cmake
index 9f2db72..9f2db72 100644
--- a/Tests/FindPackageTest/FindVersionTestD.cmake
+++ b/Tests/FindPackageCMakeTest/FindVersionTestD.cmake
diff --git a/Tests/FindPackageTest/PreferConfig/ABCConfig.cmake b/Tests/FindPackageCMakeTest/PreferConfig/ABCConfig.cmake
index 281a5cd..281a5cd 100644
--- a/Tests/FindPackageTest/PreferConfig/ABCConfig.cmake
+++ b/Tests/FindPackageCMakeTest/PreferConfig/ABCConfig.cmake
diff --git a/Tests/FindPackageTest/PreferConfig/FindABC.cmake b/Tests/FindPackageCMakeTest/PreferConfig/FindABC.cmake
index 281a5cd..281a5cd 100644
--- a/Tests/FindPackageTest/PreferConfig/FindABC.cmake
+++ b/Tests/FindPackageCMakeTest/PreferConfig/FindABC.cmake
diff --git a/Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake b/Tests/FindPackageCMakeTest/PreferConfigOnlyModule/FindACME.cmake
index 7a4e1b3..7a4e1b3 100644
--- a/Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake
+++ b/Tests/FindPackageCMakeTest/PreferConfigOnlyModule/FindACME.cmake
diff --git a/Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake b/Tests/FindPackageCMakeTest/PreferConfigRecurse/ACMEConfig.cmake
index 7a4e1b3..7a4e1b3 100644
--- a/Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake
+++ b/Tests/FindPackageCMakeTest/PreferConfigRecurse/ACMEConfig.cmake
diff --git a/Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake b/Tests/FindPackageCMakeTest/PreferConfigRecurse/FindACME.cmake
index 9bdc7db..9bdc7db 100644
--- a/Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake
+++ b/Tests/FindPackageCMakeTest/PreferConfigRecurse/FindACME.cmake
diff --git a/Tests/FindPackageTest/RelocatableConfig.cmake.in b/Tests/FindPackageCMakeTest/RelocatableConfig.cmake.in
index 4a4b4e9..4a4b4e9 100644
--- a/Tests/FindPackageTest/RelocatableConfig.cmake.in
+++ b/Tests/FindPackageCMakeTest/RelocatableConfig.cmake.in
diff --git a/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfig.cmake b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfig.cmake
new file mode 100644
index 0000000..f51edb2
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfig.cmake
@@ -0,0 +1,2 @@
+set(SORT_FRAMEWORK_VERSION 3.1.1)
+message("SortFramework 3.1.1 config reached")
diff --git a/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfigVersion.cmake b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfigVersion.cmake
index fa927c7..fa927c7 100644
--- a/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.1.1/Resources/CMake/SortFrameworkConfigVersion.cmake
diff --git a/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfig.cmake b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfig.cmake
new file mode 100644
index 0000000..f7f05ef
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfig.cmake
@@ -0,0 +1,2 @@
+set(SORT_FRAMEWORK_VERSION 3.10.1)
+message("SortFramework 3.10.1 config reached")
diff --git a/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfigVersion.cmake b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfigVersion.cmake
index 6f44c2d..6f44c2d 100644
--- a/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/SortFramework.framework/Versions/3.10.1/Resources/CMake/SortFrameworkConfigVersion.cmake
diff --git a/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfig.cmake b/Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfig.cmake
index c1f2088..c1f2088 100644
--- a/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfig.cmake
+++ b/Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfig.cmake
diff --git a/Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfigVersion.cmake b/Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfigVersion.cmake
new file mode 100644
index 0000000..fa927c7
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/SortLib-3.1.1/SortLibConfigVersion.cmake
@@ -0,0 +1,9 @@
+set(PACKAGE_VERSION 3.1.1)
+if(PACKAGE_FIND_VERSION_MAJOR EQUAL 3)
+ if(PACKAGE_FIND_VERSION_MINOR EQUAL 1)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if(PACKAGE_FIND_VERSION_PATCH EQUAL 1)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfig.cmake b/Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfig.cmake
index 3f3f659..3f3f659 100644
--- a/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfig.cmake
+++ b/Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfig.cmake
diff --git a/Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfigVersion.cmake b/Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfigVersion.cmake
new file mode 100644
index 0000000..6f44c2d
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/SortLib-3.10.1/SortLibConfigVersion.cmake
@@ -0,0 +1,9 @@
+set(PACKAGE_VERSION 3.10.1)
+if(PACKAGE_FIND_VERSION_MAJOR EQUAL 3)
+ if(PACKAGE_FIND_VERSION_MINOR EQUAL 10)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if(PACKAGE_FIND_VERSION_PATCH EQUAL 1)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake b/Tests/FindPackageCMakeTest/SystemPackage/CMakeTestSystemPackageConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake
+++ b/Tests/FindPackageCMakeTest/SystemPackage/CMakeTestSystemPackageConfig.cmake
diff --git a/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake b/Tests/FindPackageCMakeTest/TApp.app/Contents/Resources/TAppConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake
+++ b/Tests/FindPackageCMakeTest/TApp.app/Contents/Resources/TAppConfig.cmake
diff --git a/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake b/Tests/FindPackageCMakeTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake
+++ b/Tests/FindPackageCMakeTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake
diff --git a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake b/Tests/FindPackageCMakeTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake
+++ b/Tests/FindPackageCMakeTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake
diff --git a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake b/Tests/FindPackageCMakeTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake
+++ b/Tests/FindPackageCMakeTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake
diff --git a/Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake b/Tests/FindPackageCMakeTest/cmake/SetFoundFALSEConfig.cmake
index ae6bd14..ae6bd14 100644
--- a/Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake
+++ b/Tests/FindPackageCMakeTest/cmake/SetFoundFALSEConfig.cmake
diff --git a/Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake b/Tests/FindPackageCMakeTest/cmake/SetFoundResolvedConfig.cmake
index b2cf87c..b2cf87c 100644
--- a/Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake
+++ b/Tests/FindPackageCMakeTest/cmake/SetFoundResolvedConfig.cmake
diff --git a/Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake b/Tests/FindPackageCMakeTest/cmake/SetFoundTRUEConfig.cmake
index 19d0711..19d0711 100644
--- a/Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake
+++ b/Tests/FindPackageCMakeTest/cmake/SetFoundTRUEConfig.cmake
diff --git a/Tests/FindPackageTest/include/foo.h b/Tests/FindPackageCMakeTest/include/foo.h
index 2392aee..2392aee 100644
--- a/Tests/FindPackageTest/include/foo.h
+++ b/Tests/FindPackageCMakeTest/include/foo.h
diff --git a/Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake b/Tests/FindPackageCMakeTest/lib/Bar/BarConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/Bar/BarConfig.cmake
diff --git a/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake b/Tests/FindPackageCMakeTest/lib/Bar/cmake/bar-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/Bar/cmake/bar-config.cmake
diff --git a/Tests/FindPackageTest/lib/Blub/BlubConfig.cmake b/Tests/FindPackageCMakeTest/lib/Blub/BlubConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/Blub/BlubConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/Blub/BlubConfig.cmake
diff --git a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake b/Tests/FindPackageCMakeTest/lib/RecursiveA/recursivea-config.cmake
index eff4d4f..eff4d4f 100644
--- a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/RecursiveA/recursivea-config.cmake
diff --git a/Tests/FindPackageTest/lib/SortLib-4.0.0/SortLibConfig.cmake b/Tests/FindPackageCMakeTest/lib/SortLib-4.0.0/SortLibConfig.cmake
index 845e6c7..845e6c7 100644
--- a/Tests/FindPackageTest/lib/SortLib-4.0.0/SortLibConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/SortLib-4.0.0/SortLibConfig.cmake
diff --git a/Tests/FindPackageTest/lib/SortLib-4.0.0/SortLibConfigVersion.cmake b/Tests/FindPackageCMakeTest/lib/SortLib-4.0.0/SortLibConfigVersion.cmake
index b642dab..b642dab 100644
--- a/Tests/FindPackageTest/lib/SortLib-4.0.0/SortLibConfigVersion.cmake
+++ b/Tests/FindPackageCMakeTest/lib/SortLib-4.0.0/SortLibConfigVersion.cmake
diff --git a/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake b/Tests/FindPackageCMakeTest/lib/TApp/TAppConfig.cmake
index 5ba8d55..5ba8d55 100644
--- a/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/TApp/TAppConfig.cmake
diff --git a/Tests/FindPackageTest/lib/Bar/BarConfig.cmake b/Tests/FindPackageCMakeTest/lib/arch/Bar/BarConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/Bar/BarConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/arch/Bar/BarConfig.cmake
diff --git a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake
index 822b449..822b449 100644
--- a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake
+++ b/Tests/FindPackageCMakeTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake
diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/arch/cmake/zot-4.0/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/arch/cmake/zot-4.0/zot-config.cmake
diff --git a/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake b/Tests/FindPackageCMakeTest/lib/arch/foo-1.2/CMake/FooConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/arch/foo-1.2/CMake/FooConfig.cmake
diff --git a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/arch/zot-3.1/zot-config-version.cmake
index 31573b9..31573b9 100644
--- a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake
+++ b/Tests/FindPackageCMakeTest/lib/arch/zot-3.1/zot-config-version.cmake
diff --git a/Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/arch/zot-3.1/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/arch/zot-3.1/zot-config.cmake
diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/cmake/zot-3.1/zot-config-version.cmake
index e3e17de..e3e17de 100644
--- a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake
+++ b/Tests/FindPackageCMakeTest/lib/cmake/zot-3.1/zot-config-version.cmake
diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/cmake/zot-3.1/zot-config.cmake
index 2fbd525..2fbd525 100644
--- a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/cmake/zot-3.1/zot-config.cmake
diff --git a/Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config-version.cmake
new file mode 100644
index 0000000..822b449
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config-version.cmake
@@ -0,0 +1,7 @@
+set(PACKAGE_VERSION 4.0)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/cmake/zot-4.0/zot-config.cmake
diff --git a/Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake b/Tests/FindPackageCMakeTest/lib/foo-1.2/CMake/FooConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/foo-1.2/CMake/FooConfig.cmake
diff --git a/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake b/Tests/FindPackageCMakeTest/lib/foo-1.2/foo-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/foo-1.2/foo-config.cmake
diff --git a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake b/Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfig.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake
+++ b/Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfig.cmake
diff --git a/Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfigVersion.cmake b/Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfigVersion.cmake
new file mode 100644
index 0000000..b37bc8e
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/lib/suffix/test/SuffixTestConfigVersion.cmake
@@ -0,0 +1,7 @@
+set(PACKAGE_VERSION 1.2)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/zot-1.0/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/zot-1.0/zot-config.cmake
diff --git a/Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config-version.cmake
new file mode 100644
index 0000000..3b14664
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config-version.cmake
@@ -0,0 +1,4 @@
+set(PACKAGE_VERSION 2.0)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+endif()
diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/zot-2.0/zot-config.cmake
diff --git a/Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config-version.cmake
new file mode 100644
index 0000000..a4d45a4
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config-version.cmake
@@ -0,0 +1,4 @@
+set(PACKAGE_VERSION 3.0)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+endif()
diff --git a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/zot-3.0/zot-config.cmake
diff --git a/Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config-version.cmake
new file mode 100644
index 0000000..31573b9
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config-version.cmake
@@ -0,0 +1,7 @@
+set(PACKAGE_VERSION 3.1)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config.cmake
index deffa57..deffa57 100644
--- a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/zot-3.1/zot-config.cmake
diff --git a/Tests/FindPackageCMakeTest/lib/zot/zot-config-version.cmake b/Tests/FindPackageCMakeTest/lib/zot/zot-config-version.cmake
new file mode 100644
index 0000000..093776f
--- /dev/null
+++ b/Tests/FindPackageCMakeTest/lib/zot/zot-config-version.cmake
@@ -0,0 +1,9 @@
+# This version should never, ever be used.
+set(PACKAGE_VERSION_UNSUITABLE 1)
+set(PACKAGE_VERSION 3.1)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/FindPackageTest/lib/zot/zot-config.cmake b/Tests/FindPackageCMakeTest/lib/zot/zot-config.cmake
index 9168183..9168183 100644
--- a/Tests/FindPackageTest/lib/zot/zot-config.cmake
+++ b/Tests/FindPackageCMakeTest/lib/zot/zot-config.cmake
diff --git a/Tests/FindPackageCpsTest/CMakeLists.txt b/Tests/FindPackageCpsTest/CMakeLists.txt
new file mode 100644
index 0000000..f36bada
--- /dev/null
+++ b/Tests/FindPackageCpsTest/CMakeLists.txt
@@ -0,0 +1,300 @@
+cmake_minimum_required(VERSION 3.31)
+project(FindPackageCpsTest)
+
+set(CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES "e82e467b-f997-4464-8ace-b00808fff261")
+
+# Protect tests from running inside the default install prefix.
+set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/NotDefaultPrefix")
+
+# Use the test directory to Look for packages.
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+# Disable built-in search paths.
+set(CMAKE_FIND_USE_PACKAGE_ROOT_PATH OFF)
+set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF)
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH OFF)
+set(CMAKE_FIND_USE_INSTALL_PREFIX OFF)
+
+# Enable framework searching.
+set(CMAKE_FIND_FRAMEWORK FIRST)
+
+add_executable(FindPackageCpsTest FindPackageTest.cxx)
+
+###############################################################################
+
+function(expect PACKAGE VAR OP VALUE WHAT)
+ if(NOT ${PACKAGE}_${VAR} ${OP} ${VALUE})
+ message(SEND_ERROR "${PACKAGE} wrong ${WHAT} ${${PACKAGE}_${VAR}} !")
+ endif()
+endfunction()
+
+function(test_version PACKAGE LITERAL COUNT MAJOR MINOR PATCH TWEAK)
+ if(NOT ${PACKAGE}_FOUND)
+ message(SEND_ERROR "${PACKAGE} not found !")
+ else()
+ expect(${PACKAGE} VERSION STREQUAL "${LITERAL}" "version")
+ expect(${PACKAGE} VERSION_COUNT EQUAL ${COUNT} "version count")
+ expect(${PACKAGE} VERSION_MAJOR EQUAL ${MAJOR} "major version")
+ expect(${PACKAGE} VERSION_MINOR EQUAL ${MINOR} "minor version")
+ expect(${PACKAGE} VERSION_PATCH EQUAL ${PATCH} "patch version")
+ expect(${PACKAGE} VERSION_TWEAK EQUAL ${TWEAK} "tweak version")
+ endif()
+endfunction()
+
+function(test_unparsed_version PACKAGE VERSION)
+ find_package(${PACKAGE} CONFIG)
+ test_version(${PACKAGE} "${VERSION}" 0 0 0 0 0)
+endfunction()
+
+###############################################################################
+# Test a basic package search.
+# It should NOT find the package's CMake package file.
+
+find_package(Sample CONFIG)
+test_version(Sample "2.10.11" 3 2 10 11 0)
+
+###############################################################################
+# Test finding a package more than once.
+
+find_package(Repeat REQUIRED)
+find_package(Repeat REQUIRED)
+
+###############################################################################
+# Test some more complicated version parsing.
+
+find_package(LongVersion CONFIG)
+test_version(LongVersion "1.1.2.3.5.8+fibonacci" 6 1 1 2 3)
+
+find_package(EmptyMarker CONFIG)
+test_version(EmptyMarker "1.1+" 2 1 1 0 0)
+
+test_unparsed_version(BadVersion1 "1..1")
+test_unparsed_version(BadVersion2 "1.1a.0")
+test_unparsed_version(BadVersion3 "1.1.")
+test_unparsed_version(BadVersion4 "+42")
+test_unparsed_version(CustomVersion "VII")
+
+###############################################################################
+# Test finding a package whose CPS file is in the package prefix root.
+set(RootTest_DIR "${CMAKE_CURRENT_SOURCE_DIR}/RootTest")
+find_package(RootTest)
+if(NOT RootTest_FOUND)
+ message(SEND_ERROR "RootTest not found !")
+endif()
+
+###############################################################################
+# Test glob sorting.
+
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+set(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
+find_package(SortLib CONFIG)
+if(NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
+endif()
+unset(SortLib_VERSION)
+
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+find_package(SortLib CONFIG)
+if(NOT "${SortLib_VERSION}" STREQUAL "3.10.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Natural! Dec ${SortLib_VERSION}")
+endif()
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+unset(SortLib_VERSION)
+
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+FIND_PACKAGE(SortLib 4.0 CONFIG)
+IF (NOT "${SortLib_VERSION}" STREQUAL "4.0.0")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER gave up too soon! ${SortLib_VERSION}")
+endif()
+unset(SortLib_VERSION)
+
+set(SortFramework_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+set(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
+find_package(SortFramework CONFIG)
+if(NOT "${SortFramework_VERSION}" STREQUAL "3.1.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Framework Name Asc! ${SortFramework_VERSION}")
+endif()
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+unset(SortFramework_VERSION)
+
+set(SortFramework_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+find_package(SortFramework CONFIG)
+if(NOT "${SortFramework_VERSION}" STREQUAL "3.10.1")
+ message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Framework Natural! Dec ${SortFramework_VERSION}")
+endif()
+set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+unset(SortFramework_VERSION)
+
+unset(CMAKE_FIND_PACKAGE_SORT_ORDER)
+unset(CMAKE_FIND_PACKAGE_SORT_DIRECTION)
+
+###############################################################################
+# Find a package that actually has some content.
+
+find_package(Foo CONFIG)
+if(NOT Foo_FOUND)
+ message(SEND_ERROR "Foo not found !")
+elseif(NOT TARGET Foo::PrefixTest)
+ message(SEND_ERROR "Foo::PrefixTest missing !")
+elseif(NOT TARGET Foo::RelativeTest)
+ message(SEND_ERROR "Foo::RelativeTest missing !")
+elseif(NOT TARGET Foo::Empty)
+ message(SEND_ERROR "Foo::Empty missing !")
+else()
+ get_property(pt_includes
+ TARGET Foo::PrefixTest PROPERTY INTERFACE_INCLUDE_DIRECTORIES_DEFAULT)
+ if(NOT "${CMAKE_CURRENT_SOURCE_DIR}/include" PATH_EQUAL "${pt_includes}")
+ message(SEND_ERROR "Foo::PrefixTest has wrong includes '${pt_includes}' !")
+ endif()
+ set(pt_includes)
+
+ get_property(rt_includes
+ TARGET Foo::RelativeTest PROPERTY INTERFACE_INCLUDE_DIRECTORIES_DEFAULT)
+ if(NOT "${CMAKE_CURRENT_SOURCE_DIR}/cps/../include" PATH_EQUAL "${rt_includes}")
+ message(SEND_ERROR "Foo::RelativeTest has wrong includes '${rt_includes}' !")
+ endif()
+ set(rt_includes)
+endif()
+
+###############################################################################
+# Test importing of compile definitions.
+
+find_package(defs CONFIG REQUIRED)
+
+if(CMAKE_GENERATOR STREQUAL "Xcode" OR CMAKE_GENERATOR MATCHES "Visual Studio")
+ # VS/Xcode generators cannot use different definitions within the same
+ # target, so we must split the test into one target per language.
+ add_library(defs-test-c STATIC defs-test-c.c)
+ add_library(defs-test-cxx STATIC defs-test-cxx.cxx)
+ target_link_libraries(defs-test-c defs::defs)
+ target_link_libraries(defs-test-cxx defs::defs)
+else()
+ add_library(defs-test STATIC defs-test-c.c defs-test-cxx.cxx)
+ target_link_libraries(defs-test defs::defs)
+endif()
+
+###############################################################################
+# Test importing and mangling of requirements (i.e. link libraries).
+
+find_package(RequiresTest CONFIG REQUIRED)
+
+add_library(requires-test STATIC requires-test.cxx)
+target_link_libraries(requires-test RequiresTest::Indirect)
+
+###############################################################################
+# Test importing of (language-specific) include paths.
+
+include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
+
+find_package(includes CONFIG REQUIRED)
+
+set(CMAKE_REQUIRED_LIBRARIES includes::default)
+check_include_file(cmincludetest/global.h C_GLOBAL_H)
+check_include_file(cmincludetest/cxxonly.h C_CXXONLY_H)
+check_include_file_cxx(cmincludetest/cxxonly.h CXX_CXXONLY_H)
+set(CMAKE_REQUIRED_LIBRARIES)
+
+if(NOT C_GLOBAL_H)
+ message(SEND_ERROR "cmincludetest/global.h not found !")
+endif()
+if(NOT CXX_CXXONLY_H)
+ message(SEND_ERROR "cmincludetest/cxxonly.h not found in C++ mode !")
+endif()
+if(C_CXXONLY_H)
+ message(SEND_ERROR "cmincludetest/cxxonly.h unexpectedly found in C mode ?!")
+endif()
+
+###############################################################################
+# Find a package that has dependencies.
+
+find_package(Bar)
+if(NOT Bar_FOUND)
+ message(SEND_ERROR "Bar not found !")
+elseif(NOT Dep1_FOUND)
+ message(SEND_ERROR "Bar's Dep1 not found !")
+elseif(NOT Dep2_FOUND)
+ message(SEND_ERROR "Bar's Dep2 not found !")
+elseif(NOT Dep3_FOUND)
+ message(SEND_ERROR "Bar's Dep3 not found !")
+elseif(NOT TARGET Dep1::Target)
+ message(SEND_ERROR "Dep1::Target missing !")
+elseif(NOT TARGET Dep2::Target)
+ message(SEND_ERROR "Dep2::Target missing !")
+elseif(NOT TARGET Dep3::Target)
+ message(SEND_ERROR "Dep3::Target missing !")
+elseif(NOT TARGET Bar::Target1)
+ message(SEND_ERROR "Bar::Target1 missing !")
+elseif(NOT TARGET Bar::Target2)
+ message(SEND_ERROR "Bar::Target2 missing !")
+endif()
+
+###############################################################################
+# Test requesting components from a package.
+
+find_package(ComponentTest
+ COMPONENTS Target1 Target2
+ OPTIONAL_COMPONENTS Target4 Target6)
+if(NOT ComponentTest_FOUND)
+ message(SEND_ERROR "ComponentTest not found !")
+elseif(NOT TARGET ComponentTest::Target1)
+ message(SEND_ERROR "ComponentTest::Target1 missing !")
+elseif(NOT TARGET ComponentTest::Target2)
+ message(SEND_ERROR "ComponentTest::Target2 missing !")
+elseif(NOT TARGET ComponentTest::Target3)
+ message(SEND_ERROR "ComponentTest::Target3 missing !")
+elseif(NOT TARGET ComponentTest::Target4)
+ message(SEND_ERROR "ComponentTest::Target4 missing !")
+elseif(NOT TARGET ComponentTest::Target5)
+ message(SEND_ERROR "ComponentTest::Target5 missing !")
+elseif(TARGET ComponentTest::Target6)
+ message(SEND_ERROR "ComponentTest::Target6 exists ?!")
+elseif(TARGET ComponentTest::Target7)
+ message(SEND_ERROR "ComponentTest::Target7 exists ?!")
+elseif(TARGET ComponentTest::Target8)
+ message(SEND_ERROR "ComponentTest::Target8 exists ?!")
+endif()
+
+###############################################################################
+# Test requesting components from a dependency.
+
+find_package(TransitiveTest)
+if(NOT TransitiveTest_FOUND)
+ message(SEND_ERROR "TransitiveTest not found !")
+elseif(NOT TransitiveDep_FOUND)
+ message(SEND_ERROR "TransitiveTest's TransitiveDep not found !")
+elseif(NOT TARGET TransitiveDep::Target1)
+ message(SEND_ERROR "TransitiveDep::Target1 missing !")
+elseif(NOT TARGET TransitiveDep::Target2)
+ message(SEND_ERROR "TransitiveDep::Target2 missing !")
+elseif(NOT TARGET TransitiveDep::Target3)
+ message(SEND_ERROR "TransitiveDep::Target3 missing !")
+elseif(TARGET TransitiveDep::Target4)
+ message(SEND_ERROR "TransitiveDep::Target4 exists ?!")
+elseif(TARGET TransitiveDep::Target5)
+ message(SEND_ERROR "TransitiveDep::Target5 exists ?!")
+endif()
+
+###############################################################################
+# Test default configurations.
+
+find_package(DefaultConfigurationsTest)
+if(NOT DefaultConfigurationsTest_FOUND)
+ message(SEND_ERROR "DefaultConfigurationsTest not found !")
+elseif(NOT TARGET DefaultConfigurationsTest::Target)
+ message(SEND_ERROR "DefaultConfigurationsTest::Target missing !")
+else()
+ get_property(dct_configs
+ TARGET DefaultConfigurationsTest::Target PROPERTY IMPORTED_CONFIGURATIONS)
+ if(NOT "${dct_configs}" STREQUAL "DEFAULT;TEST")
+ message(SEND_ERROR "DefaultConfigurationsTest::Target has wrong configurations '${dct_configs}' !")
+ endif()
+ set(dct_configs)
+endif()
diff --git a/Tests/FindPackageCpsTest/FindPackageTest.cxx b/Tests/FindPackageCpsTest/FindPackageTest.cxx
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/FindPackageCpsTest/FindPackageTest.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/FindPackageCpsTest/RootTest/RootTest.cps b/Tests/FindPackageCpsTest/RootTest/RootTest.cps
new file mode 100644
index 0000000..5176954
--- /dev/null
+++ b/Tests/FindPackageCpsTest/RootTest/RootTest.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "RootTest",
+ "cps_path": "@prefix@",
+ "components": {
+ "Sample": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.1.1/Resources/CPS/SortFramework.cps b/Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.1.1/Resources/CPS/SortFramework.cps
new file mode 100644
index 0000000..930a292
--- /dev/null
+++ b/Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.1.1/Resources/CPS/SortFramework.cps
@@ -0,0 +1,7 @@
+{
+ "cps_version": "0.13",
+ "name": "SortFramework",
+ "version": "3.1.1",
+ "cps_path": "@prefix@/Resources/CPS",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.10.1/Resources/CPS/SortFramework.cps b/Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.10.1/Resources/CPS/SortFramework.cps
new file mode 100644
index 0000000..dc8423b
--- /dev/null
+++ b/Tests/FindPackageCpsTest/SortFramework.framework/Versions/3.10.1/Resources/CPS/SortFramework.cps
@@ -0,0 +1,7 @@
+{
+ "cps_version": "0.13",
+ "name": "SortFramework",
+ "version": "3.10.1",
+ "cps_path": "@prefix@/Resources/CPS",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cmake/SampleConfig.cmake b/Tests/FindPackageCpsTest/cmake/SampleConfig.cmake
new file mode 100644
index 0000000..fb180bc
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cmake/SampleConfig.cmake
@@ -0,0 +1,2 @@
+set(Sample_FOUND TRUE)
+set(Sample_VERSION 1.0)
diff --git a/Tests/FindPackageCpsTest/cmake/dep2-config.cmake b/Tests/FindPackageCpsTest/cmake/dep2-config.cmake
new file mode 100644
index 0000000..e2815f4
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cmake/dep2-config.cmake
@@ -0,0 +1,3 @@
+set(Dep2_FOUND TRUE)
+
+add_library(Dep2::Target INTERFACE IMPORTED)
diff --git a/Tests/FindPackageCpsTest/cps/ComponentTest-extra1.cps b/Tests/FindPackageCpsTest/cps/ComponentTest-extra1.cps
new file mode 100644
index 0000000..267ee49
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/ComponentTest-extra1.cps
@@ -0,0 +1,12 @@
+{
+ "cps_version": "0.13",
+ "name": "ComponentTest",
+ "components": {
+ "Target2": {
+ "type": "interface"
+ },
+ "Target3": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/ComponentTest-extra2.cps b/Tests/FindPackageCpsTest/cps/ComponentTest-extra2.cps
new file mode 100644
index 0000000..a1072c8
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/ComponentTest-extra2.cps
@@ -0,0 +1,12 @@
+{
+ "cps_version": "0.13",
+ "name": "ComponentTest",
+ "components": {
+ "Target4": {
+ "type": "interface"
+ },
+ "Target5": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/ComponentTest-extra3.cps b/Tests/FindPackageCpsTest/cps/ComponentTest-extra3.cps
new file mode 100644
index 0000000..683911f
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/ComponentTest-extra3.cps
@@ -0,0 +1,15 @@
+{
+ "cps_version": "0.13",
+ "name": "ComponentTest",
+ "requires": {
+ "DoesNotExist": null
+ },
+ "components": {
+ "Target6": {
+ "type": "interface"
+ },
+ "Target7": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/ComponentTest-extra4.cps b/Tests/FindPackageCpsTest/cps/ComponentTest-extra4.cps
new file mode 100644
index 0000000..badd41a
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/ComponentTest-extra4.cps
@@ -0,0 +1,9 @@
+{
+ "cps_version": "0.13",
+ "name": "ComponentTest",
+ "components": {
+ "Target8": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/ComponentTest.cps b/Tests/FindPackageCpsTest/cps/ComponentTest.cps
new file mode 100644
index 0000000..763d60e
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/ComponentTest.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "ComponentTest",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "Target1": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/DefaultConfigurationsTest.cps b/Tests/FindPackageCpsTest/cps/DefaultConfigurationsTest.cps
new file mode 100644
index 0000000..24e99ea
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/DefaultConfigurationsTest.cps
@@ -0,0 +1,16 @@
+{
+ "cps_version": "0.13",
+ "name": "DefaultConfigurationsTest",
+ "cps_path": "@prefix@/cps",
+ "configurations": [ "Default" ],
+ "components": {
+ "Target": {
+ "type": "interface",
+ "configurations": {
+ "Test": {
+ "includes": [ "@prefix@/include" ]
+ }
+ }
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/Repeat.cps b/Tests/FindPackageCpsTest/cps/Repeat.cps
new file mode 100644
index 0000000..55354fd
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/Repeat.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "Repeat",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "Repeat": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/RequiresTest.cps b/Tests/FindPackageCpsTest/cps/RequiresTest.cps
new file mode 100644
index 0000000..736e25c
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/RequiresTest.cps
@@ -0,0 +1,19 @@
+{
+ "cps_version": "0.13",
+ "name": "RequiresTest",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "Indirect": {
+ "type": "interface",
+ "requires": [ ":Direct" ]
+ },
+ "Direct": {
+ "type": "interface",
+ "definitions": {
+ "*": {
+ "ANSWER": 42
+ }
+ }
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/SortLib/3.1.1/SortLib.cps b/Tests/FindPackageCpsTest/cps/SortLib/3.1.1/SortLib.cps
new file mode 100644
index 0000000..978e511
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/SortLib/3.1.1/SortLib.cps
@@ -0,0 +1,7 @@
+{
+ "cps_version": "0.13",
+ "name": "SortLib",
+ "version": "3.1.1",
+ "cps_path": "@prefix@/cps/SortLib/3.1.1",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/SortLib/3.10.1/SortLib.cps b/Tests/FindPackageCpsTest/cps/SortLib/3.10.1/SortLib.cps
new file mode 100644
index 0000000..e22ed4a
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/SortLib/3.10.1/SortLib.cps
@@ -0,0 +1,7 @@
+{
+ "cps_version": "0.13",
+ "name": "SortLib",
+ "version": "3.10.1",
+ "cps_path": "@prefix@/cps/SortLib/3.10.1",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/TransitiveDep-extra1.cps b/Tests/FindPackageCpsTest/cps/TransitiveDep-extra1.cps
new file mode 100644
index 0000000..312a804
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/TransitiveDep-extra1.cps
@@ -0,0 +1,12 @@
+{
+ "cps_version": "0.13",
+ "name": "TransitiveDep",
+ "components": {
+ "Target2": {
+ "type": "interface"
+ },
+ "Target3": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/TransitiveDep-extra2.cps b/Tests/FindPackageCpsTest/cps/TransitiveDep-extra2.cps
new file mode 100644
index 0000000..b1dd4bd
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/TransitiveDep-extra2.cps
@@ -0,0 +1,9 @@
+{
+ "cps_version": "0.13",
+ "name": "TransitiveDep",
+ "components": {
+ "Target4": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/TransitiveDep-extra3.cps b/Tests/FindPackageCpsTest/cps/TransitiveDep-extra3.cps
new file mode 100644
index 0000000..6c307ba
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/TransitiveDep-extra3.cps
@@ -0,0 +1,12 @@
+{
+ "cps_version": "0.13",
+ "name": "ComponentTest",
+ "requires": {
+ "DoesNotExist": null
+ },
+ "components": {
+ "Target5": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/TransitiveDep.cps b/Tests/FindPackageCpsTest/cps/TransitiveDep.cps
new file mode 100644
index 0000000..1af27bb
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/TransitiveDep.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "TransitiveDep",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "Target1": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/TransitiveTest.cps b/Tests/FindPackageCpsTest/cps/TransitiveTest.cps
new file mode 100644
index 0000000..4c5e31e
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/TransitiveTest.cps
@@ -0,0 +1,11 @@
+{
+ "cps_version": "0.13",
+ "name": "TransitiveTest",
+ "cps_path": "@prefix@/cps",
+ "requires": {
+ "TransitiveDep": {
+ "components": [ "Target2" ]
+ }
+ },
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/badversion1.cps b/Tests/FindPackageCpsTest/cps/badversion1.cps
new file mode 100644
index 0000000..05acfa1
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/badversion1.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "BadVersion1",
+ "version": "1..1",
+ "version_schema": "simple",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/badversion2.cps b/Tests/FindPackageCpsTest/cps/badversion2.cps
new file mode 100644
index 0000000..99e683d
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/badversion2.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "BadVersion2",
+ "version": "1.1a.0",
+ "version_schema": "simple",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/badversion3.cps b/Tests/FindPackageCpsTest/cps/badversion3.cps
new file mode 100644
index 0000000..97e670d
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/badversion3.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "BadVersion3",
+ "version": "1.1.",
+ "version_schema": "simple",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/badversion4.cps b/Tests/FindPackageCpsTest/cps/badversion4.cps
new file mode 100644
index 0000000..2574866
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/badversion4.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "BadVersion4",
+ "version": "+42",
+ "version_schema": "simple",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/bar-extra.cps b/Tests/FindPackageCpsTest/cps/bar-extra.cps
new file mode 100644
index 0000000..688fc4a
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/bar-extra.cps
@@ -0,0 +1,13 @@
+{
+ "cps_version": "0.13",
+ "name": "Bar",
+ "requires": {
+ "Dep3": null
+ },
+ "components": {
+ "Target2": {
+ "type": "interface",
+ "requires": [ "Dep3:Target" ]
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/bar.cps b/Tests/FindPackageCpsTest/cps/bar.cps
new file mode 100644
index 0000000..eb0e1d3
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/bar.cps
@@ -0,0 +1,19 @@
+{
+ "cps_version": "0.13",
+ "name": "Bar",
+ "cps_path": "@prefix@/cps",
+ "requires": {
+ "Dep1": {
+ "components": [ "Target" ]
+ },
+ "Dep2": {
+ "components": [ "Target" ]
+ }
+ },
+ "components": {
+ "Target1": {
+ "type": "interface",
+ "requires": [ "Dep1:Target", "Dep2:Target" ]
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/customversion.cps b/Tests/FindPackageCpsTest/cps/customversion.cps
new file mode 100644
index 0000000..30aa29d
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/customversion.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "CustomVersion",
+ "version": "VII",
+ "version_schema": "roman",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/defs.cps b/Tests/FindPackageCpsTest/cps/defs.cps
new file mode 100644
index 0000000..cb93772
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/defs.cps
@@ -0,0 +1,27 @@
+{
+ "cps_version": "0.13",
+ "name": "defs",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "defs": {
+ "type": "interface",
+ "definitions": {
+ "c": {
+ "ONLY_IN_C": null,
+ "OVERRIDE1": "1",
+ "OVERRIDE2": "1"
+ },
+ "cxx": {
+ "ONLY_IN_CXX": null,
+ "OVERRIDE1": "2"
+ },
+ "*": {
+ "NOVALUE": null,
+ "EMPTYVALUE": "",
+ "OVERRIDE1": "0",
+ "OVERRIDE2": "0"
+ }
+ }
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/dep1.cps b/Tests/FindPackageCpsTest/cps/dep1.cps
new file mode 100644
index 0000000..3b6917d
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/dep1.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "Dep1",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "Target": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/dep3.cps b/Tests/FindPackageCpsTest/cps/dep3.cps
new file mode 100644
index 0000000..6805f8e
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/dep3.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "Dep3",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "Target": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/emptymarker.cps b/Tests/FindPackageCpsTest/cps/emptymarker.cps
new file mode 100644
index 0000000..2099c92
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/emptymarker.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "EmptyMarker",
+ "version": "1.1+",
+ "version_schema": "simple",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/foo-relative.cps b/Tests/FindPackageCpsTest/cps/foo-relative.cps
new file mode 100644
index 0000000..ff794fb
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/foo-relative.cps
@@ -0,0 +1,9 @@
+{
+ "cps_version": "0.13",
+ "name": "Foo",
+ "components": {
+ "RelativeTest": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/foo-relative@default.cps b/Tests/FindPackageCpsTest/cps/foo-relative@default.cps
new file mode 100644
index 0000000..c9e8d4f
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/foo-relative@default.cps
@@ -0,0 +1,9 @@
+{
+ "name": "Foo",
+ "configuration": "default",
+ "components": {
+ "RelativeTest": {
+ "includes": ["../include"]
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/foo.cps b/Tests/FindPackageCpsTest/cps/foo.cps
new file mode 100644
index 0000000..0475a9f
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/foo.cps
@@ -0,0 +1,14 @@
+{
+ "cps_version": "0.13",
+ "name": "Foo",
+ "cps_path": "@prefix@/cps",
+ "default_configurations": ["default"],
+ "components": {
+ "PrefixTest": {
+ "type": "interface"
+ },
+ "Empty": {
+ "type": "interface"
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/foo@default.cps b/Tests/FindPackageCpsTest/cps/foo@default.cps
new file mode 100644
index 0000000..a5b4147
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/foo@default.cps
@@ -0,0 +1,10 @@
+{
+ "cps_version": "0.13",
+ "name": "Foo",
+ "configuration": "default",
+ "components": {
+ "PrefixTest": {
+ "includes": ["@prefix@/include"]
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/includes.cps b/Tests/FindPackageCpsTest/cps/includes.cps
new file mode 100644
index 0000000..ea6b080
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/includes.cps
@@ -0,0 +1,15 @@
+{
+ "cps_version": "0.13",
+ "name": "includes",
+ "cps_path": "@prefix@/cps",
+ "components": {
+ "default": {
+ "type": "interface",
+ "includes": {
+ "bogus": [],
+ "cxx": ["@prefix@/include/cxx"],
+ "*": ["@prefix@/include"]
+ }
+ }
+ }
+}
diff --git a/Tests/FindPackageCpsTest/cps/longversion.cps b/Tests/FindPackageCpsTest/cps/longversion.cps
new file mode 100644
index 0000000..300952d
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/longversion.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "LongVersion",
+ "version": "1.1.2.3.5.8+fibonacci",
+ "version_schema": "simple",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/cps/sample.cps b/Tests/FindPackageCpsTest/cps/sample.cps
new file mode 100644
index 0000000..41ec3c3
--- /dev/null
+++ b/Tests/FindPackageCpsTest/cps/sample.cps
@@ -0,0 +1,8 @@
+{
+ "cps_version": "0.13",
+ "name": "Sample",
+ "version": "2.10.11",
+ "compat_version": "2.0.0",
+ "cps_path": "@prefix@/cps",
+ "components": {}
+}
diff --git a/Tests/FindPackageCpsTest/defs-test-c.c b/Tests/FindPackageCpsTest/defs-test-c.c
new file mode 100644
index 0000000..6415989
--- /dev/null
+++ b/Tests/FindPackageCpsTest/defs-test-c.c
@@ -0,0 +1,37 @@
+#ifndef OVERRIDE1
+# error OVERRIDE1 is not defined
+#endif
+#if OVERRIDE1 != 1
+# error OVERRIDE1 has the wrong value
+#endif
+
+#ifndef OVERRIDE2
+# error OVERRIDE2 is not defined
+#endif
+#if OVERRIDE2 != 1
+# error OVERRIDE2 has the wrong value
+#endif
+
+#ifndef ONLY_IN_C
+# error ONLY_IN_C is not defined in C sources
+#endif
+#ifdef ONLY_IN_CXX
+# error ONLY_IN_CXX is defined in C sources
+#endif
+
+#ifndef NOVALUE
+# error NOVALUE is not defined
+#endif
+#if !defined(__BORLANDC__)
+# if !NOVALUE
+# error NOVALUE evaluated as a Boolean is not true
+# endif
+#endif
+
+#ifndef EMPTYVALUE
+# error EMPTYVALUE is not defined
+#endif
+
+#if 3 - EMPTYVALUE - 3 != 6
+# error EMPTYVALUE is not empty
+#endif
diff --git a/Tests/FindPackageCpsTest/defs-test-cxx.cxx b/Tests/FindPackageCpsTest/defs-test-cxx.cxx
new file mode 100644
index 0000000..90acda2
--- /dev/null
+++ b/Tests/FindPackageCpsTest/defs-test-cxx.cxx
@@ -0,0 +1,37 @@
+#ifndef OVERRIDE1
+# error OVERRIDE1 is not defined
+#endif
+#if OVERRIDE1 != 2
+# error OVERRIDE1 has the wrong value
+#endif
+
+#ifndef OVERRIDE2
+# error OVERRIDE2 is not defined
+#endif
+#if OVERRIDE2 != 0
+# error OVERRIDE2 has the wrong value
+#endif
+
+#ifdef ONLY_IN_C
+# error ONLY_IN_C is defined in C++ sources
+#endif
+#ifndef ONLY_IN_CXX
+# error ONLY_IN_CXX is not defined in C++ sources
+#endif
+
+#ifndef NOVALUE
+# error NOVALUE is not defined
+#endif
+#if !defined(__BORLANDC__)
+# if !NOVALUE
+# error NOVALUE evaluated as a Boolean is not true
+# endif
+#endif
+
+#ifndef EMPTYVALUE
+# error EMPTYVALUE is not defined
+#endif
+
+#if 3 - EMPTYVALUE - 3 != 6
+# error EMPTYVALUE is not empty
+#endif
diff --git a/Tests/Wrapping/dummy b/Tests/FindPackageCpsTest/include/cmincludetest/global.h
index e69de29..e69de29 100644
--- a/Tests/Wrapping/dummy
+++ b/Tests/FindPackageCpsTest/include/cmincludetest/global.h
diff --git a/Tests/RunCMake/project_injected/CMP0048-WARN.cmake b/Tests/FindPackageCpsTest/include/cxx/cmincludetest/cxxonly.h
index e69de29..e69de29 100644
--- a/Tests/RunCMake/project_injected/CMP0048-WARN.cmake
+++ b/Tests/FindPackageCpsTest/include/cxx/cmincludetest/cxxonly.h
diff --git a/Tests/FindPackageCpsTest/include/foo.h b/Tests/FindPackageCpsTest/include/foo.h
new file mode 100644
index 0000000..2392aee
--- /dev/null
+++ b/Tests/FindPackageCpsTest/include/foo.h
@@ -0,0 +1 @@
+/* empty header file */
diff --git a/Tests/FindPackageCpsTest/requires-test.cxx b/Tests/FindPackageCpsTest/requires-test.cxx
new file mode 100644
index 0000000..39d649c
--- /dev/null
+++ b/Tests/FindPackageCpsTest/requires-test.cxx
@@ -0,0 +1,7 @@
+#ifndef ANSWER
+# error ANSWER is not defined
+#else
+# if ANSWER != 42
+# error ANSWER has the wrong value
+# endif
+#endif
diff --git a/Tests/FindPackageCpsTest/share/cps/SortLib/SortLib.cps b/Tests/FindPackageCpsTest/share/cps/SortLib/SortLib.cps
new file mode 100644
index 0000000..fdc99dc
--- /dev/null
+++ b/Tests/FindPackageCpsTest/share/cps/SortLib/SortLib.cps
@@ -0,0 +1,7 @@
+{
+ "cps_version": "0.13",
+ "name": "SortLib",
+ "version": "4.0.0",
+ "cps_path": "@prefix@/cps/SortLib",
+ "components": {}
+}
diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake
deleted file mode 100644
index 979bbdf..0000000
--- a/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-set(PACKAGE_VERSION 1.1)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
- set(PACKAGE_VERSION_COMPATIBLE 1)
- if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
- set(PACKAGE_VERSION_EXACT 1)
- endif()
-endif()
-
diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake
deleted file mode 100644
index 17caaa7..0000000
--- a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-set(PACKAGE_VERSION 1.2)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
- set(PACKAGE_VERSION_COMPATIBLE 1)
- if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2)
- set(PACKAGE_VERSION_EXACT 1)
- endif()
-endif()
-
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
deleted file mode 100644
index 73d3fb4..0000000
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ /dev/null
@@ -1,671 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-project(FindPackageTest)
-
-# Protect tests from running inside the default install prefix.
-set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/NotDefaultPrefix")
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
-
-# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
-# new (as of cmake 2.8.3) syntax. This works only if CMP0017 is set to NEW,
-# because otherwise FindPackageHandleStandardArgs.cmake from the current
-# directory is included (via CMAKE_MODULE_PATH).
-cmake_policy(SET CMP0017 NEW)
-find_package(ZLIB QUIET)
-
-# Look for a package that has a find module and may be found.
-find_package(OpenGL QUIET)
-
-# Look for a package that has no find module and will not be found.
-find_package(NotAPackage QUIET)
-
-# Look for a package that has an advanced find module.
-find_package(Boost QUIET)
-
-add_executable(FindPackageTest FindPackageTest.cxx)
-
-# test behavior of cmFindBase wrt. the CMAKE_PREFIX_PATH variable
-# foo.h should be found in ${CMAKE_CURRENT_SOURCE_DIR}/include:
-
-set(CMAKE_PREFIX_PATH /blub /blah "${CMAKE_CURRENT_SOURCE_DIR}")
-find_path(FOO_DIR foo.h)
-
-if(NOT FOO_DIR)
- message(FATAL_ERROR "Did not find foo.h which is in ${CMAKE_CURRENT_SOURCE_DIR}/include
- CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
-endif()
-
-find_package(VersionTestA 1)
-find_package(VersionTestB 1.2)
-find_package(VersionTestC 1.2.3)
-find_package(VersionTestD 1.2.3.4)
-
-
-find_package(LotsOfComponents COMPONENTS AComp OPTIONAL_COMPONENTS BComp CComp)
-if(NOT LOTSOFCOMPONENTS_FOUND)
- message(SEND_ERROR "LotsOfComponents not found !")
-endif()
-
-find_package(SomePackage)
-if(NOT SomePackage_FOUND)
- message(SEND_ERROR "SomePackage not found !")
-endif()
-if(NOT SOMEPACKAGE_FOUND)
- message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!")
-endif()
-
-find_package(UpperCasePackage)
-if(NOT UpperCasePackage_FOUND)
- message(SEND_ERROR "UpperCasePackage not found!")
-endif()
-if(NOT UPPERCASEPACKAGE_FOUND)
- message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!")
-endif()
-
-#-----------------------------------------------------------------------------
-# Test system package registry if possible.
-set(CMakeTestSystemPackage "")
-if(WIN32 AND NOT CYGWIN)
- # Try writing a value to the system package registry.
- set(_data "${FindPackageTest_SOURCE_DIR}/SystemPackage")
- set(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage")
- set(_file "${FindPackageTest_BINARY_DIR}/CMakeTestSystemPackage.data")
- file(WRITE ${_file} "${_data}\n")
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E md5sum ${_file}
- OUTPUT_VARIABLE _output ERROR_VARIABLE _error RESULT_VARIABLE _failed
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- string(REGEX REPLACE " .*" "" _value "${_output}")
- if(NOT _failed AND _value)
- execute_process(
- COMMAND reg add "${_key}" /v "${_value}" /t REG_SZ /d "${_data}" /f
- OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _failed
- )
- endif()
- # If the above worked, add the rest of the test and a rule to
- # cleanup the value.
- if(NOT _failed)
- message(STATUS "HKLM is writable: enabling CMakeTestSystemPackage")
- set(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f)
- set(CMakeTestSystemPackage CMakeTestSystemPackage)
- else()
- message(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage")
- endif()
-endif()
-
-#-----------------------------------------------------------------------------
-
-#set(CMAKE_FIND_DEBUG_MODE 1)
-
-# For purposes of the test wipe out previous find results.
-set(PACKAGES
- foo Foo Bar Blub TFramework Tframework TApp Tapp Special
- VersionedA VersionedB VersionedC VersionedD VersionedE
- VersionedF VersionedG VersionedH
- WrongA WrongB WrongC WrongD
- wibbleA wibbleB
- RecursiveA RecursiveB RecursiveC
- ArchA ArchB ArchC ArchD
- EnvA EnvB
- SetFoundTRUE SetFoundFALSE
- ${CMakeTestSystemPackage}
- )
-foreach(p ${PACKAGES})
- set(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-endforeach()
-
-# Enable framework and bundle searching. Make sure bundles are found
-# before unix-syle packages.
-set(CMAKE_FIND_FRAMEWORK LAST)
-set(CMAKE_FIND_APPBUNDLE FIRST)
-
-# Set the wrong answer for a find to make sure it re-finds.
-set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0)
-
-# Test that CMAKE_IGNORE_PATH can ignore the purposely bad package
-# files in the lib/cmake/zot-3.1 directory.
-set(CMAKE_IGNORE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-3.1)
-
-# Look for packages with new-style signatures.
-find_package(foo NO_MODULE)
-find_package(Foo CONFIGS FooConfig.cmake)
-find_package(Bar)
-set(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE)
-find_package(Blub NO_MODULE)
-find_package(TFramework CONFIGS TFrameworkConfig.cmake)
-find_package(Tframework)
-find_package(TApp)
-find_package(Tapp CONFIGS tapp-config.cmake)
-find_package(Special NAMES Suffix SuffixTest PATH_SUFFIXES test)
-find_package(VersionedA 2 NAMES zot)
-find_package(VersionedB 3.1 EXACT NAMES zot)
-find_package(VersionedC 4.0 EXACT NAMES zot)
-find_package(VersionedD 1.1 EXACT NAMES Baz)
-find_package(VersionedE 1.2 EXACT NAMES Baz)
-find_package(VersionedF 1.3 EXACT NAMES Baz)
-find_package(VersionedG 2.0 EXACT NAMES Baz)
-find_package(VersionedH 2.1 EXACT NAMES Baz)
-
-
-# Test Config files which set Xyz_FOUND themselves:
-find_package(SetFoundTRUE NO_MODULE)
-find_package(SetFoundFALSE NO_MODULE)
-
-# Test wrong initial path when result is present.
-set(WrongA_DIR "${VersionedD_DIR}")
-find_package(WrongA 1.2 EXACT NAMES Baz)
-
-# Test wrong initial cache entry of UNINITIALIZED type when result is present.
-set(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
-get_property(type CACHE WrongB_DIR PROPERTY TYPE)
-find_package(WrongB 1.2 EXACT NAMES Baz)
-
-# Test wrong initial path when result is missing.
-set(WrongC_DIR "${VersionedD_DIR}")
-find_package(WrongC 1.4 EXACT QUIET NAMES Baz)
-
-# Test wrong initial cache entry of UNINITIALIZED type when result is missing.
-set(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
-get_property(type CACHE WrongD_DIR PROPERTY TYPE)
-find_package(WrongD 1.4 EXACT QUIET NAMES Baz)
-
-# HINTS should override the system but PATHS should not
-list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A")
-find_package(wibbleA NAMES wibble PATHS B)
-find_package(wibbleB NAMES wibble HINTS B)
-
-# Look for package with recursive find-modules.
-find_package(RecursiveA COMPONENTS A)
-find_package(RecursiveB 2)
-find_package(RecursiveC 3.1 EXACT)
-
-# Test architecture-specific search directories.
-set(CMAKE_LIBRARY_ARCHITECTURE arch)
-find_package(ArchA NAMES Bar)
-find_package(ArchB NAMES Foo CONFIGS FooConfig.cmake)
-find_package(ArchC 3.1 EXACT NAMES zot)
-find_package(ArchD 4.0 EXACT NAMES zot)
-unset(CMAKE_LIBRARY_ARCHITECTURE)
-
-# Test find_package() with CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS enabled
-if(UNIX
- AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS
- )
- # Create ./symlink pointing back here.
- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
- . "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
- # Make find_package search through the symlink
- set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
-
- # First, test the default behavior where symlinks are preserved.
- set(SetFoundResolved_DIR "")
- find_package(SetFoundResolved)
- # The result must preserve the /symlink/ path.
- set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/symlink/cmake")
- if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}")
- message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")")
- endif()
-
- # This part of the test only works if there are no symlinks in our path.
- get_filename_component(real_src_dir "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH)
- if(real_src_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- # Resolve symlinks when finding the package.
- set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE)
- set(SetFoundResolved_DIR "")
- find_package(SetFoundResolved)
- # ./symlink points back here so it should be gone when resolved.
- set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
- if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}")
- message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")")
- endif()
- endif()
-
- # Cleanup.
- unset(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS)
- file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
-endif()
-
-# Test <PackageName>_DIR environment variable.
-# We erase the main prefix path to ensure the env var is used.
-set(CMAKE_PREFIX_PATH)
-set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
-find_package(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work
-find_package(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail
-
-# Test system package registry if available.
-if(CMakeTestSystemPackage)
- find_package(CMakeTestSystemPackage)
- execute_process(COMMAND ${CMakeTestSystemPackage_CLEANUP}
- OUTPUT_VARIABLE _output ERROR_VARIABLE _error)
-endif()
-
-# Expected locations at which packages should be found.
-set(foo_EXPECTED "lib/foo-1.2/foo-config.cmake")
-set(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake")
-set(Bar_EXPECTED "lib/Bar/BarConfig.cmake")
-set(Blub_MISSING "")
-set(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake")
-set(TFramework_EXPECTED
- "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake")
-set(Tframework_EXPECTED
- "TFramework.framework/Versions/A/Resources/tframework-config.cmake")
-set(TApp_EXPECTED
- "TApp.app/Contents/Resources/TAppConfig.cmake")
-set(Tapp_EXPECTED
- "TApp.app/Contents/Resources/cmake/tapp-config.cmake")
-set(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
-set(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
-set(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake")
-set(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake")
-set(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake")
-set(VersionedF_EXPECTED "Baz 1.3/lib/cmake/Baz/BazConfig.cmake")
-set(VersionedG_EXPECTED "Baz 2.0/share/Baz 2/BazConfig.cmake")
-set(VersionedH_EXPECTED "Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake")
-set(WrongA_EXPECTED "${VersionedE_EXPECTED}")
-set(WrongB_EXPECTED "${VersionedE_EXPECTED}")
-set(WrongC_MISSING "WrongC_DIR-NOTFOUND")
-set(WrongD_MISSING "WrongD_DIR-NOTFOUND")
-set(wibbleA_EXPECTED "A/wibble-config.cmake")
-set(wibbleB_EXPECTED "B/wibble-config.cmake")
-set(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
-set(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
-set(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
-set(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake")
-set(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake")
-set(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake")
-set(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake")
-set(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake")
-set(EnvB_MISSING "EnvB_DIR-NOTFOUND")
-set(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake")
-set(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-set(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake")
-
-# Check the results.
-foreach(p ${PACKAGES})
- if(DEFINED ${p}_MISSING)
- # Check and report failure.
- if(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}")
- message(SEND_ERROR
- "Package ${p} should have been [${${p}_MISSING}] but "
- "was [${${p}_DIR}]")
- endif()
- if(${p}_FOUND)
- message(SEND_ERROR
- "Package ${p} should not have been found, but ${p}_FOUND is set to "
- "\"${${p}_FOUND}\"")
- endif()
- elseif(${p}_FOUND)
- # Convert to relative path for comparison to expected location.
- file(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}"
- "${${p}_CONFIG}")
-
- # Debugging output.
- if(CMAKE_FIND_DEBUG_MODE)
- message("Package ${p} found [${REL_${p}_CONFIG}]")
- endif()
-
- # Check and report failure.
- if(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}")
- message(SEND_ERROR
- "Package ${p} should have been [${${p}_EXPECTED}] but "
- "was [${REL_${p}_CONFIG}]")
- endif()
- else()
- message(SEND_ERROR "Package ${p} not found!")
- endif()
-endforeach()
-
-# Check that version information was extracted.
-if(NOT "${VersionedA_VERSION}" STREQUAL "2.0")
- message(SEND_ERROR
- "Package VersionedA is version [${VersionedA_VERSION}], not [2.0]")
-endif()
-if(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2")
- message(SEND_ERROR
- "Package VersionedA is major version [${VersionedA_VERSION_MAJOR}], not [2]")
-endif()
-if(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0")
- message(SEND_ERROR
- "Package VersionedA is minor version [${VersionedA_VERSION_MINOR}], not [0]")
-endif()
-
-if(NOT "${VersionedB_VERSION}" STREQUAL "3.1")
- message(SEND_ERROR
- "Package VersionedB is version [${VersionedB_VERSION}], not [3.1]")
-endif()
-if(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3")
- message(SEND_ERROR
- "Package VersionedB is major version [${VersionedB_VERSION_MAJOR}], not [3]")
-endif()
-if(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1")
- message(SEND_ERROR
- "Package VersionedB is minor version [${VersionedB_VERSION_MINOR}], not [1]")
-endif()
-
-if(NOT "${Special_VERSION}" STREQUAL "1.2")
- message(SEND_ERROR
- "Package Special is version [${Special_VERSION}], not [1.2]")
-endif()
-if(NOT "${Special_VERSION_MAJOR}" STREQUAL "1")
- message(SEND_ERROR
- "Package Special is major version [${Special_VERSION_MAJOR}], not [1]")
-endif()
-if(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
- message(SEND_ERROR
- "Package Special is minor version [${Special_VERSION_MINOR}], not [2]")
-endif()
-
-# Test version number comparison.
-if(NOT "1.2.3.4" VERSION_LESS "1.2.3.5")
- message(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!")
-endif()
-if(NOT "1.2" VERSION_LESS "1.10")
- message(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!")
-endif()
-if(NOT "1.02" VERSION_GREATER "1.1")
- message(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!")
-endif()
-if("1.2.3" VERSION_GREATER "1.2.3.4")
- message(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!")
-endif()
-if(NOT "1.2" VERSION_EQUAL "1.2.0.0")
- message(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
-endif()
-
-#-----------------------------------------------------------------------------
-# Test export(PACKAGE) with find_package.
-
-# Choose a unique version.
-string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
-string(RANDOM LENGTH 4 ALPHABET "0123456789" v)
-string(APPEND version ".${v}")
-
-message(STATUS "Preparing export(PACKAGE) test project")
-try_compile(EXPORTER_COMPILED
- ${FindPackageTest_BINARY_DIR}/Exporter-build
- ${FindPackageTest_SOURCE_DIR}/Exporter
- CMakeTestExportPackage dummy
- CMAKE_FLAGS "-UCMAKE_EXPORT_NO_PACKAGE_REGISTRY"
- "-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=OLD"
- -Dversion=${version}
- OUTPUT_VARIABLE output)
-message(STATUS "Searching for export(PACKAGE) test project")
-set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
- "Wipe out find results for testing." FORCE)
-
-message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=TRUE")
-set(CMAKE_FIND_USE_PACKAGE_REGISTRY TRUE)
-find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
-if(NOT CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
-endif()
-unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
-
-message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=FALSE")
-set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY FALSE)
-find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
-if(NOT CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
-endif()
-unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
-
-message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=TRUE and CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE")
-set(CMAKE_FIND_USE_PACKAGE_REGISTRY TRUE)
-set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY TRUE)
-set(CMakeTestExportPackage_DIR FALSE)
-find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
-if(NOT CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
-endif()
-unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
-unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
-
-message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=FALSE and CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=FALSE")
-set(CMAKE_FIND_USE_PACKAGE_REGISTRY FALSE)
-set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY FALSE)
-set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
- "Wipe out find results for testing." FORCE)
-find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
-if(CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should be not FOUND!")
-endif()
-unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
-unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
-
-message(STATUS "Remove export(PACKAGE) test project")
-file(REMOVE_RECURSE ${FindPackageTest_BINARY_DIR}/Exporter-build)
-set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
- "Wipe out find results for testing." FORCE)
-find_package(CMakeTestExportPackage QUIET) # Should clean the user package cache
-#
-message(STATUS "Preparing export(PACKAGE) test project with CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE")
-try_compile(EXPORTER_COMPILED
- ${FindPackageTest_BINARY_DIR}/Exporter-build
- ${FindPackageTest_SOURCE_DIR}/Exporter
- CMakeTestExportPackage dummy
- CMAKE_FLAGS "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE"
- -Dversion=${version}
- OUTPUT_VARIABLE output)
-message(STATUS "Searching for export(PACKAGE) test project")
-find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
-if(CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!")
-endif()
-
-message(STATUS "Remove export(PACKAGE) test project")
-file(REMOVE_RECURSE ${FindPackageTest_BINARY_DIR}/Exporter-build)
-
-message(STATUS "Preparing export(PACKAGE) test project with POLICY CMP0090=NEW")
-try_compile(EXPORTER_COMPILED
- ${FindPackageTest_BINARY_DIR}/Exporter-build
- ${FindPackageTest_SOURCE_DIR}/Exporter
- CMakeTestExportPackage dummy
- CMAKE_FLAGS
- "-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=NEW"
- -Dversion=${version}
- OUTPUT_VARIABLE output)
-message(STATUS "Searching for export(PACKAGE) test project")
-find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
-if(CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!")
-endif()
-
-
-#-----------------------------------------------------------------------------
-# Test configure_package_config_file().
-
-include(CMakePackageConfigHelpers)
-
-# Generate a config file ready to be installed.
-set(INCLUDE_INSTALL_DIR include )
-set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" )
-set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
-
-configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
- INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
- PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
- )
-
-set(Relocatable_FIND_COMPONENTS AComp BComp CComp)
-set(Relocatable_FIND_REQUIRED_BComp 1)
-include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
-
-if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
- message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")")
-endif()
-
-if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
- message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")")
-endif()
-
-if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")")
-endif()
-
-if(NOT DEFINED Relocatable_FOUND)
- message(SEND_ERROR "Relocatable_FOUND not defined !")
-endif()
-
-if(Relocatable_FOUND)
- message(SEND_ERROR "Relocatable_FOUND set to TRUE !")
-endif()
-
-# Generate a config file for the build tree.
-set(INCLUDE_INSTALL_DIR include )
-set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/share/" )
-set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
-
-configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
- INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
- PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
- INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
- )
-
-set(Relocatable_FIND_COMPONENTS AComp BComp CComp)
-set(Relocatable_FIND_REQUIRED_BComp 1)
-include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
-
-if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
- message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")")
-endif()
-
-if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
- message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")")
-endif()
-
-if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")")
-endif()
-
-if(NOT DEFINED Relocatable_FOUND)
- message(SEND_ERROR "Relocatable_FOUND not defined !")
-endif()
-
-if(Relocatable_FOUND)
- message(SEND_ERROR "Relocatable_FOUND set to TRUE !")
-endif()
-
-
-############################################################################
-##Test FIND_PACKAGE using sorting
-set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
-SET(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
-SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
-
-set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-FIND_PACKAGE(SortLib CONFIG)
-IF (NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
- message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
-endif()
-unset(SortLib_VERSION)
-
-
-set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
-SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
-FIND_PACKAGE(SortLib CONFIG)
-IF (NOT "${SortLib_VERSION}" STREQUAL "3.10.1")
- message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Natural! Dec ${SortLib_VERSION}")
-endif()
-set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-unset(SortLib_VERSION)
-
-
-set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-FIND_PACKAGE(SortLib 4.0 CONFIG)
-IF (NOT "${SortLib_VERSION}" STREQUAL "4.0.0")
- message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER gave up too soon! ${SortLib_VERSION}")
-endif()
-unset(SortLib_VERSION)
-
-unset(CMAKE_FIND_PACKAGE_SORT_ORDER)
-unset(CMAKE_FIND_PACKAGE_SORT_DIRECTION)
-set(CMAKE_PREFIX_PATH )
-
-############################################################################
-##Test FIND_PACKAGE CMAKE_FIND_PACKAGE_PREFER_CONFIG
-
-set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfig)
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfig)
-
-# prefer module mode
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
-unset(ABC_FOUND)
-unset(ABC_CONFIG)
-
-find_package(ABC)
-if(NOT ABC_FOUND)
- message(SEND_ERROR "Did not find ABC package")
-endif()
-if(ABC_CONFIG)
- message(SEND_ERROR "Incorrectly found ABC in CONFIG mode, expected to find it with MODULE mode")
-endif()
-
-# Now prefer config mode
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
-unset(ABC_FOUND)
-unset(ABC_CONFIG)
-
-find_package(ABC)
-if(NOT ABC_FOUND)
- message(SEND_ERROR "Did not find ABC package")
-endif()
-if(NOT ABC_CONFIG)
- message(SEND_ERROR "Incorrectly found ABC in MODULE mode, expected to find it with CONFIG mode")
-endif()
-
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
-set(CMAKE_PREFIX_PATH)
-set(CMAKE_MODULE_PATH)
-
-############################################################################
-##Test FIND_PACKAGE CMAKE_FIND_PACKAGE_PREFER_CONFIG - Do not recurse
-
-# No CMAKE_PREFIX_PATH
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigRecurse)
-
-# Now prefer config mode
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
-unset(ACME_FOUND)
-unset(ACME_CONFIG)
-
-find_package(ACME)
-if(ACME_FOUND AND ACME_CONFIG)
- message(SEND_ERROR "Incorrectly found ACME in CONFIG mode, from the MODULE package")
-endif()
-
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
-set(CMAKE_MODULE_PATH)
-
-############################################################################
-##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with module fallback
-
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigOnlyModule)
-
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
-
-find_package(ACME REQUIRED)
-
-if(NOT ACME_FOUND)
- message(SEND_ERROR "Did not find ACME package")
-endif()
-
-############################################################################
-##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with NO_MODULE
-
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigOnlyModule)
-
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
-
-find_package(ACME NO_MODULE)
-
-if(ACME_FOUND)
- message(SEND_ERROR "Should not find ACME package")
-endif()
-
-############################################################################
-##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with unknown package
-
-set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
-find_package(DoesNotExist)
diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake
deleted file mode 100644
index bcefcd7..0000000
--- a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-set(PACKAGE_VERSION 4.0)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4)
- set(PACKAGE_VERSION_COMPATIBLE 1)
- if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0)
- set(PACKAGE_VERSION_EXACT 1)
- endif()
-endif()
-
diff --git a/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake
deleted file mode 100644
index db3a8a4..0000000
--- a/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(PACKAGE_VERSION 2.0)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2)
- set(PACKAGE_VERSION_COMPATIBLE 1)
-endif()
-
diff --git a/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake
deleted file mode 100644
index dd9c939..0000000
--- a/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(PACKAGE_VERSION 3.0)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
- set(PACKAGE_VERSION_COMPATIBLE 1)
-endif()
-
diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake
deleted file mode 100644
index 8fa767e..0000000
--- a/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-set(PACKAGE_VERSION 3.1)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
- set(PACKAGE_VERSION_COMPATIBLE 1)
- if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
- set(PACKAGE_VERSION_EXACT 1)
- endif()
-endif()
-
diff --git a/Tests/FindPackageTest/lib/zot/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake
deleted file mode 100644
index 430f009..0000000
--- a/Tests/FindPackageTest/lib/zot/zot-config-version.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-# This version should never, ever be used.
-set(PACKAGE_VERSION_UNSUITABLE 1)
-set(PACKAGE_VERSION 3.1)
-if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
- set(PACKAGE_VERSION_COMPATIBLE 1)
- if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
- set(PACKAGE_VERSION_EXACT 1)
- endif()
-endif()
-
diff --git a/Tests/FindProtobuf/CMakeLists.txt b/Tests/FindProtobuf/CMakeLists.txt
index b4ca29b..8e46ff8 100644
--- a/Tests/FindProtobuf/CMakeLists.txt
+++ b/Tests/FindProtobuf/CMakeLists.txt
@@ -9,3 +9,4 @@ add_test(NAME FindProtobuf.Test COMMAND
"-DCMake_TEST_FindProtobuf_gRPC=${CMake_TEST_FindProtobuf_gRPC}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+set_property(TEST FindProtobuf.Test PROPERTY FAIL_REGULAR_EXPRESSION PROTOC_EXE)
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt
index 2859c48..1409bd9 100644
--- a/Tests/FindProtobuf/Test/CMakeLists.txt
+++ b/Tests/FindProtobuf/Test/CMakeLists.txt
@@ -70,7 +70,7 @@ if(CMake_TEST_FindProtobuf_gRPC)
# NOTE: with IMPORT_DIRS msgs/, generated files will be placed under ${CMAKE_CURRENT_BINARY_DIR}/grpc/
target_include_directories(msgs_grpc_IMPORT_DIRS PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/grpc/)
target_link_libraries(msgs_grpc_IMPORT_DIRS PUBLIC ${Protobuf_LIBRARIES})
- protobuf_generate(TARGET msgs_grpc_IMPORT_DIRS LANGUAGE cpp IMPORT_DIRS msgs/)
+ protobuf_generate(TARGET msgs_grpc_IMPORT_DIRS LANGUAGE cpp IMPORT_DIRS msgs/ PROTOC_EXE ${Protobuf_PROTOC_EXECUTABLE})
protobuf_generate(TARGET msgs_grpc_IMPORT_DIRS LANGUAGE grpc IMPORT_DIRS msgs/ GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc PLUGIN "protoc-gen-grpc=${gRPC_CPP_PLUGIN}")
add_executable(test_generate_grpc_IMPORT_DIRS main-generate-grpc.cxx)
target_link_libraries(test_generate_grpc_IMPORT_DIRS PRIVATE msgs_grpc_IMPORT_DIRS)
diff --git a/Tests/FindProtobuf/Test/main-desc.cxx b/Tests/FindProtobuf/Test/main-desc.cxx
index dc768ab..a961097 100644
--- a/Tests/FindProtobuf/Test/main-desc.cxx
+++ b/Tests/FindProtobuf/Test/main-desc.cxx
@@ -14,7 +14,7 @@ int main(int argc, char* argv[])
google::protobuf::FileDescriptorSet file_descriptor_set;
file_descriptor_set.ParseFromIstream(&fs);
- const google::protobuf::DescriptorPool* compiled_pool =
+ google::protobuf::DescriptorPool const* compiled_pool =
google::protobuf::DescriptorPool::generated_pool();
if (compiled_pool == NULL) {
@@ -25,15 +25,15 @@ int main(int argc, char* argv[])
google::protobuf::DescriptorPool pool(compiled_pool);
google::protobuf::DynamicMessageFactory dynamic_message_factory(&pool);
- for (const google::protobuf::FileDescriptorProto& file_descriptor_proto :
+ for (google::protobuf::FileDescriptorProto const& file_descriptor_proto :
file_descriptor_set.file()) {
- const google::protobuf::FileDescriptor* file_descriptor =
+ google::protobuf::FileDescriptor const* file_descriptor =
pool.BuildFile(file_descriptor_proto);
if (file_descriptor == NULL) {
continue;
}
- const google::protobuf::Descriptor* descriptor =
+ google::protobuf::Descriptor const* descriptor =
pool.FindMessageTypeByName("example.msgs.ExampleDesc");
if (descriptor == NULL) {
diff --git a/Tests/FindPython/ArtifactsPrefix/CMakeLists.txt b/Tests/FindPython/ArtifactsPrefix/CMakeLists.txt
new file mode 100644
index 0000000..d007017
--- /dev/null
+++ b/Tests/FindPython/ArtifactsPrefix/CMakeLists.txt
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.31)
+
+project(TestArtifactsPrefix C)
+
+set(Python_ARTIFACTS_PREFIX "_V2")
+find_package (Python 2 EXACT REQUIRED)
+
+if(NOT Python_V2_FOUND OR NOT Python_FOUND)
+ message(FATAL_ERROR "Python v2 interpreter not found.")
+endif()
+if(NOT Python_V2_VERSION_MAJOR VERSION_EQUAL 2)
+ message(FATAL_ERROR "Python v2 interpreter: wrong major version.")
+endif()
+
+
+set(Python_ARTIFACTS_PREFIX "_V3")
+find_package (Python 3 EXACT REQUIRED)
+
+if(NOT Python_V3_FOUND OR NOT Python_FOUND)
+ message(FATAL_ERROR "Python v3 interpreter not found.")
+endif()
+if(NOT Python_V3_VERSION_MAJOR VERSION_EQUAL 3)
+ message(FATAL_ERROR "Python v3 interpreter: wrong major version.")
+endif()
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 636a7b0..f275013 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -342,16 +342,18 @@ if(CMake_TEST_FindPython3)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.Python3Embedded COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Embedded"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python3Embedded"
- ${build_generator_args}
- --build-project TestPython3Embedded
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
+ if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "4.8")
+ add_test(NAME FindPython.Python3Embedded COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Embedded"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3Embedded"
+ ${build_generator_args}
+ --build-project TestPython3Embedded
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ endif()
add_test(NAME FindPython.RequiredArtifacts COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
@@ -430,10 +432,13 @@ if(CMake_TEST_FindPython3)
FindPython.Python.V3.ExactVersion.LOCATION FindPython.Python.V3.ExactVersion.VERSION
FindPython.Python3.VersionRange.LOCATION FindPython.Python3.VersionRange.VERSION
FindPython.Python.V3.VersionRange.LOCATION FindPython.Python.V3.VersionRange.VERSION
- FindPython.VirtualEnv FindPython.Python3Embedded FindPython.RequiredArtifacts
+ FindPython.VirtualEnv FindPython.RequiredArtifacts
FindPython.ArtifactsInteractive.ON FindPython.ArtifactsInteractive.OFF
FindPython.CustomFailureMessage FindPython.DifferentComponents
APPEND PROPERTY LABELS Python3)
+ if(TEST FindPython.Python3Embedded)
+ set_property(TEST FindPython.Python3Embedded APPEND PROPERTY LABELS Python3)
+ endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_test(NAME FindPython.UnversionedNames COMMAND
@@ -518,6 +523,21 @@ if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3)
APPEND PROPERTY LABELS Python2 Python3)
endif()
+if(CMake_TEST_FindPython2 AND CMake_TEST_FindPython3)
+ add_test(NAME FindPython.ArtifactsPrefix COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ArtifactsPrefix"
+ "${CMake_BINARY_DIR}/Tests/FindPython/ArtifactsPrefix"
+ ${build_generator_args}
+ --build-project TestArtifactsPrefix
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ set_property(TEST FindPython.ArtifactsPrefix
+ APPEND PROPERTY LABELS Python2 Python3)
+endif()
if(CMake_TEST_FindPython2_SABIModule)
add_test(NAME FindPython.Python2.Development.SABIModule COMMAND
diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt
index 7074649..187a2e2 100644
--- a/Tests/FindPython/Python/CMakeLists.txt
+++ b/Tests/FindPython/Python/CMakeLists.txt
@@ -38,3 +38,43 @@ else()
COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python
-P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake")
endif()
+
+
+#
+# New search with user's prefix
+#
+foreach(item IN ITEMS FOUND Development_FOUND Development.Module_FOUND Development.Embed_FOUND)
+ unset(Python_${item})
+endforeach()
+
+set(Python_ARTIFACTS_PREFIX "_TEST")
+find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Development)
+if (NOT Python_TEST_FOUND OR NOT Python_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} (TEST prefix)")
+endif()
+if (NOT Python_TEST_Development.Module_FOUND OR NOT Python_Development.Module_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module' (TEST prefix)")
+endif()
+if (NOT Python_TEST_Development.Embed_FOUND OR NOT Python_Development.Embed_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed' (TEST prefix)")
+endif()
+
+if(NOT TARGET Python_TEST::Interpreter)
+ message(SEND_ERROR "Python_TEST::Interpreter not found")
+endif()
+
+if(NOT TARGET Python_TEST::Python)
+ message(SEND_ERROR "Python_TEST::Python not found")
+endif()
+if(NOT TARGET Python_TEST::Module)
+ message(SEND_ERROR "Python_TEST::Module not found")
+endif()
+
+if (Python_REQUESTED_VERSION)
+ Python_TEST_add_library (TEST_spam${Python_REQUESTED_VERSION} MODULE ../TEST_spam.c)
+ target_compile_definitions (TEST_spam${Python_REQUESTED_VERSION} PRIVATE PYTHON${Python_REQUESTED_VERSION})
+
+ add_test (NAME python_TEST_spam${Python_REQUESTED_VERSION}
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:TEST_spam${Python_REQUESTED_VERSION}>"
+ "${Python_INTERPRETER}" -c "import TEST_spam${Python_REQUESTED_VERSION}; TEST_spam${Python_REQUESTED_VERSION}.system(\"cd\")")
+endif()
diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt
index f858574..ffbb140 100644
--- a/Tests/FindPython/Python2/CMakeLists.txt
+++ b/Tests/FindPython/Python2/CMakeLists.txt
@@ -45,3 +45,44 @@ add_test(NAME findpython2_script
COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python2
-DPython2_FIND_STRATEGY=${Python2_FIND_STRATEGY}
-P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake")
+
+
+#
+# New search with user's prefix
+#
+foreach(item IN ITEMS FOUND Development_FOUND Development.Module_FOUND Development.Embed_FOUND)
+ unset(Python2_${item})
+endforeach()
+
+set(Python2_ARTIFACTS_PREFIX "_TEST")
+find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
+if (NOT Python2_TEST_FOUND OR NOT Python2_FOUND)
+ message (FATAL_ERROR "Failed to find Python 2 (TEST prefix)")
+endif()
+if (NOT Python2_TEST_Development_FOUND OR NOT Python2_Development_FOUND)
+ message (FATAL_ERROR "Failed to find Python 2 'Development' component (TEST prefix)")
+endif()
+if (NOT Python2_TEST_Development.Module_FOUND OR NOT Python2_Development.Module_FOUND)
+ message (FATAL_ERROR "Failed to find Python 2 'Development.Module' component (TEST prefix)")
+endif()
+if (NOT Python2_TEST_Development.Embed_FOUND OR NOT Python2_Development.Embed_FOUND)
+ message (FATAL_ERROR "Failed to find Python 2 'Development.Embed' component (TEST prefix)")
+endif()
+
+if(NOT TARGET Python2_TEST::Interpreter)
+ message(SEND_ERROR "Python2_TEST::Interpreter not found")
+endif()
+
+if(NOT TARGET Python2_TEST::Python)
+ message(SEND_ERROR "Python2_TEST::Python not found")
+endif()
+if(NOT TARGET Python2_TEST::Module)
+ message(SEND_ERROR "Python2_TEST::Module not found")
+endif()
+
+Python2_TEST_add_library (TEST_spam2 MODULE ../TEST_spam.c)
+target_compile_definitions (TEST_spam2 PRIVATE PYTHON2)
+
+add_test (NAME python2_TEST_spam2
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:TEST_spam2>"
+ "${Python2_INTERPRETER}" -c "import TEST_spam2; TEST_spam2.system(\"cd\")")
diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt
index 28f68e1..bac6ed5 100644
--- a/Tests/FindPython/Python3/CMakeLists.txt
+++ b/Tests/FindPython/Python3/CMakeLists.txt
@@ -102,3 +102,44 @@ add_test(NAME python3_find_invalid_abi
-DPython3_FIND_STRATEGY=${Python3_FIND_STRATEGY}
"-DPython3_FIND_ABI=${Python3_INVALID_ABI}"
-P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake")
+
+
+#
+# New search with user's prefix
+#
+foreach(item IN ITEMS FOUND Development_FOUND Development.Module_FOUND Development.Embed_FOUND)
+ unset(Python3_${item})
+endforeach()
+
+set(Python3_ARTIFACTS_PREFIX "_TEST")
+find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+if (NOT Python3_TEST_FOUND OR NOT Python3_FOUND)
+ message (FATAL_ERROR "Failed to find Python 3 (TEST prefix)")
+endif()
+if (NOT Python3_TEST_Development_FOUND OR NOT Python3_Development_FOUND)
+ message (FATAL_ERROR "Failed to find Python 3 'Development' component (TEST prefix)")
+endif()
+if (NOT Python3_TEST_Development.Module_FOUND OR NOT Python3_Development.Module_FOUND)
+ message (FATAL_ERROR "Failed to find Python 3 'Development.Module' component (TEST prefix)")
+endif()
+if (NOT Python3_TEST_Development.Embed_FOUND OR NOT Python3_Development.Embed_FOUND)
+ message (FATAL_ERROR "Failed to find Python 3 'Development.Embed' component (TEST prefix)")
+endif()
+
+if(NOT TARGET Python3_TEST::Interpreter)
+ message(SEND_ERROR "Python3_TEST::Interpreter not found")
+endif()
+
+if(NOT TARGET Python3_TEST::Python)
+ message(SEND_ERROR "Python3_TEST::Python not found")
+endif()
+if(NOT TARGET Python3_TEST::Module)
+ message(SEND_ERROR "Python3_TEST::Module not found")
+endif()
+
+Python3_TEST_add_library (TEST_spam3 MODULE ../TEST_spam.c)
+target_compile_definitions (TEST_spam3 PRIVATE PYTHON3)
+
+add_test (NAME python3_TEST_spam3
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:TEST_spam3>"
+ "${Python3_TEST_INTERPRETER}" -c "import TEST_spam3; TEST_spam3.system(\"cd\")")
diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
index 8be39bf..721c862 100644
--- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
@@ -107,6 +107,10 @@ add_test(NAME FindPython.RequiredArtifacts.Library.VALID COMMAND
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_LIBRARY=ON
"-DPython3_LIBRARY=${Python3_LIBRARY_RELEASE}"
+ "-DPYTHON_LIBRARY_RELEASE=${Python3_LIBRARY_RELEASE}"
+ "-DPYTHON_RUNTIME_LIBRARY_RELEASE=${Python3_RUNTIME_LIBRARY_RELEASE}"
+ "-DPYTHON_LIBRARY_DEBUG=${Python3_LIBRARY_DEBUG}"
+ "-DPYTHON_RUNTIME_LIBRARY_DEBUG=${Python3_RUNTIME_LIBRARY_DEBUG}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Library.INVALID COMMAND
@@ -179,7 +183,11 @@ if (CMake_TEST_FindPython3_SABIModule AND WIN32)
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_SABI_LIBRARY=ON
- "-DPython3_SABI_LIBRARY=${Python3_SABI_LIBRARY_RELEASE}"
+ "-DPython3_SABI_LIBRARY=${Python3_SABI_LIBRARY_RELEASE}"
+ "-DPYTHON_SABI_LIBRARY_RELEASE=${Python3_SABI_LIBRARY_RELEASE}"
+ "-DPYTHON_RUNTIME_SABI_LIBRARY_RELEASE=${Python3_RUNTIME_SABI_LIBRARY_RELEASE}"
+ "-DPYTHON_SABI_LIBRARY_DEBUG=${Python3_SABI_LIBRARY_DEBUG}"
+ "-DPYTHON_RUNTIME_SABI_LIBRARY_DEBUG=${Python3_RUNTIME_SABI_LIBRARY_DEBUG}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.SABILibrary.INVALID COMMAND
@@ -190,7 +198,7 @@ if (CMake_TEST_FindPython3_SABIModule AND WIN32)
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_SABI_LIBRARY=ON
- "-DPython3_SABI_LIBRARY=${USER_LIBRARY}"
+ "-DPython3_SABI_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
index 25bdcf3..9a3d010 100644
--- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
@@ -31,12 +31,19 @@ if (NOT PYTHON_IS_FOUND AND Python3_FOUND)
message (FATAL_ERROR "Python3 unexpectedly found")
endif()
-
if (CHECK_INTERPRETER AND NOT Python3_EXECUTABLE STREQUAL required_interpreter)
message (FATAL_ERROR "Failed to use input variable Python3_EXECUTABLE")
endif()
-if (CHECK_LIBRARY AND NOT Python3_LIBRARY_RELEASE STREQUAL required_library)
+if (CHECK_LIBRARY AND PYTHON_IS_FOUND AND
+ (NOT Python3_LIBRARY_RELEASE STREQUAL PYTHON_LIBRARY_RELEASE
+ OR (WIN32 AND NOT Python3_RUNTIME_LIBRARY_RELEASE STREQUAL PYTHON_RUNTIME_LIBRARY_RELEASE)
+ OR (PYTHON_LIBRARY_DEBUG AND NOT Python3_LIBRARY_DEBUG STREQUAL PYTHON_LIBRARY_DEBUG)
+ OR (WIN32 AND PYTHON_RUNTIME_LIBRARY_DEBUG AND NOT Python3_RUNTIME_LIBRARY_DEBUG STREQUAL PYTHON_RUNTIME_LIBRARY_DEBUG)))
+ message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY")
+endif()
+if (CHECK_LIBRARY AND NOT PYTHON_IS_FOUND AND
+ NOT Python3_LIBRARY_RELEASE STREQUAL required_library)
message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY")
endif()
@@ -44,6 +51,14 @@ if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include)
message (FATAL_ERROR "Failed to use input variable Python3_INCLUDE_DIR")
endif()
-if (CHECK_SABI_LIBRARY AND NOT Python3_SABI_LIBRARY_RELEASE STREQUAL required_sabi_library)
+if (CHECK_SABI_LIBRARY AND PYTHON_IS_FOUND AND
+ (NOT Python3_SABI_LIBRARY_RELEASE STREQUAL PYTHON_SABI_LIBRARY_RELEASE
+ OR (WIN32 AND NOT Python3_RUNTIME_SABI_LIBRARY_RELEASE STREQUAL PYTHON_RUNTIME_SABI_LIBRARY_RELEASE)
+ OR (PYTHON_SABI_LIBRARY_DEBUG AND NOT Python3_SABI_LIBRARY_DEBUG STREQUAL PYTHON_SABI_LIBRARY_DEBUG)
+ OR (WIN32 AND PYTHON_RUNTIME_SABI_LIBRARY_DEBUG AND NOT Python3_RUNTIME_SABI_LIBRARY_DEBUG STREQUAL PYTHON_RUNTIME_SABI_LIBRARY_DEBUG)))
message (FATAL_ERROR "Failed to use input variable Python3_SABI_LIBRARY")
endif()
+if (CHECK_SABI_LIBRARY AND NOT PYTHON_IS_FOUND AND
+ NOT Python3_SABI_LIBRARY_RELEASE STREQUAL required_sabi_library)
+ message (FATAL_ERROR "Failed to use input variable Python3_SABI_LIBRARY")
+endif()
diff --git a/Tests/FindPython/TEST_spam.c b/Tests/FindPython/TEST_spam.c
new file mode 100644
index 0000000..fc483fd
--- /dev/null
+++ b/Tests/FindPython/TEST_spam.c
@@ -0,0 +1,41 @@
+#define Py_LIMITED_API 3
+#include <Python.h>
+
+static PyObject* spam_system(PyObject* self, PyObject* args)
+{
+ char const* command;
+ int sts;
+
+ if (!PyArg_ParseTuple(args, "s", &command))
+ return NULL;
+ sts = system(command);
+ /* return PyLong_FromLong(sts); */
+ return Py_BuildValue("i", sts);
+}
+
+static PyMethodDef SpamMethods[] = {
+ { "system", spam_system, METH_VARARGS, "Execute a shell command." },
+ { NULL, NULL, 0, NULL } /* Sentinel */
+};
+
+#if defined(PYTHON2)
+PyMODINIT_FUNC initTEST_spam2(void)
+{
+ (void)Py_InitModule("TEST_spam2", SpamMethods);
+}
+#endif
+
+#if defined(PYTHON3)
+static struct PyModuleDef spammodule = {
+ PyModuleDef_HEAD_INIT, "TEST_spam3", /* name of module */
+ NULL, /* module documentation, may be NULL */
+ -1, /* size of per-interpreter state of the module,
+ or -1 if the module keeps state in global variables. */
+ SpamMethods
+};
+
+PyMODINIT_FUNC PyInit_TEST_spam3(void)
+{
+ return PyModule_Create(&spammodule);
+}
+#endif
diff --git a/Tests/FindPython/display_time.c b/Tests/FindPython/display_time.c
index 568d510..7b95f1f 100644
--- a/Tests/FindPython/display_time.c
+++ b/Tests/FindPython/display_time.c
@@ -9,27 +9,32 @@
void display_time(void)
{
#if defined(PYTHON3)
- wchar_t* program = Py_DecodeLocale("display_time", NULL);
- if (program == NULL) {
- fprintf(stderr, "Fatal error: cannot decode argv[0]\n");
- exit(1);
+ PyConfig config;
+ PyStatus status;
+
+ PyConfig_InitPythonConfig(&config);
+ status =
+ PyConfig_SetBytesString(&config, &config.program_name, "display_time");
+ if (PyStatus_Exception(status)) {
+ Py_ExitStatusException(status);
}
+
char* cmd = "from time import time,ctime\n"
"print('Today is', ctime(time()))\n";
#else
char* program = "display_time";
char* cmd = "from time import time,ctime\n"
"print 'Today is', ctime(time())\n";
-#endif
Py_SetProgramName(program); /* optional but recommended */
+#endif
Py_Initialize();
PyRun_SimpleString(cmd);
#if defined(PYTHON3)
if (Py_FinalizeEx() < 0) {
exit(120);
}
- PyMem_RawFree(program);
+ PyConfig_Clear(&config);
#else
Py_Finalize();
#endif
diff --git a/Tests/FindPython/spam.c b/Tests/FindPython/spam.c
index 1c65d54..063bf35 100644
--- a/Tests/FindPython/spam.c
+++ b/Tests/FindPython/spam.c
@@ -1,9 +1,9 @@
-
+#define Py_LIMITED_API 3
#include <Python.h>
static PyObject* spam_system(PyObject* self, PyObject* args)
{
- const char* command;
+ char const* command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
diff --git a/Tests/FindRuby/CMakeLists.txt b/Tests/FindRuby/CMakeLists.txt
index ee58923..a6de4d6 100644
--- a/Tests/FindRuby/CMakeLists.txt
+++ b/Tests/FindRuby/CMakeLists.txt
@@ -39,7 +39,21 @@ if(CMake_TEST_FindRuby)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
set_tests_properties(FindRuby.FailExact PROPERTIES
- PASS_REGULAR_EXPRESSION "Could NOT find Ruby: Found unsuitable version \".*\", but required is.*exact version \"[0-9]+\\.[0-9]+\\.[0-9]+\" \\(found .*\\)")
+ PASS_REGULAR_EXPRESSION "Could NOT find Ruby.*Required[ \n]+is[ \n]+exact[ \n]+version[ \n]+\"1\\.9\\.9\"")
+
+ # RBENV specific test
+ if(CMake_TEST_FindRuby_RBENV)
+ add_test(NAME FindRuby.Rbenv COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindRuby/Rbenv"
+ "${CMake_BINARY_DIR}/Tests/FindRuby/Rbenv"
+ ${build_generator_args}
+ --build-project TestRBENV
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ endif()
# RVM specific test
if(CMake_TEST_FindRuby_RVM)
diff --git a/Tests/FindRuby/Rbenv/CMakeLists.txt b/Tests/FindRuby/Rbenv/CMakeLists.txt
new file mode 100644
index 0000000..3994c68
--- /dev/null
+++ b/Tests/FindRuby/Rbenv/CMakeLists.txt
@@ -0,0 +1,77 @@
+cmake_minimum_required(VERSION 3.31)
+project(TestRBENV LANGUAGES NONE)
+
+include(CTest)
+
+# Test environment has RBENV_ROOT setup
+find_program (rbenv
+ NAMES rbenv
+ NAMES_PER_DIR
+ PATHS "$ENV{HOME}/.rbenv/bin/rbenv" ENV RBENV_ROOT
+ PATH_SUFFIXES bin Scripts
+ NO_CACHE)
+execute_process (COMMAND "${rbenv}" "which" "ruby"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE RBENV_RUBY
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# Make sure we found a valid Ruby interpreter
+if(NOT RBENV_RUBY)
+ message(FATAL_ERROR "Unable to find RBENV using RBENV_ROOT ${RBENV_ROOT}")
+endif()
+
+# Get the version of rbenv Ruby
+execute_process (COMMAND "${RBENV_RUBY}" -e "puts RUBY_VERSION"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE RBENV_RUBY_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if (result)
+ message (FATAL_ERROR "Unable to detect rbenv ruby version from '${RBENV_RUBY}': ${RBENV_RUBY_VERSION}")
+endif()
+
+# Find system Ruby
+execute_process(COMMAND "${CMAKE_COMMAND}" -E env PATH=/usr/bin:/bin "which" "ruby"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE SYSTEM_RUBY
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if (SYSTEM_RUBY MATCHES "${RBENV_RUBY}")
+ message(FATAL_ERROR "System Ruby (${SYSTEM_RUBY}) matches rbenv Ruby (${RBENV_RUBY})")
+endif()
+
+# Get version of the system Ruby
+execute_process (COMMAND "${SYSTEM_RUBY}" -e "puts RUBY_VERSION"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE SYSTEM_RUBY_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if (result)
+ message (FATAL_ERROR "Unable to detect system ruby version from '${SYSTEM_RUBY}': ${SYSTEM_RUBY_VERSION}")
+endif()
+
+if(SYSTEM_RUBY_VERSION VERSION_EQUAL RBENV_RUBY_VERSION)
+ message(FATAL_ERROR "Your RBENV Ruby Version and standard ruby version are the same (${RBENV_RUBY_VERSION}).")
+endif()
+
+message(STATUS "Found standard Ruby (${SYSTEM_RUBY_VERSION}): ${SYSTEM_RUBY}")
+message(STATUS "Found rbenv Ruby (${RBENV_RUBY_VERSION}): ${RBENV_RUBY}")
+
+add_test(NAME FindRuby.RbenvDefault
+ COMMAND "${CMAKE_COMMAND}" -E env "RBENV_ROOT=$ENV{RBENV_ROOT}"
+ "${CMAKE_COMMAND}" "-DRBENV_RUBY=${RBENV_RUBY}" "-DSYSTEM_RUBY=${SYSTEM_RUBY}" "-DRBENV_RUBY_VERSION=${RBENV_RUBY_VERSION}" "-DSYSTEM_RUBY_VERSION=${SYSTEM_RUBY_VERSION}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/RbenvDefault.cmake")
+
+add_test(NAME FindRuby.RbenvOnly
+ COMMAND "${CMAKE_COMMAND}" -E env "RBENV_ROOT=$ENV{RBENV_ROOT}"
+ "${CMAKE_COMMAND}" "-DRBENV_RUBY=${RBENV_RUBY}" "-DSYSTEM_RUBY=${SYSTEM_RUBY}" "-DRBENV_RUBY_VERSION=${RBENV_RUBY_VERSION}" "-DSYSTEM_RUBY_VERSION=${SYSTEM_RUBY_VERSION}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/RbenvOnly.cmake")
+
+add_test(NAME FindRuby.RbenvStandard
+ COMMAND "${CMAKE_COMMAND}" -E env "RBENV_ROOT=$ENV{RBENV_ROOT}"
+ "${CMAKE_COMMAND}" "-DRBENV_RUBY=${RBENV_RUBY}" "-DSYSTEM_RUBY=${SYSTEM_RUBY}" "-DRBENV_RUBY_VERSION=${RBENV_RUBY_VERSION}" "-DSYSTEM_RUBY_VERSION=${SYSTEM_RUBY_VERSION}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/RbenvStandard.cmake")
diff --git a/Tests/FindRuby/Rbenv/RbenvDefault.cmake b/Tests/FindRuby/Rbenv/RbenvDefault.cmake
new file mode 100644
index 0000000..86f2264
--- /dev/null
+++ b/Tests/FindRuby/Rbenv/RbenvDefault.cmake
@@ -0,0 +1,28 @@
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES "")
+
+unset(ENV{MY_RUBY_HOME}) # Suppress RVM code path for this test.
+
+# Should find rbenv Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby REQUIRED)
+if (NOT "${Ruby_EXECUTABLE}" STREQUAL "${RBENV_RUBY}")
+ message (FATAL_ERROR "Failed to find rbenv Ruby: ${Ruby_EXECUTABLE}")
+endif()
+
+# Should find rbenv Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby ${RBENV_RUBY_VERSION} REQUIRED)
+if (NOT Ruby_EXECUTABLE MATCHES "${RBENV_RUBY}")
+ message (FATAL_ERROR "Failed to find rbenv Ruby: ${Ruby_EXECUTABLE}")
+endif()
+
+# Should find standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby ${SYSTEM_RUBY_VERSION} EXACT)
+if (NOT Ruby_EXECUTABLE STREQUAL "${SYSTEM_RUBY}")
+ message (FATAL_ERROR "Failed to find system Ruby: ${Ruby_EXECUTABLE}")
+endif()
diff --git a/Tests/FindRuby/Rbenv/RbenvOnly.cmake b/Tests/FindRuby/Rbenv/RbenvOnly.cmake
new file mode 100644
index 0000000..b524596
--- /dev/null
+++ b/Tests/FindRuby/Rbenv/RbenvOnly.cmake
@@ -0,0 +1,29 @@
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES "")
+
+set(Ruby_FIND_VIRTUALENV ONLY)
+unset(ENV{MY_RUBY_HOME}) # Suppress RVM code path for this test.
+
+# We should find the rbenv Ruby not standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby QUIET)
+if (NOT Ruby_EXECUTABLE STREQUAL "${RBENV_RUBY}")
+ message (FATAL_ERROR "Failed to find rbenv Ruby: ${Ruby_EXECUTABLE}")
+endif()
+
+# We should find the rbenv Ruby not standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby ${RBENV_RUBY_VERSION} QUIET)
+if (NOT Ruby_EXECUTABLE STREQUAL "${RBENV_RUBY}")
+ message (FATAL_ERROR "Failed to find rbenv Ruby: ${Ruby_EXECUTABLE}")
+endif()
+
+# We should not find standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby ${SYSTEM_RUBY_VERSION} EXACT QUIET)
+if (NOT Ruby_EXECUTABLE STREQUAL "Ruby_EXECUTABLE-NOTFOUND")
+ message (FATAL_ERROR "Incorrectly found Ruby: ${Ruby_EXECUTABLE}")
+endif()
diff --git a/Tests/FindRuby/Rbenv/RbenvStandard.cmake b/Tests/FindRuby/Rbenv/RbenvStandard.cmake
new file mode 100644
index 0000000..75cff89
--- /dev/null
+++ b/Tests/FindRuby/Rbenv/RbenvStandard.cmake
@@ -0,0 +1,29 @@
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES "")
+
+set (Ruby_FIND_VIRTUALENV STANDARD)
+unset(ENV{MY_RUBY_HOME}) # Suppress RVM code path for this test.
+
+# We should find the standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby QUIET)
+if (NOT Ruby_EXECUTABLE STREQUAL "${SYSTEM_RUBY}")
+ message (FATAL_ERROR "Failed to find standard Ruby: ${Ruby_EXECUTABLE}")
+endif()
+
+# We should not find the rbenv Ruby or standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby ${RBENV_RUBY_VERSION} EXACT QUIET)
+if (NOT Ruby_EXECUTABLE STREQUAL "Ruby_EXECUTABLE-NOTFOUND")
+ message (FATAL_ERROR "Incorrectly found rbenv Ruby: ${Ruby_EXECUTABLE}")
+endif()
+
+# We should find standard Ruby
+unset(Ruby_EXECUTABLE CACHE)
+unset(RUBY_EXECUTABLE) # compatibility variable
+find_package (Ruby ${SYSTEM_RUBY_VERSION} EXACT QUIET)
+if (NOT Ruby_EXECUTABLE MATCHES "${SYSTEM_RUBY}")
+ message (FATAL_ERROR "Failed to find standard Ruby: ${Ruby_EXECUTABLE}")
+endif()
diff --git a/Tests/FindRuby/Rvm/RvmOnly.cmake b/Tests/FindRuby/Rvm/RvmOnly.cmake
index 3851a7c..d47a880 100644
--- a/Tests/FindRuby/Rvm/RvmOnly.cmake
+++ b/Tests/FindRuby/Rvm/RvmOnly.cmake
@@ -2,6 +2,7 @@ set(CMAKE_FIND_LIBRARY_PREFIXES "")
set(CMAKE_FIND_LIBRARY_SUFFIXES "")
set(Ruby_FIND_VIRTUALENV ONLY)
+set(Ruby_RBENV_EXECUTABLE "") # Suppress rbenv code path for this test.
# Test: FindRuby.RvmOnly
if (RUBY_HOME)
@@ -21,21 +22,17 @@ endif()
# Test: FindRuby.UnsetRvmOnly
if (NOT RUBY_HOME)
- # If ENV{MY_RUBY_HOME} isn't defined, it should default back to "STANDARD"
- # At which point:
+ # If ENV{MY_RUBY_HOME} isn't defined and Ruby_FIND_VIRTUALENV is set to ONLY
+ # then Ruby should not be found
- # It shouldn't find the RVM ruby
find_package (Ruby ${RVM_RUBY_VERSION} EXACT QUIET)
if(Ruby_FOUND)
- message(FATAL_ERROR "Found RVM ruby when expecting system")
+ message (FATAL_ERROR "RVM Ruby unexpectedly found.")
endif()
- # it should find the system ruby
+ # it should *not* find the system ruby
find_package (Ruby ${SYSTEM_RUBY_VERSION} EXACT QUIET)
- if(NOT Ruby_FOUND)
- message (FATAL_ERROR "Ruby not found.")
- endif()
- if (Ruby_FOUND MATCHES "^${RUBY_HOME}/.+")
- message(FATAL_ERROR "Failed to find system ruby")
+ if(Ruby_FOUND)
+ message (FATAL_ERROR "Ruby unexpectedly found.")
endif()
endif()
diff --git a/Tests/FindRuby/Test/CMakeLists.txt b/Tests/FindRuby/Test/CMakeLists.txt
index dcf3ec3..fb5ae37 100644
--- a/Tests/FindRuby/Test/CMakeLists.txt
+++ b/Tests/FindRuby/Test/CMakeLists.txt
@@ -2,11 +2,24 @@ cmake_minimum_required(VERSION 3.17)
project(TestRuby LANGUAGES C)
include(CTest)
+cmake_policy(SET CMP0185 NEW)
+
find_package(Ruby 1.9.9 REQUIRED)
if (NOT Ruby_FOUND)
message (FATAL_ERROR "Failed to find Ruby >=1.9.9")
endif()
+foreach(var_CMP0185
+ RUBY_EXECUTABLE
+ RUBY_INCLUDE_DIRS
+ RUBY_LIBRARY
+ RUBY_VERSION
+ )
+ if(DEFINED ${var_CMP0185})
+ message(FATAL_ERROR "Pre-CMP0185 result variable is set: ${var_CMP0185}")
+ endif()
+endforeach()
+
add_executable(ruby_version ruby_version.c)
target_include_directories(ruby_version PRIVATE ${Ruby_INCLUDE_DIRS})
target_link_libraries(ruby_version PRIVATE ${Ruby_LIBRARIES})
diff --git a/Tests/FindVulkan/Test/main-SPIRV-Tools.c b/Tests/FindVulkan/Test/main-SPIRV-Tools.c
index c38f38d..18c2432 100644
--- a/Tests/FindVulkan/Test/main-SPIRV-Tools.c
+++ b/Tests/FindVulkan/Test/main-SPIRV-Tools.c
@@ -4,8 +4,8 @@
int main(void)
{
- const char* spv_version = spvSoftwareVersionString();
- const char* spv_details = spvSoftwareVersionDetailsString();
+ char const* spv_version = spvSoftwareVersionString();
+ char const* spv_details = spvSoftwareVersionDetailsString();
assert(spv_version);
assert(spv_details);
diff --git a/Tests/FindVulkan/Test/main-dynamicVulkanLoading.cpp b/Tests/FindVulkan/Test/main-dynamicVulkanLoading.cpp
index f6f909f..e3bf0da 100644
--- a/Tests/FindVulkan/Test/main-dynamicVulkanLoading.cpp
+++ b/Tests/FindVulkan/Test/main-dynamicVulkanLoading.cpp
@@ -24,7 +24,7 @@ int main()
vk::UniqueInstance instance =
vk::createInstanceUnique(vk::InstanceCreateInfo{
vk::InstanceCreateFlags(), // flags
- &(const vk::ApplicationInfo&)vk::ApplicationInfo{
+ &(vk::ApplicationInfo const&)vk::ApplicationInfo{
"CMake Test application", // application name
VK_MAKE_VERSION(0, 0, 0), // application version
"CMake Test Engine", // engine name
diff --git a/Tests/FindVulkan/Test/main-glslang.cxx b/Tests/FindVulkan/Test/main-glslang.cxx
index 81b18d6..3d3e156 100644
--- a/Tests/FindVulkan/Test/main-glslang.cxx
+++ b/Tests/FindVulkan/Test/main-glslang.cxx
@@ -5,10 +5,10 @@
int main()
{
- const glslang::Version glslang_version = glslang::GetVersion();
- const char* glslang_essl_version = glslang::GetEsslVersionString();
- const char* glslang_glsl_version = glslang::GetGlslVersionString();
- const int glslang_khronos_tool_id = glslang::GetKhronosToolId();
+ glslang::Version const glslang_version = glslang::GetVersion();
+ char const* glslang_essl_version = glslang::GetEsslVersionString();
+ char const* glslang_glsl_version = glslang::GetGlslVersionString();
+ int const glslang_khronos_tool_id = glslang::GetKhronosToolId();
std::cout << "glslang Version: " << glslang_version.major << '.'
<< glslang_version.minor << '.' << glslang_version.patch
diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt
index 3312f6f..e47de60 100644
--- a/Tests/FindX11/Test/CMakeLists.txt
+++ b/Tests/FindX11/Test/CMakeLists.txt
@@ -82,6 +82,7 @@ test_x11_component(x11_components Xkb)
test_x11_component(x11_components xkbfile)
test_x11_component(x11_components Xmu)
test_x11_component(x11_components Xpm)
+test_x11_component(x11_components Xpresent)
test_x11_component(x11_components Xtst)
test_x11_component(x11_components Xrandr)
test_x11_component(x11_components Xrender)
@@ -147,6 +148,7 @@ foreach(lib
xkbfile
Xmu
Xpm
+ Xpresent
Xtst
Xrandr
Xrender
diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c
index 2542145..258d55c 100644
--- a/Tests/FindX11/Test/main.c
+++ b/Tests/FindX11/Test/main.c
@@ -201,6 +201,15 @@ static int test_Xpm(void)
}
#endif
+#ifdef HAVE_X11_Xpresent
+# include <X11/extensions/Xpresent.h>
+
+static int test_Xpresent(void)
+{
+ return XPresentVersion();
+}
+#endif
+
#ifdef HAVE_X11_Xtst
# include <X11/extensions/XTest.h>
@@ -596,7 +605,7 @@ static void test_xcb_render_util(void)
{
int screen_nbr;
xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr);
- const xcb_render_query_version_reply_t* cookie =
+ xcb_render_query_version_reply_t const* cookie =
xcb_render_util_query_version(connection);
xcb_disconnect(connection);
}
@@ -881,6 +890,9 @@ int main(int argc, char* argv[])
#ifdef HAVE_X11_Xpm
test_Xpm,
#endif
+#ifdef HAVE_X11_Xpresent
+ test_Xpresent,
+#endif
#ifdef HAVE_X11_Xtst
test_Xtst,
#endif
diff --git a/Tests/Fortran/hello.f b/Tests/Fortran/hello.f
index aa0de77..63e6408 100644
--- a/Tests/Fortran/hello.f
+++ b/Tests/Fortran/hello.f
@@ -3,4 +3,3 @@
PRINT *, 'Hello'
END
-
diff --git a/Tests/Fortran/testf.f b/Tests/Fortran/testf.f
index abf6c6d..4909181 100644
--- a/Tests/Fortran/testf.f
+++ b/Tests/Fortran/testf.f
@@ -4,4 +4,3 @@
CALL WORLD()
END
-
diff --git a/Tests/Fortran/world.f b/Tests/Fortran/world.f
index 0487dff..deae3fa 100644
--- a/Tests/Fortran/world.f
+++ b/Tests/Fortran/world.f
@@ -3,4 +3,3 @@
PRINT *, 'World!'
END
-
diff --git a/Tests/FortranC/Flags.cmake.in b/Tests/FortranC/Flags.cmake.in
index cf361a5..83ceef0 100644
--- a/Tests/FortranC/Flags.cmake.in
+++ b/Tests/FortranC/Flags.cmake.in
@@ -5,6 +5,9 @@ set(bld "@CMAKE_CURRENT_BINARY_DIR@/FortranC/Flags")
# flags, remove them, and invoke the real compiler.
set(ID "CC")
set(COMMAND "@CMAKE_C_COMPILER@")
+if("x${COMMAND}" MATCHES "xctoolchain(/usr/bin/cc)$")
+ set(COMMAND "${CMAKE_MATCH_1}")
+endif()
configure_file("${src}/test_opt.sh.in" "${bld}/cc.sh" @ONLY)
set(ID "FC")
set(COMMAND "@CMAKE_Fortran_COMPILER@")
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index c9f89cb..4f2724d 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.10...3.25) # Enable CMP0091 and CMP0141.
+cmake_policy(SET CMP0184 NEW)
project(FortranOnly Fortran)
message("CTEST_FULL_OUTPUT ")
diff --git a/Tests/FortranOnly/preprocess2.f b/Tests/FortranOnly/preprocess2.f
index 3b332c4..a772259 100644
--- a/Tests/FortranOnly/preprocess2.f
+++ b/Tests/FortranOnly/preprocess2.f
@@ -1,6 +1,6 @@
#define int INTEGER
! This single unmatched quote ' should not cause an error during compilation
PROGRAM PREPRO
- int f = 1
+ int :: f = 1
PRINT*, f
END
diff --git a/Tests/Fuzzing/README.rst b/Tests/Fuzzing/README.rst
index a869f9c..15dc5f6 100644
--- a/Tests/Fuzzing/README.rst
+++ b/Tests/Fuzzing/README.rst
@@ -2,7 +2,7 @@ The fuzzers in this directory are run continuously through OSS-fuzz.
All fuzzers are implemented by way of the `libFuzzer engine`_.
The link to the OSS-fuzz integration can be found here: (pending)
-All email addresses in the `project.yaml` file on OSS-fuzz will have access
+All email addresses in the ``project.yaml`` file on OSS-fuzz will have access
to detailed bug reports and will be notified via email if/when bugs are found.
.. _`libFuzzer Engine`: https://llvm.org/docs/LibFuzzer.html
diff --git a/Tests/Fuzzing/xml_parser_fuzzer.cc b/Tests/Fuzzing/xml_parser_fuzzer.cc
index 1faa918..df8e17f 100644
--- a/Tests/Fuzzing/xml_parser_fuzzer.cc
+++ b/Tests/Fuzzing/xml_parser_fuzzer.cc
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <stdint.h>
#include <stdio.h>
@@ -7,7 +7,7 @@
#include "cmXMLParser.h"
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
char test_file[] = "libfuzzer.xml";
diff --git a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
index 309a8cc..4118042 100644
--- a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
@@ -7,13 +7,8 @@ if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
endif()
endif()
-if (CMP0044_TYPE)
- cmake_policy(SET CMP0044 ${CMP0044_TYPE})
-endif()
-
-add_library(cmp0044-check-${CMP0044_TYPE} cmp0044-check.cpp)
-target_compile_definitions(cmp0044-check-${CMP0044_TYPE}
+add_library(cmp0044-check cmp0044-check.cpp)
+target_compile_definitions(cmp0044-check
PRIVATE
Result=$<C_COMPILER_ID:${lc_test}>
- Type_Is_${CMP0044_TYPE}
)
diff --git a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
index 2812b0d..ad6add9 100644
--- a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
+++ b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
@@ -1,24 +1,5 @@
-
-#ifdef Type_Is_
-# if !Result
-# error Result should be 1 in WARN mode
-# endif
-#endif
-
-#ifdef Type_Is_NEW
-# if Result
-# error Result should be 0 in NEW mode
-# endif
-#endif
-
-#ifdef Type_Is_OLD
-# if !Result
-# error Result should be 1 in OLD mode
-# endif
-#endif
-
-#if !defined(Type_Is_) && !defined(Type_Is_OLD) && !defined(Type_Is_NEW)
-# error No expected definition present
+#if Result
+# error Result should be 0
#endif
void foo(void)
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 708cfc8..4d73bf9 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -438,11 +438,7 @@ add_test(echo-old-style echo "\$<CONFIGURATION>")
set_property(TEST echo-old-style PROPERTY
PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$")
-add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-WARN)
-set(CMP0044_TYPE NEW)
-add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW)
-set(CMP0044_TYPE OLD)
-add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD)
+add_subdirectory(CMP0044)
if(NOT CMAKE_GENERATOR STREQUAL Xcode OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]")
add_library(objlib OBJECT objlib1.c objlib2.c)
@@ -504,5 +500,3 @@ if(NOT CMAKE_GENERATOR STREQUAL Xcode OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;
DEPENDS execobjs
)
endif()
-
-cmake_policy(VERSION 2.8.12) # old enough to not set CMP0044
diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt
index 9250709..0821b92 100644
--- a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in
index fc24d90..f2fc665 100644
--- a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in
+++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt
index d6d007d..e474dc6 100644
--- a/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt
index 93d668b..8b3a7ca 100644
--- a/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in
index fed946c..7c61869 100644
--- a/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in
+++ b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt
index 2e2871b..4e10aed 100644
--- a/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt
index 85ee805..af3bc9d 100644
--- a/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt
index ae30fa2..ac403c0 100644
--- a/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
add_library(lib1 STATIC
func1.c lib1.h
diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt
index 8cb6869..ac3ab39 100644
--- a/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt
index 575bf50..845ab14 100644
--- a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiExclude/verify.cmake b/Tests/GhsMulti/GhsMultiExclude/verify.cmake
index 99cef63..597924f 100644
--- a/Tests/GhsMulti/GhsMultiExclude/verify.cmake
+++ b/Tests/GhsMulti/GhsMultiExclude/verify.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(verify_skipped_tgt name)
unset(fileName CACHE)
diff --git a/Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt
index 24126c8..965706e 100644
--- a/Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt
index 6846a98..a41f43d 100644
--- a/Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt
index d4cbf04..31fbee1 100644
--- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c
index db8d658..674e8bd 100644
--- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c
+++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c
@@ -1,6 +1,6 @@
#include "HelperFun.h"
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
int out;
out = giveNum();
diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt
index 3f2f0eb..2840eca 100644
--- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt b/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt
index fa0dce0..a316909 100644
--- a/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
index 2d21bfb..b888c02 100644
--- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
index 58c2115..47a30c4 100644
--- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
+++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt
index 145dac0..2b94893 100644
--- a/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt
index f49e33d..449174d 100644
--- a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt
index 9039730..09dde7d 100644
--- a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
add_library(lib1 STATIC func2.c func3.c func4.c)
target_link_libraries(lib1 lib2)
diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt
index 9e077a9..f0c5a65 100644
--- a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt
index 0d83bc3..c2066a6 100644
--- a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt
index e42e7fb..5ddc130 100644
--- a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake
index b6af935..c92eea2 100644
--- a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake
+++ b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
function(verify_project_top name)
unset(fileName CACHE)
diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt
index 98668e5c..b75a7b4 100644
--- a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt
index b177887..f2a8c11 100644
--- a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt
index b2540d9..3ad42e9 100644
--- a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt
index 93a1afc..126be60 100644
--- a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt
index f5f3c55..e9aaa08 100644
--- a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
diff --git a/Tests/ISPC/ObjectGenex/main.cxx b/Tests/ISPC/ObjectGenex/main.cxx
index 143e74e..9059736 100644
--- a/Tests/ISPC/ObjectGenex/main.cxx
+++ b/Tests/ISPC/ObjectGenex/main.cxx
@@ -81,7 +81,7 @@ int main()
// is equal to the number of arch's
std::vector<std::string> paths = expandList(obj_paths);
- const bool correctSize = (paths.size() == ExpectedISPCObjects);
+ bool const correctSize = (paths.size() == ExpectedISPCObjects);
return (correctSize) ? 0 : 1;
}
diff --git a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt b/Tests/IncludeDirectories/CMP0021/CMakeLists.txt
deleted file mode 100644
index 0b9aee8..0000000
--- a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-
-cmake_policy(SET CMP0021 OLD)
-add_executable(cmp0021exe main.cpp)
-
-if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/includes")
- execute_process(COMMAND ${CMAKE_COMMAND} -E
- copy_directory
- "${CMAKE_CURRENT_SOURCE_DIR}/includes"
- "${CMAKE_CURRENT_BINARY_DIR}/includes"
- )
-endif()
-set_property(TARGET cmp0021exe PROPERTY
- INCLUDE_DIRECTORIES includes/cmp0021)
diff --git a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h b/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h
deleted file mode 100644
index 3d49b31..0000000
--- a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-#define CMP0021_DEFINE
diff --git a/Tests/IncludeDirectories/CMP0021/main.cpp b/Tests/IncludeDirectories/CMP0021/main.cpp
deleted file mode 100644
index 0f87dd9..0000000
--- a/Tests/IncludeDirectories/CMP0021/main.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-
-#include "cmp0021.h"
-
-#ifndef CMP0021_DEFINE
-# error Expected CMP0021_DEFINE
-#endif
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index e9c1c63..854a42a 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -206,7 +206,3 @@ get_target_property(incs empty_entry_test INCLUDE_DIRECTORIES)
if (NOT incs STREQUAL ";/one/two")
message(SEND_ERROR "Empty include_directories entry was not ignored.")
endif()
-
-if(NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR MATCHES "Ninja")
- add_subdirectory(CMP0021)
-endif()
diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt
index 5b83b14..7090057 100644
--- a/Tests/InterfaceLinkLibraries/CMakeLists.txt
+++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0022 NEW)
-
project(InterfaceLinkLibraries)
add_library(foo_shared SHARED foo_vs6_1.cpp)
diff --git a/Tests/Java/HelloWorld.java b/Tests/Java/HelloWorld.java
index 995ee48..8d00940 100644
--- a/Tests/Java/HelloWorld.java
+++ b/Tests/Java/HelloWorld.java
@@ -8,4 +8,3 @@ class HelloWorld
System.out.println("Hello World!");
}
}
-
diff --git a/Tests/LibName/CMakeLists.txt b/Tests/LibName/CMakeLists.txt
index b8f0890..3624f96 100644
--- a/Tests/LibName/CMakeLists.txt
+++ b/Tests/LibName/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.10)
project(LibName)
# this is a test to make sure that relative path
# LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH work
diff --git a/Tests/LibName/bar.c b/Tests/LibName/bar.c
index b1c5cf2..62a9298 100644
--- a/Tests/LibName/bar.c
+++ b/Tests/LibName/bar.c
@@ -2,6 +2,7 @@
__declspec(dllexport)
#endif
- extern void foo(void)
+extern void
+foo(void)
{
}
diff --git a/Tests/LibName/foo.c b/Tests/LibName/foo.c
index 1bdb58b..9b51156 100644
--- a/Tests/LibName/foo.c
+++ b/Tests/LibName/foo.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void foo(void);
+extern void
+foo(void);
#ifdef _WIN32
__declspec(dllexport)
#endif
diff --git a/Tests/LibName/foobar.c b/Tests/LibName/foobar.c
index fa7d3e9..e7e78b3 100644
--- a/Tests/LibName/foobar.c
+++ b/Tests/LibName/foobar.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void bar();
+extern void
+bar();
int main(void)
{
diff --git a/Tests/LinkDirectory/External/CMakeLists.txt b/Tests/LinkDirectory/External/CMakeLists.txt
index b85e351..d2d3722 100644
--- a/Tests/LinkDirectory/External/CMakeLists.txt
+++ b/Tests/LinkDirectory/External/CMakeLists.txt
@@ -20,13 +20,7 @@ add_executable(myexe3 myexe.c)
set_property(TARGET myexe3 PROPERTY OUTPUT_NAME LinkDirectory3)
target_link_libraries(myexe3 PRIVATE mylibs)
-
-# Test CMP0015 OLD behavior: -L../lib
-cmake_policy(SET CMP0015 OLD)
link_directories(../lib${cfg_dir})
-
-# Test CMP0015 NEW behavior: -L${CMAKE_CURRENT_SOURCE_DIR}/lib
-cmake_policy(SET CMP0015 NEW)
link_directories(lib${cfg_dir})
add_executable(myexe myexe.c)
diff --git a/Tests/LinkLine/CMakeLists.txt b/Tests/LinkLine/CMakeLists.txt
index 6154dd4..0e7ff47 100644
--- a/Tests/LinkLine/CMakeLists.txt
+++ b/Tests/LinkLine/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.10)
project( LinkLine )
# Makes sure that the library order as specified by the user are
diff --git a/Tests/LinkLineOrder/CMakeLists.txt b/Tests/LinkLineOrder/CMakeLists.txt
index 78455e9..b4c8876 100644
--- a/Tests/LinkLineOrder/CMakeLists.txt
+++ b/Tests/LinkLineOrder/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.10)
project( LinkLineOrder )
# This tests ensures that the order of libraries are preserved when
diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt
deleted file mode 100644
index 11dce36..0000000
--- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-project(CMAKE_LOADED_COMMANDS)
-
-if (MUDSLIDE_TYPE MATCHES MUCHO)
- add_definitions(-DMUCHO_MUDSLIDE)
-endif ()
-
-include_directories(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source)
-
-add_library(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c)
-
-if(WATCOM)
- target_link_libraries(cmCMAKE_TEST_COMMAND clbsdll.lib)
-endif()
diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
deleted file mode 100644
index ba13727..0000000
--- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
+++ /dev/null
@@ -1,192 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "cmCPluginAPI.h"
-
-typedef struct
-{
- char* LibraryName;
- int Argc;
- char** Argv;
-} cmVTKWrapTclData;
-
-/* do almost everything in the initial pass */
-static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
-{
- char* file;
- char* str;
- const char* srcs;
- const char* cstr;
- char buffer[1024];
- void* source_file;
- char* args[2];
- const char* ccArgs[4];
- const char* ccDep[1];
- const char* ccOut[1];
- cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
-
- cmVTKWrapTclData* cdata =
- (cmVTKWrapTclData*)malloc(sizeof(cmVTKWrapTclData));
- cdata->LibraryName = "BOO";
- cdata->Argc = argc;
- cdata->Argv = argv;
- info->CAPI->SetClientData(info, cdata);
-
- /* Now check and see if the value has been stored in the cache */
- /* already, if so use that value and don't look for the program */
- if (!info->CAPI->IsOn(mf, "TEST_COMMAND_TEST1")) {
- info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
- return 1;
- }
-
- info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
- cdata->LibraryName = "HOO";
-
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON",
- "Test cache variable", CM_CACHE_BOOL);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "",
- "Test cache variable 1", CM_CACHE_PATH);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "",
- "Test cache variable 2", CM_CACHE_FILEPATH);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "",
- "Test cache variable 3", CM_CACHE_STRING);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "",
- "Test cache variable 4", CM_CACHE_INTERNAL);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "",
- "Test cache variable 5", CM_CACHE_STATIC);
-
- file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0);
-
- str = info->CAPI->GetFilenameWithoutExtension(file);
- info->CAPI->DisplaySatus(mf, str);
- info->CAPI->Free(str);
- str = info->CAPI->GetFilenamePath(file);
- info->CAPI->DisplaySatus(mf, str);
- info->CAPI->Free(str);
- str = info->CAPI->Capitalized("cmake");
- info->CAPI->DisplaySatus(mf, str);
- info->CAPI->Free(str);
-
- info->CAPI->DisplaySatus(mf, info->CAPI->GetProjectName(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeOutputDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetStartDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetStartOutputDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
- snprintf(
- buffer, sizeof(buffer), "Cache version: %d.%d, CMake version: %d.%d",
- info->CAPI->GetCacheMajorVersion(mf), info->CAPI->GetCacheMinorVersion(mf),
- info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
- info->CAPI->DisplaySatus(mf, buffer);
- if (info->CAPI->CommandExists(mf, "SET")) {
- info->CAPI->DisplaySatus(mf, "Command SET exists");
- }
- if (info->CAPI->CommandExists(mf, "SET_FOO_BAR")) {
- info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists");
- return 0;
- }
- info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION");
-
- source_file = info->CAPI->CreateNewSourceFile(mf);
- cstr = info->CAPI->SourceFileGetSourceName(source_file);
- snprintf(buffer, sizeof(buffer), "Should be empty (source file name): [%s]",
- cstr);
- info->CAPI->DisplaySatus(mf, buffer);
- cstr = info->CAPI->SourceFileGetFullPath(source_file);
- snprintf(buffer, sizeof(buffer),
- "Should be empty (source file full path): [%s]", cstr);
- info->CAPI->DisplaySatus(mf, buffer);
- info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop",
- "This property is no longer used", 0);
- if (info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY")) {
- info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
- return 0;
- }
- info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY2", "nice prop",
- "This property is for testing.", 0);
- info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
- cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
- snprintf(buffer, sizeof(buffer),
- "Should be 0 (source file abstract property): [%p]", cstr);
- info->CAPI->DisplaySatus(mf, buffer);
-
- info->CAPI->DestroySourceFile(source_file);
-
- srcs = argv[2];
- info->CAPI->AddExecutable(mf, "LoadedCommand", 1, &srcs, 0);
-
- /* add customs commands to generate the source file */
- ccArgs[0] = "-E";
- ccArgs[1] = "copy";
- ccArgs[2] = argv[0];
- ccArgs[3] = argv[1];
- ccDep[0] = ccArgs[2];
- ccOut[0] = ccArgs[3];
- info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", file, 4, ccArgs, 1,
- ccDep, 1, ccOut, "LoadedCommand");
-
- ccArgs[2] = argv[1];
- ccArgs[3] = argv[2];
- ccDep[0] = ccArgs[2];
- ccOut[0] = ccArgs[3];
- info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], file, 4, ccArgs, ccDep[0],
- 0, 0);
-
- ccArgs[1] = "echo";
- ccArgs[2] = "Build has finished";
- info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", file, 3, ccArgs,
- CM_POST_BUILD);
-
- info->CAPI->Free(file);
-
- args[0] = "TEST_EXEC";
- args[1] = "TRUE";
-
- /* code coverage */
- if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
- return 0;
- }
-
- ccArgs[0] = "TEST_EXEC";
- ccArgs[1] = "TRUE";
- info->CAPI->ExecuteCommand(mf, "SET", 2, ccArgs);
-
- /* make sure we can find the source file */
- if (!info->CAPI->GetSource(mf, argv[1])) {
- info->CAPI->SetError(mf, "Source file could not be found!");
- return 0;
- }
-
- return 1;
-}
-
-static void CCONV FinalPass(void* inf, void* mf)
-{
- cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
- /* get our client data from initial pass */
- cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info);
- if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"), "HOO") ||
- strcmp(cdata->LibraryName, "HOO")) {
- fprintf(stderr, "*** Failed LOADED COMMAND Final Pass\n");
- }
-}
-static void CCONV Destructor(void* inf)
-{
- cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
- /* get our client data from initial pass */
- cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info);
- free(cdata);
-}
-
-#ifdef MUCHO_MUDSLIDE
-void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo* info)
-{
- info->InitialPass = InitialPass;
- info->FinalPass = FinalPass;
- info->Destructor = Destructor;
- info->m_Inherited = 0;
- info->Name = "CMAKE_TEST_COMMAND";
-}
-#endif
diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt
deleted file mode 100644
index d892703..0000000
--- a/Tests/LoadCommand/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0031 OLD) # testing the old behavior
-project(LoadCommand)
-
-# set a definition
-set (TEST_COMMAND_TEST1 1)
-
-include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
-CHECK_TYPE_SIZE(char SIZEOF_CHAR)
-CHECK_TYPE_SIZE(short SIZEOF_SHORT)
-
-configure_file(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in
- ${LoadCommand_BINARY_DIR}/LoadedCommand.h)
-
-include_directories(${LoadCommand_BINARY_DIR})
-
-# try to compile the command
-# make sure it is not already loaded
-if(COMMAND CMAKE_TEST_COMMAND)
-else()
- try_compile(COMPILE_OK
- ${LoadCommand_BINARY_DIR}/CMakeCommands
- ${LoadCommand_SOURCE_DIR}/CMakeCommands
- CMAKE_LOADED_COMMANDS CMAKE_FLAGS -DMUDSLIDE_TYPE:STRING=MUCHO
- OUTPUT_VARIABLE OUTPUT )
-endif()
-
-message("Output from try compile: ${OUTPUT}")
-
-# if the compile was OK, try loading the command
-if (COMPILE_OK)
- load_command(CMAKE_TEST_COMMAND
- ${LoadCommand_BINARY_DIR}/CMakeCommands
- ${LoadCommand_BINARY_DIR}/CMakeCommands/Debug
- ${LoadCommand_BINARY_DIR}/CMakeCommands/Development
- )
- # if the command loaded, execute the command
- if (COMMAND CMAKE_TEST_COMMAND)
- CMAKE_TEST_COMMAND(
- "${LoadCommand_SOURCE_DIR}/LoadedCommand.cxx.in"
- "${LoadCommand_BINARY_DIR}/LoadedCommand2.cxx.in"
- "${LoadCommand_BINARY_DIR}/LoadedCommand3.cxx"
- )
- endif ()
-else ()
- message("failed to compile CMAKE_LOADED_COMMANDS")
-endif ()
-
-# TEST_DEF is set by the loaded command cmTestCommand.c
-if (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC)
- add_definitions(-DCMAKE_IS_FUN)
-endif ()
-
diff --git a/Tests/LoadCommand/LoadedCommand.cxx.in b/Tests/LoadCommand/LoadedCommand.cxx.in
deleted file mode 100644
index 72ec014..0000000
--- a/Tests/LoadCommand/LoadedCommand.cxx.in
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "LoadedCommand.h"
-#include <stdio.h>
-
-int testSizeOf(int s1, int s2)
-{
- return s1 - s2;
-}
-
-int main ()
-{
- int ret = 0;
-
-#if !defined( ADDED_DEFINITION )
- printf("Should have ADDED_DEFINITION defined\n");
- ret= 1;
-#endif
-#if !defined(CMAKE_IS_FUN)
- printf("Loaded Command was not built with CMAKE_IS_FUN: failed.\n");
- ret = 1;
-#endif
- if(testSizeOf(SIZEOF_CHAR, sizeof(char)))
- {
- printf("Size of char is broken.\n");
- ret = 1;
- }
- if(testSizeOf(SIZEOF_SHORT, sizeof(short)))
- {
- printf("Size of short is broken.\n");
- ret = 1;
- }
- return ret;
-}
diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in
deleted file mode 100644
index 733c414..0000000
--- a/Tests/LoadCommand/LoadedCommand.h.in
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Check for size of types */
-#cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR}
-#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT}
diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt
deleted file mode 100644
index 9f29c43..0000000
--- a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-project(CMAKE_LOADED_COMMANDS)
-
-if (MUDSLIDE_TYPE MATCHES MUCHO)
- add_definitions(-DMUCHO_MUDSLIDE)
-endif ()
-
-if(WATCOM)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-endif()
-include_directories(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source)
-
-add_library(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c)
-
-if(WATCOM)
- target_link_libraries(cmCMAKE_TEST_COMMAND clbsdll.lib)
-endif()
diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
deleted file mode 100644
index e3b332c..0000000
--- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+++ /dev/null
@@ -1,192 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "cmCPluginAPI.h"
-
-typedef struct
-{
- char* LibraryName;
- int Argc;
- char** Argv;
-} cmVTKWrapTclData;
-
-/* do almost everything in the initial pass */
-static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
-{
- char* file;
- char* str;
- const char* srcs;
- char* cstr;
- char buffer[1024];
- void* source_file;
- char* args[2];
- const char* ccArgs[4];
- const char* ccDep[1];
- const char* ccOut[1];
- cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
-
- cmVTKWrapTclData* cdata =
- (cmVTKWrapTclData*)malloc(sizeof(cmVTKWrapTclData));
- cdata->LibraryName = "BOO";
- cdata->Argc = argc;
- cdata->Argv = argv;
- info->CAPI->SetClientData(info, cdata);
-
- /* Now check and see if the value has been stored in the cache */
- /* already, if so use that value and don't look for the program */
- if (!info->CAPI->IsOn(mf, "TEST_COMMAND_TEST1")) {
- info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
- return 1;
- }
-
- info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
- cdata->LibraryName = "HOO";
-
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON",
- "Test cache variable", CM_CACHE_BOOL);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "",
- "Test cache variable 1", CM_CACHE_PATH);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "",
- "Test cache variable 2", CM_CACHE_FILEPATH);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "",
- "Test cache variable 3", CM_CACHE_STRING);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "",
- "Test cache variable 4", CM_CACHE_INTERNAL);
- info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "",
- "Test cache variable 5", CM_CACHE_STATIC);
-
- file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0);
-
- str = info->CAPI->GetFilenameWithoutExtension(file);
- info->CAPI->DisplaySatus(mf, str);
- info->CAPI->Free(str);
- str = info->CAPI->GetFilenamePath(file);
- info->CAPI->DisplaySatus(mf, str);
- info->CAPI->Free(str);
- str = info->CAPI->Capitalized("cmake");
- info->CAPI->DisplaySatus(mf, str);
- info->CAPI->Free(str);
-
- info->CAPI->DisplaySatus(mf, info->CAPI->GetProjectName(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeOutputDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetStartDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetStartOutputDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
- info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
- snprintf(
- buffer, sizeof(buffer), "Cache version: %d.%d, CMake version: %d.%d",
- info->CAPI->GetCacheMajorVersion(mf), info->CAPI->GetCacheMinorVersion(mf),
- info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
- info->CAPI->DisplaySatus(mf, buffer);
- if (info->CAPI->CommandExists(mf, "SET")) {
- info->CAPI->DisplaySatus(mf, "Command SET exists");
- }
- if (info->CAPI->CommandExists(mf, "SET_FOO_BAR")) {
- info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists");
- return 0;
- }
- info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION");
-
- source_file = info->CAPI->CreateNewSourceFile(mf);
- cstr = info->CAPI->SourceFileGetSourceName(source_file);
- snprintf(buffer, sizeof(buffer), "Should be empty (source file name): [%s]",
- cstr);
- info->CAPI->DisplaySatus(mf, buffer);
- cstr = info->CAPI->SourceFileGetFullPath(source_file);
- snprintf(buffer, sizeof(buffer),
- "Should be empty (source file full path): [%s]", cstr);
- info->CAPI->DisplaySatus(mf, buffer);
- info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop",
- "This property is no longer used", 0);
- if (info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY")) {
- info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
- return 0;
- }
- info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY2", "nice prop",
- "This property is for testing.", 0);
- info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
- cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
- snprintf(buffer, sizeof(buffer),
- "Should be 0 (source file abstract property): [%p]", cstr);
- info->CAPI->DisplaySatus(mf, buffer);
-
- info->CAPI->DestroySourceFile(source_file);
-
- srcs = argv[2];
- info->CAPI->AddExecutable(mf, "LoadedCommand", 1, &srcs, 0);
-
- /* add customs commands to generate the source file */
- ccArgs[0] = "-E";
- ccArgs[1] = "copy";
- ccArgs[2] = argv[0];
- ccArgs[3] = argv[1];
- ccDep[0] = ccArgs[2];
- ccOut[0] = ccArgs[3];
- info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", file, 4, ccArgs, 1,
- ccDep, 1, ccOut, "LoadedCommand");
-
- ccArgs[2] = argv[1];
- ccArgs[3] = argv[2];
- ccDep[0] = ccArgs[2];
- ccOut[0] = ccArgs[3];
- info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], file, 4, ccArgs, ccDep[0],
- 0, 0);
-
- ccArgs[1] = "echo";
- ccArgs[2] = "Build has finished";
- info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", file, 3, ccArgs,
- CM_POST_BUILD);
-
- info->CAPI->Free(file);
-
- args[0] = "TEST_EXEC";
- args[1] = "TRUE";
-
- /* code coverage */
- if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
- return 0;
- }
-
- ccArgs[0] = "TEST_EXEC";
- ccArgs[1] = "TRUE";
- info->CAPI->ExecuteCommand(mf, "SET", 2, ccArgs);
-
- /* make sure we can find the source file */
- if (!info->CAPI->GetSource(mf, argv[1])) {
- info->CAPI->SetError(mf, "Source file could not be found!");
- return 0;
- }
-
- return 1;
-}
-
-static void CCONV FinalPass(void* inf, void* mf)
-{
- cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
- /* get our client data from initial pass */
- cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info);
- if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"), "HOO") ||
- strcmp(cdata->LibraryName, "HOO")) {
- fprintf(stderr, "*** Failed LOADED COMMAND Final Pass\n");
- }
-}
-static void CCONV Destructor(void* inf)
-{
- cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
- /* get our client data from initial pass */
- cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info);
- free(cdata);
-}
-
-#ifdef MUCHO_MUDSLIDE
-void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo* info)
-{
- info->InitialPass = InitialPass;
- info->FinalPass = FinalPass;
- info->Destructor = Destructor;
- info->m_Inherited = 0;
- info->Name = "CMAKE_TEST_COMMAND";
-}
-#endif
diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt
deleted file mode 100644
index ac304e3..0000000
--- a/Tests/LoadCommandOneConfig/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0031 OLD) # testing the old behavior
-project(LoadCommand)
-
-# set a definition
-set (TEST_COMMAND_TEST1 1)
-
-include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
-CHECK_TYPE_SIZE(char SIZEOF_CHAR)
-CHECK_TYPE_SIZE(short SIZEOF_SHORT)
-
-include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
-CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H)
-
-include (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
-CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM)
-
-configure_file(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in
- ${LoadCommand_BINARY_DIR}/LoadedCommand.h)
-
-include_directories(${LoadCommand_BINARY_DIR})
-
-# try to compile the command
-# make sure it is not already loaded
-if(COMMAND CMAKE_TEST_COMMAND)
-else()
- try_compile(COMPILE_OK
- ${LoadCommand_BINARY_DIR}/CMakeCommands
- ${LoadCommand_SOURCE_DIR}/CMakeCommands
- CMAKE_LOADED_COMMANDS CMAKE_FLAGS -DMUDSLIDE_TYPE:STRING=MUCHO
- OUTPUT_VARIABLE OUTPUT )
-endif()
-
-message("Output from try compile: ${OUTPUT}")
-
-# if the compile was OK, try loading the command
-if (COMPILE_OK)
- load_command(CMAKE_TEST_COMMAND
- ${LoadCommand_BINARY_DIR}/CMakeCommands
- ${LoadCommand_BINARY_DIR}/CMakeCommands/Debug
- ${LoadCommand_BINARY_DIR}/CMakeCommands/Development
- )
- # if the command loaded, execute the command
- if (COMMAND CMAKE_TEST_COMMAND)
- CMAKE_TEST_COMMAND(
- "${LoadCommand_SOURCE_DIR}/LoadedCommand.cxx.in"
- "${LoadCommand_BINARY_DIR}/LoadedCommand2.cxx.in"
- "${LoadCommand_BINARY_DIR}/LoadedCommand3.cxx"
- )
- endif ()
-else ()
- message("failed to compile CMAKE_LOADED_COMMANDS")
-endif ()
-
-# TEST_DEF is set by the loaded command cmTestCommand.c
-if (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC)
- add_definitions(-DCMAKE_IS_FUN)
-endif ()
-
diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in b/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in
deleted file mode 100644
index 72ec014..0000000
--- a/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "LoadedCommand.h"
-#include <stdio.h>
-
-int testSizeOf(int s1, int s2)
-{
- return s1 - s2;
-}
-
-int main ()
-{
- int ret = 0;
-
-#if !defined( ADDED_DEFINITION )
- printf("Should have ADDED_DEFINITION defined\n");
- ret= 1;
-#endif
-#if !defined(CMAKE_IS_FUN)
- printf("Loaded Command was not built with CMAKE_IS_FUN: failed.\n");
- ret = 1;
-#endif
- if(testSizeOf(SIZEOF_CHAR, sizeof(char)))
- {
- printf("Size of char is broken.\n");
- ret = 1;
- }
- if(testSizeOf(SIZEOF_SHORT, sizeof(short)))
- {
- printf("Size of short is broken.\n");
- ret = 1;
- }
- return ret;
-}
diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.h.in b/Tests/LoadCommandOneConfig/LoadedCommand.h.in
deleted file mode 100644
index d748d06..0000000
--- a/Tests/LoadCommandOneConfig/LoadedCommand.h.in
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Check for size of types */
-#cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR}
-#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT}
-
-/* Check for headers */
-#cmakedefine HAVE_SYS_PRCTL_H
-
-/* Check for libraries */
-#cmakedefine HAVE_LIBM
diff --git a/Tests/MFC/mfc1/ReadMe.txt b/Tests/MFC/mfc1/ReadMe.txt
index d84608e..bf8a845 100644
--- a/Tests/MFC/mfc1/ReadMe.txt
+++ b/Tests/MFC/mfc1/ReadMe.txt
@@ -110,12 +110,12 @@ Resource.h
Microsoft Visual C++ reads and updates this file.
mfc1.manifest
- Application manifest files are used by Windows XP to describe an applications
- dependency on specific versions of Side-by-Side assemblies. The loader uses this
- information to load the appropriate assembly from the assembly cache or private
- from the application. The Application manifest maybe included for redistribution
- as an external .manifest file that is installed in the same folder as the application
- executable or it may be included in the executable in the form of a resource.
+ Application manifest files are used by Windows XP to describe an applications
+ dependency on specific versions of Side-by-Side assemblies. The loader uses this
+ information to load the appropriate assembly from the assembly cache or private
+ from the application. The Application manifest maybe included for redistribution
+ as an external .manifest file that is installed in the same folder as the application
+ executable or it may be included in the executable in the form of a resource.
/////////////////////////////////////////////////////////////////////////////
Other notes:
diff --git a/Tests/MFC/mfc1/mfc1.rc b/Tests/MFC/mfc1/mfc1.rc
index 346c5fb..4e5710c 100644
--- a/Tests/MFC/mfc1/mfc1.rc
+++ b/Tests/MFC/mfc1/mfc1.rc
@@ -22,13 +22,13 @@
1 TEXTINCLUDE
BEGIN
- "resource.h\0"
+ "resource.h\0"
END
2 TEXTINCLUDE
BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
+ "#include ""afxres.h""\r\n"
+ "\0"
END
3 TEXTINCLUDE
@@ -37,15 +37,15 @@ BEGIN
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
- "\r\n"
- "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
- "LANGUAGE 9, 1\r\n"
- "#pragma code_page(1252)\r\n"
- "#include ""res\\mfc1.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
- "#include ""afxres.rc"" // Standard components\r\n"
- "#include ""afxprint.rc"" // printing/print preview resources\r\n"
- "#endif\r\n"
- "\0"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\mfc1.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#include ""afxprint.rc"" // printing/print preview resources\r\n"
+ "#endif\r\n"
+ "\0"
END
#endif // APSTUDIO_INVOKED
@@ -82,11 +82,11 @@ BEGIN
BUTTON ID_FILE_NEW
BUTTON ID_FILE_OPEN
BUTTON ID_FILE_SAVE
- SEPARATOR
+ SEPARATOR
BUTTON ID_EDIT_CUT
BUTTON ID_EDIT_COPY
BUTTON ID_EDIT_PASTE
- SEPARATOR
+ SEPARATOR
BUTTON ID_FILE_PRINT
BUTTON ID_APP_ABOUT
END
@@ -103,70 +103,70 @@ LANGUAGE 9, 1
IDR_MAINFRAME MENU
BEGIN
- POPUP "&File"
- BEGIN
- MENUITEM "&New\tCtrl+N", ID_FILE_NEW
- MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
- MENUITEM SEPARATOR
- MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
- MENUITEM SEPARATOR
- MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED
- MENUITEM SEPARATOR
- MENUITEM "&Close", ID_FILE_CLOSE
- MENUITEM "E&xit", ID_APP_EXIT
- END
- POPUP "&View"
- BEGIN
- MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
- MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
- END
- POPUP "&Help"
- BEGIN
- MENUITEM "&About mfc1...", ID_APP_ABOUT
- END
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&New\tCtrl+N", ID_FILE_NEW
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM SEPARATOR
+ MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
+ MENUITEM SEPARATOR
+ MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "&Close", ID_FILE_CLOSE
+ MENUITEM "E&xit", ID_APP_EXIT
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
+ MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&About mfc1...", ID_APP_ABOUT
+ END
END
IDR_mfc1TYPE MENU
BEGIN
- POPUP "&File"
- BEGIN
- MENUITEM "&New\tCtrl+N", ID_FILE_NEW
- MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
- MENUITEM "&Close", ID_FILE_CLOSE
- MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
- MENUITEM "Save &As...", ID_FILE_SAVE_AS
- MENUITEM SEPARATOR
- MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
- MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
- MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
- MENUITEM SEPARATOR
- MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED
- MENUITEM SEPARATOR
- MENUITEM "E&xit", ID_APP_EXIT
- END
- POPUP "&Edit"
- BEGIN
- MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
- MENUITEM SEPARATOR
- MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
- MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
- MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
- END
- POPUP "&View"
- BEGIN
- MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
- MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
- END
- POPUP "&Window"
- BEGIN
- MENUITEM "&New Window", ID_WINDOW_NEW
- MENUITEM "&Cascade", ID_WINDOW_CASCADE
- MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
- MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
- END
- POPUP "&Help"
- BEGIN
- MENUITEM "&About mfc1...", ID_APP_ABOUT
- END
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&New\tCtrl+N", ID_FILE_NEW
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM "&Close", ID_FILE_CLOSE
+ MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
+ MENUITEM "Save &As...", ID_FILE_SAVE_AS
+ MENUITEM SEPARATOR
+ MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
+ MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
+ MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
+ MENUITEM SEPARATOR
+ MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", ID_APP_EXIT
+ END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
+ MENUITEM SEPARATOR
+ MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
+ MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
+ MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
+ END
+ POPUP "&Window"
+ BEGIN
+ MENUITEM "&New Window", ID_WINDOW_NEW
+ MENUITEM "&Cascade", ID_WINDOW_CASCADE
+ MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
+ MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&About mfc1...", ID_APP_ABOUT
+ END
END
@@ -177,20 +177,20 @@ END
IDR_MAINFRAME ACCELERATORS
BEGIN
- "N", ID_FILE_NEW, VIRTKEY,CONTROL
- "O", ID_FILE_OPEN, VIRTKEY,CONTROL
- "S", ID_FILE_SAVE, VIRTKEY,CONTROL
- "P", ID_FILE_PRINT, VIRTKEY,CONTROL
- "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL
- "X", ID_EDIT_CUT, VIRTKEY,CONTROL
- "C", ID_EDIT_COPY, VIRTKEY,CONTROL
- "V", ID_EDIT_PASTE, VIRTKEY,CONTROL
- VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT
- VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT
- VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL
- VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT
- VK_F6, ID_NEXT_PANE, VIRTKEY
- VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT
+ "N", ID_FILE_NEW, VIRTKEY,CONTROL
+ "O", ID_FILE_OPEN, VIRTKEY,CONTROL
+ "S", ID_FILE_SAVE, VIRTKEY,CONTROL
+ "P", ID_FILE_PRINT, VIRTKEY,CONTROL
+ "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL
+ "X", ID_EDIT_CUT, VIRTKEY,CONTROL
+ "C", ID_EDIT_COPY, VIRTKEY,CONTROL
+ "V", ID_EDIT_PASTE, VIRTKEY,CONTROL
+ VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT
+ VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT
+ VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL
+ VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT
+ VK_F6, ID_NEXT_PANE, VIRTKEY
+ VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT
END
/////////////////////////////////////////////////////////////////////////////
@@ -209,11 +209,11 @@ CAPTION "About mfc1"
STYLE DS_MODALFRAME | DS_SHELLFONT_FLAG | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
- ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
- LTEXT "mfc1 Version 1.0",IDC_STATIC,40,10,119,8,
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
+ LTEXT "mfc1 Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
- LTEXT "Copyright (C) 2011",IDC_STATIC,40,25,119,8
- DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
+ LTEXT "Copyright (C) 2011",IDC_STATIC,40,25,119,8
+ DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
END
@@ -235,23 +235,23 @@ VS_VERSION_INFO VERSIONINFO
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
- BLOCK "StringFileInfo"
- BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
BLOCK "040904e4"
- BEGIN
+ BEGIN
VALUE "CompanyName", "TODO: <Company name>"
VALUE "FileDescription", "TODO: <File description>"
- VALUE "FileVersion", "1.0.0.1"
- VALUE "InternalName", "mfc1.exe"
+ VALUE "FileVersion", "1.0.0.1"
+ VALUE "InternalName", "mfc1.exe"
VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved."
- VALUE "OriginalFilename","mfc1.exe"
+ VALUE "OriginalFilename","mfc1.exe"
VALUE "ProductName", "TODO: <Product name>"
- VALUE "ProductVersion", "1.0.0.1"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0409, 1252
+ VALUE "ProductVersion", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 1252
END
END
@@ -281,95 +281,95 @@ END
STRINGTABLE
BEGIN
// Non-mac-targeting apps remove the two extra substrings
- IDR_MAINFRAME "mfc1"
+ IDR_MAINFRAME "mfc1"
// has a file suffix - shell file type too
- IDR_mfc1TYPE "\nmfc1\nmfc1\nmfc1 Files (*.mf1)\n.mf1\nmfc1.Document\nmfc1.Document"
+ IDR_mfc1TYPE "\nmfc1\nmfc1\nmfc1 Files (*.mf1)\n.mf1\nmfc1.Document\nmfc1.Document"
END
STRINGTABLE
BEGIN
- AFX_IDS_APP_TITLE "mfc1"
- AFX_IDS_IDLEMESSAGE "Ready"
+ AFX_IDS_APP_TITLE "mfc1"
+ AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE
BEGIN
- ID_INDICATOR_EXT "EXT"
- ID_INDICATOR_CAPS "CAP"
- ID_INDICATOR_NUM "NUM"
- ID_INDICATOR_SCRL "SCRL"
- ID_INDICATOR_OVR "OVR"
- ID_INDICATOR_REC "REC"
+ ID_INDICATOR_EXT "EXT"
+ ID_INDICATOR_CAPS "CAP"
+ ID_INDICATOR_NUM "NUM"
+ ID_INDICATOR_SCRL "SCRL"
+ ID_INDICATOR_OVR "OVR"
+ ID_INDICATOR_REC "REC"
END
STRINGTABLE
BEGIN
- ID_FILE_NEW "Create a new document\nNew"
- ID_FILE_OPEN "Open an existing document\nOpen"
- ID_FILE_CLOSE "Close the active document\nClose"
- ID_FILE_SAVE "Save the active document\nSave"
- ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
- ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
- ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
- ID_FILE_PRINT "Print the active document\nPrint"
- ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
- ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
- ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
- ID_FILE_MRU_FILE1 "Open this document"
- ID_FILE_MRU_FILE2 "Open this document"
- ID_FILE_MRU_FILE3 "Open this document"
- ID_FILE_MRU_FILE4 "Open this document"
- ID_FILE_MRU_FILE5 "Open this document"
- ID_FILE_MRU_FILE6 "Open this document"
- ID_FILE_MRU_FILE7 "Open this document"
- ID_FILE_MRU_FILE8 "Open this document"
- ID_FILE_MRU_FILE9 "Open this document"
- ID_FILE_MRU_FILE10 "Open this document"
- ID_FILE_MRU_FILE11 "Open this document"
- ID_FILE_MRU_FILE12 "Open this document"
- ID_FILE_MRU_FILE13 "Open this document"
- ID_FILE_MRU_FILE14 "Open this document"
- ID_FILE_MRU_FILE15 "Open this document"
- ID_FILE_MRU_FILE16 "Open this document"
- ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
- ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
- ID_WINDOW_NEW "Open another window for the active document\nNew Window"
- ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
- ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
- ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
- ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
- ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
- ID_EDIT_CLEAR "Erase the selection\nErase"
- ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
- ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
- ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
- ID_EDIT_FIND "Find the specified text\nFind"
- ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
- ID_EDIT_REPEAT "Repeat the last action\nRepeat"
- ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
- ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
- ID_EDIT_UNDO "Undo the last action\nUndo"
- ID_EDIT_REDO "Redo the previously undone action\nRedo"
- ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
- ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
+ ID_FILE_NEW "Create a new document\nNew"
+ ID_FILE_OPEN "Open an existing document\nOpen"
+ ID_FILE_CLOSE "Close the active document\nClose"
+ ID_FILE_SAVE "Save the active document\nSave"
+ ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
+ ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
+ ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
+ ID_FILE_PRINT "Print the active document\nPrint"
+ ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
+ ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
+ ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
+ ID_FILE_MRU_FILE1 "Open this document"
+ ID_FILE_MRU_FILE2 "Open this document"
+ ID_FILE_MRU_FILE3 "Open this document"
+ ID_FILE_MRU_FILE4 "Open this document"
+ ID_FILE_MRU_FILE5 "Open this document"
+ ID_FILE_MRU_FILE6 "Open this document"
+ ID_FILE_MRU_FILE7 "Open this document"
+ ID_FILE_MRU_FILE8 "Open this document"
+ ID_FILE_MRU_FILE9 "Open this document"
+ ID_FILE_MRU_FILE10 "Open this document"
+ ID_FILE_MRU_FILE11 "Open this document"
+ ID_FILE_MRU_FILE12 "Open this document"
+ ID_FILE_MRU_FILE13 "Open this document"
+ ID_FILE_MRU_FILE14 "Open this document"
+ ID_FILE_MRU_FILE15 "Open this document"
+ ID_FILE_MRU_FILE16 "Open this document"
+ ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
+ ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
+ ID_WINDOW_NEW "Open another window for the active document\nNew Window"
+ ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
+ ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
+ ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
+ ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
+ ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
+ ID_EDIT_CLEAR "Erase the selection\nErase"
+ ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
+ ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
+ ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
+ ID_EDIT_FIND "Find the specified text\nFind"
+ ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
+ ID_EDIT_REPEAT "Repeat the last action\nRepeat"
+ ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
+ ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
+ ID_EDIT_UNDO "Undo the last action\nUndo"
+ ID_EDIT_REDO "Redo the previously undone action\nRedo"
+ ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
+ ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE
BEGIN
- AFX_IDS_SCSIZE "Change the window size"
- AFX_IDS_SCMOVE "Change the window position"
- AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
- AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
- AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
- AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
- AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
- AFX_IDS_SCRESTORE "Restore the window to normal size"
- AFX_IDS_SCTASKLIST "Activate Task List"
- AFX_IDS_MDICHILD "Activate this window"
- AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
+ AFX_IDS_SCSIZE "Change the window size"
+ AFX_IDS_SCMOVE "Change the window position"
+ AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
+ AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
+ AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
+ AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
+ AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
+ AFX_IDS_SCRESTORE "Restore the window to normal size"
+ AFX_IDS_SCTASKLIST "Activate Task List"
+ AFX_IDS_MDICHILD "Activate this window"
+ AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
END
#endif
#ifdef _UNICODE
-IDR_MANIFEST RT_MANIFEST "res\\mfc1.manifest"
+IDR_MANIFEST RT_MANIFEST "res\\mfc1.manifest"
#endif
#ifndef APSTUDIO_INVOKED
@@ -387,7 +387,7 @@ IDR_MANIFEST RT_MANIFEST "res\\mfc1.manifest"
LANGUAGE 9, 1
#pragma code_page(1252)
#include "res\\mfc1.rc2" // non-Microsoft Visual C++ edited resources
-#include "afxres.rc" // Standard components
+#include "afxres.rc" // Standard components
#include "afxprint.rc" // printing/print preview resources
#endif
#endif // not APSTUDIO_INVOKED
diff --git a/Tests/MSManifest/Subdir2/test_manifest1.in b/Tests/MSManifest/Subdir2/test_manifest1.in
index f36eead..b2fa573 100644
--- a/Tests/MSManifest/Subdir2/test_manifest1.in
+++ b/Tests/MSManifest/Subdir2/test_manifest1.in
@@ -1,5 +1,5 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" version="1.0.0.0"
name="Kitware.CMake.MSMultipleManifest"/>
- <description>CMake Multiple Manifest Test Application</description>
+ <description>CMake Multiple Manifest Test Application</description>
</assembly>
diff --git a/Tests/MSManifest/Subdir2/test_manifest2.in b/Tests/MSManifest/Subdir2/test_manifest2.in
index ec96f11..f91b94e 100644
--- a/Tests/MSManifest/Subdir2/test_manifest2.in
+++ b/Tests/MSManifest/Subdir2/test_manifest2.in
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
- <application>
- <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
- <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
- <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
- </application>
- </compatibility>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
+ </application>
+ </compatibility>
</assembly>
diff --git a/Tests/MSVCRuntimeChecks/CMakeLists.txt b/Tests/MSVCRuntimeChecks/CMakeLists.txt
new file mode 100644
index 0000000..cac117c
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/CMakeLists.txt
@@ -0,0 +1,105 @@
+cmake_minimum_required(VERSION 3.31)
+cmake_policy(SET CMP0184 NEW)
+
+# All runtime checks flags enables single preprocessor definition,
+# so override our table of flags to artificially add a definition we can check.
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/override-C.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/override-CXX.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA ${CMAKE_CURRENT_SOURCE_DIR}/override-CUDA.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran ${CMAKE_CURRENT_SOURCE_DIR}/override-Fortran.cmake)
+
+project(MSVCRuntimeChecks)
+if(CMake_TEST_CUDA STREQUAL "NVIDIA")
+ enable_language(CUDA)
+endif()
+if(CMake_TEST_Fortran)
+ enable_language(Fortran)
+endif()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+set(verify_default VERIFY_RTCsu)
+
+set(verify_def_PossibleDataLoss -DVERIFY_RTCc)
+set(verify_def_StackFrameErrorCheck -DVERIFY_RTCs)
+set(verify_def_UninitializedVariable -DVERIFY_RTCu)
+set(verify_def_RTCsu -DVERIFY_RTCsu)
+
+function(verify_combination format verify_format_defs lang src)
+ # Test that try_compile builds with this runtime check.
+ set(CMAKE_MSVC_RUNTIME_CHECKS "${format}")
+ set(CMAKE_TRY_COMPILE_CONFIGURATION "Debug")
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
+
+ string(REPLACE ";" "_" format_var_name "${format}")
+ if (NOT format_var_name)
+ set(format_var_name "Empty")
+ endif()
+
+ if (NOT verify_format_defs)
+ foreach(format_for_def IN LISTS format)
+ list(APPEND verify_format_defs ${verify_def_${format_for_def}})
+ endforeach()
+ endif()
+
+ try_compile(${format_var_name}_COMPILES
+ ${CMAKE_CURRENT_BINARY_DIR}/try_compile/${format_var_name}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${src}
+ COMPILE_DEFINITIONS ${verify_format_defs}
+ CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE ${format_var_name}_OUTPUT
+ )
+ if(${format_var_name}_COMPILES)
+ message(STATUS "try_compile ${lang} with \"${format}\" worked")
+ else()
+ string(REPLACE "\n" "\n " ${format_var_name}_OUTPUT " ${${format_var_name}_OUTPUT}")
+ message(SEND_ERROR "try_compile ${lang} with \"${format}\" failed:\n${${format_var_name}_OUTPUT}")
+ endif()
+
+ # Test that targets build with this runtime check.
+ set(CMAKE_MSVC_RUNTIME_CHECKS "$<$<BOOL:$<TARGET_PROPERTY:BOOL_TRUE>>:${format}>$<$<BOOL:$<TARGET_PROPERTY:BOOL_FALSE>>:BadContent>")
+ add_library(${format_var_name}-${lang} ${src})
+ set_property(TARGET ${format_var_name}-${lang} PROPERTY BOOL_TRUE TRUE)
+ target_compile_definitions(${format_var_name}-${lang} PRIVATE ${verify_format_defs})
+endfunction()
+
+function(verify lang src)
+ add_library(default-${lang} ${src})
+ target_compile_definitions(default-${lang} PRIVATE "$<$<CONFIG:Debug>:${verify_default}>")
+
+ # zero checkers
+ verify_combination("" "" ${lang} ${src})
+
+ # single checker
+ verify_combination(PossibleDataLoss "" ${lang} ${src})
+ verify_combination(StackFrameErrorCheck "" ${lang} ${src})
+ verify_combination(UninitializedVariable "" ${lang} ${src})
+ verify_combination(RTCsu "" ${lang} ${src})
+
+ # multiple checkers (without RTCsu merging)
+ verify_combination("PossibleDataLoss;StackFrameErrorCheck" "" ${lang} ${src})
+ verify_combination("PossibleDataLoss;UninitializedVariable" "" ${lang} ${src})
+
+ # multiple checkers (only RTCsu merging)
+ set(defs "${verify_def_RTCsu}")
+ verify_combination("StackFrameErrorCheck;UninitializedVariable" "${defs}" ${lang} ${src})
+ verify_combination("StackFrameErrorCheck;RTCsu" "${defs}" ${lang} ${src})
+ verify_combination("UninitializedVariable;RTCsu" "${defs}" ${lang} ${src})
+ verify_combination("StackFrameErrorCheck;UninitializedVariable;RTCsu" "${defs}" ${lang} ${src})
+
+ # multiple checkers (with RTCsu merging)
+ list(APPEND defs "${verify_def_PossibleDataLoss}")
+ verify_combination("PossibleDataLoss;StackFrameErrorCheck;UninitializedVariable" "${defs}" ${lang} ${src})
+ verify_combination("PossibleDataLoss;StackFrameErrorCheck;RTCsu" "${defs}" ${lang} ${src})
+ verify_combination("PossibleDataLoss;UninitializedVariable;RTCsu" "${defs}" ${lang} ${src})
+ verify_combination("PossibleDataLoss;StackFrameErrorCheck;UninitializedVariable;RTCsu" "${defs}" ${lang} ${src})
+endfunction()
+
+verify(C verify.c)
+verify(CXX verify.cxx)
+if(CMake_TEST_CUDA STREQUAL "NVIDIA")
+ verify(CUDA verify.cu)
+endif()
+if(CMake_TEST_Fortran)
+ verify(Fortran verify.F90)
+endif()
diff --git a/Tests/MSVCRuntimeChecks/override-C.cmake b/Tests/MSVCRuntimeChecks/override-C.cmake
new file mode 100644
index 0000000..8e25994
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/override-C.cmake
@@ -0,0 +1,3 @@
+set(delimiter ";")
+set(lang "C")
+include(${CMAKE_CURRENT_LIST_DIR}/override-common.cmake)
diff --git a/Tests/MSVCRuntimeChecks/override-CUDA.cmake b/Tests/MSVCRuntimeChecks/override-CUDA.cmake
new file mode 100644
index 0000000..7f61309
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/override-CUDA.cmake
@@ -0,0 +1,3 @@
+set(delimiter " ")
+set(lang "CUDA")
+include(${CMAKE_CURRENT_LIST_DIR}/override-common.cmake)
diff --git a/Tests/MSVCRuntimeChecks/override-CXX.cmake b/Tests/MSVCRuntimeChecks/override-CXX.cmake
new file mode 100644
index 0000000..27e1579
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/override-CXX.cmake
@@ -0,0 +1,3 @@
+set(delimiter ";")
+set(lang "CXX")
+include(${CMAKE_CURRENT_LIST_DIR}/override-common.cmake)
diff --git a/Tests/MSVCRuntimeChecks/override-Fortran.cmake b/Tests/MSVCRuntimeChecks/override-Fortran.cmake
new file mode 100644
index 0000000..0a790eb
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/override-Fortran.cmake
@@ -0,0 +1,3 @@
+set(delimiter ";")
+set(lang "Fortran")
+include(${CMAKE_CURRENT_LIST_DIR}/override-common.cmake)
diff --git a/Tests/MSVCRuntimeChecks/override-common.cmake b/Tests/MSVCRuntimeChecks/override-common.cmake
new file mode 100644
index 0000000..0241702
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/override-common.cmake
@@ -0,0 +1,50 @@
+if("${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID};${CMAKE_${lang}_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;GNU")
+ # Clang does not actually support these, so Windows-Clang passes no flags.
+ set(empty_PossibleDataLoss 1)
+ set(empty_StackFrameErrorCheck 1)
+ set(empty_UninitializedVariable 1)
+ set(empty_RTCsu 1)
+elseif("${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID};${lang}" MATCHES "^Intel(LLVM)?;MSVC;Fortran$")
+ # IntelLLVM Fortran does not actually support these, so Windows-IntelLLVM-Fortran passes no flags.
+ set(empty_PossibleDataLoss 1)
+ set(empty_StackFrameErrorCheck 1)
+ set(empty_UninitializedVariable 0) # this one is supported
+ set(empty_RTCsu 1)
+elseif(CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC" AND CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 14)
+ set(empty_PossibleDataLoss 1)
+ set(empty_StackFrameErrorCheck 0)
+ set(empty_UninitializedVariable 1)
+ set(empty_RTCsu 0)
+else()
+ set(empty_PossibleDataLoss 0)
+ set(empty_StackFrameErrorCheck 0)
+ set(empty_UninitializedVariable 0)
+ set(empty_RTCsu 0)
+endif()
+
+set(var "CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss")
+if(empty_PossibleDataLoss AND ${var} STREQUAL "")
+ set("${var}" "-DTEST_RTCc")
+else()
+ string(REPLACE "-RTCc" "-RTCc${delimiter}-DTEST_RTCc" "${var}" "${${var}}")
+endif()
+set(var "CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck")
+if(empty_StackFrameErrorCheck AND ${var} STREQUAL "")
+ set("${var}" "-DTEST_RTCs")
+else()
+ string(REPLACE "-RTCs" "-RTCs${delimiter}-DTEST_RTCs" "${var}" "${${var}}")
+ string(REPLACE "-GZ" "-GZ${delimiter}-DTEST_RTCs" "${var}" "${${var}}")
+endif()
+set(var "CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable")
+if(empty_UninitializedVariable AND ${var} STREQUAL "")
+ set("${var}" "-DTEST_RTCu")
+else()
+ string(REPLACE "-RTCu" "-RTCu${delimiter}-DTEST_RTCu" "${var}" "${${var}}")
+endif()
+set(var "CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu")
+if(empty_RTCsu AND ${var} STREQUAL "")
+ set("${var}" "-DTEST_RTCsu")
+else()
+ string(REPLACE "-RTC1" "-RTC1${delimiter}-DTEST_RTCsu" "${var}" "${${var}}")
+ string(REPLACE "-GZ" "-GZ${delimiter}-DTEST_RTCsu" "${var}" "${${var}}")
+endif()
diff --git a/Tests/MSVCRuntimeChecks/verify.F90 b/Tests/MSVCRuntimeChecks/verify.F90
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/verify.F90
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCRuntimeChecks/verify.c b/Tests/MSVCRuntimeChecks/verify.c
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/verify.c
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCRuntimeChecks/verify.cu b/Tests/MSVCRuntimeChecks/verify.cu
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/verify.cu
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCRuntimeChecks/verify.cxx b/Tests/MSVCRuntimeChecks/verify.cxx
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/verify.cxx
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCRuntimeChecks/verify.h b/Tests/MSVCRuntimeChecks/verify.h
new file mode 100644
index 0000000..aae595b
--- /dev/null
+++ b/Tests/MSVCRuntimeChecks/verify.h
@@ -0,0 +1,61 @@
+/* Some compilers ignore the -RTC flags even if specified. */
+#if (defined(_MSC_VER) && _MSC_VER <= 1310) || defined(__clang__) || \
+ defined(__INTEL_LLVM_COMPILER) || defined(__INTEL_COMPILER)
+# define NO__MSVC_RUNTIME_CHECKS
+#endif
+
+#ifdef VERIFY_RTCc
+# ifndef TEST_RTCc
+# error "TEST_RTCc incorrectly not defined by enabled runtime check"
+# endif
+# if !defined(__MSVC_RUNTIME_CHECKS) && !defined(NO__MSVC_RUNTIME_CHECKS)
+# error \
+ "__MSVC_RUNTIME_CHECKS incorrectly not defined by enabled RTCc runtime check"
+# endif
+#else
+# ifdef TEST_RTCc
+# error "TEST_RTCc incorrectly defined by disabled runtime check"
+# endif
+#endif
+
+#ifdef VERIFY_RTCs
+# ifndef TEST_RTCs
+# error "TEST_RTCs incorrectly not defined by enabled runtime check"
+# endif
+# if !defined(__MSVC_RUNTIME_CHECKS) && !defined(NO__MSVC_RUNTIME_CHECKS)
+# error \
+ "__MSVC_RUNTIME_CHECKS incorrectly not defined by enabled RTCs runtime check"
+# endif
+#else
+# ifdef TEST_RTCs
+# error "TEST_RTCs incorrectly defined by disabled runtime check"
+# endif
+#endif
+
+#ifdef VERIFY_RTCu
+# ifndef TEST_RTCu
+# error "TEST_RTCu incorrectly not defined by enabled runtime check"
+# endif
+# if !defined(__MSVC_RUNTIME_CHECKS) && !defined(NO__MSVC_RUNTIME_CHECKS)
+# error \
+ "__MSVC_RUNTIME_CHECKS incorrectly not defined by enabled RTCu runtime check"
+# endif
+#else
+# ifdef TEST_RTCu
+# error "TEST_RTCu incorrectly defined by disabled runtime check"
+# endif
+#endif
+
+#ifdef VERIFY_RTCsu
+# ifndef TEST_RTCsu
+# error "TEST_RTCsu incorrectly not defined by enabled runtime check"
+# endif
+# if !defined(__MSVC_RUNTIME_CHECKS) && !defined(NO__MSVC_RUNTIME_CHECKS)
+# error \
+ "__MSVC_RUNTIME_CHECKS incorrectly not defined by enabled RTCsu runtime check"
+# endif
+#else
+# ifdef TEST_RTCsu
+# error "TEST_RTCsu incorrectly defined by disabled runtime check"
+# endif
+#endif
diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt
index 50ac71f..5f32953 100644
--- a/Tests/MacRuntimePath/A/CMakeLists.txt
+++ b/Tests/MacRuntimePath/A/CMakeLists.txt
@@ -10,8 +10,6 @@ add_library(shared2 SHARED shared.cpp shared.h)
set_target_properties(shared2 PROPERTIES
BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")
-cmake_policy(SET CMP0042 NEW)
-
# a framework library
add_library(framework SHARED framework.cpp framework.h)
set_target_properties(framework PROPERTIES FRAMEWORK 1)
diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt
index 6cafcc0..dad3970 100644
--- a/Tests/MathTest/CMakeLists.txt
+++ b/Tests/MathTest/CMakeLists.txt
@@ -52,4 +52,3 @@ configure_file(
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
add_executable(MathTest MathTestExec.cxx)
-
diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx
index fbcddc4..94b6ebc 100644
--- a/Tests/MathTest/MathTestExec.cxx
+++ b/Tests/MathTest/MathTestExec.cxx
@@ -5,7 +5,7 @@
int res = 0;
bool print = false;
-void test_expression(int x, int y, const char* text)
+void test_expression(int x, int y, char const* text)
{
bool fail = (x) != (y);
if (fail) {
diff --git a/Tests/MumpsCoverage/.gitattributes b/Tests/MumpsCoverage/.gitattributes
index 9fc9b0f..86e85dc 100644
--- a/Tests/MumpsCoverage/.gitattributes
+++ b/Tests/MumpsCoverage/.gitattributes
@@ -1 +1,2 @@
*.cmcov eol=crlf
+*.m tab-indent
diff --git a/Tests/MumpsCoverage/ZZCOVTST.mcov b/Tests/MumpsCoverage/ZZCOVTST.mcov
index e1fa18c..f3bd40b 100644
--- a/Tests/MumpsCoverage/ZZCOVTST.mcov
+++ b/Tests/MumpsCoverage/ZZCOVTST.mcov
@@ -37,5 +37,3 @@ GT.M 15-AUG-2014 10:14:32 ZWR
^ZZCOVERAGE("ZZCOVTST","T6",4)="1:0:0:0:41"
^ZZCOVERAGE("ZZCOVTST","T6",5)="1:0:0:0:34"
^ZZCOVERAGE("ZZCOVTST","T6",6)="1:0:0:0:38"
-
-
diff --git a/Tests/NewlineArgs/libcxx2.h.in b/Tests/NewlineArgs/libcxx2.h.in
index bdf9cfa..0ece510 100644
--- a/Tests/NewlineArgs/libcxx2.h.in
+++ b/Tests/NewlineArgs/libcxx2.h.in
@@ -3,4 +3,3 @@
#define TEST_FLAG_3
#endif
#endif
-
diff --git a/Tests/OutDir/OutDir.c b/Tests/OutDir/OutDir.c
index 4f6ae87..25bc83c 100644
--- a/Tests/OutDir/OutDir.c
+++ b/Tests/OutDir/OutDir.c
@@ -3,9 +3,9 @@
int main(void)
{
- const char* files[] = { TESTC1_LIB, TESTC2_LIB, CONLY_EXE, 0 };
+ char const* files[] = { TESTC1_LIB, TESTC2_LIB, CONLY_EXE, 0 };
int result = 0;
- const char** fname = files;
+ char const** fname = files;
for (; *fname; ++fname) {
FILE* f = fopen(*fname, "rb");
if (f) {
diff --git a/Tests/PerConfig/CMakeLists.txt b/Tests/PerConfig/CMakeLists.txt
index 7f461b0..d6d63d1 100644
--- a/Tests/PerConfig/CMakeLists.txt
+++ b/Tests/PerConfig/CMakeLists.txt
@@ -1,5 +1,7 @@
project(PerConfig C)
+set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
+
# Targets with per-configuration names.
add_library(pcStatic STATIC pcStatic.c)
set_property(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt)
diff --git a/Tests/PerConfig/pcShared.c b/Tests/PerConfig/pcShared.c
index b08fadc..9b4bf98 100644
--- a/Tests/PerConfig/pcShared.c
+++ b/Tests/PerConfig/pcShared.c
@@ -1,5 +1,5 @@
#include "pcShared.h"
-const char* pcShared(void)
+char const* pcShared(void)
{
return "INFO:symbol[pcShared]";
}
diff --git a/Tests/PerConfig/pcStatic.c b/Tests/PerConfig/pcStatic.c
index 7e1bf51..2ac1f33 100644
--- a/Tests/PerConfig/pcStatic.c
+++ b/Tests/PerConfig/pcStatic.c
@@ -1,4 +1,4 @@
-const char* pcStatic(void)
+char const* pcStatic(void)
{
return "INFO:symbol[pcStatic]";
}
diff --git a/Tests/PerConfig/perconfig.c b/Tests/PerConfig/perconfig.c
index 5162ae0..16ac035 100644
--- a/Tests/PerConfig/perconfig.c
+++ b/Tests/PerConfig/perconfig.c
@@ -1,5 +1,5 @@
#include "pcShared.h"
-extern const char* pcStatic(void);
+extern char const* pcStatic(void);
int main(void)
{
pcStatic();
diff --git a/Tests/Plugin/include/DynamicLoader.hxx b/Tests/Plugin/include/DynamicLoader.hxx
index 20b37de..ce4641c 100644
--- a/Tests/Plugin/include/DynamicLoader.hxx
+++ b/Tests/Plugin/include/DynamicLoader.hxx
@@ -39,11 +39,11 @@ public:
typedef void (*SymbolPointer)();
- static LibraryHandle OpenLibrary(const std::string&);
+ static LibraryHandle OpenLibrary(std::string const&);
static int CloseLibrary(LibraryHandle);
- static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
+ static SymbolPointer GetSymbolAddress(LibraryHandle, std::string const&);
};
#endif
diff --git a/Tests/Plugin/src/DynamicLoader.cxx b/Tests/Plugin/src/DynamicLoader.cxx
index d4a2637..1497f4a 100644
--- a/Tests/Plugin/src/DynamicLoader.cxx
+++ b/Tests/Plugin/src/DynamicLoader.cxx
@@ -10,7 +10,7 @@
# include <dl.h>
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
}
@@ -24,7 +24,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
void* addr;
int status;
@@ -45,7 +45,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
# include <mach-o/dyld.h>
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
NSObjectFileImageReturnCode rc;
NSObjectFileImage image = 0;
@@ -69,7 +69,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
void* result = 0;
// Need to prepend symbols with '_' on Apple-gcc compilers
@@ -90,7 +90,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
# include <stdio.h>
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
DynamicLoader::LibraryHandle lh;
int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0);
@@ -108,15 +108,15 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
void* result;
# if defined(__BORLANDC__) || defined(__WATCOMC__)
// Need to prepend symbols with '_'
std::string ssym = '_' + sym;
- const char* rsym = ssym.c_str();
+ char const* rsym = ssym.c_str();
# else
- const char* rsym = sym.c_str();
+ char const* rsym = sym.c_str();
# endif
result = (void*)GetProcAddress(lib, rsym);
// Hack to cast pointer-to-data to pointer-to-function.
@@ -134,7 +134,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
static image_id last_dynamic_err = B_OK;
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
// image_id's are integers, errors are negative. Add one just in case we
// get a valid image_id of zero (is that even possible?).
@@ -165,7 +165,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -199,7 +199,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
# include <malloc.h>
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
char* name = (char*)calloc(1, libname.size() + 1);
dld_init(program_invocation_name);
@@ -216,7 +216,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -232,7 +232,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
# include <dlfcn.h>
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
+ std::string const& libname)
{
return dlopen(libname.c_str(), RTLD_LAZY);
}
@@ -248,7 +248,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
}
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
+ DynamicLoader::LibraryHandle lib, std::string const& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
diff --git a/Tests/Policy0002/A/CMakeLists.txt b/Tests/Policy0002/A/CMakeLists.txt
deleted file mode 100644
index cee6422..0000000
--- a/Tests/Policy0002/A/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_executable(Policy0002 ../policy0002.c)
diff --git a/Tests/Policy0002/CMakeLists.txt b/Tests/Policy0002/CMakeLists.txt
deleted file mode 100644
index a408e76..0000000
--- a/Tests/Policy0002/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-project(Policy0002 C)
-cmake_policy(SET CMP0002 OLD)
-add_subdirectory(A)
-add_executable(Policy0002 policy0002.c)
diff --git a/Tests/PolicyScope/Bar.cmake b/Tests/PolicyScope/Bar.cmake
index 5202cb5..fb5ef60 100644
--- a/Tests/PolicyScope/Bar.cmake
+++ b/Tests/PolicyScope/Bar.cmake
@@ -1,8 +1,5 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.31)
# Make sure a policy set differently by our includer is now correct.
-cmake_policy(GET CMP0003 cmp)
-check(CMP0003 "NEW" "${cmp}")
-
-# Test allowing the top-level file to not have cmake_minimum_required.
-cmake_policy(SET CMP0000 OLD)
+cmake_policy(GET CMP0180 cmp)
+check(CMP0180 "NEW" "${cmp}")
diff --git a/Tests/PolicyScope/CMakeLists.txt b/Tests/PolicyScope/CMakeLists.txt
index 353842b..15e553c 100644
--- a/Tests/PolicyScope/CMakeLists.txt
+++ b/Tests/PolicyScope/CMakeLists.txt
@@ -1,5 +1,5 @@
+cmake_minimum_required(VERSION 3.30)
project(PolicyScope C)
-# No cmake_minimum_required(VERSION), it's in FindFoo.
#-----------------------------------------------------------------------------
# Helper function to report results.
@@ -10,35 +10,18 @@ function(check msg lhs rhs)
endfunction()
#-----------------------------------------------------------------------------
-# Test using a development framework that sets policies for us.
-
-# Policy CMP0011 should not be set at this point.
-cmake_policy(GET CMP0011 cmp)
-check(CMP0011 "" "${cmp}")
-
# Put the test modules in the search path.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
-# The included file should set policies for us.
-find_package(Foo)
-
-# Check policies set by the package.
-cmake_policy(GET CMP0003 cmp)
-check(CMP0003 "OLD" "${cmp}")
-cmake_policy(GET CMP0002 cmp)
-check(CMP0002 "NEW" "${cmp}")
-cmake_policy(GET CMP0011 cmp)
-check(CMP0011 "NEW" "${cmp}")
-
# Make sure an included file cannot change policies.
include(Bar)
-cmake_policy(GET CMP0003 cmp)
-check(CMP0003 "OLD" "${cmp}")
+cmake_policy(GET CMP0180 cmp)
+check(CMP0180 "" "${cmp}")
# Allow the included file to change policies.
include(Bar NO_POLICY_SCOPE)
-cmake_policy(GET CMP0003 cmp)
-check(CMP0003 "NEW" "${cmp}")
+cmake_policy(GET CMP0180 cmp)
+check(CMP0180 "NEW" "${cmp}")
#-----------------------------------------------------------------------------
# Test function and macro policy recording.
@@ -46,65 +29,65 @@ check(CMP0003 "NEW" "${cmp}")
# Create the functions in an isolated scope in which we change policies.
cmake_policy(PUSH)
if(1)
- # Change CMP0002
- cmake_policy(SET CMP0002 OLD)
+ # Change CMP0179
+ cmake_policy(SET CMP0179 OLD)
function(func1)
- # CMP0002 should be changed when this function is invoked
- cmake_policy(GET CMP0002 cmp)
- check(CMP0002 "OLD" "${cmp}")
+ # CMP0179 should be changed when this function is invoked
+ cmake_policy(GET CMP0179 cmp)
+ check(CMP0179 "OLD" "${cmp}")
# The undocumented PARENT_SCOPE option sees the caller's setting.
- cmake_policy(GET CMP0002 cmp PARENT_SCOPE)
- check(CMP0002 "NEW" "${cmp}")
+ cmake_policy(GET CMP0179 cmp PARENT_SCOPE)
+ check(CMP0179 "NEW" "${cmp}")
endfunction()
- # Unset CMP0002
- cmake_policy(VERSION 2.4)
+ # Unset CMP0179
+ cmake_policy(VERSION 3.30)
macro(macro1)
- # CMP0002 should be unset when this macro is invoked
- cmake_policy(GET CMP0002 cmp)
- check(CMP0002 "" "${cmp}")
+ # CMP0179 should be unset when this macro is invoked
+ cmake_policy(GET CMP0179 cmp)
+ check(CMP0179 "" "${cmp}")
# The undocumented PARENT_SCOPE option sees the caller's setting.
- cmake_policy(GET CMP0002 cmp PARENT_SCOPE)
- check(CMP0002 "NEW" "${cmp}")
+ cmake_policy(GET CMP0179 cmp PARENT_SCOPE)
+ check(CMP0179 "NEW" "${cmp}")
# Setting the policy should work here and also in the caller.
- cmake_policy(SET CMP0002 OLD)
- cmake_policy(GET CMP0002 cmp)
- check(CMP0002 "OLD" "${cmp}")
+ cmake_policy(SET CMP0179 OLD)
+ cmake_policy(GET CMP0179 cmp)
+ check(CMP0179 "OLD" "${cmp}")
endmacro()
endif()
cmake_policy(POP)
-# CMP0002 should still be NEW in this context.
-cmake_policy(GET CMP0002 cmp)
-check(CMP0002 "NEW" "${cmp}")
+# CMP0179 should still be NEW in this context.
+cmake_policy(GET CMP0179 cmp)
+check(CMP0179 "NEW" "${cmp}")
# Check the recorded policies
func1()
macro1()
-# The macro should have changed CMP0002.
-cmake_policy(GET CMP0002 cmp)
-check(CMP0002 "OLD" "${cmp}")
+# The macro should have changed CMP0179.
+cmake_policy(GET CMP0179 cmp)
+check(CMP0179 "OLD" "${cmp}")
#-----------------------------------------------------------------------------
# Test CMAKE_POLICY_DEFAULT_CMP<NNNN> variable.
cmake_policy(PUSH)
- set(CMAKE_POLICY_DEFAULT_CMP0010 OLD) # ignored
- set(CMAKE_POLICY_DEFAULT_CMP0012 OLD) # honored
- set(CMAKE_POLICY_DEFAULT_CMP0013 NEW) # honored
- set(CMAKE_POLICY_DEFAULT_CMP0014 "") # noop
- cmake_policy(VERSION 2.6.3)
- cmake_policy(GET CMP0010 cmp)
- check(CMP0010 "NEW" "${cmp}")
- cmake_policy(GET CMP0012 cmp)
- check(CMP0012 "OLD" "${cmp}")
- cmake_policy(GET CMP0013 cmp)
- check(CMP0013 "NEW" "${cmp}")
- cmake_policy(GET CMP0014 cmp)
- check(CMP0014 "" "${cmp}")
+ set(CMAKE_POLICY_DEFAULT_CMP0170 OLD) # ignored
+ set(CMAKE_POLICY_DEFAULT_CMP0171 OLD) # honored
+ set(CMAKE_POLICY_DEFAULT_CMP0172 NEW) # honored
+ set(CMAKE_POLICY_DEFAULT_CMP0173 "") # noop
+ cmake_policy(VERSION 3.30)
+ cmake_policy(GET CMP0170 cmp)
+ check(CMP0170 "NEW" "${cmp}")
+ cmake_policy(GET CMP0171 cmp)
+ check(CMP0171 "OLD" "${cmp}")
+ cmake_policy(GET CMP0172 cmp)
+ check(CMP0172 "NEW" "${cmp}")
+ cmake_policy(GET CMP0173 cmp)
+ check(CMP0173 "" "${cmp}")
cmake_policy(POP)
#-----------------------------------------------------------------------------
diff --git a/Tests/PolicyScope/FindFoo.cmake b/Tests/PolicyScope/FindFoo.cmake
deleted file mode 100644
index e364b6d..0000000
--- a/Tests/PolicyScope/FindFoo.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0003 OLD)
diff --git a/Tests/PreOrder/CMakeLists.txt b/Tests/PreOrder/CMakeLists.txt
index 8b4c439..1fcdf66 100644
--- a/Tests/PreOrder/CMakeLists.txt
+++ b/Tests/PreOrder/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.10)
# a simple test case
project (PreOrder)
set(CMAKE_IGNORE_DEPENDENCIES_ORDERING 1)
diff --git a/Tests/PreOrder/Library/CMakeLists.txt b/Tests/PreOrder/Library/CMakeLists.txt
index 018ffa5..effad96 100644
--- a/Tests/PreOrder/Library/CMakeLists.txt
+++ b/Tests/PreOrder/Library/CMakeLists.txt
@@ -1,2 +1 @@
add_library(simpleLib simpleLib.cxx )
-
diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt
index 78ba293..a7d65ba 100644
--- a/Tests/Preprocess/CMakeLists.txt
+++ b/Tests/Preprocess/CMakeLists.txt
@@ -1,6 +1,4 @@
cmake_minimum_required(VERSION 3.10)
-cmake_policy(SET CMP0043 OLD) # testing the old behavior
-
project(Preprocess)
# This test is meant both as a test and as a reference for supported
@@ -229,24 +227,45 @@ set(FILE_PATH "${Preprocess_SOURCE_DIR}/file_def.h")
set(TARGET_PATH "${Preprocess_SOURCE_DIR}/target_def.h")
# Set some definition properties.
-foreach(c "" "_DEBUG" "_RELEASE" "_RELWITHDEBINFO" "_MINSIZEREL")
- set(FLAVOR "${c}")
+set_property(
+ DIRECTORY .
+ APPEND PROPERTY COMPILE_DEFINITIONS "DIRECTORY_DEF"
+ )
+set_property(
+ TARGET Preprocess
+ APPEND PROPERTY COMPILE_DEFINITIONS "TARGET_DEF"
+ )
+set_property(
+ SOURCE preprocess.c preprocess.cxx
+ PROPERTY COMPILE_DEFINITIONS "FILE_DEF"
+ )
+
+# Set some per-config definition properties.
+foreach(c "DEBUG" "RELEASE" "RELWITHDEBINFO" "MINSIZEREL")
# Treat RelWithDebInfo and MinSizeRel as Release to avoid having
- # an exponentional matrix of inclusions and exclusions of defines
- if("${c}" STREQUAL "_RELWITHDEBINFO" OR "${c}" STREQUAL "_MINSIZEREL")
- set(FLAVOR "_RELEASE")
+ # an exponential matrix of inclusions and exclusions of defines
+ if("${c}" STREQUAL "RELWITHDEBINFO" OR "${c}" STREQUAL "MINSIZEREL")
+ set(FLAVOR "RELEASE")
+ else()
+ set(FLAVOR "${c}")
endif()
set_property(
DIRECTORY .
- APPEND PROPERTY COMPILE_DEFINITIONS${c} "DIRECTORY_DEF${FLAVOR}"
+ APPEND PROPERTY COMPILE_DEFINITIONS "$<$<CONFIG:${c}>:DIRECTORY_DEF_${FLAVOR}>"
)
set_property(
TARGET Preprocess
- PROPERTY COMPILE_DEFINITIONS${c} "TARGET_DEF${FLAVOR}"
+ APPEND PROPERTY COMPILE_DEFINITIONS "$<$<CONFIG:${c}>:TARGET_DEF_${FLAVOR}>"
)
+ if(NOT PREPROCESS_XCODE)
+ set_property(
+ SOURCE preprocess.c
+ APPEND PROPERTY COMPILE_DEFINITIONS "$<$<CONFIG:${c}>:FILE_DEF_${FLAVOR}>"
+ )
+ endif()
set_property(
- SOURCE preprocess.c preprocess.cxx
- PROPERTY COMPILE_DEFINITIONS${c} "FILE_DEF${FLAVOR}"
+ SOURCE preprocess.cxx
+ PROPERTY COMPILE_DEFINITIONS_${c} "FILE_DEF_${FLAVOR}"
)
endforeach()
diff --git a/Tests/Qt4Deploy/testdeploy.cpp b/Tests/Qt4Deploy/testdeploy.cpp
index 33c0bb3..88c71af 100644
--- a/Tests/Qt4Deploy/testdeploy.cpp
+++ b/Tests/Qt4Deploy/testdeploy.cpp
@@ -15,7 +15,7 @@ int main(int argc, char** argv)
bool foundSqlite = false;
qDebug() << "Supported Database Drivers:";
- foreach (const QString& sqlDriver, QSqlDatabase::drivers()) {
+ foreach (QString const& sqlDriver, QSqlDatabase::drivers()) {
qDebug() << " " << sqlDriver;
if (sqlDriver == "QSQLITE")
foundSqlite = true;
diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt
index 47a6408..6d5e34b 100644
--- a/Tests/Qt4Targets/CMakeLists.txt
+++ b/Tests/Qt4Targets/CMakeLists.txt
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.10)
project(Qt4Targets)
-cmake_policy(SET CMP0020 NEW)
-
find_package(Qt4 REQUIRED)
set(CMAKE_AUTOMOC ON)
diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp
index 55457d2..3bacc5b 100644
--- a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp
+++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp
@@ -11,7 +11,7 @@ class LObject : public QObject
Q_OBJECT
public:
Q_SLOT
- void aSlot(){};
+ void aSlot() {};
};
#endif
diff --git a/Tests/QtAutogen/Complex/abc.cpp b/Tests/QtAutogen/Complex/abc.cpp
index 4c7dc52..c9fd1a7 100644
--- a/Tests/QtAutogen/Complex/abc.cpp
+++ b/Tests/QtAutogen/Complex/abc.cpp
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "abc.h"
#include <stdio.h>
diff --git a/Tests/QtAutogen/Complex/abc.h b/Tests/QtAutogen/Complex/abc.h
index ec5f411..5a14a17 100644
--- a/Tests/QtAutogen/Complex/abc.h
+++ b/Tests/QtAutogen/Complex/abc.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef ABC_H
#define ABC_H
diff --git a/Tests/QtAutogen/Complex/abc_p.h b/Tests/QtAutogen/Complex/abc_p.h
index 1f6102c..e6d565e 100644
--- a/Tests/QtAutogen/Complex/abc_p.h
+++ b/Tests/QtAutogen/Complex/abc_p.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef ABC_P_H
#define ABC_P_H
diff --git a/Tests/QtAutogen/Complex/bar.cpp b/Tests/QtAutogen/Complex/bar.cpp
index 734bd7a..f4b2a79 100644
--- a/Tests/QtAutogen/Complex/bar.cpp
+++ b/Tests/QtAutogen/Complex/bar.cpp
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "sub/bar.h"
#include <stdio.h>
diff --git a/Tests/QtAutogen/Complex/blub.cpp b/Tests/QtAutogen/Complex/blub.cpp
index 1c497e0..d0b53a8 100644
--- a/Tests/QtAutogen/Complex/blub.cpp
+++ b/Tests/QtAutogen/Complex/blub.cpp
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "blub.h"
#include <stdio.h>
diff --git a/Tests/QtAutogen/Complex/blub.h b/Tests/QtAutogen/Complex/blub.h
index ff79878..c52e2ec 100644
--- a/Tests/QtAutogen/Complex/blub.h
+++ b/Tests/QtAutogen/Complex/blub.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef BLUB_H
#define BLUB_H
diff --git a/Tests/QtAutogen/Complex/calwidget.cpp b/Tests/QtAutogen/Complex/calwidget.cpp
index 202ed49..819ab8d 100644
--- a/Tests/QtAutogen/Complex/calwidget.cpp
+++ b/Tests/QtAutogen/Complex/calwidget.cpp
@@ -110,13 +110,13 @@ void Window::selectedDateChanged()
currentDateEdit->setDate(calendar->selectedDate());
}
-void Window::minimumDateChanged(const QDate& date)
+void Window::minimumDateChanged(QDate const& date)
{
calendar->setMinimumDate(date);
maximumDateEdit->setDate(calendar->maximumDate());
}
-void Window::maximumDateChanged(const QDate& date)
+void Window::maximumDateChanged(QDate const& date)
{
calendar->setMaximumDate(date);
minimumDateEdit->setDate(calendar->minimumDate());
@@ -173,7 +173,7 @@ void Window::reformatCalendarPage()
// May First in Red takes precedence
if (mayFirstCheckBox->isChecked()) {
- const QDate mayFirst(calendar->yearShown(), 5, 1);
+ QDate const mayFirst(calendar->yearShown(), 5, 1);
QTextCharFormat mayFirstFormat;
mayFirstFormat.setForeground(Qt::red);
calendar->setDateTextFormat(mayFirst, mayFirstFormat);
diff --git a/Tests/QtAutogen/Complex/calwidget.h b/Tests/QtAutogen/Complex/calwidget.h
index 084d959..cc7f2a9 100644
--- a/Tests/QtAutogen/Complex/calwidget.h
+++ b/Tests/QtAutogen/Complex/calwidget.h
@@ -70,8 +70,8 @@ private slots:
void horizontalHeaderChanged(int index);
void verticalHeaderChanged(int index);
void selectedDateChanged();
- void minimumDateChanged(const QDate& date);
- void maximumDateChanged(const QDate& date);
+ void minimumDateChanged(QDate const& date);
+ void maximumDateChanged(QDate const& date);
void weekdayFormatChanged();
void weekendFormatChanged();
void reformatHeaders();
diff --git a/Tests/QtAutogen/Complex/codeeditor.cpp b/Tests/QtAutogen/Complex/codeeditor.cpp
index 9c9dbc3..d22999e7 100644
--- a/Tests/QtAutogen/Complex/codeeditor.cpp
+++ b/Tests/QtAutogen/Complex/codeeditor.cpp
@@ -84,7 +84,7 @@ void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */)
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
}
-void CodeEditor::updateLineNumberArea(const QRect& rect, int dy)
+void CodeEditor::updateLineNumberArea(QRect const& rect, int dy)
{
if (dy)
lineNumberArea->scroll(0, dy);
diff --git a/Tests/QtAutogen/Complex/codeeditor.h b/Tests/QtAutogen/Complex/codeeditor.h
index b410bd4..c53064b 100644
--- a/Tests/QtAutogen/Complex/codeeditor.h
+++ b/Tests/QtAutogen/Complex/codeeditor.h
@@ -67,7 +67,7 @@ protected:
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void highlightCurrentLine();
- void updateLineNumberArea(const QRect&, int);
+ void updateLineNumberArea(QRect const&, int);
private:
QWidget* lineNumberArea;
diff --git a/Tests/QtAutogen/Complex/foo.cpp b/Tests/QtAutogen/Complex/foo.cpp
index f665eee..d99e6c1 100644
--- a/Tests/QtAutogen/Complex/foo.cpp
+++ b/Tests/QtAutogen/Complex/foo.cpp
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "foo.h"
#include <stdio.h>
diff --git a/Tests/QtAutogen/Complex/foo.h b/Tests/QtAutogen/Complex/foo.h
index 3e03fe6..024f627 100644
--- a/Tests/QtAutogen/Complex/foo.h
+++ b/Tests/QtAutogen/Complex/foo.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef FOO_H
#define FOO_H
diff --git a/Tests/QtAutogen/Complex/sub/bar.h b/Tests/QtAutogen/Complex/sub/bar.h
index e4093f6..c8e31a1 100644
--- a/Tests/QtAutogen/Complex/sub/bar.h
+++ b/Tests/QtAutogen/Complex/sub/bar.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef BAR_H
#define BAR_H
diff --git a/Tests/QtAutogen/Complex/xyz.cpp b/Tests/QtAutogen/Complex/xyz.cpp
index e46c9d3..37e4a50 100644
--- a/Tests/QtAutogen/Complex/xyz.cpp
+++ b/Tests/QtAutogen/Complex/xyz.cpp
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "xyz.h"
#include <stdio.h>
diff --git a/Tests/QtAutogen/Complex/xyz.h b/Tests/QtAutogen/Complex/xyz.h
index 8b813fd..1a4a868 100644
--- a/Tests/QtAutogen/Complex/xyz.h
+++ b/Tests/QtAutogen/Complex/xyz.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef XYZ_H
#define XYZ_H
diff --git a/Tests/QtAutogen/Complex/yaf.cpp b/Tests/QtAutogen/Complex/yaf.cpp
index 10448c1..eff85cb 100644
--- a/Tests/QtAutogen/Complex/yaf.cpp
+++ b/Tests/QtAutogen/Complex/yaf.cpp
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#include "yaf.h"
#include <stdio.h>
diff --git a/Tests/QtAutogen/Complex/yaf.h b/Tests/QtAutogen/Complex/yaf.h
index f271061..d244328 100644
--- a/Tests/QtAutogen/Complex/yaf.h
+++ b/Tests/QtAutogen/Complex/yaf.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef YAF_H
#define YAF_H
diff --git a/Tests/QtAutogen/Complex/yaf_p.h b/Tests/QtAutogen/Complex/yaf_p.h
index 48fdd30..07b77b6 100644
--- a/Tests/QtAutogen/Complex/yaf_p.h
+++ b/Tests/QtAutogen/Complex/yaf_p.h
@@ -1,5 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
+ file LICENSE.rst or https://cmake.org/licensing for details. */
#ifndef YAF_P_H
#define YAF_P_H
diff --git a/Tests/QtAutogen/MocOnly/IncA.cpp b/Tests/QtAutogen/MocOnly/IncA.cpp
index 94610cd..7c5d3f1 100644
--- a/Tests/QtAutogen/MocOnly/IncA.cpp
+++ b/Tests/QtAutogen/MocOnly/IncA.cpp
@@ -8,7 +8,7 @@ class IncAPrivate : public QObject
{
Q_OBJECT
public:
- IncAPrivate(){};
+ IncAPrivate() {};
};
IncA::IncA()
diff --git a/Tests/QtAutogen/MocOnly/IncB.cpp b/Tests/QtAutogen/MocOnly/IncB.cpp
index bd441a9..6eb62cf 100644
--- a/Tests/QtAutogen/MocOnly/IncB.cpp
+++ b/Tests/QtAutogen/MocOnly/IncB.cpp
@@ -6,7 +6,7 @@ class IncBPrivate : public QObject
{
Q_OBJECT
public:
- IncBPrivate(){};
+ IncBPrivate() {};
};
IncB::IncB()
diff --git a/Tests/QtAutogen/MocSkipSource/qItemC.cpp b/Tests/QtAutogen/MocSkipSource/qItemC.cpp
index 622f282..464b652 100644
--- a/Tests/QtAutogen/MocSkipSource/qItemC.cpp
+++ b/Tests/QtAutogen/MocSkipSource/qItemC.cpp
@@ -4,8 +4,8 @@ class QItemC_Local : public QObject
{
Q_OBJECT
public:
- QItemC_Local(){};
- ~QItemC_Local(){};
+ QItemC_Local() {};
+ ~QItemC_Local() {};
};
void QItemC::go()
diff --git a/Tests/QtAutogen/MocSkipSource/qItemD.cpp b/Tests/QtAutogen/MocSkipSource/qItemD.cpp
index fe0f4e4..ed4e81f 100644
--- a/Tests/QtAutogen/MocSkipSource/qItemD.cpp
+++ b/Tests/QtAutogen/MocSkipSource/qItemD.cpp
@@ -4,8 +4,8 @@ class QItemD_Local : public QObject
{
Q_OBJECT
public:
- QItemD_Local(){};
- ~QItemD_Local(){};
+ QItemD_Local() {};
+ ~QItemD_Local() {};
};
void QItemD::go()
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp
index b5e8753..03ddc25 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp
@@ -1,6 +1,6 @@
#include "StyleA.hpp"
-QStyle* StyleA::create(const QString& key)
+QStyle* StyleA::create(QString const& key)
{
return 0;
}
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp
index 198ae98..11599e2 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp
@@ -12,7 +12,7 @@ class StyleA : public QStylePlugin
Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json")
A_CUSTOM_MACRO(org.styles.A, "StyleA_Custom.json", AnotherArg)
public:
- QStyle* create(const QString& key);
+ QStyle* create(QString const& key);
};
#endif
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp
index 17d4400..51204d3 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp
@@ -1,6 +1,6 @@
#include "StyleB.hpp"
-QStyle* StyleB::create(const QString& key)
+QStyle* StyleB::create(QString const& key)
{
return 0;
}
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp
index 8ce8d77..bd5913b 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp
@@ -12,7 +12,7 @@ class StyleB : public QStylePlugin
Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json")
A_CUSTOM_MACRO(org.styles.B, "jsonIn/StyleB_Custom.json", AnotherArg)
public:
- QStyle* create(const QString& key);
+ QStyle* create(QString const& key);
};
#endif
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp
index 37e7564..48e6fe4 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp
@@ -1,6 +1,6 @@
#include "StyleC.hpp"
-QStyle* StyleC::create(const QString& key)
+QStyle* StyleC::create(QString const& key)
{
return 0;
}
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp
index 53171e3..726c3a1 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp
@@ -12,7 +12,7 @@ class StyleC : public QStylePlugin
Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json")
A_CUSTOM_MACRO(org.styles.C, "StyleC_Custom.json", AnotherArg)
public:
- QStyle* create(const QString& key);
+ QStyle* create(QString const& key);
};
#endif
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp
index 7e4b121..9895f58 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp
@@ -1,6 +1,6 @@
#include "StyleD.hpp"
-QStyle* StyleD::create(const QString& key)
+QStyle* StyleD::create(QString const& key)
{
return 0;
}
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp
index 29674f9..93d2ddf 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp
@@ -12,7 +12,7 @@ class StyleD : public QStylePlugin
Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json")
A_CUSTOM_MACRO(org.styles.D, "sub/StyleD_Custom.json", AnotherArg)
public:
- QStyle* create(const QString& key);
+ QStyle* create(QString const& key);
};
#endif
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp
index 3448319..ab93456 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp
@@ -1,6 +1,6 @@
#include "StyleE.hpp"
-QStyle* StyleE::create(const QString& key)
+QStyle* StyleE::create(QString const& key)
{
return 0;
}
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp
index 7318220..0a2bfec 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp
@@ -12,7 +12,7 @@ class StyleE : public QStylePlugin
Q_PLUGIN_METADATA(IID "org.styles.E" FILE "StyleE.json")
A_CUSTOM_MACRO(org.styles.E, "StyleE_Custom.json", AnotherArg)
public:
- QStyle* create(const QString& key);
+ QStyle* create(QString const& key);
};
#endif
diff --git a/Tests/QtAutogen/SameName/object.h b/Tests/QtAutogen/SameName/object.h
index 8662094..3e81af2 100644
--- a/Tests/QtAutogen/SameName/object.h
+++ b/Tests/QtAutogen/SameName/object.h
@@ -7,7 +7,7 @@ class Object_h : public QObject
{
Q_OBJECT
Q_SLOT
- void go(){};
+ void go() {};
};
#endif
diff --git a/Tests/QtAutogen/SameName/object.hh b/Tests/QtAutogen/SameName/object.hh
index 3e16f83..4db2b5a 100644
--- a/Tests/QtAutogen/SameName/object.hh
+++ b/Tests/QtAutogen/SameName/object.hh
@@ -7,7 +7,7 @@ class Object_hh : public QObject
{
Q_OBJECT
Q_SLOT
- void go(){};
+ void go() {};
};
#endif
diff --git a/Tests/QtAutogen/SameName/object.hpp b/Tests/QtAutogen/SameName/object.hpp
index 035050e..498befd 100644
--- a/Tests/QtAutogen/SameName/object.hpp
+++ b/Tests/QtAutogen/SameName/object.hpp
@@ -7,7 +7,7 @@ class Object_hpp : public QObject
{
Q_OBJECT
Q_SLOT
- void go(){};
+ void go() {};
};
#endif
diff --git a/Tests/QtAutogen/SameName/object.hxx b/Tests/QtAutogen/SameName/object.hxx
index c3c050f..b2a963c 100644
--- a/Tests/QtAutogen/SameName/object.hxx
+++ b/Tests/QtAutogen/SameName/object.hxx
@@ -7,7 +7,7 @@ class Object_hxx : public QObject
{
Q_OBJECT
Q_SLOT
- void go(){};
+ void go() {};
};
#endif
diff --git a/Tests/QtAutogen/SameName/object_upper_ext.H b/Tests/QtAutogen/SameName/object_upper_ext.H
index 3266087..57f0f8a 100644
--- a/Tests/QtAutogen/SameName/object_upper_ext.H
+++ b/Tests/QtAutogen/SameName/object_upper_ext.H
@@ -7,7 +7,7 @@ class Object_Upper_Ext_H : public QObject
{
Q_OBJECT
Q_SLOT
- void go(){};
+ void go() {};
};
#endif
diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake
index 529592e..a2e0fca 100644
--- a/Tests/QtAutogen/TestMacros.cmake
+++ b/Tests/QtAutogen/TestMacros.cmake
@@ -48,7 +48,6 @@ macro(ADD_AUTOGEN_TEST NAME)
--build-project ${NAME}
${Autogen_CTEST_OPTIONS}
--build-exe-dir "${_BuildDir}"
- --force-new-ctest-process
--build-options ${build_options} ${Autogen_BUILD_OPTIONS}
${_TestCommand}
)
diff --git a/Tests/QtAutogen/UicInterface/klocalizedstring.cpp b/Tests/QtAutogen/UicInterface/klocalizedstring.cpp
index b629cd1..3974074 100644
--- a/Tests/QtAutogen/UicInterface/klocalizedstring.cpp
+++ b/Tests/QtAutogen/UicInterface/klocalizedstring.cpp
@@ -1,12 +1,12 @@
#include "klocalizedstring.h"
-QString tr2xi18n(const char* text, const char*)
+QString tr2xi18n(char const* text, char const*)
{
return QLatin1String("TranslatedX") + QString::fromLatin1(text);
}
-QString tr2i18n(const char* text, const char*)
+QString tr2i18n(char const* text, char const*)
{
return QLatin1String("Translated") + QString::fromLatin1(text);
}
diff --git a/Tests/QtAutogen/UicInterface/klocalizedstring.h b/Tests/QtAutogen/UicInterface/klocalizedstring.h
index 6129599..c7d69c1 100644
--- a/Tests/QtAutogen/UicInterface/klocalizedstring.h
+++ b/Tests/QtAutogen/UicInterface/klocalizedstring.h
@@ -7,11 +7,13 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
- QString tr2xi18n(const char* text, const char* comment = 0);
+QString
+tr2xi18n(char const* text, char const* comment = 0);
#ifdef _WIN32
__declspec(dllexport)
#endif
- QString tr2i18n(const char* text, const char* comment = 0);
+QString
+tr2i18n(char const* text, char const* comment = 0);
#endif
diff --git a/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp
index 3091845..faa8c14 100644
--- a/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp
+++ b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp
@@ -4,7 +4,7 @@ class LocalObject : public QObject
{
Q_OBJECT
public:
- LocalObject(){};
+ LocalObject() {};
};
void mocOnly()
diff --git a/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER-check.cmake b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER-check.cmake
new file mode 100644
index 0000000..d485f2b
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER-check.cmake
@@ -0,0 +1,3 @@
+
+set(reference_file "ARCHIVER.txt")
+include ("${CMAKE_CURRENT_LIST_DIR}/ARCHIVER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED-check.cmake b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED-check.cmake
new file mode 100644
index 0000000..35c0baa
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED-check.cmake
@@ -0,0 +1,4 @@
+
+set(reference_file "ARCHIVER_NESTED.txt")
+set(archiver_prefix_expected YES)
+include ("${CMAKE_CURRENT_LIST_DIR}/ARCHIVER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED_SHELL-check.cmake b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED_SHELL-check.cmake
new file mode 100644
index 0000000..d0321f2
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_NESTED_SHELL-check.cmake
@@ -0,0 +1,4 @@
+
+set(reference_file "ARCHIVER_NESTED_SHELL.txt")
+set(archiver_prefix_expected YES)
+include ("${CMAKE_CURRENT_LIST_DIR}/ARCHIVER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_SHELL-check.cmake b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_SHELL-check.cmake
new file mode 100644
index 0000000..d485f2b
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-ARCHIVER_SHELL-check.cmake
@@ -0,0 +1,3 @@
+
+set(reference_file "ARCHIVER.txt")
+include ("${CMAKE_CURRENT_LIST_DIR}/ARCHIVER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-validation.cmake b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-validation.cmake
new file mode 100644
index 0000000..8bb0753
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion-validation.cmake
@@ -0,0 +1,15 @@
+
+if (actual_stdout MATCHES "ARCHIVER:" AND NOT archiver_prefix_expected)
+ set (RunCMake_TEST_FAILED "ARCHIVER: prefix was not expanded.")
+ return()
+endif()
+
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/${reference_file}")
+ set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/${reference_file}: Reference file not found.")
+ return()
+endif()
+file(READ "${RunCMake_TEST_BINARY_DIR}/${reference_file}" archiver_flag)
+
+if (NOT actual_stdout MATCHES "${archiver_flag}")
+ set (RunCMake_TEST_FAILED "ARCHIVER: was not expanded correctly.")
+endif()
diff --git a/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion.cmake b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion.cmake
new file mode 100644
index 0000000..fa3fc9e
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/ARCHIVER_expansion.cmake
@@ -0,0 +1,66 @@
+
+enable_language(C)
+
+set(cfg_dir)
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(_isMultiConfig)
+ set(cfg_dir /Debug)
+endif()
+
+set(DUMP_EXE "${CMAKE_CURRENT_BINARY_DIR}${cfg_dir}/dump${CMAKE_EXECUTABLE_SUFFIX}")
+
+add_executable(dump dump.c)
+
+# Overwrite archive rule to enable command line dump
+set(CMAKE_C_CREATE_STATIC_LIBRARY "\"${DUMP_EXE}\" create_archive <LINK_FLAGS>")
+
+function(add_test_library target_name options)
+ add_library(${target_name} STATIC lib.c)
+ set_property(TARGET ${target_name} PROPERTY STATIC_LIBRARY_OPTIONS "${options}")
+
+ add_dependencies(${target_name} dump)
+endfunction()
+
+# Use ARCHIVER alone
+add_test_library(archiver "ARCHIVER:-foo,bar")
+
+# Use ARCHIVER with SHELL
+add_test_library(archiver_shell "ARCHIVER:SHELL:-foo bar")
+
+# Nested ARCHIVER: prefixes should be preserved as written, only the outermost ARCHIVER: prefix removed
+add_test_library(archiver_nested "ARCHIVER:ARCHIVER:-foo,bar")
+
+# Same with ARCHIVER:SHELL:
+add_test_library(archiver_nested_shell "ARCHIVER:SHELL:ARCHIVER:-foo bar")
+
+# generate reference for ARCHIVER flag
+if (CMAKE_C_ARCHIVER_WRAPPER_FLAG)
+ set(archiver_flag ${CMAKE_C_ARCHIVER_WRAPPER_FLAG})
+ list(GET archiver_flag -1 archiver_space)
+ if (archiver_space STREQUAL " ")
+ list(REMOVE_AT archiver_flag -1)
+ else()
+ set(archiver_space)
+ endif()
+ list (JOIN archiver_flag " " archiver_flag)
+ if (CMAKE_C_ARCHIVER_WRAPPER_FLAG_SEP)
+ set(archiver_sep "${CMAKE_C_ARCHIVER_WRAPPER_FLAG_SEP}")
+
+ set(archiver_flag_nested "${archiver_flag}${archiver_space}ARCHIVER:-foo${archiver_sep}bar")
+ set(archiver_flag_nested_shell "${archiver_flag}${archiver_space}ARCHIVER:-foo${archiver_sep}bar")
+ string (APPEND archiver_flag "${archiver_space}" "-foo${archiver_sep}bar")
+ else()
+ set(archiver_prefix "${archiver_flag}${archiver_space}")
+
+ set(archiver_flag_nested "${archiver_prefix}ARCHIVER:-foo ${archiver_prefix}bar")
+ set(archiver_flag_nested_shell "${archiver_prefix}ARCHIVER:-foo ${archiver_prefix}bar")
+ set (archiver_flag "${archiver_prefix}-foo ${archiver_prefix}bar")
+ endif()
+else()
+ set(archiver_flag_nested "ARCHIVER:-foo bar")
+ set(archiver_flag_nested_shell "ARCHIVER:-foo bar")
+ set(archiver_flag "-foo bar")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ARCHIVER.txt" "${archiver_flag}")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ARCHIVER_NESTED.txt" "${archiver_flag_nested}")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ARCHIVER_NESTED_SHELL.txt" "${archiver_flag_nested_shell}")
diff --git a/Tests/RunCMake/ARCHIVER-prefix/CMakeLists.txt b/Tests/RunCMake/ARCHIVER-prefix/CMakeLists.txt
new file mode 100644
index 0000000..a3382b3
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.31...4.0)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/ARCHIVER-prefix/RunCMakeTest.cmake b/Tests/RunCMake/ARCHIVER-prefix/RunCMakeTest.cmake
new file mode 100644
index 0000000..4f15e1e
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/RunCMakeTest.cmake
@@ -0,0 +1,30 @@
+
+include(RunCMake)
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${VERBOSE})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+run_cmake(bad_SHELL_usage)
+
+if(RunCMake_GENERATOR MATCHES "Ninja|Makefile|Xcode|Visual Studio")
+ # Some environments are excluded because they are not able to honor verbose mode
+ if (RunCMake_GENERATOR MATCHES "Xcode|Visual Studio"
+ AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ set(RunCMake_TEST_EXPECT_RESULT ".*")
+ set(VERBOSE "--verbose")
+ endif()
+
+ run_cmake(ARCHIVER_expansion)
+
+ run_cmake_target(ARCHIVER_expansion ARCHIVER archiver)
+ run_cmake_target(ARCHIVER_expansion ARCHIVER_SHELL archiver_shell)
+ run_cmake_target(ARCHIVER_expansion ARCHIVER_NESTED archiver_nested)
+ run_cmake_target(ARCHIVER_expansion ARCHIVER_NESTED_SHELL archiver_nested_shell)
+endif()
diff --git a/Tests/RunCMake/project/CMP0048-OLD-VERSION-result.txt b/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/project/CMP0048-OLD-VERSION-result.txt
+++ b/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-result.txt
diff --git a/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-stderr.txt
new file mode 100644
index 0000000..f72e3bf
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at bad_SHELL_usage.cmake:4 \(add_library\):
+ 'SHELL:' prefix is not supported as part of 'ARCHIVER:' arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage.cmake b/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage.cmake
new file mode 100644
index 0000000..4ef634e
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/bad_SHELL_usage.cmake
@@ -0,0 +1,5 @@
+
+enable_language(C)
+
+add_library(example STATIC lib.c)
+set_property(TARGET example PROPERTY STATIC_LIBRARY_OPTIONS "ARCHIVER:-foo,SHELL:-bar")
diff --git a/Tests/RunCMake/ARCHIVER-prefix/dump.c b/Tests/RunCMake/ARCHIVER-prefix/dump.c
new file mode 100644
index 0000000..8baa313
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/dump.c
@@ -0,0 +1,13 @@
+
+#include "stdio.h"
+
+int main(int argc, char* argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ printf("%s ", argv[i]);
+ printf("\n");
+
+ return 0;
+}
diff --git a/Tests/RunCMake/ARCHIVER-prefix/lib.c b/Tests/RunCMake/ARCHIVER-prefix/lib.c
new file mode 100644
index 0000000..9bbd24c
--- /dev/null
+++ b/Tests/RunCMake/ARCHIVER-prefix/lib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/AppleSDK/CMakeLists.txt b/Tests/RunCMake/AppleSDK/CMakeLists.txt
new file mode 100644
index 0000000..955802c
--- /dev/null
+++ b/Tests/RunCMake/AppleSDK/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 4.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/AppleSDK/NoSDK-stdout.txt b/Tests/RunCMake/AppleSDK/NoSDK-stdout.txt
new file mode 100644
index 0000000..8628e21
--- /dev/null
+++ b/Tests/RunCMake/AppleSDK/NoSDK-stdout.txt
@@ -0,0 +1,4 @@
+-- CMAKE_C_COMPILER_APPLE_SYSROOT=''
+-- CMAKE_CXX_COMPILER_APPLE_SYSROOT=''
+-- CMAKE_OBJC_COMPILER_APPLE_SYSROOT=''
+-- CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT=''
diff --git a/Tests/RunCMake/AppleSDK/NoSDK.cmake b/Tests/RunCMake/AppleSDK/NoSDK.cmake
new file mode 100644
index 0000000..a6006ea
--- /dev/null
+++ b/Tests/RunCMake/AppleSDK/NoSDK.cmake
@@ -0,0 +1,5 @@
+enable_language(C CXX OBJC OBJCXX)
+message(STATUS "CMAKE_C_COMPILER_APPLE_SYSROOT='${CMAKE_C_COMPILER_APPLE_SYSROOT}'")
+message(STATUS "CMAKE_CXX_COMPILER_APPLE_SYSROOT='${CMAKE_CXX_COMPILER_APPLE_SYSROOT}'")
+message(STATUS "CMAKE_OBJC_COMPILER_APPLE_SYSROOT='${CMAKE_OBJC_COMPILER_APPLE_SYSROOT}'")
+message(STATUS "CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT='${CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT}'")
diff --git a/Tests/RunCMake/AppleSDK/RunCMakeTest.cmake b/Tests/RunCMake/AppleSDK/RunCMakeTest.cmake
new file mode 100644
index 0000000..f85b1a1
--- /dev/null
+++ b/Tests/RunCMake/AppleSDK/RunCMakeTest.cmake
@@ -0,0 +1,47 @@
+include(RunCMake)
+
+# Isolate from caller's environment.
+unset(ENV{CMAKE_OSX_ARCHITECTURES})
+unset(ENV{CMAKE_OSX_DEPLOYMENT_TARGET})
+unset(ENV{SDKROOT})
+
+function(run_xcode_cc)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-xcode")
+ if(EXISTS "/usr/include/AvailabilityMacros.h")
+ run_cmake(SDK)
+ else()
+ run_cmake(NoSDK)
+ endif()
+endfunction()
+
+if(RunCMake_GENERATOR STREQUAL "Xcode")
+ run_xcode_cc()
+else()
+ set(system_cc "/usr/bin/cc")
+ set(system_cxx "/usr/bin/c++")
+ if(EXISTS "${system_cc}" AND EXISTS "${system_cxx}")
+ set(ENV{CC} "${system_cc}")
+ set(ENV{CXX} "${system_cxx}")
+ set(ENV{OBJC} "${system_cc}")
+ set(ENV{OBJCXX} "${system_cxx}")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-system")
+ run_cmake(SDK)
+ endif()
+
+ execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE xcode_cc OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE xcode_cxx OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND xcrun --show-sdk-path OUTPUT_VARIABLE xcode_sdk OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(EXISTS "${xcode_cc}" AND EXISTS "${xcode_cxx}")
+ set(ENV{CC} "${xcode_cc}")
+ set(ENV{CXX} "${xcode_cxx}")
+ set(ENV{OBJC} "${xcode_cc}")
+ set(ENV{OBJCXX} "${xcode_cxx}")
+ run_xcode_cc()
+ if(EXISTS "${xcode_sdk}")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-xcode-SDKROOT")
+ set(ENV{SDKROOT} "${xcode_sdk}")
+ run_cmake(SDK)
+ unset(ENV{SDKROOT})
+ endif()
+ endif()
+endif()
diff --git a/Tests/RunCMake/AppleSDK/SDK-stdout.txt b/Tests/RunCMake/AppleSDK/SDK-stdout.txt
new file mode 100644
index 0000000..e290cce
--- /dev/null
+++ b/Tests/RunCMake/AppleSDK/SDK-stdout.txt
@@ -0,0 +1,4 @@
+-- CMAKE_C_COMPILER_APPLE_SYSROOT='/([^']*/SDKs/MacOSX[0-9.]*\.sdk)?'
+-- CMAKE_CXX_COMPILER_APPLE_SYSROOT='/([^']*/SDKs/MacOSX[0-9.]*\.sdk)?'
+-- CMAKE_OBJC_COMPILER_APPLE_SYSROOT='/([^']*/SDKs/MacOSX[0-9.]*\.sdk)?'
+-- CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT='/([^']*/SDKs/MacOSX[0-9.]*\.sdk)?'
diff --git a/Tests/RunCMake/AppleSDK/SDK.cmake b/Tests/RunCMake/AppleSDK/SDK.cmake
new file mode 100644
index 0000000..a6006ea
--- /dev/null
+++ b/Tests/RunCMake/AppleSDK/SDK.cmake
@@ -0,0 +1,5 @@
+enable_language(C CXX OBJC OBJCXX)
+message(STATUS "CMAKE_C_COMPILER_APPLE_SYSROOT='${CMAKE_C_COMPILER_APPLE_SYSROOT}'")
+message(STATUS "CMAKE_CXX_COMPILER_APPLE_SYSROOT='${CMAKE_CXX_COMPILER_APPLE_SYSROOT}'")
+message(STATUS "CMAKE_OBJC_COMPILER_APPLE_SYSROOT='${CMAKE_OBJC_COMPILER_APPLE_SYSROOT}'")
+message(STATUS "CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT='${CMAKE_OBJCXX_COMPILER_APPLE_SYSROOT}'")
diff --git a/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake b/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake
index 28c175d..5f86f90 100644
--- a/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake
+++ b/Tests/RunCMake/AppleTextStubs/LibraryWithVersions.cmake
@@ -25,9 +25,6 @@ set (GENERATE_CONTENT "if (\"${CMAKE_TAPI}\")
endif()\n\n")
string (APPEND GENERATE_CONTENT [[
-cmake_policy (SET CMP0011 NEW)
-cmake_policy (SET CMP0057 NEW)
-
macro (CHECK_FILE test_msg path)
if (NOT EXISTS "${path}")
string (APPEND RunCMake_TEST_FAILED "${test_msg}: \"${path}\" not found\n")
diff --git a/Tests/RunCMake/AutoExportDll/hello.cxx b/Tests/RunCMake/AutoExportDll/hello.cxx
index 35ccbb7..2dc0c98 100644
--- a/Tests/RunCMake/AutoExportDll/hello.cxx
+++ b/Tests/RunCMake/AutoExportDll/hello.cxx
@@ -10,8 +10,8 @@ void hello()
{
printf("hello");
}
-void Hello::operator delete[](void*){};
-void Hello::operator delete(void*){};
+void Hello::operator delete[](void*) {};
+void Hello::operator delete(void*) {};
#ifdef HELLO_VFTABLE
HelloVFTable::HelloVFTable()
diff --git a/Tests/RunCMake/Autogen_1/AutogenDuplicateDependency.cmake b/Tests/RunCMake/Autogen_1/AutogenDuplicateDependency.cmake
new file mode 100644
index 0000000..f6968d4
--- /dev/null
+++ b/Tests/RunCMake/Autogen_1/AutogenDuplicateDependency.cmake
@@ -0,0 +1,38 @@
+enable_language(CXX)
+
+find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core)
+
+set(CMAKE_AUTOMOC ON)
+
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp"
+ CONTENT "void foo() {}")
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ CONTENT "int main() {return 0;}")
+
+# Test case.
+# App depends on Lib, which means App_autogen depends on Lib_autogen by default.
+# Which means building App_autogen should trigger the generation of the
+# fancy_generated.txt file, which is a dependency of Lib_autogen.
+
+# Create a shared library and an executable.
+add_library(Lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp")
+add_executable(App "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+
+# Link Lib into App more than once. Previously this was not properly handled by AUTOGEN,
+# which discarded the Lib_autogen dependency from App_autogen entirely, and the
+# file was not generated.
+foreach(i RANGE 1 ${LIB_LINK_COUNT})
+ target_link_libraries(App PRIVATE Lib)
+endforeach()
+
+# Add a custom target that generates a file.
+set(generated_file_path "${CMAKE_CURRENT_BINARY_DIR}/fancy_generated.txt")
+add_custom_command(
+ OUTPUT "${generated_file_path}"
+ COMMAND ${CMAKE_COMMAND} -E touch "${generated_file_path}"
+)
+add_custom_target(generate_file DEPENDS "${generated_file_path}")
+
+# Make sure the file is generated as part of building the Lib_autogen target.
+set_target_properties(Lib PROPERTIES
+ AUTOGEN_TARGET_DEPENDS generate_file)
diff --git a/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake
index 2cf60e4..c49f09c 100644
--- a/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake
@@ -131,4 +131,19 @@ if (DEFINED with_qt_version)
endblock()
endif()
endif()
+ block()
+ foreach(LIB_LINK_COUNT RANGE 1 4)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-link-count-${LIB_LINK_COUNT}")
+ set(RunCMake_TEST_BINARY_DIR
+ "${RunCMake_BINARY_DIR}/AutogenDuplicateDependency-build-${LIB_LINK_COUNT}")
+ run_cmake_with_options(AutogenDuplicateDependency ${RunCMake_TEST_OPTIONS} -DLIB_LINK_COUNT=${LIB_LINK_COUNT})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "fancy_generated.txt")
+ run_cmake_command("AutogenDuplicateDependency-build"
+ ${CMAKE_COMMAND} --build . --target App_autogen --verbose)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ unset(RunCMake_TEST_EXPECT_stdout)
+ unset(RunCMake_TEST_NO_CLEAN)
+ endforeach()
+ endblock()
endif ()
diff --git a/Tests/RunCMake/Autogen_common/exe_common.h b/Tests/RunCMake/Autogen_common/exe_common.h
index 15311c6..78115ed 100644
--- a/Tests/RunCMake/Autogen_common/exe_common.h
+++ b/Tests/RunCMake/Autogen_common/exe_common.h
@@ -6,7 +6,7 @@
#include <string>
#include <vector>
-inline int runRealExe(const int argc, char** argv)
+inline int runRealExe(int const argc, char** argv)
{
std::vector<std::string> args;
std::string realMocPath;
diff --git a/Tests/RunCMake/Autogen_common/utils.cmake b/Tests/RunCMake/Autogen_common/utils.cmake
index 0692ca5..2093f36 100644
--- a/Tests/RunCMake/Autogen_common/utils.cmake
+++ b/Tests/RunCMake/Autogen_common/utils.cmake
@@ -24,7 +24,7 @@ ${make_program_stderr}
"top ${RunCMake_MAKE_PROGRAM} build failed exited with status ${make_program_result}")
endif()
set(make_program_stdout "${make_program_stdout}" PARENT_SCOPE)
-endfunction(run_make_program)
+endfunction()
function(count_substring STRING SUBSTRING COUNT_VAR)
string(LENGTH "${STRING}" STRING_LENGTH)
@@ -210,12 +210,12 @@ function(autogen_executable_test exe)
block()
if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}")
- set(not_expect_descripton "Auto${exe}")
+ set(not_expect_description "Auto${exe}")
else ()
set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}")
- set(not_expect_descripton "Auto${exe}")
+ set(not_expect_description "Auto${exe}")
endif()
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-second-build-${config}_expect_no_${not_expect_descripton}")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-second-build-${config}_expect_no_${not_expect_description}")
run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config})
endblock()
endforeach()
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
index c3725a4..331d21d 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
@@ -77,5 +77,14 @@ if(check_step EQUAL 3)
\"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:subexe>\"
\"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:sublib>\"
)
+
+ if (RunCMake_GENERATOR MATCHES \"Make\")
+ file(STRINGS \"${CMAKE_BINARY_DIR}/CMakeFiles/topcc.dir/compiler_depend.internal\" deps REGEX \"^.*topccdep\\\\.txt$\")
+ list(LENGTH deps count)
+ if (NOT count EQUAL 1)
+ string(APPEND RunCMake_TEST_FAILED \"dependencies are duplicated\\n\")
+ set(RunCMake_TEST_FAILED \"\${RunCMake_TEST_FAILED}\" PARENT_SCOPE)
+ endif()
+ endif()
endif()
")
diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt b/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt b/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt
deleted file mode 100644
index 782e45c..0000000
--- a/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
- Target "bat" links to item " bar " which has leading or trailing
- whitespace. This is now an error according to policy CMP0004.
diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake b/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake
deleted file mode 100644
index 32c1474..0000000
--- a/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-cmake_policy(SET CMP0004 OLD)
-
-add_library(foo SHARED empty.cpp)
-add_library(bar SHARED empty.cpp)
-add_library(bing SHARED empty.cpp)
-add_library(bung SHARED empty.cpp)
-
-cmake_policy(SET CMP0004 NEW)
-
-add_library(bat SHARED empty.cpp)
-
-target_link_libraries(foo "$<1: bar >")
-target_link_libraries(bing "$<$<NOT:$<TARGET_POLICY:CMP0004>>: bar >")
-target_link_libraries(bung "$<$<TARGET_POLICY:CMP0004>: bar >")
-
-# The line below causes the error because the policy is NEW when bat
-# is created.
-target_link_libraries(bat "$<1: bar >")
diff --git a/Tests/RunCMake/CMP0004/RunCMakeTest.cmake b/Tests/RunCMake/CMP0004/RunCMakeTest.cmake
index 950d0ed..8e3079c 100644
--- a/Tests/RunCMake/CMP0004/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0004/RunCMakeTest.cmake
@@ -1,5 +1,4 @@
include(RunCMake)
-run_cmake(CMP0004-OLD)
run_cmake(CMP0004-NEW)
run_cmake(CMP0004-policy-genex)
diff --git a/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake b/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake
index 3091e66..a419f30 100644
--- a/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake
+++ b/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0019 NEW)
include(CMP0019-code.cmake)
diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt
deleted file mode 100644
index dc03414..0000000
--- a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0019-OLD\.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0019 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/CMP0019/CMP0019-OLD.cmake b/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake
deleted file mode 100644
index 0f02f9c..0000000
--- a/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0019 OLD)
-include(CMP0019-code.cmake)
diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt
deleted file mode 100644
index 6eee437..0000000
--- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-^CMake Warning \(dev\) in CMakeLists\.txt:
- Policy CMP0019 is not set: Do not re-expand variables in include and link
- information. Run "cmake --help-policy CMP0019" for policy details. Use
- the cmake_policy command to set the policy and suppress this warning.
-
- The following variable evaluations were encountered:
-
- Evaluated directory INCLUDE_DIRECTORIES
-
- /usr/include/\${VAR_INCLUDE};/usr/include/normal
-
- as
-
- /usr/include/VAL_INCLUDE;/usr/include/normal
-
- Evaluated target some_target INCLUDE_DIRECTORIES
-
- /usr/include/\${VAR_INCLUDE};/usr/include/normal
-
- as
-
- /usr/include/VAL_INCLUDE;/usr/include/normal
-
- Evaluated link directories
-
- /usr/lib/\${VAR_LINK_DIRS};/usr/lib/normal
-
- as
-
- /usr/lib/VAL_LINK_DIRS;/usr/lib/normal
-
- Evaluated link library
-
- \${VAR_LINK_LIBS}
-
- as
-
- VAL_LINK_LIBS
-
-This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake b/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake
deleted file mode 100644
index a419f30..0000000
--- a/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include(CMP0019-code.cmake)
diff --git a/Tests/RunCMake/CMP0019/CMakeLists.txt b/Tests/RunCMake/CMP0019/CMakeLists.txt
index 8f85fbf..bf2ef15 100644
--- a/Tests/RunCMake/CMP0019/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0019/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.4)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake
index fcd080f..a6b4527 100644
--- a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0019-WARN)
-run_cmake(CMP0019-OLD)
run_cmake(CMP0019-NEW)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake
deleted file mode 100644
index b0268c8..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-enable_language(CXX)
-
-add_library(testLib empty_vs6_1.cpp)
-add_executable(testExe empty_vs6_2.cpp)
-target_link_libraries(testExe testLib)
-
-export(TARGETS testExe FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NOWARN-exe.cmake")
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake
index 2e76ee0..57c3ed0 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake
@@ -1,7 +1,5 @@
enable_language(CXX)
-cmake_policy(SET CMP0042 NEW)
-
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
target_link_libraries(bar foo)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake
index 3fee15d..8ad1687 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake
@@ -1,7 +1,5 @@
-project(CMP0022-NOWARN-static-NEW)
-
-cmake_policy(SET CMP0022 NEW)
+enable_language(CXX)
add_library(foo STATIC empty_vs6_1.cpp)
add_library(bar STATIC empty_vs6_2.cpp)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
index 3e4144f..17f71b0 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
@@ -1,5 +1,5 @@
-project(CMP0022-NOWARN-static)
+enable_language(CXX)
add_library(foo STATIC empty_vs6_1.cpp)
add_library(bar STATIC empty_vs6_2.cpp)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt
deleted file mode 100644
index c84a289..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-^CMake Warning \(dev\) in CMakeLists\.txt:
- Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
- interface. Run "cmake --help-policy CMP0022" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be
- preferred as the source of the link interface for this library but because
- CMP0022 is not set CMake is ignoring the property and using the link
- implementation as the link interface instead.
-
- INTERFACE_LINK_LIBRARIES:
-
- foo
-
- Link implementation:
-
- \(empty\)
-
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake
deleted file mode 100644
index c5d3c29..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-
-project(CMP0022-WARN-empty-old)
-
-add_library(foo SHARED empty_vs6_1.cpp)
-add_library(bar SHARED empty_vs6_2.cpp)
-
-set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
-
-add_library(user empty.cpp)
-target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt
deleted file mode 100644
index 1370c5e..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
- interface. Run "cmake --help-policy CMP0022" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be
- preferred as the source of the link interface for this library but because
- CMP0022 is not set CMake is ignoring the property and using the link
- implementation as the link interface instead.
-
- INTERFACE_LINK_LIBRARIES:
-
- foo
-
- Link implementation:
-
- bat
-
-This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake
deleted file mode 100644
index b3cb131..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-
-project(CMP0022-WARN)
-
-add_library(foo STATIC empty_vs6_1.cpp)
-add_library(bar STATIC empty_vs6_2.cpp)
-add_library(bat STATIC empty_vs6_3.cpp)
-set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
-set_property(TARGET bar PROPERTY LINK_LIBRARIES bat)
-
-add_library(user empty.cpp)
-target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt
deleted file mode 100644
index 39a9511..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-^CMake Warning \(dev\) in CMakeLists\.txt:
- Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
- interface. Run "cmake --help-policy CMP0022" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from
- its LINK_INTERFACE_LIBRARIES properties.
-
- INTERFACE_LINK_LIBRARIES:
-
- foo
-
- LINK_INTERFACE_LIBRARIES:
-
- bat
-
-This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
deleted file mode 100644
index 5d39214..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
- interface. Run "cmake --help-policy CMP0022" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from
- its LINK_INTERFACE_LIBRARIES(_DEBUG)? properties.
-
- INTERFACE_LINK_LIBRARIES:
-
- foo
-
- LINK_INTERFACE_LIBRARIES(_DEBUG)?:
-
- bat
-
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
deleted file mode 100644
index 03223e8..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-
-project(CMP0022-WARN-tll)
-
-add_library(foo SHARED empty_vs6_1.cpp)
-add_library(bar SHARED empty_vs6_2.cpp)
-add_library(bat SHARED empty_vs6_3.cpp)
-target_link_libraries(bar LINK_PUBLIC foo)
-# Replace the compatibility values set by target_link_libraries
-set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
-set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES_DEBUG bat)
-
-add_library(user SHARED empty.cpp)
-target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
deleted file mode 100644
index e3552b2..0000000
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-
-project(CMP0022-WARN)
-
-cmake_policy(SET CMP0042 NEW)
-
-add_library(foo SHARED empty_vs6_1.cpp)
-add_library(bar SHARED empty_vs6_2.cpp)
-add_library(bat SHARED empty_vs6_3.cpp)
-set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
-set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
-
-add_library(user empty.cpp)
-target_link_libraries(user bar)
-
-# Use "bar" again with a different "head" target to check
-# that the warning does not appear again.
-add_library(user2 empty_vs6_3.cpp)
-target_link_libraries(user2 bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake b/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake
index d832fac..70dc6fa 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake
@@ -1,7 +1,5 @@
enable_language(CXX)
-cmake_policy(SET CMP0022 NEW)
-
add_library(testLib empty_vs6_1.cpp)
add_executable(testExe empty_vs6_2.cpp)
target_link_libraries(testExe testLib)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-export.cmake
index 06147f3..5a61a89 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-export.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-export.cmake
@@ -1,7 +1,5 @@
-project(cmp0022NEW)
-
-cmake_policy(SET CMP0022 NEW)
+enable_language(CXX)
add_library(cmp0022NEW SHARED empty_vs6_1.cpp)
add_library(testLib SHARED empty_vs6_2.cpp)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake
index 171febe..f9eca04 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake
@@ -1,7 +1,5 @@
-project(cmp0022NEW)
-
-cmake_policy(SET CMP0022 NEW)
+enable_language(CXX)
add_library(cmp0022NEW SHARED empty_vs6_1.cpp)
add_library(testLib SHARED empty_vs6_2.cpp)
diff --git a/Tests/RunCMake/CMP0022/CMakeLists.txt b/Tests/RunCMake/CMP0022/CMakeLists.txt
index 72abfc8..bf2ef15 100644
--- a/Tests/RunCMake/CMP0022/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0022/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.11)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake
index ea956fc..4af82d0 100644
--- a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake
@@ -1,11 +1,5 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0022-WARN)
-run_cmake(CMP0022-WARN-tll)
-run_cmake(CMP0022-WARN-static)
-run_cmake(CMP0022-WARN-empty-old)
-run_cmake(CMP0022-NOWARN-exe)
run_cmake(CMP0022-NOWARN-shared)
run_cmake(CMP0022-NOWARN-static)
run_cmake(CMP0022-NOWARN-static-NEW)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt
deleted file mode 100644
index 84dec32..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0026-CONFIG-LOCATION-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0026 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/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake
deleted file mode 100644
index 4166828..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-enable_language(CXX)
-
-cmake_policy(SET CMP0026 OLD)
-
-add_library(somelib empty.cpp)
-get_target_property(_loc somelib Debug_LOCATION)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt
deleted file mode 100644
index d2209fd..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0026-CONFIG-LOCATION-WARN.cmake:5 \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "somelib". Use the
- target name directly with add_custom_command, or use the generator
- expression \$<TARGET_FILE>, as appropriate.
-
-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/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake
deleted file mode 100644
index 511056f..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-enable_language(CXX)
-
-add_library(somelib empty.cpp)
-get_target_property(_loc somelib Debug_LOCATION)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt
deleted file mode 100644
index 1fb4ef6..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0026-LOCATION-CONFIG-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0026 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/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake
deleted file mode 100644
index 482373d..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-enable_language(CXX)
-
-cmake_policy(SET CMP0026 OLD)
-
-add_library(somelib empty.cpp)
-get_target_property(_loc somelib LOCATION_Debug)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt
deleted file mode 100644
index 8b4faf0..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0026-LOCATION-CONFIG-WARN.cmake:5 \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "somelib". Use the
- target name directly with add_custom_command, or use the generator
- expression \$<TARGET_FILE>, as appropriate.
-
-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/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake
deleted file mode 100644
index 85711c3..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-enable_language(CXX)
-
-add_library(somelib empty.cpp)
-get_target_property(_loc somelib LOCATION_Debug)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt
deleted file mode 100644
index b4282f5..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0026-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0026 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/CMP0026/CMP0026-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake
deleted file mode 100644
index 80497a3..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-enable_language(CXX)
-
-cmake_policy(SET CMP0026 OLD)
-
-set(out ${CMAKE_CURRENT_BINARY_DIR}/out.txt)
-
-add_library(somelib empty.cpp ${out})
-get_target_property(_loc somelib LOCATION)
-
-file(WRITE "${out}"
- "source file written by project code after getting target LOCATION\n"
- )
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt
deleted file mode 100644
index 17a7db0..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_library(otherlib ../empty.cpp)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
deleted file mode 100644
index 0d39596..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "somelib". Use the
- target name directly with add_custom_command, or use the generator
- expression \$<TARGET_FILE>, as appropriate.
-
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "otherlib". Use the
- target name directly with add_custom_command, or use the generator
- expression \$<TARGET_FILE>, as appropriate.
-
-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/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
deleted file mode 100644
index bfc9203..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-
-enable_language(CXX)
-
-add_library(somelib empty.cpp)
-get_target_property(_loc somelib LOCATION)
-
-add_subdirectory(CMP0026-WARN-Dir)
-get_target_property(_loc otherlib LOCATION)
diff --git a/Tests/RunCMake/CMP0026/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMakeLists.txt
index 4b3de84..bf2ef15 100644
--- a/Tests/RunCMake/CMP0026/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0026/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt
deleted file mode 100644
index 6377921..0000000
--- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at LOCATION-and-TARGET_OBJECTS.cmake:[0-9]+ \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "bar". Use the target
- name directly with add_custom_command, or use the generator expression
- \$<TARGET_FILE>, as appropriate.
-
-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/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake
deleted file mode 100644
index ee5ed5b..0000000
--- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake_policy(SET CMP0118 NEW)
-enable_language(CXX)
-
-add_library(foo OBJECT empty.cpp)
-add_executable(bar $<TARGET_OBJECTS:foo>)
-get_target_property(location bar LOCATION)
diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt
deleted file mode 100644
index 360d987..0000000
--- a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at ObjlibNotDefined.cmake:[0-9]+ \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "objlibuser". Use the
- target name directly with add_custom_command, or use the generator
- expression \$<TARGET_FILE>, as appropriate.
-
-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/CMP0026/ObjlibNotDefined.cmake b/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake
deleted file mode 100644
index 194760c..0000000
--- a/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-
-enable_language(CXX)
-
-add_executable(objlibuser
- empty.cpp
- $<TARGET_OBJECTS:bar>
-)
-
-get_target_property(_location objlibuser LOCATION)
-
-add_library(bar OBJECT
- empty.cpp
-)
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
index 6476176..7684eb6 100644
--- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -1,16 +1,6 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0026-WARN)
-run_cmake(CMP0026-OLD)
run_cmake(CMP0026-NEW)
run_cmake(CMP0026-IMPORTED)
run_cmake(CMP0026-CONFIG-LOCATION-NEW)
-run_cmake(CMP0026-CONFIG-LOCATION-OLD)
-run_cmake(CMP0026-CONFIG-LOCATION-WARN)
run_cmake(CMP0026-LOCATION-CONFIG-NEW)
-run_cmake(CMP0026-LOCATION-CONFIG-OLD)
-run_cmake(CMP0026-LOCATION-CONFIG-WARN)
-run_cmake(ObjlibNotDefined)
-run_cmake(LOCATION-and-TARGET_OBJECTS)
-run_cmake(clear-cached-information)
diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt
deleted file mode 100644
index c51e883..0000000
--- a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-
-add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/main.c)
diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt
deleted file mode 100644
index 3525704..0000000
--- a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at clear-cached-information.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0026 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/CMP0026/clear-cached-information.cmake b/Tests/RunCMake/CMP0026/clear-cached-information.cmake
deleted file mode 100644
index 9916948..0000000
--- a/Tests/RunCMake/CMP0026/clear-cached-information.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-cmake_policy(SET CMP0118 NEW)
-enable_language(C)
-
-cmake_policy(SET CMP0026 OLD)
-
-add_subdirectory(clear-cached-information-dir)
-
-# Critical: this needs to happen in root CMakeLists.txt and not inside
-# the subdir.
-get_target_property(mypath Hello LOCATION)
-# Now we create the file later, so you can see, ultimately no error should
-# happen e.g. during generate phase:
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c)
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE)
diff --git a/Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt b/Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt
deleted file mode 100644
index 4c2b300..0000000
--- a/Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Imported target "testTarget" includes non-existent path
-
- "/does/not/exist"
-
- in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
-
- \* The path was deleted, renamed, or moved to another location.
-
- \* An install or uninstall procedure did not complete successfully.
-
- \* The installation package was faulty and references files it does not
- provide.
diff --git a/Tests/RunCMake/CMP0027/CMP0027-OLD.cmake b/Tests/RunCMake/CMP0027/CMP0027-OLD.cmake
deleted file mode 100644
index 404217d..0000000
--- a/Tests/RunCMake/CMP0027/CMP0027-OLD.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-
-enable_language(CXX)
-
-cmake_policy(SET CMP0027 OLD)
-
-add_library(testTarget UNKNOWN IMPORTED)
-set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/does/not/exist")
-
-add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
-target_link_libraries(userTarget PRIVATE $<1:testTarget>)
diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt
deleted file mode 100644
index 9bcec3c..0000000
--- a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0027 is not set: Conditionally linked imported targets with
- missing include directories. Run "cmake --help-policy CMP0027" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Imported target "testTarget" includes non-existent path
-
- "/does/not/exist"
-
- in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
-
- \* The path was deleted, renamed, or moved to another location.
-
- \* An install or uninstall procedure did not complete successfully.
-
- \* The installation package was faulty and references files it does not
- provide.
diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN.cmake b/Tests/RunCMake/CMP0027/CMP0027-WARN.cmake
deleted file mode 100644
index 8e5f9b5..0000000
--- a/Tests/RunCMake/CMP0027/CMP0027-WARN.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-
-enable_language(CXX)
-
-add_library(testTarget UNKNOWN IMPORTED)
-set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/does/not/exist")
-
-add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
-target_link_libraries(userTarget PRIVATE $<1:testTarget>)
diff --git a/Tests/RunCMake/CMP0027/CMakeLists.txt b/Tests/RunCMake/CMP0027/CMakeLists.txt
index 4b3de84..bf2ef15 100644
--- a/Tests/RunCMake/CMP0027/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0027/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0027/RunCMakeTest.cmake b/Tests/RunCMake/CMP0027/RunCMakeTest.cmake
index 1017f01..98460d8 100644
--- a/Tests/RunCMake/CMP0027/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0027/RunCMakeTest.cmake
@@ -1,5 +1,3 @@
include(RunCMake)
run_cmake(CMP0027-NEW)
-run_cmake(CMP0027-OLD)
-run_cmake(CMP0027-WARN)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
index ec2315f..7f5458c 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
@@ -1,18 +1,18 @@
-CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\):
+CMake Error at CMP0037-NEW-colon.cmake:[0-9]+ \(add_library\):
The target name "lib:colon" is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\):
+CMake Error at CMP0037-NEW-colon.cmake:[0-9]+ \(add_executable\):
The target name "exe:colon" is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at CMP0037-NEW-colon.cmake:6 \(add_custom_target\):
+CMake Error at CMP0037-NEW-colon.cmake:[0-9]+ \(add_custom_target\):
The target name "custom:colon" is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
index fd56e75..13724ee 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
@@ -1,5 +1,4 @@
enable_language(CXX)
-cmake_policy(SET CMP0037 NEW)
add_library("lib:colon" empty.cpp)
add_executable("exe:colon" empty.cpp)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt
index 5789e38..945786e 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt
@@ -1,17 +1,17 @@
-CMake Error at CMP0037-NEW-reserved.cmake:4 \(add_library\):
+CMake Error at CMP0037-NEW-reserved.cmake:[0-9]+ \(add_library\):
The target name "all" is reserved or not valid for certain CMake features,
such as generator expressions, and may result in undefined behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at CMP0037-NEW-reserved.cmake:5 \(add_executable\):
+CMake Error at CMP0037-NEW-reserved.cmake:[0-9]+ \(add_executable\):
The target name "clean" is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at CMP0037-NEW-reserved.cmake:6 \(add_custom_target\):
+CMake Error at CMP0037-NEW-reserved.cmake:[0-9]+ \(add_custom_target\):
The target name "help" is reserved or not valid for certain CMake features,
such as generator expressions, and may result in undefined behavior.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake
index 83a7119..a56c7f8 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake
@@ -1,5 +1,4 @@
enable_language(CXX)
-cmake_policy(SET CMP0037 NEW)
add_library(all empty.cpp)
add_executable(clean empty.cpp)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
index e14cec0..61abe5b 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
@@ -1,18 +1,18 @@
-CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\):
+CMake Error at CMP0037-NEW-space.cmake:[0-9]+ \(add_library\):
The target name "lib with spaces" is reserved or not valid for certain
CMake features, such as generator expressions, and may result in undefined
behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\):
+CMake Error at CMP0037-NEW-space.cmake:[0-9]+ \(add_executable\):
The target name "exe with spaces" is reserved or not valid for certain
CMake features, such as generator expressions, and may result in undefined
behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at CMP0037-NEW-space.cmake:6 \(add_custom_target\):
+CMake Error at CMP0037-NEW-space.cmake:[0-9]+ \(add_custom_target\):
The target name "custom with spaces" is reserved or not valid for certain
CMake features, such as generator expressions, and may result in undefined
behavior.
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
index 2a288cc..e4819f3 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
@@ -1,5 +1,4 @@
enable_language(CXX)
-cmake_policy(SET CMP0037 NEW)
add_library("lib with spaces" empty.cpp)
add_executable("exe with spaces" empty.cpp)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt
deleted file mode 100644
index de09351..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0037-OLD-reserved.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0037 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake
deleted file mode 100644
index f52e4d2..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-enable_language(CXX)
-cmake_policy(SET CMP0037 OLD)
-
-add_library(all empty.cpp)
-add_executable(clean empty.cpp)
-add_custom_target(help)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt
deleted file mode 100644
index 4d13e59..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0037-OLD-space.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0037 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake
deleted file mode 100644
index c9fb6c8..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-enable_language(CXX)
-cmake_policy(SET CMP0037 OLD)
-
-add_library("lib with spaces" empty.cpp)
-add_executable("exe with spaces" empty.cpp)
-add_custom_target("custom with spaces")
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt
deleted file mode 100644
index d3b0e17..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:2 \(add_library\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "lib:colon" is reserved or not valid for certain CMake
- features, such as generator expressions, and may result in undefined
- behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:3 \(add_executable\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "exe:colon" is reserved or not valid for certain CMake
- features, such as generator expressions, and may result in undefined
- behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:4 \(add_custom_target\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "custom:colon" is reserved or not valid for certain CMake
- features, such as generator expressions, and may result in undefined
- behavior.
-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/CMP0037/CMP0037-WARN-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake
deleted file mode 100644
index 1b1a405..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-enable_language(CXX)
-add_library("lib:colon" empty.cpp)
-add_executable("exe:colon" empty.cpp)
-add_custom_target("custom:colon")
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt
deleted file mode 100644
index 2d556a7..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:2 \(add_library\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "all" is reserved or not valid for certain CMake features,
- such as generator expressions, and may result in undefined behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:3 \(add_executable\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "clean" is reserved or not valid for certain CMake
- features, such as generator expressions, and may result in undefined
- behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:4 \(add_custom_target\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "help" is reserved or not valid for certain CMake features,
- such as generator expressions, and may result in undefined behavior.
-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/CMP0037/CMP0037-WARN-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake
deleted file mode 100644
index a5e0f10..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-enable_language(CXX)
-add_library(all empty.cpp)
-add_executable(clean empty.cpp)
-add_custom_target(help)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt
deleted file mode 100644
index e39477a..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-CMake Warning \(dev\) at CMP0037-WARN-space.cmake:2 \(add_library\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "lib with spaces" is reserved or not valid for certain
- CMake features, such as generator expressions, and may result in undefined
- behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0037-WARN-space.cmake:3 \(add_executable\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "exe with spaces" is reserved or not valid for certain
- CMake features, such as generator expressions, and may result in undefined
- behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0037-WARN-space.cmake:4 \(add_custom_target\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "custom with spaces" is reserved or not valid for certain
- CMake features, such as generator expressions, and may result in undefined
- behavior.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake
deleted file mode 100644
index e01b8e5..0000000
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-enable_language(CXX)
-add_library("lib with spaces" empty.cpp)
-add_executable("exe with spaces" empty.cpp)
-add_custom_target("custom with spaces")
diff --git a/Tests/RunCMake/CMP0037/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt
index 4b3de84..bf2ef15 100644
--- a/Tests/RunCMake/CMP0037/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0037/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt
index 270fa6d..8f408bf 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt
+++ b/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at NEW-cond-package.cmake:4 \(add_custom_target\):
+^CMake Error at NEW-cond-package.cmake:[0-9]+ \(add_custom_target\):
The target name "package" is reserved when CPack packaging is enabled.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package.cmake b/Tests/RunCMake/CMP0037/NEW-cond-package.cmake
index ceea907..93ae7a5 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond-package.cmake
+++ b/Tests/RunCMake/CMP0037/NEW-cond-package.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0037 NEW)
file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
add_custom_target(test)
add_custom_target(package)
diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt
index 2d32147..85a678e 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt
+++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at NEW-cond-package_source.cmake:5 \(add_custom_target\):
+^CMake Error at NEW-cond-package_source.cmake:[0-9]+ \(add_custom_target\):
The target name "package_source" is reserved when CPack source packaging is
enabled.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake b/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake
index 3f8883b..8345707 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake
+++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0037 NEW)
file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
add_custom_target(test)
add_custom_target(package)
diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt
index 44b4741..c7cbdf4 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt
+++ b/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at NEW-cond-test.cmake:3 \(add_custom_target\):
+^CMake Error at NEW-cond-test.cmake:[0-9]+ \(add_custom_target\):
The target name "test" is reserved when CTest testing is enabled.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test.cmake b/Tests/RunCMake/CMP0037/NEW-cond-test.cmake
index 7eeaffc..dba3215 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond-test.cmake
+++ b/Tests/RunCMake/CMP0037/NEW-cond-test.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0037 NEW)
enable_testing()
add_custom_target(test)
add_custom_target(package)
diff --git a/Tests/RunCMake/CMP0037/NEW-cond.cmake b/Tests/RunCMake/CMP0037/NEW-cond.cmake
index d0dc77af..0bfdbe1 100644
--- a/Tests/RunCMake/CMP0037/NEW-cond.cmake
+++ b/Tests/RunCMake/CMP0037/NEW-cond.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0037 NEW)
add_custom_target(test)
add_custom_target(package)
add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt
deleted file mode 100644
index 5a29a49..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at OLD-cond-package.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0037 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package.cmake b/Tests/RunCMake/CMP0037/OLD-cond-package.cmake
deleted file mode 100644
index 7a0afbe..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-package.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt
deleted file mode 100644
index 5f72e16..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at OLD-cond-package_source.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0037 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake b/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake
deleted file mode 100644
index 95616b6..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt
deleted file mode 100644
index 94e4575..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at OLD-cond.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0037 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt
deleted file mode 100644
index 81e10ce..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at OLD-cond-test.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0037 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0037/OLD-cond-test.cmake b/Tests/RunCMake/CMP0037/OLD-cond-test.cmake
deleted file mode 100644
index bfa32a9..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond-test.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-enable_testing()
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/OLD-cond.cmake b/Tests/RunCMake/CMP0037/OLD-cond.cmake
deleted file mode 100644
index abad680..0000000
--- a/Tests/RunCMake/CMP0037/OLD-cond.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
index 89beb59..d6efdb2 100644
--- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
@@ -1,56 +1,16 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-if(RunCMake_GENERATOR MATCHES "^Ninja")
- # Detect ninja version so we know what tests can be supported.
- execute_process(
- COMMAND "${RunCMake_MAKE_PROGRAM}" --version
- OUTPUT_VARIABLE ninja_out
- ERROR_VARIABLE ninja_out
- RESULT_VARIABLE ninja_res
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+")
- set(ninja_version "${ninja_out}")
- message(STATUS "ninja version: ${ninja_version}")
- else()
- message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
- endif()
-else()
- set(ninja_version "")
-endif()
-
-run_cmake(CMP0037-OLD-space)
run_cmake(CMP0037-NEW-space)
-run_cmake(CMP0037-WARN-space)
run_cmake(CMP0037-NEW-colon)
-if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make"))
- run_cmake(CMP0037-WARN-colon)
-endif()
-
-if(NOT ninja_version VERSION_GREATER_EQUAL 1.10)
- run_cmake(CMP0037-WARN-reserved)
- run_cmake(CMP0037-OLD-reserved)
-endif()
run_cmake(CMP0037-NEW-reserved)
run_cmake(NEW-cond)
run_cmake(NEW-cond-test)
run_cmake(NEW-cond-package)
-run_cmake(OLD-cond)
-run_cmake(OLD-cond-test)
-run_cmake(OLD-cond-package)
-run_cmake(WARN-cond)
-run_cmake(WARN-cond-test)
-run_cmake(WARN-cond-package)
run_cmake(alias-test-NEW)
-run_cmake(alias-test-OLD)
-run_cmake(alias-test-WARN)
if(RunCMake_GENERATOR MATCHES "Make|Ninja")
run_cmake(NEW-cond-package_source)
- run_cmake(OLD-cond-package_source)
- run_cmake(WARN-cond-package_source)
endif()
diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt
deleted file mode 100644
index 5960e51..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-^CMake Warning \(dev\) at WARN-cond-package.cmake:4 \(add_custom_target\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "package" is reserved when CPack packaging is enabled. It
- may result in undefined behavior.
-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/CMP0037/WARN-cond-package.cmake b/Tests/RunCMake/CMP0037/WARN-cond-package.cmake
deleted file mode 100644
index 61cdc68..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond-package.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt
deleted file mode 100644
index ae72909..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-^CMake Warning \(dev\) at WARN-cond-package_source.cmake:5 \(add_custom_target\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "package_source" is reserved when CPack source packaging is
- enabled. It may result in undefined behavior.
-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/CMP0037/WARN-cond-package_source.cmake b/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake
deleted file mode 100644
index 468380c..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt
deleted file mode 100644
index e7a3ee5..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-^CMake Warning \(dev\) at WARN-cond-test.cmake:3 \(add_custom_target\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern. Run "cmake --help-policy CMP0037" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- The target name "test" is reserved when CTest testing is enabled. It may
- result in undefined behavior.
-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/CMP0037/WARN-cond-test.cmake b/Tests/RunCMake/CMP0037/WARN-cond-test.cmake
deleted file mode 100644
index 982af36..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond-test.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-enable_testing()
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/WARN-cond.cmake b/Tests/RunCMake/CMP0037/WARN-cond.cmake
deleted file mode 100644
index 04a7f9d..0000000
--- a/Tests/RunCMake/CMP0037/WARN-cond.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)
diff --git a/Tests/RunCMake/CMP0037/alias-test-NEW.cmake b/Tests/RunCMake/CMP0037/alias-test-NEW.cmake
index 32569b5..bb880a3 100644
--- a/Tests/RunCMake/CMP0037/alias-test-NEW.cmake
+++ b/Tests/RunCMake/CMP0037/alias-test-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0037 NEW)
include(alias-test-common.cmake)
diff --git a/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt
deleted file mode 100644
index bf177e2..0000000
--- a/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at alias-test-OLD\.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0037 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/CMP0037/alias-test-OLD.cmake b/Tests/RunCMake/CMP0037/alias-test-OLD.cmake
deleted file mode 100644
index 1f3e770..0000000
--- a/Tests/RunCMake/CMP0037/alias-test-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-include(alias-test-common.cmake)
diff --git a/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt
deleted file mode 100644
index 43bf98b..0000000
--- a/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-^CMake Warning \(dev\) at alias-test-common\.cmake:[0-9]+ \(add_library\):
- Policy CMP0037 is not set: Target names should not be reserved and should
- match a validity pattern\. Run "cmake --help-policy CMP0037" for policy
- details\. Use the cmake_policy command to set the policy and suppress this
- warning\.
-
- The target name "test" is reserved when CTest testing is enabled\. It may
- result in undefined behavior\.
-Call Stack \(most recent call first\):
- alias-test-WARN\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0037/alias-test-WARN.cmake b/Tests/RunCMake/CMP0037/alias-test-WARN.cmake
deleted file mode 100644
index 688cb95..0000000
--- a/Tests/RunCMake/CMP0037/alias-test-WARN.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-# leave CMP0037 unset
-include(alias-test-common.cmake)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt
index 3d0a428..9685758 100644
--- a/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0038-NEW.cmake:3 \(add_library\):
+CMake Error at CMP0038-NEW.cmake:1 \(add_library\):
Target "self_link" links to itself.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake
index 6296b83..0e3df1d 100644
--- a/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake
+++ b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake
@@ -1,4 +1,2 @@
-
-cmake_policy(SET CMP0038 NEW)
add_library(self_link empty.cpp)
target_link_libraries(self_link self_link)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt
deleted file mode 100644
index c754128..0000000
--- a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0038-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0038 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake
deleted file mode 100644
index 3752821..0000000
--- a/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-cmake_policy(SET CMP0038 OLD)
-add_library(self_link empty.cpp)
-target_link_libraries(self_link self_link)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt
deleted file mode 100644
index 64631e7..0000000
--- a/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Warning \(dev\) at CMP0038-WARN.cmake:2 \(add_library\):
- Policy CMP0038 is not set: Targets may not link directly to themselves.
- Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- Target "self_link" links to itself.
-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/CMP0038/CMP0038-WARN.cmake b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake
deleted file mode 100644
index 5b92d09..0000000
--- a/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-
-add_library(self_link empty.cpp)
-target_link_libraries(self_link self_link)
diff --git a/Tests/RunCMake/CMP0038/CMakeLists.txt b/Tests/RunCMake/CMP0038/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0038/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0038/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0038/RunCMakeTest.cmake b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake
index 3e7b5f3..06f8808 100644
--- a/Tests/RunCMake/CMP0038/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0038-WARN)
run_cmake(CMP0038-NEW)
-run_cmake(CMP0038-OLD)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt
index 3d9d225..d294b2f 100644
--- a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt
@@ -1,5 +1,5 @@
-CMake Error at CMP0039-NEW.cmake:7 \(target_link_libraries\):
+CMake Error at CMP0039-NEW\.cmake:[0-9]+ \(target_link_libraries\):
Utility target "utility" must not be used as the target of a
- target_link_libraries call.
+ target_link_libraries call\.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake
index 2032d64..6f3a7d3 100644
--- a/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake
+++ b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake
@@ -1,6 +1,3 @@
-
-cmake_policy(SET CMP0039 NEW)
-
add_custom_target(utility
COMMAND ${CMAKE_COMMAND} -E echo test
)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt
deleted file mode 100644
index d7863fd..0000000
--- a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0039-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0039 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake
deleted file mode 100644
index 9a513f4..0000000
--- a/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-cmake_policy(SET CMP0039 OLD)
-
-add_custom_target(utility
- COMMAND ${CMAKE_COMMAND} -E echo test
-)
-target_link_libraries(utility m)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt
deleted file mode 100644
index a8e6c70..0000000
--- a/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CMake Warning \(dev\) at CMP0039-WARN.cmake:5 \(target_link_libraries\):
- Policy CMP0039 is not set: Utility targets may not have link dependencies.
- Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- Utility target "utility" should not be used as the target of a
- target_link_libraries call.
-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/CMP0039/CMP0039-WARN.cmake b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake
deleted file mode 100644
index 6249993..0000000
--- a/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-add_custom_target(utility
- COMMAND ${CMAKE_COMMAND} -E echo test
-)
-target_link_libraries(utility m)
diff --git a/Tests/RunCMake/CMP0039/CMakeLists.txt b/Tests/RunCMake/CMP0039/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0039/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0039/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0039/RunCMakeTest.cmake b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake
index ce7541a..abfd4d2 100644
--- a/Tests/RunCMake/CMP0039/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0039-WARN)
run_cmake(CMP0039-NEW)
-run_cmake(CMP0039-OLD)
diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake
index 880b178..f0af023 100644
--- a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake
+++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0040 NEW)
-
add_library(foobar empty.cpp)
add_custom_command(TARGET foobar PRE_BUILD
diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt
index 4a1077c..d577dc1 100644
--- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt
+++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\):
- No TARGET 'foobar' has been created in this directory.
+^CMake Error at CMP0040-NEW-missing-target.cmake:[0-9]+ \(add_custom_command\):
+ No TARGET 'foobar' has been created in this directory\.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists\.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake
index a9f764c..e3fdbb2 100644
--- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake
+++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0040 NEW)
-
add_custom_command(TARGET foobar PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E hello world
)
diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt
deleted file mode 100644
index f38c03d..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0040-OLD-existing-target.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0040 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake
deleted file mode 100644
index 7a9e91e..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_policy(SET CMP0040 OLD)
-
-add_library(foobar empty.cpp)
-
-add_custom_command(TARGET foobar PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo hello world
-)
diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt
deleted file mode 100644
index 61f4f03..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0040-OLD-missing-target.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0040 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake
deleted file mode 100644
index 0f5cd15..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0040 OLD)
-
-add_custom_command(TARGET foobar PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo hello world
-)
diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt
deleted file mode 100644
index 70ed05b..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_command\):
- Policy CMP0040 is not set: The target in the TARGET signature of
- add_custom_command\(\) must exist and must be defined in the current
- directory. Run "cmake --help-policy CMP0040" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-+
- No TARGET 'foobar' has been created in this directory.
-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/CMP0040/CMP0040-WARN-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake
deleted file mode 100644
index 4efeaae..0000000
--- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-add_custom_command(TARGET foobar PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E hello world
-)
diff --git a/Tests/RunCMake/CMP0040/CMakeLists.txt b/Tests/RunCMake/CMP0040/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0040/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0040/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0040/RunCMakeTest.cmake b/Tests/RunCMake/CMP0040/RunCMakeTest.cmake
index e5e6c37..b6fd899 100644
--- a/Tests/RunCMake/CMP0040/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0040/RunCMakeTest.cmake
@@ -1,9 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0040-OLD-missing-target)
run_cmake(CMP0040-NEW-missing-target)
-run_cmake(CMP0040-WARN-missing-target)
-
-run_cmake(CMP0040-OLD-existing-target)
run_cmake(CMP0040-NEW-existing-target)
diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt
deleted file mode 100644
index 1b736da..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0041-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0041 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake b/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake
deleted file mode 100644
index 16cbced..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-
-cmake_policy(SET CMP0041 OLD)
-
-add_library(foo empty.cpp)
-set_property(TARGET foo
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES
- include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME>
-)
-install(TARGETS foo EXPORT FooExport DESTINATION lib)
-install(EXPORT FooExport DESTINATION lib/cmake)
diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt b/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt
deleted file mode 100644
index a7d303e..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-CMake Warning in CMakeLists.txt:
- Policy CMP0041 is not set: Error on relative include with generator
- expression. Run "cmake --help-policy CMP0041" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains relative path:
-
- "include/\$<TARGET_PROPERTY:NAME>"
-
-
-CMake Warning in CMakeLists.txt:
- Policy CMP0041 is not set: Error on relative include with generator
- expression. Run "cmake --help-policy CMP0041" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path:
-
- ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>"
-
- which is prefixed in the source directory.
-
-
-CMake Warning in CMakeLists.txt:
- Policy CMP0041 is not set: Error on relative include with generator
- expression. Run "cmake --help-policy CMP0041" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path:
-
- ".*/Tests/RunCMake/CMP0041/CMP0041-WARN-build/include/\$<TARGET_PROPERTY:NAME>"
-
- which is prefixed in the build directory.
diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake b/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake
deleted file mode 100644
index 873cbc7..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-
-add_library(foo empty.cpp)
-set_property(TARGET foo
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES
- include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME>
-)
-install(TARGETS foo EXPORT FooExport DESTINATION lib)
-install(EXPORT FooExport DESTINATION lib/cmake)
diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt
deleted file mode 100644
index dbc5167..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0041-tid-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0041 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake
deleted file mode 100644
index b5c4e7f..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-
-cmake_policy(SET CMP0041 OLD)
-
-add_library(foo empty.cpp)
-target_include_directories(foo INTERFACE
- include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME>
-)
-install(TARGETS foo EXPORT FooExport DESTINATION lib)
-install(EXPORT FooExport DESTINATION lib/cmake)
diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt
deleted file mode 100644
index aae2c7a..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-CMake Warning in CMakeLists.txt:
- Policy CMP0041 is not set: Error on relative include with generator
- expression. Run "cmake --help-policy CMP0041" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path:
-
- ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>"
-
- which is prefixed in the source directory.
-
-
-CMake Warning in CMakeLists.txt:
- Policy CMP0041 is not set: Error on relative include with generator
- expression. Run "cmake --help-policy CMP0041" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path:
-
- ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>"
-
- which is prefixed in the source directory.
-
-
-CMake Warning in CMakeLists.txt:
- Policy CMP0041 is not set: Error on relative include with generator
- expression. Run "cmake --help-policy CMP0041" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path:
-
- ".*/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-build/include/\$<TARGET_PROPERTY:NAME>"
-
- which is prefixed in the build directory.
diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake
deleted file mode 100644
index ee4c2a6..0000000
--- a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-add_library(foo empty.cpp)
-target_include_directories(foo INTERFACE
- include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME>
- ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME>
-)
-install(TARGETS foo EXPORT FooExport DESTINATION lib)
-install(EXPORT FooExport DESTINATION lib/cmake)
diff --git a/Tests/RunCMake/CMP0041/CMakeLists.txt b/Tests/RunCMake/CMP0041/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0041/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0041/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake
index 93378c2..0c99cda 100644
--- a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake
@@ -1,16 +1,11 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
# Protect tests from running inside the default install prefix.
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
-run_cmake(CMP0041-OLD)
run_cmake(CMP0041-NEW)
-run_cmake(CMP0041-WARN)
# Protect tests from running inside the default install prefix.
set(RunCMake_TEST_OPTIONS "--install-prefix ${RunCMake_BINARY_DIR}/NotDefaultPrefix")
-run_cmake(CMP0041-tid-OLD)
run_cmake(CMP0041-tid-NEW)
-run_cmake(CMP0041-tid-WARN)
diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake
index 778a444..424cf83 100644
--- a/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake
+++ b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake
@@ -1,4 +1 @@
-
-cmake_policy(SET CMP0042 NEW)
-
add_library(foo SHARED empty.cpp)
diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt
deleted file mode 100644
index 9d1488d..0000000
--- a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0042-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0042 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake
deleted file mode 100644
index 1aede96..0000000
--- a/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-cmake_policy(SET CMP0042 OLD)
-
-add_library(foo SHARED empty.cpp)
diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt
deleted file mode 100644
index f3574a1..0000000
--- a/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CMake Warning \(dev\):
- Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
- --help-policy CMP0042" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- MACOSX_RPATH is not specified for the following targets:
-
- foo
-
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake
deleted file mode 100644
index 3fa32b1..0000000
--- a/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-add_library(foo SHARED empty.cpp)
-add_library(foo-static STATIC empty.cpp)
-add_library(foo2 SHARED empty.cpp)
-set_target_properties(foo2 PROPERTIES MACOSX_RPATH 1)
-add_library(foo3 SHARED empty.cpp)
-set_target_properties(foo3 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@loader_path")
-add_library(foo4 SHARED empty.cpp)
-set_target_properties(foo4 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")
diff --git a/Tests/RunCMake/CMP0042/CMakeLists.txt b/Tests/RunCMake/CMP0042/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0042/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0042/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0042/RunCMakeTest.cmake b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake
index 6b23145..79ee5d1 100644
--- a/Tests/RunCMake/CMP0042/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0042-OLD)
run_cmake(CMP0042-NEW)
-run_cmake(CMP0042-WARN)
diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt b/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake b/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake
deleted file mode 100644
index 857153d..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-cmake_policy(SET CMP0043 NEW)
-
-add_library(foo empty.cpp)
-set_property(TARGET foo
- PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE"
-)
diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt
deleted file mode 100644
index ebbb361..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0043-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0043 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake b/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake
deleted file mode 100644
index f379430..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-cmake_policy(SET CMP0043 OLD)
-
-add_library(foo empty.cpp)
-set_property(TARGET foo
- PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE"
-)
diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt b/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt
deleted file mode 100644
index 4769a63..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties.
- Run "cmake --help-policy CMP0043" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake b/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake
deleted file mode 100644
index 161a60d..0000000
--- a/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-add_library(foo empty.cpp)
-set_property(TARGET foo
- PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE"
-)
diff --git a/Tests/RunCMake/CMP0043/CMakeLists.txt b/Tests/RunCMake/CMP0043/CMakeLists.txt
deleted file mode 100644
index cc8a6f8..0000000
--- a/Tests/RunCMake/CMP0043/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-project(${RunCMake_TEST} CXX)
-include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir
-
-if(CMAKE_BUILD_TYPE)
- # Dummy variable use
-endif()
diff --git a/Tests/RunCMake/CMP0043/RunCMakeTest.cmake b/Tests/RunCMake/CMP0043/RunCMakeTest.cmake
deleted file mode 100644
index b940528..0000000
--- a/Tests/RunCMake/CMP0043/RunCMakeTest.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-
-list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
-
-run_cmake(CMP0043-OLD)
-run_cmake(CMP0043-NEW)
-run_cmake(CMP0043-WARN)
diff --git a/Tests/RunCMake/CMP0043/empty.cpp b/Tests/RunCMake/CMP0043/empty.cpp
deleted file mode 100644
index 11ec041..0000000
--- a/Tests/RunCMake/CMP0043/empty.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
- int empty()
-{
- return 0;
-}
diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt
index 805a85e..0b27f60 100644
--- a/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0045-NEW.cmake:4 \(get_target_property\):
+CMake Error at CMP0045-NEW.cmake:[0-9]+ \(get_target_property\):
get_target_property\(\) called with non-existent target "tgt".
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake b/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake
index 7b2a3cd..ee1c19f 100644
--- a/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake
+++ b/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake
@@ -1,4 +1 @@
-
-cmake_policy(SET CMP0045 NEW)
-
get_target_property(result tgt TYPE)
diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt
deleted file mode 100644
index 0dac20f..0000000
--- a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0045-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0045 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake b/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake
deleted file mode 100644
index 90201a3..0000000
--- a/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-cmake_policy(SET CMP0045 OLD)
-
-get_target_property(result tgt TYPE)
diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt b/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt
deleted file mode 100644
index 4c53224..0000000
--- a/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Warning \(dev\) at CMP0045-WARN.cmake:2 \(get_target_property\):
- Policy CMP0045 is not set: Error on non-existent target in
- get_target_property. Run "cmake --help-policy CMP0045" for policy details.
- Use the cmake_policy command to set the policy and suppress this warning.
-
- get_target_property\(\) called with non-existent target "tgt".
-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/CMP0045/CMP0045-WARN.cmake b/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake
deleted file mode 100644
index 86a99a0..0000000
--- a/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-
-get_target_property(result tgt TYPE)
diff --git a/Tests/RunCMake/CMP0045/CMakeLists.txt b/Tests/RunCMake/CMP0045/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0045/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0045/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0045/RunCMakeTest.cmake b/Tests/RunCMake/CMP0045/RunCMakeTest.cmake
index 009d455..ad92464 100644
--- a/Tests/RunCMake/CMP0045/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0045/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0045-OLD)
run_cmake(CMP0045-NEW)
-run_cmake(CMP0045-WARN)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-Duplicate-result.txt b/Tests/RunCMake/CMP0046/CMP0046-Duplicate-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-Duplicate-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0046/CMP0046-Duplicate-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-Duplicate-stderr.txt
deleted file mode 100644
index fb31d6d..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-Duplicate-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CMake Warning \(dev\) at CMP0046-Duplicate.cmake:5 \(add_dependencies\):
- Policy CMP0046 is not set: Error on non-existent dependency in
- add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
- Use the cmake_policy command to set the policy and suppress this warning.
-
- The dependency target "ctgt_no_exist" of target "dummy" does not exist.
-Call Stack \(most recent call first\):
- CMP0046-Duplicate.cmake:8 \(add_dep\)
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0046/CMP0046-Duplicate.cmake b/Tests/RunCMake/CMP0046/CMP0046-Duplicate.cmake
deleted file mode 100644
index 26e640b..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-Duplicate.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-add_library(dummy empty.cpp)
-
-macro(add_dep)
- add_dependencies(dummy ctgt_no_exist)
-endmacro()
-
-add_dep()
-add_dep()
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake
index 0be290a..245d023 100644
--- a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0046 NEW)
-
add_custom_target(foo)
add_custom_target(bar)
add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt
index 381647f..09f08d7 100644
--- a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0046-NEW-missing-dependency.cmake:4 \(add_dependencies\):
+CMake Error at CMP0046-NEW-missing-dependency.cmake:[0-9]+ \(add_dependencies\):
The dependency target "bar" of target "foo" does not exist.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake
index 9bb6b90..896fa40 100644
--- a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake
@@ -1,4 +1,2 @@
-cmake_policy(SET CMP0046 NEW)
-
add_custom_target(foo)
add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt
deleted file mode 100644
index 4444118..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0046-OLD-existing-dependency.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0046 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake
deleted file mode 100644
index b22ab4f..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0046 OLD)
-
-add_custom_target(foo)
-add_custom_target(bar)
-add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt
deleted file mode 100644
index 525954f..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0046-OLD-missing-dependency.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0046 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake
deleted file mode 100644
index 5ee3cb7..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_policy(SET CMP0046 OLD)
-
-add_custom_target(foo)
-add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt
deleted file mode 100644
index fed36f1..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Warning \(dev\) at CMP0046-WARN-missing-dependency.cmake:2 \(add_dependencies\):
- Policy CMP0046 is not set: Error on non-existent dependency in
- add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
- Use the cmake_policy command to set the policy and suppress this warning.
-+
- The dependency target "bar" of target "foo" does not exist.
-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/CMP0046/CMP0046-WARN-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake
deleted file mode 100644
index 896fa40..0000000
--- a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-add_custom_target(foo)
-add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMakeLists.txt b/Tests/RunCMake/CMP0046/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0046/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0046/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0046/RunCMakeTest.cmake b/Tests/RunCMake/CMP0046/RunCMakeTest.cmake
index 86b749a..f4e22e3 100644
--- a/Tests/RunCMake/CMP0046/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0046/RunCMakeTest.cmake
@@ -1,10 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0046-OLD-missing-dependency)
run_cmake(CMP0046-NEW-missing-dependency)
-run_cmake(CMP0046-WARN-missing-dependency)
-
-run_cmake(CMP0046-OLD-existing-dependency)
run_cmake(CMP0046-NEW-existing-dependency)
-run_cmake(CMP0046-Duplicate)
diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt
index ff787e8..b22cc4e 100644
--- a/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt
@@ -1,6 +1,9 @@
-CMake Error at CMP0049-NEW.cmake:5 \(add_library\):
- Legacy variable expansion in source file "\${tgt_srcs}" expanded to
- "empty.cpp" in target "tgt". This behavior will be removed in a future
- version of CMake.
-Call Stack \(most recent call first\):
+CMake Error at CMP0049-NEW.cmake:[0-9]+ \(add_library\):
+ Cannot find source file:
+
+ \${tgt_srcs}
+
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake b/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake
index 85b5aa8..ce4cded 100644
--- a/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake
+++ b/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake
@@ -1,5 +1,2 @@
-
-cmake_policy(SET CMP0049 NEW)
-
set(tgt_srcs empty.cpp)
add_library(tgt \${tgt_srcs})
diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt
deleted file mode 100644
index b373970..0000000
--- a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0049-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0049 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake b/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake
deleted file mode 100644
index ae6fd3b..0000000
--- a/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-cmake_policy(SET CMP0049 OLD)
-
-set(tgt_srcs empty.cpp)
-add_library(tgt \${tgt_srcs})
diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt b/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt
deleted file mode 100644
index 0cf5ce3..0000000
--- a/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-CMake Warning \(dev\) at CMP0049-WARN.cmake:3 \(add_library\):
- Policy CMP0049 is not set: Do not expand variables in target source
- entries. Run "cmake --help-policy CMP0049" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Legacy variable expansion in source file "\${tgt_srcs}" expanded to
- "empty.cpp" in target "tgt". This behavior will be removed in a future
- version of CMake.
-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/CMP0049/CMP0049-WARN.cmake b/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake
deleted file mode 100644
index ada082e..0000000
--- a/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-
-set(tgt_srcs empty.cpp)
-add_library(tgt \${tgt_srcs})
diff --git a/Tests/RunCMake/CMP0049/CMakeLists.txt b/Tests/RunCMake/CMP0049/CMakeLists.txt
index a06591c..c814f14 100644
--- a/Tests/RunCMake/CMP0049/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0049/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0049/RunCMakeTest.cmake b/Tests/RunCMake/CMP0049/RunCMakeTest.cmake
index e71f31e..70b2b44 100644
--- a/Tests/RunCMake/CMP0049/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0049/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0049-OLD)
run_cmake(CMP0049-NEW)
-run_cmake(CMP0049-WARN)
diff --git a/Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt
deleted file mode 100644
index e913b3f..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0050-NEW.cmake:5 \(add_custom_command\):
- The SOURCE signatures of add_custom_command are no longer supported.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0050/CMP0050-NEW.cmake b/Tests/RunCMake/CMP0050/CMP0050-NEW.cmake
deleted file mode 100644
index cdc65b8..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-NEW.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-
-cmake_policy(SET CMP0050 NEW)
-
-add_library(empty empty.cpp)
-add_custom_command(
- TARGET empty
- SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/input.h
- OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h
- DEPENDS ${CMAKE_COMMAND}
-)
diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt
deleted file mode 100644
index 3e7fa97..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0050-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0050 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD.cmake b/Tests/RunCMake/CMP0050/CMP0050-OLD.cmake
deleted file mode 100644
index efb37e5..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-OLD.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-
-cmake_policy(SET CMP0050 OLD)
-
-add_library(empty empty.cpp)
-add_custom_command(
- TARGET empty
- SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/input.h
- OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h
- DEPENDS ${CMAKE_COMMAND}
-)
diff --git a/Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt b/Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt
deleted file mode 100644
index c88d595..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Warning \(dev\) at CMP0050-WARN.cmake:3 \(add_custom_command\):
- Policy CMP0050 is not set: Disallow add_custom_command SOURCE signatures.
- Run "cmake --help-policy CMP0050" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The SOURCE signatures of add_custom_command are no longer supported.
-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/CMP0050/CMP0050-WARN.cmake b/Tests/RunCMake/CMP0050/CMP0050-WARN.cmake
deleted file mode 100644
index e57230e..0000000
--- a/Tests/RunCMake/CMP0050/CMP0050-WARN.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-
-add_library(empty empty.cpp)
-add_custom_command(
- TARGET empty
- SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/input.h
- OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h
- DEPENDS ${CMAKE_COMMAND}
-)
diff --git a/Tests/RunCMake/CMP0050/CMakeLists.txt b/Tests/RunCMake/CMP0050/CMakeLists.txt
deleted file mode 100644
index a06591c..0000000
--- a/Tests/RunCMake/CMP0050/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-project(${RunCMake_TEST} CXX)
-include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0050/RunCMakeTest.cmake b/Tests/RunCMake/CMP0050/RunCMakeTest.cmake
deleted file mode 100644
index 526a9aa..0000000
--- a/Tests/RunCMake/CMP0050/RunCMakeTest.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-
-run_cmake(CMP0050-OLD)
-run_cmake(CMP0050-NEW)
-run_cmake(CMP0050-WARN)
diff --git a/Tests/RunCMake/CMP0050/empty.cpp b/Tests/RunCMake/CMP0050/empty.cpp
deleted file mode 100644
index bf7d5c9..0000000
--- a/Tests/RunCMake/CMP0050/empty.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#include "input.h"
-
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
- int empty()
-{
- return 0;
-}
diff --git a/Tests/RunCMake/CMP0050/input.h.in b/Tests/RunCMake/CMP0050/input.h.in
deleted file mode 100644
index d8c5d26..0000000
--- a/Tests/RunCMake/CMP0050/input.h.in
+++ /dev/null
@@ -1,2 +0,0 @@
-
-#define INPUT
diff --git a/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake b/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake
index f304bf1..144c982 100644
--- a/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake
+++ b/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake
@@ -1,6 +1,3 @@
-
-cmake_policy(SET CMP0051 NEW)
-
add_library(objects OBJECT empty.cpp)
add_library(empty empty.cpp $<TARGET_OBJECTS:objects>)
diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt
deleted file mode 100644
index e1c44e5..0000000
--- a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Deprecation Warning at CMP0051-OLD.cmake:2 \(cmake_policy\):
- The OLD behavior for policy CMP0051 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\)
-+
-Sources: "empty.cpp"$
diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD.cmake b/Tests/RunCMake/CMP0051/CMP0051-OLD.cmake
deleted file mode 100644
index 0243e94..0000000
--- a/Tests/RunCMake/CMP0051/CMP0051-OLD.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-
-cmake_policy(SET CMP0051 OLD)
-
-add_library(objects OBJECT empty.cpp)
-
-add_library(empty empty.cpp $<TARGET_OBJECTS:objects>)
-
-get_target_property(srcs empty SOURCES)
-
-message("Sources: \"${srcs}\"")
diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt
deleted file mode 100644
index 77cbad5..0000000
--- a/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_library(empty2 ../empty.cpp $<TARGET_OBJECTS:objects>)
diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt
deleted file mode 100644
index 78c6b6d..0000000
--- a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-CMake Warning \(dev\) at CMP0051-WARN.cmake:6 \(get_target_property\):
- Policy CMP0051 is not set: List TARGET_OBJECTS in SOURCES target property.
- Run "cmake --help-policy CMP0051" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- Target "empty" contains \$<TARGET_OBJECTS> generator expression in its
- sources list. This content was not previously part of the SOURCES property
- when that property was read at configure time. Code reading that property
- needs to be adapted to ignore the generator expression using the
- string\(GENEX_STRIP\) command.
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-Sources: "empty.cpp"
-*
-CMake Warning \(dev\) at CMP0051-WARN.cmake:12 \(get_target_property\):
- Policy CMP0051 is not set: List TARGET_OBJECTS in SOURCES target property.
- Run "cmake --help-policy CMP0051" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- Target "empty2" contains \$<TARGET_OBJECTS> generator expression in its
- sources list. This content was not previously part of the SOURCES property
- when that property was read at configure time. Code reading that property
- needs to be adapted to ignore the generator expression using the
- string\(GENEX_STRIP\) command.
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-Sources: "../empty.cpp"$
diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake
deleted file mode 100644
index 744598f..0000000
--- a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-
-add_library(objects OBJECT empty.cpp)
-
-add_library(empty empty.cpp $<TARGET_OBJECTS:objects>)
-
-get_target_property(srcs empty SOURCES)
-
-message("Sources: \"${srcs}\"")
-
-add_subdirectory(CMP0051-WARN-Dir)
-
-get_target_property(srcs empty2 SOURCES)
-
-message("Sources: \"${srcs}\"")
diff --git a/Tests/RunCMake/CMP0051/CMakeLists.txt b/Tests/RunCMake/CMP0051/CMakeLists.txt
index 3482e6b..c814f14 100644
--- a/Tests/RunCMake/CMP0051/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0051/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0051/RunCMakeTest.cmake b/Tests/RunCMake/CMP0051/RunCMakeTest.cmake
index 955d898..74015c3 100644
--- a/Tests/RunCMake/CMP0051/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0051/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0051-OLD)
run_cmake(CMP0051-NEW)
-run_cmake(CMP0051-WARN)
diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt
deleted file mode 100644
index 2a0ddbaa..0000000
--- a/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-^CMake Deprecation Warning at CMP0053-OLD.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0053 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:3 \(include\)
-+
-called
---><--$
diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake b/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake
deleted file mode 100644
index 41f5347..0000000
--- a/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-cmake_policy(SET CMP0053 OLD)
-
-function (watch_callback)
- message("called")
-endfunction ()
-
-variable_watch(test watch_callback)
-message("-->${test}<--")
diff --git a/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt
deleted file mode 100644
index 836b0ff..0000000
--- a/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^called
---><--$
diff --git a/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake b/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake
deleted file mode 100644
index b010d13..0000000
--- a/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-function (watch_callback)
- message("called")
-endfunction ()
-
-variable_watch(test watch_callback)
-message("-->${test}<--")
diff --git a/Tests/RunCMake/CMP0053/CMakeLists.txt b/Tests/RunCMake/CMP0053/CMakeLists.txt
index 3482e6b..c814f14 100644
--- a/Tests/RunCMake/CMP0053/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0053/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0053/RunCMakeTest.cmake b/Tests/RunCMake/CMP0053/RunCMakeTest.cmake
index de58c25..6880ea0 100644
--- a/Tests/RunCMake/CMP0053/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0053/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0053-OLD)
run_cmake(CMP0053-NEW)
-run_cmake(CMP0053-WARN)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
deleted file mode 100644
index f5a8fbe..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
index 23a9124..bbe2ea4 100644
--- a/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
+++ b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0054 NEW)
-
set(FOO "BAR")
set(BAZ "ZZZ")
set(MYTRUE ON)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
deleted file mode 100644
index 0500280..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0054-OLD.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
deleted file mode 100644
index 0c4cede..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-cmake_policy(SET CMP0054 OLD)
-
-set(FOO "BAR")
-set(BAZ "ZZZ")
-set(MYTRUE ON)
-set(MYNUMBER 3)
-set(MYVERSION 3.0)
-
-function(assert_unquoted PREFIX FIRST)
- string(REPLACE ";" " " ARGN_SP "${ARGN}")
- if(${PREFIX} ${FIRST} ${ARGN})
- message(FATAL_ERROR "Assertion failed [${PREFIX} ${FIRST} ${ARGN_SP}]")
- endif()
-endfunction()
-
-function(assert_quoted PREFIX FIRST)
- string(REPLACE ";" " " ARGN_SP "${ARGN}")
- if(${PREFIX} "${FIRST}" ${ARGN})
- message(FATAL_ERROR "Assertion failed [${PREFIX} \"${FIRST}\" ${ARGN_SP}]")
- endif()
-endfunction()
-
-function(assert FIRST)
- assert_unquoted(NOT ${FIRST} ${ARGN})
- assert_quoted(NOT ${FIRST} ${ARGN})
-endfunction()
-
-assert(MYTRUE)
-
-assert(FOO MATCHES "^BAR$")
-
-assert(MYNUMBER LESS 4)
-assert(MYNUMBER GREATER 2)
-assert(MYNUMBER EQUAL 3)
-
-assert(FOO STRLESS CCC)
-assert(BAZ STRGREATER CCC)
-assert(FOO STREQUAL BAR)
-
-assert_unquoted(NOT MYVERSION VERSION_LESS 3.1)
-assert_unquoted("" MYVERSION VERSION_LESS 2.9)
-
-assert_quoted("" MYVERSION VERSION_LESS 2.9)
-assert_quoted(NOT MYVERSION VERSION_LESS 3.1)
-
-assert(MYVERSION VERSION_GREATER 2.9)
-assert(MYVERSION VERSION_EQUAL 3.0)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
deleted file mode 100644
index 3cfa5d2..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-CMake Warning \(dev\) at CMP0054-WARN.cmake:3 \(if\):
- Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
- keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Quoted variables like "FOO" will no longer be dereferenced when the policy
- is set to NEW. Since the policy is not set the OLD behavior will be used.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0054-WARN.cmake:5 \(elseif\):
- Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
- keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Quoted variables like "FOO" will no longer be dereferenced when the policy
- is set to NEW. Since the policy is not set the OLD behavior will be used.
-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/CMP0054/CMP0054-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
deleted file mode 100644
index a608929..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-set(FOO "BAR")
-
-if(NOT "FOO" STREQUAL "BAR")
- message(FATAL_ERROR "The given literals should match")
-elseif("FOO" STREQUAL "BING")
- message(FATAL_ERROR "The given literals should not match")
-endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt
deleted file mode 100644
index 485db52..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-CMake Warning \(dev\) at CMP0054-duplicate-warnings.cmake:4 \(if\):
- Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
- keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Quoted variables like "FOO" will no longer be dereferenced when the policy
- is set to NEW. Since the policy is not set the OLD behavior will be used.
-Call Stack \(most recent call first\):
- CMP0054-duplicate-warnings.cmake:8 \(generate_warning\)
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at CMP0054-duplicate-warnings.cmake:11 \(if\):
- Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
- keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Quoted variables like "FOO" will no longer be dereferenced when the policy
- is set to NEW. Since the policy is not set the OLD behavior will be used.
-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/CMP0054/CMP0054-duplicate-warnings.cmake b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake
deleted file mode 100644
index 04fbe14..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-set(FOO "BAR")
-
-function(generate_warning)
- if("FOO" STREQUAL "BAR")
- endif()
-endfunction()
-
-generate_warning()
-generate_warning()
-
-if("FOO" STREQUAL "BAR")
-endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt
index f444684..429803e 100644
--- a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0054-keywords-NEW.cmake:23 \(if\):
+CMake Error at CMP0054-keywords-NEW.cmake:21 \(if\):
if given arguments:
"NOT" "1"
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake
index b957658..445b5ea 100644
--- a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0054 NEW)
-
function(assert KEYWORD)
if("${KEYWORD}" STREQUAL "${KEYWORD}")
else()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt
deleted file mode 100644
index 60303cd..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0054-keywords-OLD.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake
deleted file mode 100644
index a2a7f51..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_policy(SET CMP0054 OLD)
-
-if(NOT 1)
- message(FATAL_ERROR "[NOT 1] evaluated true")
-endif()
-
-if("NOT" 1)
- message(FATAL_ERROR "[\"NOT\" 1] evaluated true")
-endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt
deleted file mode 100644
index 5a8c263..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-CMake Warning \(dev\) at CMP0054-keywords-WARN.cmake:1 \(if\):
- Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
- keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Quoted keywords like "NOT" will no longer be interpreted as keywords when
- the policy is set to NEW. Since the policy is not set the OLD behavior
- will be used.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0054-keywords-WARN.cmake:3 \(elseif\):
- Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
- keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
- details. Use the cmake_policy command to set the policy and suppress this
- warning.
-
- Quoted keywords like "DEFINED" will no longer be interpreted as keywords
- when the policy is set to NEW. Since the policy is not set the OLD
- behavior will be used.
-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/CMP0054/CMP0054-keywords-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake
deleted file mode 100644
index 118ab3d..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-if("NOT" 1)
- message(FATAL_ERROR "[\"NOT\" 1] evaluated true")
-elseif("DEFINED" NotDefined)
- message(FATAL_ERROR "[\"DEFINED\" NotDefined] evaluated true")
-endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt
deleted file mode 100644
index 1b35472..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0054-policy-command-scope.cmake:25 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake
deleted file mode 100644
index b6b243c..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-set(FOO BAR)
-
-cmake_policy(SET CMP0054 NEW)
-
-function(function_defined_new_called_old)
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-endfunction()
-
-macro(macro_defined_new_called_old)
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-endmacro()
-
-cmake_policy(SET CMP0054 OLD)
-
-function_defined_new_called_old()
-macro_defined_new_called_old()
-
-function(function_defined_old_called_new)
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-endfunction()
-
-macro(macro_defined_old_called_new)
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-endmacro()
-
-cmake_policy(SET CMP0054 NEW)
-
-function_defined_old_called_new()
-macro_defined_old_called_new()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt
deleted file mode 100644
index 4eac90e..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-^CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:14 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:14 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:27 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:48 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:48 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake
deleted file mode 100644
index 87c968a..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-set(FOO BAR)
-
-cmake_policy(SET CMP0054 NEW)
-
-foreach(loop_var arg1 arg2)
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-
- cmake_policy(SET CMP0054 OLD)
-
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-
- cmake_policy(SET CMP0054 NEW)
-endforeach()
-
-cmake_policy(SET CMP0054 OLD)
-
-foreach(loop_var arg1 arg2)
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-
- cmake_policy(SET CMP0054 NEW)
-
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-
- cmake_policy(SET CMP0054 OLD)
-endforeach()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt
deleted file mode 100644
index a2dd62e..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0054-policy-nested-if.cmake:23 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake
deleted file mode 100644
index dd7434d..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake
+++ /dev/null
@@ -1,41 +0,0 @@
-set(FOO BAR)
-
-cmake_policy(SET CMP0054 NEW)
-
-if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-
- cmake_policy(SET CMP0054 OLD)
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-endif()
-
-if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
-endif()
-
-cmake_policy(SET CMP0054 OLD)
-
-if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-
- cmake_policy(SET CMP0054 NEW)
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-endif()
-
-if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
-endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt
deleted file mode 100644
index 718904d..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-^CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:16 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:16 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:37 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:58 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)
-+
-CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:58 \(cmake_policy\):
- The OLD behavior for policy CMP0054 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake
deleted file mode 100644
index 7fb836e..0000000
--- a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-set(FOO BAR)
-
-set(LOOP_VAR "")
-
-cmake_policy(SET CMP0054 NEW)
-
-while(NOT LOOP_VAR STREQUAL "xx")
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-
- cmake_policy(SET CMP0054 OLD)
-
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-
- cmake_policy(SET CMP0054 NEW)
-
- string(APPEND LOOP_VAR "x")
-endwhile()
-
-while("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
-endwhile()
-
-set(LOOP_VAR "")
-
-cmake_policy(SET CMP0054 OLD)
-
-while(NOT LOOP_VAR STREQUAL "xx")
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
- endif()
-
- cmake_policy(SET CMP0054 NEW)
-
- if(NOT FOO STREQUAL BAR)
- message(FATAL_ERROR "The variable should match the string")
- endif()
-
- if("FOO" STREQUAL BAR)
- message(FATAL_ERROR "The strings should not match")
- endif()
-
- cmake_policy(SET CMP0054 OLD)
-
- string(APPEND LOOP_VAR "x")
-endwhile()
-
-if(NOT "FOO" STREQUAL BAR)
- message(FATAL_ERROR "The quoted variable should match the string")
-endif()
diff --git a/Tests/RunCMake/CMP0054/CMakeLists.txt b/Tests/RunCMake/CMP0054/CMakeLists.txt
index 2897109..bf2ef15 100644
--- a/Tests/RunCMake/CMP0054/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0054/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0054/RunCMakeTest.cmake b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
index fc031de..99ac7f4 100644
--- a/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
@@ -1,14 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0054-OLD)
run_cmake(CMP0054-NEW)
-run_cmake(CMP0054-WARN)
run_cmake(CMP0054-keywords-NEW)
-run_cmake(CMP0054-keywords-OLD)
-run_cmake(CMP0054-keywords-WARN)
-run_cmake(CMP0054-duplicate-warnings)
-run_cmake(CMP0054-policy-command-scope)
-run_cmake(CMP0054-policy-foreach-scope)
-run_cmake(CMP0054-policy-while-scope)
-run_cmake(CMP0054-policy-nested-if)
diff --git a/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope-stderr.txt
index 27e8140..8a708f7 100644
--- a/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope-stderr.txt
+++ b/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0055-NEW-Out-of-Scope.cmake:4 \(break\):
+CMake Error at CMP0055-NEW-Out-of-Scope.cmake:1 \(break\):
A BREAK command was found outside of a proper FOREACH or WHILE loop scope.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope.cmake b/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope.cmake
index 53ac214..aa3ab26 100644
--- a/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope.cmake
+++ b/Tests/RunCMake/CMP0055/CMP0055-NEW-Out-of-Scope.cmake
@@ -1,4 +1 @@
-
-cmake_policy(SET CMP0055 NEW)
-
break()
diff --git a/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments-stderr.txt
index 32947af..24d0204 100644
--- a/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments-stderr.txt
+++ b/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0055-NEW-Reject-Arguments.cmake:5 \(break\):
+CMake Error at CMP0055-NEW-Reject-Arguments.cmake:2 \(break\):
The BREAK command does not accept any arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments.cmake b/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments.cmake
index 52eaa6a..c00c418 100644
--- a/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments.cmake
+++ b/Tests/RunCMake/CMP0055/CMP0055-NEW-Reject-Arguments.cmake
@@ -1,6 +1,3 @@
-
-cmake_policy(SET CMP0055 NEW)
-
foreach(i RANGE 1 2)
break(1)
-endforeach() \ No newline at end of file
+endforeach()
diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-result.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt
deleted file mode 100644
index d0a156c..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0055-OLD-Out-of-Scope.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0055 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/CMP0055/CMP0055-OLD-Out-of-Scope.cmake b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope.cmake
deleted file mode 100644
index 57195c2..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-cmake_policy(SET CMP0055 OLD)
-
-break()
diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-result.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt
deleted file mode 100644
index 937b352..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0055-OLD-Reject-Arguments.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0055 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/CMP0055/CMP0055-OLD-Reject-Arguments.cmake b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments.cmake
deleted file mode 100644
index d8fdddf..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-
-cmake_policy(SET CMP0055 OLD)
-
-foreach(i RANGE 1 2)
- break(1)
-endforeach() \ No newline at end of file
diff --git a/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-result.txt b/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-stderr.txt
deleted file mode 100644
index ad850ac..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Warning \(dev\) at CMP0055-WARN-Out-of-Scope.cmake:2 \(break\):
- Policy CMP0055 is not set: Strict checking for break\(\) command. Run "cmake
- --help-policy CMP0055" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- A BREAK command was found outside of a proper FOREACH or WHILE loop scope.
-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/CMP0055/CMP0055-WARN-Out-of-Scope.cmake b/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope.cmake
deleted file mode 100644
index 373a95a..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-WARN-Out-of-Scope.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-
-break()
diff --git a/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-result.txt b/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-stderr.txt
deleted file mode 100644
index 3cc686d..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Warning \(dev\) at CMP0055-WARN-Reject-Arguments.cmake:3 \(break\):
- Policy CMP0055 is not set: Strict checking for break\(\) command. Run "cmake
- --help-policy CMP0055" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- The BREAK command does not accept any arguments.
-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/CMP0055/CMP0055-WARN-Reject-Arguments.cmake b/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments.cmake
deleted file mode 100644
index ec6b90f..0000000
--- a/Tests/RunCMake/CMP0055/CMP0055-WARN-Reject-Arguments.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-foreach(i RANGE 1 2)
- break(1)
-endforeach()
diff --git a/Tests/RunCMake/CMP0055/CMakeLists.txt b/Tests/RunCMake/CMP0055/CMakeLists.txt
index ef2163c..bf2ef15 100644
--- a/Tests/RunCMake/CMP0055/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0055/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0055/RunCMakeTest.cmake b/Tests/RunCMake/CMP0055/RunCMakeTest.cmake
index 33a5b4b..d9db6f5 100644
--- a/Tests/RunCMake/CMP0055/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0055/RunCMakeTest.cmake
@@ -1,10 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0055-OLD-Out-of-Scope)
run_cmake(CMP0055-NEW-Out-of-Scope)
-run_cmake(CMP0055-WARN-Out-of-Scope)
-
-run_cmake(CMP0055-OLD-Reject-Arguments)
run_cmake(CMP0055-NEW-Reject-Arguments)
-run_cmake(CMP0055-WARN-Reject-Arguments)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake
index ebd7ba5..5689868 100644
--- a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake
+++ b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0057 NEW)
-
set(MY_NON_EXISTENT_LIST)
set(MY_EMPTY_LIST "")
diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-OLD-stderr.txt
deleted file mode 100644
index f3fad8d..0000000
--- a/Tests/RunCMake/CMP0057/CMP0057-OLD-stderr.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-CMake Error at CMP0057-OLD.cmake:5 \(if\):
- if given arguments:
-
- "foo" "IN_LIST" "MY_LIST"
-
- Unknown arguments specified
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake
deleted file mode 100644
index cf9ec89..0000000
--- a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_policy(SET CMP0057 OLD)
-
-set(MY_LIST foo bar)
-
-if("foo" IN_LIST MY_LIST)
- message("foo is in MY_LIST")
-endif()
diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt
deleted file mode 100644
index b1c9b63..0000000
--- a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-CMake Warning \(dev\) at CMP0057-WARN.cmake:3 \(if\):
- Policy CMP0057 is not set: Support new IN_LIST if\(\) operator. Run "cmake
- --help-policy CMP0057" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- IN_LIST will be interpreted as an operator when the policy is set to NEW.
- Since the policy is not set the OLD behavior will be used.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0057-WARN.cmake:3 \(if\):
- if given arguments:
-
- "foo" "IN_LIST" "MY_LIST"
-
- Unknown arguments specified
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake
deleted file mode 100644
index 45f53a5..0000000
--- a/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(MY_LIST foo bar)
-
-if("foo" IN_LIST MY_LIST)
- message("foo is in MY_LIST")
-endif()
diff --git a/Tests/RunCMake/CMP0057/CMakeLists.txt b/Tests/RunCMake/CMP0057/CMakeLists.txt
index 18dfd26..bf2ef15 100644
--- a/Tests/RunCMake/CMP0057/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0057/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.2)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake
index 76eaca6..9791587 100644
--- a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0057-OLD)
-run_cmake(CMP0057-WARN)
run_cmake(CMP0057-NEW)
diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt b/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake b/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake
index f7b9303..0dde536 100644
--- a/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake
+++ b/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake
@@ -1,6 +1,3 @@
-
-cmake_policy(SET CMP0059 NEW)
-
add_definitions(-DSOME_DEF)
get_property(defs DIRECTORY .
diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt b/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt
deleted file mode 100644
index e35e8c5..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-DEFS: -DSOME_DEF
-CUSTOM CONTENT: -DSOME_DEF
diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake b/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake
deleted file mode 100644
index 2555774..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-
-cmake_policy(SET CMP0059 OLD)
-
-add_definitions(-DSOME_DEF)
-
-get_property(defs DIRECTORY .
- PROPERTY DEFINITIONS
-)
-message("DEFS:${defs}")
-
-set_property(DIRECTORY .
- PROPERTY DEFINITIONS CUSTOM_CONTENT
-)
-get_property(content DIRECTORY .
- PROPERTY DEFINITIONS
-)
-message("CUSTOM CONTENT:${content}")
diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt
deleted file mode 100644
index 06c7be3..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\):
- Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory
- property. Run "cmake --help-policy CMP0059" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-DEFS: -DSOME_DEF
-CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\):
- Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory
- property. Run "cmake --help-policy CMP0059" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CUSTOM CONTENT: -DSOME_DEF
diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake b/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake
deleted file mode 100644
index 9d0b49c..0000000
--- a/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-add_definitions(-DSOME_DEF)
-
-get_property(defs DIRECTORY .
- PROPERTY DEFINITIONS
-)
-message("DEFS:${defs}")
-
-set_property(DIRECTORY .
- PROPERTY DEFINITIONS CUSTOM_CONTENT
-)
-get_property(content DIRECTORY .
- PROPERTY DEFINITIONS
-)
-message("CUSTOM CONTENT:${content}")
diff --git a/Tests/RunCMake/CMP0059/CMakeLists.txt b/Tests/RunCMake/CMP0059/CMakeLists.txt
index ef2163c..bf2ef15 100644
--- a/Tests/RunCMake/CMP0059/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0059/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0059/RunCMakeTest.cmake b/Tests/RunCMake/CMP0059/RunCMakeTest.cmake
index 9b57579..b95bb0f 100644
--- a/Tests/RunCMake/CMP0059/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0059/RunCMakeTest.cmake
@@ -1,5 +1,3 @@
include(RunCMake)
-run_cmake(CMP0059-OLD)
run_cmake(CMP0059-NEW)
-run_cmake(CMP0059-WARN)
diff --git a/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake b/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake
index 0414e4b..6b84565 100644
--- a/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake
+++ b/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0060 NEW)
include(CMP0060-Common.cmake)
diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt
deleted file mode 100644
index d197c91..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-[^0]
diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt
deleted file mode 100644
index 240764c..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
-LINKFLAG_CMP0060_LINKSUFFIX
diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt
deleted file mode 100644
index 4658747..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0060-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0060 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/CMP0060/CMP0060-OLD.cmake b/Tests/RunCMake/CMP0060/CMP0060-OLD.cmake
deleted file mode 100644
index a9cffef..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0060 OLD)
-include(CMP0060-Common.cmake)
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt
deleted file mode 100644
index d197c91..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-[^0]
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt
deleted file mode 100644
index 240764c..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
-LINKFLAG_CMP0060_LINKSUFFIX
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake
deleted file mode 100644
index 6b84565..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include(CMP0060-Common.cmake)
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt
deleted file mode 100644
index d197c91..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-[^0]
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt
deleted file mode 100644
index 240764c..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
-LINKFLAG_CMP0060_LINKSUFFIX
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt
deleted file mode 100644
index 07c17e2..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-^CMake Warning \(dev\) at CMP0060-Common.cmake:[0-9]+ \(add_executable\):
- Policy CMP0060 is not set: Link libraries by full path even in implicit
- directories. Run "cmake --help-policy CMP0060" for policy details. Use
- the cmake_policy command to set the policy and suppress this warning.
-
- Some library files are in directories implicitly searched by the linker
- when invoked for C:
-
- .*/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-build/lib/(lib)?CMP0060.(a|lib|l)
-
- For compatibility with older versions of CMake, the generated link line
- will ask the linker to search for these by library name.
-Call Stack \(most recent call first\):
- CMP0060-WARN-ON.cmake:[0-9]+ \(include\)
- CMakeLists.txt:[0-9]+ \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake
deleted file mode 100644
index a0a7950..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-set(CMAKE_POLICY_WARNING_CMP0060 1)
-include(CMP0060-Common.cmake)
diff --git a/Tests/RunCMake/CMP0060/CMakeLists.txt b/Tests/RunCMake/CMP0060/CMakeLists.txt
index db6b701..d1b0d2c 100644
--- a/Tests/RunCMake/CMP0060/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0060/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.2)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} C)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0060/RunCMakeTest.cmake b/Tests/RunCMake/CMP0060/RunCMakeTest.cmake
index b7eae5a..024f79c 100644
--- a/Tests/RunCMake/CMP0060/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0060/RunCMakeTest.cmake
@@ -1,5 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
function(run_cmake_CMP0060 CASE)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0060-${CASE}-build)
@@ -14,7 +13,4 @@ function(run_cmake_CMP0060 CASE)
)
endfunction()
-run_cmake_CMP0060(OLD)
-run_cmake_CMP0060(WARN-OFF)
-run_cmake_CMP0060(WARN-ON)
run_cmake_CMP0060(NEW)
diff --git a/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake b/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake
index cdf50e9..4657471 100644
--- a/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake
+++ b/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0064 NEW)
-
if(NOT TEST TestThatDoesNotExist)
message(STATUS "if NOT TestThatDoesNotExist is true")
endif()
diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt
deleted file mode 100644
index 987a503..0000000
--- a/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0064-OLD.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0064 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:3 \(include\)$
diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake b/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake
deleted file mode 100644
index bffd3f3..0000000
--- a/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_policy(SET CMP0064 OLD)
-
-if(TEST)
- message(FATAL_ERROR "TEST was not recognized to be undefined")
-else()
- message(STATUS "TEST was treated as a variable")
-endif()
diff --git a/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt
deleted file mode 100644
index 71f1ab7..0000000
--- a/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CMake Warning \(dev\) at CMP0064-WARN.cmake:3 \(if\):
- Policy CMP0064 is not set: Support new TEST if\(\) operator. Run "cmake
- --help-policy CMP0064" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- TEST will be interpreted as an operator when the policy is set to NEW.
- Since the policy is not set the OLD behavior will be used.
-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/CMP0064/CMP0064-WARN.cmake b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake
deleted file mode 100644
index 8f26ec6..0000000
--- a/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-if(TEST)
- message(FATAL_ERROR "TEST was not recognized to be undefined")
-else()
- message(STATUS "TEST was treated as a variable")
-endif()
diff --git a/Tests/RunCMake/CMP0064/CMakeLists.txt b/Tests/RunCMake/CMP0064/CMakeLists.txt
index 74b3ff8..bf2ef15 100644
--- a/Tests/RunCMake/CMP0064/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0064/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0064/RunCMakeTest.cmake b/Tests/RunCMake/CMP0064/RunCMakeTest.cmake
index 4c68510..82de368 100644
--- a/Tests/RunCMake/CMP0064/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0064/RunCMakeTest.cmake
@@ -1,6 +1,3 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(CMP0064-OLD)
-run_cmake(CMP0064-WARN)
run_cmake(CMP0064-NEW)
diff --git a/Tests/RunCMake/CMP0065/CMakeLists.txt b/Tests/RunCMake/CMP0065/CMakeLists.txt
index 74b3ff8..bf2ef15 100644
--- a/Tests/RunCMake/CMP0065/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0065/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0065/OLDBad1.cmake b/Tests/RunCMake/CMP0065/OLDBad1.cmake
deleted file mode 100644
index 6d780b4..0000000
--- a/Tests/RunCMake/CMP0065/OLDBad1.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-enable_language(C)
-include(BuildTargetInSubProject.cmake)
-
-BuildTargetInSubProject(TestPolicyCMP0065 FooOLDBad1 FALSE)
diff --git a/Tests/RunCMake/CMP0065/OLDBad2.cmake b/Tests/RunCMake/CMP0065/OLDBad2.cmake
deleted file mode 100644
index 7196473..0000000
--- a/Tests/RunCMake/CMP0065/OLDBad2.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-enable_language(C)
-include(BuildTargetInSubProject.cmake)
-
-BuildTargetInSubProject(TestPolicyCMP0065 FooOLDBad2 FALSE)
diff --git a/Tests/RunCMake/CMP0065/RunCMakeTest.cmake b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
index 1ca4605..54df5e3 100644
--- a/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
@@ -1,12 +1,7 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
-run_cmake(OLDBad1)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "AIX")
# Tests with ENABLE_EXPORTS ON. For AIX we do not use the flags at all.
- run_cmake(OLDBad2)
run_cmake(NEWBad)
endif()
run_cmake(NEWGood)
-run_cmake(WARN-OFF)
-run_cmake(WARN-ON)
diff --git a/Tests/RunCMake/CMP0065/WARN-OFF.cmake b/Tests/RunCMake/CMP0065/WARN-OFF.cmake
deleted file mode 100644
index dbc9562..0000000
--- a/Tests/RunCMake/CMP0065/WARN-OFF.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-
-enable_language(C)
-add_executable(main subproject/main.c)
diff --git a/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt
deleted file mode 100644
index c31ec38..0000000
--- a/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0065 is not set: Do not add flags to export symbols from
- executables without the ENABLE_EXPORTS target property. Run "cmake
- --help-policy CMP0065" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- For compatibility with older versions of CMake, additional flags may be
- added to export symbols on all executables regardless of their
- ENABLE_EXPORTS property.
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0065/WARN-ON.cmake b/Tests/RunCMake/CMP0065/WARN-ON.cmake
deleted file mode 100644
index 6ed4a41..0000000
--- a/Tests/RunCMake/CMP0065/WARN-ON.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(CMAKE_POLICY_WARNING_CMP0065 1)
-enable_language(C)
-add_executable(main subproject/main.c)
diff --git a/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt b/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt
index bed5960..7f19467 100644
--- a/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt
@@ -1,22 +1,8 @@
-cmake_minimum_required(VERSION 3.3)
-
+cmake_minimum_required(VERSION 3.10)
project(TestPolicyCMP0065 C)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS BADFLAGS)
-#----------------------------------------------------------------------
-cmake_policy(SET CMP0065 OLD)
-add_executable(FooOLDBad1 main.c)
-
-#----------------------------------------------------------------------
-cmake_policy(SET CMP0065 OLD)
-add_executable(FooOLDBad2 main.c)
-set_target_properties(FooOLDBad2 PROPERTIES ENABLE_EXPORTS ON)
-
-#----------------------------------------------------------------------
-cmake_policy(SET CMP0065 NEW)
add_executable(FooNEWGood main.c)
-#----------------------------------------------------------------------
-cmake_policy(SET CMP0065 NEW)
add_executable(FooNEWBad main.c)
set_target_properties(FooNEWBad PROPERTIES ENABLE_EXPORTS ON)
diff --git a/Tests/RunCMake/CMP0068/CMP0068-NEW.cmake b/Tests/RunCMake/CMP0068/CMP0068-NEW.cmake
index eb8cfa1..a1e6d6a 100644
--- a/Tests/RunCMake/CMP0068/CMP0068-NEW.cmake
+++ b/Tests/RunCMake/CMP0068/CMP0068-NEW.cmake
@@ -1,6 +1,5 @@
cmake_policy(SET CMP0068 NEW)
-cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty.cpp)
set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath" INSTALL_RPATH "@loader_path/" BUILD_WITH_INSTALL_RPATH 1)
diff --git a/Tests/RunCMake/CMP0068/CMP0068-OLD.cmake b/Tests/RunCMake/CMP0068/CMP0068-OLD.cmake
index cf1040f..fdc82bb 100644
--- a/Tests/RunCMake/CMP0068/CMP0068-OLD.cmake
+++ b/Tests/RunCMake/CMP0068/CMP0068-OLD.cmake
@@ -1,6 +1,5 @@
cmake_policy(SET CMP0068 OLD)
-cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty.cpp)
set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath" INSTALL_RPATH "@loader_path/" BUILD_WITH_INSTALL_RPATH 1)
diff --git a/Tests/RunCMake/CMP0068/CMP0068-WARN.cmake b/Tests/RunCMake/CMP0068/CMP0068-WARN.cmake
index b7ec480..bf1ec34 100644
--- a/Tests/RunCMake/CMP0068/CMP0068-WARN.cmake
+++ b/Tests/RunCMake/CMP0068/CMP0068-WARN.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0042 NEW)
-
add_library(foo SHARED empty.cpp)
add_library(foo-static STATIC empty.cpp)
add_library(foo2 SHARED empty.cpp)
diff --git a/Tests/RunCMake/CMP0132/CMP0132-OLD-stderr.txt b/Tests/RunCMake/CMP0132/CMP0132-OLD-stderr.txt
new file mode 100644
index 0000000..025665d
--- /dev/null
+++ b/Tests/RunCMake/CMP0132/CMP0132-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0132-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0132 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/CMP0135/CMP0135-OLD-stderr.txt b/Tests/RunCMake/CMP0135/CMP0135-OLD-stderr.txt
new file mode 100644
index 0000000..59a7a58
--- /dev/null
+++ b/Tests/RunCMake/CMP0135/CMP0135-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0135-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0135 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/CMP0139/CMP0139-OLD-stderr.txt b/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
index 1cfb319..b04cd1a 100644
--- a/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
@@ -1,3 +1,14 @@
+^CMake Deprecation Warning at CMP0139-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0139 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 CMP0139-OLD.cmake:[0-9]+ \(if\):
if given arguments:
@@ -5,4 +16,4 @@ CMake Error at CMP0139-OLD.cmake:[0-9]+ \(if\):
Unknown arguments specified
Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMakeListFileName/CMakeLists.txt b/Tests/RunCMake/CMakeListFileName/CMakeLists.txt
new file mode 100644
index 0000000..94e43ba
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/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/CMakeListFileName/RunCMakeTest.cmake b/Tests/RunCMake/CMakeListFileName/RunCMakeTest.cmake
new file mode 100644
index 0000000..147590e
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/RunCMakeTest.cmake
@@ -0,0 +1,17 @@
+include(RunCMake)
+
+block()
+ set(RunCMake_TEST_NO_SOURCE_DIR 1)
+ set(source ${RunCMake_SOURCE_DIR}/project)
+ run_cmake_with_options(dont-set-file -S ${source})
+ run_cmake_with_options(set-file-dne -S ${source} --project-file dne.cmake)
+ run_cmake_with_options(set-file-multi -S ${source} --project-file 1 --project-file 2)
+ run_cmake_with_options(set-file-none -S ${source} --project-file)
+
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/other)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake_with_options(set-file -S ${source} --project-file other.cmake)
+ run_cmake_with_options(remembers-file -S ${source})
+ run_cmake_with_options(cant-change-file -S ${source} --project-file another.cmake)
+endblock()
diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt b/Tests/RunCMake/CMakeListFileName/cant-change-file-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt
+++ b/Tests/RunCMake/CMakeListFileName/cant-change-file-result.txt
diff --git a/Tests/RunCMake/CMakeListFileName/cant-change-file-stderr.txt b/Tests/RunCMake/CMakeListFileName/cant-change-file-stderr.txt
new file mode 100644
index 0000000..25d3d61
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/cant-change-file-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error: CMakeLists filename : \"another.cmake\"
+Does not match the previous: \"other.cmake\"
+Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
diff --git a/Tests/RunCMake/CMakeListFileName/dont-set-file-stdout.txt b/Tests/RunCMake/CMakeListFileName/dont-set-file-stdout.txt
new file mode 100644
index 0000000..787db38
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/dont-set-file-stdout.txt
@@ -0,0 +1,3 @@
+\-\- Processing: CMakeLists.txt
+\-\- Processing: subdir-1/CMakeLists.txt
+\-\- Processing: subdir-2/CMakeLists.txt
diff --git a/Tests/RunCMake/CMakeListFileName/project/CMakeLists.txt b/Tests/RunCMake/CMakeListFileName/project/CMakeLists.txt
new file mode 100644
index 0000000..8d35b34
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/project/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.31)
+project(test)
+message(STATUS "Processing: CMakeLists.txt")
+add_subdirectory(subdir-1)
+add_subdirectory(subdir-2)
diff --git a/Tests/RunCMake/CMakeListFileName/project/other.cmake b/Tests/RunCMake/CMakeListFileName/project/other.cmake
new file mode 100644
index 0000000..b9bb06e
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/project/other.cmake
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.31)
+project(test)
+message(STATUS "Processing: other.cmake")
+add_subdirectory(subdir-1)
+add_subdirectory(subdir-2)
diff --git a/Tests/RunCMake/CMakeListFileName/project/subdir-1/CMakeLists.txt b/Tests/RunCMake/CMakeListFileName/project/subdir-1/CMakeLists.txt
new file mode 100644
index 0000000..455d9e5
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/project/subdir-1/CMakeLists.txt
@@ -0,0 +1 @@
+message(STATUS "Processing: subdir-1/CMakeLists.txt")
diff --git a/Tests/RunCMake/CMakeListFileName/project/subdir-1/other.cmake b/Tests/RunCMake/CMakeListFileName/project/subdir-1/other.cmake
new file mode 100644
index 0000000..f26252b
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/project/subdir-1/other.cmake
@@ -0,0 +1 @@
+message(STATUS "Processing: subdir-1/other.cmake")
diff --git a/Tests/RunCMake/CMakeListFileName/project/subdir-2/CMakeLists.txt b/Tests/RunCMake/CMakeListFileName/project/subdir-2/CMakeLists.txt
new file mode 100644
index 0000000..3a69f44
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/project/subdir-2/CMakeLists.txt
@@ -0,0 +1 @@
+message(STATUS "Processing: subdir-2/CMakeLists.txt")
diff --git a/Tests/RunCMake/CMakeListFileName/remembers-file-stderr.txt b/Tests/RunCMake/CMakeListFileName/remembers-file-stderr.txt
new file mode 100644
index 0000000..e35c60e
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/remembers-file-stderr.txt
@@ -0,0 +1,4 @@
+CMake Warning:
+ This project has been configured with a project file other than
+ CMakeLists.txt. This feature is intended for temporary use during
+ development and not for publication of a final product.
diff --git a/Tests/RunCMake/CMakeListFileName/remembers-file-stdout.txt b/Tests/RunCMake/CMakeListFileName/remembers-file-stdout.txt
new file mode 100644
index 0000000..c1cb088
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/remembers-file-stdout.txt
@@ -0,0 +1,3 @@
+\-\- Processing: other.cmake
+\-\- Processing: subdir-1/other.cmake
+\-\- Processing: subdir-2/CMakeLists.txt
diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt b/Tests/RunCMake/CMakeListFileName/set-file-dne-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt
+++ b/Tests/RunCMake/CMakeListFileName/set-file-dne-result.txt
diff --git a/Tests/RunCMake/CMakeListFileName/set-file-dne-stderr.txt b/Tests/RunCMake/CMakeListFileName/set-file-dne-stderr.txt
new file mode 100644
index 0000000..ab7c26b
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/set-file-dne-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning:
+ This project has been configured with a project file other than
+ CMakeLists.txt. This feature is intended for temporary use during
+ development and not for publication of a final product.
+
+
+CMake Error: The source directory [^
+]* does not appear to contain dne.cmake.
+Specify --help for usage, or press the help button on the CMake GUI.
diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt b/Tests/RunCMake/CMakeListFileName/set-file-multi-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt
+++ b/Tests/RunCMake/CMakeListFileName/set-file-multi-result.txt
diff --git a/Tests/RunCMake/CMakeListFileName/set-file-multi-stderr.txt b/Tests/RunCMake/CMakeListFileName/set-file-multi-stderr.txt
new file mode 100644
index 0000000..9cfb84d
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/set-file-multi-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: Multiple --project-file options not allowed
+CMake Error: Run 'cmake --help' for all supported options
diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt b/Tests/RunCMake/CMakeListFileName/set-file-none-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt
+++ b/Tests/RunCMake/CMakeListFileName/set-file-none-result.txt
diff --git a/Tests/RunCMake/CMakeListFileName/set-file-none-stderr.txt b/Tests/RunCMake/CMakeListFileName/set-file-none-stderr.txt
new file mode 100644
index 0000000..ffeca30
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/set-file-none-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: No filename specified for --project-file
+CMake Error: Run 'cmake --help' for all supported options.
diff --git a/Tests/RunCMake/CMakeListFileName/set-file-stderr.txt b/Tests/RunCMake/CMakeListFileName/set-file-stderr.txt
new file mode 100644
index 0000000..e35c60e
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/set-file-stderr.txt
@@ -0,0 +1,4 @@
+CMake Warning:
+ This project has been configured with a project file other than
+ CMakeLists.txt. This feature is intended for temporary use during
+ development and not for publication of a final product.
diff --git a/Tests/RunCMake/CMakeListFileName/set-file-stdout.txt b/Tests/RunCMake/CMakeListFileName/set-file-stdout.txt
new file mode 100644
index 0000000..c1cb088
--- /dev/null
+++ b/Tests/RunCMake/CMakeListFileName/set-file-stdout.txt
@@ -0,0 +1,3 @@
+\-\- Processing: other.cmake
+\-\- Processing: subdir-1/other.cmake
+\-\- Processing: subdir-2/CMakeLists.txt
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 0a96aef..e671397 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
# See adjacent README.rst for documentation of this test infrastructure.
@@ -21,6 +21,9 @@ macro(add_RunCMake_test test)
if(CMAKE_C_COMPILER_ID STREQUAL "LCC")
list(APPEND TEST_ARGS -DRunCMake_TEST_LCC=1)
endif()
+ if(DEFINED CMake_TEST_E2K_BROKEN_LIBC)
+ list(APPEND TEST_ARGS -DRunCMake_TEST_E2K_BROKEN_LIBC=${CMake_TEST_E2K_BROKEN_LIBC})
+ endif()
add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
-DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig}
@@ -107,11 +110,9 @@ add_RunCMake_test(CMP0041)
if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
add_RunCMake_test(CMP0042)
endif()
-add_RunCMake_test(CMP0043)
add_RunCMake_test(CMP0045)
add_RunCMake_test(CMP0046)
add_RunCMake_test(CMP0049)
-add_RunCMake_test(CMP0050)
add_RunCMake_test(CMP0051)
add_RunCMake_test(CMP0053)
add_RunCMake_test(CMP0054)
@@ -240,6 +241,7 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
set_property(TEST RunCMake.Ninja APPEND PROPERTY LABELS "Fortran")
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN} -DMSYS=${MSYS}
+ -DCMAKE_EXECUTABLE_SUFFIX=${CMAKE_EXECUTABLE_SUFFIX}
)
if(ninja_test_with_qt_version)
list(APPEND NinjaMultiConfig_ARGS
@@ -394,6 +396,7 @@ set_property(TEST RunCMake.CompilerId APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC"
add_RunCMake_test(CompilerTest ${CMake_TEST_LANG_VARS})
set_property(TEST RunCMake.CompilerTest APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC" "Fortran")
add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE})
+add_RunCMake_test(CpsExportImport)
add_RunCMake_test(DisallowedCommands)
if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(ExportCompileCommands)
@@ -412,6 +415,9 @@ if(CMAKE_USE_SYSTEM_JSONCPP)
endif()
add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
+if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+ add_RunCMake_test(Instrumentation)
+endif()
add_RunCMake_test(ConfigDir)
add_RunCMake_test(FindBoost)
add_RunCMake_test(FindLua)
@@ -473,10 +479,12 @@ set_property(TEST RunCMake.LanguageStandards APPEND PROPERTY LABELS "CUDA" "HIP"
add_RunCMake_test(LinkItemValidation)
add_RunCMake_test(LinkStatic)
+add_RunCMake_test(ARCHIVER-prefix -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|Fujitsu|FujitsuClang)$")
add_RunCMake_test(MetaCompileFeatures)
endif()
if(MSVC)
+ add_RunCMake_test(MSVCRuntimeChecks)
add_RunCMake_test(MSVCRuntimeLibrary)
add_RunCMake_test(MSVCRuntimeTypeInfo)
add_RunCMake_test(MSVCWarningFlags)
@@ -506,6 +514,13 @@ add_RunCMake_test(ToolchainFile)
add_RunCMake_test(find_dependency)
add_RunCMake_test(CompileDefinitions)
add_RunCMake_test(CompileWarningAsError -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+if((CMAKE_C_COMPILER_ID MATCHES "AppleClang|MSVC"
+ OR (CMAKE_SYSTEM_NAME MATCHES "Linux|Windows" AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
+ OR (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_C_COMPILER_ID STREQUAL "SunPro")
+ OR (CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_C_COMPILER_ID STREQUAL "XL"))
+ AND CMAKE_C_COMPILER_LINKER_ID)
+ add_RunCMake_test(LinkWarningAsError)
+endif()
set_property(TEST RunCMake.CompileWarningAsError APPEND PROPERTY LABELS "CUDA")
add_RunCMake_test(CompileFeatures -DCMake_NO_C_STANDARD=${CMake_NO_C_STANDARD} -DCMake_NO_CXX_STANDARD=${CMake_NO_CXX_STANDARD})
add_RunCMake_test(Policy)
@@ -591,6 +606,9 @@ add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_environment)
add_RunCMake_test(ctest_empty_binary_directory)
add_RunCMake_test(ctest_fixtures)
+if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+ add_RunCMake_test(ctest_instrumentation)
+endif()
add_RunCMake_test(define_property)
add_RunCMake_test(file -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
add_RunCMake_test(file-CHMOD -DMSYS=${MSYS})
@@ -615,6 +633,7 @@ 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})
add_RunCMake_test(find_package -DMINGW=${MINGW} -DMSYS=${MSYS})
+add_RunCMake_test(find_package-CPS)
add_RunCMake_test(find_path -DMINGW=${MINGW})
add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(foreach)
@@ -637,6 +656,7 @@ add_RunCMake_test(project_injected)
add_RunCMake_test(property_init)
add_RunCMake_test(DependencyProviders)
add_RunCMake_test(return)
+add_RunCMake_test(SarifOutput)
add_RunCMake_test(separate_arguments)
add_RunCMake_test(set_property)
add_RunCMake_test(string)
@@ -645,6 +665,7 @@ add_RunCMake_test(BundleUtilities)
if(APPLE)
add_RunCMake_test(INSTALL_NAME_DIR)
add_RunCMake_test(MacOSVersions)
+ add_RunCMake_test(AppleSDK)
add_RunCMake_test(AppleTextStubs)
endif()
@@ -875,6 +896,11 @@ add_RunCMake_test(target_link_libraries-LINK_GROUP -DCMAKE_SYSTEM_NAME=${CMAKE_S
-DCMAKE_IMPORT_LIBRARY_PREFIX=${CMAKE_IMPORT_LIBRARY_PREFIX}
-DCMAKE_IMPORT_LIBRARY_SUFFIX=${CMAKE_IMPORT_LIBRARY_SUFFIX}
-DCMAKE_LINK_LIBRARY_FLAG=${CMAKE_LINK_LIBRARY_FLAG})
+add_RunCMake_test(target_link_libraries-LINKER-prefix -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT}
+ -DCMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN=${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN}
+ -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
+ -DCMAKE_C_COMPILER_FRONTEND_VARIANT=${CMAKE_C_COMPILER_FRONTEND_VARIANT})
add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMake_TEST_CUDA=${CMake_TEST_CUDA})
@@ -1108,6 +1134,7 @@ set(cpack_tests
RPM.COMPONENT_WITH_SPECIAL_CHARS
7Z
+ TAR
TBZ2
TGZ
TXZ
@@ -1247,6 +1274,8 @@ add_RunCMake_test(CMakePresetsWorkflow
add_RunCMake_test(VerifyHeaderSets)
add_RunCMake_test(set_tests_properties)
+add_RunCMake_test(CMakeListFileName)
+
if(CMAKE_GENERATOR MATCHES "Make|Ninja")
add_RunCMake_test(Codegen)
add_RunCMake_test(TransformDepfile)
diff --git a/Tests/RunCMake/CMakePackage/ApplePlatformGenSubdir.cmake b/Tests/RunCMake/CMakePackage/ApplePlatformGenSubdir.cmake
index e472665..2ad64ae 100644
--- a/Tests/RunCMake/CMakePackage/ApplePlatformGenSubdir.cmake
+++ b/Tests/RunCMake/CMakePackage/ApplePlatformGenSubdir.cmake
@@ -18,7 +18,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install/${CMAKE_INSTALL_DATADIR}/pkg_a_in
[[message(STATUS "Hello from pkg_a")]]
)
-# To expose re-using the same package prefix variable, we need to use a
+# To expose reusing the same package prefix variable, we need to use a
# different install prefix. This is really contrived and not representative of
# what a package should do.
generate_apple_platform_selection_file(
diff --git a/Tests/RunCMake/CMakePresets/IncludeOutsideProject.json.in b/Tests/RunCMake/CMakePresets/IncludeOutsideProject.json.in
index cf1928f..f84494f 100644
--- a/Tests/RunCMake/CMakePresets/IncludeOutsideProject.json.in
+++ b/Tests/RunCMake/CMakePresets/IncludeOutsideProject.json.in
@@ -5,7 +5,8 @@
],
"configurePresets": [
{
- "name": "IncludeOutsideProject"
+ "name": "IncludeOutsideProject",
+ "generator": "@RunCMake_GENERATOR@"
}
]
}
diff --git a/Tests/RunCMake/CMakePresets/IncludeUserOutsideProjectUser.json.in b/Tests/RunCMake/CMakePresets/IncludeUserOutsideProjectUser.json.in
index 5b5427a..c7436c7 100644
--- a/Tests/RunCMake/CMakePresets/IncludeUserOutsideProjectUser.json.in
+++ b/Tests/RunCMake/CMakePresets/IncludeUserOutsideProjectUser.json.in
@@ -5,7 +5,8 @@
],
"configurePresets": [
{
- "name": "IncludeUserOutsideProject"
+ "name": "IncludeUserOutsideProject",
+ "generator": "@RunCMake_GENERATOR@"
}
]
}
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index a92a4c4..6ffd7e5 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.19) # CMP0053
+cmake_minimum_required(VERSION 3.19)
include(RunCMake)
@@ -76,13 +76,24 @@ function(run_cmake_presets name)
set(_preset)
endif()
+ set(_log_level)
+ if(CMakePresets_LOG_LEVEL)
+ set(_log_level "--log-level=${CMakePresets_LOG_LEVEL}")
+ endif()
+
+ set(_make_program)
+ if(RunCMake_MAKE_PROGRAM)
+ set(_make_program -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM})
+ endif()
+
set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND}
${_source_args}
-DRunCMake_TEST=${name}
-DRunCMake_GENERATOR=${RunCMake_GENERATOR}
- -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}
+ ${_make_program}
${_unused_cli}
${_preset}
+ ${_log_level}
${ARGN}
)
run_cmake(${name})
@@ -187,6 +198,7 @@ unset(ENV{TEST_D_ENV_REF})
set(ENV{TEST_ENV_OVERRIDE} "This environment variable will be overridden")
set(ENV{TEST_PENV} "Process environment variable")
set(ENV{TEST_ENV_REF_PENV} "suffix")
+set(CMakePresets_LOG_LEVEL "verbose")
run_cmake_presets(Good "-DTEST_OVERRIDE_1=Overridden value" "-DTEST_OVERRIDE_2:STRING=Overridden value" -C "${RunCMake_SOURCE_DIR}/CacheOverride.cmake" "-UTEST_UNDEF")
unset(ENV{TEST_ENV_OVERRIDE})
unset(ENV{TEST_PENV})
@@ -204,6 +216,7 @@ if(WIN32)
endif()
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/GoodBOM.json.in")
run_cmake_presets(GoodBOM)
+unset(CMakePresets_LOG_LEVEL)
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/CMakePresets.json.in")
file(REMOVE_RECURSE ${RunCMake_BINARY_DIR}/GoodBinaryCmdLine-build)
run_cmake_presets(GoodBinaryCmdLine -B ${RunCMake_BINARY_DIR}/GoodBinaryCmdLine-build)
diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in
index 5f3cf48..95dbb02 100644
--- a/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in
+++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in
@@ -2,7 +2,8 @@
"version": 6,
"configurePresets": [
{
- "name": "default"
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@"
}
],
"packagePresets": [
diff --git a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
index 2960eeb..4370bf5 100644
--- a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
+++ b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
@@ -13,6 +13,10 @@
"cmake-@version@-macos-universal\.tar\.gz"
"cmake-@version@-macos10\.10-universal\.dmg"
"cmake-@version@-macos10\.10-universal\.tar\.gz"
+"cmake-@version@-sunos-x86_64\.sh"
+"cmake-@version@-sunos-x86_64\.tar\.gz"
+"cmake-@version@-sunos-sparc64\.sh"
+"cmake-@version@-sunos-sparc64\.tar\.gz"
"cmake-@version@-windows-i386\.msi"
"cmake-@version@-windows-i386\.zip"
"cmake-@version@-windows-x86_64\.msi"
@@ -28,6 +32,8 @@
"cmake-@version@-macos-universal\.dmg"
-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macos10\.10"\) and \(\.class == "archive"\)\) \| \.name
"cmake-@version@-macos10\.10-universal\.tar\.gz"
+-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "sunos"\) and \(\.architecture\[\] \| \. == "sparc64"\) and \(\.class == "archive"\)\) \| \.name
+"cmake-@version@-sunos-sparc64\.tar\.gz"
-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "windows"\) and \(\.architecture\[\] \| \. == "i386"\) and \(\.class == "installer"\)\) \| \.name
"cmake-@version@-windows-i386\.msi"
-- query: \.files\[\] \| select\(\.architecture\[\] \| \. == "x86_64"\) \| \.name
@@ -37,6 +43,8 @@
"cmake-@version@-macos-universal\.tar\.gz"
"cmake-@version@-macos10\.10-universal\.dmg"
"cmake-@version@-macos10\.10-universal\.tar\.gz"
+"cmake-@version@-sunos-x86_64\.sh"
+"cmake-@version@-sunos-x86_64\.tar\.gz"
"cmake-@version@-windows-x86_64\.msi"
"cmake-@version@-windows-x86_64\.zip"
-- query: \.files\[\] \| select\(\[\.macOSmin\] \| inside\(\["10\.10", "10\.11", "10\.12"\]\)\) \| \.name
diff --git a/Tests/RunCMake/CMakeRelease/FileTable.cmake b/Tests/RunCMake/CMakeRelease/FileTable.cmake
index f46535c..c9d34d3 100644
--- a/Tests/RunCMake/CMakeRelease/FileTable.cmake
+++ b/Tests/RunCMake/CMakeRelease/FileTable.cmake
@@ -11,6 +11,7 @@ foreach(query
".files[] | select(.os[] | . == \"source\") | .name"
".files[] | select((.os[] | . == \"macOS\") and (.class == \"volume\")) | .name"
".files[] | select((.os[] | . == \"macos10.10\") and (.class == \"archive\")) | .name"
+ ".files[] | select((.os[] | . == \"sunos\") and (.architecture[] | . == \"sparc64\") and (.class == \"archive\")) | .name"
".files[] | select((.os[] | . == \"windows\") and (.architecture[] | . == \"i386\") and (.class == \"installer\")) | .name"
".files[] | select(.architecture[] | . == \"x86_64\") | .name"
".files[] | select([.macOSmin] | inside([\"10.10\", \"10.11\", \"10.12\"])) | .name"
diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in b/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in
index 4e2c085..d8f2e7b 100644
--- a/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in
+++ b/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.12)
-set(CTEST_RUN_CURRENT_SCRIPT 0)
get_property(role GLOBAL PROPERTY CMAKE_ROLE)
if(NOT role STREQUAL "CTEST")
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
index 3ec4c69..5d60aacd 100644
--- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake
+++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0057 NEW)
-
function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target)
if(TEST_TYPE IN_LIST types)
string(REGEX MATCH "^[^.]*" GENERATOR_TYPE "${TEST_TYPE}")
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index 39a316f..7471446 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -70,12 +70,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
if(err_)
set(error_extra " Extra: Could not unpack package content: '${err}'")
else()
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/data_${PREFIX}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/data_${PREFIX}/*")
# get file info so that we can determine if file is executable or not
foreach(FILE_ IN LISTS FILE_PATHS_)
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index c026bf6..57f86ca 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -5,19 +5,20 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
# A debugedit binary is required for these tests, so skip them if it's not found
find_program(DEBUGEDIT debugedit)
+find_program(BRPALT brp-alt PATHS /usr/lib/rpm/)
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT")
run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT")
run_cpack_test(AUTO_SUFFIXES "RPM.AUTO_SUFFIXES;DEB.AUTO_SUFFIXES" false "MONOLITHIC")
run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "COMPONENT")
-if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+if(DEBUGEDIT AND NOT BRPALT)
run_cpack_test(DEBUGINFO "RPM.DEBUGINFO" true "COMPONENT")
endif()
run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "MONOLITHIC")
run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT")
run_cpack_test(DEPENDENCIES "DEB.DEPENDENCIES" true "COMPONENT")
-if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+if(DEBUGEDIT AND NOT BRPALT)
run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES" true "COMPONENT")
endif()
run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC")
@@ -30,26 +31,28 @@ run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT")
run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT")
run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT")
run_cpack_test_subtests(INSTALL_SCRIPTS "default;no_scripts" "RPM.INSTALL_SCRIPTS" false "COMPONENT")
-if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+if(DEBUGEDIT AND NOT BRPALT)
run_cpack_test_subtests(INSTALL_SCRIPTS "single_debug_info;no_scripts_single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT")
endif()
run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC")
run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT")
-run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT")
-run_cpack_test_package_target(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT")
+run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;TAR;External" false "MONOLITHIC;COMPONENT")
+run_cpack_test_package_target(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;TAR;External" false "MONOLITHIC;COMPONENT")
run_cpack_test_package_target(THREADED_ALL "TXZ;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test_package_target(THREADED "TXZ;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC")
run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM.PARTIALLY_RELOCATABLE_WARNING" false "COMPONENT")
run_cpack_test(PER_COMPONENT_FIELDS "RPM.PER_COMPONENT_FIELDS;DEB.PER_COMPONENT_FIELDS" false "COMPONENT")
run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component" "RPM.SINGLE_DEBUGINFO" true "CUSTOM")
-if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+if(DEBUGEDIT AND NOT BRPALT)
run_cpack_test_subtests(SINGLE_DEBUGINFO "one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM")
endif()
-if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+if(DEBUGEDIT AND NOT BRPALT)
run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT")
endif()
-run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE")
+if(NOT BRPALT)
+ run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE")
+endif()
run_cpack_test(SUGGESTS "RPM.SUGGESTS" false "MONOLITHIC")
run_cpack_test(SYMLINKS "RPM.SYMLINKS;TGZ" false "MONOLITHIC;COMPONENT")
set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789")
@@ -68,9 +71,13 @@ run_cpack_test_subtests(
false
"MONOLITHIC;COMPONENT"
)
-run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT")
+if(NOT BRPALT)
+ run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT")
+else()
+ run_cpack_test(PROJECT_META "DEB.PROJECT_META" false "MONOLITHIC;COMPONENT")
+endif()
run_cpack_test_package_target(PRE_POST_SCRIPTS "ZIP" false "MONOLITHIC;COMPONENT")
run_cpack_test_subtests(DUPLICATE_FILE "success;conflict_file;conflict_symlink" "TGZ" false "COMPONENT;GROUP")
-run_cpack_test(COMPONENT_WITH_SPECIAL_CHARS "RPM.COMPONENT_WITH_SPECIAL_CHARS;DEB.COMPONENT_WITH_SPECIAL_CHARS;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT;GROUP")
-run_cpack_test_package_target(COMPONENT_WITH_SPECIAL_CHARS "RPM.COMPONENT_WITH_SPECIAL_CHARS;DEB.COMPONENT_WITH_SPECIAL_CHARS;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT;GROUP")
+run_cpack_test(COMPONENT_WITH_SPECIAL_CHARS "RPM.COMPONENT_WITH_SPECIAL_CHARS;DEB.COMPONENT_WITH_SPECIAL_CHARS;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;TAR" false "MONOLITHIC;COMPONENT;GROUP")
+run_cpack_test_package_target(COMPONENT_WITH_SPECIAL_CHARS "RPM.COMPONENT_WITH_SPECIAL_CHARS;DEB.COMPONENT_WITH_SPECIAL_CHARS;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;TAR" false "MONOLITHIC;COMPONENT;GROUP")
run_cpack_test_subtests(MULTIARCH "same;foreign;allowed;fail" "DEB.MULTIARCH" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/TAR/Helpers.cmake b/Tests/RunCMake/CPack/TAR/Helpers.cmake
new file mode 100644
index 0000000..c963701
--- /dev/null
+++ b/Tests/RunCMake/CPack/TAR/Helpers.cmake
@@ -0,0 +1,3 @@
+set(cpack_archive_extension_ "tar")
+
+include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
diff --git a/Tests/RunCMake/CPack/TAR/Prerequirements.cmake b/Tests/RunCMake/CPack/TAR/Prerequirements.cmake
new file mode 100644
index 0000000..dbaf682
--- /dev/null
+++ b/Tests/RunCMake/CPack/TAR/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/TAR/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/TAR/packaging_COMPONENT_default.cmake
new file mode 100644
index 0000000..81a5035
--- /dev/null
+++ b/Tests/RunCMake/CPack/TAR/packaging_COMPONENT_default.cmake
@@ -0,0 +1 @@
+set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
index d1d615b..36d070f 100644
--- a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
@@ -4,6 +4,7 @@
execute_process(
COMMAND ${RPMBUILD_EXECUTABLE} --nobuild test_suggests.spec
ERROR_QUIET
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE RPMBUILD_SUGGESTS_RESULT)
if(RPMBUILD_SUGGESTS_RESULT EQUAL 0)
@@ -15,15 +16,20 @@ endif()
# that tag and that was already checked by expected files test.
if(should_contain_suggests_tag_)
execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}"
- WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
RESULT_VARIABLE rpm_result_
- OUTPUT_VARIABLE rpm_output_
- ERROR_VARIABLE error_variable_
+ OUTPUT_VARIABLE rpm_stdout_
+ ERROR_VARIABLE rpm_stderr_
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(rpm_result_ OR NOT rpm_output_ STREQUAL "libsuggested")
- message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages"
- " (result: '${rpm_result_}'; output: '${rpm_output_}';"
- " error: '${error_variable_}')")
+ if(rpm_result_ OR NOT rpm_stdout_ STREQUAL "libsuggested")
+ string(REPLACE "\n" "\n " rpm_stdout_ "${rpm_stdout_}")
+ string(REPLACE "\n" "\n " rpm_stderr_ "${rpm_stderr_}")
+ message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages\n"
+ "result: ${rpm_result_}\n"
+ "stdout:\n"
+ " ${rpm_stdout_}\n"
+ "stderr:\n"
+ " ${rpm_stderr_}\n"
+ )
endif()
endif()
diff --git a/Tests/RunCMake/CPack_NuGet/.gitattributes b/Tests/RunCMake/CPack_NuGet/.gitattributes
deleted file mode 100644
index 4a8bbd0..0000000
--- a/Tests/RunCMake/CPack_NuGet/.gitattributes
+++ /dev/null
@@ -1,3 +0,0 @@
-# Do not check whitespace in the nuspec file for comparison. It needs to
-# look identical to the file generated in the test.
-expected.nuspec -whitespace
diff --git a/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake b/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake
index e83f007..6e930b6 100644
--- a/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake
+++ b/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake
@@ -3,9 +3,9 @@ if(NOT generated_nuspec)
set(RunCMake_TEST_FAILED "No nuspec file generated under ${RunCMake_TEST_BINARY_DIR}")
else()
# Read in the generated nuspec file content
- file(READ "${generated_nuspec}" actual_nuspec)
+ file(STRINGS "${generated_nuspec}" actual_nuspec REGEX "^.*[^ ]+$")
# Read in the expected file content
- file(READ "${CMAKE_CURRENT_LIST_DIR}/expected.nuspec" expected_nuspec)
+ file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/expected.nuspec" expected_nuspec REGEX "^.*[^ ]+$")
# Compare the file contents
string(COMPARE EQUAL "${actual_nuspec}" "${expected_nuspec}" nuspec_matches)
diff --git a/Tests/RunCMake/CPack_NuGet/expected.nuspec b/Tests/RunCMake/CPack_NuGet/expected.nuspec
index d5c6c45..3d96df0 100644
--- a/Tests/RunCMake/CPack_NuGet/expected.nuspec
+++ b/Tests/RunCMake/CPack_NuGet/expected.nuspec
@@ -6,22 +6,11 @@
<version>1.2.3</version>
<description><![CDATA[A NuGet package for testing CMake's CPack NuGet generator]]></description>
<authors><![CDATA[ACME Inc]]></authors>
-
<!-- Optional elements -->
-
<owners><![CDATA[ACME Inc]]></owners>
<projectUrl><![CDATA[https://www.example.com]]></projectUrl>
-
<license type="expression"><![CDATA[MIT]]></license>
-
-
-
-
<summary><![CDATA[A test NuGet package]]></summary>
-
-
-
-
<repository type="git" url="https://github.com/example/nugetlib.git" />
<dependencies>
<group>
@@ -34,5 +23,4 @@
<group targetFramework="net6.0" />
</dependencies>
</metadata>
-
</package>
diff --git a/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt
index e6f9325..45230f7 100644
--- a/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt
+++ b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt
@@ -1,3 +1,3 @@
Cannot find file: [^
]*/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-build/DartConfiguration.tcl
-Binary directory is not set. No coverage checking will be performed.$
+ Cannot find any coverage files\. Ignoring Coverage request\.$
diff --git a/Tests/RunCMake/CTestCommandLine/EmptyDirTest-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/EmptyDirTest-ctest-stderr.txt
new file mode 100644
index 0000000..d9c2ecb
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/EmptyDirTest-ctest-stderr.txt
@@ -0,0 +1,3 @@
+Cannot find file: [^
+]*/Tests/RunCMake/CTestCommandLine/EmptyDirTest-ctest-build/DartConfiguration.tcl
+No tests were found!!!$
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index b2374ca..3e30e35 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -355,6 +355,9 @@ function(run_TestOutputSize)
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}/DartConfiguration.tcl" "
+BuildDirectory: ${RunCMake_TEST_BINARY_DIR}
+")
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(PassingTest \"${CMAKE_COMMAND}\" -E echo PassingTestOutput)
add_test(FailingTest \"${CMAKE_COMMAND}\" -E no_such_command)
@@ -375,6 +378,9 @@ function(run_TestOutputTruncation mode expected)
set(TRUNCATED_OUTPUT ${expected}) # used in TestOutputTruncation-check.cmake
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/DartConfiguration.tcl" "
+BuildDirectory: ${RunCMake_TEST_BINARY_DIR}
+")
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(Truncation_${mode} \"${CMAKE_COMMAND}\" -E echo 123456789)
")
@@ -463,10 +469,14 @@ function(run_ShowOnly)
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo)
set_tests_properties(ShowOnly PROPERTIES
- WILL_FAIL true
+ GENERATED_RESOURCE_SPEC_FILE \"/Path/Does/Not/Exist\"
RESOURCE_GROUPS \"2,threads:2,gpus:4;gpus:2,threads:4\"
REQUIRED_FILES RequiredFileDoesNotExist
_BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\"
+ TIMEOUT 1234.5
+ TIMEOUT_SIGNAL_NAME SIGINT
+ TIMEOUT_SIGNAL_GRACE_PERIOD 2.1
+ WILL_FAIL true
USER_DEFINED_A \"User defined property A value\"
USER_DEFINED_B \"User defined property B value\"
)
@@ -544,8 +554,14 @@ set(ENV{CMAKE_TLS_VERIFY} 0) # Test fallback to env variable.
run_FailDrop(TLSVerify-OFF-env)
unset(ENV{CMAKE_TLS_VERIFY})
+run_cmake_command(EmptyDirTest-ctest
+ ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Test
+ )
+
run_cmake_command(EmptyDirCoverage-ctest
- ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage
+ # Isolate this test from any surrounding coverage tool.
+ ${CMAKE_COMMAND} -E env --unset=COVFILE
+ ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage
)
function(run_MemCheckSan case opts)
@@ -614,6 +630,21 @@ run_output_junit()
run_cmake_command(invalid-ctest-argument ${CMAKE_CTEST_COMMAND} --not-a-valid-ctest-argument)
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeoutDefault)
+ 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}/DartConfiguration.tcl" "
+BuildDirectory: ${RunCMake_TEST_BINARY_DIR}
+")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+add_test(test1 \"${CMAKE_COMMAND}\" -E true)
+")
+ run_cmake_command(TimeoutDefault ${CMAKE_CTEST_COMMAND} -V)
+ run_cmake_command(TimeoutDefault-T-Test ${CMAKE_CTEST_COMMAND} -V -T Test)
+endblock()
+
if(WIN32)
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeoutSignalWindows)
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
deleted file mode 100644
index 19310b8..0000000
--- a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputSize/DartConfiguration.tcl
-Errors while running CTest
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt
deleted file mode 100644
index 30b46ce..0000000
--- a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt
deleted file mode 100644
index 30b46ce..0000000
--- a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt
deleted file mode 100644
index 30b46ce..0000000
--- a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl
diff --git a/Tests/RunCMake/CTestCommandLine/TimeoutDefault-T-Test-stdout.txt b/Tests/RunCMake/CTestCommandLine/TimeoutDefault-T-Test-stdout.txt
new file mode 100644
index 0000000..c753544
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TimeoutDefault-T-Test-stdout.txt
@@ -0,0 +1,2 @@
+1: Test timeout computed to be: 10000000
+1/1 Test #1: test1[ ]
diff --git a/Tests/RunCMake/CTestCommandLine/TimeoutDefault-stdout.txt b/Tests/RunCMake/CTestCommandLine/TimeoutDefault-stdout.txt
new file mode 100644
index 0000000..c753544
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TimeoutDefault-stdout.txt
@@ -0,0 +1,2 @@
+1: Test timeout computed to be: 10000000
+1/1 Test #1: test1[ ]
diff --git a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
index f9667ae..504bd3f 100644
--- a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
+++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
@@ -1,3 +1,5 @@
+import sys
+
from show_only_json_check import *
def check_kind(k):
@@ -57,12 +59,20 @@ def check_command(c):
assert is_list(c)
assert len(c) == 3
assert is_string(c[0])
- check_re(c[0], "/cmake(\.exe)?$")
+ check_re(c[0], r"/cmake(\.exe)?$")
assert is_string(c[1])
assert c[1] == "-E"
assert is_string(c[2])
assert c[2] == "echo"
+def check_generated_resource_spec_file_property(p):
+ assert is_dict(p)
+ assert sorted(p.keys()) == ["name", "value"]
+ assert is_string(p["name"])
+ assert is_string(p["value"])
+ assert p["name"] == "GENERATED_RESOURCE_SPEC_FILE"
+ assert p["value"] == "/Path/Does/Not/Exist"
+
def check_reqfiles_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
@@ -72,6 +82,30 @@ def check_reqfiles_property(p):
assert len(p["value"]) == 1
assert p["value"][0] == "RequiredFileDoesNotExist"
+def check_timeout_property(p):
+ assert is_dict(p)
+ assert sorted(p.keys()) == ["name", "value"]
+ assert is_string(p["name"])
+ assert is_float(p["value"])
+ assert p["name"] == "TIMEOUT"
+ assert p["value"] == 1234.5
+
+def check_timeout_signal_name_property(p):
+ assert is_dict(p)
+ assert sorted(p.keys()) == ["name", "value"]
+ assert is_string(p["name"])
+ assert is_string(p["value"])
+ assert p["name"] == "TIMEOUT_SIGNAL_NAME"
+ assert p["value"] == "SIGINT"
+
+def check_timeout_signal_grace_property(p):
+ assert is_dict(p)
+ assert sorted(p.keys()) == ["name", "value"]
+ assert is_string(p["name"])
+ assert is_float(p["value"])
+ assert p["name"] == "TIMEOUT_SIGNAL_GRACE_PERIOD"
+ assert p["value"] == 2.1
+
def check_willfail_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
@@ -155,12 +189,26 @@ def check_defined_properties(p_list):
def check_properties(p):
assert is_list(p)
- 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])
+ if sys.platform in ("win32"):
+ assert len(p) == 8
+ check_generated_resource_spec_file_property(p[0])
+ check_resource_groups_property(p[1])
+ check_reqfiles_property(p[2])
+ check_timeout_property(p[3])
+ check_willfail_property(p[4])
+ check_workingdir_property(p[5])
+ check_defined_properties(p[6:7])
+ else:
+ assert len(p) == 10
+ check_generated_resource_spec_file_property(p[0])
+ check_resource_groups_property(p[1])
+ check_reqfiles_property(p[2])
+ check_timeout_property(p[3])
+ check_timeout_signal_name_property(p[4])
+ check_timeout_signal_grace_property(p[5])
+ check_willfail_property(p[6])
+ check_workingdir_property(p[7])
+ check_defined_properties(p[8:9])
def check_tests(t):
assert is_list(t)
diff --git a/Tests/RunCMake/CTestCommandLine/show_only_json_check.py b/Tests/RunCMake/CTestCommandLine/show_only_json_check.py
index 493c9e5..3310db7 100644
--- a/Tests/RunCMake/CTestCommandLine/show_only_json_check.py
+++ b/Tests/RunCMake/CTestCommandLine/show_only_json_check.py
@@ -14,6 +14,9 @@ def is_list(x):
def is_int(x):
return isinstance(x, int) or isinstance(x, long)
+def is_float(x):
+ return isinstance(x, float)
+
def is_string(x):
return isinstance(x, str) or isinstance(x, unicode)
diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt
index 017ccb0..6b16868 100644
--- a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt
+++ b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt
@@ -1 +1 @@
-Failed to change working directory to ".*/non-existing-dir" : No such file or directory
+Failed to change working directory to ".*/non-existing-dir": No such file or directory
diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt
deleted file mode 100644
index ddcd238..0000000
--- a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
-Internal ctest changing into directory: .*/non-existing-dir
diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
index 2824fbf..2bb1386 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
+++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
@@ -37,13 +37,13 @@
* being allocated, or allocated without being deallocated.
*/
-static int usage(const char* argv0)
+static int usage(char const* argv0)
{
std::cout << "Usage: " << argv0 << " (write|verify) <args...>" << std::endl;
return 1;
}
-static int usageWrite(const char* argv0)
+static int usageWrite(char const* argv0)
{
std::cout << "Usage: " << argv0
<< " write <log-file> <test-name> <sleep-time-secs>"
@@ -52,7 +52,7 @@ static int usageWrite(const char* argv0)
return 1;
}
-static int usageVerify(const char* argv0)
+static int usageVerify(char const* argv0)
{
std::cout << "Usage: " << argv0
<< " verify <log-file> <resource-spec-file> [<test-names>]"
@@ -83,7 +83,7 @@ static int doWrite(int argc, char const* const* argv)
assert(result);
// Verify group count
- const char* resourceGroupCountEnv =
+ char const* resourceGroupCountEnv =
cmSystemTools::GetEnv("CTEST_RESOURCE_GROUP_COUNT");
if (!resourceGroupCountEnv) {
std::cout << "CTEST_RESOURCE_GROUP_COUNT should be defined" << std::endl;
@@ -122,9 +122,8 @@ static int doWrite(int argc, char const* const* argv)
expectedResources.insert(it.ResourceType);
}
- std::string prefix = "CTEST_RESOURCE_GROUP_";
- prefix += std::to_string(i);
- const char* actualResourcesCStr = cmSystemTools::GetEnv(prefix);
+ std::string prefix = cmStrCat("CTEST_RESOURCE_GROUP_", i);
+ char const* actualResourcesCStr = cmSystemTools::GetEnv(prefix);
if (!actualResourcesCStr) {
std::cout << prefix << " should be defined" << std::endl;
return 1;
@@ -155,7 +154,7 @@ static int doWrite(int argc, char const* const* argv)
std::string varName = prefix;
varName += cmSystemTools::UpperCase(type);
- const char* varVal = cmSystemTools::GetEnv(varName);
+ char const* varVal = cmSystemTools::GetEnv(varName);
if (!varVal) {
std::cout << varName << " should be defined" << std::endl;
return 1;
diff --git a/Tests/RunCMake/CTestResourceAllocation/test.cmake.in b/Tests/RunCMake/CTestResourceAllocation/test.cmake.in
index 319ebf1..3237ef0 100644
--- a/Tests/RunCMake/CTestResourceAllocation/test.cmake.in
+++ b/Tests/RunCMake/CTestResourceAllocation/test.cmake.in
@@ -31,10 +31,18 @@ elseif(CTEST_RESOURCE_SPEC_SOURCE STREQUAL "CACHE")
list(APPEND config_options "-DCTEST_RESOURCE_SPEC_FILE=@RunCMake_SOURCE_DIR@/resspec.json")
endif()
+set(test_args)
+if(DEFINED CTEST_PARALLEL)
+ list(APPEND test_args PARALLEL_LEVEL ${CTEST_PARALLEL})
+endif()
+if(DEFINED CTEST_RANDOM)
+ list(APPEND test_args SCHEDULE_RANDOM ${CTEST_RANDOM})
+endif()
+
ctest_start(Experimental QUIET)
ctest_configure(OPTIONS "${config_options}")
ctest_build()
-ctest_test(${resspec} RETURN_VALUE retval PARALLEL_LEVEL ${CTEST_PARALLEL} SCHEDULE_RANDOM ${CTEST_RANDOM})
+ctest_test(${resspec} RETURN_VALUE retval ${test_args})
if(retval)
message(FATAL_ERROR "Tests did not pass")
endif()
diff --git a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
index 470bbd8..6b4b96a 100644
--- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
@@ -34,7 +34,7 @@ else()
target_compile_definitions(TestTimeout PRIVATE SIGNAL)
set_tests_properties(TestTimeout PROPERTIES
TIMEOUT_SIGNAL_NAME SIGUSR1
- TIMEOUT_SIGNAL_GRACE_PERIOD 1.2
+ TIMEOUT_SIGNAL_GRACE_PERIOD 32.1
)
]])
run_ctest_timeout(Signal)
@@ -91,7 +91,7 @@ endblock()
block()
set(TIMEOUT 4)
set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)")
- set(CASE_CMAKELISTS_SUFFIX_CODE "set_property(TEST TestTimeout PROPERTY TIMEOUT 10)\n")
+ set(CASE_CMAKELISTS_SUFFIX_CODE "set_property(TEST TestTimeout PROPERTY TIMEOUT 60)\n")
run_ctest_timeout(PropertyOverridesVar)
endblock()
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 47475d3..8ed2f97 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -1,8 +1,5 @@
include(RunCMake)
-# For `if (IN_LIST)`
-cmake_policy(SET CMP0057 NEW)
-
run_cmake(Inspect)
include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
diff --git a/Tests/RunCMake/CXXModules/check-json.cmake b/Tests/RunCMake/CXXModules/check-json.cmake
index 8d95973..09edc33 100644
--- a/Tests/RunCMake/CXXModules/check-json.cmake
+++ b/Tests/RunCMake/CXXModules/check-json.cmake
@@ -1,6 +1,3 @@
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW)
-
function (json_placeholders in out)
string(REPLACE "<CONFIG>" "${CXXModules_config}" in "${in}")
string(TOLOWER "${CXXModules_config}" config_lower)
@@ -50,8 +47,8 @@ endfunction ()
function (check_json_value path actual_type expect_type actual_value expect_value)
if (NOT actual_type STREQUAL expect_type)
- list(APPEND RunCMake_TEST_FAILED
- "Type mismatch at ${path}: ${actual_type} vs. ${expect_type}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Type mismatch at:\n ${path}\nexpected:\n ${expect_type}\nactual:\n ${actual_type}\n")
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
return ()
endif ()
@@ -60,13 +57,13 @@ function (check_json_value path actual_type expect_type actual_value expect_valu
# Nothing to check
elseif (actual_type STREQUAL BOOLEAN)
if (NOT actual_value STREQUAL expect_value)
- list(APPEND RunCMake_TEST_FAILED
- "Boolean mismatch at ${path}: ${actual_value} vs. ${expect_value}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Boolean mismatch at:\n ${path}\nexpected:\n ${expect_value}\nactual:\n ${actual_value}\n")
endif ()
elseif (actual_type STREQUAL NUMBER)
if (NOT actual_value EQUAL expect_value)
- list(APPEND RunCMake_TEST_FAILED
- "Number mismatch at ${path}: ${actual_value} vs. ${expect_value}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Number mismatch at:\n ${path}\nexpected:\n ${expect_value}\nactual:\n ${actual_value}\n")
endif ()
elseif (actual_type STREQUAL STRING)
# Allow some values to be ignored.
@@ -79,24 +76,24 @@ function (check_json_value path actual_type expect_type actual_value expect_valu
string(REPLACE "\\" "/" actual_value_check "${actual_value}")
string(REGEX REPLACE "^\"(.*)\"$" "\\1" actual_value_check "${actual_value_check}")
if (NOT actual_value_check MATCHES "^${expect_value_expanded}$")
- list(APPEND RunCMake_TEST_FAILED
- "String mismatch (path regex) at ${path}: ${actual_value} vs. ^${expect_value_expanded}$")
+ string(APPEND RunCMake_TEST_FAILED
+ "String mismatch (path regex) at:\n ${path}\nexpected:\n ^${expect_value_expanded}$\nactual:\n ${actual_value}\n")
endif ()
elseif (expect_value MATCHES "^REGEX:")
if (NOT actual_value MATCHES "^${expect_value_expanded}$")
- list(APPEND RunCMake_TEST_FAILED
- "String mismatch (regex) at ${path}: ${actual_value} vs. ^${expect_value_expanded}$")
+ string(APPEND RunCMake_TEST_FAILED
+ "String mismatch (regex) at:\n ${path}\nexpected:\n ^${expect_value_expanded}$\nactual:\n ${actual_value}\n")
endif ()
elseif (expect_value MATCHES "^PATH:")
string(REPLACE "\\" "/" actual_value_check "${actual_value}")
string(REGEX REPLACE "^\"(.*)\"$" "\\1" actual_value_check "${actual_value_check}")
if (NOT actual_value_check STREQUAL "${expect_value_expanded}")
- list(APPEND RunCMake_TEST_FAILED
- "String mismatch (path) at ${path}: ${actual_value} vs. ^${expect_value_expanded}$")
+ string(APPEND RunCMake_TEST_FAILED
+ "String mismatch (path) at:\n ${path}\nexpected:\n ${expect_value_expanded}\nactual:\n ${actual_value}\n")
endif ()
elseif (NOT actual_value STREQUAL expect_value_expanded)
- list(APPEND RunCMake_TEST_FAILED
- "String mismatch at ${path}: ${actual_value} vs. ${expect_value_expanded}")
+ string(APPEND RunCMake_TEST_FAILED
+ "String mismatch at:\n ${path}\nexpected:\n ${expect_value_expanded}\nactual:\n ${actual_value}\n")
endif ()
elseif (actual_type STREQUAL ARRAY)
check_json_array("${path}" "${actual_value}" "${expect_value}")
@@ -130,11 +127,11 @@ function (check_json_array path actual expect)
set(iter_len "${actual_len}")
if (actual_len LESS expect_len)
- list(APPEND RunCMake_TEST_FAILED
- "Missing array items at ${path}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Missing array items at:\n ${path}\n")
elseif (expect_len LESS actual_len)
- list(APPEND RunCMake_TEST_FAILED
- "Extra array items at ${path}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Extra array items at:\n ${path}\n")
set(iter_len "${expect_len}")
endif ()
@@ -200,13 +197,13 @@ function (check_json_object path actual expect)
if (actual_keys_missed)
string(REPLACE ";" ", " actual_keys_missed_text "${actual_keys_missed}")
- list(APPEND RunCMake_TEST_FAILED
- "Extra unexpected members at ${path}: ${actual_keys_missed_text}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Extra unexpected members at:\n ${path}\nactual:\n ${actual_keys_missed_text}\n")
endif ()
if (expect_keys_missed)
string(REPLACE ";" ", " expect_keys_missed_text "${expect_keys_missed}")
- list(APPEND RunCMake_TEST_FAILED
- "Missing expected members at ${path}: ${expect_keys_missed_text}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Missing expected members at\n ${path}\nactual:\n ${expect_keys_missed_text}\n")
endif ()
foreach (key IN LISTS common_keys)
@@ -228,5 +225,3 @@ function (check_json actual expect)
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endfunction ()
-
-cmake_policy(POP)
diff --git a/Tests/RunCMake/CXXModules/examples/build-database-check.cmake b/Tests/RunCMake/CXXModules/examples/build-database-check.cmake
index 734b580..c09acea 100644
--- a/Tests/RunCMake/CXXModules/examples/build-database-check.cmake
+++ b/Tests/RunCMake/CXXModules/examples/build-database-check.cmake
@@ -1,6 +1,3 @@
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW)
-
include("${CMAKE_CURRENT_LIST_DIR}/../check-json.cmake")
function (check_build_database expect_basename fname component)
@@ -77,5 +74,3 @@ function (check_build_database expect_basename fname component)
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endfunction ()
-
-cmake_policy(POP)
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stderr.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stderr.txt
new file mode 100644
index 0000000..375ab1d
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0138-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0138 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/CommandLine/C_basic-stdout.txt b/Tests/RunCMake/CommandLine/C_basic-stdout.txt
index 74a938e..1cb0322 100644
--- a/Tests/RunCMake/CommandLine/C_basic-stdout.txt
+++ b/Tests/RunCMake/CommandLine/C_basic-stdout.txt
@@ -1 +1 @@
-loading initial cache file ../C_basic_initial-cache.txt
+loading initial cache file \.\./C_basic_initial-cache.txt
diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt b/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt
index 32724f5..700e449 100644
--- a/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt
+++ b/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt
@@ -1 +1,2 @@
-loading initial cache file .*/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt
+loading initial cache file [^
+]*/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt
diff --git a/Tests/RunCMake/CommandLine/D-tilde.cmake b/Tests/RunCMake/CommandLine/D-tilde.cmake
new file mode 100644
index 0000000..63028ea
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/D-tilde.cmake
@@ -0,0 +1,21 @@
+if(NOT "$ENV{HOME}" STREQUAL "")
+ if(TILDE_PATH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_PATH}")
+ message(SEND_ERROR "~ not expanded as expected:\n ${TILDE_PATH}")
+ endif()
+
+ if(TILDE_SLASH_PATH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_SLASH_PATH}" OR NOT TILDE_SLASH_PATH MATCHES "/InHome$")
+ message(SEND_ERROR "~/ not expanded as expected:\n ${TILDE_SLASH_PATH}")
+ endif()
+else()
+ set(ENV{HOME} "${CMAKE_CURRENT_LIST_DIR}")
+endif()
+
+set(TILDE "" CACHE PATH "")
+if(TILDE MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE}")
+ message(SEND_ERROR "~ not expanded as expected:\n ${TILDE}")
+endif()
+
+set(TILDE_SLASH "" CACHE PATH "")
+if(TILDE_SLASH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_SLASH}" OR NOT TILDE_SLASH MATCHES "/InHome$")
+ message(SEND_ERROR "~/ not expanded as expected:\n ${TILDE_SLASH}")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
index 0c2a951..51b7e25 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":1}]},{"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":8}]},{"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/CommandLine/Envgen-bad-help-stdout.txt b/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt
index 075c48c..cd43295 100644
--- a/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt
+++ b/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt
@@ -1,2 +1,2 @@
Generators.*
-\* (Unix Makefiles|Visual Studio).*
+\* (Unix Makefiles|NMake Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt b/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt
index 4a1215e..aebe93a 100644
--- a/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt
+++ b/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt
@@ -2,4 +2,4 @@
CMake Error: CMAKE_GENERATOR was set but the specified generator doesn't exist. Using CMake default.
Generators.*
-\* (Unix Makefiles|Visual Studio).*
+\* (Unix Makefiles|NMake Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt b/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt
index ec6ec92..12085ad 100644
--- a/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt
+++ b/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt
@@ -1,4 +1,4 @@
^CMake Error: No generator specified for -G
Generators.*
-\* (Unix Makefiles|Visual Studio).*
+\* (Unix Makefiles|NMake Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt b/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt
index 47f9c9e..68d1d12 100644
--- a/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt
+++ b/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt
@@ -4,4 +4,4 @@ Warning: Environment variable CMAKE_GENERATOR_TOOLSET will be ignored, because C
CMake Error: No generator specified for -G
Generators.*
-\* (Unix Makefiles|Visual Studio).*
+\* (Unix Makefiles|NMake Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs-C_buildsrcdir-stdout.txt b/Tests/RunCMake/CommandLine/ExplicitDirs-C_buildsrcdir-stdout.txt
index 862cfeb..c73adbd 100644
--- a/Tests/RunCMake/CommandLine/ExplicitDirs-C_buildsrcdir-stdout.txt
+++ b/Tests/RunCMake/CommandLine/ExplicitDirs-C_buildsrcdir-stdout.txt
@@ -1,2 +1,2 @@
-loading initial cache file .*initial-cache.txt
-.*
+loading initial cache file [^
+]*initial-cache.txt
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 89e513b..9fda9eb 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -18,6 +18,7 @@ run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt)
run_cmake_command(D-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -D)
run_cmake_command(D-no-src ${CMAKE_COMMAND} -B DummyBuildDir -D VAR=VALUE)
run_cmake_command(Dno-src ${CMAKE_COMMAND} -B DummyBuildDir -DVAR=VALUE)
+run_cmake_script(D-tilde -DTILDE=~ -DTILDE_PATH:PATH=~ -DTILDE_SLASH=~/InHome -DTILDE_SLASH_PATH:PATH=~/InHome)
run_cmake_command(U-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -U)
run_cmake_command(U-no-src ${CMAKE_COMMAND} -B DummyBuildDir -U VAR)
run_cmake_command(Uno-src ${CMAKE_COMMAND} -B DummyBuildDir -UVAR)
@@ -263,6 +264,10 @@ function(run_Toolchain)
run_cmake_with_options(toolchain-no-arg -S ${source_dir} --toolchain=)
run_cmake_with_options(toolchain-valid-abs-path -S ${source_dir} --toolchain "${source_dir}/toolchain.cmake")
run_cmake_with_options(toolchain-valid-rel-src-path -S ${source_dir} --toolchain=toolchain.cmake)
+ run_cmake_with_options(toolchain-D-abs-path -S ${source_dir} -DCMAKE_TOOLCHAIN_FILE=${source_dir}/toolchain.cmake)
+ if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN" AND NOT CMAKE_SYSTEM_NAME STREQUAL "MSYS")
+ run_cmake_with_options(toolchain-D-slash-abs-path -S ${source_dir} -DCMAKE_TOOLCHAIN_FILE=/${source_dir}/toolchain.cmake)
+ endif()
set(RunCMake_TEST_NO_CLEAN 1)
set(binary_dir ${RunCMake_BINARY_DIR}/Toolchain-build)
@@ -273,7 +278,6 @@ function(run_Toolchain)
# precedence over source dir
file(WRITE ${binary_dir}/toolchain.cmake [=[
set(CMAKE_SYSTEM_NAME Linux)
-set(toolchain_file binary_dir)
]=])
run_cmake_with_options(toolchain-valid-rel-build-path -S ${source_dir} -B ${binary_dir} --toolchain toolchain.cmake)
endfunction()
@@ -434,7 +438,7 @@ function(run_EnvironmentExportCompileCommands)
run_cmake(env-export-compile-commands-override)
unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS})
-endfunction(run_EnvironmentExportCompileCommands)
+endfunction()
if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja")
run_EnvironmentExportCompileCommands()
@@ -895,10 +899,31 @@ run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1)
run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1)
run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR})
-run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake)
-# Documented to return the same result as above even if -S and -B are set to something else.
-# Tests the values of CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR.
-run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake -S something_else -B something_else_1)
+
+block()
+ set(expect ${RunCMake_BINARY_DIR}/P_working-dir-build)
+ run_cmake_script(P_working-dir -DEXPECTED_WORKING_DIR=${expect})
+
+ # -S and -B have no effect on script mode variables.
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-S-B")
+ run_cmake_script(P_working-dir -DEXPECTED_WORKING_DIR=${expect} -S something_else -B something_else_1)
+
+ # Relative PWD is ignored.
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-PWD-.")
+ set(RunCMake_TEST_COMMAND_PWD .)
+ run_cmake_script(P_working-dir -DEXPECTED_WORKING_DIR=${expect})
+
+ # Lower-case PWD is ignored on case-sensitive filesystems
+ # and case-normalized on case-insensitive filesystems.
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-PWD-case")
+ string(TOLOWER "${expect}" RunCMake_TEST_COMMAND_PWD)
+ run_cmake_script(P_working-dir -DEXPECTED_WORKING_DIR=${expect})
+
+ # Backslashed PWD is normalized on Windows and ignored elsewhere.
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-PWD-backslash")
+ string(REPLACE "/" "\\" RunCMake_TEST_COMMAND_PWD "${expect}")
+ run_cmake_script(P_working-dir -DEXPECTED_WORKING_DIR=${expect})
+endblock()
# Place an initial cache where C_basic will find it when passed the relative path "..".
file(COPY ${RunCMake_SOURCE_DIR}/C_basic_initial-cache.txt DESTINATION ${RunCMake_BINARY_DIR})
diff --git a/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt b/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt
index 80d42b8..d49b684 100644
--- a/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt
+++ b/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.20)
project(Toolchain LANGUAGES NONE)
-message(FATAL_ERROR "${toolchain_file}")
+message(STATUS "CMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}'")
diff --git a/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake b/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake
index 719556c..99c2301 100644
--- a/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake
+++ b/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake
@@ -1,2 +1 @@
set(CMAKE_SYSTEM_NAME Linux)
-set(toolchain_file source_dir)
diff --git a/Tests/RunCMake/CommandLine/toolchain-D-abs-path-stdout.txt b/Tests/RunCMake/CommandLine/toolchain-D-abs-path-stdout.txt
new file mode 100644
index 0000000..753f00b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/toolchain-D-abs-path-stdout.txt
@@ -0,0 +1 @@
+CMAKE_TOOLCHAIN_FILE='[^']*/Tests/RunCMake/CommandLine/Toolchain/toolchain\.cmake'
diff --git a/Tests/RunCMake/CommandLine/toolchain-D-slash-abs-path-stdout.txt b/Tests/RunCMake/CommandLine/toolchain-D-slash-abs-path-stdout.txt
new file mode 100644
index 0000000..9e9781f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/toolchain-D-slash-abs-path-stdout.txt
@@ -0,0 +1 @@
+CMAKE_TOOLCHAIN_FILE='/[^/][^']*/Tests/RunCMake/CommandLine/Toolchain/toolchain\.cmake'
diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt
deleted file mode 100644
index 21d5db6..0000000
--- a/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CMake Error.*source_dir
diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stdout.txt b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stdout.txt
new file mode 100644
index 0000000..753f00b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stdout.txt
@@ -0,0 +1 @@
+CMAKE_TOOLCHAIN_FILE='[^']*/Tests/RunCMake/CommandLine/Toolchain/toolchain\.cmake'
diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt
deleted file mode 100644
index 0475546..0000000
--- a/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^CMake Error at CMakeLists.txt:[0-9] \(message\):
- binary_dir$
diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stdout.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stdout.txt
new file mode 100644
index 0000000..659cf5f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stdout.txt
@@ -0,0 +1 @@
+CMAKE_TOOLCHAIN_FILE='[^']*/Tests/RunCMake/CommandLine/Toolchain-build/toolchain\.cmake'
diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt
deleted file mode 100644
index 21d5db6..0000000
--- a/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CMake Error.*source_dir
diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stdout.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stdout.txt
new file mode 100644
index 0000000..753f00b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stdout.txt
@@ -0,0 +1 @@
+CMAKE_TOOLCHAIN_FILE='[^']*/Tests/RunCMake/CommandLine/Toolchain/toolchain\.cmake'
diff --git a/Tests/RunCMake/CommandLine/trace-expand-warn-uninitialized.cmake b/Tests/RunCMake/CommandLine/trace-expand-warn-uninitialized.cmake
index ec3e4d4..f8f0c8f 100644
--- a/Tests/RunCMake/CommandLine/trace-expand-warn-uninitialized.cmake
+++ b/Tests/RunCMake/CommandLine/trace-expand-warn-uninitialized.cmake
@@ -1,4 +1 @@
-cmake_policy(SET CMP0053 OLD)
-message(STATUS "'${uninitialized_variable}'")
-cmake_policy(SET CMP0053 NEW)
message(STATUS "'${uninitialized_variable}'")
diff --git a/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt b/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt
index 41ba098..623b86d 100644
--- a/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt
+++ b/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt
@@ -1,52 +1,22 @@
-^CMake Warning \(dev\) at warn-uninitialized.cmake:3 \(set\):
- uninitialized variable 'OLD_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at warn-uninitialized.cmake:4 \(set\):
- uninitialized variable 'OLD_WARN_FROM_NORMAL_CMAKE_FILE_IN_ATS'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at warn-uninitialized.cmake:5 \(string\):
- uninitialized variable 'OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at warn-uninitialized.cmake:7 \(configure_file\):
- uninitialized variable 'OLD_WARN_FROM_CONFIGURE_FILE_INSIDE_AT'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at warn-uninitialized.cmake:8 \(string\):
- uninitialized variable 'OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_AT'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at warn-uninitialized.cmake:13 \(set\):
+CMake Warning \(dev\) at warn-uninitialized.cmake:1 \(set\):
uninitialized variable 'NEW_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES'
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
-CMake Warning \(dev\) at warn-uninitialized.cmake:14 \(string\):
+CMake Warning \(dev\) at warn-uninitialized.cmake:2 \(string\):
uninitialized variable 'NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES'
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
-CMake Warning \(dev\) at warn-uninitialized.cmake:16 \(configure_file\):
+CMake Warning \(dev\) at warn-uninitialized.cmake:4 \(configure_file\):
uninitialized variable 'NEW_WARN_FROM_CONFIGURE_FILE_INSIDE_AT'
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
-CMake Warning \(dev\) at warn-uninitialized.cmake:17 \(string\):
+CMake Warning \(dev\) at warn-uninitialized.cmake:5 \(string\):
uninitialized variable 'NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_AT'
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CommandLine/warn-uninitialized.cmake b/Tests/RunCMake/CommandLine/warn-uninitialized.cmake
index ff65c16..4163654 100644
--- a/Tests/RunCMake/CommandLine/warn-uninitialized.cmake
+++ b/Tests/RunCMake/CommandLine/warn-uninitialized.cmake
@@ -1,18 +1,5 @@
-cmake_policy(PUSH)
-cmake_policy(SET CMP0053 OLD)
-set(FOO "${OLD_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES}")
-set(FOO "@OLD_WARN_FROM_NORMAL_CMAKE_FILE_IN_ATS@")
-string(CONFIGURE "\${OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES}" OUT1)
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/file1.in "\@OLD_WARN_FROM_CONFIGURE_FILE_INSIDE_AT\@")
-configure_file(${CMAKE_CURRENT_BINARY_DIR}/file1.in file1.out)
-string(CONFIGURE "\@OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_AT\@" OUT2)
-cmake_policy(POP)
-
-cmake_policy(PUSH)
-cmake_policy(SET CMP0053 NEW)
set(FOO "${NEW_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES}")
string(CONFIGURE "\${NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES}" OUT3)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/file2.in "\@NEW_WARN_FROM_CONFIGURE_FILE_INSIDE_AT\@")
configure_file(${CMAKE_CURRENT_BINARY_DIR}/file2.in file2.out)
string(CONFIGURE "@NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_AT@" OUT4)
-cmake_policy(POP)
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 487284b..508662e 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0057 NEW)
include(RunCMake)
run_cmake(NotAFeature)
diff --git a/Tests/RunCMake/ConfigDir/check-reply.cmake b/Tests/RunCMake/ConfigDir/check-reply.cmake
index 6e0ecf9..eb534c0 100644
--- a/Tests/RunCMake/ConfigDir/check-reply.cmake
+++ b/Tests/RunCMake/ConfigDir/check-reply.cmake
@@ -1,3 +1,6 @@
if (NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/reply)
set(RunCMake_TEST_FAILED "Failed to read FileAPI query from user config directory")
endif()
+if (NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/.cmake/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0/v1/data)
+ set(RunCMake_TEST_FAILED "Failed to read Instrumentation query from user config directory")
+endif()
diff --git a/Tests/RunCMake/ConfigDir/config/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0/v1/query/query.json b/Tests/RunCMake/ConfigDir/config/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0/v1/query/query.json
new file mode 100644
index 0000000..61a2092
--- /dev/null
+++ b/Tests/RunCMake/ConfigDir/config/instrumentation-a37d1069-1972-4901-b9c9-f194aaf2b6e0/v1/query/query.json
@@ -0,0 +1,3 @@
+{
+ "version": 1
+}
diff --git a/Tests/RunCMake/Configure/CacheVarHelpString.cmake b/Tests/RunCMake/Configure/CacheVarHelpString.cmake
new file mode 100644
index 0000000..262e527
--- /dev/null
+++ b/Tests/RunCMake/Configure/CacheVarHelpString.cmake
@@ -0,0 +1,21 @@
+# Various newline possibilities
+
+set(help_strings
+ "\n"
+ "\n\n\n"
+ "\n \n"
+ "\nline1"
+ "line1\n"
+ "\nline1\n"
+ "line1\nline2\nline3"
+ "\nline1\nline2\nline3\n"
+ "
+line line line line line line line line line line line line line line line line
+line line line line line line line line line line line line line line line line
+line line line line line line line line line line line line line line line line"
+)
+
+foreach(help IN LISTS help_strings)
+ string(SHA1 name "${help}")
+ set("${name}" "" CACHE STRING "${help}" FORCE)
+endforeach()
diff --git a/Tests/RunCMake/Configure/RerunCMakeNinja-build1-check.cmake b/Tests/RunCMake/Configure/RerunCMakeNinja-build1-check.cmake
new file mode 100644
index 0000000..3fb557f
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMakeNinja-build1-check.cmake
@@ -0,0 +1,4 @@
+file(READ ${stamp} content)
+if(NOT content STREQUAL 1)
+ set(RunCMake_TEST_FAILED "Expected stamp '1' but got: '${content}'")
+endif()
diff --git a/Tests/RunCMake/Configure/RerunCMakeNinja.cmake b/Tests/RunCMake/Configure/RerunCMakeNinja.cmake
new file mode 100644
index 0000000..35e11d4
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMakeNinja.cmake
@@ -0,0 +1,16 @@
+set(input ${CMAKE_CURRENT_BINARY_DIR}/input.txt)
+set(stamp ${CMAKE_CURRENT_BINARY_DIR}/stamp.txt)
+file(READ ${input} content)
+file(WRITE ${stamp} "${content}")
+
+# Add enough subdirectories to make the total list of paths to 'cmake_install.cmake'
+# files exceed the Windows command-line length limit.
+set(length 0)
+foreach(i RANGE 1 1000)
+ if(length GREATER_EQUAL 32678)
+ break()
+ endif()
+ add_subdirectory(RerunCMakeNinja RerunCMakeNinja${i})
+ string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}/RerunCMakeNinja${i}/cmake_install.cmake" subdir_length)
+ math(EXPR length "${length} + ${subdir_length}")
+endforeach()
diff --git a/Tests/RunCMake/Configure/RerunCMakeNinja/CMakeLists.txt b/Tests/RunCMake/Configure/RerunCMakeNinja/CMakeLists.txt
new file mode 100644
index 0000000..d77c363
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMakeNinja/CMakeLists.txt
@@ -0,0 +1 @@
+# Empty subdirectory, but it has a 'cmake_install.cmake'.
diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake
index 00d3272..b29640a 100644
--- a/Tests/RunCMake/Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake
@@ -39,6 +39,24 @@ block()
endif()
endblock()
+if(RunCMake_GENERATOR MATCHES "^Ninja")
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMakeNinja-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}/input.txt")
+ set(stamp "${RunCMake_TEST_BINARY_DIR}/stamp.txt")
+ file(WRITE "${input}" "0")
+ run_cmake(RerunCMakeNinja)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
+ # remove cmake_install.cmake to trigger rerun
+ file(REMOVE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+ file(WRITE "${input}" "1")
+ run_cmake_command(RerunCMakeNinja-build1 ${CMAKE_COMMAND} --build .)
+ endblock()
+endif()
+
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RemoveCache-build)
set(RunCMake_TEST_VARIANT_DESCRIPTION "-step1")
@@ -55,6 +73,12 @@ if(NOT RunCMake_GENERATOR MATCHES "^Ninja Multi-Config$")
run_cmake(NoCMAKE_DEFAULT_CONFIGS)
endif()
+block()
+ run_cmake(CacheVarHelpString)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake(CacheVarHelpString)
+endblock()
+
if(NOT CMAKE_HOST_WIN32)
block()
# Test a non-writable build directory.
diff --git a/Tests/RunCMake/CpsExportImport/CMakeLists.txt b/Tests/RunCMake/CpsExportImport/CMakeLists.txt
new file mode 100644
index 0000000..955802c
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 4.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CpsExportImport/RunCMakeTest.cmake b/Tests/RunCMake/CpsExportImport/RunCMakeTest.cmake
new file mode 100644
index 0000000..dff26eb
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/RunCMakeTest.cmake
@@ -0,0 +1,24 @@
+include(RunCMake)
+
+set(RunCMake_TEST_OPTIONS
+ -Wno-dev
+ "-DCMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO:STRING=b80be207-778e-46ba-8080-b23bba22639e"
+ "-DCMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES:STRING=e82e467b-f997-4464-8ace-b00808fff261"
+ )
+
+function(build_project test)
+ set(RunCMake_TEST_NO_CLEAN FALSE)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(${test})
+
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Release)
+ run_cmake_command(${test}-install ${CMAKE_COMMAND} --install . --config Release)
+endfunction()
+
+build_project(TestLibrary)
+build_project(TestExecutable)
diff --git a/Tests/RunCMake/CpsExportImport/TestExecutable.cmake b/Tests/RunCMake/CpsExportImport/TestExecutable.cmake
new file mode 100644
index 0000000..cced129
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/TestExecutable.cmake
@@ -0,0 +1,12 @@
+project(TestLibrary C)
+
+set(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/../install")
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../install")
+
+find_package(libb REQUIRED COMPONENTS libb)
+
+add_executable(app app.c)
+
+target_link_libraries(app PUBLIC libb::libb)
+
+install(TARGETS app DESTINATION bin)
diff --git a/Tests/RunCMake/CpsExportImport/TestLibrary.cmake b/Tests/RunCMake/CpsExportImport/TestLibrary.cmake
new file mode 100644
index 0000000..a984f2b
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/TestLibrary.cmake
@@ -0,0 +1,14 @@
+project(TestLibrary C)
+
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../install")
+
+add_library(liba SHARED liba.c)
+add_library(libb SHARED libb.c)
+
+target_link_libraries(libb PUBLIC liba)
+
+install(TARGETS liba EXPORT liba DESTINATION lib)
+install(PACKAGE_INFO liba DESTINATION cps EXPORT liba)
+
+install(TARGETS libb EXPORT libb DESTINATION lib)
+install(PACKAGE_INFO libb DESTINATION cps EXPORT libb)
diff --git a/Tests/RunCMake/CpsExportImport/app.c b/Tests/RunCMake/CpsExportImport/app.c
new file mode 100644
index 0000000..9ad7829
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/app.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+extern
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+int ask(void);
+
+int main(void)
+{
+ printf("%i\n", ask());
+ return 0;
+}
diff --git a/Tests/RunCMake/CpsExportImport/liba.c b/Tests/RunCMake/CpsExportImport/liba.c
new file mode 100644
index 0000000..a2e2267
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/liba.c
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int answer(void)
+{
+ return 42;
+}
diff --git a/Tests/RunCMake/CpsExportImport/libb.c b/Tests/RunCMake/CpsExportImport/libb.c
new file mode 100644
index 0000000..8ba04af
--- /dev/null
+++ b/Tests/RunCMake/CpsExportImport/libb.c
@@ -0,0 +1,13 @@
+extern
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+int answer(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int ask(void)
+{
+ return answer();
+}
diff --git a/Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c b/Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c
index e6bbcff..374fb15 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c
+++ b/Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
int i;
for (i = 1; i < argc; ++i) {
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt
index e147081..52ec78d 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0029-NEW.cmake:2 \(subdir_depends\):
- The subdir_depends command should not be called; see CMP0029.
+CMake Error at CMP0029-NEW.cmake:1 \(subdir_depends\):
+ The subdir_depends command has been removed; see CMP0029.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake
index 392b9d4..1ceb1f8 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0029 NEW)
subdir_depends()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt
deleted file mode 100644
index 430c865..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Deprecation Warning at CMP0029-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0029 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/DisallowedCommands/CMP0029-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake
deleted file mode 100644
index 099fd90..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0029 OLD)
-subdir_depends()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt
deleted file mode 100644
index 32a452a..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-CMake Warning \(dev\) at CMP0029-WARN.cmake:1 \(subdir_depends\):
- Policy CMP0029 is not set: The subdir_depends command should not be called.
- Run "cmake --help-policy CMP0029" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-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/DisallowedCommands/CMP0029-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake
deleted file mode 100644
index 1ceb1f8..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-subdir_depends()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt
index cb380db..f8919f5 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0030-NEW.cmake:2 \(use_mangled_mesa\):
- The use_mangled_mesa command should not be called; see CMP0030.
+CMake Error at CMP0030-NEW.cmake:1 \(use_mangled_mesa\):
+ The use_mangled_mesa command has been removed; see CMP0030.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake
index 73365a7..cbe0ff0 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0030 NEW)
use_mangled_mesa()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt
deleted file mode 100644
index d00b827..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-^CMake Deprecation Warning at CMP0030-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0030 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 CMP0030-OLD.cmake:2 \(use_mangled_mesa\):
- use_mangled_mesa called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake
deleted file mode 100644
index efbb852..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0030 OLD)
-use_mangled_mesa()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt
deleted file mode 100644
index db3c23f13..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0030-WARN.cmake:1 \(use_mangled_mesa\):
- Policy CMP0030 is not set: The use_mangled_mesa command should not be
- called. Run "cmake --help-policy CMP0030" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0030-WARN.cmake:1 \(use_mangled_mesa\):
- use_mangled_mesa called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake
deleted file mode 100644
index cbe0ff0..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-use_mangled_mesa()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt
index 78c2236..da23be8 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0031-NEW.cmake:2 \(load_command\):
- The load_command command should not be called; see CMP0031.
+CMake Error at CMP0031-NEW.cmake:1 \(load_command\):
+ The load_command command has been removed; see CMP0031.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake
index 3d9caf2..9e9b1f4 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0031 NEW)
load_command()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt
deleted file mode 100644
index ba198d6..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0031-OLD.cmake:2 \(load_command\):
- load_command Attempt to load command failed from file.*bogus_command.*
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake
deleted file mode 100644
index 8fedf98..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0031 OLD)
-load_command(bogus_command)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt
deleted file mode 100644
index 4cb65b3..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0031-WARN.cmake:1 \(load_command\):
- Policy CMP0031 is not set: The load_command command should not be called.
- Run "cmake --help-policy CMP0031" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0031-WARN.cmake:1 \(load_command\):
- load_command Attempt to load command failed from file.*bogus_command.*
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake
deleted file mode 100644
index c9d99fc..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-load_command(bogus_command)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt
index c7ac16e..7b9f42a 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0032-NEW.cmake:2 \(output_required_files\):
- The output_required_files command should not be called; see CMP0032.
+CMake Error at CMP0032-NEW.cmake:1 \(output_required_files\):
+ The output_required_files command has been removed; see CMP0032.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake
index c6fb5e8..7411e48 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0032 NEW)
output_required_files()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt
deleted file mode 100644
index 2223c42..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0032-OLD.cmake:2 \(output_required_files\):
- output_required_files called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake
deleted file mode 100644
index 6585110..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0032 OLD)
-output_required_files()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt
deleted file mode 100644
index 0cf3f94..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0032-WARN.cmake:1 \(output_required_files\):
- Policy CMP0032 is not set: The output_required_files command should not be
- called. Run "cmake --help-policy CMP0032" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0032-WARN.cmake:1 \(output_required_files\):
- output_required_files called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake
deleted file mode 100644
index 7411e48..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-output_required_files()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt
index 8d210aa..69e0439 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0033-NEW.cmake:2 \(export_library_dependencies\):
- The export_library_dependencies command should not be called; see CMP0033.
+CMake Error at CMP0033-NEW.cmake:1 \(export_library_dependencies\):
+ The export_library_dependencies command has been removed; see CMP0033.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake
index 6f90f29..f897ddd 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0033 NEW)
export_library_dependencies()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt
deleted file mode 100644
index e5dd2dd..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0033-OLD.cmake:2 \(export_library_dependencies\):
- export_library_dependencies called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake
deleted file mode 100644
index a3504b6..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0033 OLD)
-export_library_dependencies()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt
deleted file mode 100644
index e561dac..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0033-WARN.cmake:1 \(export_library_dependencies\):
- Policy CMP0033 is not set: The export_library_dependencies command should
- not be called. Run "cmake --help-policy CMP0033" for policy details. Use
- the cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0033-WARN.cmake:1 \(export_library_dependencies\):
- export_library_dependencies called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake
deleted file mode 100644
index f897ddd..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-export_library_dependencies()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt
index 1dd279b..a3d77a6 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0034-NEW.cmake:2 \(utility_source\):
- The utility_source command should not be called; see CMP0034.
+CMake Error at CMP0034-NEW.cmake:1 \(utility_source\):
+ The utility_source command has been removed; see CMP0034.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake
index 48724a9..b4ae045 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0034 NEW)
utility_source()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt
deleted file mode 100644
index 3358628..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0034-OLD.cmake:2 \(utility_source\):
- utility_source called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake
deleted file mode 100644
index a2c9798..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0034 OLD)
-utility_source()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt
deleted file mode 100644
index ea3831f..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0034-WARN.cmake:1 \(utility_source\):
- Policy CMP0034 is not set: The utility_source command should not be called.
- Run "cmake --help-policy CMP0034" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0034-WARN.cmake:1 \(utility_source\):
- utility_source called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake
deleted file mode 100644
index b4ae045..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-utility_source()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt
index 0604829..fb21197 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0035-NEW.cmake:2 \(variable_requires\):
- The variable_requires command should not be called; see CMP0035.
+CMake Error at CMP0035-NEW.cmake:1 \(variable_requires\):
+ The variable_requires command has been removed; see CMP0035.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake
index 27eb32e..3af4de1 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0035 NEW)
variable_requires()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt
deleted file mode 100644
index 86eda43..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0035-OLD.cmake:2 \(variable_requires\):
- variable_requires called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake
deleted file mode 100644
index 7425262..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0035 OLD)
-variable_requires()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt
deleted file mode 100644
index 4d4fc8e..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0035-WARN.cmake:1 \(variable_requires\):
- Policy CMP0035 is not set: The variable_requires command should not be
- called. Run "cmake --help-policy CMP0035" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0035-WARN.cmake:1 \(variable_requires\):
- variable_requires called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake
deleted file mode 100644
index 3af4de1..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-variable_requires()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt
index 11aabd0..f5e3f02 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CMP0036-NEW.cmake:2 \(build_name\):
- The build_name command should not be called; see CMP0036.
+CMake Error at CMP0036-NEW.cmake:1 \(build_name\):
+ The build_name command has been removed; see CMP0036.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake
index 5341db2..9556687 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake
+++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0036 NEW)
build_name()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt
deleted file mode 100644
index fef195f..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0036-OLD.cmake:2 \(build_name\):
- build_name called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake
deleted file mode 100644
index fdd840f..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0036 OLD)
-build_name()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt
deleted file mode 100644
index b9b7c5a..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0036-WARN.cmake:1 \(build_name\):
- Policy CMP0036 is not set: The build_name command should not be called.
- Run "cmake --help-policy CMP0036" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0036-WARN.cmake:1 \(build_name\):
- build_name called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake
deleted file mode 100644
index 9556687..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-build_name()
diff --git a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt
index 927c9b4..bf2ef15 100644
--- a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12) # old enough to not set CMP0029 through CMP0036
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
index f3974ea..c65bbd4 100644
--- a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
+++ b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
@@ -1,5 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
foreach(p
CMP0029
@@ -11,7 +10,5 @@ foreach(p
CMP0035
CMP0036
)
- run_cmake(${p}-WARN)
- run_cmake(${p}-OLD)
run_cmake(${p}-NEW)
endforeach()
diff --git a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake
index 55a9f0d..f1d621b 100644
--- a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake
+++ b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake
@@ -12,5 +12,6 @@ function(check target regex)
endfunction()
check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? --build "?.*"?]])
+check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? --install "?.*"?]])
check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? -E touch "?.*"?]])
check("/CMakeFiles/Foo.dir/build.make" [[\+"?.*"? -E true]])
diff --git a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake
index 3f688ca..077b929 100644
--- a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake
+++ b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake
@@ -1,9 +1,11 @@
include(ExternalProject)
ExternalProject_Add(Foo
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Foo
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR>
BUILD_JOB_SERVER_AWARE 1
- INSTALL_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR>
+ INSTALL_JOB_SERVER_AWARE 1
)
# Add a second step to test JOB_SERVER_AWARE
diff --git a/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt b/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt
index 8ee6ec1..cab8134 100644
--- a/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt
+++ b/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt
@@ -1,8 +1,8 @@
CMake Warning \(dev\) at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
- The package name passed to `find_package_handle_standard_args`
+ The package name passed to find_package_handle_standard_args\(\)
\(NAMEMISMATCH\) does not match the name of the calling package
\(NameMismatch\). This can lead to problems in calling code that expects
- `find_package` result variables \(e.g., `_FOUND`\) to follow a certain
+ find_package\(\) result variables \(e.g., `_FOUND`\) to follow a certain
pattern.
Call Stack \(most recent call first\):
FindNameMismatch.cmake:[0-9]+ \(find_package_handle_standard_args\)
@@ -11,10 +11,10 @@ Call Stack \(most recent call first\):
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
- The package name passed to `find_package_handle_standard_args`
+ The package name passed to find_package_handle_standard_args\(\)
\(NAMEMISMATCH\) does not match the name of the calling package
\(NameMismatchOld\). This can lead to problems in calling code that expects
- `find_package` result variables \(e.g., `_FOUND`\) to follow a certain
+ find_package\(\) result variables \(e.g., `_FOUND`\) to follow a certain
pattern.
Call Stack \(most recent call first\):
FindNameMismatchOld.cmake:[0-9]+ \(find_package_handle_standard_args\)
diff --git a/Tests/RunCMake/FPHSA/range_ignored-stderr.txt b/Tests/RunCMake/FPHSA/range_ignored-stderr.txt
index 43f2336..24a7dff 100644
--- a/Tests/RunCMake/FPHSA/range_ignored-stderr.txt
+++ b/Tests/RunCMake/FPHSA/range_ignored-stderr.txt
@@ -1,4 +1,4 @@
CMake Warning \(dev\) at .+FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
- `find_package\(\)` specify a version range but the module Pseudo does not
+ find_package\(\) specify a version range but the module Pseudo does not
support this capability. Only the lower endpoint of the range will be
used.
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW-stdout.txt
new file mode 100644
index 0000000..a18e8f7
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW-stdout.txt
@@ -0,0 +1,3 @@
+-- The following features have been enabled:
+
+ \* Foo, Foo\.
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW.cmake
new file mode 100644
index 0000000..154d2c0
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-NEW.cmake
@@ -0,0 +1,11 @@
+include(FeatureSummary)
+
+cmake_policy(SET CMP0183 NEW)
+
+set(WITH_FOO 1)
+set(WITH_BAR 1)
+set(WITH_BAZ 0)
+
+add_feature_info(Foo "WITH_FOO AND (WITH_BAR OR WITH_BAZ)" "Foo.")
+
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt
new file mode 100644
index 0000000..efd7a4e
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Warning \(dev\) at [^
+]*/Modules/FeatureSummary\.cmake:[0-9]+ \(message\):
+ Policy CMP0183 is not set: add_feature_info\(\) supports full Condition
+ Syntax\. Run "cmake --help-policy CMP0183" for policy details. Use the
+ cmake_policy command to set the policy and suppress this warning\.
+Call Stack \(most recent call first\):
+ FeatureSummaryParentheses-CMP0183-WARN\.cmake:[0-9]+ \(add_feature_info\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stdout.txt
new file mode 100644
index 0000000..2b4a5ed
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stdout.txt
@@ -0,0 +1,7 @@
+-- The following features have been enabled:
+
+ \* Bar, Bar\.
+
+-- The following features have been disabled:
+
+ \* Foo, Foo\.
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN.cmake
new file mode 100644
index 0000000..3fbd7d3
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN.cmake
@@ -0,0 +1,10 @@
+include(FeatureSummary)
+
+set(WITH_FOO 1)
+set(WITH_BAR 1)
+set(WITH_BAZ 0)
+
+add_feature_info(Foo "WITH_FOO AND (WITH_BAR OR WITH_BAZ)" "Foo.")
+add_feature_info(Bar "WITH_FOO;WITH_BAR" "Bar.")
+
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW-stdout.txt
new file mode 100644
index 0000000..a18e8f7
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW-stdout.txt
@@ -0,0 +1,3 @@
+-- The following features have been enabled:
+
+ \* Foo, Foo\.
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW.cmake
new file mode 100644
index 0000000..f60103a
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-NEW.cmake
@@ -0,0 +1,8 @@
+include(FeatureSummary)
+
+cmake_policy(SET CMP0183 NEW)
+
+set(FOO "lower")
+add_feature_info(Foo "FOO MATCHES \"(UPPER|lower)\"" "Foo.")
+
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD-stdout.txt
new file mode 100644
index 0000000..a18e8f7
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD-stdout.txt
@@ -0,0 +1,3 @@
+-- The following features have been enabled:
+
+ \* Foo, Foo\.
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD.cmake
new file mode 100644
index 0000000..590d202
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryRegex-CMP0183-OLD.cmake
@@ -0,0 +1,8 @@
+include(FeatureSummary)
+
+cmake_policy(SET CMP0183 OLD)
+
+set(FOO "lower")
+add_feature_info(Foo "FOO MATCHES (UPPER|lower)" "Foo.")
+
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
index c672c16..0a8d344 100644
--- a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
@@ -21,3 +21,7 @@ run_cmake(FeatureSummaryCustomRequired)
run_cmake(FeatureSummaryCustomRequiredListA)
run_cmake(FeatureSummaryCustomRequiredListB)
run_cmake(FeatureSummaryCustomDescription)
+run_cmake(FeatureSummaryParentheses-CMP0183-NEW)
+run_cmake(FeatureSummaryParentheses-CMP0183-WARN)
+run_cmake(FeatureSummaryRegex-CMP0183-NEW)
+run_cmake(FeatureSummaryRegex-CMP0183-OLD)
diff --git a/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake b/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake
index 2e9d7ed..17aa794 100644
--- a/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake
+++ b/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake
@@ -2,7 +2,7 @@ cmake_policy(SET CMP0169 OLD)
include(FetchContent)
-# Test using saved details. We are re-using a SOURCE_DIR from a previous test
+# Test using saved details. We are reusing a SOURCE_DIR from a previous test
# so the download command should not be executed.
FetchContent_Declare(
t1
diff --git a/Tests/RunCMake/FileAPI/check_index.py b/Tests/RunCMake/FileAPI/check_index.py
index 20243c0..64c17d0 100644
--- a/Tests/RunCMake/FileAPI/check_index.py
+++ b/Tests/RunCMake/FileAPI/check_index.py
@@ -5,6 +5,7 @@ import re
if sys.version_info[0] >= 3:
unicode = str
+ long = int
def is_bool(x, val=None):
return isinstance(x, bool) and (val is None or x == val)
diff --git a/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py b/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py
index 9410c7e..54ca394 100644
--- a/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py
+++ b/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py
@@ -76,6 +76,12 @@ def check_object_cmakeFiles(o):
"isCMake": None,
},
{
+ "path": "^dir/very-long/CMakeLists\\.txt$",
+ "isGenerated": None,
+ "isExternal": None,
+ "isCMake": None,
+ },
+ {
"path": "^dir/dirtest\\.cmake$",
"isGenerated": None,
"isExternal": None,
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index 5f41ad9..b7b0090 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -12,7 +12,7 @@ def read_codemodel_json_data(filename):
def check_objects(o, g):
assert is_list(o)
assert len(o) == 1
- check_index_object(o[0], "codemodel", 2, 7, check_object_codemodel(g))
+ check_index_object(o[0], "codemodel", 2, 8, check_object_codemodel(g))
def check_backtrace(t, b, backtrace):
btg = t["backtraceGraph"]
@@ -24,7 +24,7 @@ def check_backtrace(t, b, backtrace):
if expected["line"] is not None:
expected_keys.append("line")
- assert is_int(node["line"], expected["line"])
+ assert is_int(node["line"], expected["line"]), repr(node["line"]) + " != " + repr(expected["line"])
if expected["command"] is not None:
expected_keys.append("command")
@@ -94,6 +94,8 @@ def check_directory(c):
assert is_string(actual["jsonFile"])
filepath = os.path.join(reply_dir, actual["jsonFile"])
+ maximum_filename_length = 140
+ assert len(actual["jsonFile"]) <= maximum_filename_length
with open(filepath) as f:
d = json.load(f)
@@ -429,6 +431,14 @@ def check_target(c):
missing_exception=lambda e: "launchers: %s" % e,
extra_exception=lambda a: "launchers: %s" % a)
+ if "debugger" in expected:
+ if expected["debugger"] is not None:
+ expected_keys.append("debugger")
+ assert is_dict(obj["debugger"])
+ debugger_keys = ["workingDirectory"]
+ assert sorted(obj["debugger"].keys()) == sorted(debugger_keys)
+ assert matches(obj["debugger"]["workingDirectory"], expected["debugger"]["workingDirectory"])
+
if expected["link"] is not None:
expected_keys.append("link")
assert is_dict(obj["link"])
@@ -739,6 +749,7 @@ def gen_check_directories(c, g):
read_codemodel_json_data("directories/object.json"),
read_codemodel_json_data("directories/dir.json"),
read_codemodel_json_data("directories/dir_dir.json"),
+ read_codemodel_json_data("directories/dir_very-long.json"),
read_codemodel_json_data("directories/external.json"),
read_codemodel_json_data("directories/fileset.json"),
read_codemodel_json_data("directories/subdir.json"),
@@ -956,6 +967,8 @@ def gen_check_targets(c, g, inSource):
for d in e["dependencies"]:
if matches(d["id"], "^\\^ZERO_CHECK::@"):
d["id"] = "^ZERO_CHECK::@6890427a1f51a3e7e1df$"
+ if e["name"] == "cxx_exe":
+ e["debugger"]["workingDirectory"] = "^/test/debugger/workingDirectoryVS$"
elif g["name"] == "Xcode":
if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""):
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
index 912d664..0bc2487 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
@@ -42,7 +42,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 38,
+ "line": 40,
"command": "install",
"hasParent": true
},
@@ -76,7 +76,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 38,
+ "line": 40,
"command": "install",
"hasParent": true
},
@@ -107,7 +107,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 38,
+ "line": 40,
"command": "install",
"hasParent": true
},
@@ -138,7 +138,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 38,
+ "line": 40,
"command": "install",
"hasParent": true
},
@@ -170,7 +170,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 43,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -202,7 +202,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 43,
+ "line": 45,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
index 2a3756e..dfa1e8b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
@@ -3,7 +3,8 @@
"build": "^dir$",
"parentSource": "^\\.$",
"childSources": [
- "^dir/dir$"
+ "^dir/dir$",
+ "^dir/very-long$"
],
"targetIds": null,
"projectName": "codemodel-v2",
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_very-long.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_very-long.json
new file mode 100644
index 0000000..117f356
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_very-long.json
@@ -0,0 +1,11 @@
+{
+ "source": "^dir/very-long",
+ "build": "^dir/very-long-directory-name-in-order-to-test-that-the-fileapi-codemodel-v2-directory-object-is-placed-in-a-json-file-on-disk-with-a-shortened-name$",
+ "parentSource": "^dir$",
+ "childSources": null,
+ "targetIds": null,
+ "projectName": "codemodel-v2",
+ "minimumCMakeVersion": "3.13",
+ "hasInstallRule": null,
+ "installers": []
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
index b57ab45..f535822 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
@@ -51,7 +51,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 43,
+ "line": 46,
"command": "install",
"hasParent": true
},
@@ -96,7 +96,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -144,7 +144,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -189,7 +189,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -233,7 +233,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -277,7 +277,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 51,
+ "line": 54,
"command": "install",
"hasParent": true
},
@@ -324,7 +324,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 53,
+ "line": 56,
"command": "install",
"hasParent": true
},
@@ -369,7 +369,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 54,
+ "line": 57,
"command": "install",
"hasParent": true
},
@@ -418,7 +418,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 55,
+ "line": 58,
"command": "install",
"hasParent": true
},
@@ -470,7 +470,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 56,
+ "line": 59,
"command": "install",
"hasParent": true
},
@@ -519,7 +519,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 57,
+ "line": 60,
"command": "install",
"hasParent": true
},
@@ -561,7 +561,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 58,
+ "line": 61,
"command": "install",
"hasParent": true
},
@@ -603,7 +603,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 59,
+ "line": 62,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
index 8d2712d..9309407 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
@@ -15,6 +15,7 @@
"^\\.$",
"^dir$",
"^dir/dir$",
+ "^dir/very-long$",
"^fileset$",
"^subdir$"
],
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_exe_framework.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_exe_framework.json
index a4c13a8..dd49b39 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_exe_framework.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_exe_framework.json
@@ -26,7 +26,7 @@
"backtrace": null
}
],
- "compileCommandFragments": []
+ "compileCommandFragments": null
}
],
"link": {
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json
index c6ff37a..34e1cbf 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 6,
+ "line": 8,
"command": "add_executable",
"hasParent": true
},
@@ -64,7 +64,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 6,
+ "line": 8,
"command": "add_executable",
"hasParent": true
},
@@ -114,7 +114,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 7,
+ "line": 9,
"command": "target_link_libraries",
"hasParent": true
},
@@ -142,5 +142,8 @@
"id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$",
"backtrace": null
}
- ]
+ ],
+ "debugger": {
+ "workingDirectory": "^/test/debugger/workingDirectory$"
+ }
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json
index 5b58dd1..4a0a43d 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 5,
+ "line": 7,
"command": "add_library",
"hasParent": true
},
@@ -64,7 +64,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 5,
+ "line": 7,
"command": "add_library",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json
index 5e92840..ad34f88 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 10,
+ "line": 13,
"command": "add_executable",
"hasParent": true
},
@@ -64,7 +64,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 10,
+ "line": 13,
"command": "add_executable",
"hasParent": true
},
@@ -114,7 +114,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 11,
+ "line": 14,
"command": "target_link_libraries",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
index 8d5faf8..9eee3dc 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 9,
+ "line": 12,
"command": "add_library",
"hasParent": true
},
@@ -69,7 +69,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 9,
+ "line": 12,
"command": "add_library",
"hasParent": true
},
@@ -118,7 +118,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -148,7 +148,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -178,7 +178,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 51,
+ "line": 54,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json
index df43319..badeeb2 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 14,
+ "line": 17,
"command": "add_executable",
"hasParent": true
},
@@ -64,7 +64,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 14,
+ "line": 17,
"command": "add_executable",
"hasParent": true
},
@@ -114,7 +114,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 15,
+ "line": 18,
"command": "target_link_libraries",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json
index 2220581..a05cf59 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 13,
+ "line": 16,
"command": "add_library",
"hasParent": true
},
@@ -64,7 +64,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 13,
+ "line": 16,
"command": "add_library",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
index a5bebcd..95c5e64 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
@@ -89,7 +89,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 17,
+ "line": 20,
"command": "add_library",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
index 73f9346..68ec736 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
@@ -52,7 +52,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -71,7 +71,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
@@ -122,7 +122,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 38,
+ "line": 40,
"command": "install",
"hasParent": true
},
@@ -139,7 +139,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 43,
+ "line": 46,
"command": "install",
"hasParent": true
},
@@ -175,7 +175,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 18,
+ "line": 20,
"command": "target_link_options",
"hasParent": true
},
@@ -193,7 +193,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 19,
+ "line": 21,
"command": "target_link_directories",
"hasParent": true
},
@@ -248,5 +248,8 @@
"id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$",
"backtrace": null
}
- ]
+ ],
+ "debugger": {
+ "workingDirectory": "^/test/debugger/workingDirectory$"
+ }
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
index bbd973b..a1b15ca 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
@@ -87,13 +87,7 @@
"link": {
"language": "CXX",
"lto": null,
- "commandFragments": [
- {
- "fragment" : ".*",
- "role" : "flags",
- "backtrace": null
- }
- ]
+ "commandFragments": null
},
"archive": null,
"dependencies": [
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json
index c1a8b0c..24a7550 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json
@@ -91,13 +91,7 @@
"link": {
"language": "CXX",
"lto": null,
- "commandFragments": [
- {
- "fragment" : ".*",
- "role" : "flags",
- "backtrace": null
- }
- ]
+ "commandFragments": null
},
"archive": null,
"dependencies": [
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json
index ac6a1c0..86cfc8a 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -33,7 +33,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
@@ -61,7 +61,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -80,7 +80,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json
index 311fe7a..f459e08 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -33,7 +33,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
@@ -61,7 +61,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -80,7 +80,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
@@ -108,7 +108,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -127,7 +127,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json
index adf979e..f5e06bf 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -33,7 +33,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
@@ -61,7 +61,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 21,
+ "line": 23,
"command": "target_precompile_headers",
"hasParent": true
},
@@ -80,7 +80,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 17,
+ "line": 19,
"command": "target_compile_options",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json
index 9002368..4988f04 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 49,
+ "line": 51,
"command": "add_executable",
"hasParent": true
},
@@ -52,7 +52,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 49,
+ "line": 51,
"command": "add_executable",
"hasParent": true
},
@@ -87,13 +87,7 @@
"link": {
"language": "CXX",
"lto": null,
- "commandFragments": [
- {
- "fragment" : ".*",
- "role" : "flags",
- "backtrace": null
- }
- ]
+ "commandFragments": null
},
"archive": null,
"dependencies": [
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json
index 06e7a7b..8facf86 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json
@@ -91,13 +91,7 @@
"link": {
"language": "CXX",
"lto": null,
- "commandFragments": [
- {
- "fragment" : ".*",
- "role" : "flags",
- "backtrace": null
- }
- ]
+ "commandFragments": null
},
"archive": null,
"dependencies": [
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json
index 1858df7..9ac7b7c 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 10,
+ "line": 12,
"command": "add_executable",
"hasParent": true
},
@@ -52,7 +52,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 10,
+ "line": 12,
"command": "add_executable",
"hasParent": true
},
@@ -90,7 +90,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 11,
+ "line": 13,
"command": "target_link_libraries",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
index 2274e45..45894c0 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 9,
+ "line": 11,
"command": "add_library",
"hasParent": true
},
@@ -57,7 +57,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 9,
+ "line": 11,
"command": "add_library",
"hasParent": true
},
@@ -94,7 +94,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -124,7 +124,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -154,7 +154,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 51,
+ "line": 54,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json
index 5b07d5a..45ab35c 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 26,
+ "line": 28,
"command": "add_executable",
"hasParent": true
},
@@ -46,7 +46,7 @@
[
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 27,
+ "line": 29,
"command": "set_property",
"hasParent": true
},
@@ -72,7 +72,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 26,
+ "line": 28,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json
index 0c4eabb..98528cb 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json
@@ -5,7 +5,7 @@
[
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 29,
+ "line": 31,
"command": "target_compile_features",
"hasParent": true
},
@@ -19,7 +19,7 @@
[
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 30,
+ "line": 32,
"command": "target_compile_features",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json
index d9554f1..e04b988 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 23,
+ "line": 25,
"command": "add_executable",
"hasParent": true
},
@@ -46,7 +46,7 @@
[
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 24,
+ "line": 26,
"command": "set_property",
"hasParent": true
},
@@ -72,7 +72,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 23,
+ "line": 25,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json
index 001eb8d..0808877 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 14,
+ "line": 16,
"command": "add_executable",
"hasParent": true
},
@@ -52,7 +52,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 14,
+ "line": 16,
"command": "add_executable",
"hasParent": true
},
@@ -90,7 +90,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 15,
+ "line": 17,
"command": "target_link_libraries",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json
index 2f322b0..90ea0df 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json
@@ -16,7 +16,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 13,
+ "line": 15,
"command": "add_library",
"hasParent": true
},
@@ -52,7 +52,7 @@
"backtrace": [
{
"file": "^cxx/CMakeLists\\.txt$",
- "line": 13,
+ "line": 15,
"command": "add_library",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json
index 5b47814..e737de5 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json
@@ -28,7 +28,7 @@
},
{
"file": "^codemodel-v2\\.cmake$",
- "line": 3,
+ "line": 5,
"command": "include",
"hasParent": true
},
@@ -91,7 +91,7 @@
},
{
"file": "^codemodel-v2\\.cmake$",
- "line": 3,
+ "line": 5,
"command": "include",
"hasParent": true
},
@@ -134,7 +134,7 @@
},
{
"file": "^codemodel-v2\\.cmake$",
- "line": 3,
+ "line": 5,
"command": "include",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
index 5f4019d..42bdcea 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake
+++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
@@ -1,10 +1,13 @@
enable_language(C)
+set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
+
include("${CMAKE_CURRENT_LIST_DIR}/include_test.cmake")
add_library(c_lib empty.c)
add_executable(c_exe empty.c)
target_link_libraries(c_exe PRIVATE c_lib)
+set_property(TARGET c_exe PROPERTY DEBUGGER_WORKING_DIRECTORY "/test/debugger/workingDirectory")
add_library(c_shared_lib SHARED empty.c)
add_executable(c_shared_exe empty.c)
diff --git a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
index d7d2e11..d2ebeda 100644
--- a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
@@ -5,6 +5,8 @@ add_library(cxx_lib ../empty.cxx)
add_executable(cxx_exe ../empty.cxx)
target_link_libraries(cxx_exe PRIVATE cxx_lib)
set_property(TARGET cxx_exe PROPERTY FOLDER bin)
+set_property(TARGET cxx_exe PROPERTY DEBUGGER_WORKING_DIRECTORY "/test/debugger/workingDirectory")
+set_property(TARGET cxx_exe PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "/test/debugger/workingDirectoryVS")
add_library(cxx_shared_lib SHARED ../empty.cxx)
add_executable(cxx_shared_exe ../empty.cxx)
diff --git a/Tests/RunCMake/FileAPI/dir/CMakeLists.txt b/Tests/RunCMake/FileAPI/dir/CMakeLists.txt
index 780445d..70b2ba7 100644
--- a/Tests/RunCMake/FileAPI/dir/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/dir/CMakeLists.txt
@@ -1 +1,2 @@
add_subdirectory(dir)
+add_subdirectory(very-long very-long-directory-name-in-order-to-test-that-the-fileapi-codemodel-v2-directory-object-is-placed-in-a-json-file-on-disk-with-a-shortened-name)
diff --git a/Tests/RunCMake/VS10Project/CSharpSourceGroup/images/empty.bmp b/Tests/RunCMake/FileAPI/dir/very-long/CMakeLists.txt
index e69de29..e69de29 100644
--- a/Tests/RunCMake/VS10Project/CSharpSourceGroup/images/empty.bmp
+++ b/Tests/RunCMake/FileAPI/dir/very-long/CMakeLists.txt
diff --git a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
index ebf1b87..9b170b0 100644
--- a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
+++ b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
@@ -9,8 +9,8 @@
// this test should return a matrix of 10 x 10 and should check some of the
// arguments
-void mexFunction(const int nlhs, mxArray* plhs[], const int nrhs,
- const mxArray* prhs[])
+void mexFunction(int const nlhs, mxArray* plhs[], int const nrhs,
+ mxArray const* prhs[])
{
if (nrhs != 1) {
mexErrMsgTxt("Incorrect arguments");
diff --git a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in
index 48add61..697e055 100644
--- a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in
+++ b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in
@@ -46,52 +46,23 @@ if (NOT output STREQUAL listvar)
list (APPEND errors "returns bad value: ${output}")
endif()
-block(SCOPE_FOR POLICIES)
- cmake_policy(SET CMP0007 NEW)
-
- set(listvar "0;1;2;3;4")
- list(INSERT listvar 1 "")
- set (output "$<LIST:INSERT,0;1;2;3;4,1,>")
- if (NOT output STREQUAL listvar)
- list (APPEND errors "returns bad value: ${output}")
- endif()
-
- list(INSERT listvar 4 ";")
- set (output "$<LIST:INSERT,0;;1;2;3;4,4,;>")
- if (NOT output STREQUAL listvar)
- list (APPEND errors "returns bad value: ${output}")
- endif()
-
- list(INSERT listvar 0 "x")
- set (output "$<LIST:INSERT,0;;1;2;;;3;4,0,x>")
- if (NOT output STREQUAL listvar)
- list (APPEND errors "returns bad value: ${output}")
- endif()
-endblock()
-block(SCOPE_FOR POLICIES)
- set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "")
- cmake_policy(SET CMP0007 OLD)
-
- set(listvar "0;1;2;3;4")
- list(INSERT listvar 1 "")
- set (output "$<LIST:INSERT,0;1;2;3;4,1,>")
- if (NOT output STREQUAL listvar)
- list (APPEND errors "returns bad value: ${output}")
- endif()
-
- list(INSERT listvar 4 ";")
- set (output "$<LIST:INSERT,0;1;2;3;4,4,;>")
- if (NOT output STREQUAL listvar)
- list (APPEND errors "returns bad value: ${output}")
- endif()
+set(listvar "0;1;2;3;4")
+list(INSERT listvar 1 "")
+set (output "$<LIST:INSERT,0;1;2;3;4,1,>")
+if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+endif()
- list(INSERT listvar 0 "x")
- set (output "$<LIST:INSERT,0;1;2;3;4,0,x>")
- if (NOT output STREQUAL listvar)
- list (APPEND errors "returns bad value: ${output}")
- endif()
+list(INSERT listvar 4 ";")
+set (output "$<LIST:INSERT,0;;1;2;3;4,4,;>")
+if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+endif()
- unset(CMAKE_WARN_DEPRECATED CACHE)
-endblock()
+list(INSERT listvar 0 "x")
+set (output "$<LIST:INSERT,0;;1;2;;;3;4,0,x>")
+if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+endif()
check_errors("LIST:INSERT..." ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/NATIVE_PATH.cmake.in b/Tests/RunCMake/GenEx-PATH/NATIVE_PATH.cmake.in
new file mode 100644
index 0000000..99b888a
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/NATIVE_PATH.cmake.in
@@ -0,0 +1,48 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path(SET test_path "/x/y/z/../../a/d")
+cmake_path(NATIVE_PATH test_path reference)
+set(output [=[$<PATH:NATIVE_PATH,/x/y/z/../../a/d>]=])
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+cmake_path(SET test_path "/x/y/z/../../a/d")
+cmake_path(NATIVE_PATH test_path NORMALIZE reference)
+set(output [=[$<PATH:NATIVE_PATH,NORMALIZE,/x/y/z/../../a/d>]=])
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+
+######################################
+## tests with list of paths
+######################################
+unset(reference)
+foreach(path IN ITEMS "/x/y/z/../../a/d" "/x/y/z/../../b/e")
+ cmake_path(SET test_path "${path}")
+ cmake_path(NATIVE_PATH test_path result)
+ list(APPEND reference "${result}")
+endforeach()
+
+set(output [=[$<PATH:NATIVE_PATH,/x/y/z/../../a/d;/x/y/z/../../b/e>]=])
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+unset(reference)
+foreach(path IN ITEMS "/x/y/z/../../a/d" "/x/y/z/../../b/e")
+ cmake_path(SET test_path "${path}")
+ cmake_path(NATIVE_PATH test_path NORMALIZE result)
+ list(APPEND reference "${result}")
+endforeach()
+set(output [=[$<PATH:NATIVE_PATH,NORMALIZE,/x/y/z/../../a/d;/x/y/z/../../b/e>]=])
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+
+
+
+check_errors("PATH:NATIVE_PATH" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake
index a93777a..a2fedc1 100644
--- a/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake
@@ -16,7 +16,7 @@ foreach (subcommand IN ITEMS GET_ROOT_NAME GET_ROOT_DIRECTORY GET_ROOT_PATH GET_
GET_EXTENSION GET_STEM GET_RELATIVE_PART GET_PARENT_PATH
HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH HAS_FILENAME
HAS_EXTENSION HAS_STEM HAS_RELATIVE_PART HAS_PARENT_PATH
- IS_ABSOLUTE IS_RELATIVE CMAKE_PATH REMOVE_FILENAME REMOVE_EXTENSION
+ IS_ABSOLUTE IS_RELATIVE CMAKE_PATH NATIVE_PATH REMOVE_FILENAME REMOVE_EXTENSION
NORMAL_PATH)
check_path_syntax (${subcommand} unexpected-arg "-DPATH_ARGUMENTS=${subcommand},ARG1,ARG2")
endforeach()
@@ -27,7 +27,7 @@ foreach (subcommand IN ITEMS GET_EXTENSION GET_STEM REMOVE_EXTENSION)
check_path_syntax ("${subcommand}[LAST_ONLY]" unexpected-arg "-DPATH_ARGUMENTS=${subcommand},LAST_ONLY,ARG1,ARG2")
unset(RunCMake-stderr-file)
endforeach()
-foreach (subcommand IN ITEMS CMAKE_PATH)
+foreach (subcommand IN ITEMS CMAKE_PATH NATIVE_PATH)
check_path_syntax ("${subcommand}[NORMALIZE]" unexpected-arg "-DPATH_ARGUMENTS=${subcommand},NORMALIZE,ARG1,ARG2")
endforeach()
@@ -57,6 +57,7 @@ endfunction()
check_path_execution (GET_ITEM)
check_path_execution (HAS_ITEM)
check_path_execution (CMAKE_PATH)
+check_path_execution (NATIVE_PATH)
check_path_execution (APPEND)
check_path_execution (REMOVE_ITEM)
check_path_execution (REPLACE_ITEM)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake
index ddf3887..6aa01f4 100644
--- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake
@@ -1,5 +1,7 @@
enable_language (C)
+set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
+
set (win_platforms Windows CYGWIN MSYS)
set (GENERATE_CONTENT [[
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake
index 9c5d932..4f38076 100644
--- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake
@@ -1,5 +1,7 @@
enable_language (C)
+set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
+
set (win_platforms Windows CYGWIN MSYS)
set (GENERATE_CONTENT [[
diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake
index 04ff640..5a27241 100644
--- a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/RunCMakeTest.cmake
@@ -1,7 +1,5 @@
include(RunCMake)
-cmake_policy(SET CMP0057 NEW)
-
function(run_cmake_with_config test)
if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
diff --git a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake
index 02ba513..38dae3c 100644
--- a/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_IMPORT_FILE/TARGET_SONAME_IMPORT_FILE.cmake
@@ -1,5 +1,7 @@
enable_language(C)
+set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
+
set (GENERATE_CONTENT [[
macro (CHECK_VALUE test_msg value expected)
if (NOT "${value}" STREQUAL "${expected}")
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt
index 5791993..f453253 100644
--- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt
@@ -1,6 +1,3 @@
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 NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt
deleted file mode 100644
index 468d2c5..0000000
--- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:3 \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Warning \(dev\) in CMakeLists\.txt:
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "foo". Use the target
- name directly with add_custom_command, or use the generator expression
- \$<TARGET_FILE>, as appropriate.
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake
deleted file mode 100644
index 8929cdb..0000000
--- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-enable_language(C)
-add_library(foo empty.c)
-add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,LOCATION>)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake
index c278831..d877c52 100644
--- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake
@@ -11,7 +11,6 @@ run_cmake(LinkImplementationCycle3)
run_cmake(LinkImplementationCycle4)
run_cmake(LinkImplementationCycle5)
run_cmake(LinkImplementationCycle6)
-run_cmake(LOCATION)
run_cmake(SOURCES)
run_cmake(TransitiveBuild)
run_cmake(TransitiveLink-CMP0166-OLD)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c
index 524b5b2..c939c08 100644
--- a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c
@@ -1,7 +1,8 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void lib2(void);
+extern void
+lib2(void);
#ifdef _WIN32
__declspec(dllexport)
diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
index 2cfcd8d..3e20d2e 100644
--- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
@@ -16,7 +16,7 @@ static void rtrim(std::string& str, char byte)
}
}
-void compare(const char* refName, const char* testName)
+void compare(char const* refName, char const* testName)
{
std::ifstream ref;
ref.open(refName);
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt
deleted file mode 100644
index 074cba0..0000000
--- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\):
- Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator
- expressions. Run "cmake --help-policy CMP0044" for policy details. Use
- the cmake_policy command to set the policy and suppress this warning.
-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/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake
deleted file mode 100644
index dfa23e0..0000000
--- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-
-enable_language(C)
-
-string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test)
-if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
- string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test)
- if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
- message(SEND_ERROR "Try harder.")
- endif()
-endif()
-
-add_library(cmp0044-check empty.c)
-target_compile_definitions(cmp0044-check
- PRIVATE
- Result=$<C_COMPILER_ID:${lc_test}>
- Type_Is_${CMP0044_TYPE}
-)
diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt
index bd7fdd1..bf2ef15 100644
--- a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt
+++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt
@@ -1,6 +1,3 @@
cmake_minimum_required(VERSION 3.10)
-if(RunCMake_TEST STREQUAL "CMP0044-WARN")
- cmake_policy(VERSION 2.8.11) # old enough to not set CMP0044
-endif()
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 8ba70aa..985d91b 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -13,7 +13,6 @@ run_cmake(BadTargetTypeInterface)
run_cmake(BadTargetTypeObject)
run_cmake(BadInstallPrefix)
run_cmake(BadSHELL_PATH)
-run_cmake(CMP0044-WARN)
run_cmake(NonValidTarget-C_COMPILER_ID)
run_cmake(NonValidTarget-CXX_COMPILER_ID)
run_cmake(NonValidTarget-Fortran_COMPILER_ID)
diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
index 5a353d8..6f9f97b 100644
--- a/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
+++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
@@ -1,3 +1,3 @@
--- GetPrequisites\(.*script.sh\) : ignoring script file
--- GetPrequisites\(.*script.bat\) : ignoring script file
--- GetPrequisites\(.*script\) : ignoring script file
+-- GetPrerequisites\(.*script.sh\) : ignoring script file
+-- GetPrerequisites\(.*script.bat\) : ignoring script file
+-- GetPrerequisites\(.*script\) : ignoring script file
diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp
index 9236bd1..c612b24 100644
--- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp
+++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp
@@ -18,7 +18,7 @@ int main(int argc, char** argv)
if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") {
if (!is_typed_only) {
- const char* basic_suite_names[] = { "basic.", "ns.basic." };
+ char const* basic_suite_names[] = { "basic.", "ns.basic." };
for (size_t i = 0; i < ARRAY_SIZE(basic_suite_names); i++) {
std::cout << basic_suite_names[i] << std::endl;
std::cout << " case_foo" << std::endl;
@@ -34,7 +34,7 @@ int main(int argc, char** argv)
std::cout << " case" << std::endl;
}
if (!is_basic_only) {
- const char* typed_suite_names[] = { "typed", "ns.typed",
+ char const* typed_suite_names[] = { "typed", "ns.typed",
"prefix/typed" };
for (size_t i = 0; i < ARRAY_SIZE(typed_suite_names); i++) {
std::cout << typed_suite_names[i] << "/0. # TypeParam = short\n";
@@ -46,14 +46,14 @@ int main(int argc, char** argv)
}
}
if (!is_basic_only && !is_typed_only) {
- const char* value_suite_names[] = { "value", "ns.value",
+ char const* value_suite_names[] = { "value", "ns.value",
"prefix/value" };
for (size_t i = 0; i < ARRAY_SIZE(value_suite_names); i++) {
std::cout << value_suite_names[i] << "/test." << std::endl;
std::cout << " case/0 # GetParam() = 1" << std::endl;
std::cout << " case/1 # GetParam() = \"foo\"" << std::endl;
}
- const char* param_suite_names[] = { "param", "ns.param",
+ char const* param_suite_names[] = { "param", "ns.param",
"prefix/param" };
for (size_t j = 0; j < ARRAY_SIZE(param_suite_names); j++) {
std::cout << param_suite_names[j] << "/special." << std::endl;
diff --git a/Tests/RunCMake/GoogleTest/flush_script_test.cpp b/Tests/RunCMake/GoogleTest/flush_script_test.cpp
index f032dda..60270bd 100644
--- a/Tests/RunCMake/GoogleTest/flush_script_test.cpp
+++ b/Tests/RunCMake/GoogleTest/flush_script_test.cpp
@@ -9,9 +9,9 @@ int main(int argc, char** argv)
// to test the module without actually needing Google Test.
if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") {
std::cout << "flush_script_test.\n";
- const size_t flushThreshold = 50000;
- const size_t flushAfter = 4;
- const size_t testCaseNum = 3 * flushAfter;
+ size_t const flushThreshold = 50000;
+ size_t const flushAfter = 4;
+ size_t const testCaseNum = 3 * flushAfter;
std::string testName(flushThreshold / flushAfter, 'T');
for (size_t i = 1; i <= testCaseNum; ++i)
std::cout << " t" << i << testName.c_str() << "\n";
diff --git a/Tests/RunCMake/GoogleTest/test_launcher.c b/Tests/RunCMake/GoogleTest/test_launcher.c
index be5e00d..edc1d45 100644
--- a/Tests/RunCMake/GoogleTest/test_launcher.c
+++ b/Tests/RunCMake/GoogleTest/test_launcher.c
@@ -4,7 +4,7 @@
#if defined(_MSC_VER) && _MSC_VER < 1900
# include <stdarg.h>
-static int snprintf(char* buffer, size_t count, const char* format, ...)
+static int snprintf(char* buffer, size_t count, char const* format, ...)
{
int n;
va_list argptr;
@@ -16,11 +16,11 @@ static int snprintf(char* buffer, size_t count, const char* format, ...)
}
#endif
-static int launch(int argc, const char* argv[])
+static int launch(int argc, char const* argv[])
{
char cmd[4096];
size_t len = 0;
- const char* sep = "";
+ char const* sep = "";
int i;
int n;
#ifdef _WIN32
@@ -55,7 +55,7 @@ static int launch(int argc, const char* argv[])
return system(cmd);
}
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
{
int ownArgs = 1;
int i;
diff --git a/Tests/RunCMake/Graphviz/RunCMakeTest.cmake b/Tests/RunCMake/Graphviz/RunCMakeTest.cmake
index c0cea10..c804cb1 100644
--- a/Tests/RunCMake/Graphviz/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Graphviz/RunCMakeTest.cmake
@@ -66,7 +66,9 @@ run_test(no_executables GRAPHVIZ_EXECUTABLES FALSE)
run_test(no_static_libs GRAPHVIZ_STATIC_LIBS FALSE)
run_test(no_shared_libs GRAPHVIZ_SHARED_LIBS FALSE)
-run_test(no_module_libs GRAPHVIZ_MODULE_LIBS FALSE)
+if(NOT RunCMake_TEST_E2K_BROKEN_LIBC)
+ run_test(no_module_libs GRAPHVIZ_MODULE_LIBS FALSE)
+endif()
run_test(no_interface_libs GRAPHVIZ_INTERFACE_LIBS FALSE)
run_test(no_object_libs GRAPHVIZ_OBJECT_LIBS FALSE)
diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt
deleted file mode 100644
index d5c480d..0000000
--- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CMake Error in CMakeLists.txt:
- Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo"
-
- which is prefixed in the build directory.
diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt
deleted file mode 100644
index a08f80f..0000000
--- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_minimum_required\):
- The OLD behavior for policy CMP0052 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/IfacePaths/BinInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt
deleted file mode 100644
index eb4d56d..0000000
--- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0052 is not set: Reject source and build dirs in installed
- INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for
- policy details. Use the cmake_policy command to set the policy and
- suppress this warning.
-
- Directory:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo"
-
- in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory
- of the install directory:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix"
-
- however it is also a subdirectory of the build tree:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-CMP0052-WARN-build"
-
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt
new file mode 100644
index 0000000..e6e5767
--- /dev/null
+++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt
@@ -0,0 +1,6 @@
+CMake Error in CMakeLists.txt:
+ Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
+
+ ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-build/foo"
+
+ which is prefixed in the build directory.
diff --git a/Tests/RunCMake/IfacePaths/CMakeLists.txt b/Tests/RunCMake/IfacePaths/CMakeLists.txt
index 5ee2bef..0dc68ee 100644
--- a/Tests/RunCMake/IfacePaths/CMakeLists.txt
+++ b/Tests/RunCMake/IfacePaths/CMakeLists.txt
@@ -1,8 +1,4 @@
-if(RunCMake_TEST MATCHES "-CMP0052")
- cmake_minimum_required(VERSION 3.0) # old enough to not set CMP0052
-else()
- cmake_minimum_required(VERSION 3.10)
-endif()
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
if(NOT TEST_FILE)
set(TEST_FILE ${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake
index c84e95e..a02bbfe 100644
--- a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake
+++ b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake
@@ -68,40 +68,25 @@ configure_file(
COPYONLY
)
-foreach(policyStatus NEW OLD "")
- if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES)
- if (NOT "${policyStatus}" STREQUAL "")
- set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus})
- else()
- unset(policyOption)
- set(policyStatus WARN)
- endif()
- set(policySuffix -CMP0052-${policyStatus})
- endif()
- set(RunCMake_TEST_OPTIONS
- "--install-prefix ${RunCMake_BINARY_DIR}/prefix" ${policyOption}
- "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake"
- )
- # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run
- # the test suite in-source properly. Otherwise the install directory would be
- # a subdirectory or the source directory, which is allowed and tested separately
- # below.
- set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
- set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix${policySuffix}-build")
- run_cmake(BinInInstallPrefix${policySuffix})
- unset(RunCMake_TEST_BINARY_DIR)
-
- set(RunCMake_TEST_OPTIONS
- "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
- "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake"
- )
- run_cmake(SrcInInstallPrefix${policySuffix})
- unset(RunCMake_TEST_SOURCE_DIR)
-
- if (NOT TEST_PROP STREQUAL INCLUDE_DIRECTORIES)
- break()
- endif()
-endforeach()
+set(RunCMake_TEST_OPTIONS
+ "--install-prefix ${RunCMake_BINARY_DIR}/prefix" ${policyOption}
+ "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake"
+ )
+# Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run
+# the test suite in-source properly. Otherwise the install directory would be
+# a subdirectory or the source directory, which is allowed and tested separately
+# below.
+set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
+set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-build")
+run_cmake(BinInInstallPrefix)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_OPTIONS
+ "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
+ "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake"
+ )
+run_cmake(SrcInInstallPrefix)
+unset(RunCMake_TEST_SOURCE_DIR)
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix")
run_cmake(InstallPrefixInInterface)
diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt
deleted file mode 100644
index 38acbdd..0000000
--- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
- The OLD behavior for policy CMP0052 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/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt
deleted file mode 100644
index fd6e372..0000000
--- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-CMake Warning \(dev\) in CMakeLists.txt:
- Policy CMP0052 is not set: Reject source and build dirs in installed
- INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for
- policy details. Use the cmake_policy command to set the policy and
- suppress this warning.
-
- Directory:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/src/foo"
-
- in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory
- of the install directory:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix"
-
- however it is also a subdirectory of the source tree:
-
- ".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/src"
-
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt
index 38bfa4e..38bfa4e 100644
--- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt
+++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_INCLUDE_DIRECTORIES.txt
diff --git a/Tests/RunCMake/InstallParallel/no-parallel-install-stdout.txt b/Tests/RunCMake/InstallParallel/no-parallel-install-stdout.txt
index aa0a9d3..4a30a04 100644
--- a/Tests/RunCMake/InstallParallel/no-parallel-install-stdout.txt
+++ b/Tests/RunCMake/InstallParallel/no-parallel-install-stdout.txt
@@ -1,5 +1,3 @@
-\-\- Install configuration:[^
-]*
\-\- Installing:[^
]*
\-\- Installing:[^
diff --git a/Tests/RunCMake/InstallParallel/parallel-install-stdout.txt b/Tests/RunCMake/InstallParallel/parallel-install-stdout.txt
index 61a52b0..9c059b0 100644
--- a/Tests/RunCMake/InstallParallel/parallel-install-stdout.txt
+++ b/Tests/RunCMake/InstallParallel/parallel-install-stdout.txt
@@ -1,30 +1,15 @@
-\[1\/5\] [^
-]*
-\-\- Install configuration:[^
-]*
+\[1\/5\] .*
\-\- Installing:[^
]*
-\[2\/5\] [^
-]*
-\-\- Install configuration:[^
-]*
+\[2\/5\] .*
\-\- Installing:[^
]*
-\[3\/5\] [^
-]*
-\-\- Install configuration:[^
-]*
+\[3\/5\] .*
\-\- Installing:[^
]*
-\[4\/5\] [^
-]*
-\-\- Install configuration:[^
-]*
+\[4\/5\] .*
\-\- Installing:[^
]*
-\[5\/5\] [^
-]*
-\-\- Install configuration:[^
-]*
+\[5\/5\] .*
\-\- Installing:[^
]*
diff --git a/Tests/RunCMake/Instrumentation/CMakeLists.txt b/Tests/RunCMake/Instrumentation/CMakeLists.txt
new file mode 100644
index 0000000..dda37d8
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.30)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake b/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake
new file mode 100644
index 0000000..39f06a7
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake
@@ -0,0 +1,135 @@
+cmake_minimum_required(VERSION 3.30)
+include(RunCMake)
+
+function(instrument test)
+ # Set Paths Variables
+ set(config "${CMAKE_CURRENT_LIST_DIR}/config")
+ set(ENV{CMAKE_CONFIG_DIR} ${config})
+ cmake_parse_arguments(ARGS
+ "BUILD;BUILD_MAKE_PROGRAM;INSTALL;TEST;COPY_QUERIES;COPY_QUERIES_GENERATED;NO_WARN;STATIC_QUERY;DYNAMIC_QUERY;INSTALL_PARALLEL;MANUAL_HOOK"
+ "CHECK_SCRIPT;CONFIGURE_ARG" "" ${ARGN})
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test})
+ set(uuid "a37d1069-1972-4901-b9c9-f194aaf2b6e0")
+ set(v1 ${RunCMake_TEST_BINARY_DIR}/.cmake/instrumentation-${uuid}/v1)
+ set(query_dir ${CMAKE_CURRENT_LIST_DIR}/query)
+
+ # Clear previous instrumentation data
+ # We can't use RunCMake_TEST_NO_CLEAN 0 because we preserve queries placed in the build tree after
+ file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR})
+
+ # Set hook command
+ set(static_query_hook_arg 0)
+ if (ARGS_STATIC_QUERY)
+ set(static_query_hook_arg 1)
+ endif()
+ set(GET_HOOK "\\\"${CMAKE_COMMAND}\\\" -P \\\"${RunCMake_SOURCE_DIR}/hook.cmake\\\" ${static_query_hook_arg}")
+
+ # Load query JSON and cmake (with cmake_instrumentation(...)) files
+ set(query ${query_dir}/${test}.json.in)
+ set(cmake_file ${query_dir}/${test}.cmake)
+ if (EXISTS ${query})
+ file(MAKE_DIRECTORY ${v1}/query)
+ configure_file(${query} ${v1}/query/${test}.json)
+ elseif (EXISTS ${cmake_file})
+ list(APPEND ARGS_CONFIGURE_ARG "-DINSTRUMENT_COMMAND_FILE=${cmake_file}")
+ endif()
+
+ set(copy_loc ${RunCMake_TEST_BINARY_DIR}/query)
+ if (ARGS_COPY_QUERIES_GENERATED)
+ set(ARGS_COPY_QUERIES TRUE)
+ set(copy_loc ${v1}/query/generated) # Copied files here should be cleared on configure
+ endif()
+ if (ARGS_COPY_QUERIES)
+ file(MAKE_DIRECTORY ${copy_loc})
+ set(generated_queries "0;1;2")
+ foreach(n IN LISTS generated_queries)
+ configure_file(
+ "${query_dir}/generated/query-${n}.json.in"
+ "${copy_loc}/query-${n}.json"
+ )
+ endforeach()
+ endif()
+
+ # Configure Test Case
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if (ARGS_NO_WARN)
+ list(APPEND ARGS_CONFIGURE_ARG "-Wno-dev")
+ endif()
+ set(RunCMake_TEST_SOURCE_DIR ${RunCMake_SOURCE_DIR}/project)
+ if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(maybe_CMAKE_BUILD_TYPE -DCMAKE_BUILD_TYPE=Debug)
+ endif()
+ run_cmake_with_options(${test} ${ARGS_CONFIGURE_ARG} ${maybe_CMAKE_BUILD_TYPE})
+
+ # Follow-up Commands
+ if (ARGS_BUILD)
+ run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Debug)
+ endif()
+ if (ARGS_BUILD_MAKE_PROGRAM)
+ run_cmake_command(${test}-make-program ${RunCMake_MAKE_PROGRAM})
+ endif()
+ if (ARGS_INSTALL)
+ run_cmake_command(${test}-install ${CMAKE_COMMAND} --install . --prefix install --config Debug)
+ endif()
+ if (ARGS_TEST)
+ run_cmake_command(${test}-test ${CMAKE_CTEST_COMMAND} . -C Debug)
+ endif()
+ if (ARGS_MANUAL_HOOK)
+ run_cmake_command(${test}-index ${CMAKE_CTEST_COMMAND} --collect-instrumentation .)
+ endif()
+
+ # Run Post-Test Checks
+ # Check scripts need to run after ALL run_cmake_command have finished
+ if (ARGS_CHECK_SCRIPT)
+ set(RunCMake-check-file ${ARGS_CHECK_SCRIPT})
+ set(RunCMake_CHECK_ONLY 1)
+ run_cmake(${test}-verify)
+ unset(RunCMake-check-file)
+ unset(RunCMake_CHECK_ONLY)
+ endif()
+endfunction()
+
+# Bad Queries
+instrument(bad-query)
+instrument(bad-hook)
+instrument(empty)
+instrument(bad-version)
+
+# Verify Hooks Run and Index File
+instrument(hooks-1 BUILD INSTALL TEST STATIC_QUERY)
+instrument(hooks-2 BUILD INSTALL TEST)
+instrument(hooks-no-callbacks MANUAL_HOOK)
+
+# Check data file contents
+instrument(no-query BUILD INSTALL TEST
+ CHECK_SCRIPT check-data-dir.cmake)
+instrument(dynamic-query BUILD INSTALL TEST DYNAMIC_QUERY
+ CHECK_SCRIPT check-data-dir.cmake)
+instrument(both-query BUILD INSTALL TEST DYNAMIC_QUERY
+ CHECK_SCRIPT check-data-dir.cmake)
+
+# cmake_instrumentation command
+instrument(cmake-command
+ COPY_QUERIES NO_WARN DYNAMIC_QUERY
+ CHECK_SCRIPT check-generated-queries.cmake)
+instrument(cmake-command-data
+ COPY_QUERIES NO_WARN BUILD INSTALL TEST DYNAMIC_QUERY
+ CHECK_SCRIPT check-data-dir.cmake)
+instrument(cmake-command-bad-api-version NO_WARN)
+instrument(cmake-command-bad-data-version NO_WARN)
+instrument(cmake-command-missing-version NO_WARN)
+instrument(cmake-command-bad-arg NO_WARN)
+instrument(cmake-command-parallel-install
+ BUILD INSTALL TEST NO_WARN INSTALL_PARALLEL DYNAMIC_QUERY
+ CHECK_SCRIPT check-data-dir.cmake)
+instrument(cmake-command-resets-generated NO_WARN
+ COPY_QUERIES_GENERATED
+ CHECK_SCRIPT check-data-dir.cmake
+)
+
+# FIXME(#26668) This does not work on Windows
+if (UNIX)
+ instrument(cmake-command-make-program NO_WARN
+ BUILD_MAKE_PROGRAM
+ CHECK_SCRIPT check-make-program-hooks.cmake)
+endif()
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt b/Tests/RunCMake/Instrumentation/bad-hook-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt
+++ b/Tests/RunCMake/Instrumentation/bad-hook-result.txt
diff --git a/Tests/RunCMake/Instrumentation/bad-hook-stderr.txt b/Tests/RunCMake/Instrumentation/bad-hook-stderr.txt
new file mode 100644
index 0000000..651de1d
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/bad-hook-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error: +
+Error: @3,13: Not a valid hook: "bad hook"
+ "hooks": \["bad hook", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postInstall"\]
+ \^$
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt b/Tests/RunCMake/Instrumentation/bad-query-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt
+++ b/Tests/RunCMake/Instrumentation/bad-query-result.txt
diff --git a/Tests/RunCMake/Instrumentation/bad-query-stderr.txt b/Tests/RunCMake/Instrumentation/bad-query-stderr.txt
new file mode 100644
index 0000000..caa0eec
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/bad-query-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error: +
+Error: @3,42: Not a valid query: "bad query"
+ "queries": \["staticSystemInformation", "bad query"\]
+ \^$
diff --git a/Tests/RunCMake/Instrumentation/check-data-dir.cmake b/Tests/RunCMake/Instrumentation/check-data-dir.cmake
new file mode 100644
index 0000000..e21eb66
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/check-data-dir.cmake
@@ -0,0 +1,154 @@
+include(${CMAKE_CURRENT_LIST_DIR}/verify-snippet.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/json.cmake)
+
+file(GLOB snippets ${v1}/data/*)
+if (NOT snippets)
+ add_error("No snippet files generated")
+endif()
+
+set(FOUND_SNIPPETS "")
+foreach(snippet IN LISTS snippets)
+ get_filename_component(filename "${snippet}" NAME)
+
+ read_json("${snippet}" contents)
+
+ # Verify snippet file is valid
+ verify_snippet("${snippet}" "${contents}")
+
+ # Append to list of collected snippet roles
+ if (NOT role IN_LIST FOUND_SNIPPETS)
+ list(APPEND FOUND_SNIPPETS ${role})
+ endif()
+
+ # Verify target
+ string(JSON target ERROR_VARIABLE noTarget GET "${contents}" target)
+ if (NOT target MATCHES NOTFOUND)
+ set(targets "main;lib;customTarget;TARGET_NAME")
+ if (NOT ${target} IN_LIST targets)
+ snippet_error("${snippet}" "Unexpected target: ${target}")
+ endif()
+ endif()
+
+ # Verify output
+ string(JSON result GET "${contents}" result)
+ if (NOT ${result} EQUAL 0)
+ snippet_error("${snippet}" "Compile command had non-0 result")
+ endif()
+
+ # Verify contents of compile-* Snippets
+ if (filename MATCHES "^compile-")
+ string(JSON target GET "${contents}" target)
+ string(JSON source GET "${contents}" source)
+ string(JSON language GET "${contents}" language)
+ if (NOT language MATCHES "C\\+\\+")
+ snippet_error("${snippet}" "Expected C++ compile language")
+ endif()
+ if (NOT source MATCHES "${target}.cxx$")
+ snippet_error("${snippet}" "Unexpected source file")
+ endif()
+ endif()
+
+ # Verify contents of link-* Snippets
+ if (filename MATCHES "^link-")
+ string(JSON target GET "${contents}" target)
+ string(JSON targetType GET "${contents}" targetType)
+ string(JSON targetLabels GET "${contents}" targetLabels)
+ if (target MATCHES "main")
+ if (NOT targetType MATCHES "EXECUTABLE")
+ snippet_error("${snippet}" "Expected EXECUTABLE, target type was ${targetType}")
+ endif()
+ string(JSON nlabels LENGTH "${targetLabels}")
+ if (NOT nlabels STREQUAL 2)
+ snippet_error("${snippet}" "Missing Target Labels for: ${target}")
+ else()
+ string(JSON label1 GET "${contents}" targetLabels 0)
+ string(JSON label2 GET "${contents}" targetLabels 1)
+ if (NOT label1 MATCHES "label1" OR NOT label2 MATCHES "label2")
+ snippet_error("${snippet}" "Missing Target Labels for: ${target}")
+ endif()
+ endif()
+ endif()
+ if (target MATCHES "lib")
+ if (NOT targetType MATCHES "STATIC_LIBRARY")
+ snippet_error("${snippet}" "Expected STATIC_LIBRARY, target type was ${targetType}")
+ endif()
+ string(JSON nlabels LENGTH "${targetLabels}")
+ if (NOT nlabels STREQUAL 1)
+ snippet_error("${snippet}" "Missing Target Labels for: ${target}")
+ else()
+ string(JSON label ERROR_VARIABLE noLabels GET "${contents}" targetLabels 0)
+ if (NOT label MATCHES "label3")
+ snippet_error("${snippet}" "Missing Target Labels for: ${target}")
+ endif()
+ endif()
+ endif()
+ endif()
+
+ # Verify contents of custom-* Snippets
+ if (filename MATCHES "^custom-")
+ string(JSON outputs GET "${contents}" outputs)
+ if (NOT output1 MATCHES "output1" OR NOT output2 MATCHES "output2")
+ snippet_error("${snippet}" "Custom command missing outputs")
+ endif()
+ endif()
+
+ # Verify contents of test-* Snippets
+ if (filename MATCHES "^test-")
+ string(JSON testName GET "${contents}" testName)
+ if (NOT testName STREQUAL "test")
+ snippet_error("${snippet}" "Unexpected testName: ${testName}")
+ endif()
+ endif()
+
+ # Verify that Config is Debug
+ if (filename MATCHES "^test|^compile|^link")
+ string(JSON config GET "${contents}" config)
+ if (NOT config STREQUAL "Debug")
+ snippet_error(${snippet} "Unexpected config: ${config}")
+ endif()
+ endif()
+
+ # Verify command args were passed
+ if (filename MATCHES "^cmakeBuild|^ctest")
+ string(JSON command GET "${contents}" command)
+ if (NOT command MATCHES "Debug")
+ snippet_error(${snippet} "Command value missing passed arguments")
+ endif()
+ endif()
+
+endforeach()
+
+# Verify that listed snippets match expected roles
+set(EXPECTED_SNIPPETS configure generate)
+if (ARGS_BUILD)
+ list(APPEND EXPECTED_SNIPPETS compile link custom cmakeBuild)
+endif()
+if (ARGS_TEST)
+ list(APPEND EXPECTED_SNIPPETS ctest test)
+endif()
+if (ARGS_INSTALL)
+ list(APPEND EXPECTED_SNIPPETS cmakeInstall)
+ if (ARGS_INSTALL_PARALLEL)
+ list(APPEND EXPECTED_SNIPPETS install)
+ endif()
+endif()
+foreach(role IN LISTS EXPECTED_SNIPPETS)
+ list(FIND FOUND_SNIPPETS "${role}" found)
+ if (found EQUAL -1)
+ add_error("No snippet files of role \"${role}\" were found in ${v1}")
+ endif()
+endforeach()
+foreach(role IN LISTS FOUND_SNIPPETS)
+ list(FIND EXPECTED_SNIPPETS "${role}" found)
+ if (${found} EQUAL -1)
+ add_error("Found unexpected snippet file of role \"${role}\" in ${v1}")
+ endif()
+endforeach()
+
+# Verify test/install artifacts
+if (ARGS_INSTALL AND NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/install)
+ add_error("ctest --instrument launcher failed to install the project")
+endif()
+if (ARGS_TEST AND NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Testing)
+ add_error("ctest --instrument launcher failed to test the project")
+endif()
diff --git a/Tests/RunCMake/Instrumentation/check-generated-queries.cmake b/Tests/RunCMake/Instrumentation/check-generated-queries.cmake
new file mode 100644
index 0000000..6ccdd28
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/check-generated-queries.cmake
@@ -0,0 +1,18 @@
+include(${CMAKE_CURRENT_LIST_DIR}/json.cmake)
+function(check_generated_json n)
+ set(expected_file "${RunCMake_TEST_BINARY_DIR}/query/query-${n}.json")
+ set(generated_file "${v1}/query/generated/query-${n}.json")
+ read_json("${expected_file}" expected)
+ read_json("${generated_file}" generated)
+ string(JSON equal EQUAL ${expected} ${generated})
+ if (NOT equal)
+ set(RunCMake_TEST_FAILED
+ "Generated JSON ${generated}\nNot equal to expected ${expected}"
+ )
+ endif()
+ return(PROPAGATE RunCMake_TEST_FAILED)
+endfunction()
+
+foreach(n IN LISTS generated_queries)
+ check_generated_json(${n})
+endforeach()
diff --git a/Tests/RunCMake/Instrumentation/check-make-program-hooks.cmake b/Tests/RunCMake/Instrumentation/check-make-program-hooks.cmake
new file mode 100644
index 0000000..239af3b
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/check-make-program-hooks.cmake
@@ -0,0 +1,45 @@
+set(NUM_TRIES 30)
+set(DELAY 1)
+
+if (NOT EXISTS ${v1}/preBuild.hook)
+ set(RunCMake_TEST_FAILED "preBuild hook did not run\n")
+endif()
+
+macro(hasPostBuildArtifacts)
+ if (NOT postBuildRan AND EXISTS ${v1}/postBuild.hook)
+ set(postBuildRan 1)
+ endif()
+ if (NOT dataDirClean)
+ file(GLOB snippets "${v1}/data/*")
+ if ("${snippets}" STREQUAL "")
+ set(dataDirClean 1)
+ endif()
+ endif()
+endmacro()
+
+set(postBuildRan 0)
+set(dataDirClean 0)
+foreach(_ RANGE ${NUM_TRIES})
+ hasPostBuildArtifacts()
+ if (postBuildRan AND dataDirClean)
+ break()
+ endif()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${DELAY})
+endforeach()
+
+if (NOT postBuildRan)
+ string(APPEND RunCMake_TEST_FAILED "postBuild hook did not run\n")
+endif()
+if (NOT dataDirClean)
+ string(APPEND RunCMake_TEST_FAILED "Snippet files not fully removed post build\n")
+endif()
+
+file(READ ${v1}/postBuild.hook postBuildErrors)
+if (NOT postBuildErrors MATCHES "^$")
+ string(APPEND RunCMake_TEST_FAILED "Errors found in data during postBuild hook:\n${postBuildErrors}\n")
+endif()
+
+file(READ ${v1}/preBuild.hook preBuildErrors)
+if (NOT preBuildErrors MATCHES "^$")
+ string(APPEND RunCMake_TEST_FAILED "Errors found in data during preBuild hook:\n${preBuildErrors}\n")
+endif()
diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-result.txt b/Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/ParenInVarName1-result.txt
+++ b/Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-result.txt
diff --git a/Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-stderr.txt
new file mode 100644
index 0000000..ab172e0
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/cmake-command-bad-api-version-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at [^
+]*\(cmake_instrumentation\):
+ cmake_instrumentation QUERY subcommand given an unsupported API_VERSION "0"
+ \(the only currently supported version is 1\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
diff --git a/Tests/RunCMake/Syntax/ParenInENV-result.txt b/Tests/RunCMake/Instrumentation/cmake-command-bad-arg-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/ParenInENV-result.txt
+++ b/Tests/RunCMake/Instrumentation/cmake-command-bad-arg-result.txt
diff --git a/Tests/RunCMake/Instrumentation/cmake-command-bad-arg-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-bad-arg-stderr.txt
new file mode 100644
index 0000000..4d0f532
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/cmake-command-bad-arg-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at [^
+]* \(cmake_instrumentation\):
+ cmake_instrumentation given unknown argument "UNKNOWN_ARG".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt b/Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt
+++ b/Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-result.txt
diff --git a/Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-stderr.txt
new file mode 100644
index 0000000..512d104
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/cmake-command-bad-data-version-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at [^
+]*\(cmake_instrumentation\):
+ cmake_instrumentation given a non-integer DATA_VERSION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt b/Tests/RunCMake/Instrumentation/cmake-command-missing-version-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt
+++ b/Tests/RunCMake/Instrumentation/cmake-command-missing-version-result.txt
diff --git a/Tests/RunCMake/Instrumentation/cmake-command-missing-version-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-missing-version-stderr.txt
new file mode 100644
index 0000000..0d1d8c3
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/cmake-command-missing-version-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at [^
+]*\(cmake_instrumentation\):
+ cmake_instrumentation QUERY subcommand given an unsupported DATA_VERSION ""
+ \(the only currently supported version is 1\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt b/Tests/RunCMake/Instrumentation/cmake-command-non-int-version-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt
+++ b/Tests/RunCMake/Instrumentation/cmake-command-non-int-version-result.txt
diff --git a/Tests/RunCMake/Instrumentation/cmake-command-non-int-version-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-non-int-version-stderr.txt
new file mode 100644
index 0000000..b6615ff
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/cmake-command-non-int-version-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at CMakeLists\.txt:37 \(cmake_instrumentation\):
+ cmake_instrumentation given a non-integer DATA_VERSION\.
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt b/Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt
+++ b/Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-result.txt
diff --git a/Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-stderr.txt
new file mode 100644
index 0000000..2eab224
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/cmake-command-unsupported-version-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error at CMakeLists\.txt:44 \(cmake_instrumentation\):
+ cmake_instrumentation given an unsupported API_VERSION "0" \(the only
+ currently supported version is 1\)\.
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt b/Tests/RunCMake/Instrumentation/empty-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt
+++ b/Tests/RunCMake/Instrumentation/empty-result.txt
diff --git a/Tests/RunCMake/Instrumentation/empty-stderr.txt b/Tests/RunCMake/Instrumentation/empty-stderr.txt
new file mode 100644
index 0000000..c8a5397
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/empty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error: +
+Error: @1,1: Missing required field "version" in root object
+{
+\^$
diff --git a/Tests/RunCMake/Instrumentation/hook.cmake b/Tests/RunCMake/Instrumentation/hook.cmake
new file mode 100644
index 0000000..a139a37
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hook.cmake
@@ -0,0 +1,81 @@
+cmake_minimum_required(VERSION 3.30)
+
+include(${CMAKE_CURRENT_LIST_DIR}/json.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/verify-snippet.cmake)
+# Test CALLBACK script. Prints output information and verifies index file
+# Called as: cmake -P hook.cmake [CheckForStaticQuery?] [index.json]
+set(index ${CMAKE_ARGV4})
+if (NOT ${CMAKE_ARGV3})
+ set(hasStaticInfo "UNEXPECTED")
+endif()
+read_json("${index}" contents)
+string(JSON hook GET "${contents}" hook)
+
+# Output is verified by *-stdout.txt files that the HOOK is run
+message(STATUS ${hook})
+# Not a check-*.cmake script, this is called as an instrumentation CALLBACK
+set(ERROR_MESSAGE "")
+function(add_error error)
+ string(APPEND ERROR_MESSAGE "${error}\n")
+ return(PROPAGATE ERROR_MESSAGE)
+endfunction()
+
+function(has_key_index key json)
+ cmake_parse_arguments(ARG "UNEXPECTED" "" "" ${ARGN})
+ unset(missingKey)
+ string(JSON ${key} ERROR_VARIABLE missingKey GET "${json}" ${key})
+ if (NOT ARG_UNEXPECTED AND NOT missingKey MATCHES NOTFOUND)
+ add_error("\nKey \"${key}\" not in index:\n${json}")
+ elseif(ARG_UNEXPECTED AND missingKey MATCHES NOTFOUND)
+ add_error("\nUnexpected key \"${key}\" in index:\n${json}")
+ endif()
+ return(PROPAGATE ERROR_MESSAGE ${key})
+endfunction()
+
+has_key_index(version "${contents}")
+has_key_index(buildDir "${contents}")
+has_key_index(dataDir "${contents}")
+has_key_index(snippets "${contents}")
+
+if (NOT version EQUAL 1)
+ add_error("Version must be 1, got: ${version}")
+endif()
+
+string(JSON length LENGTH "${snippets}")
+math(EXPR length "${length}-1")
+foreach(i RANGE ${length})
+ string(JSON filename GET "${snippets}" ${i})
+ if (NOT EXISTS ${dataDir}/${filename})
+ add_error("Listed snippet: ${dataDir}/${filename} does not exist")
+ endif()
+ read_json(${dataDir}/${filename} snippet_contents)
+ verify_snippet(${dataDir}/${filename} "${snippet_contents}")
+endforeach()
+
+has_key_index(staticSystemInformation "${contents}" ${hasStaticInfo})
+has_key_index(OSName "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(OSPlatform "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(OSRelease "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(OSVersion "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(familyId "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(hostname "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(is64Bits "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(modelId "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(numberOfLogicalCPU "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(numberOfPhysicalCPU "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(processorAPICID "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(processorCacheSize "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(processorClockFrequency "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(processorName "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(totalPhysicalMemory "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(totalVirtualMemory "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(vendorID "${staticSystemInformation}" ${hasStaticInfo})
+has_key_index(vendorString "${staticSystemInformation}" ${hasStaticInfo})
+
+get_filename_component(dataDir ${index} DIRECTORY)
+get_filename_component(v1 ${dataDir} DIRECTORY)
+file(WRITE ${v1}/${hook}.hook "${ERROR_MESSAGE}")
+
+if (NOT ERROR_MESSAGE MATCHES "^$")
+ message(FATAL_ERROR ${ERROR_MESSAGE})
+endif()
diff --git a/Tests/RunCMake/Instrumentation/hooks-1-build-stdout.txt b/Tests/RunCMake/Instrumentation/hooks-1-build-stdout.txt
new file mode 100644
index 0000000..8062d6a
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hooks-1-build-stdout.txt
@@ -0,0 +1 @@
+^\-\- preCMakeBuild
diff --git a/Tests/RunCMake/Instrumentation/hooks-1-install-stdout.txt b/Tests/RunCMake/Instrumentation/hooks-1-install-stdout.txt
new file mode 100644
index 0000000..da0da3b
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hooks-1-install-stdout.txt
@@ -0,0 +1 @@
+.*\-\- postInstall$
diff --git a/Tests/RunCMake/Instrumentation/hooks-2-build-stdout.txt b/Tests/RunCMake/Instrumentation/hooks-2-build-stdout.txt
new file mode 100644
index 0000000..655b134
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hooks-2-build-stdout.txt
@@ -0,0 +1 @@
+.*\-\- postCMakeBuild$
diff --git a/Tests/RunCMake/Instrumentation/hooks-2-stdout.txt b/Tests/RunCMake/Instrumentation/hooks-2-stdout.txt
new file mode 100644
index 0000000..e2458f7
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hooks-2-stdout.txt
@@ -0,0 +1,5 @@
+.*\-\- Configuring done[^
+]*
+\-\- Generating done[^
+]*
+\-\- postGenerate.*
diff --git a/Tests/RunCMake/Instrumentation/hooks-2-test-stdout.txt b/Tests/RunCMake/Instrumentation/hooks-2-test-stdout.txt
new file mode 100644
index 0000000..442a48c
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hooks-2-test-stdout.txt
@@ -0,0 +1 @@
+.*\-\- postTest$
diff --git a/Tests/RunCMake/Instrumentation/hooks-no-callbacks-index-stdout.txt b/Tests/RunCMake/Instrumentation/hooks-no-callbacks-index-stdout.txt
new file mode 100644
index 0000000..8ed4f5e
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/hooks-no-callbacks-index-stdout.txt
@@ -0,0 +1 @@
+^\-\- manual$
diff --git a/Tests/RunCMake/Instrumentation/json.cmake b/Tests/RunCMake/Instrumentation/json.cmake
new file mode 100644
index 0000000..3cc88e0
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/json.cmake
@@ -0,0 +1,4 @@
+function(read_json filename outvar)
+ file(READ "${filename}" ${outvar})
+ return(PROPAGATE ${outvar})
+endfunction()
diff --git a/Tests/RunCMake/Instrumentation/project/CMakeLists.txt b/Tests/RunCMake/Instrumentation/project/CMakeLists.txt
new file mode 100644
index 0000000..0d90faf
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/project/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 3.30)
+project(instrumentation)
+enable_testing()
+if (EXISTS ${INSTRUMENT_COMMAND_FILE})
+ set(CMAKE_EXPERIMENTAL_INSTRUMENTATION "a37d1069-1972-4901-b9c9-f194aaf2b6e0")
+ include(${INSTRUMENT_COMMAND_FILE})
+endif()
+
+add_executable(main main.cxx)
+add_library(lib lib.cxx)
+target_link_libraries(main lib)
+add_custom_command(
+ COMMAND ${CMAKE_COMMAND} -E true
+ OUTPUT output1 output2
+)
+set_property(SOURCE output1 output2 PROPERTY SYMBOLIC 1)
+add_custom_target(customTarget ALL
+ DEPENDS output1
+)
+add_test(NAME test COMMAND $<TARGET_FILE:main>)
+install(TARGETS main)
+set_target_properties(main PROPERTIES LABELS "label1;label2")
+set_target_properties(lib PROPERTIES LABELS "label3")
diff --git a/Tests/RunCMake/Instrumentation/project/lib.cxx b/Tests/RunCMake/Instrumentation/project/lib.cxx
new file mode 100644
index 0000000..c912397
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/project/lib.cxx
@@ -0,0 +1,4 @@
+int lib()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/Instrumentation/project/lib.h b/Tests/RunCMake/Instrumentation/project/lib.h
new file mode 100644
index 0000000..9f73b0d
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/project/lib.h
@@ -0,0 +1 @@
+int lib();
diff --git a/Tests/RunCMake/Instrumentation/project/main.cxx b/Tests/RunCMake/Instrumentation/project/main.cxx
new file mode 100644
index 0000000..0362522
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/project/main.cxx
@@ -0,0 +1,5 @@
+#include "lib.h"
+int main()
+{
+ return lib();
+}
diff --git a/Tests/RunCMake/Instrumentation/query/bad-hook.json.in b/Tests/RunCMake/Instrumentation/query/bad-hook.json.in
new file mode 100644
index 0000000..5f92ba0
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/bad-hook.json.in
@@ -0,0 +1,4 @@
+{
+ "version": 1,
+ "hooks": ["bad hook", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postInstall"]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/bad-query.json.in b/Tests/RunCMake/Instrumentation/query/bad-query.json.in
new file mode 100644
index 0000000..5bd4054
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/bad-query.json.in
@@ -0,0 +1,4 @@
+{
+ "version": 1,
+ "queries": ["staticSystemInformation", "bad query"]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/bad-version.json.in b/Tests/RunCMake/Instrumentation/query/bad-version.json.in
new file mode 100644
index 0000000..5dfe44d
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/bad-version.json.in
@@ -0,0 +1,3 @@
+{
+ "version": 0
+}
diff --git a/Tests/RunCMake/Instrumentation/query/both-query.json.in b/Tests/RunCMake/Instrumentation/query/both-query.json.in
new file mode 100644
index 0000000..839361f
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/both-query.json.in
@@ -0,0 +1,7 @@
+{
+ "version": 1,
+ "queries": [
+ "staticSystemInformation",
+ "dynamicSystemInformation"
+ ]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-bad-api-version.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-bad-api-version.cmake
new file mode 100644
index 0000000..2d4d746
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-bad-api-version.cmake
@@ -0,0 +1,3 @@
+cmake_instrumentation(
+ API_VERSION 0
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-bad-arg.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-bad-arg.cmake
new file mode 100644
index 0000000..ed88bd1
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-bad-arg.cmake
@@ -0,0 +1,5 @@
+cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ UNKNOWN_ARG
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-bad-data-version.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-bad-data-version.cmake
new file mode 100644
index 0000000..8fe34b6
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-bad-data-version.cmake
@@ -0,0 +1,4 @@
+cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION NOT_AN_INT
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-data.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-data.cmake
new file mode 100644
index 0000000..5c238fd
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-data.cmake
@@ -0,0 +1,5 @@
+cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ QUERIES dynamicSystemInformation
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake
new file mode 100644
index 0000000..9e88561
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake
@@ -0,0 +1,7 @@
+file(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/../hook.cmake" hook_path)
+cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ HOOKS preBuild postBuild
+ CALLBACK ${CMAKE_COMMAND} -P ${hook_path} 0
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-missing-version.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-missing-version.cmake
new file mode 100644
index 0000000..84cffd0
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-missing-version.cmake
@@ -0,0 +1,3 @@
+cmake_instrumentation(
+ API_VERSION 1
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-parallel-install.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-parallel-install.cmake
new file mode 100644
index 0000000..237f14e
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-parallel-install.cmake
@@ -0,0 +1,6 @@
+set_property(GLOBAL PROPERTY INSTALL_PARALLEL ON)
+cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ QUERIES dynamicSystemInformation
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-resets-generated.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-resets-generated.cmake
new file mode 100644
index 0000000..bdfdacf
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-resets-generated.cmake
@@ -0,0 +1,4 @@
+cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+)
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command.cmake
new file mode 100644
index 0000000..72e9b41
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command.cmake
@@ -0,0 +1,21 @@
+ # Query 0
+ cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ )
+ # Query 1
+ cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ HOOKS postGenerate
+ CALLBACK ${CMAKE_COMMAND} -E echo callback1
+ )
+ # Query 2
+ cmake_instrumentation(
+ API_VERSION 1
+ DATA_VERSION 1
+ HOOKS postCMakeBuild
+ QUERIES staticSystemInformation dynamicSystemInformation
+ CALLBACK ${CMAKE_COMMAND} -E echo callback2
+ CALLBACK ${CMAKE_COMMAND} -E echo callback3
+ )
diff --git a/Tests/RunCMake/Instrumentation/query/dynamic-query.json.in b/Tests/RunCMake/Instrumentation/query/dynamic-query.json.in
new file mode 100644
index 0000000..839361f
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/dynamic-query.json.in
@@ -0,0 +1,7 @@
+{
+ "version": 1,
+ "queries": [
+ "staticSystemInformation",
+ "dynamicSystemInformation"
+ ]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/empty.json.in b/Tests/RunCMake/Instrumentation/query/empty.json.in
new file mode 100644
index 0000000..2c63c08
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/empty.json.in
@@ -0,0 +1,2 @@
+{
+}
diff --git a/Tests/RunCMake/Instrumentation/query/generated/query-0.json.in b/Tests/RunCMake/Instrumentation/query/generated/query-0.json.in
new file mode 100644
index 0000000..d6b0a1a
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/generated/query-0.json.in
@@ -0,0 +1,6 @@
+{
+ "callbacks" : [],
+ "hooks" : [],
+ "queries" : [],
+ "version": 1
+}
diff --git a/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in b/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in
new file mode 100644
index 0000000..e5e6c35
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in
@@ -0,0 +1,12 @@
+{
+ "callbacks" :
+ [
+ "\"@CMAKE_COMMAND@\" \"-E\" \"echo\" \"callback1\""
+ ],
+ "hooks" :
+ [
+ "postGenerate"
+ ],
+ "queries" : [],
+ "version" : 1
+}
diff --git a/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in b/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in
new file mode 100644
index 0000000..58db59f
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in
@@ -0,0 +1,17 @@
+{
+ "callbacks" :
+ [
+ "\"@CMAKE_COMMAND@\" \"-E\" \"echo\" \"callback2\"",
+ "\"@CMAKE_COMMAND@\" \"-E\" \"echo\" \"callback3\""
+ ],
+ "hooks" :
+ [
+ "postCMakeBuild"
+ ],
+ "queries" :
+ [
+ "staticSystemInformation",
+ "dynamicSystemInformation"
+ ],
+ "version": 1
+}
diff --git a/Tests/RunCMake/Instrumentation/query/hooks-1.json.in b/Tests/RunCMake/Instrumentation/query/hooks-1.json.in
new file mode 100644
index 0000000..31bba86
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/hooks-1.json.in
@@ -0,0 +1,6 @@
+{
+ "version": 1,
+ "hooks": ["preCMakeBuild", "postInstall"],
+ "callbacks": ["@GET_HOOK@"],
+ "queries": ["staticSystemInformation"]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/hooks-2.json.in b/Tests/RunCMake/Instrumentation/query/hooks-2.json.in
new file mode 100644
index 0000000..ae18b09
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/hooks-2.json.in
@@ -0,0 +1,5 @@
+{
+ "version": 1,
+ "hooks": ["postGenerate", "postCMakeBuild", "postTest"],
+ "callbacks": ["@GET_HOOK@"]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/hooks-no-callbacks.json.in b/Tests/RunCMake/Instrumentation/query/hooks-no-callbacks.json.in
new file mode 100644
index 0000000..69885d4
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/hooks-no-callbacks.json.in
@@ -0,0 +1,4 @@
+{
+ "version": 1,
+ "callbacks": ["@GET_HOOK@"]
+}
diff --git a/Tests/RunCMake/Instrumentation/query/no-query.json.in b/Tests/RunCMake/Instrumentation/query/no-query.json.in
new file mode 100644
index 0000000..61a2092
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/query/no-query.json.in
@@ -0,0 +1,3 @@
+{
+ "version": 1
+}
diff --git a/Tests/RunCMake/Instrumentation/verify-snippet.cmake b/Tests/RunCMake/Instrumentation/verify-snippet.cmake
new file mode 100644
index 0000000..3eaafe8
--- /dev/null
+++ b/Tests/RunCMake/Instrumentation/verify-snippet.cmake
@@ -0,0 +1,115 @@
+# Performs generic (non-project specific) validation of v1 Snippet File Contents
+
+function(add_error error)
+ string(APPEND RunCMake_TEST_FAILED " ${error}\n")
+ string(APPEND ERROR_MESSAGE " ${error}\n")
+ return(PROPAGATE RunCMake_TEST_FAILED ERROR_MESSAGE)
+endfunction()
+
+function(snippet_error snippet error)
+ add_error("Error in snippet file ${snippet}:\n${error}")
+ return(PROPAGATE RunCMake_TEST_FAILED ERROR_MESSAGE)
+endfunction()
+
+function(has_key snippet json key)
+ string(JSON data ERROR_VARIABLE missingKey GET "${json}" ${key})
+ if (NOT missingKey MATCHES NOTFOUND)
+ snippet_error("${snippet}" "Missing ${key}")
+ endif()
+ return(PROPAGATE RunCMake_TEST_FAILED ERROR_MESSAGE)
+endfunction()
+
+function(has_not_key snippet json key)
+ string(JSON data ERROR_VARIABLE missingKey GET "${json}" ${key})
+ if (missingKey MATCHES NOTFOUND)
+ snippet_error("${snippet}" "Has unexpected ${key}")
+ endif()
+ return(PROPAGATE RunCMake_TEST_FAILED ERROR_MESSAGE)
+endfunction()
+
+function(snippet_has_fields snippet contents)
+ get_filename_component(filename "${snippet}" NAME)
+ has_key("${snippet}" "${contents}" role)
+ has_key("${snippet}" "${contents}" result)
+ has_key("${snippet}" "${contents}" workingDir)
+ if (NOT filename MATCHES "^build-*")
+ has_key("${snippet}" "${contents}" command)
+ endif()
+ if (filename MATCHES "^link-*")
+ has_key("${snippet}" "${contents}" target)
+ has_key("${snippet}" "${contents}" outputs)
+ has_key("${snippet}" "${contents}" outputSizes)
+ has_key("${snippet}" "${contents}" targetType)
+ has_key("${snippet}" "${contents}" targetLabels)
+ has_key("${snippet}" "${contents}" config)
+ elseif (filename MATCHES "^compile-*")
+ has_key("${snippet}" "${contents}" target)
+ has_key("${snippet}" "${contents}" outputs)
+ has_key("${snippet}" "${contents}" outputSizes)
+ has_key("${snippet}" "${contents}" source)
+ has_key("${snippet}" "${contents}" language)
+ has_key("${snippet}" "${contents}" config)
+ elseif (filename MATCHES "^custom-*")
+ has_key("${snippet}" "${contents}" outputs)
+ has_key("${snippet}" "${contents}" outputSizes)
+ elseif (filename MATCHES "^test-*")
+ has_key("${snippet}" "${contents}" testName)
+ has_key("${snippet}" "${contents}" config)
+ endif()
+ if(ARGS_DYNAMIC_QUERY)
+ has_key("${snippet}" "${contents}" dynamicSystemInformation)
+ string(JSON dynamicSystemInfo ERROR_VARIABLE noInfo GET "${contents}" dynamicSystemInformation)
+ if (noInfo MATCHES NOTFOUND)
+ has_key("${snippet}" ${dynamicSystemInfo} beforeCPULoadAverage)
+ has_key("${snippet}" ${dynamicSystemInfo} beforeHostMemoryUsed)
+ has_key("${snippet}" ${dynamicSystemInfo} beforeCPULoadAverage)
+ has_key("${snippet}" ${dynamicSystemInfo} beforeHostMemoryUsed)
+ endif()
+ else()
+ has_not_key("${snippet}" "${contents}" dynamicSystemInformation)
+ string(JSON dynamicSystemInfo ERROR_VARIABLE noInfo GET "${contents}" dynamicSystemInformation)
+ if (noInfo MATCHES NOTFOUND)
+ has_not_key("${snippet}" ${dynamicSystemInfo} beforeCPULoadAverage)
+ has_not_key("${snippet}" ${dynamicSystemInfo} beforeHostMemoryUsed)
+ has_not_key("${snippet}" ${dynamicSystemInfo} beforeCPULoadAverage)
+ has_not_key("${snippet}" ${dynamicSystemInfo} beforeHostMemoryUsed)
+ endif()
+ endif()
+ return(PROPAGATE RunCMake_TEST_FAILED ERROR_MESSAGE)
+endfunction()
+
+function(snippet_valid_timing contents)
+ string(JSON start GET "${contents}" timeStart)
+ string(JSON duration GET "${contents}" duration)
+ if (start LESS 0)
+ snippet_error("${snippet}" "Negative time start: ${start}")
+ endif()
+ if (duration LESS 0)
+ snippet_error("${snippet}" "Negative duration: ${end}")
+ endif()
+ return(PROPAGATE RunCMake_TEST_FAILED ERROR_MESSAGE)
+endfunction()
+
+function(verify_snippet snippet contents)
+ snippet_has_fields("${snippet}" "${contents}")
+ snippet_valid_timing("${contents}")
+ string(JSON version GET "${contents}" version)
+ if (NOT version EQUAL 1)
+ snippet_error("${snippet}" "Version must be 1, got: ${version}")
+ endif()
+ string(JSON role GET "${contents}" role)
+ get_filename_component(filename "${snippet}" NAME)
+ if (NOT filename MATCHES "^${role}-")
+ snippet_error("${snippet}" "Role \"${role}\" doesn't match snippet filename")
+ endif()
+ string(JSON outputs ERROR_VARIABLE noOutputs GET "${contents}" outputs)
+ if (NOT outputs MATCHES NOTFOUND)
+ string(JSON outputSizes ERROR_VARIABLE noOutputSizes GET "${contents}" outputSizes)
+ list(LENGTH outputs outputsLen)
+ list(LENGTH outputSizes outputSizesLen)
+ if (outputSizes MATCHES NOTFOUND OR NOT outputsLen EQUAL outputSizesLen)
+ snippet_error("${snippet}" "outputs and outputSizes do not match")
+ endif()
+ endif()
+ return(PROPAGATE ERROR_MESSAGE RunCMake_TEST_FAILED role)
+endfunction()
diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt b/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt
index e14fcde..a48bded 100644
--- a/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt
+++ b/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt
@@ -1,15 +1,20 @@
-CMake Error at invalid_name.cmake:2 \(add_library\):
- add_library Invalid name for INTERFACE library target: if\$ace
+^CMake Error at invalid_name\.cmake:1 \(add_library\):
+ The target name "if\$ace" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior\.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+
-CMake Error at invalid_name.cmake:4 \(add_library\):
- add_library Invalid name for INTERFACE library target: iface::target
+CMake Error at invalid_name\.cmake:2 \(add_library\):
+ The target name "iface::target" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior\.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+
-CMake Error at invalid_name.cmake:6 \(add_library\):
- add_library Invalid name for IMPORTED INTERFACE library target:
- if\$target_imported
+CMake Error at invalid_name\.cmake:3 \(add_library\):
+ The target name "if\$target_imported" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior\.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake b/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake
index 4a8ca37..3c9a90a 100644
--- a/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake
+++ b/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake
@@ -1,6 +1,3 @@
-cmake_policy(SET CMP0037 OLD)
add_library(if$ace INTERFACE)
-
add_library(iface::target INTERFACE)
-
add_library(if$target_imported INTERFACE IMPORTED)
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-result.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-stderr.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-stderr.txt
deleted file mode 100644
index d756db1..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-stderr.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:3 \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMP0028-OLD-iface\.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0028 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/LinkItemValidation/CMP0028-OLD-iface.cmake b/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface.cmake
deleted file mode 100644
index d7bd60e..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-cmake_policy(SET CMP0028 OLD)
-
-add_library(iface INTERFACE)
-target_link_libraries(iface INTERFACE External::Library)
-add_library(foo empty.cpp)
-target_link_libraries(foo iface)
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-result.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-stderr.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-stderr.txt
deleted file mode 100644
index 8ebf949..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD-stderr.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:3 \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMP0028-OLD\.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0028 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/LinkItemValidation/CMP0028-OLD.cmake b/Tests/RunCMake/LinkItemValidation/CMP0028-OLD.cmake
deleted file mode 100644
index d4a870b..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-OLD.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-cmake_policy(SET CMP0028 OLD)
-
-add_library(foo empty.cpp)
-target_link_libraries(foo PRIVATE External::Library)
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-result.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-stderr.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-stderr.txt
deleted file mode 100644
index bb6a16e..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-stderr.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-CMake Warning \(dev\) at CMP0028-WARN-iface\.cmake:3 \(target_link_libraries\):
- Policy CMP0028 is not set: Double colon in target name means ALIAS or
- IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
- Use the cmake_policy command to set the policy and suppress this warning.
-
- The link interface of target "iface" contains:
-
- External::Library
-
- but the target was not found. Possible reasons include:
-(
- \*[^
-]+)*
-
-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/LinkItemValidation/CMP0028-WARN-iface.cmake b/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface.cmake
deleted file mode 100644
index 9270023..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-add_library(iface INTERFACE)
-target_link_libraries(iface INTERFACE External::Library)
-add_library(foo empty.cpp)
-target_link_libraries(foo iface)
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-result.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-stderr.txt b/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-stderr.txt
deleted file mode 100644
index c0cb5b0..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN-stderr.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-CMake Warning \(dev\) at CMP0028-WARN\.cmake:3 \(target_link_libraries\):
- Policy CMP0028 is not set: Double colon in target name means ALIAS or
- IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
- Use the cmake_policy command to set the policy and suppress this warning.
-
- Target "foo" links to:
-
- External::Library
-
- but the target was not found. Possible reasons include:
-(
- \*[^
-]+)*
-
-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/LinkItemValidation/CMP0028-WARN.cmake b/Tests/RunCMake/LinkItemValidation/CMP0028-WARN.cmake
deleted file mode 100644
index 70a6cc6..0000000
--- a/Tests/RunCMake/LinkItemValidation/CMP0028-WARN.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-
-add_library(foo empty.cpp)
-target_link_libraries(foo PRIVATE External::Library)
diff --git a/Tests/RunCMake/LinkItemValidation/CMakeLists.txt b/Tests/RunCMake/LinkItemValidation/CMakeLists.txt
index 9467ea4..48cc6f4 100644
--- a/Tests/RunCMake/LinkItemValidation/CMakeLists.txt
+++ b/Tests/RunCMake/LinkItemValidation/CMakeLists.txt
@@ -1,6 +1,3 @@
cmake_minimum_required(VERSION 3.10)
-if(RunCMake_TEST MATCHES "^CMP0028")
- cmake_minimum_required(VERSION 2.8.12) # old enough to not set CMP0028
-endif()
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir
diff --git a/Tests/RunCMake/LinkItemValidation/RunCMakeTest.cmake b/Tests/RunCMake/LinkItemValidation/RunCMakeTest.cmake
index c423f6a..e94dc94 100644
--- a/Tests/RunCMake/LinkItemValidation/RunCMakeTest.cmake
+++ b/Tests/RunCMake/LinkItemValidation/RunCMakeTest.cmake
@@ -1,10 +1,6 @@
include(RunCMake)
run_cmake(CMP0028-NEW)
-run_cmake(CMP0028-OLD)
-run_cmake(CMP0028-WARN)
run_cmake(CMP0028-NEW-iface)
-run_cmake(CMP0028-OLD-iface)
-run_cmake(CMP0028-WARN-iface)
run_cmake(OnlyTargets)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt b/Tests/RunCMake/LinkWarningAsError/BadValue-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt
+++ b/Tests/RunCMake/LinkWarningAsError/BadValue-result.txt
diff --git a/Tests/RunCMake/LinkWarningAsError/BadValue-stderr.txt b/Tests/RunCMake/LinkWarningAsError/BadValue-stderr.txt
new file mode 100644
index 0000000..78a5a45
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/BadValue-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error:
+ Erroneous value\(s\) for 'LINK_WARNING_AS_ERROR' property of target 'main':
+
+ FOO
diff --git a/Tests/RunCMake/LinkWarningAsError/BadValue.cmake b/Tests/RunCMake/LinkWarningAsError/BadValue.cmake
new file mode 100644
index 0000000..46441fd
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/BadValue.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_executable(main main.c)
+set_property(TARGET main PROPERTY LINK_WARNING_AS_ERROR FOO)
diff --git a/Tests/RunCMake/LinkWarningAsError/CMakeLists.txt b/Tests/RunCMake/LinkWarningAsError/CMakeLists.txt
new file mode 100644
index 0000000..674c652
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.31...4.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/RunCMakeTest.cmake b/Tests/RunCMake/LinkWarningAsError/RunCMakeTest.cmake
new file mode 100644
index 0000000..09ec4a4
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/RunCMakeTest.cmake
@@ -0,0 +1,33 @@
+include(RunCMake)
+
+# Isolate test cases from the caller's environment.
+if(DEFINED ENV{CFLAGS})
+ string(REGEX REPLACE "-Werror[^ ]*" "" cflags "$ENV{CFLAGS}")
+ set(ENV{CFLAGS} "${cflags}")
+endif()
+if(DEFINED ENV{LDFLAGS})
+ string(REGEX REPLACE "-Wl,--fatal-warnings[^ ]*" "" ldflags "$ENV{LDFLAGS}")
+ set(ENV{LDFLAGS} "${ldflags}")
+endif()
+
+run_cmake(BadValue)
+
+function(run_link_warn test)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_with_options(${test} ${ARGN})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(ARGN MATCHES "--link-no-warning-as-error")
+ # Cause the build system to re-run CMake to verify that this option is preserved.
+ run_cmake_command(${test}-Touch ${CMAKE_COMMAND} -E touch_nocreate CMakeCache.txt)
+ endif()
+ run_cmake_command(${test}-Build ${CMAKE_COMMAND} --build . --verbose)
+endfunction()
+
+run_link_warn(WarnErrorOn1)
+run_link_warn(WarnErrorOn2)
+run_link_warn(WarnErrorOn3)
+run_link_warn(WarnErrorOn4)
+run_link_warn(WarnErrorOff1)
+run_link_warn(WarnErrorOff2)
+run_link_warn(WarnErrorOnIgnore "--link-no-warning-as-error")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnError-validation.cmake b/Tests/RunCMake/LinkWarningAsError/WarnError-validation.cmake
new file mode 100644
index 0000000..9f2c8df
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnError-validation.cmake
@@ -0,0 +1,19 @@
+
+set(reference_file "${RunCMake_TEST_BINARY_DIR}/WARNING_AS_ERROR.txt")
+if (NOT EXISTS "${reference_file}")
+ set (RunCMake_TEST_FAILED "${reference_file}: Reference file not found.")
+ return()
+endif()
+file(READ "${reference_file}" WarnErrorFlags)
+
+if(NOT WarnErrorFlags STREQUAL "UNDEFINED")
+ if(WARNING_AS_ERROR)
+ if(NOT actual_stdout MATCHES "${WarnErrorFlags}")
+ set (RunCMake_TEST_FAILED "LINK_WARNING_AS_ERROR: flag is missing.")
+ endif()
+ else()
+ if(actual_stdout MATCHES "${WarnErrorFlags}")
+ set (RunCMake_TEST_FAILED "LINK_WARNING_AS_ERROR: flag unexpectedly present: '${WarnErrorFlags}'")
+ endif()
+ endif()
+endif()
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnError.cmake b/Tests/RunCMake/LinkWarningAsError/WarnError.cmake
new file mode 100644
index 0000000..91d3d68
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnError.cmake
@@ -0,0 +1,103 @@
+
+set(linkWarning "${link_warning_as_error}")
+if (DEFINED CMAKE_LINK_WARNING_AS_ERROR)
+ set(linkWarning "${CMAKE_LINK_WARNING_AS_ERROR}")
+endif()
+if (linkWarning STREQUAL "ON")
+ set (linkWarning DRIVER LINKER)
+endif()
+
+if((linkWarning STREQUAL "DRIVER;LINKER" AND NOT CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR
+ AND NOT CMAKE_C_LINK_OPTIONS_WARNING_AS_ERROR)
+ OR (linkWarning STREQUAL "DRIVER" AND NOT CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR)
+ OR (linkWarning STREQUAL "LINKER" AND NOT CMAKE_C_LINK_OPTIONS_WARNING_AS_ERROR))
+ set(WarnErrorFlags "UNDEFINED")
+else()
+ set(cfg_dir)
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
+ set(cfg_dir /Debug)
+ endif()
+ set(DUMP_EXE "${CMAKE_CURRENT_BINARY_DIR}${cfg_dir}/dump${CMAKE_EXECUTABLE_SUFFIX}")
+
+ add_executable(dump dump.c)
+ set_property(TARGET dump PROPERTY LINK_WARNING_AS_ERROR OFF)
+
+ # ensure no temp file nor response file will be used
+ set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
+ string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
+ string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
+
+ add_executable(main main.c)
+ if (NOT DEFINED CMAKE_LINK_WARNING_AS_ERROR)
+ set_property(TARGET main PROPERTY LINK_WARNING_AS_ERROR ${link_warning_as_error})
+ endif()
+ # use LAUNCH facility to dump linker command
+ set_property(TARGET main PROPERTY RULE_LAUNCH_LINK "\"${DUMP_EXE}\"")
+
+ add_dependencies(main dump)
+
+ # generate reference for WARNING_AS_ERROR flag
+ unset(compiler_WarnError)
+ unset(linker_WarnError)
+ unset(WarnErrorFlags)
+ ## DRIVER
+ if (CMAKE_C_LINK_MODE STREQUAL "DRIVER")
+ list(JOIN CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR " " compiler_WarnError)
+ endif()
+ ## LINKER
+ string(REPLACE "LINKER:" "" linker_WarnError "${CMAKE_C_LINK_OPTIONS_WARNING_AS_ERROR}")
+ if (CMAKE_C_LINKER_WRAPPER_FLAG)
+ set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG})
+ list(GET linker_flag -1 linker_space)
+ if (linker_space STREQUAL " ")
+ list(REMOVE_AT linker_flag -1)
+ else()
+ set(linker_space)
+ endif()
+ list(JOIN linker_flag " " linker_flag)
+ if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP)
+ string(REPLACE "," "${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}" linker_WarnError "${linker_WarnError}")
+ set(linker_WarnError "${linker_flag}${linker_space}${linker_WarnError}")
+ else()
+ set(linker_prefix "${linker_flag}${linker_space}")
+ string(REPLACE "," ";" linker_WarnError "${linker_WarnError}")
+ list(TRANSFORM linker_WarnError PREPEND "${linker_prefix}")
+ list(JOIN linker_WarnError " " linker_WarnError)
+ endif()
+ else()
+ string(REPLACE "," " " linker_WarnError "${linker_WarnError}")
+ endif()
+
+ # Add regex [^-] to avoid matching of MSVC compiler flag -WX-
+ if(linkWarning STREQUAL "DRIVER;LINKER")
+ set(WarnErrorFlags "${compiler_WarnError}")
+ if (WarnErrorFlags)
+ string(APPEND WarnErrorFlags " ${linker_WarnError}[^-]")
+ else()
+ set(WarnErrorFlags "${linker_WarnError}[^-]")
+ endif()
+ elseif(linkWarning STREQUAL "DRIVER")
+ set(WarnErrorFlags "${compiler_WarnError}[^-]")
+ elseif(linkWarning STREQUAL "LINKER")
+ set(WarnErrorFlags "${linker_WarnError}[^-]")
+ else()
+ # OFF value
+ if(compiler_WarnError AND linker_WarnError)
+ set(WarnErrorFlags "(${compiler_WarnError}[^-]|${linker_WarnError}[^-])+")
+ elseif(compiler_WarnError)
+ set(WarnErrorFlags "${compiler_WarnError}[^-]")
+ elseif(linker_WarnError)
+ set(WarnErrorFlags "${linker_WarnError}[^-]")
+ endif()
+ if(NOT WarnErrorFlags)
+ set(WarnErrorFlags "UNDEFINED")
+ endif()
+ endif()
+endif()
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ # replace '-' with '/' for options
+ string(REGEX REPLACE "-([A-Z]+)" "[-/]\\1" WarnErrorFlags "${WarnErrorFlags}")
+endif()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/WARNING_AS_ERROR.txt" "${WarnErrorFlags}")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOff1-Build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff1-Build-check.cmake
new file mode 100644
index 0000000..77f6de4
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff1-Build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR OFF)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOff1.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff1.cmake
new file mode 100644
index 0000000..d4e7ba1
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff1.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(link_warning_as_error OFF)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOff2-Build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff2-Build-check.cmake
new file mode 100644
index 0000000..77f6de4
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff2-Build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR OFF)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOff2.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff2.cmake
new file mode 100644
index 0000000..14f1a4c
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOff2.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(CMAKE_LINK_WARNING_AS_ERROR OFF)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn1-Build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn1-Build-check.cmake
new file mode 100644
index 0000000..c395cda
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn1-Build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR ON)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn1.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn1.cmake
new file mode 100644
index 0000000..0fa198b
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn1.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(link_warning_as_error ON)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn2-Build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn2-Build-check.cmake
new file mode 100644
index 0000000..c395cda
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn2-Build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR ON)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn2.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn2.cmake
new file mode 100644
index 0000000..4fe0f00
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn2.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(CMAKE_LINK_WARNING_AS_ERROR ON)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn3-build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn3-build-check.cmake
new file mode 100644
index 0000000..c395cda
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn3-build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR ON)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn3.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn3.cmake
new file mode 100644
index 0000000..6ec5a1e
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn3.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(link_warning_as_error DRIVER)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn4-build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn4-build-check.cmake
new file mode 100644
index 0000000..c395cda
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn4-build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR ON)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOn4.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn4.cmake
new file mode 100644
index 0000000..13c89e6
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOn4.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(link_warning_as_error LINKER)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore-Build-check.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore-Build-check.cmake
new file mode 100644
index 0000000..77f6de4
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore-Build-check.cmake
@@ -0,0 +1,4 @@
+
+set(WARNING_AS_ERROR OFF)
+
+include("${CMAKE_CURRENT_LIST_DIR}/WarnError-validation.cmake")
diff --git a/Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore.cmake b/Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore.cmake
new file mode 100644
index 0000000..0fa198b
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/WarnErrorOnIgnore.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+set(link_warning_as_error ON)
+
+include(WarnError.cmake)
diff --git a/Tests/RunCMake/LinkWarningAsError/dump.c b/Tests/RunCMake/LinkWarningAsError/dump.c
new file mode 100644
index 0000000..8baa313
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/dump.c
@@ -0,0 +1,13 @@
+
+#include "stdio.h"
+
+int main(int argc, char* argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ printf("%s ", argv[i]);
+ printf("\n");
+
+ return 0;
+}
diff --git a/Tests/RunCMake/LinkWarningAsError/main.c b/Tests/RunCMake/LinkWarningAsError/main.c
new file mode 100644
index 0000000..402eac3
--- /dev/null
+++ b/Tests/RunCMake/LinkWarningAsError/main.c
@@ -0,0 +1,5 @@
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake b/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake
index 1121608..529202a 100644
--- a/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake
+++ b/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake
@@ -26,13 +26,13 @@ endif()
#
# Generate file for validation
#
-if (CMAKE_C_USING_LINKER_MODE STREQUAL "TOOL")
+if (CMAKE_C_LINK_MODE STREQUAL "LINKER")
cmake_path(GET CMAKE_C_USING_LINKER_FOO_C FILENAME LINKER_TYPE_OPTION)
else()
set(LINKER_TYPE_OPTION "${CMAKE_C_USING_LINKER_FOO_C}")
endif()
if(CMake_TEST_CUDA)
- if (CMAKE_CUDA_USING_LINKER_MODE STREQUAL "TOOL")
+ if (CMAKE_CUDA_LINK_MODE STREQUAL "LINKER")
cmake_path(GET CMAKE_CUDA_USING_LINKER_FOO_CUDA FILENAME CUDA_LINKER)
else()
set(CUDA_LINKER "${CMAKE_CUDA_USING_LINKER_FOO_CUDA}")
@@ -41,7 +41,7 @@ if(CMake_TEST_CUDA)
endif()
if(CMake_TEST_Swift)
- if(CMAKE_Swift_USING_LINKER_MODE STREQUAL "TOOL")
+ if(CMAKE_Swift_LINK_MODE STREQUAL "LINKER")
cmake_path(GET CMAKE_Swift_USING_LINKER_FOO_Swift FILENAME Swift_LINKER)
else()
set(Swift_LINKER "${CMAKE_Swift_USING_LINKER_FOO_Swift}")
diff --git a/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake b/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake
index 9170f5c..5f92e47 100644
--- a/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake
+++ b/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake
@@ -19,13 +19,13 @@ endif()
#
# Generate file for validation
#
-if (CMAKE_C_USING_LINKER_MODE STREQUAL "TOOL")
+if (CMAKE_C_LINK_MODE STREQUAL "LINKER")
cmake_path(GET CMAKE_C_USING_LINKER_LLD FILENAME LINKER_TYPE_OPTION)
else()
set(LINKER_TYPE_OPTION "${CMAKE_C_USING_LINKER_LLD}")
endif()
if(CMake_TEST_CUDA)
- if (CMAKE_CUDA_USING_LINKER_MODE STREQUAL "TOOL")
+ if (CMAKE_CUDA_LINK_MODE STREQUAL "LINKER")
cmake_path(GET CMAKE_CUDA_USING_LINKER_LLD FILENAME CUDA_LINKER)
else()
set(CUDA_LINKER "${CMAKE_CUDA_USING_LINKER_LLD}")
@@ -33,7 +33,7 @@ if(CMake_TEST_CUDA)
string(APPEND LINKER_TYPE_OPTION "|${CUDA_LINKER}")
endif()
if(CMake_TEST_Swift)
- if(CMAKE_Swift_USING_LINKER_MODE STREQUAL "TOOL")
+ if(CMAKE_Swift_LINK_MODE STREQUAL "LINKER")
cmake_path(GET CMAKE_Swift_USING_LINKER_LLD FILENAME LINKER_TYPE_OPTION)
else()
set(Swift_LINKER "${CMAKE_Swift_USING_LINKER_LLD}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-result.txt
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-stderr.txt b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-stderr.txt
new file mode 100644
index 0000000..0fc2135
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error in CMakeLists.txt:
+ MSVC_RUNTIME_CHECKS value 'BogusValue' not known for this C compiler.
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW.cmake b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW.cmake
new file mode 100644
index 0000000..0f0d3c3
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0184 NEW)
+include(CMP0184-common.cmake)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NoEffect.cmake b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NoEffect.cmake
new file mode 100644
index 0000000..13244b1
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-NoEffect.cmake
@@ -0,0 +1,4 @@
+include(CMP0184-common.cmake)
+
+# Setting this policy after enable_language command has no effect.
+cmake_policy(SET CMP0184 NEW)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-OLD.cmake b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-OLD.cmake
new file mode 100644
index 0000000..32dc4ff
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0184 OLD)
+include(CMP0184-common.cmake)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-WARN.cmake b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-WARN.cmake
new file mode 100644
index 0000000..7e960ab
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0184-common.cmake)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-common.cmake b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-common.cmake
new file mode 100644
index 0000000..c3ca394
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMP0184-common.cmake
@@ -0,0 +1,25 @@
+enable_language(C)
+
+cmake_policy(GET CMP0184 cmp0184)
+if(cmp0184 STREQUAL "NEW")
+ if(NOT CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT)
+ message(SEND_ERROR "CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT not set under NEW behavior")
+ endif()
+else()
+ if(CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT)
+ message(SEND_ERROR "CMAKE_MSVC_RUNTIME_CHECKS_DEFAULT is set under OLD behavior")
+ endif()
+endif()
+
+if(cmp0184 STREQUAL "NEW")
+ if(CMAKE_C_FLAGS_DEBUG MATCHES "[/-](RTC1|GZ)( |$)")
+ message(SEND_ERROR "CMAKE_C_FLAGS_DEBUG has -RTC1 flag under NEW behavior:\n ${CMAKE_C_FLAGS_DEBUG}")
+ endif()
+else()
+ if(NOT (CMAKE_C_FLAGS_DEBUG MATCHES "/(RTC1|GZ)( |$)"))
+ message(SEND_ERROR "CMAKE_C_FLAGS_DEBUG does not have /RTC1 flag under OLD behavior:\n ${CMAKE_C_FLAGS_DEBUG}")
+ endif()
+endif()
+
+set(CMAKE_MSVC_RUNTIME_CHECKS BogusValue)
+add_library(foo empty.c)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/CMakeLists.txt b/Tests/RunCMake/MSVCRuntimeChecks/CMakeLists.txt
new file mode 100644
index 0000000..b7814f2
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.31)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/RunCMakeTest.cmake b/Tests/RunCMake/MSVCRuntimeChecks/RunCMakeTest.cmake
new file mode 100644
index 0000000..a2fe769
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(CMP0184-WARN)
+run_cmake(CMP0184-OLD)
+run_cmake(CMP0184-NEW)
+run_cmake(CMP0184-NoEffect)
diff --git a/Tests/RunCMake/MSVCRuntimeChecks/empty.c b/Tests/RunCMake/MSVCRuntimeChecks/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeChecks/empty.c
diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt
index b664fa0..01d446c 100644
--- a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt
@@ -19,7 +19,7 @@ Call Stack \(most recent call first\):
.*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\)
.*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\)
.*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\)
- .*/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env/test\.cmake:10 \(ctest_read_custom_files\)
+ .*/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env/test\.cmake:5 \(ctest_read_custom_files\)
Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake
diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt
index bc89703..2e81bcb 100644
--- a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt
@@ -19,7 +19,7 @@ Call Stack \(most recent call first\):
.*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\)
.*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\)
.*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\)
- .*/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var/test\.cmake:10 \(ctest_read_custom_files\)
+ .*/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var/test\.cmake:5 \(ctest_read_custom_files\)
Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake
diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt
index b10b26d..0586d4f 100644
--- a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt
@@ -11,41 +11,41 @@ CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_11\.cmake:1
Maximum recursion depth of 10 exceeded
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_10\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_10\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_9\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_9\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_8\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_8\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_7\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_7\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_6\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_6\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_5\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_5\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_4\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_4\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_3\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_3\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_2\.cmake:13 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_2\.cmake:8 \(message\):
Nested script failed
-CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var/test\.cmake:19 \(message\):
+CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var/test\.cmake:14 \(message\):
Nested script failed$
diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in
index d4f28c4..5646a00 100644
--- a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in
+++ b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in
@@ -1,12 +1,7 @@
cmake_minimum_required(VERSION 3.12)
-set(CTEST_RUN_CURRENT_SCRIPT 0)
message("@LEVEL_CURRENT@")
-set(CTEST_SOURCE_DIRECTORY "@CTEST_SOURCE_DIRECTORY@")
-set(CTEST_BINARY_DIRECTORY "@CTEST_BINARY_DIRECTORY@")
-set(CTEST_COMMAND "@CTEST_COMMAND@")
-
ctest_run_script("${CMAKE_CURRENT_LIST_DIR}/ctest_run_script_@LEVEL_NEXT@.cmake" RETURN_VALUE val)
if(NOT val EQUAL 0)
diff --git a/Tests/RunCMake/MaxRecursionDepth/test.cmake.in b/Tests/RunCMake/MaxRecursionDepth/test.cmake.in
index fd1fc10..62c8e41 100644
--- a/Tests/RunCMake/MaxRecursionDepth/test.cmake.in
+++ b/Tests/RunCMake/MaxRecursionDepth/test.cmake.in
@@ -1,9 +1,4 @@
cmake_minimum_required(VERSION 3.12)
-set(CTEST_RUN_CURRENT_SCRIPT 0)
-
-set(CTEST_SOURCE_DIRECTORY "@RunCMake_SOURCE_DIR@")
-set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@")
-set(CTEST_COMMAND "${CMAKE_CTEST_COMMAND}")
if(TEST_NAME STREQUAL "ctest_read_custom_files")
set(x 2)
diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake
index 0f77930..6128167 100644
--- a/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake
+++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake
@@ -1,3 +1,2 @@
-cmake_policy(SET CMP0058 NEW)
set(byproducts BYPRODUCTS byproduct1a byproduct1b)
include(CMP0058-common.cmake)
diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake
index 582e3d5..7bc66ef 100644
--- a/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake
+++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0058 NEW)
include(CMP0058-common.cmake)
diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt
deleted file mode 100644
index 8646a13..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^[^
-]* Generating output1
-[^
-]* Generating output2$
diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt
deleted file mode 100644
index 4cf1f19..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-^CMake Deprecation Warning at CMP0058-OLD-by\.cmake:[0-9] \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9] \(include\)
-+
-CMake Deprecation Warning at CMP0058-OLD-by\.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0058 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/Ninja/CMP0058-OLD-by.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake
deleted file mode 100644
index 45e5aa3..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_policy(VERSION 3.2)
-cmake_policy(SET CMP0058 OLD)
-set(byproducts BYPRODUCTS byproduct1a byproduct1b)
-include(CMP0058-common.cmake)
diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt
deleted file mode 100644
index 8646a13..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^[^
-]* Generating output1
-[^
-]* Generating output2$
diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt
deleted file mode 100644
index 6a9bc62..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-^CMake Deprecation Warning at CMP0058-OLD-no\.cmake:[0-9] \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9] \(include\)
-+
-CMake Deprecation Warning at CMP0058-OLD-no\.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0058 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/Ninja/CMP0058-OLD-no.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake
deleted file mode 100644
index 388e018..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_policy(VERSION 3.2)
-cmake_policy(SET CMP0058 OLD)
-include(CMP0058-common.cmake)
diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt
deleted file mode 100644
index 8646a13..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^[^
-]* Generating output1
-[^
-]* Generating output2$
diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-by-stderr.txt
deleted file mode 100644
index 5abfda7..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-WARN-by-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-^CMake Deprecation Warning at CMP0058-WARN-by\.cmake:[0-9] \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9] \(include\)$
diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake
deleted file mode 100644
index 6f5484a..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_policy(VERSION 3.2)
-set(byproducts BYPRODUCTS byproduct1a byproduct1b)
-include(CMP0058-common.cmake)
diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt
deleted file mode 100644
index 8646a13..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^[^
-]* Generating output1
-[^
-]* Generating output2$
diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt
deleted file mode 100644
index 70d9451..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-^CMake Deprecation Warning at CMP0058-WARN-no\.cmake:[0-9] \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9] \(include\)
-+
-CMake Warning \(dev\):
- Policy CMP0058 is not set: Ninja requires custom command byproducts to be
- explicit. Run "cmake --help-policy CMP0058" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- This project specifies custom command DEPENDS on files in the build tree
- that are not specified as the OUTPUT or BYPRODUCTS of any
- add_custom_command or add_custom_target:
-
- byproduct1a
- byproduct1b
-
- For compatibility with versions of CMake that did not have the BYPRODUCTS
- option, CMake is generating phony rules for such files to convince 'ninja'
- to build.
-
- Project authors should add the missing BYPRODUCTS or OUTPUT options to the
- custom commands that produce these files.
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake
deleted file mode 100644
index 714ae64..0000000
--- a/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(VERSION 3.2)
-include(CMP0058-common.cmake)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index d1f99b2..a0e59ee 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -93,10 +93,6 @@ function(run_CMP0058 case)
run_cmake_command(CMP0058-${case}-build ${CMAKE_COMMAND} --build .)
endfunction()
-run_CMP0058(OLD-no)
-run_CMP0058(OLD-by)
-run_CMP0058(WARN-no)
-run_CMP0058(WARN-by)
run_CMP0058(NEW-no)
run_CMP0058(NEW-by)
@@ -179,7 +175,7 @@ ${ninja_stderr}
"top ninja build failed exited with status ${ninja_result}")
endif()
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
-endfunction(run_ninja)
+endfunction()
function (run_LooseObjectDepends)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LooseObjectDepends-build)
@@ -260,11 +256,11 @@ macro(ninja_escape_path path out)
string(REPLACE "\$ " "\$\$" "${out}" "${path}")
string(REPLACE " " "\$ " "${out}" "${${out}}")
string(REPLACE ":" "\$:" "${out}" "${${out}}")
-endmacro(ninja_escape_path)
+endmacro()
macro(shell_escape string out)
string(REPLACE "\"" "\\\"" "${out}" "${string}")
-endmacro(shell_escape)
+endmacro()
function(run_sub_cmake test ninja_output_path_prefix)
set(top_build_dir "${RunCMake_BINARY_DIR}/${test}-build/")
@@ -347,7 +343,7 @@ build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_pa
build.ninja = ${mtime_top_build_ninja}")
endif()
-endfunction(run_sub_cmake)
+endfunction()
if("${ninja_version}" VERSION_LESS 1.6)
message(WARNING "Ninja is too old; skipping rest of test.")
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index f1e8b30..aef8870 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -470,6 +470,19 @@ run_cmake_command(OutputPathPrefix-clean-ninja "${RunCMake_MAKE_PROGRAM}" -f Out
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_BINARY_DIR)
+# cmake --install test
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/cmake--install-build)
+ run_cmake_with_options(cmake--install
+ -DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install
+ -DCMAKE_CROSS_CONFIGS=all
+ -DCMAKE_DEFAULT_CONFIGS=Debug\\\\;Release
+ )
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(cmake--install-build ${CMAKE_COMMAND} --build .)
+ run_cmake_command(cmake--install-install ${CMAKE_COMMAND} --install .)
+endblock()
+
# CudaSimple uses separable compilation, which is currently only supported on NVCC.
if(CMake_TEST_CUDA)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build)
diff --git a/Tests/RunCMake/NinjaMultiConfig/cmake--install-install-check.cmake b/Tests/RunCMake/NinjaMultiConfig/cmake--install-install-check.cmake
new file mode 100644
index 0000000..e6a9f95
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/cmake--install-install-check.cmake
@@ -0,0 +1,4 @@
+if (NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/install/bin/Debug/exe${CMAKE_EXECUTABLE_SUFFIX} OR
+ NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/exe${CMAKE_EXECUTABLE_SUFFIX})
+ set(RunCMake_TEST_FAILED "Multi-Config Install with CMAKE_DEFAULT_CONFIGS set did not install all specified configs by default")
+endif()
diff --git a/Tests/RunCMake/NinjaMultiConfig/cmake--install.cmake b/Tests/RunCMake/NinjaMultiConfig/cmake--install.cmake
new file mode 100644
index 0000000..e0c31b5
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/cmake--install.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Install.cmake)
diff --git a/Tests/RunCMake/NinjaMultiConfig/generator.c b/Tests/RunCMake/NinjaMultiConfig/generator.c
index 465ee2f..d80675c 100644
--- a/Tests/RunCMake/NinjaMultiConfig/generator.c
+++ b/Tests/RunCMake/NinjaMultiConfig/generator.c
@@ -3,12 +3,12 @@
/* FIXME Get this working */
/*#include <intdir_config.h>*/
-const char* generatorlib_genex_config_definition(void);
-const char* generatorlib_genex_config_include_dir(void);
-const char* generatorobj_genex_config_definition(void);
-const char* generatorobj_genex_config_include_dir(void);
+char const* generatorlib_genex_config_definition(void);
+char const* generatorlib_genex_config_include_dir(void);
+char const* generatorobj_genex_config_definition(void);
+char const* generatorobj_genex_config_include_dir(void);
-static const char contents[] =
+static char const contents[] =
/* clang-format off */
"#include <stdio.h>\n"
"\n"
@@ -78,7 +78,7 @@ static const char contents[] =
int main(int argc, char** argv)
{
- const char* filename;
+ char const* filename;
FILE* fout;
if (argc < 2) {
diff --git a/Tests/RunCMake/NinjaMultiConfig/generatorlib.c b/Tests/RunCMake/NinjaMultiConfig/generatorlib.c
index de5c8f3..40d847e 100644
--- a/Tests/RunCMake/NinjaMultiConfig/generatorlib.c
+++ b/Tests/RunCMake/NinjaMultiConfig/generatorlib.c
@@ -2,12 +2,12 @@
/* FIXME Get this working */
/*#include <intdir_config.h>*/
-const char* generatorlib_genex_config_definition(void)
+char const* generatorlib_genex_config_definition(void)
{
return GENEX_CONFIG_DEFINITION;
}
-const char* generatorlib_genex_config_include_dir(void)
+char const* generatorlib_genex_config_include_dir(void)
{
return GENEX_CONFIG_INCLUDE_DIR;
}
diff --git a/Tests/RunCMake/NinjaMultiConfig/generatorobj.c b/Tests/RunCMake/NinjaMultiConfig/generatorobj.c
index 7bb5aa6..85c2107 100644
--- a/Tests/RunCMake/NinjaMultiConfig/generatorobj.c
+++ b/Tests/RunCMake/NinjaMultiConfig/generatorobj.c
@@ -2,12 +2,12 @@
/* FIXME Get this working */
/*#include <intdir_config.h>*/
-const char* generatorobj_genex_config_definition(void)
+char const* generatorobj_genex_config_definition(void)
{
return GENEX_CONFIG_DEFINITION;
}
-const char* generatorobj_genex_config_include_dir(void)
+char const* generatorobj_genex_config_include_dir(void)
{
return GENEX_CONFIG_INCLUDE_DIR;
}
diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
index c663707..84c46d6 100644
--- a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
@@ -1 +1,3 @@
-CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in any export set.
+CMake Error in CMakeLists.txt:
+ install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A"
+ that is not in any export set.
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake
index db571a3..d9e9dde 100644
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0022 NEW)
-
enable_language(C)
add_library(AnObjLib OBJECT a.c)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake
index 6bb8d5e..4c0842b 100644
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0022 NEW)
-
enable_language(C)
add_library(AnObjLib OBJECT a.c)
diff --git a/Tests/RunCMake/PackageInfo/BadDefaultTarget-stderr.txt b/Tests/RunCMake/PackageInfo/BadDefaultTarget-stderr.txt
index 6467a14..5cbdfae 100644
--- a/Tests/RunCMake/PackageInfo/BadDefaultTarget-stderr.txt
+++ b/Tests/RunCMake/PackageInfo/BadDefaultTarget-stderr.txt
@@ -1,2 +1,8 @@
-CMake Error: Package "test" specifies DEFAULT_TARGETS "dog", which is not a target in the export set "foo".
-CMake Error: Package "test" specifies DEFAULT_TARGETS "cat", which is not a target in the export set "foo".
+CMake Error in CMakeLists.txt:
+ Package "test" specifies DEFAULT_TARGETS "dog", which is not a target in
+ the export set "foo".
+
+
+CMake Error in CMakeLists.txt:
+ Package "test" specifies DEFAULT_TARGETS "cat", which is not a target in
+ the export set "foo".
diff --git a/Tests/RunCMake/PackageInfo/DependsMultiple.cmake b/Tests/RunCMake/PackageInfo/DependsMultiple.cmake
new file mode 100644
index 0000000..314c074
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultiple.cmake
@@ -0,0 +1,3 @@
+project(DependsMultiple CXX)
+set(NAMESPACE foo::)
+include(DependsMultipleCommon.cmake)
diff --git a/Tests/RunCMake/PackageInfo/DependsMultipleCommon.cmake b/Tests/RunCMake/PackageInfo/DependsMultipleCommon.cmake
new file mode 100644
index 0000000..388ce48
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleCommon.cmake
@@ -0,0 +1,11 @@
+add_library(foo foo.cxx)
+add_library(bar foo.cxx)
+target_link_libraries(bar foo)
+
+install(TARGETS foo EXPORT foo)
+install(EXPORT foo DESTINATION cmake NAMESPACE ${NAMESPACE})
+install(PACKAGE_INFO foo EXPORT foo DESTINATION cps)
+
+install(TARGETS bar EXPORT bar)
+install(EXPORT bar DESTINATION .)
+install(PACKAGE_INFO bar EXPORT bar DESTINATION cps)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-result.txt
diff --git a/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-stderr.txt b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-stderr.txt
new file mode 100644
index 0000000..cfaf949
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace-stderr.txt
@@ -0,0 +1,19 @@
+CMake Error in CMakeLists.txt:
+ install\(EXPORT "bar" ...\) includes target "bar" which requires target "foo"
+ that is not in this export set, but in another export set which is exported
+ multiple times with different namespaces: cmake/foo.cmake, cps/foo.cps.
+
+ An exported target cannot depend upon another target which is exported in
+ more than one export set or with more than one namespace. Consider
+ consolidating the exports of the "foo" target to a single export.
+
+
+CMake Error in CMakeLists.txt:
+ install\(PACKAGE_INFO "bar" ...\) includes target "bar" which requires target
+ "foo" that is not in this export set, but in another export set which is
+ exported multiple times with different namespaces: cmake/foo.cmake,
+ cps/foo.cps.
+
+ An exported target cannot depend upon another target which is exported in
+ more than one export set or with more than one namespace. Consider
+ consolidating the exports of the "foo" target to a single export.
diff --git a/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace.cmake b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace.cmake
new file mode 100644
index 0000000..a874757
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentNamespace.cmake
@@ -0,0 +1,3 @@
+project(DependsMultipleDifferentNamespace CXX)
+set(NAMESPACE "")
+include(DependsMultipleCommon.cmake)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-result.txt
diff --git a/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-stderr.txt b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-stderr.txt
new file mode 100644
index 0000000..9c97a75
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets-stderr.txt
@@ -0,0 +1,18 @@
+CMake Error in CMakeLists.txt:
+ install\(EXPORT "bar" ...\) includes target "bar" which requires target "foo"
+ that is not in this export set, but in multiple other export sets:
+ cmake/foo.cmake, cps/foo.cps, cmake/foo-alt.cmake.
+
+ An exported target cannot depend upon another target which is exported in
+ more than one export set or with more than one namespace. Consider
+ consolidating the exports of the "foo" target to a single export.
+
+
+CMake Error in CMakeLists.txt:
+ install\(PACKAGE_INFO "bar" ...\) includes target "bar" which requires target
+ "foo" that is not in this export set, but in multiple other export sets:
+ cmake/foo.cmake, cps/foo.cps, cmake/foo-alt.cmake.
+
+ An exported target cannot depend upon another target which is exported in
+ more than one export set or with more than one namespace. Consider
+ consolidating the exports of the "foo" target to a single export.
diff --git a/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets.cmake b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets.cmake
new file mode 100644
index 0000000..57bccbb
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleDifferentSets.cmake
@@ -0,0 +1,5 @@
+project(DependsMultipleDifferentSets CXX)
+include(DependsMultipleCommon.cmake)
+
+install(TARGETS foo EXPORT foo-alt)
+install(EXPORT foo-alt DESTINATION cmake)
diff --git a/Tests/RunCMake/PackageInfo/DependsMultipleNotInstalled.cmake b/Tests/RunCMake/PackageInfo/DependsMultipleNotInstalled.cmake
new file mode 100644
index 0000000..7d6e06c
--- /dev/null
+++ b/Tests/RunCMake/PackageInfo/DependsMultipleNotInstalled.cmake
@@ -0,0 +1,4 @@
+project(DependsMultipleNotInstalled CXX)
+set(NAMESPACE foo::)
+include(DependsMultipleCommon.cmake)
+install(TARGETS foo EXPORT foo-alt) # set foo-alt never installed
diff --git a/Tests/RunCMake/PackageInfo/ReferencesNonExportedTarget-stderr.txt b/Tests/RunCMake/PackageInfo/ReferencesNonExportedTarget-stderr.txt
index c68d518..86ed604 100644
--- a/Tests/RunCMake/PackageInfo/ReferencesNonExportedTarget-stderr.txt
+++ b/Tests/RunCMake/PackageInfo/ReferencesNonExportedTarget-stderr.txt
@@ -1 +1,3 @@
-CMake Error: install\(PACKAGE_INFO "dog" \.\.\.\) includes target "canine" which requires target "mammal" that is not in any export set.
+CMake Error in CMakeLists.txt:
+ install\(PACKAGE_INFO "dog" \.\.\.\) includes target "canine" which requires
+ target "mammal" that is not in any export set.
diff --git a/Tests/RunCMake/PackageInfo/Requirements-check.cmake b/Tests/RunCMake/PackageInfo/Requirements-check.cmake
index 59a212f..a082355 100644
--- a/Tests/RunCMake/PackageInfo/Requirements-check.cmake
+++ b/Tests/RunCMake/PackageInfo/Requirements-check.cmake
@@ -8,8 +8,10 @@ expect_value("${content}" "interface" "components" "libb" "type")
file(READ "${out_dir}/bar.cps" content)
expect_value("${content}" "bar" "name")
-expect_null("${content}" "requires" "foo")
-expect_null("${content}" "requires" "test")
+expect_array("${content}" 1 "requires" "foo" "components")
+expect_value("${content}" "libb" "requires" "foo" "components" 0)
+expect_array("${content}" 1 "requires" "test" "components")
+expect_value("${content}" "liba" "requires" "test" "components" 0)
expect_value("${content}" "interface" "components" "libc" "type")
expect_value("${content}" "interface" "components" "libd" "type")
diff --git a/Tests/RunCMake/PackageInfo/RunCMakeTest.cmake b/Tests/RunCMake/PackageInfo/RunCMakeTest.cmake
index e90c371..4b3493e 100644
--- a/Tests/RunCMake/PackageInfo/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PackageInfo/RunCMakeTest.cmake
@@ -21,6 +21,8 @@ run_cmake(ReferencesNonExportedTarget)
run_cmake(ReferencesWronglyExportedTarget)
run_cmake(ReferencesWronglyImportedTarget)
run_cmake(ReferencesWronglyNamespacedTarget)
+run_cmake(DependsMultipleDifferentNamespace)
+run_cmake(DependsMultipleDifferentSets)
# Test functionality
run_cmake(Appendix)
@@ -31,3 +33,5 @@ run_cmake(MinimalVersion)
run_cmake(LowerCaseFile)
run_cmake(Requirements)
run_cmake(TargetTypes)
+run_cmake(DependsMultiple)
+run_cmake(DependsMultipleNotInstalled)
diff --git a/Tests/RunCMake/ParseImplicitData/.gitattributes b/Tests/RunCMake/ParseImplicitData/.gitattributes
new file mode 100644
index 0000000..2f3ef8c
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitData/.gitattributes
@@ -0,0 +1 @@
+*.input tab-indent
diff --git a/Tests/RunCMake/ParseImplicitData/CMakeLists.txt b/Tests/RunCMake/ParseImplicitData/CMakeLists.txt
index a9d5fdd5..e150ed2 100644
--- a/Tests/RunCMake/ParseImplicitData/CMakeLists.txt
+++ b/Tests/RunCMake/ParseImplicitData/CMakeLists.txt
@@ -27,7 +27,7 @@ message("Generate input for system type: ${UNAME}")
# CMAKE_<LANG>_COMPILER_* variables we save in the resultfile
set(compvars ABI AR ARCHITECTURE_ID EXTERNAL_TOOLCHAIN ID LAUNCHER LOADED
- RANLIB TARGET VERSION VERSION_INTERAL)
+ RANLIB TARGET VERSION VERSION_INTERNAL)
foreach(lang IN ITEMS ${LANGUAGES})
diff --git a/Tests/RunCMake/ParseImplicitData/aix-C-IBMClang-17.1.1.2.input b/Tests/RunCMake/ParseImplicitData/aix-C-IBMClang-17.1.1.2.input
index 0d57b2c..2639aed 100644
--- a/Tests/RunCMake/ParseImplicitData/aix-C-IBMClang-17.1.1.2.input
+++ b/Tests/RunCMake/ParseImplicitData/aix-C-IBMClang-17.1.1.2.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=17.1.1.2
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake-build/bin/cmake -E env VERBOSE=1 /opt/freeware/bin/gmake -f Makefile cmTC_b9ba2/fast
diff --git a/Tests/RunCMake/ParseImplicitData/aix-C-XL-13.1.3.input b/Tests/RunCMake/ParseImplicitData/aix-C-XL-13.1.3.input
index 14517c5..90d2911 100644
--- a/Tests/RunCMake/ParseImplicitData/aix-C-XL-13.1.3.input
+++ b/Tests/RunCMake/ParseImplicitData/aix-C-XL-13.1.3.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=13.1.3
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_424d1/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/aix-C-XLClang-16.1.0.1.input b/Tests/RunCMake/ParseImplicitData/aix-C-XLClang-16.1.0.1.input
index 2f018e6..12eaabf 100644
--- a/Tests/RunCMake/ParseImplicitData/aix-C-XLClang-16.1.0.1.input
+++ b/Tests/RunCMake/ParseImplicitData/aix-C-XLClang-16.1.0.1.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=16.1.0.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_fcf21/fast
diff --git a/Tests/RunCMake/ParseImplicitData/aix-CXX-IBMClang-17.1.1.2.input b/Tests/RunCMake/ParseImplicitData/aix-CXX-IBMClang-17.1.1.2.input
index ace5021..2be60f9 100644
--- a/Tests/RunCMake/ParseImplicitData/aix-CXX-IBMClang-17.1.1.2.input
+++ b/Tests/RunCMake/ParseImplicitData/aix-CXX-IBMClang-17.1.1.2.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=17.1.1.2
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake-build/bin/cmake -E env VERBOSE=1 /opt/freeware/bin/gmake -f Makefile cmTC_7f688/fast
diff --git a/Tests/RunCMake/ParseImplicitData/aix-CXX-XL-13.1.3.input b/Tests/RunCMake/ParseImplicitData/aix-CXX-XL-13.1.3.input
index 5aec849..539eeef 100644
--- a/Tests/RunCMake/ParseImplicitData/aix-CXX-XL-13.1.3.input
+++ b/Tests/RunCMake/ParseImplicitData/aix-CXX-XL-13.1.3.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=13.1.3
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_e8f3a/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/aix-CXX-XLClang-16.1.0.1.input b/Tests/RunCMake/ParseImplicitData/aix-CXX-XLClang-16.1.0.1.input
index da16db3..85cd0d2 100644
--- a/Tests/RunCMake/ParseImplicitData/aix-CXX-XLClang-16.1.0.1.input
+++ b/Tests/RunCMake/ParseImplicitData/aix-CXX-XLClang-16.1.0.1.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=16.1.0.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_b8490/fast
diff --git a/Tests/RunCMake/ParseImplicitData/craype-C-Cray-8.7.input b/Tests/RunCMake/ParseImplicitData/craype-C-Cray-8.7.input
index b3218a2..a320d83 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-C-Cray-8.7.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-C-Cray-8.7.input
@@ -9,7 +9,8 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=8.7
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
+CMAKE_C_IMPLICIT_LINK_LIBRARY_stdc++=/usr/lib64/libstdc++.a
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_cb7b8/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-C-Cray-9.0-hlist-ad.input b/Tests/RunCMake/ParseImplicitData/craype-C-Cray-9.0-hlist-ad.input
index e82bd97..9e26204 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-C-Cray-9.0-hlist-ad.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-C-Cray-9.0-hlist-ad.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=9.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /home/generic.user/Code/tmp/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_9ceca/fast && /usr/bin/gmake -f CMakeFiles/cmTC_9ceca.dir/build.make CMakeFiles/cmTC_9ceca.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/craype-C-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitData/craype-C-GNU-7.3.0.input
index 2dc60af..2fe2b6a 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-C-GNU-7.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-C-GNU-7.3.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=7.3.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_61245/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-C-Intel-18.0.2.20180210.input b/Tests/RunCMake/ParseImplicitData/craype-C-Intel-18.0.2.20180210.input
index 8c68e5b..580cad9 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-C-Intel-18.0.2.20180210.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-C-Intel-18.0.2.20180210.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=18.0.2.20180210
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_96fde/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-8.7.input b/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-8.7.input
index 73c9c8a..4bd4fa1 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-8.7.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-8.7.input
@@ -9,7 +9,8 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=8.7
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
+CMAKE_CXX_IMPLICIT_LINK_LIBRARY_stdc++=/usr/lib64/libstdc++.a
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_f3b1f/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-9.0-hlist-ad.input b/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-9.0-hlist-ad.input
index 06a4ac9..f632b43 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-9.0-hlist-ad.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-CXX-Cray-9.0-hlist-ad.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=9.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /home/generic.user/Code/tmp/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_aa1be/fast && /usr/bin/gmake -f CMakeFiles/cmTC_aa1be.dir/build.make CMakeFiles/cmTC_aa1be.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/craype-CXX-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitData/craype-CXX-GNU-7.3.0.input
index 50f2859..6f492c6 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-CXX-GNU-7.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-CXX-GNU-7.3.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=7.3.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_66e70/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-CXX-Intel-18.0.2.20180210.input b/Tests/RunCMake/ParseImplicitData/craype-CXX-Intel-18.0.2.20180210.input
index e25f7cf..aab024a 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-CXX-Intel-18.0.2.20180210.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-CXX-Intel-18.0.2.20180210.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=18.0.2.20180210
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_7f9a2/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-8.7.input b/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-8.7.input
index 4c4e2f4..bd60487 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-8.7.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-8.7.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=8.7
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_9c3ab/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-9.0-hlist-ad.input b/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-9.0-hlist-ad.input
index 0ba430a..629365f 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-9.0-hlist-ad.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-Fortran-Cray-9.0-hlist-ad.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=9.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /home/generic.user/Code/tmp/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_61c1d/fast && /usr/bin/gmake -f CMakeFiles/cmTC_61c1d.dir/build.make CMakeFiles/cmTC_61c1d.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/craype-Fortran-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitData/craype-Fortran-GNU-7.3.0.input
index bee298c..a4ecfc8 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-Fortran-GNU-7.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-Fortran-GNU-7.3.0.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=7.3.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_390ef/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/craype-Fortran-Intel-18.0.2.20180210.input b/Tests/RunCMake/ParseImplicitData/craype-Fortran-Intel-18.0.2.20180210.input
index 4cdff74..c043868 100644
--- a/Tests/RunCMake/ParseImplicitData/craype-Fortran-Intel-18.0.2.20180210.input
+++ b/Tests/RunCMake/ParseImplicitData/craype-Fortran-Intel-18.0.2.20180210.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=18.0.2.20180210
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_7523d/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/darwin-C-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitData/darwin-C-AppleClang-8.0.0.8000042.input
index 4bc26bc..509b47b 100644
--- a/Tests/RunCMake/ParseImplicitData/darwin-C-AppleClang-8.0.0.8000042.input
+++ b/Tests/RunCMake/ParseImplicitData/darwin-C-AppleClang-8.0.0.8000042.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=8.0.0.8000042
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_0c33e/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/darwin-CXX-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitData/darwin-CXX-AppleClang-8.0.0.8000042.input
index 907a92e..707c3d1 100644
--- a/Tests/RunCMake/ParseImplicitData/darwin-CXX-AppleClang-8.0.0.8000042.input
+++ b/Tests/RunCMake/ParseImplicitData/darwin-CXX-AppleClang-8.0.0.8000042.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=8.0.0.8000042
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_b7e96/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input
index effaedf..464ebaf 100644
--- a/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input
+++ b/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=8.0.0.8000042
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ba7aa/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input
index 5504e94..9ba17c6 100644
--- a/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input
+++ b/Tests/RunCMake/ParseImplicitData/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=8.0.0.8000042
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_638bd/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/freebsd-C-Clang-3.3.0.input b/Tests/RunCMake/ParseImplicitData/freebsd-C-Clang-3.3.0.input
index 81626f9..8cc0e19 100644
--- a/Tests/RunCMake/ParseImplicitData/freebsd-C-Clang-3.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/freebsd-C-Clang-3.3.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=3.3.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/local/bin/gmake" "cmTC_0c44b/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/freebsd-CXX-Clang-3.3.0.input b/Tests/RunCMake/ParseImplicitData/freebsd-CXX-Clang-3.3.0.input
index 1f7758b..2f9adbd 100644
--- a/Tests/RunCMake/ParseImplicitData/freebsd-CXX-Clang-3.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/freebsd-CXX-Clang-3.3.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=3.3.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/local/bin/gmake" "cmTC_c3442/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/freebsd-Fortran-GNU-4.6.4.input b/Tests/RunCMake/ParseImplicitData/freebsd-Fortran-GNU-4.6.4.input
index 8a5d741..5b5b1d3 100644
--- a/Tests/RunCMake/ParseImplicitData/freebsd-Fortran-GNU-4.6.4.input
+++ b/Tests/RunCMake/ParseImplicitData/freebsd-Fortran-GNU-4.6.4.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=4.6.4
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/local/bin/gmake" "cmTC_9ec75/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/hand-C-empty.input b/Tests/RunCMake/ParseImplicitData/hand-C-empty.input
index b27eb02..b265d17 100644
--- a/Tests/RunCMake/ParseImplicitData/hand-C-empty.input
+++ b/Tests/RunCMake/ParseImplicitData/hand-C-empty.input
@@ -9,6 +9,6 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=7.3.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
This is a test and there is nothing here to parse.
diff --git a/Tests/RunCMake/ParseImplicitData/hand-C-relative.input b/Tests/RunCMake/ParseImplicitData/hand-C-relative.input
index dd0c10b..dbaa5a7 100644
--- a/Tests/RunCMake/ParseImplicitData/hand-C-relative.input
+++ b/Tests/RunCMake/ParseImplicitData/hand-C-relative.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=7.3.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
This is a hand-written test case.
diff --git a/Tests/RunCMake/ParseImplicitData/hand-CXX-empty.input b/Tests/RunCMake/ParseImplicitData/hand-CXX-empty.input
index b983d6b..18c8d48 100644
--- a/Tests/RunCMake/ParseImplicitData/hand-CXX-empty.input
+++ b/Tests/RunCMake/ParseImplicitData/hand-CXX-empty.input
@@ -9,6 +9,6 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=7.3.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
This is a test and there is nothing here to parse.
diff --git a/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input b/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input
index 568933a..0a12ae9 100644
--- a/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input
+++ b/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=7.3.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
This is a hand-written test case.
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-GNU-10.2.1-static-libgcc.input b/Tests/RunCMake/ParseImplicitData/linux-C-GNU-10.2.1-static-libgcc.input
index 0aaf05e..63576e7 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-GNU-10.2.1-static-libgcc.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-GNU-10.2.1-static-libgcc.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-10
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=10.2.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_2fff5/fast && /usr/bin/gmake -f CMakeFiles/cmTC_2fff5.dir/build.make CMakeFiles/cmTC_2fff5.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-GNU-12.2.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-GNU-12.2.0.input
index 7ecf081..2b75825 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-GNU-12.2.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-GNU-12.2.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-12
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=12.2.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_9e804
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-GNU-7.3.0.input
index ee296a7..188f4e6 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-GNU-7.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-GNU-7.3.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=7.3.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_1f304/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-Intel-18.0.0.20170811.input b/Tests/RunCMake/ParseImplicitData/linux-C-Intel-18.0.0.20170811.input
index 1e6544b..16c9857 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-Intel-18.0.0.20170811.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-Intel-18.0.0.20170811.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=18.0.0.20170811
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_a5f0a/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-Intel-2021.10.0.20230609.input b/Tests/RunCMake/ParseImplicitData/linux-C-Intel-2021.10.0.20230609.input
index 60f2017..0251caf 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-Intel-2021.10.0.20230609.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-Intel-2021.10.0.20230609.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=2021.10.0.20230609
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_c7575
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-IntelLLVM-2023.2.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-IntelLLVM-2023.2.0.input
index dd3b227..cdb1b3f 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-IntelLLVM-2023.2.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-IntelLLVM-2023.2.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm/llvm-ranlib
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=2023.2.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_0d8c1
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input
index 93e36ca..852b088 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=21.1.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /root/parse_implicit_data/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_b8daa/fast && /usr/bin/make -f CMakeFiles/cmTC_b8daa.dir/build.make CMakeFiles/cmTC_b8daa.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux-C-PGI-18.10.1.input
index cfc3e7b..026e1af 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=18.10.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_81a12/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-XL-12.1.0.input
index a6d9e5a..14dede8 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-XL-12.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-XL-12.1.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=12.1.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_79cdf/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-XL-16.1.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-XL-16.1.0.0.input
index 97fa28b..7b6babc 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-C-XL-16.1.0.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-C-XL-16.1.0.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=16.1.0.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_56ad1/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-CLANG.input b/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-CLANG.input
index 954697d..a3c61fe 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-CLANG.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-CLANG.input
@@ -10,7 +10,7 @@ CMAKE_CUDA_COMPILER_LOADED=1
CMAKE_CUDA_COMPILER_RANLIB=
CMAKE_CUDA_COMPILER_TARGET=
CMAKE_CUDA_COMPILER_VERSION=10.1.168
-CMAKE_CUDA_COMPILER_VERSION_INTERAL=
+CMAKE_CUDA_COMPILER_VERSION_INTERNAL=
Change Dir: /home/robert/Work/cmake/cuda_clang_compiler_info/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_e3386 && [1/2] Building CUDA object CMakeFiles/cmTC_e3386.dir/CMakeCUDACompilerABI.cu.o
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-XLClang-v.input b/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-XLClang-v.input
index 7b20288..30e1ec2 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-XLClang-v.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-10.1.168-XLClang-v.input
@@ -10,7 +10,7 @@ CMAKE_CUDA_COMPILER_LOADED=1
CMAKE_CUDA_COMPILER_RANLIB=
CMAKE_CUDA_COMPILER_TARGET=
CMAKE_CUDA_COMPILER_VERSION=10.1.168
-CMAKE_CUDA_COMPILER_VERSION_INTERAL=
+CMAKE_CUDA_COMPILER_VERSION_INTERNAL=
Change Dir: /ccs/home/rmaynard/cmake/extract_xlc_info/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_e9f3e/fast && /usr/bin/gmake -f CMakeFiles/cmTC_e9f3e.dir/build.make CMakeFiles/cmTC_e9f3e.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-9.2.148-GCC.input b/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-9.2.148-GCC.input
index 98aee98..267abe4 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-9.2.148-GCC.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CUDA-NVIDIA-9.2.148-GCC.input
@@ -10,7 +10,7 @@ CMAKE_CUDA_COMPILER_LOADED=1
CMAKE_CUDA_COMPILER_RANLIB=
CMAKE_CUDA_COMPILER_TARGET=
CMAKE_CUDA_COMPILER_VERSION=9.2.148
-CMAKE_CUDA_COMPILER_VERSION_INTERAL=
+CMAKE_CUDA_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_5996d/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-10.2.1-static-libstdc++.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-10.2.1-static-libstdc++.input
index 387f149..30fd529 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-10.2.1-static-libstdc++.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-10.2.1-static-libstdc++.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-10
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=10.2.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_CXX_IMPLICIT_LINK_LIBRARY_stdc++=/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-12.2.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-12.2.0.input
index 134a8e9..885a34a 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-12.2.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-12.2.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-12
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=12.2.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_705d2
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-7.3.0.input
index 633a0ef..6b9f037 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-7.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-GNU-7.3.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=7.3.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_63146/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-18.0.0.20170811.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-18.0.0.20170811.input
index 22d8715..b663508 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-18.0.0.20170811.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-18.0.0.20170811.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=18.0.0.20170811
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_d768a/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-2021.10.0.20230609.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-2021.10.0.20230609.input
index 8a7ffda..6ca5bbd 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-2021.10.0.20230609.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-Intel-2021.10.0.20230609.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=2021.10.0.20230609
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_b5439
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-IntelLLVM-2023.2.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-IntelLLVM-2023.2.0.input
index 8713d6d..a7eece0 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-IntelLLVM-2023.2.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-IntelLLVM-2023.2.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm/llvm-ranlib
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=2023.2.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_05be3
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input
index 64781b9..04301db 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=21.1.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /root/parse_implicit_data/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_79118/fast && /usr/bin/make -f CMakeFiles/cmTC_79118.dir/build.make CMakeFiles/cmTC_79118.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-PGI-18.10.1.input
index f95627e..6430c86 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=18.10.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_9932f/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-12.1.0.input
index 494b45c..fdd5278 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-12.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-12.1.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=12.1.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_a9a18/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-16.1.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-16.1.0.0.input
index 37aa450..fc970d7 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-16.1.0.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-CXX-XL-16.1.0.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=16.1.0.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_f0c9c/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-10.2.1-static-libgfortran.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-10.2.1-static-libgfortran.input
index 16b38d2..d33a2b7 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-10.2.1-static-libgfortran.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-10.2.1-static-libgfortran.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib-10
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=10.2.1
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_Fortran_IMPLICIT_LINK_LIBRARY_gfortran=/usr/lib/gcc/x86_64-linux-gnu/10/libgfortran.a
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-12.2.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-12.2.0.input
index ed4ddcb..321e671 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-12.2.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-12.2.0.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib-12
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=12.2.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_62ee5
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-13.3.0-static-libquadmath.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-13.3.0-static-libquadmath.input
index b1ab2f0..c4854af 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-13.3.0-static-libquadmath.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-13.3.0-static-libquadmath.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib-13
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=13.3.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_Fortran_IMPLICIT_LINK_LIBRARY_quadmath=/usr/lib/gcc/x86_64-linux-gnu/13/libquadmath.a
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-7.3.0.input
index 4582433..41fb08f 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-7.3.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-GNU-7.3.0.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=7.3.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_1cf45/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-Intel-2021.10.0.20230609.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-Intel-2021.10.0.20230609.input
index 7379c84..c2e1f59 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-Intel-2021.10.0.20230609.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-Intel-2021.10.0.20230609.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=2021.10.0.20230609
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_9370c
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-IntelLLVM-2023.2.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-IntelLLVM-2023.2.0.input
index 53c7e53..e39c027 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-IntelLLVM-2023.2.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-IntelLLVM-2023.2.0.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/opt/intel/oneapi/compiler/2023.2.1/linux/bin-llvm/llvm-ranlib
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=2023.2.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/.gitlab/ninja -v cmTC_59e9e
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-clang.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-clang.input
index f314608..b0776fe 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-clang.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-clang.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=0.35.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/CMake/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_48bf9/fast
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-gcc.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-gcc.input
index 7879a3a..003a091 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-gcc.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.35.0-gcc.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=0.35.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/CMake/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_48bf9/fast
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-clang.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-clang.input
index 7f84f44..11c1ce8 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-clang.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-clang.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=0.41.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/CMake/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_e3038/fast
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-gcc.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-gcc.input
index 4a79262..d3caf942 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-gcc.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LFortran-0.41.0-gcc.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=0.41.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/CMake/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_fdc77/fast
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
index 5a53c88..cf27d8d 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=15.0.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_2e9b9/fast && /usr/bin/gmake -f CMakeFiles/cmTC_2e9b9.dir/build.make CMakeFiles/cmTC_2e9b9.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-PGI-18.10.1.input
index fe49bcd..ecf93f9 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=18.10.1
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_1e8d2/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-XL-14.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-XL-14.1.0.input
index d80cede..78a76d0 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-Fortran-XL-14.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-XL-14.1.0.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=14.1.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_d05a9/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input
index a80592c..03db842 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/opt/llvm-13/bin/llvm-ranlib
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=13.0.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_91833/fast && /usr/bin/make -f CMakeFiles/cmTC_91833.dir/build.make CMakeFiles/cmTC_91833.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input
index e656390..0bd4aea 100644
--- a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/opt/llvm-13/bin/llvm-ranlib
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=13.0.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_5372b/fast && /usr/bin/make -f CMakeFiles/cmTC_5372b.dir/build.make CMakeFiles/cmTC_5372b.dir/build
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-PGI-18.10.1.input
index 5e2e49a..415cc74 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=18.10.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_a7f0d/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-XL-12.1.0.input
index 8b1e286..42bea99 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-XL-12.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-C-XL-12.1.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=12.1.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_b8c4a/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-PGI-18.10.1.input
index dd2b55d..bad422b 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=18.10.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_90855/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-XL-12.1.0.input
index f6b5d91..bc72b2c 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-XL-12.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-CXX-XL-12.1.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=12.1.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_98791/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-Fortran-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-Fortran-PGI-18.10.1.input
index 12727f0..04d1fd6 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc-Fortran-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc-Fortran-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=18.10.1
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_b7462/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-C-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-C-XL-12.1.0.input
index a552d70..b8da192 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-C-XL-12.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-C-XL-12.1.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=12.1.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_76ec2/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-CXX-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-CXX-XL-12.1.0.input
index 4b20f2e..3ed28e0 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-CXX-XL-12.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_nostdinc_i-CXX-XL-12.1.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=12.1.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_026f6/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/linux_pgf77-Fortran-PGI-18.10.1.input b/Tests/RunCMake/ParseImplicitData/linux_pgf77-Fortran-PGI-18.10.1.input
index 01abe8d..9dc5435 100644
--- a/Tests/RunCMake/ParseImplicitData/linux_pgf77-Fortran-PGI-18.10.1.input
+++ b/Tests/RunCMake/ParseImplicitData/linux_pgf77-Fortran-PGI-18.10.1.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=18.10.1
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ea063/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input
index b1c4ce0..ddd5e59 100644
--- a/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input
+++ b/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=C:/DoesNotExist/MinGW/bin/gcc-ranlib.exe
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=4.9.3
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: C:/tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"C:/DoesNotExist/MinGW/bin/mingw32-make.exe" "cmTC_ab097/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input
index aae67bb..a0e0849 100644
--- a/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input
+++ b/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=C:/DoesNotExist/MinGW/bin/gcc-ranlib.exe
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=4.9.3
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: C:/tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"C:/DoesNotExist/MinGW/bin/mingw32-make.exe" "cmTC_2b790/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/netbsd-C-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitData/netbsd-C-GNU-4.8.5.input
index b468484..cafecb3 100644
--- a/Tests/RunCMake/ParseImplicitData/netbsd-C-GNU-4.8.5.input
+++ b/Tests/RunCMake/ParseImplicitData/netbsd-C-GNU-4.8.5.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=CMAKE_C_COMPILER_RANLIB-NOTFOUND
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=4.8.5
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/pkg/bin/gmake" "cmTC_9a517/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/netbsd-CXX-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitData/netbsd-CXX-GNU-4.8.5.input
index e3c5f72..c5df99c 100644
--- a/Tests/RunCMake/ParseImplicitData/netbsd-CXX-GNU-4.8.5.input
+++ b/Tests/RunCMake/ParseImplicitData/netbsd-CXX-GNU-4.8.5.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=4.8.5
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/pkg/bin/gmake" "cmTC_cca06/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-C-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-C-GNU-4.8.5.input
index cd5845a..2eba3e9 100644
--- a/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-C-GNU-4.8.5.input
+++ b/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-C-GNU-4.8.5.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=CMAKE_C_COMPILER_RANLIB-NOTFOUND
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=4.8.5
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/pkg/bin/gmake" "cmTC_b8d65/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-CXX-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-CXX-GNU-4.8.5.input
index b9a585c..5505abb 100644
--- a/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-CXX-GNU-4.8.5.input
+++ b/Tests/RunCMake/ParseImplicitData/netbsd_nostdinc-CXX-GNU-4.8.5.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=4.8.5
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/pkg/bin/gmake" "cmTC_bbb1e/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/openbsd-C-Clang-5.0.1.input b/Tests/RunCMake/ParseImplicitData/openbsd-C-Clang-5.0.1.input
index 9f34f3d..60edb38 100644
--- a/Tests/RunCMake/ParseImplicitData/openbsd-C-Clang-5.0.1.input
+++ b/Tests/RunCMake/ParseImplicitData/openbsd-C-Clang-5.0.1.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=CMAKE_C_COMPILER_RANLIB-NOTFOUND
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=5.0.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_f5360/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/openbsd-CXX-Clang-5.0.1.input b/Tests/RunCMake/ParseImplicitData/openbsd-CXX-Clang-5.0.1.input
index 93f1a95..4c7c355 100644
--- a/Tests/RunCMake/ParseImplicitData/openbsd-CXX-Clang-5.0.1.input
+++ b/Tests/RunCMake/ParseImplicitData/openbsd-CXX-Clang-5.0.1.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=5.0.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_a2bf8/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/sunos-C-SunPro-5.13.0.input b/Tests/RunCMake/ParseImplicitData/sunos-C-SunPro-5.13.0.input
index b0b504a..3f1c534 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos-C-SunPro-5.13.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos-C-SunPro-5.13.0.input
@@ -9,7 +9,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=5.13.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/opt/csw/bin/gmake" "cmTC_55079/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/sunos-CXX-SunPro-5.13.0.input b/Tests/RunCMake/ParseImplicitData/sunos-CXX-SunPro-5.13.0.input
index 9abd06a..8932d12 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos-CXX-SunPro-5.13.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos-CXX-SunPro-5.13.0.input
@@ -9,7 +9,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=5.13.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/opt/csw/bin/gmake" "cmTC_cc4b2/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/sunos-Fortran-SunPro-8.8.0.input b/Tests/RunCMake/ParseImplicitData/sunos-Fortran-SunPro-8.8.0.input
index 4a2bedd..1217b9e 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos-Fortran-SunPro-8.8.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos-Fortran-SunPro-8.8.0.input
@@ -9,7 +9,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=8.8.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
Run Build Command:"/opt/csw/bin/gmake" "cmTC_adcec/fast"
diff --git a/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-C-GNU-5.5.0.input b/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-C-GNU-5.5.0.input
index 39d9f79..8fd6e5f 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-C-GNU-5.5.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-C-GNU-5.5.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/opt/csw/bin/gcc-ranlib-5.5
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=5.5.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/build/bin/cmake -E env VERBOSE=1 /opt/csw/bin/gmake -f Makefile cmTC_c0ced/fast
diff --git a/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-CXX-GNU-5.5.0.input b/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-CXX-GNU-5.5.0.input
index dd0799a..a2ceb05 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-CXX-GNU-5.5.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-CXX-GNU-5.5.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/opt/csw/bin/gcc-ranlib-5.5
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=5.5.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/build/bin/cmake -E env VERBOSE=1 /opt/csw/bin/gmake -f Makefile cmTC_e6422/fast
diff --git a/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-Fortran-GNU-5.5.0.input b/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-Fortran-GNU-5.5.0.input
index 9d62b1a..75c6021 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-Fortran-GNU-5.5.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos5.10_sparc32-Fortran-GNU-5.5.0.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/opt/csw/bin/gcc-ranlib-5.5
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=5.5.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): /tmp/cmake/build/bin/cmake -E env VERBOSE=1 /opt/csw/bin/gmake -f Makefile cmTC_955e5/fast
diff --git a/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-C-GNU-5.5.0.input b/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-C-GNU-5.5.0.input
index 0fc6809..dcad2cd 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-C-GNU-5.5.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-C-GNU-5.5.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=/opt/csw/bin/gcc-ranlib-5.5
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=5.5.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): "/tmp/cmake/build/bin/cmake" -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_669bd/fast
diff --git a/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-CXX-GNU-5.5.0.input b/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-CXX-GNU-5.5.0.input
index 0f0c712..b931177 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-CXX-GNU-5.5.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-CXX-GNU-5.5.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=/opt/csw/bin/gcc-ranlib-5.5
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=5.5.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): "/tmp/cmake/build/bin/cmake" -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_1c2eb/fast
diff --git a/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-Fortran-GNU-5.5.0.input b/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-Fortran-GNU-5.5.0.input
index bcd5114..0470803 100644
--- a/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-Fortran-GNU-5.5.0.input
+++ b/Tests/RunCMake/ParseImplicitData/sunos5.11_i386-Fortran-GNU-5.5.0.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=/opt/csw/bin/gcc-ranlib-5.5
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=5.5.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
Change Dir: '/tmp/ii/CMakeFiles/CMakeTmp'
Run Build Command(s): "/tmp/cmake/build/bin/cmake" -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_437d4/fast
diff --git a/Tests/RunCMake/ParseImplicitData/windows_arm64-C-Clang-17.0.1-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_arm64-C-Clang-17.0.1-MSVC.input
index d28b970..d8c2715 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_arm64-C-Clang-17.0.1-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_arm64-C-Clang-17.0.1-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=17.0.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
CMAKE_C_SIMULATE_ID=MSVC
clang version 17.0.1
Target: aarch64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitData/windows_arm64-CXX-Clang-17.0.1-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_arm64-CXX-Clang-17.0.1-MSVC.input
index e82a4fa..36819c0 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_arm64-CXX-Clang-17.0.1-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_arm64-CXX-Clang-17.0.1-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=17.0.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_CXX_SIMULATE_ID=MSVC
clang version 17.0.1
Target: aarch64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitData/windows_arm64-Fortran-LLVMFlang-17.0.1-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_arm64-Fortran-LLVMFlang-17.0.1-MSVC.input
index 4937a41..fd7a1cb 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_arm64-Fortran-LLVMFlang-17.0.1-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_arm64-Fortran-LLVMFlang-17.0.1-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=17.0.1
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_Fortran_SIMULATE_ID=MSVC
flang-new version 17.0.1
Target: aarch64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Clang-17.0.1-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Clang-17.0.1-MSVC.input
index b823880..2c8c295 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Clang-17.0.1-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Clang-17.0.1-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=17.0.1
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
CMAKE_C_SIMULATE_ID=MSVC
clang version 17.0.1
Target: x86_64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Intel-2021.9.0.20230302.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Intel-2021.9.0.20230302.input
index a54d54b..ef1cabd 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Intel-2021.9.0.20230302.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-Intel-2021.9.0.20230302.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=2021.9.0.20230302
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-IntelLLVM-2023.1.0.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-IntelLLVM-2023.1.0.input
index 710892c..ed2168f 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-IntelLLVM-2023.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-IntelLLVM-2023.1.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/Llvm/x64/bin/llvm-ranlib.exe
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=2023.1.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.36.32543.0.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.36.32543.0.input
index cc73ff7..37d983a 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.36.32543.0.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.36.32543.0.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=19.36.32543.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.38.33130.0-VS.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.38.33130.0-VS.input
index 77bae76..a059b01 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.38.33130.0-VS.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-C-MSVC-19.38.33130.0-VS.input
@@ -10,7 +10,7 @@ CMAKE_C_COMPILER_LOADED=1
CMAKE_C_COMPILER_RANLIB=
CMAKE_C_COMPILER_TARGET=
CMAKE_C_COMPILER_VERSION=19.38.33130.0
-CMAKE_C_COMPILER_VERSION_INTERAL=
+CMAKE_C_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Clang-17.0.1-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Clang-17.0.1-MSVC.input
index 756fd13..d237332 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Clang-17.0.1-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Clang-17.0.1-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=17.0.1
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_CXX_SIMULATE_ID=MSVC
clang version 17.0.1
Target: x86_64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Intel-2021.9.0.20230302.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Intel-2021.9.0.20230302.input
index ecb3f5c..35ce257 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Intel-2021.9.0.20230302.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-Intel-2021.9.0.20230302.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=2021.9.0.20230302
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-IntelLLVM-2023.1.0.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-IntelLLVM-2023.1.0.input
index 2650ba7..354735a 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-IntelLLVM-2023.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-IntelLLVM-2023.1.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/Llvm/x64/bin/llvm-ranlib.exe
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=2023.1.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.36.32543.0.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.36.32543.0.input
index 5575537..f199a28 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.36.32543.0.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.36.32543.0.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=19.36.32543.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.38.33130.0-VS.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.38.33130.0-VS.input
index 16d1b37..9dd437d 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.38.33130.0-VS.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-CXX-MSVC-19.38.33130.0-VS.input
@@ -10,7 +10,7 @@ CMAKE_CXX_COMPILER_LOADED=1
CMAKE_CXX_COMPILER_RANLIB=
CMAKE_CXX_COMPILER_TARGET=
CMAKE_CXX_COMPILER_VERSION=19.38.33130.0
-CMAKE_CXX_COMPILER_VERSION_INTERAL=
+CMAKE_CXX_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-Intel-2021.9.0.20230302.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-Intel-2021.9.0.20230302.input
index 75e49a6..5feb0c3 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-Intel-2021.9.0.20230302.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-Intel-2021.9.0.20230302.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=2021.9.0.20230302
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-IntelLLVM-2023.1.0.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-IntelLLVM-2023.1.0.input
index e8e0d1a..64dfb0f 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-IntelLLVM-2023.1.0.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-IntelLLVM-2023.1.0.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/Llvm/x64/bin/llvm-ranlib.exe
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=2023.1.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_HOST_SYSTEM_NAME=Windows
Change Dir: 'C:/DoesNotExist/Temp/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-17.0.1-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-17.0.1-MSVC.input
index fb75b51..fad8d2f 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-17.0.1-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-17.0.1-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=17.0.1
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_Fortran_SIMULATE_ID=MSVC
flang-new version 17.0.1
Target: x86_64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-18.0.0-MSVC.input b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-18.0.0-MSVC.input
index c567f06..fd00314 100644
--- a/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-18.0.0-MSVC.input
+++ b/Tests/RunCMake/ParseImplicitData/windows_x86_64-Fortran-LLVMFlang-18.0.0-MSVC.input
@@ -10,7 +10,7 @@ CMAKE_Fortran_COMPILER_LOADED=1
CMAKE_Fortran_COMPILER_RANLIB=
CMAKE_Fortran_COMPILER_TARGET=
CMAKE_Fortran_COMPILER_VERSION=18.0.0
-CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+CMAKE_Fortran_COMPILER_VERSION_INTERNAL=
CMAKE_Fortran_SIMULATE_ID=MSVC
flang-new version 18.0.0
Target: x86_64-pc-windows-msvc
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/CheckCompilerLinkerId.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/CheckCompilerLinkerId.cmake
new file mode 100644
index 0000000..a6a56ca
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/CheckCompilerLinkerId.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+if(NOT CMAKE_C_COMPILER_LINKER OR NOT CMAKE_C_COMPILER_LINKER_ID)
+ message(FATAL_ERROR "Failed to determine Linker.")
+endif()
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/RunCMakeTest.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/RunCMakeTest.cmake
index d50d403..df03f15 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/RunCMakeTest.cmake
@@ -39,3 +39,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows|AIX|SunOS)$|BSD"
)
endif()
endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES Clang)
+ run_cmake_with_options(CheckCompilerLinkerId "-DCMAKE_C_FLAGS=-fdiagnostics-color=always")
+endif()
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-C-Cray-8.7.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-C-Cray-8.7.output
index 8f68c4c..2258031 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-C-Cray-8.7.output
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-C-Cray-8.7.output
@@ -1,3 +1,3 @@
-libs=AtpSigHandler;AtpSigHCommData;pthread;sci_cray_mpi_mp;m;f;sci_cray_mp;craymp;m;pthread;f;hugetlbfs;mpich_cray;rt;pthread;ugni;pmi;pgas-dmapp;fi;u;rt;dmapp;ugni;udreg;pthread;m;cray-c\+\+-rts;stdc\+\+;xpmem;dmapp;pthread;pmi;pthread;alpslli;pthread;wlm_detect;ugni;pthread;alpsutil;pthread;rca;udreg;quadmath;m;omp;rt;craymp;pthread;rt;dl;cray-c\+\+-rts;stdc\+\+;m;modules;m;rt;fi;m;quadmath;rt;craymath;m;gfortran;quadmath;rt;f;m;pthread;rt;u;rt;dl;cray-c\+\+-rts;stdc\+\+;m;csup;rt;atomic;stdc\+\+;pthread;c;csup;m;gcc
+libs=AtpSigHandler;AtpSigHCommData;pthread;sci_cray_mpi_mp;m;f;sci_cray_mp;craymp;m;pthread;f;hugetlbfs;mpich_cray;rt;pthread;ugni;pmi;pgas-dmapp;fi;u;rt;dmapp;ugni;udreg;pthread;m;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;xpmem;dmapp;pthread;pmi;pthread;alpslli;pthread;wlm_detect;ugni;pthread;alpsutil;pthread;rca;udreg;quadmath;m;omp;rt;craymp;pthread;rt;dl;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;m;modules;m;rt;fi;m;quadmath;rt;craymath;m;gfortran;quadmath;rt;f;m;pthread;rt;u;rt;dl;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;m;csup;rt;atomic;/usr/lib64/libstdc\+\+\.a;pthread;c;csup;m;gcc
dirs=/opt/gcc/6.1.0/snos/lib64;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/lib;/opt/cray/dmapp/default/lib64;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/lib64;/opt/cray/pe/pmi/5.0.14/lib64;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64;/opt/cray/pe/atp/2.1.3/libApp;/opt/cray/pe/cce/8.7.4/cce/x86_64/lib;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64;/usr/lib64;/lib64;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0;/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-unknown-linux-gnu/lib
linker_tool=/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-CXX-Cray-8.7.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-CXX-Cray-8.7.output
index 0b25047..2d2320a 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-CXX-Cray-8.7.output
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/craype-CXX-Cray-8.7.output
@@ -1,3 +1,3 @@
-libs=AtpSigHandler;AtpSigHCommData;pthread;sci_cray_mpi_mp;m;f;sci_cray_mp;craymp;m;pthread;f;hugetlbfs;mpichcxx_cray;rt;pthread;ugni;pmi;mpich_cray;rt;pthread;ugni;pmi;pgas-dmapp;fi;u;rt;dmapp;ugni;udreg;pthread;m;cray-c\+\+-rts;stdc\+\+;xpmem;dmapp;pthread;pmi;pthread;alpslli;pthread;wlm_detect;ugni;pthread;alpsutil;pthread;rca;udreg;quadmath;m;omp;rt;craymp;pthread;rt;dl;cray-c\+\+-rts;stdc\+\+;m;modules;m;rt;fi;m;quadmath;rt;craymath;m;gfortran;quadmath;rt;f;m;pthread;rt;u;rt;dl;cray-c\+\+-rts;stdc\+\+;m;csup;rt;atomic;cray-c\+\+-rts;stdc\+\+;supc\+\+;stdc\+\+;pthread;c;csup;m;gcc
+libs=AtpSigHandler;AtpSigHCommData;pthread;sci_cray_mpi_mp;m;f;sci_cray_mp;craymp;m;pthread;f;hugetlbfs;mpichcxx_cray;rt;pthread;ugni;pmi;mpich_cray;rt;pthread;ugni;pmi;pgas-dmapp;fi;u;rt;dmapp;ugni;udreg;pthread;m;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;xpmem;dmapp;pthread;pmi;pthread;alpslli;pthread;wlm_detect;ugni;pthread;alpsutil;pthread;rca;udreg;quadmath;m;omp;rt;craymp;pthread;rt;dl;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;m;modules;m;rt;fi;m;quadmath;rt;craymath;m;gfortran;quadmath;rt;f;m;pthread;rt;u;rt;dl;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;m;csup;rt;atomic;cray-c\+\+-rts;/usr/lib64/libstdc\+\+\.a;supc\+\+;/usr/lib64/libstdc\+\+\.a;pthread;c;csup;m;gcc
dirs=/opt/gcc/6.1.0/snos/lib64;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/lib;/opt/cray/dmapp/default/lib64;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/lib64;/opt/cray/pe/pmi/5.0.14/lib64;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64;/opt/cray/pe/atp/2.1.3/libApp;/opt/cray/pe/cce/8.7.4/cce/x86_64/lib;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64;/usr/lib64;/lib64;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0;/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-unknown-linux-gnu/lib
linker_tool=/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld
diff --git a/Tests/RunCMake/Policy/CMakeLists.txt b/Tests/RunCMake/Policy/CMakeLists.txt
index 667561e..30c0273 100644
--- a/Tests/RunCMake/Policy/CMakeLists.txt
+++ b/Tests/RunCMake/Policy/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/PolicyScope/CMakeLists.txt b/Tests/RunCMake/PolicyScope/CMakeLists.txt
index 667561e..30c0273 100644
--- a/Tests/RunCMake/PolicyScope/CMakeLists.txt
+++ b/Tests/RunCMake/PolicyScope/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake b/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake
index da608b3..9244d0d 100644
--- a/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake
@@ -1,7 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
run_cmake(NotClosed)
run_cmake(NotOpened)
-run_cmake(parent-dir-generate-time)
-run_cmake(dir-in-macro-generate-time)
diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt
deleted file mode 100644
index d223f42..0000000
--- a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-CMake Warning \(dev\) at dir1/CMakeLists.txt:5 \(target_compile_definitions\):
- Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator
- expressions. Run "cmake --help-policy CMP0044" for policy details. Use
- the cmake_policy command to set the policy and suppress this warning.
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake
deleted file mode 100644
index 04a7c2c..0000000
--- a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-
-include(dir-in-macro-include.cmake)
diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake b/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake
deleted file mode 100644
index fd326f1..0000000
--- a/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-
-enable_language(CXX)
-
-# This does not affect dir1 despite being set before the add_subdirectory.
-cmake_policy(SET CMP0044 NEW)
-add_subdirectory(dir1)
diff --git a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt
deleted file mode 100644
index 66ff016..0000000
--- a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-add_library(foo STATIC foo.cpp)
-string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id)
-target_compile_definitions(foo PRIVATE Foo=$<CXX_COMPILER_ID:invalid,${compiler_id}>)
diff --git a/Tests/RunCMake/PolicyScope/dir1/foo.cpp b/Tests/RunCMake/PolicyScope/dir1/foo.cpp
deleted file mode 100644
index 766b775..0000000
--- a/Tests/RunCMake/PolicyScope/dir1/foo.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-
-int main()
-{
- return 0;
-}
diff --git a/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake b/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake
deleted file mode 100644
index a0842f7..0000000
--- a/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-enable_language(CXX)
-
-add_subdirectory(dir1)
-
-# This affects dir1 despite being set after the add_subdirectory.
-cmake_policy(SET CMP0044 NEW)
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index c8a5c15..139d586 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0057 NEW)
include(RunCMake)
function(run_test name)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 1601561..edead75 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
foreach(
arg
@@ -107,12 +107,12 @@ function(run_cmake test)
if(NOT DEFINED RunCMake_TEST_OPTIONS)
set(RunCMake_TEST_OPTIONS "")
endif()
- if(APPLE)
- list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW)
- endif()
if(RunCMake_TEST_LCC AND NOT RunCMake_TEST_NO_CMP0129)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0129=NEW)
endif()
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "AIX")
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0182=NEW)
+ endif()
if(RunCMake_MAKE_PROGRAM)
list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
endif()
@@ -143,25 +143,33 @@ function(run_cmake test)
if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
endif()
- string(CONCAT _code [[execute_process(
- COMMAND ${RunCMake_TEST_COMMAND}
- ${RunCMake_TEST_OPTIONS}
- ]] "${RunCMake_TEST_RAW_ARGS}\n" [[
- WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}"
- OUTPUT_VARIABLE actual_stdout
- ERROR_VARIABLE ${actual_stderr_var}
- RESULT_VARIABLE actual_result
- ENCODING UTF8
- ${maybe_timeout}
- ${maybe_input_file}
- )]])
+ if(NOT RunCMake_CHECK_ONLY)
+ string(CONCAT _code [[execute_process(
+ COMMAND ${RunCMake_TEST_COMMAND}
+ ${RunCMake_TEST_OPTIONS}
+ ]] "${RunCMake_TEST_RAW_ARGS}\n" [[
+ WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}"
+ OUTPUT_VARIABLE actual_stdout
+ ERROR_VARIABLE ${actual_stderr_var}
+ RESULT_VARIABLE actual_result
+ ENCODING UTF8
+ ${maybe_timeout}
+ ${maybe_input_file}
+ )]])
+ else()
+ set(expect_result "")
+ endif()
if(DEFINED ENV{PWD})
set(old_pwd "$ENV{PWD}")
else()
set(old_pwd)
endif()
- # Emulate a shell using this directory.
- set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}")
+ if(RunCMake_TEST_COMMAND_PWD)
+ set(ENV{PWD} "${RunCMake_TEST_COMMAND_PWD}")
+ else()
+ # Emulate a shell using this directory.
+ set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}")
+ endif()
cmake_language(EVAL CODE "${_code}")
if(DEFINED old_pwd)
set(ENV{PWD} "${old_pwd}")
@@ -259,7 +267,7 @@ function(run_cmake test)
if(RunCMake_TEST_FAILED)
set(msg "${RunCMake_TEST_FAILED}\n${msg}")
endif()
- if(msg)
+ if(msg AND NOT RunCMake_CHECK_ONLY)
string(REPLACE ";" "\" \"" command "\"${RunCMake_TEST_COMMAND}\"")
if(RunCMake_TEST_OPTIONS)
string(REPLACE ";" "\" \"" options "\"${RunCMake_TEST_OPTIONS}\"")
@@ -269,8 +277,7 @@ function(run_cmake test)
string(APPEND command " ${RunCMake_TEST_RAW_ARGS}")
endif()
string(APPEND msg "Command was:\n command> ${command}\n")
- endif()
- if(msg)
+
foreach(o IN ITEMS stdout stderr config)
if(DEFINED expect_${o})
string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} " expect-${o}> ${expect_${o}}")
@@ -284,6 +291,8 @@ function(run_cmake test)
if(RunCMake_TEST_FAILURE_MESSAGE)
string(APPEND msg "${RunCMake_TEST_FAILURE_MESSAGE}")
endif()
+ endif()
+ if(msg)
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
index b21eb26..f00a71e 100644
--- a/Tests/RunCMake/RunCPack.cmake
+++ b/Tests/RunCMake/RunCPack.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(RunCMake)
diff --git a/Tests/RunCMake/RunCPack/AppWiX/patch.xml b/Tests/RunCMake/RunCPack/AppWiX/patch.xml
index 13c392d..e23c33c 100644
--- a/Tests/RunCMake/RunCPack/AppWiX/patch.xml
+++ b/Tests/RunCMake/RunCPack/AppWiX/patch.xml
@@ -1,7 +1,7 @@
<CPackWiXPatch>
- <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
- <Environment Id="MyEnvironment" Action="set"
- Name="CPackWiXGeneratorTest"
- Value="CPackWiXGeneratorTest"/>
- </CPackWiXFragment>
+ <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
+ <Environment Id="MyEnvironment" Action="set"
+ Name="CPackWiXGeneratorTest"
+ Value="CPackWiXGeneratorTest"/>
+ </CPackWiXFragment>
</CPackWiXPatch>
diff --git a/Tests/RunCMake/RunCPack/verify.cmake b/Tests/RunCMake/RunCPack/verify.cmake
index 26a52bc..f39d20f 100644
--- a/Tests/RunCMake/RunCPack/verify.cmake
+++ b/Tests/RunCMake/RunCPack/verify.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
if(glob)
list(TRANSFORM glob PREPEND "${dir}/")
diff --git a/Tests/RunCMake/RunCTest.cmake b/Tests/RunCMake/RunCTest.cmake
index 87d17f2..243a037 100644
--- a/Tests/RunCMake/RunCTest.cmake
+++ b/Tests/RunCMake/RunCTest.cmake
@@ -1,5 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
+# file LICENSE.rst or https://cmake.org/licensing for details.
include(RunCMake)
diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake
index 180a0fe..ba06441 100644
--- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake
+++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake
@@ -45,7 +45,7 @@ block()
run_cmake(Stub)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(Stub-build ${CMAKE_COMMAND} --build . --config Debug)
- if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|SunOS)$|BSD")
+ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|SunOS|GNU)$|BSD")
set(ldpath LD_LIBRARY_PATH)
elseif(CMAKE_SYSTEM_NAME MATCHES "^(Darwin)$")
set(ldpath DYLD_LIBRARY_PATH)
diff --git a/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt b/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt
index 38cd119..29cf267 100644
--- a/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt
+++ b/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt
@@ -1 +1 @@
-(error while loading shared libraries: libStub\.so\.1|Library not loaded: '?@rpath/libStub\.1\.dylib'?|(Cannot|Could not) load module libStub\.a\(libStub\.so\.1\)|fatal: libStub\.so\.1: open failed|Shared object "libStub\.so\.1" not found)
+(error while loading shared libraries: libStub\.so\.1|Library not loaded: '?@rpath/libStub\.1\.dylib'?|(Cannot|Could not) load module libStub\.a\(libStub\.so\.1\)|fatal: libStub\.so\.1: open failed|Shared object "libStub\.so\.1" not found|Error loading shared library libStub\.so\.1:)
diff --git a/Tests/RunCMake/SarifOutput/CMakeLists.txt b/Tests/RunCMake/SarifOutput/CMakeLists.txt
new file mode 100644
index 0000000..bf2ef15
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.10)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/SarifOutput/DefaultSarifOutput-check.cmake b/Tests/RunCMake/SarifOutput/DefaultSarifOutput-check.cmake
new file mode 100644
index 0000000..e89cc64
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/DefaultSarifOutput-check.cmake
@@ -0,0 +1,4 @@
+# By default, no SARIF file should be generated
+if (EXISTS "${RunCMake_TEST_BINARY_DIR}/.cmake/sarif/cmake.sarif")
+ message(FATAL_ERROR "SARIF file should not have been generated by default")
+endif()
diff --git a/Tests/RunCMake/SarifOutput/DefaultSarifOutput-stderr.txt b/Tests/RunCMake/SarifOutput/DefaultSarifOutput-stderr.txt
new file mode 100644
index 0000000..cbe39e5
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/DefaultSarifOutput-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Warning at DefaultSarifOutput\.cmake:1 \(message\):
+ Example warning message
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/SarifOutput/DefaultSarifOutput.cmake b/Tests/RunCMake/SarifOutput/DefaultSarifOutput.cmake
new file mode 100644
index 0000000..5681cde
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/DefaultSarifOutput.cmake
@@ -0,0 +1 @@
+message(WARNING "Example warning message")
diff --git a/Tests/RunCMake/SarifOutput/GenerateSarifResults-check.cmake b/Tests/RunCMake/SarifOutput/GenerateSarifResults-check.cmake
new file mode 100644
index 0000000..0f83ae9
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/GenerateSarifResults-check.cmake
@@ -0,0 +1,4 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check-sarif.cmake")
+
+check_sarif_output("${RunCMake_TEST_BINARY_DIR}/.cmake/sarif/cmake.sarif"
+ "${CMAKE_CURRENT_LIST_DIR}/GenerateSarifResults-expected.sarif")
diff --git a/Tests/RunCMake/SarifOutput/GenerateSarifResults-expected.sarif b/Tests/RunCMake/SarifOutput/GenerateSarifResults-expected.sarif
new file mode 100644
index 0000000..2a66e6b
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/GenerateSarifResults-expected.sarif
@@ -0,0 +1,67 @@
+{
+ "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
+ "runs": [
+ {
+ "results": [
+ {
+ "level": "warning",
+ "locations": [
+ {
+ "physicalLocation": {
+ "artifactLocation": {
+ "uri": "PATH:<SOURCE_DIR>/GenerateSarifResults.cmake"
+ },
+ "region": {
+ "startLine": 2
+ }
+ }
+ }
+ ],
+ "message": {
+ "text": "Example warning message"
+ },
+ "ruleId": "CMake.Warning",
+ "ruleIndex": 0
+ },
+ {
+ "level": "warning",
+ "locations": [
+ {
+ "physicalLocation": {
+ "artifactLocation": {
+ "uri": "PATH:<SOURCE_DIR>/GenerateSarifResults.cmake"
+ },
+ "region": {
+ "startLine": 5
+ }
+ }
+ }
+ ],
+ "message": {
+ "text": "A second example warning message"
+ },
+ "ruleId": "CMake.Warning",
+ "ruleIndex": 0
+ }
+ ],
+ "tool": {
+ "driver": {
+ "name": "CMake",
+ "rules": [
+ {
+ "id": "CMake.Warning",
+ "messageStrings": {
+ "default": {
+ "text": "CMake Warning: {0}"
+ }
+ },
+ "name": "CMake Warning"
+ }
+ ],
+ "version": "<IGNORE>"
+ }
+ }
+ }
+ ],
+ "version": "2.1.0"
+}
diff --git a/Tests/RunCMake/SarifOutput/GenerateSarifResults-stderr.txt b/Tests/RunCMake/SarifOutput/GenerateSarifResults-stderr.txt
new file mode 100644
index 0000000..5ebc455
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/GenerateSarifResults-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Warning at GenerateSarifResults\.cmake:2 \(message\):
+ Example warning message
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Warning at GenerateSarifResults\.cmake:5 \(message\):
+ A second example warning message
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/SarifOutput/GenerateSarifResults.cmake b/Tests/RunCMake/SarifOutput/GenerateSarifResults.cmake
new file mode 100644
index 0000000..b0e6cde
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/GenerateSarifResults.cmake
@@ -0,0 +1,8 @@
+# Write some user messages to produce SARIF results
+message(WARNING "Example warning message")
+
+# The second warning should be logged, but the rule should not be duplicated
+message(WARNING "A second example warning message")
+
+# Status message should not be logged
+message(STATUS "Example status message")
diff --git a/Tests/RunCMake/SarifOutput/ProjectFatalError-check.cmake b/Tests/RunCMake/SarifOutput/ProjectFatalError-check.cmake
new file mode 100644
index 0000000..4cbf4f6
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ProjectFatalError-check.cmake
@@ -0,0 +1,4 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check-sarif.cmake")
+
+check_sarif_output("${RunCMake_TEST_BINARY_DIR}/.cmake/sarif/cmake.sarif"
+ "${CMAKE_CURRENT_LIST_DIR}/ProjectFatalError-expected.sarif")
diff --git a/Tests/RunCMake/SarifOutput/ProjectFatalError-expected.sarif b/Tests/RunCMake/SarifOutput/ProjectFatalError-expected.sarif
new file mode 100644
index 0000000..f36f101
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ProjectFatalError-expected.sarif
@@ -0,0 +1,47 @@
+{
+ "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
+ "runs": [
+ {
+ "results": [
+ {
+ "level": "error",
+ "locations": [
+ {
+ "physicalLocation": {
+ "artifactLocation": {
+ "uri": "PATH:<SOURCE_DIR>/ProjectFatalError.cmake"
+ },
+ "region": {
+ "startLine": 1
+ }
+ }
+ }
+ ],
+ "message": {
+ "text": "Example error"
+ },
+ "ruleId": "CMake.FatalError",
+ "ruleIndex": 0
+ }
+ ],
+ "tool": {
+ "driver": {
+ "name": "CMake",
+ "rules": [
+ {
+ "id": "CMake.FatalError",
+ "messageStrings": {
+ "default": {
+ "text": "CMake Error: {0}"
+ }
+ },
+ "name": "CMake Error"
+ }
+ ],
+ "version": "<IGNORE>"
+ }
+ }
+ }
+ ],
+ "version": "2.1.0"
+}
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt b/Tests/RunCMake/SarifOutput/ProjectFatalError-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt
+++ b/Tests/RunCMake/SarifOutput/ProjectFatalError-result.txt
diff --git a/Tests/RunCMake/SarifOutput/ProjectFatalError-stderr.txt b/Tests/RunCMake/SarifOutput/ProjectFatalError-stderr.txt
new file mode 100644
index 0000000..613bb49
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ProjectFatalError-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at ProjectFatalError\.cmake:1 \(message\):
+ Example error
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/SarifOutput/ProjectFatalError.cmake b/Tests/RunCMake/SarifOutput/ProjectFatalError.cmake
new file mode 100644
index 0000000..5668a05
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ProjectFatalError.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "Example error")
diff --git a/Tests/RunCMake/SarifOutput/RunCMakeTest.cmake b/Tests/RunCMake/SarifOutput/RunCMakeTest.cmake
new file mode 100644
index 0000000..fc6099b
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/RunCMakeTest.cmake
@@ -0,0 +1,25 @@
+include(RunCMake)
+include("${CMAKE_CURRENT_LIST_DIR}/check-sarif.cmake")
+
+# Default case: the SARIF file should not be generated
+run_cmake(DefaultSarifOutput)
+
+# Ensure the expected messages are present in the SARIF output
+run_cmake_with_options(GenerateSarifResults -DCMAKE_EXPORT_SARIF=ON)
+
+# Activate SARIF output using the `CMAKE_EXPORT_SARIF` variable
+run_cmake(ToggleExportSarifVariable)
+
+# If CMake stops with a fatal error, it should still generate a SARIF file if
+# requested (and the fatal error should be in the log)
+run_cmake_with_options(ProjectFatalError -DCMAKE_EXPORT_SARIF=ON)
+
+# ScriptModeSarifVariable Test: Script mode must ignore the
+# `CMAKE_EXPORT_SARIF`variable
+run_cmake_script(ScriptModeSarifVariable -DCMAKE_EXPORT_SARIF=ON)
+
+# Check that the command-line option can be used to set the file output path
+run_cmake_with_options(SarifFileArgument --sarif-output=test_cmake_run.sarif)
+
+# Test the command-line option in script mode as well
+run_cmake_script(SarifFileArgumentScript --sarif-output=test_cmake_run.sarif)
diff --git a/Tests/RunCMake/SarifOutput/SarifFileArgument-check.cmake b/Tests/RunCMake/SarifOutput/SarifFileArgument-check.cmake
new file mode 100644
index 0000000..55d8091
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/SarifFileArgument-check.cmake
@@ -0,0 +1,4 @@
+# Make sure the output exists
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/test_cmake_run.sarif")
+ message(FATAL_ERROR "SARIF file not generated in the expected location")
+endif()
diff --git a/Tests/RunCMake/SarifOutput/SarifFileArgument-stderr.txt b/Tests/RunCMake/SarifOutput/SarifFileArgument-stderr.txt
new file mode 100644
index 0000000..277a0ad
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/SarifFileArgument-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Warning at SarifFileArgument\.cmake:1 \(message\):
+ SARIF file test
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/SarifOutput/SarifFileArgument.cmake b/Tests/RunCMake/SarifOutput/SarifFileArgument.cmake
new file mode 100644
index 0000000..597b163
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/SarifFileArgument.cmake
@@ -0,0 +1 @@
+message(WARNING "SARIF file test")
diff --git a/Tests/RunCMake/SarifOutput/SarifFileArgumentScript-check.cmake b/Tests/RunCMake/SarifOutput/SarifFileArgumentScript-check.cmake
new file mode 100644
index 0000000..55d8091
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/SarifFileArgumentScript-check.cmake
@@ -0,0 +1,4 @@
+# Make sure the output exists
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/test_cmake_run.sarif")
+ message(FATAL_ERROR "SARIF file not generated in the expected location")
+endif()
diff --git a/Tests/RunCMake/SarifOutput/SarifFileArgumentScript.cmake b/Tests/RunCMake/SarifOutput/SarifFileArgumentScript.cmake
new file mode 100644
index 0000000..6ca9263
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/SarifFileArgumentScript.cmake
@@ -0,0 +1,2 @@
+# This won't appear in the SARIF log, but it gives the script something to do.
+message(STATUS "SARIF file test")
diff --git a/Tests/RunCMake/SarifOutput/ScriptModeSarifVariable-check.cmake b/Tests/RunCMake/SarifOutput/ScriptModeSarifVariable-check.cmake
new file mode 100644
index 0000000..c69e4d9
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ScriptModeSarifVariable-check.cmake
@@ -0,0 +1,4 @@
+# Script mode should ignore the SARIF project variable and export nothing
+if (EXISTS "${RunCMake_TEST_BINARY_DIR}/.cmake/sarif/cmake.sarif")
+ message(FATAL_ERROR "SARIF file should not have been generated in script mode")
+endif()
diff --git a/Tests/RunCMake/SarifOutput/ScriptModeSarifVariable.cmake b/Tests/RunCMake/SarifOutput/ScriptModeSarifVariable.cmake
new file mode 100644
index 0000000..d2f2a65
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ScriptModeSarifVariable.cmake
@@ -0,0 +1,3 @@
+# Try enabling SARIF output in script mode
+# No file should be generated since script mode ignores the variable
+set(CMAKE_EXPORT_SARIF ON CACHE BOOL "Export SARIF results" FORCE)
diff --git a/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-check.cmake b/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-check.cmake
new file mode 100644
index 0000000..6b26efe
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-check.cmake
@@ -0,0 +1,5 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check-sarif.cmake")
+
+# This test should produce the same output as GenerateSarifResults
+check_sarif_output("${RunCMake_TEST_BINARY_DIR}/.cmake/sarif/cmake.sarif"
+ "${CMAKE_CURRENT_LIST_DIR}/GenerateSarifResults-expected.sarif")
diff --git a/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-stderr.txt b/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-stderr.txt
new file mode 100644
index 0000000..5cfe7b5
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning at GenerateSarifResults\.cmake:2 \(message\):
+ Example warning message
+Call Stack \(most recent call first\):
+ ToggleExportSarifVariable\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Warning at GenerateSarifResults.cmake:5 \(message\):
+ A second example warning message
+Call Stack \(most recent call first\):
+ ToggleExportSarifVariable\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable.cmake b/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable.cmake
new file mode 100644
index 0000000..19c0a6e
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/ToggleExportSarifVariable.cmake
@@ -0,0 +1,6 @@
+# Generate potential SARIF results
+include("${CMAKE_CURRENT_LIST_DIR}/GenerateSarifResults.cmake")
+
+# Enable SARIF logging at the end for the most behavior coverage
+# All results should be captured regardless of when enabled
+set(CMAKE_EXPORT_SARIF ON CACHE BOOL "Export SARIF results" FORCE)
diff --git a/Tests/RunCMake/SarifOutput/check-sarif.cmake b/Tests/RunCMake/SarifOutput/check-sarif.cmake
new file mode 100644
index 0000000..a2e5279
--- /dev/null
+++ b/Tests/RunCMake/SarifOutput/check-sarif.cmake
@@ -0,0 +1,19 @@
+include("${CMAKE_CURRENT_LIST_DIR}/../CXXModules/check-json.cmake")
+
+# Check that the SARIF results from a test match the expected results
+macro(check_sarif_output sarif_output_file expected_sarif_output_file)
+ # Make sure the output file exists before reading it
+ if (NOT EXISTS "${sarif_output_file}")
+ message(FATAL_ERROR "SARIF output file not found: ${sarif_output_file}")
+ endif()
+ file(READ "${sarif_output_file}" actual_output)
+
+ # Make sure the expected output file exists before reading it
+ if (NOT EXISTS "${expected_sarif_output_file}")
+ message(FATAL_ERROR "Expected SARIF output file not found: ${expected_sarif_output_file}")
+ endif()
+ file(READ "${expected_sarif_output_file}" expected_output)
+
+ # Check the actual output against the expected output
+ check_json("${actual_output}" "${expected_output}")
+endmacro()
diff --git a/Tests/RunCMake/Swift/CompileCommands-check.cmake b/Tests/RunCMake/Swift/CompileCommands-check.cmake
index e33a027..b277c5c 100644
--- a/Tests/RunCMake/Swift/CompileCommands-check.cmake
+++ b/Tests/RunCMake/Swift/CompileCommands-check.cmake
@@ -11,13 +11,13 @@ set(expected_compile_commands
"directory": ".*(/Tests/RunCMake/Swift/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\Swift\\\\CompileCommands-build)",
"command": ".*swiftc .* (\\")?.*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")? (\\")?.*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?",
"file": ".*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)",
- "output": "CMakeFiles/CompileCommandLib.dir/(Debug(/|\\))?E.swift.o|CMakeFiles\\\\CompileCommandLib.dir\\\\E.swift.obj"
+ "output": "CMakeFiles/CompileCommandLib.dir/(Debug(/|\\))?E.swift.o|CMakeFiles\\\\CompileCommandLib.dir\\\\(Debug\\\\|Release\\\\)?E.swift.obj"
},
{
"directory": ".*(/Tests/RunCMake/Swift/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\Swift\\\\CompileCommands-build)",
"command": ".*swiftc .* (\\")?.*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")? (\\")?.*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?",
"file": ".*/Tests/RunCMake/Swift/L.swift",
- "output": "CMakeFiles/CompileCommandLib.dir/(Debug(/|\\))?L.swift.o|CMakeFiles\\\\CompileCommandLib.dir\\\\L.swift.obj"
+ "output": "CMakeFiles/CompileCommandLib.dir/(Debug(/|\\))?L.swift.o|CMakeFiles\\\\CompileCommandLib.dir\\\\(Debug\\\\|Release\\\\)?L.swift.obj"
}
]$]==]
)
diff --git a/Tests/RunCMake/Swift/ImportLibraryFlags-check-stdout.txt b/Tests/RunCMake/Swift/ImportLibraryFlags-check-stdout.txt
index 9b53820..94eb6d9 100644
--- a/Tests/RunCMake/Swift/ImportLibraryFlags-check-stdout.txt
+++ b/Tests/RunCMake/Swift/ImportLibraryFlags-check-stdout.txt
@@ -1 +1 @@
-.*-implib:lib\\L.lib
+.*-implib:lib\\(Debug\\|Release\\)?L.lib
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-darwin.txt b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-darwin.txt
index 20c656d..34d28f5 100644
--- a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-darwin.txt
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-darwin.txt
@@ -1,13 +1,20 @@
.*swiftc(.exe)? [^
-]* -parse-as-library -static -emit-module [^
+]* -parse-as-library -static[^
+]* -emit-module -emit-module-path (Debug/|Release/)?StaticLibrary.swiftmodule[^
]* -module-name StaticLibrary [^
]*
.*swiftc(.exe)? [^
-]* -parse-as-library -emit-module [^
+]* -parse-as-library[^
+]* -emit-module -emit-module-path (debug|release)/modules/DynamicLibrary.swiftmodule[^
]* -module-name DynamicLibrary [^
]*
.*swiftc(.exe)? [^
]* -emit-library [^
]* -Xlinker -install_name -Xlinker @rpath/libDynamicLibrary.dylib -o ([A-Za-z]+/)?libDynamicLibrary.dylib [^
]*
+.*swiftc(.exe)? [^
+]* -parse-as-library[^
+]* -emit-module -emit-module-path Modules/(Debug/|Release/)?DynamicLibrary2.swiftmodule[^
+]* -module-name DynamicLibrary2[^
+]*
.*swiftc(.exe)? -j [0-9]+ -num-threads [0-9]+ -c -module-name Executable
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-windows.txt b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-windows.txt
index 220a805..bfab4b6 100644
--- a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-windows.txt
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout-windows.txt
@@ -1,13 +1,20 @@
.*swiftc(.exe)? [^
-]* -parse-as-library -static -emit-module [^
+]* -parse-as-library -static[^
+]* -emit-module -emit-module-path (Debug\\|Release\\)?StaticLibrary.swiftmodule[^
]* -module-name StaticLibrary [^
]*
.*swiftc(.exe)? [^
-]* -parse-as-library -emit-module [^
+]* -parse-as-library[^
+]* -emit-module -emit-module-path (debug|release)\\modules\\DynamicLibrary.swiftmodule[^
]* -module-name DynamicLibrary [^
]*
.*swiftc(.exe)? [^
]* -emit-library [^
-]* -Xlinker -implib:DynamicLibrary.lib +-o ([A-Za-z]+/)?DynamicLibrary.dll [^
+]* -Xlinker -implib:(Debug\\|Release\\)?DynamicLibrary.lib +-o ([A-Za-z]+/)?(Debug\\|Release\\)?DynamicLibrary.dll [^
+]*
+.*swiftc(.exe)? [^
+]* -parse-as-library[^
+]* -emit-module -emit-module-path Modules\\(Debug\\|Release\\)?DynamicLibrary2.swiftmodule[^
+]* -module-name DynamicLibrary2 [^
]*
.*swiftc(.exe)? -j [0-9]+ -num-threads [0-9]+ -c -module-name Executable
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt
index c3530aa..7a9a96e 100644
--- a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt
@@ -1,13 +1,20 @@
.*swiftc(.exe)? [^
-]* -parse-as-library -static -emit-module [^
+]* -parse-as-library -static[^
+]* -emit-module -emit-module-path (Debug/|Release/)?StaticLibrary.swiftmodule[^
]* -module-name StaticLibrary [^
]*
.*swiftc(.exe)? [^
-]* -parse-as-library -emit-module [^
+]* -parse-as-library[^
+]* -emit-module -emit-module-path (debug|release)/modules/DynamicLibrary.swiftmodule[^
]* -module-name DynamicLibrary [^
]*
.*swiftc(.exe)? [^
]* -emit-library [^
]* -Xlinker -soname -Xlinker libDynamicLibrary.so -o ([A-Za-z]+/)?libDynamicLibrary.so [^
]*
+.*swiftc(.exe)? [^
+]* -parse-as-library[^
+]* -emit-module -emit-module-path Modules/(Debug/|Release/)?DynamicLibrary2.swiftmodule[^
+]* -module-name DynamicLibrary2[^
+]*
.*swiftc(.exe)? -j [0-9]+ -num-threads [0-9]+ -c -module-name Executable
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
index 700edf0..2b938d6 100644
--- a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
@@ -6,8 +6,19 @@ enable_language(Swift)
add_library(StaticLibrary STATIC L.swift)
add_library(DynamicLibrary SHARED L.swift)
-set_target_properties(DynamicLibrary PROPERTIES INSTALL_NAME_DIR "@rpath")
+set_target_properties(DynamicLibrary
+ PROPERTIES
+ Swift_MODULE_DIRECTORY "$<IF:$<CONFIG:Release>,release/modules,debug/modules>"
+ INSTALL_NAME_DIR "@rpath")
+
+add_library(DynamicLibrary2 SHARED L.swift)
+set_target_properties(DynamicLibrary2
+ PROPERTIES
+ Swift_MODULE_DIRECTORY "Modules"
+ INSTALL_NAME_DIR "@rpath")
+
add_executable(Executable E.swift)
+add_dependencies(DynamicLibrary2 DynamicLibrary)
add_dependencies(DynamicLibrary StaticLibrary)
-add_dependencies(Executable DynamicLibrary)
+add_dependencies(Executable DynamicLibrary2)
diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake
index 12f004b..9aebc62 100644
--- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake
+++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake
@@ -116,7 +116,7 @@ run_symlink_test(none-src_in_bin "binary/source" "binary" "source" "..")
# .../common_real/binary
# .../common -> common_real
file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common_real")
-file(REMOVE "${RunCMake_BINARY_DIR}/common")
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common")
file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/source")
file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/binary")
file(CREATE_LINK "common_real" "${RunCMake_BINARY_DIR}/common" SYMBOLIC)
@@ -136,11 +136,21 @@ run_symlink_test(common-bin_in_src "source" "source/binary" ".." "binary")
# Create the following structure:
#
+# .../common/real/source/binary
+# .../common/link -> common/real
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common")
+file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common/real/source/binary")
+file(CREATE_LINK "${RunCMake_BINARY_DIR}/common/real" "${RunCMake_BINARY_DIR}/common/link" SYMBOLIC)
+# Test that configure with -Bcommon/real/source/binary from within common/link has real CMAKE_BINARY_DIR
+run_symlink_test(common-use_real_build_from_-B "link/source" "real/source/binary" "../../../link/source" "../../real/source/binary")
+
+# Create the following structure:
+#
# .../common_real/binary
# .../common_real/binary/source
# .../common -> common_real
file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common_real")
-file(REMOVE "${RunCMake_BINARY_DIR}/common")
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common")
file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/binary")
file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/binary/source")
file(CREATE_LINK "common_real" "${RunCMake_BINARY_DIR}/common" SYMBOLIC)
diff --git a/Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt b/Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt
new file mode 100644
index 0000000..05c47b4
--- /dev/null
+++ b/Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt
@@ -0,0 +1,4 @@
+-- source: '[^']*/Tests/RunCMake/SymlinkTrees/common/link/source'
+-- binary: '[^']*/Tests/RunCMake/SymlinkTrees/common/real/source/binary'
+-- real source: '[^']*/Tests/RunCMake/SymlinkTrees/common/real/source'
+-- real binary: '[^']*/Tests/RunCMake/SymlinkTrees/common/real/source/binary'
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt b/Tests/RunCMake/Syntax/At-stderr.txt
index e3e5332..e3e5332 100644
--- a/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt
+++ b/Tests/RunCMake/Syntax/At-stderr.txt
diff --git a/Tests/RunCMake/Syntax/At.cmake b/Tests/RunCMake/Syntax/At.cmake
new file mode 100644
index 0000000..e8df7cd
--- /dev/null
+++ b/Tests/RunCMake/Syntax/At.cmake
@@ -0,0 +1,7 @@
+set(right "wrong")
+set(var "\${right}")
+# Not expanded here with the new policy.
+set(ref "@var@")
+
+string(CONFIGURE "${ref}" output)
+message("-->${output}<--")
diff --git a/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt
index 5dcd4d7..cbd1be4 100644
--- a/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt
+++ b/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt
@@ -1 +1 @@
--->wrong<--
+-->\${right}<--
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake
deleted file mode 100644
index 40dbe46..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-
-set(right "wrong")
-set(var "\${right}")
-# Not expanded here with the new policy.
-set(ref "@var@")
-
-string(CONFIGURE "${ref}" output)
-message("-->${output}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt
deleted file mode 100644
index 0dde1bc..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Deprecation Warning at CMP0053-At-OLD.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0053 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:3 \(include\)
-+
--->wrong<--$
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake
deleted file mode 100644
index 666f107..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_policy(SET CMP0053 OLD)
-
-set(right "wrong")
-set(var "\${right}")
-# Expanded here with the old policy.
-set(ref "@var@")
-
-string(CONFIGURE "${ref}" output)
-message("-->${output}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt
deleted file mode 100644
index ec37021..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-^CMake Warning \(dev\) at CMP0053-At-WARN-newlines.cmake:4 \(set\):
- Policy CMP0053 is not set: Simplify variable reference and escape sequence
- evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- For input:
-
- '
- @var@
- '
-
- the old evaluation rules produce:
-
- '
- \${right}
- '
-
- but the new evaluation rules produce:
-
- '
- @var@
- '
-
- Using the old result for compatibility since the policy is not set.
-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/Syntax/CMP0053-At-WARN-newlines.cmake b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake
deleted file mode 100644
index c493505..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(right "wrong")
-set(var "\${right}")
-# Expanded here with the old policy.
-set(ref "
-@var@
-")
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt
deleted file mode 100644
index 697b7b3..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-^CMake Warning \(dev\) at CMP0053-At-WARN.cmake:4 \(set\):
- Policy CMP0053 is not set: Simplify variable reference and escape sequence
- evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- For input:
-
- '@var@'
-
- the old evaluation rules produce:
-
- '\${right}'
-
- but the new evaluation rules produce:
-
- '@var@'
-
- Using the old result for compatibility since the policy is not set.
-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/Syntax/CMP0053-At-WARN.cmake b/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake
deleted file mode 100644
index 19c7f53..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-set(right "wrong")
-set(var "\${right}")
-# Expanded here with the old policy.
-set(ref "@var@")
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake
deleted file mode 100644
index b81fd56..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-
-set($ value)
-set(dollar $)
-message("-->${${dollar}}<--")
-message("-->${$}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
deleted file mode 100644
index 141d66d..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-^CMake Deprecation Warning at CMP0053-Dollar-OLD.cmake:1 \(cmake_policy\):
- The OLD behavior for policy CMP0053 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:3 \(include\)
-+
--->value<--
-CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\):
- Syntax error in cmake code at
-
- .*CMP0053-Dollar-OLD.cmake:6
-
- when parsing string
-
- -->\${\$}<--
-
- syntax error, unexpected \$, expecting } \(6\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake
deleted file mode 100644
index 647f464..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake_policy(SET CMP0053 OLD)
-
-set($ value)
-set(dollar $)
-message("-->${${dollar}}<--")
-message("-->${$}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt
deleted file mode 100644
index 09c7e7c..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-^CMake Warning \(dev\) at CMP0053-NUL.cmake:1 \(set\):
- Policy CMP0053 is not set: Simplify variable reference and escape sequence
- evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- For input:
-
- '\\0'
-
- the old evaluation rules produce:
-
- ''
-
- but the new evaluation rules produce an error:
-
- Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/CMP0053-NUL.cmake:1
- when parsing string
- \\0
- Invalid character escape '\\0'.
-
- Using the old result for compatibility since the policy is not set.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Warning \(dev\) at CMP0053-NUL.cmake:2 \(set\):
- Policy CMP0053 is not set: Simplify variable reference and escape sequence
- evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- For input:
-
- '\\0'
-
- the old evaluation rules produce:
-
- ''
-
- but the new evaluation rules produce an error:
-
- Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/CMP0053-NUL.cmake:2
- when parsing string
- \\0
- Invalid character escape '\\0'.
-
- Using the old result for compatibility since the policy is not set.
-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/Syntax/CMP0053-NUL.cmake b/Tests/RunCMake/Syntax/CMP0053-NUL.cmake
deleted file mode 100644
index 9ae0906..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NUL.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(qnul "\0")
-set(nul \0)
-message(-->${nul}<--)
-message(-->${qnul}<--)
-message("-->${nul}<--")
-message("-->${qnul}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt
deleted file mode 100644
index 9575778..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at CMP0053-NameWithCarriageReturn.cmake:2 \(message\):
- message called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake
deleted file mode 100644
index b8a403d..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message(${var\rwith\rcarriagereturn})
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake
deleted file mode 100644
index bb0d93f..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message("${var\rwith\rcarriagereturn}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt
deleted file mode 100644
index df67d37..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at CMP0053-NameWithEscapedSpaces.cmake:2 \(message\):
- message called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake
deleted file mode 100644
index 805b2ca..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message(${var\ with\ escaped\ space})
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake
deleted file mode 100644
index 58d8e8f..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message("${var\ with\ escaped\ space}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt
deleted file mode 100644
index 059044f..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at CMP0053-NameWithEscapedTabs.cmake:2 \(message\):
- message called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake
deleted file mode 100644
index 214ab5d..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message(${var\ with\ escaped\ tab})
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake
deleted file mode 100644
index aa5123f..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message("${var\ with\ escaped\ tab}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt
deleted file mode 100644
index 41f86e6..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at CMP0053-NameWithNewline.cmake:2 \(message\):
- message called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake
deleted file mode 100644
index 45b532e..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message(${var\nwith\nnewline})
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake
deleted file mode 100644
index 6fe568d..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message("${var\nwith\nnewline}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt
deleted file mode 100644
index 95e8684..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at CMP0053-NameWithSpaces.cmake:2 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake:2
-
- when parsing string
-
- \${var
-
- There is an unterminated variable reference.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake
deleted file mode 100644
index dae7d25..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message(${var with space})
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt
deleted file mode 100644
index c4f3cfe..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at CMP0053-NameWithSpacesQuoted.cmake:2 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake:2
-
- when parsing string
-
- \${var with space}
-
- Invalid character \(' '\) in a variable name: 'var'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake
deleted file mode 100644
index e252cff..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message("${var with space}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt
deleted file mode 100644
index b1678b3..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at CMP0053-NameWithTabs.cmake:2 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake:2
-
- when parsing string
-
- \${var
-
- There is an unterminated variable reference.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake
deleted file mode 100644
index 45e3045..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message(${var with tab})
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt
deleted file mode 100644
index 78adb5e..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at CMP0053-NameWithTabsQuoted.cmake:2 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake:2
-
- when parsing string
-
- \${var with tab}
-
- Invalid character \(' '\) in a variable name: 'var'
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake
deleted file mode 100644
index 498675f..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-message("${var with tab}")
diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt
deleted file mode 100644
index 7020c7e..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
--->value<--
diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake b/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake
deleted file mode 100644
index b5cdf0f..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-set("ENV{e(x)}" value)
-message(-->$ENV{e\(x\)}<--)
diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake
deleted file mode 100644
index 5559d4b..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_policy(SET CMP0053 NEW)
-set("ENV{e(x)}" value)
-message("-->$ENV{e\(x\)}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt
deleted file mode 100644
index c706939..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-^CMake Warning \(dev\) at CMP0053-WARN.cmake:2 \(message\):
- Policy CMP0053 is not set: Simplify variable reference and escape sequence
- evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- For input:
-
- '\\'
-
- the old evaluation rules produce:
-
- '\\'
-
- but the new evaluation rules produce an error:
-
- Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/CMP0053-WARN.cmake:2
- when parsing string
- \\
- Invalid character escape '\\' \(at end of input\).
-
- Using the old result for compatibility since the policy is not set.
-Call Stack \(most recent call first\):
- CMP0053-WARN.cmake:5 \(escape\)
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-\\$
diff --git a/Tests/RunCMake/Syntax/CMP0053-WARN.cmake b/Tests/RunCMake/Syntax/CMP0053-WARN.cmake
deleted file mode 100644
index 6e8b07b..0000000
--- a/Tests/RunCMake/Syntax/CMP0053-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-macro (escape str)
- message("${str}")
-endmacro ()
-
-escape("\\")
diff --git a/Tests/RunCMake/Syntax/CMakeLists.txt b/Tests/RunCMake/Syntax/CMakeLists.txt
index 4b3de84..bf2ef15 100644
--- a/Tests/RunCMake/Syntax/CMakeLists.txt
+++ b/Tests/RunCMake/Syntax/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt b/Tests/RunCMake/Syntax/Dollar-stderr.txt
index 7f248ae..7f248ae 100644
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt
+++ b/Tests/RunCMake/Syntax/Dollar-stderr.txt
diff --git a/Tests/RunCMake/Syntax/Dollar.cmake b/Tests/RunCMake/Syntax/Dollar.cmake
new file mode 100644
index 0000000..6b87064
--- /dev/null
+++ b/Tests/RunCMake/Syntax/Dollar.cmake
@@ -0,0 +1,4 @@
+set($ value)
+set(dollar $)
+message("-->${${dollar}}<--")
+message("-->${$}<--")
diff --git a/Tests/RunCMake/Syntax/Escape2-stderr.txt b/Tests/RunCMake/Syntax/Escape2-stderr.txt
index cc3bdf0..7f10c3c 100644
--- a/Tests/RunCMake/Syntax/Escape2-stderr.txt
+++ b/Tests/RunCMake/Syntax/Escape2-stderr.txt
@@ -1,7 +1,7 @@
-CMake Error at Escape2.cmake:4 \(message\):
+CMake Error at Escape2.cmake:2 \(message\):
Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/Escape2.cmake:4
+ .*/Tests/RunCMake/Syntax/Escape2.cmake:2
when parsing string
@@ -9,5 +9,5 @@ CMake Error at Escape2.cmake:4 \(message\):
Invalid character escape '\\' \(at end of input\).
Call Stack \(most recent call first\):
- Escape2.cmake:7 \(escape\)
+ Escape2.cmake:5 \(escape\)
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/Escape2.cmake b/Tests/RunCMake/Syntax/Escape2.cmake
index 078a822..6e8b07b 100644
--- a/Tests/RunCMake/Syntax/Escape2.cmake
+++ b/Tests/RunCMake/Syntax/Escape2.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0053 NEW)
-
macro (escape str)
message("${str}")
endmacro ()
diff --git a/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in b/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in
index d1d908c..9e59b78 100644
--- a/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in
+++ b/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in
@@ -1,7 +1,7 @@
-CMake Error at EscapeChar-@char@-@testnum@.cmake:3 \(message\):
+CMake Error at EscapeChar-@char@-@testnum@.cmake:1 \(message\):
Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/EscapeChar-@char@-@testnum@.cmake:3
+ .*/Tests/RunCMake/Syntax/EscapeChar-@char@-@testnum@.cmake:1
when parsing string
diff --git a/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in b/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in
index 6f265e5..2c3bc73 100644
--- a/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in
+++ b/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in
@@ -1,3 +1 @@
-cmake_policy(SET CMP0053 NEW)
-
message("-->\@char@<--")
diff --git a/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake b/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake
index e9c568d..1965791 100644
--- a/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake
+++ b/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0053 NEW)
-
set("semicolon;in;name" semicolon)
set("dollar$in$name" dollar)
set("brace{in}name" brace)
diff --git a/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt b/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt
index 077272d..bb8f5c6 100644
--- a/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt
+++ b/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt
@@ -1 +1,2 @@
--->"<--
+^-->\\"<--
+-->\\"<--$
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
index 71b9c3c..c999d3e 100644
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
@@ -1,12 +1,4 @@
^CMake Error at NameWithCarriageReturn.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake:1
-
- when parsing string
-
- \${var\\rwith\\rcarriagereturn}
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
+ message called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
deleted file mode 100644
index c43e1be..0000000
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at NameWithCarriageReturnQuoted.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake:1
-
- when parsing string
-
- \${var\\rwith\\rcarriagereturn}
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
index 3a26135..f286a26 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
@@ -1,12 +1,4 @@
^CMake Error at NameWithEscapedSpaces.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake:1
-
- when parsing string
-
- \${var\\ with\\ escaped\\ space}
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
+ message called with incorrect number of arguments
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
deleted file mode 100644
index 0f40649..0000000
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at NameWithEscapedSpacesQuoted.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake:1
-
- when parsing string
-
- \${var\\ with\\ escaped\\ space}
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt
index d7fc38a..5a41740 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt
@@ -1,12 +1,4 @@
^CMake Error at NameWithEscapedTabs.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake:1
-
- when parsing string
-
- \${var\\ with\\ escaped\\ tab}
-
- Invalid escape sequence \\.?
+ message called with incorrect number of arguments
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt
deleted file mode 100644
index 915dbaa..0000000
--- a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at NameWithEscapedTabsQuoted.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake:1
-
- when parsing string
-
- \${var\\ with\\ escaped\\ tab}
-
- Invalid escape sequence \\.?
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
index 77bd470..7091970 100644
--- a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
@@ -1,12 +1,4 @@
^CMake Error at NameWithNewline.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithNewline.cmake:1
-
- when parsing string
-
- \${var\\nwith\\nnewline}
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
+ message called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
deleted file mode 100644
index 1d14b1d..0000000
--- a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-^CMake Error at NameWithNewlineQuoted.cmake:1 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake:1
-
- when parsing string
-
- \${var\\nwith\\nnewline}
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
index 71e8db3..44e0a81 100644
--- a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
@@ -7,6 +7,6 @@
\${var
- syntax error, unexpected end of file, expecting } \(6\)
+ There is an unterminated variable reference.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
index 6e3744a..4a12932 100644
--- a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var with space}
- syntax error, unexpected cal_SYMBOL, expecting } \(3\)
+ Invalid character \(' '\) in a variable name: 'var'
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
index 84ccdbe..b5f3348 100644
--- a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
@@ -7,6 +7,6 @@
\${var
- syntax error, unexpected end of file, expecting } \(6\)
+ There is an unterminated variable reference.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
index e18268a..0757300 100644
--- a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var with tab}
- syntax error, unexpected cal_SYMBOL, expecting } \(3\)
+ Invalid character \(' '\) in a variable name: 'var'
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
deleted file mode 100644
index 24c810b..0000000
--- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-CMake Warning \(dev\) at ParenInENV.cmake:2:
- Syntax Warning in cmake code at column 21
-
- Argument not separated from preceding token by whitespace.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at ParenInENV.cmake:2 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2
-
- when parsing string
-
- -->\$ENV{e
-
- syntax error, unexpected end of file, expecting } \(10\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt b/Tests/RunCMake/Syntax/ParenInENV1-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt
+++ b/Tests/RunCMake/Syntax/ParenInENV1-result.txt
diff --git a/Tests/RunCMake/Syntax/ParenInENV1-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV1-stderr.txt
new file mode 100644
index 0000000..443ac7a
--- /dev/null
+++ b/Tests/RunCMake/Syntax/ParenInENV1-stderr.txt
@@ -0,0 +1,20 @@
+CMake Warning \(dev\) at ParenInENV1.cmake:2:
+ Syntax Warning in cmake code at column 21
+
+ Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at ParenInENV1.cmake:2 \(message\):
+ Syntax error in cmake code at
+
+ .*/Tests/RunCMake/Syntax/ParenInENV1.cmake:2
+
+ when parsing string
+
+ -->\$ENV{e
+
+ There is an unterminated variable reference\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/ParenInENV.cmake b/Tests/RunCMake/Syntax/ParenInENV1.cmake
index 148f726..148f726 100644
--- a/Tests/RunCMake/Syntax/ParenInENV.cmake
+++ b/Tests/RunCMake/Syntax/ParenInENV1.cmake
diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV2-stderr.txt
index 7020c7e..7020c7e 100644
--- a/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInENV2-stderr.txt
diff --git a/Tests/RunCMake/Syntax/ParenInENV2.cmake b/Tests/RunCMake/Syntax/ParenInENV2.cmake
new file mode 100644
index 0000000..53c5e2b
--- /dev/null
+++ b/Tests/RunCMake/Syntax/ParenInENV2.cmake
@@ -0,0 +1,2 @@
+set("ENV{e(x)}" value)
+message(-->$ENV{e\(x\)}<--)
diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt b/Tests/RunCMake/Syntax/ParenInQuotedENV1-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt
+++ b/Tests/RunCMake/Syntax/ParenInQuotedENV1-result.txt
diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV1-stderr.txt b/Tests/RunCMake/Syntax/ParenInQuotedENV1-stderr.txt
new file mode 100644
index 0000000..7803634
--- /dev/null
+++ b/Tests/RunCMake/Syntax/ParenInQuotedENV1-stderr.txt
@@ -0,0 +1,13 @@
+^CMake Error at ParenInQuotedENV1\.cmake:2 \(message\):
+ Syntax error in cmake code at
+
+ [^
+]*/Tests/RunCMake/Syntax/ParenInQuotedENV1\.cmake:2
+
+ when parsing string
+
+ -->\$ENV{e\(x\)}<--
+
+ Invalid character \('\('\) in a variable name: 'e'
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake b/Tests/RunCMake/Syntax/ParenInQuotedENV1.cmake
index 6333717..6333717 100644
--- a/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake
+++ b/Tests/RunCMake/Syntax/ParenInQuotedENV1.cmake
diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInQuotedENV2-stderr.txt
index 7020c7e..7020c7e 100644
--- a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInQuotedENV2-stderr.txt
diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV2.cmake b/Tests/RunCMake/Syntax/ParenInQuotedENV2.cmake
new file mode 100644
index 0000000..0a836d0
--- /dev/null
+++ b/Tests/RunCMake/Syntax/ParenInQuotedENV2.cmake
@@ -0,0 +1,2 @@
+set("ENV{e(x)}" value)
+message("-->$ENV{e\(x\)}<--")
diff --git a/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt
index 0a6b60f..8fb5650 100644
--- a/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt
@@ -1,7 +1,7 @@
-CMake Error at ParenInVarName0.cmake:4 \(message\):
+CMake Error at ParenInVarName0.cmake:2 \(message\):
Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/ParenInVarName0.cmake:4
+ .*/Tests/RunCMake/Syntax/ParenInVarName0.cmake:2
when parsing string
diff --git a/Tests/RunCMake/Syntax/ParenInVarName0.cmake b/Tests/RunCMake/Syntax/ParenInVarName0.cmake
index f863d20..3e93d4e 100644
--- a/Tests/RunCMake/Syntax/ParenInVarName0.cmake
+++ b/Tests/RunCMake/Syntax/ParenInVarName0.cmake
@@ -1,4 +1,2 @@
-cmake_policy(SET CMP0053 NEW)
-
set("e(x)" value)
message("-->${e(x)}<--")
diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
deleted file mode 100644
index 18ca946..0000000
--- a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Error at ParenInVarName1.cmake:4 \(message\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/ParenInVarName1.cmake:4
-
- when parsing string
-
- -->\${e\(x\)}<--
-
- syntax error, unexpected cal_SYMBOL, expecting } \(6\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/ParenInVarName1.cmake b/Tests/RunCMake/Syntax/ParenInVarName1.cmake
deleted file mode 100644
index 9fdc87b..0000000
--- a/Tests/RunCMake/Syntax/ParenInVarName1.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_policy(SET CMP0053 OLD)
-
-set("{e(x)}" value)
-message("-->${e(x)}<--")
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index f56ac64..2817f76 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -1,19 +1,10 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
run_cmake(BOM-UTF-8)
run_cmake(BOM-UTF-16-LE)
run_cmake(BOM-UTF-16-BE)
run_cmake(BOM-UTF-32-LE)
run_cmake(BOM-UTF-32-BE)
-run_cmake(CMP0053-At-OLD)
-run_cmake(CMP0053-At-NEW)
-run_cmake(CMP0053-At-WARN)
-run_cmake(CMP0053-At-WARN-newlines)
-run_cmake(CMP0053-WARN)
-run_cmake(CMP0053-NUL)
-run_cmake(CMP0053-ParenInENV)
-run_cmake(CMP0053-ParenInQuotedENV)
run_cmake(CommandSpaces)
run_cmake(CommandTabs)
run_cmake(CommandNewlines)
@@ -58,18 +49,17 @@ run_cmake(Escape2)
run_cmake(EscapeCharsAllowed)
run_cmake(NullAfterBackslash)
run_cmake(NullTerminatedArgument)
-include("${RunCMake_SOURCE_DIR}/EscapeCharsDisallowed.cmake")
+if(NOT RunCMake_TEST_E2K_BROKEN_LIBC)
+ include("${RunCMake_SOURCE_DIR}/EscapeCharsDisallowed.cmake")
+endif()
run_cmake(ParenNoSpace0)
run_cmake(ParenNoSpace1)
run_cmake(ParenNoSpace2)
run_cmake(ParenInVarName0)
-run_cmake(ParenInVarName1)
run_cmake(UnterminatedCall1)
run_cmake(UnterminatedCall2)
run_cmake(UnterminatedString)
-run_cmake(UnterminatedBrace0)
run_cmake(UnterminatedBrace1)
-run_cmake(UnterminatedBrace2)
run_cmake(UnterminatedBracket0)
run_cmake(UnterminatedBracket1)
run_cmake(UnterminatedBracketComment)
@@ -79,14 +69,17 @@ run_cmake(ImproperNesting)
run_cmake(ExpandInAt)
run_cmake(EscapedAt)
run_cmake(EscapeQuotes)
+run_cmake(At)
run_cmake(AtWithVariable)
run_cmake(AtWithVariableEmptyExpansion)
run_cmake(AtWithVariableAtOnly)
run_cmake(AtWithVariableEmptyExpansionAtOnly)
run_cmake(AtWithVariableFile)
run_cmake(AtWithVariableAtOnlyFile)
-run_cmake(ParenInENV)
-run_cmake(ParenInQuotedENV)
+run_cmake(ParenInENV1)
+run_cmake(ParenInENV2)
+run_cmake(ParenInQuotedENV1)
+run_cmake(ParenInQuotedENV2)
# Variable name tests
run_cmake(NameWithSpaces)
@@ -101,20 +94,7 @@ run_cmake(NameWithNewlineQuoted)
run_cmake(NameWithCarriageReturnQuoted)
run_cmake(NameWithEscapedSpacesQuoted)
run_cmake(NameWithEscapedTabsQuoted)
-run_cmake(CMP0053-NameWithSpaces)
-run_cmake(CMP0053-NameWithTabs)
-run_cmake(CMP0053-NameWithNewline)
-run_cmake(CMP0053-NameWithCarriageReturn)
-run_cmake(CMP0053-NameWithEscapedSpaces)
-run_cmake(CMP0053-NameWithEscapedTabs)
-run_cmake(CMP0053-NameWithSpacesQuoted)
-run_cmake(CMP0053-NameWithTabsQuoted)
-run_cmake(CMP0053-NameWithNewlineQuoted)
-run_cmake(CMP0053-NameWithCarriageReturnQuoted)
-run_cmake(CMP0053-NameWithEscapedSpacesQuoted)
-run_cmake(CMP0053-NameWithEscapedTabsQuoted)
-run_cmake(CMP0053-Dollar-OLD)
-run_cmake(CMP0053-Dollar-NEW)
+run_cmake(Dollar)
# Variable special types
run_cmake(QueryCache)
diff --git a/Tests/RunCMake/Syntax/Unquoted2.cmake b/Tests/RunCMake/Syntax/Unquoted2.cmake
index d94057d..4f8ffb2 100644
--- a/Tests/RunCMake/Syntax/Unquoted2.cmake
+++ b/Tests/RunCMake/Syntax/Unquoted2.cmake
@@ -1,3 +1 @@
-cmake_policy(SET CMP0053 NEW)
-
message(\[[Unquoted Bracket Argument 1]])
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
deleted file mode 100644
index c7238df..0000000
--- a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Error at UnterminatedBrace0.cmake:1 \(set\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake:1
-
- when parsing string
-
- \${
-
- syntax error, unexpected end of file, expecting } \(3\)
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake
deleted file mode 100644
index 09af0ce..0000000
--- a/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake
+++ /dev/null
@@ -1 +0,0 @@
-set(var "${")
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-result.txt
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
index 3d88f36..745a651 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
@@ -1,13 +1,12 @@
-CMake Warning \(dev\) at UnterminatedBrace1.cmake:2 \(set\):
+CMake Error at UnterminatedBrace1.cmake:1 \(set\):
Syntax error in cmake code at
- .*/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake:2
+ .*/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake:1
when parsing string
\${
- syntax error, unexpected end of file, expecting } \(3\)
+ There is an unterminated variable reference.
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/Syntax/UnterminatedBrace1.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake
index 8b40b19..09af0ce 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0010 OLD)
set(var "${")
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt
deleted file mode 100644
index 0d76251..0000000
--- a/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Error at UnterminatedBrace2.cmake:3 \(set\):
- Syntax error in cmake code at
-
- .*/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake:3
-
- when parsing string
-
- \${
-
- There is an unterminated variable reference.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake
deleted file mode 100644
index 30d4d4d..0000000
--- a/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_policy(SET CMP0010 OLD)
-cmake_policy(SET CMP0053 NEW)
-set(var "${")
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 4015ae8..0e57ffd 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -44,6 +44,8 @@
\* CMP0160
\* CMP0162
\* CMP0179
+ \* CMP0181
+ \* CMP0182
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
index 78996e4..423262b 100644
--- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
@@ -8,10 +8,16 @@ function(run_build name)
endfunction()
run_cmake(unitybuild_c)
+run_cmake(unitybuild_c_absolute_path)
+run_cmake(unitybuild_c_relocatable_path)
run_cmake(unitybuild_c_batch)
run_cmake(unitybuild_c_group)
run_cmake(unitybuild_cxx)
+run_cmake(unitybuild_cxx_absolute_path)
+run_cmake(unitybuild_cxx_relocatable_path)
run_cmake(unitybuild_cxx_group)
+run_cmake(unitybuild_c_and_cxx_absolute_path)
+run_cmake(unitybuild_c_and_cxx_relocatable_path)
run_cmake(unitybuild_c_and_cxx)
run_cmake(unitybuild_c_and_cxx_group)
if(CMake_TEST_OBJC)
@@ -37,6 +43,7 @@ run_cmake(unitybuild_invalid_mode)
run_build(unitybuild_anon_ns)
run_build(unitybuild_anon_ns_no_unity_build)
run_build(unitybuild_anon_ns_group_mode)
+run_cmake(unitybuild_relocatable_locations)
function(run_per_config name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
diff --git a/Tests/RunCMake/UnityBuild/relocatable/foo.c b/Tests/RunCMake/UnityBuild/relocatable/foo.c
new file mode 100644
index 0000000..de1160c
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/relocatable/foo.c
@@ -0,0 +1,5 @@
+int foo(int x)
+{
+ (void)x;
+ return 0;
+}
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-check.cmake
new file mode 100644
index 0000000..e716e93
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-check.cmake
@@ -0,0 +1,17 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
+if(NOT EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source file ${unitybuild_c} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-build/s1\.c"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-build/s2\.c"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path-build/s3\.c"]]
+)
+
+file(STRINGS ${unitybuild_c} unitybuild_c_strings)
+if(NOT unitybuild_c_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_c} doesn't contain absolute paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path.cmake
new file mode 100644
index 0000000..0fe6fbf
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_absolute_path.cmake
@@ -0,0 +1,13 @@
+project(unitybuild_c_absolute_path C)
+
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE FALSE)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-check.cmake
new file mode 100644
index 0000000..aa41f78
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-check.cmake
@@ -0,0 +1,35 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
+if(NOT EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-build/s1\.c"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-build/s2\.c"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-build/s3\.c"]]
+)
+
+file(STRINGS ${unitybuild_c} unitybuild_c_strings)
+if(NOT unitybuild_c_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_c} doesn't contain absolute paths")
+ return()
+endif()
+
+set(unitybuild_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_cxx.cxx")
+if(NOT EXISTS "${unitybuild_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_cxx} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT_CXX
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-build/s1\.cxx"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-build/s2\.cxx"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path-build/s3\.cxx"]]
+)
+
+file(STRINGS ${unitybuild_cxx} unitybuild_cxx_strings)
+if(NOT unitybuild_cxx_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT_CXX}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_cxx} doesn't contain absolute paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path.cmake
new file mode 100644
index 0000000..9c6b0e4
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_absolute_path.cmake
@@ -0,0 +1,18 @@
+project(unitybuild_c_and_cxx_absolute_path C CXX)
+
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src_c "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src_c}" "int s${s}(void) { return 0; }\n")
+
+ set(src_cxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src_cxx}" "int s${s}(void) { return 0; }\n")
+
+ list(APPEND srcs "${src_c}")
+ list(APPEND srcs "${src_cxx}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE FALSE)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path-check.cmake
new file mode 100644
index 0000000..e5fd4df
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path-check.cmake
@@ -0,0 +1,35 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
+if(NOT EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "\.\./\.\./\.\./s1\.c"]]
+ [[#include "\.\./\.\./\.\./s2\.c"]]
+ [[#include "\.\./\.\./\.\./s3\.c"]]
+)
+
+file(STRINGS ${unitybuild_c} unitybuild_c_strings)
+if(NOT unitybuild_c_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_c} doesn't contain relative paths")
+ return()
+endif()
+
+set(unitybuild_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_cxx.cxx")
+if(NOT EXISTS "${unitybuild_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_cxx} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT_CXX
+ [[#include "\.\./\.\./\.\./s1\.cxx"]]
+ [[#include "\.\./\.\./\.\./s2\.cxx"]]
+ [[#include "\.\./\.\./\.\./s3\.cxx"]]
+)
+
+file(STRINGS ${unitybuild_cxx} unitybuild_cxx_strings)
+if(NOT unitybuild_cxx_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT_CXX}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_cxx} doesn't contain relative paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path.cmake
new file mode 100644
index 0000000..21257f4
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_relocatable_path.cmake
@@ -0,0 +1,18 @@
+project(unitybuild_c_and_cxx_relocatable_path C CXX)
+
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src_c "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src_c}" "int s${s}(void) { return 0; }\n")
+
+ set(src_cxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src_cxx}" "int s${s}(void) { return 0; }\n")
+
+ list(APPEND srcs "${src_c}")
+ list(APPEND srcs "${src_cxx}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE TRUE)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path-check.cmake
new file mode 100644
index 0000000..f8e41ce
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path-check.cmake
@@ -0,0 +1,17 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
+if(NOT EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source file ${unitybuild_c} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "\.\./\.\./\.\./s1\.c"]]
+ [[#include "\.\./\.\./\.\./s2\.c"]]
+ [[#include "\.\./\.\./\.\./s3\.c"]]
+)
+
+file(STRINGS ${unitybuild_c} unitybuild_c_strings)
+if(NOT unitybuild_c_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_c} doesn't contain relative paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path.cmake
new file mode 100644
index 0000000..e6046e6
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path.cmake
@@ -0,0 +1,14 @@
+project(unitybuild_c_relocatable_path C)
+
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE TRUE
+ UNITY_BUILD_UNIQUE_ID "anon")
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-check.cmake
new file mode 100644
index 0000000..95d96ec
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-check.cmake
@@ -0,0 +1,17 @@
+set(unitybuild_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_cxx.cxx")
+if(NOT EXISTS "${unitybuild_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source file ${unitybuild_cxx} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-build/s1\.cxx"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-build/s2\.cxx"]]
+ [[#include "([A-Za-z]:)?/[^"]*/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path-build/s3\.cxx"]]
+)
+
+file(STRINGS ${unitybuild_cxx} unitybuild_cxx_strings)
+if(NOT unitybuild_cxx_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_cxx} doesn't contain absolute paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path.cmake
new file mode 100644
index 0000000..07543f4
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_absolute_path.cmake
@@ -0,0 +1,13 @@
+project(unitybuild_cxx_absolute_path CXX)
+
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE FALSE)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path-check.cmake
new file mode 100644
index 0000000..d06547d
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path-check.cmake
@@ -0,0 +1,17 @@
+set(unitybuild_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_cxx.cxx")
+if(NOT EXISTS "${unitybuild_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source file ${unitybuild_cxx} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "\.\./\.\./\.\./s1\.cxx"]]
+ [[#include "\.\./\.\./\.\./s2\.cxx"]]
+ [[#include "\.\./\.\./\.\./s3\.cxx"]]
+)
+
+file(STRINGS ${unitybuild_cxx} unitybuild_cxx_strings)
+if(NOT unitybuild_cxx_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_cxx} doesn't contain relative paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path.cmake
new file mode 100644
index 0000000..abf672d
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_relocatable_path.cmake
@@ -0,0 +1,13 @@
+project(unitybuild_cxx_relocatable_path CXX)
+
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE TRUE)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations-check.cmake
new file mode 100644
index 0000000..565920c
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations-check.cmake
@@ -0,0 +1,22 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
+if(NOT EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source file ${unitybuild_c} does not exist.")
+ return()
+endif()
+
+string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
+ [[#include "\.\./\.\./\.\./s1\.c"]]
+ [[#include "\.\./\.\./\.\./s2\.c"]]
+ [[#include "\.\./\.\./\.\./s3\.c"]]
+ [[#include "\.\./\.\./\.\./subFolder/sub1\.c"]]
+ [[#include "\.\./\.\./\.\./subFolder/sub2\.c"]]
+ [[#include "\.\./\.\./\.\./subFolder/sub3\.c"]]
+ [[#include "f\.c"]]
+ [[#include "relocatable/foo\.c"]]
+)
+
+file(STRINGS ${unitybuild_c} unitybuild_c_strings)
+if(NOT unitybuild_c_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
+ set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_c} doesn't contain relative paths")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations.cmake b/Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations.cmake
new file mode 100644
index 0000000..a28d89e
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_relocatable_locations.cmake
@@ -0,0 +1,23 @@
+project(unitybuild_relocatable_locations C)
+
+# Binary path relative source file
+set(srcs "")
+foreach(s RANGE 1 3)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+foreach(s RANGE 1 3)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/subFolder/sub${s}.c")
+ file(WRITE "${src}" "int sub${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+# Source path relative source file
+list(APPEND srcs "${CMAKE_SOURCE_DIR}/f.c")
+list(APPEND srcs "${CMAKE_SOURCE_DIR}/relocatable/foo.c")
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_RELOCATABLE TRUE)
diff --git a/Tests/RunCMake/VS10Project/CSharpSourceGroup/Images/empty.bmp b/Tests/RunCMake/VS10Project/CSharpSourceGroup/Images/empty.bmp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/CSharpSourceGroup/Images/empty.bmp
diff --git a/Tests/RunCMake/VS10Project/CustomCommandParallelDisable-check.cmake b/Tests/RunCMake/VS10Project/CustomCommandParallelDisable-check.cmake
new file mode 100644
index 0000000..e0608f6
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/CustomCommandParallelDisable-check.cmake
@@ -0,0 +1,42 @@
+# Check whether the 'BuildInParallel' setting is set as expected for a specified project file.
+# Note: if the setting is not present in the project file then it is assumed to be implicitly 'false'.
+function(check_build_in_parallel_setting projectFile expectedEnabled)
+ set(SettingEnabledRegex "<BuildInParallel.*>true</BuildInParallel>")
+ set(SettingDisabledRegex "<BuildInParallel.*>false</BuildInParallel>")
+
+ if(NOT EXISTS "${projectFile}")
+ set(RunCMake_TEST_FAILED "Project file '${projectFile}' does not exist." PARENT_SCOPE)
+ return()
+ endif()
+
+ set(settingEnabled FALSE)
+ set(settingExplicitlyDisabled FALSE)
+
+ file(STRINGS "${projectFile}" lines)
+
+ foreach(line IN LISTS lines)
+ if(line MATCHES "${SettingEnabledRegex}")
+ set(settingEnabled TRUE)
+ elseif(line MATCHES "${SettingDisabledRegex}")
+ set(settingExplicitlyDisabled TRUE)
+ endif()
+ endforeach()
+
+ if(expectedEnabled)
+ if(NOT settingEnabled)
+ set(RunCMake_TEST_FAILED "Expected 'BuildInParallel' to be enabled for projectFile '${projectFile}' but it was not!" PARENT_SCOPE)
+ endif()
+ if(settingExplicitlyDisabled)
+ set(RunCMake_TEST_FAILED "Expected 'BuildInParallel' to be enabled for projectFile '${projectFile}' but instead found it explicitly disabled!" PARENT_SCOPE)
+ endif()
+ else()
+ if(settingEnabled)
+ set(RunCMake_TEST_FAILED "Expected 'BuildInParallel' to be disabled for projectFile '${projectFile}' but it was not!")
+ endif()
+ endif()
+endfunction()
+
+check_build_in_parallel_setting("${RunCMake_TEST_BINARY_DIR}/foo1.vcxproj" TRUE)
+check_build_in_parallel_setting("${RunCMake_TEST_BINARY_DIR}/bar1.vcxproj" FALSE)
+check_build_in_parallel_setting("${RunCMake_TEST_BINARY_DIR}/foo2.vcxproj" FALSE)
+check_build_in_parallel_setting("${RunCMake_TEST_BINARY_DIR}/bar2.vcxproj" FALSE)
diff --git a/Tests/RunCMake/VS10Project/CustomCommandParallelDisable.cmake b/Tests/RunCMake/VS10Project/CustomCommandParallelDisable.cmake
new file mode 100644
index 0000000..b9ea3ab
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/CustomCommandParallelDisable.cmake
@@ -0,0 +1,21 @@
+block()
+ cmake_policy(SET CMP0147 NEW) # Build custom commands in parallel by default
+
+ add_custom_command(OUTPUT "foo.out.txt" COMMAND echo Foo > foo.out.txt MAIN_DEPENDENCY "foo.txt")
+ add_custom_command(OUTPUT "bar.out.txt" COMMAND echo Bar > bar.out.txt MAIN_DEPENDENCY "bar.txt")
+ set_property(SOURCE "bar.txt" PROPERTY VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD TRUE)
+
+ add_custom_target(foo1 SOURCES foo.txt)
+ add_custom_target(bar1 SOURCES bar.txt)
+endblock()
+
+block()
+ cmake_policy(SET CMP0147 OLD) # Don't build custom commands in parallel by default
+
+ add_custom_command(OUTPUT "foo.out.cpp" COMMAND echo Foo > foo.out.txt MAIN_DEPENDENCY "foo.cpp")
+ add_custom_command(OUTPUT "bar.out.cpp" COMMAND echo Bar > bar.out.txt MAIN_DEPENDENCY "bar.cpp")
+ set_property(SOURCE "bar.cpp" PROPERTY VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD TRUE)
+
+ add_custom_target(foo2 SOURCES foo.cpp)
+ add_custom_target(bar2 SOURCES bar.cpp)
+endblock()
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index bbd8c8b..37f780c 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -1,7 +1,4 @@
-cmake_policy(SET CMP0057 NEW)
-
include(RunCMake)
-cmake_policy(SET CMP0054 NEW)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
run_cmake(LanguageStandard)
@@ -10,6 +7,7 @@ endif()
run_cmake(CustomCommandGenex)
if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio 1[1-5] ")
run_cmake(CustomCommandParallel)
+ run_cmake(CustomCommandParallelDisable)
endif()
run_cmake_with_options(VsCharacterSet -DSET_CHARSET=MultiByte)
run_cmake_with_options(VsCharacterSet -DSET_CHARSET=Unicode)
diff --git a/Tests/RunCMake/VS10Project/SolutionItems-check.cmake b/Tests/RunCMake/VS10Project/SolutionItems-check.cmake
new file mode 100644
index 0000000..a917e0b
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SolutionItems-check.cmake
@@ -0,0 +1,351 @@
+function(MapAppend map key value)
+ list(APPEND "${map}_k" "${key}")
+ list(APPEND "${map}_v" "${value}")
+
+ set("${map}_k" "${${map}_k}" PARENT_SCOPE)
+ set("${map}_v" "${${map}_v}" PARENT_SCOPE)
+endfunction()
+
+function(MapLength map out_variable)
+ list(LENGTH "${map}_k" length)
+ set("${out_variable}" "${length}" PARENT_SCOPE)
+endfunction()
+
+function(MapFind map key out_variable)
+ list(FIND "${map}_k" "${key}" index)
+ if("${index}" LESS 0)
+ unset("${out_variable}" PARENT_SCOPE)
+ else()
+ list(GET "${map}_v" "${index}" value)
+ set("${out_variable}" "${value}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+macro(MapPropagateToParentScope map)
+ set("${map}_k" "${${map}_k}" PARENT_SCOPE)
+ set("${map}_v" "${${map}_v}" PARENT_SCOPE)
+endmacro()
+
+
+function(ParseSln vcSlnFile)
+ if(NOT EXISTS "${vcSlnFile}")
+ set(RunCMake_TEST_FAILED "Solution file ${vcSlnFile} does not exist." PARENT_SCOPE)
+ return()
+ endif()
+
+ set(SCOPE "")
+
+ set(IN_SOLUTION_ITEMS FALSE)
+ set(IN_NESTED_PROJECTS FALSE)
+
+ set(REGUID "\\{[0-9A-F-]+\\}")
+
+ file(STRINGS "${vcSlnFile}" lines)
+ foreach(line IN LISTS lines)
+ string(STRIP "${line}" line)
+
+ # Project(...)
+ if(line MATCHES "Project\\(\"(${REGUID})\"\\) = \"([^\"]+)\", \"([^\"]+)\", \"(${REGUID})\"")
+ if(NOT "${SCOPE}" STREQUAL "")
+ set(RunCMake_TEST_FAILED "Improper nesting of Project" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "Project")
+
+ if("${CMAKE_MATCH_1}" STREQUAL "{2150E333-8FDC-42A3-9474-1A3956D46DE8}")
+ set(GROUP_NAME "${CMAKE_MATCH_2}")
+
+ MapFind(GROUP_PATHS "${GROUP_NAME}" existing_path)
+ if(DEFINED existing_path)
+ set(RunCMake_TEST_FAILED "Duplicate solution items project '${GROUP_NAME}'" PARENT_SCOPE)
+ return()
+ endif()
+
+ MapAppend(GROUP_PATHS "${GROUP_NAME}" "${CMAKE_MATCH_3}")
+ MapAppend(GROUP_GUIDS "${GROUP_NAME}" "${CMAKE_MATCH_4}")
+ endif()
+
+ # EndProject
+ elseif(line STREQUAL "EndProject")
+ if(NOT "${SCOPE}" STREQUAL "Project")
+ set(RunCMake_TEST_FAILED "Improper nesting of EndProject" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "")
+
+ unset(GROUP_NAME)
+
+ # ProjectSection
+ elseif(line MATCHES "ProjectSection\\(([a-zA-Z]+)\\) = ([a-zA-Z]+)")
+ if(NOT "${SCOPE}" STREQUAL "Project")
+ set(RunCMake_TEST_FAILED "Improper nesting of ProjectSection" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "ProjectSection")
+
+ if("${CMAKE_MATCH_1}" STREQUAL "SolutionItems")
+ if(NOT "${CMAKE_MATCH_2}" STREQUAL "preProject")
+ set(RunCMake_TEST_FAILED "SolutionItems must be preProject" PARENT_SCOPE)
+ return()
+ endif()
+
+ set(IN_SOLUTION_ITEMS TRUE)
+ endif()
+
+ # EndProjectSection
+ elseif(line STREQUAL "EndProjectSection")
+ if(NOT "${SCOPE}" STREQUAL "ProjectSection")
+ set(RunCMake_TEST_FAILED "Improper nesting of EndProjectSection" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "Project")
+
+ set(IN_SOLUTION_ITEMS FALSE)
+
+ # Global
+ elseif(line STREQUAL "Global")
+ if(NOT "${SCOPE}" STREQUAL "")
+ set(RunCMake_TEST_FAILED "Improper nesting of Global" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "Global")
+
+ # EndGlobal
+ elseif(line STREQUAL "EndGlobal")
+ if(NOT "${SCOPE}" STREQUAL "Global")
+ set(RunCMake_TEST_FAILED "Improper nesting of EndGlobal" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "")
+
+ # GlobalSection
+ elseif(line MATCHES "GlobalSection\\(([a-zA-Z]+)\\) = ([a-zA-Z]+)")
+ if(NOT "${SCOPE}" STREQUAL "Global")
+ set(RunCMake_TEST_FAILED "Improper nesting of GlobalSection" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "GlobalSection")
+
+ if("${CMAKE_MATCH_1}" STREQUAL "NestedProjects")
+ if(NOT "${CMAKE_MATCH_2}" STREQUAL "preSolution")
+ set(RunCMake_TEST_FAILED "NestedProjects must be preSolution" PARENT_SCOPE)
+ return()
+ endif()
+
+ set(IN_NESTED_PROJECTS TRUE)
+ endif()
+
+ # EndGlobalSection
+ elseif(line STREQUAL "EndGlobalSection")
+ if(NOT "${SCOPE}" STREQUAL "GlobalSection")
+ set(RunCMake_TEST_FAILED "Improper nesting of EndGlobalSection" PARENT_SCOPE)
+ return()
+ endif()
+ set(SCOPE "Global")
+
+ set(IN_NESTED_PROJECTS FALSE)
+
+ # .../solution-item-0-1.txt = .../solution-item-0-1.txt
+ elseif(${IN_SOLUTION_ITEMS})
+ if(NOT line MATCHES "([^=]+)=([^=]+)")
+ set(RunCMake_TEST_FAILED "Invalid solution item paths 1" PARENT_SCOPE)
+ return()
+ endif()
+
+ string(STRIP "${CMAKE_MATCH_1}" CMAKE_MATCH_1)
+ string(STRIP "${CMAKE_MATCH_2}" CMAKE_MATCH_2)
+
+ if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CMAKE_MATCH_2}")
+ set(RunCMake_TEST_FAILED "Invalid solution item paths 2" PARENT_SCOPE)
+ return()
+ endif()
+
+ cmake_path(GET CMAKE_MATCH_1 FILENAME filename)
+ MapAppend(SOLUTION_ITEMS "${filename}" "${GROUP_NAME}")
+
+ # {1EB55F5E...} = {A11E84C6...}
+ elseif(${IN_NESTED_PROJECTS})
+ if(NOT line MATCHES "(${REGUID}) = (${REGUID})")
+ set(RunCMake_TEST_FAILED "Invalid nested project guids" PARENT_SCOPE)
+ return()
+ endif()
+
+ MapFind(PROJECT_PARENTS "${CMAKE_MATCH_1}" existing_parent)
+ if(DEFINED existing_parent)
+ set(RunCMake_TEST_FAILED "Duplicate nested project: '${CMAKE_MATCH_1}'" PARENT_SCOPE)
+ return()
+ endif()
+
+ MapAppend(PROJECT_PARENTS "${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
+
+ endif()
+
+ MapPropagateToParentScope(GROUP_PATHS)
+ MapPropagateToParentScope(GROUP_GUIDS)
+ MapPropagateToParentScope(PROJECT_PARENTS)
+ MapPropagateToParentScope(SOLUTION_ITEMS)
+ endforeach()
+endfunction()
+
+
+# Check the root solution:
+block()
+ ParseSln("${RunCMake_TEST_BINARY_DIR}/SolutionItems.sln")
+
+ if(DEFINED RunCMake_TEST_FAILED)
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ return()
+ endif()
+
+
+ # Check group guids and nesting:
+
+ MapFind(GROUP_GUIDS "Solution Items" root_group_guid)
+ if(NOT DEFINED root_group_guid)
+ set(RunCMake_TEST_FAILED "Solution Items not found" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(GROUP_PATHS "Solution Items" root_group_path)
+ if(NOT "${root_group_path}" STREQUAL "Solution Items")
+ set(RunCMake_TEST_FAILED "Invalid Solution Items path: '${root_group_path}'" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(PROJECT_PARENTS "${root_group_guid}" root_group_parent_guid)
+ if(DEFINED root_group_parent_guid)
+ set(RunCMake_TEST_FAILED "Solution Items is nested" PARENT_SCOPE)
+ return()
+ endif()
+
+ MapFind(GROUP_GUIDS "Outer Group" outer_group_guid)
+ if(NOT DEFINED outer_group_guid)
+ set(RunCMake_TEST_FAILED "Outer Group not found" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(GROUP_PATHS "Outer Group" outer_group_path)
+ if(NOT "${outer_group_path}" STREQUAL "Outer Group")
+ set(RunCMake_TEST_FAILED "Invalid Outer Group path: '${outer_group_path}'" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(PROJECT_PARENTS "${outer_group_guid}" outer_group_parent_guid)
+ if(DEFINED outer_group_parent_guid)
+ set(RunCMake_TEST_FAILED "Outer Group is nested" PARENT_SCOPE)
+ return()
+ endif()
+
+ MapFind(GROUP_GUIDS "Inner Group" inner_group_guid)
+ if(NOT DEFINED inner_group_guid)
+ set(RunCMake_TEST_FAILED "Inner Group not found" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(GROUP_PATHS "Inner Group" inner_group_path)
+ if(NOT "${inner_group_path}" STREQUAL "Outer Group\\Inner Group")
+ set(RunCMake_TEST_FAILED "Invalid Inner Group path: '${inner_group_path}'" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(PROJECT_PARENTS "${inner_group_guid}" inner_group_parent_guid)
+ if(NOT DEFINED inner_group_parent_guid)
+ set(RunCMake_TEST_FAILED "Inner Group is not nested" PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT "${inner_group_parent_guid}" STREQUAL "${outer_group_guid}")
+ set(RunCMake_TEST_FAILED "Inner Group is not nested within Outer Group" PARENT_SCOPE)
+ return()
+ endif()
+
+
+ # Check solution items and nesting:
+ MapLength(SOLUTION_ITEMS solution_item_count)
+ if(NOT "${solution_item_count}" EQUAL 4)
+ set(RunCMake_TEST_FAILED "Unexpected number of solution items: ${solution_item_count}")
+ return()
+ endif()
+
+ MapFind(SOLUTION_ITEMS "solution-item-0-1.txt" group_name)
+ if(NOT DEFINED group_name)
+ set(RunCMake_TEST_FAILED "Solution item not found: solution-item-0-1.txt")
+ return()
+ endif()
+ if(NOT "${group_name}" STREQUAL "Solution Items")
+ set(RunCMake_TEST_FAILED "Invalid group for solution-item-0-1.txt: '${group_name}'")
+ return()
+ endif()
+
+ MapFind(SOLUTION_ITEMS "solution-item-1-1.txt" group_name)
+ if(NOT DEFINED group_name)
+ set(RunCMake_TEST_FAILED "Solution item not found: solution-item-1-1.txt")
+ return()
+ endif()
+ if(NOT "${group_name}" STREQUAL "Outer Group")
+ set(RunCMake_TEST_FAILED "Invalid group for solution-item-1-1.txt: '${group_name}'")
+ return()
+ endif()
+
+ MapFind(SOLUTION_ITEMS "solution-item-2-1.txt" group_name)
+ if(NOT DEFINED group_name)
+ set(RunCMake_TEST_FAILED "Solution item not found: solution-item-2-1.txt")
+ return()
+ endif()
+ if(NOT "${group_name}" STREQUAL "Inner Group")
+ set(RunCMake_TEST_FAILED "Invalid group for solution-item-2-1.txt: '${group_name}'")
+ return()
+ endif()
+
+ MapFind(SOLUTION_ITEMS "solution-item-2-2.txt" group_name)
+ if(NOT DEFINED group_name)
+ set(RunCMake_TEST_FAILED "Solution item not found: solution-item-2-2.txt")
+ return()
+ endif()
+ if(NOT "${group_name}" STREQUAL "Inner Group")
+ set(RunCMake_TEST_FAILED "Invalid group for solution-item-2-2.txt: '${group_name}'")
+ return()
+ endif()
+endblock()
+
+
+# Check the nested solution:
+block()
+ ParseSln("${RunCMake_TEST_BINARY_DIR}/SolutionItems/SolutionItemsSubproject.sln")
+
+ if(DEFINED RunCMake_TEST_FAILED)
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ return()
+ endif()
+
+
+ # Check group guids and nesting:
+
+ MapFind(GROUP_GUIDS "Extraneous" root_group_guid)
+ if(NOT DEFINED root_group_guid)
+ set(RunCMake_TEST_FAILED "Extraneous not found" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(GROUP_PATHS "Extraneous" root_group_path)
+ if(NOT "${root_group_path}" STREQUAL "Extraneous")
+ set(RunCMake_TEST_FAILED "Invalid Extraneous path: '${root_group_path}'" PARENT_SCOPE)
+ return()
+ endif()
+ MapFind(PROJECT_PARENTS "${root_group_guid}" root_group_parent_guid)
+ if(DEFINED root_group_parent_guid)
+ set(RunCMake_TEST_FAILED "Extraneous is nested" PARENT_SCOPE)
+ return()
+ endif()
+
+
+ # Check solution items and nesting:
+
+ MapLength(SOLUTION_ITEMS solution_item_count)
+ if(NOT "${solution_item_count}" EQUAL 1)
+ set(RunCMake_TEST_FAILED "Unexpected number of solution items: ${solution_item_count}" PARENT_SCOPE)
+ return()
+ endif()
+
+ MapFind(SOLUTION_ITEMS "extraneous.txt" group_name)
+ if(NOT DEFINED group_name)
+ set(RunCMake_TEST_FAILED "Solution item not found: extraneous.txt" PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT "${group_name}" STREQUAL "Extraneous")
+ set(RunCMake_TEST_FAILED "Invalid group for extraneous.txt: '${group_name}'" PARENT_SCOPE)
+ return()
+ endif()
+endblock()
diff --git a/Tests/RunCMake/VS10Project/SolutionItems.cmake b/Tests/RunCMake/VS10Project/SolutionItems.cmake
new file mode 100644
index 0000000..c8a8640
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SolutionItems.cmake
@@ -0,0 +1,8 @@
+set_property(DIRECTORY APPEND PROPERTY VS_SOLUTION_ITEMS
+ solution-item-0-1.txt
+ solution-item-1-1.txt
+ "${CMAKE_CURRENT_LIST_DIR}/solution-item-2-1.txt"
+ "${CMAKE_CURRENT_LIST_DIR}/solution-item-2-2.txt")
+source_group("Outer Group" FILES solution-item-1-1.txt)
+source_group("Outer Group/Inner Group" REGULAR_EXPRESSION "solution-item-2-[0-9]+\\.txt")
+add_subdirectory(SolutionItems)
diff --git a/Tests/RunCMake/VS10Project/SolutionItems/CMakeLists.txt b/Tests/RunCMake/VS10Project/SolutionItems/CMakeLists.txt
new file mode 100644
index 0000000..320b7a5
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SolutionItems/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.10)
+project(SolutionItemsSubproject)
+set_property(DIRECTORY APPEND PROPERTY VS_SOLUTION_ITEMS extraneous.txt)
+source_group("Extraneous" REGULAR_EXPRESSION "[^.]+\\.txt")
diff --git a/Tests/RunCMake/VS10Project/SolutionItems/extraneous.txt b/Tests/RunCMake/VS10Project/SolutionItems/extraneous.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SolutionItems/extraneous.txt
diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake
index fb2eecc..3b4cc58 100644
--- a/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake
+++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0011 NEW)
-
set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupFileSet.vcxproj.filters")
if(NOT EXISTS "${vcFiltersFile}")
set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.")
diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake
index 28d0d29..3e92bb8 100644
--- a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake
+++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake
@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0011 NEW)
-
set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupTree.vcxproj.filters")
if(NOT EXISTS "${vcFiltersFile}")
set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.")
diff --git a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake
index 9c9409c..5d1ee3e 100644
--- a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake
@@ -11,7 +11,7 @@ include(${RunCMake_TEST_SOURCE_DIR}/VsCsharpSourceGroupHelpers.cmake)
set(SOURCE_GROUPS_TO_FIND
"CSharpSourceGroup\\\\foo\\.cs"
"CSharpSourceGroup\\\\nested\\\\baz\\.cs"
- "CSharpSourceGroup\\\\images\\\\empty\\.bmp"
+ "Images\\\\empty\\.bmp"
"VsCsharpSourceGroup\\.png"
"AssemblyInfo\\.cs"
)
diff --git a/Tests/RunCMake/VS10Project/my.props b/Tests/RunCMake/VS10Project/my.props
index 7c98cde..43b9ff1 100644
--- a/Tests/RunCMake/VS10Project/my.props
+++ b/Tests/RunCMake/VS10Project/my.props
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- </PropertyGroup>
+ <PropertyGroup>
+ </PropertyGroup>
</Project>
diff --git a/Tests/RunCMake/VS10Project/solution-item-0-1.txt b/Tests/RunCMake/VS10Project/solution-item-0-1.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/solution-item-0-1.txt
diff --git a/Tests/RunCMake/VS10Project/solution-item-1-1.txt b/Tests/RunCMake/VS10Project/solution-item-1-1.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/solution-item-1-1.txt
diff --git a/Tests/RunCMake/VS10Project/solution-item-2-1.txt b/Tests/RunCMake/VS10Project/solution-item-2-1.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/solution-item-2-1.txt
diff --git a/Tests/RunCMake/VS10Project/solution-item-2-2.txt b/Tests/RunCMake/VS10Project/solution-item-2-2.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/solution-item-2-2.txt
diff --git a/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h
index 69c37ed..064c4f5 100644
--- a/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h
+++ b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h
@@ -1,4 +1,5 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void lib1(void);
+extern void
+lib1(void);
diff --git a/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h
index fa24a9a..aa4d09f 100644
--- a/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h
+++ b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h
@@ -1,4 +1,5 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void lib2(void);
+extern void
+lib2(void);
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake
index 9d1ee40..48f232d 100644
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0063 NEW)
enable_language(CXX)
# Ensure CMake would warn even if toolchain does not really have these flags.
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt
deleted file mode 100644
index 7837d23..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMP0063-OLD.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0063 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/VisibilityPreset/CMP0063-OLD.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake
deleted file mode 100644
index 8378209..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-cmake_policy(SET CMP0063 OLD)
-enable_language(CXX)
-
-# Ensure CMake would warn even if toolchain does not really have these flags.
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-
-include(CMP0063-Common.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt
deleted file mode 100644
index dc45d50..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Warning \(dev\) at CMP0063-WARN-exe.cmake:[0-9]+ \(add_executable\):
- Policy CMP0063 is not set: Honor visibility properties for all target
- types. Run "cmake --help-policy CMP0063" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "myexe" of type "EXECUTABLE" has the following visibility properties
- set for CXX:
-
- CXX_VISIBILITY_PRESET
- VISIBILITY_INLINES_HIDDEN
-
- For compatibility CMake is not honoring them for this target.
-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/VisibilityPreset/CMP0063-WARN-exe.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake
deleted file mode 100644
index cef1d75..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-
-enable_language(CXX)
-
-# Ensure CMake warns even if toolchain does not really have these flags.
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
-set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-
-add_executable(myexe lib.cpp)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt
deleted file mode 100644
index c59fe7b..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.$
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake
deleted file mode 100644
index 2a9c9e5..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-
-enable_language(CXX)
-
-# Ensure CMake does not warn even if toolchain really does have these flags.
-unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN)
-unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY)
-
-include(CMP0063-Common.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt
deleted file mode 100644
index 96bd792..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Warning \(dev\) at CMP0063-WARN-obj.cmake:[0-9]+ \(add_library\):
- Policy CMP0063 is not set: Honor visibility properties for all target
- types. Run "cmake --help-policy CMP0063" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "myobject" of type "OBJECT_LIBRARY" has the following visibility
- properties set for CXX:
-
- CXX_VISIBILITY_PRESET
- VISIBILITY_INLINES_HIDDEN
-
- For compatibility CMake is not honoring them for this target.
-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/VisibilityPreset/CMP0063-WARN-obj.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake
deleted file mode 100644
index 81d1c33..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-
-enable_language(CXX)
-
-# Ensure CMake warns even if toolchain does not really have these flags.
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
-set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-
-add_library(myobject OBJECT lib.cpp)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt
deleted file mode 100644
index b945e30..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-+
-CMake Warning \(dev\) at CMP0063-WARN-sta.cmake:[0-9]+ \(add_library\):
- Policy CMP0063 is not set: Honor visibility properties for all target
- types. Run "cmake --help-policy CMP0063" for policy details. Use the
- cmake_policy command to set the policy and suppress this warning.
-
- Target "mystatic" of type "STATIC_LIBRARY" has the following visibility
- properties set for CXX:
-
- CXX_VISIBILITY_PRESET
- VISIBILITY_INLINES_HIDDEN
-
- For compatibility CMake is not honoring them for this target.
-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/VisibilityPreset/CMP0063-WARN-sta.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake
deleted file mode 100644
index 132e076..0000000
--- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-
-enable_language(CXX)
-
-# Ensure CMake warns even if toolchain does not really have these flags.
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
-set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-
-add_library(mystatic STATIC lib.cpp)
diff --git a/Tests/RunCMake/VisibilityPreset/CMakeLists.txt b/Tests/RunCMake/VisibilityPreset/CMakeLists.txt
index 69e0236..bf2ef15 100644
--- a/Tests/RunCMake/VisibilityPreset/CMakeLists.txt
+++ b/Tests/RunCMake/VisibilityPreset/CMakeLists.txt
@@ -1,6 +1,3 @@
cmake_minimum_required(VERSION 3.10)
-if(RunCMake_TEST MATCHES "CMP0063-(OLD|WARN)")
- cmake_policy(VERSION 3.2) # old enough to not set CMP0063
-endif()
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake
index 133dbe1..6b5541a 100644
--- a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake
@@ -1,10 +1,4 @@
include(RunCMake)
-set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
run_cmake(PropertyTypo)
-run_cmake(CMP0063-OLD)
-run_cmake(CMP0063-WARN-exe)
-run_cmake(CMP0063-WARN-obj)
-run_cmake(CMP0063-WARN-sta)
-run_cmake(CMP0063-WARN-no)
run_cmake(CMP0063-NEW)
diff --git a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
index 151b907..2f9fc7d 100644
--- a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0053 NEW)
include(RunCMake)
run_cmake(VsDotnetSdkStartupObject)
diff --git a/Tests/RunCMake/VsNugetPackageRestore/RunCMakeTest.cmake b/Tests/RunCMake/VsNugetPackageRestore/RunCMakeTest.cmake
index 625167c..8ca966f 100644
--- a/Tests/RunCMake/VsNugetPackageRestore/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VsNugetPackageRestore/RunCMakeTest.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0053 NEW)
include(RunCMake)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VsNugetPackageRestore)
diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt
index da89317..a0098e7 100644
--- a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt
+++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt
@@ -1 +1 @@
-Failed to change working directory to .*[/\\]buildAndTestNoBuildDir[/\\]CMakeLists.txt :
+Failed to change working directory to ".*[/\\]buildAndTestNoBuildDir[/\\]CMakeLists.txt": (Not a directory|Invalid argument)
diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt
index 3cea890..21d288e 100644
--- a/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt
+++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt
@@ -1 +1 @@
-Failed to change working directory to .*[/\\]dirNotExist-build[/\\]thisDirWillNotExist :
+Failed to change working directory to ".*[/\\]dirNotExist-build[/\\]thisDirWillNotExist": No such file or directory
diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake
index 64505ff..8c8d970 100644
--- a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake
@@ -104,17 +104,17 @@ create_xcframework(framework framework "${xcframework_platforms}")
create_xcframework(incomplete framework "tvos;watchos")
create_executables(library library)
create_executables(framework framework)
-run_cmake_with_options(create-executable-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
+run_cmake_with_options(create-executable-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DCMAKE_OSX_SYSROOT=macosx -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
create_executables(target-library library)
create_executables(target-framework framework)
-run_cmake_with_options(create-executable-target-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
+run_cmake_with_options(create-executable-target-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DCMAKE_OSX_SYSROOT=macosx -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 12)
create_executables(library-link-phase library)
create_executables(framework-link-phase framework)
- run_cmake_with_options(create-executable-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
+ run_cmake_with_options(create-executable-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DCMAKE_OSX_SYSROOT=macosx -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
create_executables(target-library-link-phase library)
create_executables(target-framework-link-phase framework)
- run_cmake_with_options(create-executable-target-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
+ run_cmake_with_options(create-executable-target-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DCMAKE_OSX_SYSROOT=macosx -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework)
endif()
# Ensure that .xcframework is found before .framework
diff --git a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake
index b61b7fc..64abfb5 100644
--- a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake
@@ -307,6 +307,7 @@ if (XCODE_VERSION VERSION_GREATER_EQUAL 7.3)
if(BuildSystemVersion)
set(RunCMake_GENERATOR_TOOLSET "buildsystem=${BuildSystemVersion}")
endif()
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-${SystemName}-${SDK}")
run_cmake(XCTestAddBundle)
endfunction()
diff --git a/Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake b/Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake
index 9114fee..519dbe5 100644
--- a/Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake
+++ b/Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake
@@ -10,13 +10,20 @@ add_executable(TestedApp MACOSX_BUNDLE dummy_main.swift)
xctest_add_bundle(TestingAppBundle TestedApp dummy_main.swift)
-get_target_property(_lib_output_dir TestingAppBundle LIBRARY_OUTPUT_DIRECTORY)
+macro(add_test NAME name COMMAND xctest arg)
+ set(actual_arg "${arg}" PARENT_SCOPE)
+endmacro()
-if (NOT DEFINED TEST_EXPECTED_OUTPUT_DIR)
- message(FATAL_ERROR "Testing variable TEST_EXPECTED_OUTPUT_DIR is not set")
-endif()
+xctest_add_test(TestedApp.TestingAppBundle TestingAppBundle)
-if (NOT _lib_output_dir STREQUAL TEST_EXPECTED_OUTPUT_DIR)
- message(SEND_ERROR "Property LIBRARY_OUTPUT_DIRECTORY is expected to be ${TEST_EXPECTED_OUTPUT_DIR} "
- "but was ${_lib_output_dir}")
+if(NOT DEFINED TEST_EXPECTED_OUTPUT_DIR)
+ message(FATAL_ERROR "Testing variable TEST_EXPECTED_OUTPUT_DIR is not set")
+endif()
+set(expect_arg "${TEST_EXPECTED_OUTPUT_DIR}/$<TARGET_BUNDLE_DIR_NAME:TestingAppBundle>")
+if(NOT "${actual_arg}" STREQUAL "${expect_arg}")
+ message(FATAL_ERROR "xctest argument expected to be:\n"
+ " ${expect_arg}\n"
+ "but was:\n"
+ " ${actual_arg}\n"
+ )
endif()
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn-build-check.cmake
new file mode 100644
index 0000000..241ab68
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn-build-check.cmake
@@ -0,0 +1,9 @@
+set(in_app1 "${RunCMake_TEST_BINARY_DIR}/Debug/app1.app/Contents/Frameworks/TestLib.framework/Headers")
+if(NOT EXISTS "${in_app1}")
+ string(APPEND RunCMake_TEST_FAILED "TestLib was embedded without Headers in:\n ${in_app1}\n")
+endif()
+
+set(in_app2 "${RunCMake_TEST_BINARY_DIR}/Debug/app2.app/Contents/Frameworks/TestLib.framework/Headers")
+if(EXISTS "${in_app2}")
+ string(APPEND RunCMake_TEST_FAILED "TestLib was embedded with Headers in:\n ${in_app2}\n")
+endif()
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn.cmake
new file mode 100644
index 0000000..5faf3d9
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOffAndOn.cmake
@@ -0,0 +1,27 @@
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
+
+try_compile(TESTLIB_FRAMEWORK_COMPILED
+ PROJECT TestLib
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/TestLib
+ BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/TestLib
+ )
+if(NOT TESTLIB_FRAMEWORK_COMPILED)
+ message(FATAL_ERROR "TestLib.framework did not compile")
+endif()
+set(TestLib_framework "${CMAKE_CURRENT_BINARY_DIR}/TestLib/Debug/TestLib.framework")
+if(NOT EXISTS "${TestLib_framework}/Headers/TestLib.h")
+ message(FATAL_ERROR "TestLib.framework did not build with header")
+endif()
+
+add_executable(app1 MACOSX_BUNDLE main.m)
+add_executable(app2 MACOSX_BUNDLE main.m)
+
+set_target_properties(app1 PROPERTIES
+ XCODE_EMBED_FRAMEWORKS "${CMAKE_CURRENT_BINARY_DIR}/TestLib/Debug/TestLib.framework"
+ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY OFF
+)
+
+set_target_properties(app2 PROPERTIES
+ XCODE_EMBED_FRAMEWORKS "${CMAKE_CURRENT_BINARY_DIR}/TestLib/Debug/TestLib.framework"
+ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON
+)
diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
index 77ac63f..26749cd 100644
--- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
@@ -45,6 +45,18 @@ foreach(dependency ${externalFramework} ${externalDylib})
endforeach()
unset(RunCMake_TEST_OPTIONS)
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EmbedFrameworksFlagsOffAndOn-build)
+ run_cmake(EmbedFrameworksFlagsOffAndOn)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(EmbedFrameworksFlagsOffAndOn-build
+ ${CMAKE_COMMAND} --build .
+ --config Debug
+ --target app1
+ --target app2
+ )
+endblock()
+
function(TestAppExtension platform)
set(testName EmbedAppExtensions-${platform})
if(NOT platform STREQUAL "macOS")
diff --git a/Tests/RunCMake/XcodeProject-Embed/TestLib/CMakeLists.txt b/Tests/RunCMake/XcodeProject-Embed/TestLib/CMakeLists.txt
new file mode 100644
index 0000000..eb651c2
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/TestLib/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.30)
+project(TestLib C)
+add_library(TestLib SHARED TestLib.c TestLib.h)
+set_target_properties(TestLib PROPERTIES
+ FRAMEWORK 1
+ PUBLIC_HEADER TestLib.h
+ )
diff --git a/Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.c b/Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.c
new file mode 100644
index 0000000..a39723a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.c
@@ -0,0 +1,3 @@
+void TestLib(void)
+{
+}
diff --git a/Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.h b/Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.h
new file mode 100644
index 0000000..c9c0186
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/TestLib/TestLib.h
@@ -0,0 +1 @@
+extern void TestLib(void);
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
index b42e933..2fafdab 100644
--- a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
@@ -45,6 +45,7 @@ endforeach()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/CMakeLists.txt
[[
+cmake_minimum_required(VERSION 3.31)
project(ExternalFrameworks)
add_library(staticFrameworkExt STATIC func6.c)
add_library(sharedFrameworkExt SHARED func7.c)
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
index 6bad527..ec0aed2 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -1,23 +1,78 @@
function(check_property property matcher)
set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme")
+ file(READ ${schema} schema-content-${property})
+ string(REGEX MATCHALL "${matcher}" matched-${property} ${schema-content-${property}})
+ if(NOT matched-${property})
+ string(APPEND RunCMake_TEST_FAILED
+ "Xcode schema property ${property}: Could not find\n"
+ " ${matcher}\n"
+ "in schema\n"
+ " ${schema}\n"
+ )
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(check_property_count property matcher expected_count)
+ set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme")
file(STRINGS ${schema} actual-${property}
- REGEX "${matcher}" LIMIT_COUNT 1)
+ REGEX "${matcher}")
if(NOT actual-${property})
- message(SEND_ERROR "Xcode schema property ${property}: Could not find ${matcher} in schema ${schema}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Xcode schema property ${property}: Could not find\n"
+ " ${matcher}\n"
+ "in schema\n"
+ " ${schema}\n"
+ )
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ return()
+ endif()
+ list(LENGTH actual-${property} match_count)
+ if(NOT ${expected_count} EQUAL ${match_count})
+ string(APPEND RunCMake_TEST_FAILED
+ "Xcode schema property ${property}: Expected ${expected_count} matches of\n"
+ " ${matcher}\n"
+ "in schema\n"
+ " ${schema}\n"
+ "but found ${match_count}.\n\n"
+ )
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(check_no_property property matcher)
+ set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme")
+ file(STRINGS ${schema} actual-${property}
+ REGEX "${matcher}" LIMIT_COUNT 1)
+ if(actual-${property})
+ string(APPEND RunCMake_TEST_FAILED
+ "Xcode schema property ${property}: Found\n"
+ " ${matcher}\n"
+ "which is not expected in schema\n"
+ " ${schema}\n"
+ )
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endif()
endfunction()
function(expect_schema target)
set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme")
if(NOT EXISTS ${schema})
- message(SEND_ERROR "Missing schema for target ${target}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Missing schema for target ${target}\n"
+ )
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endif()
endfunction()
function(expect_no_schema target)
set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme")
if(EXISTS ${schema})
- message(SEND_ERROR "Found unexpected schema ${schema}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Found unexpected schema\n"
+ " ${schema}\n"
+ )
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endif()
endfunction()
@@ -47,6 +102,15 @@ check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFra
check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"")
check_property("LAUNCH_MODE_AUTO" "launchStyle=\"0\"")
check_property("LAUNCH_MODE_WAIT" "launchStyle=\"1\"")
+check_property("LAUNCH_CONFIGURATION_EMPTY" "<LaunchAction.*buildConfiguration=\"Debug\".*</LaunchAction>")
+check_property("LAUNCH_CONFIGURATION_DEBUG" "<LaunchAction.*buildConfiguration=\"Debug\".*</LaunchAction>")
+check_property("LAUNCH_CONFIGURATION_RELEASE" "<LaunchAction.*buildConfiguration=\"Release\".*</LaunchAction>")
+check_property("TEST_CONFIGURATION_EMPTY" "<TestAction.*buildConfiguration=\"Debug\".*</TestAction>")
+check_property("TEST_CONFIGURATION_DEBUG" "<TestAction.*buildConfiguration=\"Debug\".*</TestAction>")
+check_property("TEST_CONFIGURATION_RELEASE" "<TestAction.*buildConfiguration=\"Release\".*</TestAction>")
+check_no_property("LLDB_INIT_FILE_EMPTY" "customLLDBInitFile")
+check_property_count("LLDB_INIT_FILE_EVAL" "customLLDBInitFile=\"${RunCMake_TEST_BINARY_DIR}/.lldbinit\"" 2)
+check_property_count("LLDB_INIT_FILE_FULL" "customLLDBInitFile=\"/full/path/to/.lldbinit\"" 2)
check_property("EXECUTABLE" "myExecutable")
check_property("ARGUMENTS" [=["--foo"]=])
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
index 05a8976..9af1ac8 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -40,6 +40,15 @@ create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE ENA
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE METal)
create_scheme_for_property(LAUNCH_MODE_AUTO LAUNCH_MODE AUTO)
create_scheme_for_property(LAUNCH_MODE_WAIT LAUNCH_MODE WAIT)
+create_scheme_for_property(LAUNCH_CONFIGURATION_EMPTY LAUNCH_CONFIGURATION "")
+create_scheme_for_property(LAUNCH_CONFIGURATION_DEBUG LAUNCH_CONFIGURATION "Debug")
+create_scheme_for_property(LAUNCH_CONFIGURATION_RELEASE LAUNCH_CONFIGURATION "Release")
+create_scheme_for_property(TEST_CONFIGURATION_EMPTY TEST_CONFIGURATION "")
+create_scheme_for_property(TEST_CONFIGURATION_DEBUG TEST_CONFIGURATION "Debug")
+create_scheme_for_property(TEST_CONFIGURATION_RELEASE TEST_CONFIGURATION "Release")
+create_scheme_for_property(LLDB_INIT_FILE_EMPTY LLDB_INIT_FILE "")
+create_scheme_for_property(LLDB_INIT_FILE_EVAL LLDB_INIT_FILE "${CMAKE_BINARY_DIR}/.lldbinit")
+create_scheme_for_property(LLDB_INIT_FILE_FULL LLDB_INIT_FILE "/full/path/to/.lldbinit")
create_scheme_for_property(EXECUTABLE EXECUTABLE myExecutable)
create_scheme_for_property(ARGUMENTS ARGUMENTS "--foo;--bar=baz")
create_scheme_for_property(ENVIRONMENT ENVIRONMENT "FOO=foo;BAR=bar")
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index 820591c..82049f2 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -16,8 +16,7 @@ run_cmake(LiteralQuotes)
run_cmake(NoArguments)
run_cmake(NoOutputOrTarget)
run_cmake(OutputAndTarget)
-run_cmake(SourceByproducts)
-run_cmake(SourceUsesTerminal)
+run_cmake(SOURCE)
run_cmake(TargetImported)
run_cmake(TargetLiteralQuotes)
run_cmake(TargetNotInDir)
diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/add_custom_command/SOURCE-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-result.txt
+++ b/Tests/RunCMake/add_custom_command/SOURCE-result.txt
diff --git a/Tests/RunCMake/add_custom_command/SOURCE-stderr.txt b/Tests/RunCMake/add_custom_command/SOURCE-stderr.txt
new file mode 100644
index 0000000..95d3a5d
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/SOURCE-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at SOURCE.cmake:[0-9]+ \(add_custom_command\):
+ The SOURCE signatures of add_custom_command are no longer supported.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/add_custom_command/SOURCE.cmake b/Tests/RunCMake/add_custom_command/SOURCE.cmake
new file mode 100644
index 0000000..1b464fb
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/SOURCE.cmake
@@ -0,0 +1,10 @@
+add_library(empty empty.cpp)
+add_custom_command(
+ TARGET empty
+ SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/input.h
+ OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h
+ DEPENDS ${CMAKE_COMMAND}
+)
diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt b/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt
deleted file mode 100644
index a9cd64c..0000000
--- a/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at SourceByproducts.cmake:1 \(add_custom_command\):
- add_custom_command BYPRODUCTS may not be specified with SOURCE signatures
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts.cmake b/Tests/RunCMake/add_custom_command/SourceByproducts.cmake
deleted file mode 100644
index 824f41d..0000000
--- a/Tests/RunCMake/add_custom_command/SourceByproducts.cmake
+++ /dev/null
@@ -1 +0,0 @@
-add_custom_command(SOURCE t TARGET t BYPRODUCTS b)
diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt
deleted file mode 100644
index 1a76c54..0000000
--- a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at SourceUsesTerminal.cmake:1 \(add_custom_command\):
- add_custom_command USES_TERMINAL may not be used with SOURCE signatures
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake b/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake
deleted file mode 100644
index 295fab1..0000000
--- a/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake
+++ /dev/null
@@ -1 +0,0 @@
-add_custom_command(SOURCE t TARGET t USES_TERMINAL)
diff --git a/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt
index f352457..f3e7d05 100644
--- a/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt
+++ b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt
@@ -1,17 +1,17 @@
CMake Error at BadTargetName.cmake:1 \(add_custom_target\):
- add_custom_target called with target name containing a "#". This character
- is not allowed.
+ The target name "#" is reserved or not valid for certain CMake features,
+ such as generator expressions, and may result in undefined behavior\.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadTargetName.cmake:2 \(add_custom_target\):
- add_custom_target called with target name containing a "<". This character
- is not allowed.
+ The target name "<" is reserved or not valid for certain CMake features,
+ such as generator expressions, and may result in undefined behavior\.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadTargetName.cmake:3 \(add_custom_target\):
- add_custom_target called with target name containing a ">". This character
- is not allowed.
+ The target name ">" is reserved or not valid for certain CMake features,
+ such as generator expressions, and may result in undefined behavior\.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/alias_targets/invalid-name-stderr.txt b/Tests/RunCMake/alias_targets/invalid-name-stderr.txt
index d33b57c..006ef37 100644
--- a/Tests/RunCMake/alias_targets/invalid-name-stderr.txt
+++ b/Tests/RunCMake/alias_targets/invalid-name-stderr.txt
@@ -1,4 +1,6 @@
-CMake Error at invalid-name.cmake:6 \(add_library\):
- add_library Invalid name for ALIAS: invalid\$name
+^CMake Error at invalid-name\.cmake:3 \(add_library\):
+ The target name "invalid\$name" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior\.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/alias_targets/invalid-name.cmake b/Tests/RunCMake/alias_targets/invalid-name.cmake
index e2ebbfa..13e939c 100644
--- a/Tests/RunCMake/alias_targets/invalid-name.cmake
+++ b/Tests/RunCMake/alias_targets/invalid-name.cmake
@@ -1,6 +1,3 @@
-cmake_policy(SET CMP0037 OLD)
enable_language(CXX)
-
add_library(foo empty.cpp)
-
add_library(invalid$name ALIAS foo)
diff --git a/Tests/RunCMake/block/Scope-POLICIES-stderr.txt b/Tests/RunCMake/block/Scope-POLICIES-stderr.txt
new file mode 100644
index 0000000..84b99aa
--- /dev/null
+++ b/Tests/RunCMake/block/Scope-POLICIES-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Scope-POLICIES\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0139 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/block/Scope-VARIABLES-stderr.txt b/Tests/RunCMake/block/Scope-VARIABLES-stderr.txt
new file mode 100644
index 0000000..458daa7
--- /dev/null
+++ b/Tests/RunCMake/block/Scope-VARIABLES-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Scope-VARIABLES\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0139 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/block/Scope-stderr.txt b/Tests/RunCMake/block/Scope-stderr.txt
new file mode 100644
index 0000000..af84e88
--- /dev/null
+++ b/Tests/RunCMake/block/Scope-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Scope\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0139 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/build_command/CMP0061-NEW.cmake b/Tests/RunCMake/build_command/CMP0061-NEW.cmake
index 2e439cb..e0b3beb 100644
--- a/Tests/RunCMake/build_command/CMP0061-NEW.cmake
+++ b/Tests/RunCMake/build_command/CMP0061-NEW.cmake
@@ -1,2 +1 @@
-cmake_policy(SET CMP0061 NEW)
include(CMP0061Common.cmake)
diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt
deleted file mode 100644
index 1938da3..0000000
--- a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-^CMake Deprecation Warning at CMP0061-OLD-make.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0061 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\)
-+
-[^
-]+ --build \. --config "Release" -- -i
-[^
-]+ --build \. --config "Release" --target "MyTarget" -- -i
-[^
-]+ --build \. --config "Debug" -- -i
-[^
-]+ --build \. --config "Debug" --target "MyTarget" -- -i
-[^
-]+ --build \. --config "Release" -- -i$
diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make.cmake b/Tests/RunCMake/build_command/CMP0061-OLD-make.cmake
deleted file mode 100644
index 1542d8c..0000000
--- a/Tests/RunCMake/build_command/CMP0061-OLD-make.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0061 OLD)
-include(CMP0061Common.cmake)
diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt
deleted file mode 100644
index 85bbdf1..0000000
--- a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-^CMake Deprecation Warning at CMP0061-OLD-other.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0061 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\)
-+
-[^
-]+ --build \. --config "Release"
-[^
-]+ --build \. --config "Release" --target "MyTarget"
-[^
-]+ --build \. --config "Debug"
-[^
-]+ --build \. --config "Debug" --target "MyTarget"
-[^
-]+ --build \. --config "Release"$
diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other.cmake b/Tests/RunCMake/build_command/CMP0061-OLD-other.cmake
deleted file mode 100644
index 1542d8c..0000000
--- a/Tests/RunCMake/build_command/CMP0061-OLD-other.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0061 OLD)
-include(CMP0061Common.cmake)
diff --git a/Tests/RunCMake/build_command/RunCMakeTest.cmake b/Tests/RunCMake/build_command/RunCMakeTest.cmake
index 030db0b..0e05bd9 100644
--- a/Tests/RunCMake/build_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/build_command/RunCMakeTest.cmake
@@ -9,10 +9,5 @@ run_cmake(BeforeProject)
unset(RunCMake_TEST_OPTIONS)
run_cmake(CMP0061-NEW)
-if(RunCMake_GENERATOR MATCHES "Make")
- run_cmake(CMP0061-OLD-make)
-else()
- run_cmake(CMP0061-OLD-other)
-endif()
run_cmake(ParallelLevel)
diff --git a/Tests/RunCMake/cmake_host_system_information/MacOS-stdout.txt b/Tests/RunCMake/cmake_host_system_information/MacOS-stdout.txt
new file mode 100644
index 0000000..c86ae92
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MacOS-stdout.txt
@@ -0,0 +1 @@
+-- os_name='(macOS|Mac OS X)'
diff --git a/Tests/RunCMake/cmake_host_system_information/MacOS.cmake b/Tests/RunCMake/cmake_host_system_information/MacOS.cmake
new file mode 100644
index 0000000..d0d213a
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MacOS.cmake
@@ -0,0 +1,3 @@
+set(ENV{MallocGuardEdges} 1) # test tolerating sw_vers stderr
+cmake_host_system_information(RESULT os_name QUERY OS_NAME)
+message(STATUS "os_name='${os_name}'")
diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadView2-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadView2-stderr.txt
index 201d93a..5a80e7e 100644
--- a/Tests/RunCMake/cmake_host_system_information/Registry_BadView2-stderr.txt
+++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadView2-stderr.txt
@@ -1,4 +1,4 @@
CMake Error at Registry_BadView2.cmake:[0-9]+ \(cmake_host_system_information\):
- cmake_host_system_information given invalid value for "VIEW": BAD_VIEW.
+ cmake_host_system_information given invalid value for VIEW: BAD_VIEW.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
index 76dff4f..3917913 100644
--- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
@@ -14,6 +14,10 @@ run_cmake(Ubuntu)
run_cmake(CentOS6)
run_cmake(Debian6)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ run_cmake(MacOS)
+endif()
+
run_cmake(UserFallbackScript)
if(RunCMake_GENERATOR MATCHES "Visual Studio")
diff --git a/Tests/RunCMake/cmake_host_system_information/UnitTest-stdout.txt b/Tests/RunCMake/cmake_host_system_information/UnitTest-stdout.txt
index db6f487..f760506 100644
--- a/Tests/RunCMake/cmake_host_system_information/UnitTest-stdout.txt
+++ b/Tests/RunCMake/cmake_host_system_information/UnitTest-stdout.txt
@@ -1,7 +1,7 @@
-- UNIT_TEST_A_LIST_LIKE_VARIABLE=`satu;dua;tiga`
-- UNIT_TEST_DBL_QUOTED_VALUE=`"The" value in double "quotes"`
--- UNIT_TEST_DBL_QUOTED_VALUE_STIPPED_COMMENT=`Blah blah blah`
+-- UNIT_TEST_DBL_QUOTED_VALUE_STRIPPED_COMMENT=`Blah blah blah`
-- UNIT_TEST_NON_SPACE_VALUE=`Blah-blah-blah`
-- UNIT_TEST_QUOTED_VALUE=`'The' value in single 'quotes'`
--- UNIT_TEST_QUOTED_VALUE_STIPPED_COMMENT=`The value in single quotes`
+-- UNIT_TEST_QUOTED_VALUE_STRIPPED_COMMENT=`The value in single quotes`
-- UNIT_TEST_THE_URL_WITH_ANCHOR_TEST=`https://blah.blah/resource#anchor`
diff --git a/Tests/RunCMake/cmake_host_system_information/UnitTest/etc/os-release b/Tests/RunCMake/cmake_host_system_information/UnitTest/etc/os-release
index 66c33b5..6d5a308 100644
--- a/Tests/RunCMake/cmake_host_system_information/UnitTest/etc/os-release
+++ b/Tests/RunCMake/cmake_host_system_information/UnitTest/etc/os-release
@@ -1,9 +1,9 @@
# Comment string gonna be ignored
NON_SPACE_VALUE=Blah-blah-blah
QUOTED_VALUE='\'The\' value in single \'quotes\''
-QUOTED_VALUE_STIPPED_COMMENT='The value in single quotes'# The comment right after `'`
+QUOTED_VALUE_STRIPPED_COMMENT='The value in single quotes'# The comment right after `'`
DBL_QUOTED_VALUE="\"The\" value in double \"quotes\""
-DBL_QUOTED_VALUE_STIPPED_COMMENT="Blah blah blah"# The comment right after `'`
+DBL_QUOTED_VALUE_STRIPPED_COMMENT="Blah blah blah"# The comment right after `'`
THE_URL_WITH_ANCHOR_TEST="https://blah.blah/resource#anchor" # And a comment after
A_LIST_LIKE_VARIABLE='satu;dua;tiga'
INCORRECT_ESCAPE_IGNORED=\'This line gonna be ignored'
diff --git a/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake
index f9e22c5..517cc2b 100644
--- a/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake
+++ b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake
@@ -1,5 +1,5 @@
set(CMAKE_EXPERIMENTAL_WINDOWS_KERNEL_MODE_DRIVER
- "fac18f65-504e-4dbb-b068-f356bb1f2ddb")
+ "9157bf90-2313-44d6-aefa-67cd83c8be7c")
cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
"WindowsKernelModeDriver"
diff --git a/Tests/RunCMake/cmake_language/defer_call-stderr.txt b/Tests/RunCMake/cmake_language/defer_call-stderr.txt
index 7e8d8ca..d1ae0d7 100644
--- a/Tests/RunCMake/cmake_language/defer_call-stderr.txt
+++ b/Tests/RunCMake/cmake_language/defer_call-stderr.txt
@@ -1,13 +1,4 @@
-^CMake Deprecation Warning at defer_call/CMakeLists.txt:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0053 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.
-+
-CMake Warning at defer_call/CMakeLists.txt:3 \(message\):
+^CMake Warning at defer_call/CMakeLists.txt:2 \(message\):
Double-Deferred Warning In Subdirectory:
'[^']*/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt:DEFERRED:id3'
diff --git a/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt
index 544b9f4..ea29985 100644
--- a/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt
+++ b/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0053 OLD)
cmake_language(DEFER ID id1 CALL message STATUS "Deferred Message In Subdirectory: '${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}'")
cmake_language(DEFER ID id2 CALL
cmake_language DEFER ID id3 CALL
diff --git a/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt
deleted file mode 100644
index 4a6f16d..0000000
--- a/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-CMake Warning \(dev\) at Before24.cmake:1 \(cmake_minimum_required\):
- Compatibility with CMake < 2.4 is not supported by CMake >= 3.0.
-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_minimum_required/Before24.cmake b/Tests/RunCMake/cmake_minimum_required/Before24.cmake
deleted file mode 100644
index c28fc8a..0000000
--- a/Tests/RunCMake/cmake_minimum_required/Before24.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_minimum_required(VERSION 2.2)
diff --git a/Tests/RunCMake/cmake_minimum_required/Before3_10-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Before3_10-stderr.txt
deleted file mode 100644
index 4a6842b..0000000
--- a/Tests/RunCMake/cmake_minimum_required/Before3_10-stderr.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-^CMake Deprecation Warning at Before3_10\.cmake:1 \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
-CMake Deprecation Warning at Before3_10\.cmake:2 \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
-CMake Deprecation Warning at Before3_10\.cmake:6 \(cmake_policy\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/cmake_minimum_required/Before3_10.cmake b/Tests/RunCMake/cmake_minimum_required/Before3_10.cmake
deleted file mode 100644
index 0b010ef..0000000
--- a/Tests/RunCMake/cmake_minimum_required/Before3_10.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake_minimum_required(VERSION 3.9)
-cmake_policy(VERSION 2.6)
-cmake_policy(PUSH)
-cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call
-cmake_policy(POP)
-cmake_policy(VERSION 3.9)
diff --git a/Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated-stderr.txt b/Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated-stderr.txt
new file mode 100644
index 0000000..0a796b9
--- /dev/null
+++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated-stderr.txt
@@ -0,0 +1,19 @@
+^CMake Deprecation Warning at BeforeVersionDeprecated\.cmake:1 \(cmake_minimum_required\):
+ Compatibility with CMake < 3\.10 will be removed from a future version of
+ CMake\.
+
+ Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
+ to tell CMake that the project requires at least <min> but has been updated
+ to work with policies introduced by <max> or earlier\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Deprecation Warning at BeforeVersionDeprecated\.cmake:5 \(cmake_policy\):
+ Compatibility with CMake < 3\.10 will be removed from a future version of
+ CMake\.
+
+ Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
+ to tell CMake that the project requires at least <min> but has been updated
+ to work with policies introduced by <max> or earlier\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated.cmake b/Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated.cmake
new file mode 100644
index 0000000..ff23898
--- /dev/null
+++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionDeprecated.cmake
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.9)
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call
+cmake_policy(POP)
+cmake_policy(VERSION 3.9)
diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-result.txt
+++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-result.txt
diff --git a/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt
new file mode 100644
index 0000000..f2f41af
--- /dev/null
+++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at BeforeVersionRemoved\.cmake:1 \(cmake_minimum_required\):
+ Compatibility with CMake < 3\.5 has been removed from CMake\.
+
+ Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
+ to tell CMake that the project requires at least <min> but has been updated
+ to work with policies introduced by <max> or earlier\.
+
+ Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3\.5 to try configuring anyway\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake
new file mode 100644
index 0000000..c530a16
--- /dev/null
+++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake
@@ -0,0 +1 @@
+cmake_minimum_required(VERSION 3.4)
diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt
deleted file mode 100644
index 1363d09..0000000
--- a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-^CMake Deprecation Warning at CompatBefore24\.cmake:1 \(cmake_minimum_required\):
- Compatibility with CMake < 3\.10 will be removed from a future version of
- CMake\.
-
- Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
- to tell CMake that the project requires at least <min> but has been updated
- to work with policies introduced by <max> or earlier\.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
-CMake Error in CMakeLists.txt:
- You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less than
- 2.4. This version of CMake only supports backwards compatibility with
- CMake 2.4 or later. For compatibility with older versions please use any
- CMake 2.8.x release or lower.
diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake b/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake
deleted file mode 100644
index ca0cb1d..0000000
--- a/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_minimum_required(VERSION 2.4)
-set(CMAKE_BACKWARDS_COMPATIBILITY 2.2)
diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt
deleted file mode 100644
index 840211a..0000000
--- a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CMake Error at PolicyBefore24.cmake:2 \(cmake_policy\):
- Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. For
- compatibility with older versions please use any CMake 2.8.x release or
- lower.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake
deleted file mode 100644